Skip to content
Snippets Groups Projects
Commit 116c219c authored by Kathrin Osswald's avatar Kathrin Osswald
Browse files

Fixed accessibility issues with back-to-top button.

parent 337f97ad
Branches
Tags
No related merge requests found
......@@ -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.
......
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
{"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
......@@ -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() {
// 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"></i>');
$('#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.
......
......@@ -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>.';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment