mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
MDL-72454 Themes: Removal of back to top link
This commit is contained in:
parent
70073fdc74
commit
f081ebeb4b
2
theme/boost/amd/build/loader.min.js
vendored
2
theme/boost/amd/build/loader.min.js
vendored
@ -1,2 +1,2 @@
|
||||
function _typeof(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(a){return typeof a}}else{_typeof=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof(a)}define ("theme_boost/loader",["exports","jquery","./aria","./index","core/pending","./scroll","./pending"],function(a,b,c,d,e,f,g){"use strict";Object.defineProperty(a,"__esModule",{value:!0});Object.defineProperty(a,"Bootstrap",{enumerable:!0,get:function get(){return d.default}});b=j(b);c=i(c);d=j(d);e=j(e);f=j(f);g=j(g);function h(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;h=function(){return a};return a}function i(a){if(a&&a.__esModule){return a}if(null===a||"object"!==_typeof(a)&&"function"!=typeof a){return{default:a}}var b=h();if(b&&b.has(a)){return b.get(a)}var c={},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var e in a){if(Object.prototype.hasOwnProperty.call(a,e)){var f=d?Object.getOwnPropertyDescriptor(a,e):null;if(f&&(f.get||f.set)){Object.defineProperty(c,e,f)}else{c[e]=a[e]}}}c.default=a;if(b){b.set(a,c)}return c}function j(a){return a&&a.__esModule?a:{default:a}}var k=function(){(0,b.default)("a[data-toggle=\"tab\"]").on("shown.bs.tab",function(a){var c=(0,b.default)(a.target).attr("href");if(history.replaceState){history.replaceState(null,null,c)}else{location.hash=c}});var a=window.location.hash;if(a){var c=document.querySelector(".nav-link[href=\""+a+"\"]");if(c){c.click()}}},l=function(){(0,b.default)("body").popover({container:"body",selector:"[data-toggle=\"popover\"]",trigger:"focus"});document.addEventListener("keydown",function(a){if("Escape"===a.key&&a.target.closest("[data-toggle=\"popover\"]")){(0,b.default)(a.target).popover("hide")}})},m=function(){(0,b.default)("body").tooltip({container:"body",selector:"[data-toggle=\"tooltip\"]"})},n=new e.default("theme_boost/loader:init");(0,g.default)();c.init();k();l();m();new f.default().init();b.default.fn.dropdown.Constructor.Default.flip=!1;n.resolve()});
|
||||
function _typeof(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(a){return typeof a}}else{_typeof=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof(a)}define ("theme_boost/loader",["exports","jquery","./aria","./index","core/pending","./pending"],function(a,b,c,d,e,f){"use strict";Object.defineProperty(a,"__esModule",{value:!0});Object.defineProperty(a,"Bootstrap",{enumerable:!0,get:function get(){return d.default}});b=i(b);c=h(c);d=i(d);e=i(e);f=i(f);function g(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;g=function(){return a};return a}function h(a){if(a&&a.__esModule){return a}if(null===a||"object"!==_typeof(a)&&"function"!=typeof a){return{default:a}}var b=g();if(b&&b.has(a)){return b.get(a)}var c={},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var e in a){if(Object.prototype.hasOwnProperty.call(a,e)){var f=d?Object.getOwnPropertyDescriptor(a,e):null;if(f&&(f.get||f.set)){Object.defineProperty(c,e,f)}else{c[e]=a[e]}}}c.default=a;if(b){b.set(a,c)}return c}function i(a){return a&&a.__esModule?a:{default:a}}var j=function(){(0,b.default)("a[data-toggle=\"tab\"]").on("shown.bs.tab",function(a){var c=(0,b.default)(a.target).attr("href");if(history.replaceState){history.replaceState(null,null,c)}else{location.hash=c}});var a=window.location.hash;if(a){var c=document.querySelector(".nav-link[href=\""+a+"\"]");if(c){c.click()}}},k=function(){(0,b.default)("body").popover({container:"body",selector:"[data-toggle=\"popover\"]",trigger:"focus"});document.addEventListener("keydown",function(a){if("Escape"===a.key&&a.target.closest("[data-toggle=\"popover\"]")){(0,b.default)(a.target).popover("hide")}})},l=function(){(0,b.default)("body").tooltip({container:"body",selector:"[data-toggle=\"tooltip\"]"})},m=new e.default("theme_boost/loader:init");(0,f.default)();c.init();j();k();l();b.default.fn.dropdown.Constructor.Default.flip=!1;m.resolve()});
|
||||
//# sourceMappingURL=loader.min.js.map
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/loader.js"],"names":["rememberTabs","on","e","hash","target","attr","history","replaceState","location","window","tab","document","querySelector","click","enablePopovers","popover","container","selector","trigger","addEventListener","key","closest","enableTooltips","tooltip","pendingPromise","Pending","Aria","init","Scroll","$","fn","dropdown","Constructor","Default","flip","resolve"],"mappings":"8jBAwBA,OACA,OACA,OACA,OACA,OACA,O,4lBAKMA,CAAAA,CAAY,CAAG,UAAM,CACvB,cAAE,wBAAF,EAA0BC,EAA1B,CAA6B,cAA7B,CAA6C,SAASC,CAAT,CAAY,CACrD,GAAIC,CAAAA,CAAI,CAAG,cAAED,CAAC,CAACE,MAAJ,EAAYC,IAAZ,CAAiB,MAAjB,CAAX,CACA,GAAIC,OAAO,CAACC,YAAZ,CAA0B,CACtBD,OAAO,CAACC,YAAR,CAAqB,IAArB,CAA2B,IAA3B,CAAiCJ,CAAjC,CACH,CAFD,IAEO,CACHK,QAAQ,CAACL,IAAT,CAAgBA,CACnB,CACJ,CAPD,EAQA,GAAMA,CAAAA,CAAI,CAAGM,MAAM,CAACD,QAAP,CAAgBL,IAA7B,CACA,GAAIA,CAAJ,CAAU,CACN,GAAMO,CAAAA,CAAG,CAAGC,QAAQ,CAACC,aAAT,CAAuB,oBAAqBT,CAArB,CAA4B,KAAnD,CAAZ,CACA,GAAIO,CAAJ,CAAS,CACLA,CAAG,CAACG,KAAJ,EACH,CACJ,CACJ,C,CAMKC,CAAc,CAAG,UAAM,CACzB,cAAE,MAAF,EAAUC,OAAV,CAAkB,CACdC,SAAS,CAAE,MADG,CAEdC,QAAQ,CAAE,2BAFI,CAGdC,OAAO,CAAE,OAHK,CAAlB,EAMAP,QAAQ,CAACQ,gBAAT,CAA0B,SAA1B,CAAqC,SAAAjB,CAAC,CAAI,CACtC,GAAc,QAAV,GAAAA,CAAC,CAACkB,GAAF,EAAsBlB,CAAC,CAACE,MAAF,CAASiB,OAAT,CAAiB,2BAAjB,CAA1B,CAAuE,CACnE,cAAEnB,CAAC,CAACE,MAAJ,EAAYW,OAAZ,CAAoB,MAApB,CACH,CACJ,CAJD,CAKH,C,CAMKO,CAAc,CAAG,UAAM,CACzB,cAAE,MAAF,EAAUC,OAAV,CAAkB,CACdP,SAAS,CAAE,MADG,CAEdC,QAAQ,CAAE,2BAFI,CAAlB,CAIH,C,CAEKO,CAAc,CAAG,GAAIC,UAAJ,CAAY,yBAAZ,C,CAGvB,gBAGAC,CAAI,CAACC,IAAL,GAGA3B,CAAY,GAGZc,CAAc,GAGdQ,CAAc,GAGb,GAAIM,UAAJ,EAAD,CAAeD,IAAf,GAGAE,UAAEC,EAAF,CAAKC,QAAL,CAAcC,WAAd,CAA0BC,OAA1B,CAAkCC,IAAlC,IAEAV,CAAc,CAACW,OAAf,E","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 * Template renderer for Moodle. Load and render Moodle templates with Mustache.\n *\n * @module theme_boost/loader\n * @copyright 2015 Damyon Wiese <damyon@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 2.9\n */\n\nimport $ from 'jquery';\nimport * as Aria from './aria';\nimport Bootstrap from './index';\nimport Pending from 'core/pending';\nimport Scroll from './scroll';\nimport setupBootstrapPendingChecks from './pending';\n\n/**\n * Rember the last visited tabs.\n */\nconst rememberTabs = () => {\n $('a[data-toggle=\"tab\"]').on('shown.bs.tab', function(e) {\n var hash = $(e.target).attr('href');\n if (history.replaceState) {\n history.replaceState(null, null, hash);\n } else {\n location.hash = hash;\n }\n });\n const hash = window.location.hash;\n if (hash) {\n const tab = document.querySelector('.nav-link[href=\"' + hash + '\"]');\n if (tab) {\n tab.click();\n }\n }\n};\n\n/**\n * Enable all popovers\n *\n */\nconst enablePopovers = () => {\n $('body').popover({\n container: 'body',\n selector: '[data-toggle=\"popover\"]',\n trigger: 'focus',\n });\n\n document.addEventListener('keydown', e => {\n if (e.key === 'Escape' && e.target.closest('[data-toggle=\"popover\"]')) {\n $(e.target).popover('hide');\n }\n });\n};\n\n/**\n * Enable tooltips\n *\n */\nconst enableTooltips = () => {\n $('body').tooltip({\n container: 'body',\n selector: '[data-toggle=\"tooltip\"]',\n });\n};\n\nconst pendingPromise = new Pending('theme_boost/loader:init');\n\n// Add pending promise event listeners to relevant Bootstrap custom events.\nsetupBootstrapPendingChecks();\n\n// Setup Aria helpers for Bootstrap features.\nAria.init();\n\n// Remember the last visited tabs.\nrememberTabs();\n\n// Enable all popovers.\nenablePopovers();\n\n// Enable all tooltips.\nenableTooltips();\n\n// Add scroll handling.\n(new Scroll()).init();\n\n// Disables flipping the dropdowns up and getting hidden behind the navbar.\n$.fn.dropdown.Constructor.Default.flip = false;\n\npendingPromise.resolve();\n\nexport {\n Bootstrap,\n};\n"],"file":"loader.min.js"}
|
||||
{"version":3,"sources":["../src/loader.js"],"names":["rememberTabs","on","e","hash","target","attr","history","replaceState","location","window","tab","document","querySelector","click","enablePopovers","popover","container","selector","trigger","addEventListener","key","closest","enableTooltips","tooltip","pendingPromise","Pending","Aria","init","$","fn","dropdown","Constructor","Default","flip","resolve"],"mappings":"ijBAwBA,OACA,OACA,OACA,OACA,O,4lBAKMA,CAAAA,CAAY,CAAG,UAAM,CACvB,cAAE,wBAAF,EAA0BC,EAA1B,CAA6B,cAA7B,CAA6C,SAASC,CAAT,CAAY,CACrD,GAAIC,CAAAA,CAAI,CAAG,cAAED,CAAC,CAACE,MAAJ,EAAYC,IAAZ,CAAiB,MAAjB,CAAX,CACA,GAAIC,OAAO,CAACC,YAAZ,CAA0B,CACtBD,OAAO,CAACC,YAAR,CAAqB,IAArB,CAA2B,IAA3B,CAAiCJ,CAAjC,CACH,CAFD,IAEO,CACHK,QAAQ,CAACL,IAAT,CAAgBA,CACnB,CACJ,CAPD,EAQA,GAAMA,CAAAA,CAAI,CAAGM,MAAM,CAACD,QAAP,CAAgBL,IAA7B,CACA,GAAIA,CAAJ,CAAU,CACN,GAAMO,CAAAA,CAAG,CAAGC,QAAQ,CAACC,aAAT,CAAuB,oBAAqBT,CAArB,CAA4B,KAAnD,CAAZ,CACA,GAAIO,CAAJ,CAAS,CACLA,CAAG,CAACG,KAAJ,EACH,CACJ,CACJ,C,CAMKC,CAAc,CAAG,UAAM,CACzB,cAAE,MAAF,EAAUC,OAAV,CAAkB,CACdC,SAAS,CAAE,MADG,CAEdC,QAAQ,CAAE,2BAFI,CAGdC,OAAO,CAAE,OAHK,CAAlB,EAMAP,QAAQ,CAACQ,gBAAT,CAA0B,SAA1B,CAAqC,SAAAjB,CAAC,CAAI,CACtC,GAAc,QAAV,GAAAA,CAAC,CAACkB,GAAF,EAAsBlB,CAAC,CAACE,MAAF,CAASiB,OAAT,CAAiB,2BAAjB,CAA1B,CAAuE,CACnE,cAAEnB,CAAC,CAACE,MAAJ,EAAYW,OAAZ,CAAoB,MAApB,CACH,CACJ,CAJD,CAKH,C,CAMKO,CAAc,CAAG,UAAM,CACzB,cAAE,MAAF,EAAUC,OAAV,CAAkB,CACdP,SAAS,CAAE,MADG,CAEdC,QAAQ,CAAE,2BAFI,CAAlB,CAIH,C,CAEKO,CAAc,CAAG,GAAIC,UAAJ,CAAY,yBAAZ,C,CAGvB,gBAGAC,CAAI,CAACC,IAAL,GAGA3B,CAAY,GAGZc,CAAc,GAGdQ,CAAc,GAGdM,UAAEC,EAAF,CAAKC,QAAL,CAAcC,WAAd,CAA0BC,OAA1B,CAAkCC,IAAlC,IAEAT,CAAc,CAACU,OAAf,E","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 * Template renderer for Moodle. Load and render Moodle templates with Mustache.\n *\n * @module theme_boost/loader\n * @copyright 2015 Damyon Wiese <damyon@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 2.9\n */\n\nimport $ from 'jquery';\nimport * as Aria from './aria';\nimport Bootstrap from './index';\nimport Pending from 'core/pending';\nimport setupBootstrapPendingChecks from './pending';\n\n/**\n * Rember the last visited tabs.\n */\nconst rememberTabs = () => {\n $('a[data-toggle=\"tab\"]').on('shown.bs.tab', function(e) {\n var hash = $(e.target).attr('href');\n if (history.replaceState) {\n history.replaceState(null, null, hash);\n } else {\n location.hash = hash;\n }\n });\n const hash = window.location.hash;\n if (hash) {\n const tab = document.querySelector('.nav-link[href=\"' + hash + '\"]');\n if (tab) {\n tab.click();\n }\n }\n};\n\n/**\n * Enable all popovers\n *\n */\nconst enablePopovers = () => {\n $('body').popover({\n container: 'body',\n selector: '[data-toggle=\"popover\"]',\n trigger: 'focus',\n });\n\n document.addEventListener('keydown', e => {\n if (e.key === 'Escape' && e.target.closest('[data-toggle=\"popover\"]')) {\n $(e.target).popover('hide');\n }\n });\n};\n\n/**\n * Enable tooltips\n *\n */\nconst enableTooltips = () => {\n $('body').tooltip({\n container: 'body',\n selector: '[data-toggle=\"tooltip\"]',\n });\n};\n\nconst pendingPromise = new Pending('theme_boost/loader:init');\n\n// Add pending promise event listeners to relevant Bootstrap custom events.\nsetupBootstrapPendingChecks();\n\n// Setup Aria helpers for Bootstrap features.\nAria.init();\n\n// Remember the last visited tabs.\nrememberTabs();\n\n// Enable all popovers.\nenablePopovers();\n\n// Enable all tooltips.\nenableTooltips();\n\n// Disables flipping the dropdowns up and getting hidden behind the navbar.\n$.fn.dropdown.Constructor.Default.flip = false;\n\npendingPromise.resolve();\n\nexport {\n Bootstrap,\n};\n"],"file":"loader.min.js"}
|
2
theme/boost/amd/build/scroll.min.js
vendored
2
theme/boost/amd/build/scroll.min.js
vendored
@ -1,2 +0,0 @@
|
||||
define ("theme_boost/scroll",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;function b(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function c(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function d(a,b,d){if(b)c(a.prototype,b);if(d)c(a,d);return a}var e=function(){function a(){b(this,a)}d(a,[{key:"init",value:function init(){this.scrollY=0;window.addEventListener("scroll",this.scrollHandler.bind(this));return this}},{key:"getScrollPosition",value:function getScrollPosition(){return window.pageYOffset||document.documentElement.scrollTop}},{key:"scrollHandler",value:function scrollHandler(){var a=document.querySelector("body"),b=this.getScrollPosition();if(b>=window.innerHeight){a.classList.add("scrolled")}else{a.classList.remove("scrolled")}}}]);return a}();a.default=e;return a.default});
|
||||
//# sourceMappingURL=scroll.min.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../src/scroll.js"],"names":["MoodleScroll","scrollY","window","addEventListener","scrollHandler","bind","pageYOffset","document","documentElement","scrollTop","body","querySelector","getScrollPosition","innerHeight","classList","add","remove"],"mappings":"wcA8BqBA,CAAAA,C,yEASV,CACH,KAAKC,OAAL,CAAe,CAAf,CACAC,MAAM,CAACC,gBAAP,CAAwB,QAAxB,CAAkC,KAAKC,aAAL,CAAmBC,IAAnB,CAAwB,IAAxB,CAAlC,EACA,MAAO,KACV,C,6DASmB,CAChB,MAAOH,CAAAA,MAAM,CAACI,WAAP,EAAsBC,QAAQ,CAACC,eAAT,CAAyBC,SACzD,C,qDAQe,IACNC,CAAAA,CAAI,CAAGH,QAAQ,CAACI,aAAT,CAAuB,MAAvB,CADD,CAENV,CAAO,CAAG,KAAKW,iBAAL,EAFJ,CAGZ,GAAIX,CAAO,EAAIC,MAAM,CAACW,WAAtB,CAAmC,CAC/BH,CAAI,CAACI,SAAL,CAAeC,GAAf,CAAmB,UAAnB,CACH,CAFD,IAEO,CACHL,CAAI,CAACI,SAAL,CAAeE,MAAf,CAAsB,UAAtB,CACH,CACJ,C","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 * Manage user scroll in Moodle for future floating elements.\n *\n * @module theme_boost/scroll\n * @copyright 2020 Ferran Recio <ferran@moodle.org>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * Moodle scroll handling. For now it just handle a \"scrolled\" class\n * on the body tag but in the near future could handle more floating\n * elements like option bars, docked elements or other active elements.\n *\n * @class theme_boost/scroll\n */\nexport default class MoodleScroll {\n\n /**\n * Initialise the scroll monitoring.\n *\n * @method init\n * @chainable\n * @return {Object} this.\n */\n init() {\n this.scrollY = 0;\n window.addEventListener(\"scroll\", this.scrollHandler.bind(this));\n return this;\n }\n\n /**\n * Add special classes to body depending on scroll position.\n *\n * @method update\n * @chainable\n * @return {Integer} current scroll position.\n */\n getScrollPosition() {\n return window.pageYOffset || document.documentElement.scrollTop;\n }\n\n /**\n * Add special classes to body depending on scroll position.\n *\n * @method update\n * @chainable\n */\n scrollHandler() {\n const body = document.querySelector('body');\n const scrollY = this.getScrollPosition();\n if (scrollY >= window.innerHeight) {\n body.classList.add('scrolled');\n } else {\n body.classList.remove('scrolled');\n }\n }\n}\n"],"file":"scroll.min.js"}
|
@ -26,7 +26,6 @@ import $ from 'jquery';
|
||||
import * as Aria from './aria';
|
||||
import Bootstrap from './index';
|
||||
import Pending from 'core/pending';
|
||||
import Scroll from './scroll';
|
||||
import setupBootstrapPendingChecks from './pending';
|
||||
|
||||
/**
|
||||
@ -96,9 +95,6 @@ enablePopovers();
|
||||
// Enable all tooltips.
|
||||
enableTooltips();
|
||||
|
||||
// Add scroll handling.
|
||||
(new Scroll()).init();
|
||||
|
||||
// Disables flipping the dropdowns up and getting hidden behind the navbar.
|
||||
$.fn.dropdown.Constructor.Default.flip = false;
|
||||
|
||||
|
@ -1,72 +0,0 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Manage user scroll in Moodle for future floating elements.
|
||||
*
|
||||
* @module theme_boost/scroll
|
||||
* @copyright 2020 Ferran Recio <ferran@moodle.org>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Moodle scroll handling. For now it just handle a "scrolled" class
|
||||
* on the body tag but in the near future could handle more floating
|
||||
* elements like option bars, docked elements or other active elements.
|
||||
*
|
||||
* @class theme_boost/scroll
|
||||
*/
|
||||
export default class MoodleScroll {
|
||||
|
||||
/**
|
||||
* Initialise the scroll monitoring.
|
||||
*
|
||||
* @method init
|
||||
* @chainable
|
||||
* @return {Object} this.
|
||||
*/
|
||||
init() {
|
||||
this.scrollY = 0;
|
||||
window.addEventListener("scroll", this.scrollHandler.bind(this));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add special classes to body depending on scroll position.
|
||||
*
|
||||
* @method update
|
||||
* @chainable
|
||||
* @return {Integer} current scroll position.
|
||||
*/
|
||||
getScrollPosition() {
|
||||
return window.pageYOffset || document.documentElement.scrollTop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add special classes to body depending on scroll position.
|
||||
*
|
||||
* @method update
|
||||
* @chainable
|
||||
*/
|
||||
scrollHandler() {
|
||||
const body = document.querySelector('body');
|
||||
const scrollY = this.getScrollPosition();
|
||||
if (scrollY >= window.innerHeight) {
|
||||
body.classList.add('scrolled');
|
||||
} else {
|
||||
body.classList.remove('scrolled');
|
||||
}
|
||||
}
|
||||
}
|
1
theme/boost/lang/en/deprecated.txt
Normal file
1
theme/boost/lang/en/deprecated.txt
Normal file
@ -0,0 +1 @@
|
||||
totop,theme_boost
|
@ -50,4 +50,6 @@ $string['region-side-pre'] = 'Right';
|
||||
$string['privacy:metadata:preference:draweropennav'] = 'The user\'s preference for hiding or showing the drawer menu navigation.';
|
||||
$string['privacy:drawernavclosed'] = 'The current preference for the navigation drawer is closed.';
|
||||
$string['privacy:drawernavopen'] = 'The current preference for the navigation drawer is open.';
|
||||
|
||||
// Deprecated since Moodle 4.0.
|
||||
$string['totop'] = 'Go to top';
|
||||
|
@ -45,35 +45,6 @@ $font-size-xs: ($font-size-base * .75) !default;
|
||||
}
|
||||
}
|
||||
|
||||
$gototop-bottom-position: 50px !default;
|
||||
|
||||
#goto-top-link {
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
transition: opacity .7s ease 0s, visibility .1s ease .8s;
|
||||
display: block;
|
||||
position: fixed;
|
||||
bottom: $gototop-bottom-position;
|
||||
right: 0;
|
||||
a {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
transform: translateY(-100%);
|
||||
}
|
||||
}
|
||||
|
||||
@include media-breakpoint-down(sm) {
|
||||
#goto-top-link {
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
body.scrolled #goto-top-link {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
transition: visibility 0s ease 0s, opacity .7s ease .1s;
|
||||
}
|
||||
|
||||
.context-header-settings-menu .dropdown-toggle > .icon,
|
||||
#region-main-settings-menu .dropdown-toggle > .icon {
|
||||
height: 24px;
|
||||
|
@ -60,9 +60,6 @@ $breadcrumb-bg: transparent !default;
|
||||
$breadcrumb-divider: "/" !default;
|
||||
$breadcrumb-divider-rtl: "/" !default;
|
||||
|
||||
// Floating elements positions
|
||||
$gototop-bottom-position: 50px !default;
|
||||
|
||||
// Alerts
|
||||
$alert-border-width: 0 !default;
|
||||
|
||||
|
@ -9893,28 +9893,6 @@ a.text-dark:hover, a.text-dark:focus {
|
||||
display: flex;
|
||||
justify-content: flex-end; } }
|
||||
|
||||
#goto-top-link {
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
transition: opacity .7s ease 0s, visibility .1s ease .8s;
|
||||
display: block;
|
||||
position: fixed;
|
||||
bottom: 50px;
|
||||
right: 0; }
|
||||
#goto-top-link a {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
transform: translateY(-100%); }
|
||||
|
||||
@media (max-width: 767.98px) {
|
||||
#goto-top-link {
|
||||
bottom: 0; } }
|
||||
|
||||
body.scrolled #goto-top-link {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
transition: visibility 0s ease 0s, opacity .7s ease .1s; }
|
||||
|
||||
.context-header-settings-menu .dropdown-toggle > .icon,
|
||||
#region-main-settings-menu .dropdown-toggle > .icon {
|
||||
height: 24px;
|
||||
|
@ -94,12 +94,6 @@
|
||||
</div>
|
||||
</div>
|
||||
{{{ output.standard_after_main_region_html }}}
|
||||
<div id="goto-top-link">
|
||||
{{! go to top is sticky to footer so needs to be sibling }}
|
||||
<a class="btn btn-light" role="button" href="#" aria-label="{{#str}} totop, theme_boost {{/str}}">
|
||||
{{#pix}} i/up, core{{/pix}}
|
||||
</a>
|
||||
</div>
|
||||
{{> theme_boost/footer }}
|
||||
</div>
|
||||
|
||||
|
@ -135,11 +135,6 @@
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<div id="goto-top-link">
|
||||
<a class="btn btn-light" role="button" href="#topofscroll" aria-label="{{#str}} totop, theme_boost {{/str}}">
|
||||
{{#pix}} i/up, core{{/pix}}
|
||||
</a>
|
||||
</div>
|
||||
{{> theme_boost/footer }}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -9893,28 +9893,6 @@ a.text-dark:hover, a.text-dark:focus {
|
||||
display: flex;
|
||||
justify-content: flex-end; } }
|
||||
|
||||
#goto-top-link {
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
transition: opacity .7s ease 0s, visibility .1s ease .8s;
|
||||
display: block;
|
||||
position: fixed;
|
||||
bottom: 50px;
|
||||
right: 0; }
|
||||
#goto-top-link a {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
transform: translateY(-100%); }
|
||||
|
||||
@media (max-width: 767.98px) {
|
||||
#goto-top-link {
|
||||
bottom: 0; } }
|
||||
|
||||
body.scrolled #goto-top-link {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
transition: visibility 0s ease 0s, opacity .7s ease .1s; }
|
||||
|
||||
.context-header-settings-menu .dropdown-toggle > .icon,
|
||||
#region-main-settings-menu .dropdown-toggle > .icon {
|
||||
height: 24px;
|
||||
|
Loading…
x
Reference in New Issue
Block a user