diff --git a/CHANGES.md b/CHANGES.md index 4d2691aef771e114b9210ad7bd0f6c24a75c0cb2..8665d731992b4b47e22b2700e299d2e489595a8f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2021-02-05 - Improvement: Add missing catch branch in Back-to-top button JS * 2021-02-05 - Bugfix: Moodle core Back-to-top button was not clickable over Boost Campus footer * 2021-02-05 - Move Moodle Plugin CI from Travis CI to Github actions diff --git a/amd/build/backtotop.min.js b/amd/build/backtotop.min.js index 9f557e67effc332281bdd1c03d4477f2c447677a..cff91ae7de3ad52f49cd81a4b69ff74010de85c2 100644 --- a/amd/build/backtotop.min.js +++ b/amd/build/backtotop.min.js @@ -1,2 +1,2 @@ -define ("theme_boost_campus/backtotop",["jquery","core/str"],function(a,b){"use strict";function c(){b.get_string("backtotop","theme_boost_campus").then(function(b){a("#page-footer").after("<i class=\"fa fa-chevron-up fa-2x d-print-none\"id=\"back-to-top\" aria-label=\""+b+"\"></i>");a(window).scroll(function(){if(220<a(document).scrollTop()){a("#back-to-top").fadeIn(300)}else{a("#back-to-top").fadeOut(100)}});a("#back-to-top").click(function(b){b.preventDefault();a("html, body").animate({scrollTop:0},500)})})}return{init:function init(){c()}}}); +define ("theme_boost_campus/backtotop",["jquery","core/str","core/notification"],function(a,b,c){"use strict";function d(){var d=b.get_string("backtotop","theme_boost_campus");a.when(d).then(function(b){a("#page-footer").after("<i class=\"fa fa-chevron-up fa-2x d-print-none\"id=\"back-to-top\" aria-label=\""+b+"\"></i>");a(window).scroll(function(){if(220<a(document).scrollTop()){a("#back-to-top").fadeIn(300)}else{a("#back-to-top").fadeOut(100)}});a("#back-to-top").click(function(b){b.preventDefault();a("html, body").animate({scrollTop:0},500)});return!0}).fail(c.exception)}return{init:function init(){d()}}}); //# sourceMappingURL=backtotop.min.js.map diff --git a/amd/build/backtotop.min.js.map b/amd/build/backtotop.min.js.map index a6122c5d2ff048d025b1a6a77a0c5c7dd7925d7d..178e0f970d97b057c0efc24e1864d46e5c2072d6 100644 --- a/amd/build/backtotop.min.js.map +++ b/amd/build/backtotop.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/backtotop.js"],"names":["define","$","str","initBackToTop","get_string","then","string","after","window","scroll","document","scrollTop","fadeIn","fadeOut","click","event","preventDefault","animate","init"],"mappings":"AAyBAA,OAAM,gCAAC,CAAC,QAAD,CAAW,UAAX,CAAD,CAAyB,SAASC,CAAT,CAAYC,CAAZ,CAAiB,CAC5C,aAKA,QAASC,CAAAA,CAAT,EAAyB,CAErBD,CAAG,CAACE,UAAJ,CAAe,WAAf,CAA4B,oBAA5B,EAAkDC,IAAlD,CAAuD,SAAUC,CAAV,CAAkB,CAErEL,CAAC,CAAC,cAAD,CAAD,CAAkBM,KAAlB,CAAwB,mFACcD,CADd,CACuB,SAD/C,EAKAL,CAAC,CAACO,MAAD,CAAD,CAAUC,MAAV,CAAiB,UAAW,CACxB,GAA8B,GAA1B,CAAAR,CAAC,CAACS,QAAD,CAAD,CAAYC,SAAZ,EAAJ,CAAmC,CAC/BV,CAAC,CAAC,cAAD,CAAD,CAAkBW,MAAlB,CAAyB,GAAzB,CACH,CAFD,IAEO,CACHX,CAAC,CAAC,cAAD,CAAD,CAAkBY,OAAlB,CAA0B,GAA1B,CACH,CACJ,CAND,EASAZ,CAAC,CAAC,cAAD,CAAD,CAAkBa,KAAlB,CAAwB,SAASC,CAAT,CAAgB,CACpCA,CAAK,CAACC,cAAN,GACAf,CAAC,CAAC,YAAD,CAAD,CAAgBgB,OAAhB,CAAwB,CAACN,SAAS,CAAE,CAAZ,CAAxB,CAAwC,GAAxC,CACH,CAHD,CAIH,CApBD,CAqBH,CAED,MAAO,CACHO,IAAI,CAAE,eAAW,CACbf,CAAa,EAChB,CAHE,CAKV,CApCK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Theme Boost Campus - JS code back to top button\n *\n * @package theme_boost_campus\n * @copyright 2017 Kathrin Osswald, Ulm University <kathrin.osswald@uni-ulm.de>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n\n\ndefine(['jquery', 'core/str'], function($, str) {\n \"use strict\";\n\n /**\n * Initialising.\n */\n function initBackToTop() {\n // Get the string backtotop from language file.\n str.get_string('backtotop', 'theme_boost_campus').then(function (string) {\n // Add a fontawesome icon after the footer as the back to top button.\n $('#page-footer').after('<i class=\"fa fa-chevron-up fa-2x d-print-none\"' +\n 'id=\"back-to-top\" aria-label=\"' + string + '\"></i>');\n\n // This function fades the button in when the page is scrolled down or fades it out\n // if the user is at the top of the page.\n $(window).scroll(function() {\n if ($(document).scrollTop() > 220) {\n $('#back-to-top').fadeIn(300);\n } else {\n $('#back-to-top').fadeOut(100);\n }\n });\n\n // This function scrolls the page to top with a duration of 500ms.\n $('#back-to-top').click(function(event) {\n event.preventDefault();\n $('html, body').animate({scrollTop: 0}, 500);\n });\n });\n }\n\n return {\n init: function() {\n initBackToTop();\n }\n };\n});\n"],"file":"backtotop.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/backtotop.js"],"names":["define","$","str","Notification","initBackToTop","stringsPromise","get_string","when","then","string","after","window","scroll","document","scrollTop","fadeIn","fadeOut","click","event","preventDefault","animate","fail","exception","init"],"mappings":"AAuBAA,OAAM,gCAAC,CAAC,QAAD,CAAW,UAAX,CAAuB,mBAAvB,CAAD,CAA8C,SAASC,CAAT,CAAYC,CAAZ,CAAiBC,CAAjB,CAA+B,CAC/E,aAKA,QAASC,CAAAA,CAAT,EAAyB,CAErB,GAAIC,CAAAA,CAAc,CAAGH,CAAG,CAACI,UAAJ,CAAe,WAAf,CAA4B,oBAA5B,CAArB,CAGAL,CAAC,CAACM,IAAF,CAAOF,CAAP,EAAuBG,IAAvB,CAA4B,SAASC,CAAT,CAAiB,CAEzCR,CAAC,CAAC,cAAD,CAAD,CAAkBS,KAAlB,CAAwB,mFACcD,CADd,CACuB,SAD/C,EAKAR,CAAC,CAACU,MAAD,CAAD,CAAUC,MAAV,CAAiB,UAAW,CACxB,GAA8B,GAA1B,CAAAX,CAAC,CAACY,QAAD,CAAD,CAAYC,SAAZ,EAAJ,CAAmC,CAC/Bb,CAAC,CAAC,cAAD,CAAD,CAAkBc,MAAlB,CAAyB,GAAzB,CACH,CAFD,IAEO,CACHd,CAAC,CAAC,cAAD,CAAD,CAAkBe,OAAlB,CAA0B,GAA1B,CACH,CACJ,CAND,EASAf,CAAC,CAAC,cAAD,CAAD,CAAkBgB,KAAlB,CAAwB,SAASC,CAAT,CAAgB,CACpCA,CAAK,CAACC,cAAN,GACAlB,CAAC,CAAC,YAAD,CAAD,CAAgBmB,OAAhB,CAAwB,CAACN,SAAS,CAAE,CAAZ,CAAxB,CAAwC,GAAxC,CACH,CAHD,EAKA,QACH,CAtBD,EAsBGO,IAtBH,CAsBQlB,CAAY,CAACmB,SAtBrB,CAuBH,CAED,MAAO,CACHC,IAAI,CAAE,eAAW,CACbnB,CAAa,EAChB,CAHE,CAKV,CAzCK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Theme Boost Campus - JS code back to top button\n *\n * @package theme_boost_campus\n * @copyright 2017 Kathrin Osswald, Ulm University <kathrin.osswald@uni-ulm.de>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/str', 'core/notification'], function($, str, Notification) {\n \"use strict\";\n\n /**\n * Initialising.\n */\n function initBackToTop() {\n // Get the string backtotop from language file.\n var stringsPromise = str.get_string('backtotop', 'theme_boost_campus');\n\n // Add backtotop button to DOM and add scroll and click handlers.\n $.when(stringsPromise).then(function(string) {\n // Add a fontawesome icon after the footer as the back to top button.\n $('#page-footer').after('<i class=\"fa fa-chevron-up fa-2x d-print-none\"' +\n 'id=\"back-to-top\" aria-label=\"' + string + '\"></i>');\n\n // This function fades the button in when the page is scrolled down or fades it out\n // if the user is at the top of the page.\n $(window).scroll(function() {\n if ($(document).scrollTop() > 220) {\n $('#back-to-top').fadeIn(300);\n } else {\n $('#back-to-top').fadeOut(100);\n }\n });\n\n // This function scrolls the page to top with a duration of 500ms.\n $('#back-to-top').click(function(event) {\n event.preventDefault();\n $('html, body').animate({scrollTop: 0}, 500);\n });\n\n return true;\n }).fail(Notification.exception);\n }\n\n return {\n init: function() {\n initBackToTop();\n }\n };\n});\n"],"file":"backtotop.min.js"} \ No newline at end of file diff --git a/amd/build/infobanner.min.js.map b/amd/build/infobanner.min.js.map index 8eefd53d4c7424bdc16efa9ebf110fb89f9c5498..df58802849a67b769384590e0f5e4d7bd5895768 100644 --- a/amd/build/infobanner.min.js.map +++ b/amd/build/infobanner.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/infobanner.js"],"names":["define","$","str","ModalFactory","ModalEvents","Notification","initInfoBanner","showconfirmationdialogue","stringsPromise","get_strings","key","component","modalPromise","create","type","types","SAVE_CANCEL","click","event","stopPropagation","when","then","strings","modal","setTitle","setBody","setSaveButtonText","getRoot","on","save","M","util","set_user_preference","alert","show","fail","exception","init"],"mappings":"AAuBAA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,CAA2C,OAA3C,CACH,CAJD,EAKAV,CAAK,CAACW,IAAN,GACA,MAAOX,CAAAA,CACV,CAZD,EAYGY,IAZH,CAYQ9B,CAAY,CAAC+B,SAZrB,CAaH,CAdD,IAcO,CACHN,CAAC,CAACC,IAAF,CAAOC,mBAAP,CAA2B,yCAA3B,KAEA/B,CAAC,CAAC,iCAAD,CAAD,CAAqCgC,KAArC,CAA2C,OAA3C,CACH,CACJ,CAvBD,CAwBH,CAED,MAAO,CACHI,IAAI,CAAE,cAAS9B,CAAT,CAAmC,CACrCD,CAAc,CAACC,CAAD,CACjB,CAHE,CAKV,CA1DK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Theme Boost Campus - JS code for feature information banner\n *\n * @package theme_boost_campus\n * @copyright 2020 Kathrin Osswald, Ulm University <kathrin.osswald@uni-ulm.de>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/modal_events', 'core/notification'],\n function($, str, ModalFactory, ModalEvents, Notification) {\n \"use strict\";\n\n /**\n * Initialising.\n */\n function initInfoBanner(showconfirmationdialogue) {\n\n var stringsforInfoBannerJS = [\n {\n key: 'confirmation',\n component: 'theme_boost_campus'\n }, {\n key: 'closingperpetualinfobanner',\n component: 'theme_boost_campus'\n } , {\n key: 'yes_close',\n component: 'theme_boost_campus'\n }\n ];\n\n // Load the strings and modal before clicking on the button so that the confirmation dialogue can pop up faster.\n var stringsPromise = str.get_strings(stringsforInfoBannerJS);\n var modalPromise = ModalFactory.create({type: ModalFactory.types.SAVE_CANCEL});\n\n // With this we store the dismissing of the info banner as a user preference to persist this decision.\n $('#themeboostcampusperpinfobanner .close').click(function(event) {\n // Stop propagation to keep the info banner there until the decision in the confirmation dialogue has been made.\n event.stopPropagation();\n\n if (showconfirmationdialogue == '1') {\n $.when(stringsPromise, modalPromise).then(function (strings, modal) {\n modal.setTitle(strings[0]);\n modal.setBody(strings[1]);\n modal.setSaveButtonText(strings[2]);\n // Saved clicked - the dismissing of the info banner is confirmed.\n modal.getRoot().on(ModalEvents.save, function () {\n M.util.set_user_preference('theme_boost_campus_infobanner_dismissed', true);\n // Now close the alert.\n $('#themeboostcampusperpinfobanner').alert('close');\n });\n modal.show();\n return modal;\n }).fail(Notification.exception);\n } else {\n M.util.set_user_preference('theme_boost_campus_infobanner_dismissed', true);\n // Now close the alert.\n $('#themeboostcampusperpinfobanner').alert('close');\n }\n });\n }\n\n return {\n init: function(showconfirmationdialogue) {\n initInfoBanner(showconfirmationdialogue);\n }\n };\n});\n"],"file":"infobanner.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/infobanner.js"],"names":["define","$","str","ModalFactory","ModalEvents","Notification","initInfoBanner","showconfirmationdialogue","stringsPromise","get_strings","key","component","modalPromise","create","type","types","SAVE_CANCEL","click","event","stopPropagation","when","then","strings","modal","setTitle","setBody","setSaveButtonText","getRoot","on","save","M","util","set_user_preference","alert","show","fail","exception","init"],"mappings":"AAuBAA,OAAM,iCAAC,CAAC,QAAD,CAAW,UAAX,CAAuB,oBAAvB,CAA6C,mBAA7C,CAAkE,mBAAlE,CAAD,CACF,SAASC,CAAT,CAAYC,CAAZ,CAAiBC,CAAjB,CAA+BC,CAA/B,CAA4CC,CAA5C,CAA0D,CAC1D,aAOA,QAASC,CAAAA,CAAT,CAAwBC,CAAxB,CAAkD,IAgB1CC,CAAAA,CAAc,CAAGN,CAAG,CAACO,WAAJ,CAdQ,CACzB,CACIC,GAAG,C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I,CAAE,cAAS9B,CAAT,CAAmC,CACrCD,CAAc,CAACC,CAAD,CACjB,CAHE,CAKV,CA5DK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Theme Boost Campus - JS code for feature information banner\n *\n * @package theme_boost_campus\n * @copyright 2020 Kathrin Osswald, Ulm University <kathrin.osswald@uni-ulm.de>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/modal_events', 'core/notification'],\n function($, str, ModalFactory, ModalEvents, Notification) {\n \"use strict\";\n\n /**\n * Initialising.\n *\n * @param {string} showconfirmationdialogue\n */\n function initInfoBanner(showconfirmationdialogue) {\n\n var stringsforInfoBannerJS = [\n {\n key: 'confirmation',\n component: 'theme_boost_campus'\n }, {\n key: 'closingperpetualinfobanner',\n component: 'theme_boost_campus'\n }, {\n key: 'yes_close',\n component: 'theme_boost_campus'\n }\n ];\n\n // Load the strings and modal before clicking on the button so that the confirmation dialogue can pop up faster.\n var stringsPromise = str.get_strings(stringsforInfoBannerJS);\n var modalPromise = ModalFactory.create({type: ModalFactory.types.SAVE_CANCEL});\n\n // With this we store the dismissing of the info banner as a user preference to persist this decision.\n $('#themeboostcampusperpinfobanner .close').click(function(event) {\n // Stop propagation to keep the info banner there until the decision in the confirmation dialogue has been made.\n event.stopPropagation();\n\n if (showconfirmationdialogue == '1') {\n $.when(stringsPromise, modalPromise).then(function(strings, modal) {\n modal.setTitle(strings[0]);\n modal.setBody(strings[1]);\n modal.setSaveButtonText(strings[2]);\n // Saved clicked - the dismissing of the info banner is confirmed.\n modal.getRoot().on(ModalEvents.save, function() {\n M.util.set_user_preference('theme_boost_campus_infobanner_dismissed', true);\n // Now close the alert.\n $('#themeboostcampusperpinfobanner').alert('close');\n });\n modal.show();\n return modal;\n }).fail(Notification.exception);\n } else {\n M.util.set_user_preference('theme_boost_campus_infobanner_dismissed', true);\n // Now close the alert.\n $('#themeboostcampusperpinfobanner').alert('close');\n }\n });\n }\n\n return {\n init: function(showconfirmationdialogue) {\n initInfoBanner(showconfirmationdialogue);\n }\n };\n});\n"],"file":"infobanner.min.js"} \ No newline at end of file diff --git a/amd/src/backtotop.js b/amd/src/backtotop.js index fbe02c63cbf546d1dd14b3cfc710fab28981e317..068407edfc0262d810c8ccf1b381dc45df200fe6 100644 --- a/amd/src/backtotop.js +++ b/amd/src/backtotop.js @@ -21,7 +21,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -define(['jquery', 'core/str'], function($, str) { +define(['jquery', 'core/str', 'core/notification'], function($, str, Notification) { "use strict"; /** @@ -29,7 +29,10 @@ define(['jquery', 'core/str'], function($, str) { */ function initBackToTop() { // Get the string backtotop from language file. - str.get_string('backtotop', 'theme_boost_campus').then(function(string) { + var stringsPromise = str.get_string('backtotop', 'theme_boost_campus'); + + // Add backtotop button to DOM and add scroll and click handlers. + $.when(stringsPromise).then(function(string) { // Add a fontawesome icon after the footer as the back to top button. $('#page-footer').after('<i class="fa fa-chevron-up fa-2x d-print-none"' + 'id="back-to-top" aria-label="' + string + '"></i>'); @@ -49,7 +52,9 @@ define(['jquery', 'core/str'], function($, str) { event.preventDefault(); $('html, body').animate({scrollTop: 0}, 500); }); - }); + + return true; + }).fail(Notification.exception); } return {