diff --git a/CHANGES.md b/CHANGES.md index 3343652254897230255f678e613c672f9b2e0e24..2e2d47087b185acad89ab9acc4a70f77ff88e603 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2020-03-09 - Fixed accessibility issues with back-to-top button. * 2020-03-05 - Adjusted function full_header() in core_renderer.php due to upstream changes in theme Boost. * 2020-03-05 - Removed SCSS rule to wrap words in cards as it has been fixed in theme Boost. * 2020-03-05 - Adjusted login.mustache template due to upstream changes in theme Boost. diff --git a/amd/build/backtotop.min.js b/amd/build/backtotop.min.js index b60d4b9565452432bbbc10fbf433a028f34518f8..f475abd2090bf1bb76db1f98b2d65f89e8c2dd4a 100644 --- a/amd/build/backtotop.min.js +++ b/amd/build/backtotop.min.js @@ -1,2 +1,2 @@ -define ("theme_boost_campus/backtotop",["jquery"],function(a){"use strict";function b(){a("#page-footer").after("<i class=\"fa fa-chevron-up fa-2x d-print-none\" id=\"back-to-top\"></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(){b()}}}); +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()}}}); //# sourceMappingURL=backtotop.min.js.map diff --git a/amd/build/backtotop.min.js.map b/amd/build/backtotop.min.js.map index 79029df892bca681d4dfab9546e0df7e5ab3d536..04bfb5e6cec0179e8230ae648b97209eb445fa4d 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","$","initBackToTop","after","window","scroll","document","scrollTop","fadeIn","fadeOut","click","event","preventDefault","animate","init"],"mappings":"AAuBAA,OAAM,gCAAC,CAAC,QAAD,CAAD,CAAa,SAASC,CAAT,CAAY,CAC3B,aAKA,QAASC,CAAAA,CAAT,EAAyB,CAErBD,CAAC,CAAC,cAAD,CAAD,CAAkBE,KAAlB,CAAwB,0EAAxB,EAIAF,CAAC,CAACG,MAAD,CAAD,CAAUC,MAAV,CAAiB,UAAW,CACxB,GAA8B,GAA1B,CAAAJ,CAAC,CAACK,QAAD,CAAD,CAAYC,SAAZ,EAAJ,CAAmC,CAC/BN,CAAC,CAAC,cAAD,CAAD,CAAkBO,MAAlB,CAAyB,GAAzB,CACH,CAFD,IAEO,CACHP,CAAC,CAAC,cAAD,CAAD,CAAkBQ,OAAlB,CAA0B,GAA1B,CACH,CACJ,CAND,EASAR,CAAC,CAAC,cAAD,CAAD,CAAkBS,KAAlB,CAAwB,SAASC,CAAT,CAAgB,CACpCA,CAAK,CAACC,cAAN,GACAX,CAAC,CAAC,YAAD,CAAD,CAAgBY,OAAhB,CAAwB,CAACN,SAAS,CAAE,CAAZ,CAAxB,CAAwC,GAAxC,CACH,CAHD,CAIH,CAED,MAAO,CACHO,IAAI,CAAE,eAAW,CACbZ,CAAa,EAChB,CAHE,CAKV,CAhCK,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'], function($) {\n \"use strict\";\n\n /**\n * Initialising.\n */\n function initBackToTop() {\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\" id=\"back-to-top\"></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 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","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,CAEH,CAJD,EAQAL,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,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\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 return {\n init: function() {\n initBackToTop();\n }\n };\n});\n"],"file":"backtotop.min.js"} \ No newline at end of file diff --git a/amd/src/backtotop.js b/amd/src/backtotop.js index 478e29aa5f392eeeb93bb36e16925d052f9d1b5f..0a9802f5032ef65ded3312458ea72a967ec32d42 100644 --- a/amd/src/backtotop.js +++ b/amd/src/backtotop.js @@ -21,15 +21,21 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -define(['jquery'], function($) { + + +define(['jquery', 'core/str'], function($, str) { "use strict"; /** * Initialising. */ function initBackToTop() { - // 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"></i>'); + // Get the string backtotop from language file. + str.get_string('backtotop', 'theme_boost_campus').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>'); + }); // This function fades the button in when the page is scrolled down or fades it out // if the user is at the top of the page. diff --git a/lang/en/theme_boost_campus.php b/lang/en/theme_boost_campus.php index 18abc4c6acaaecf65205727d01ef8dcf6b378cbf..a6f3d1ed1aa8dd4155baa7a4f167e12cd1c77077 100644 --- a/lang/en/theme_boost_campus.php +++ b/lang/en/theme_boost_campus.php @@ -217,6 +217,7 @@ The advantage of uploading files to this file area is that those files can be de An example for a use case can be found in the README.md file.'; // ADDITIONAL STRINGS (IN ALPHABETICAL ORDER). +$string['backtotop'] = 'Back to top'; $string['cachedef_imagearea'] = 'Cache for imagearea items'; $string['showhintcourseguestaccessgeneral'] = 'You are currently viewing this course as <strong>{$a->role}</strong>.'; $string['showhintcourseguestaccesslink'] = 'To have full access to the course, you can <a href="{$a->url}">self enrol into this course</a>.';