mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-68833 theme_boost: Stop overriding popover triggers
The trigger specified in JS overrides any `data-trigger` in the DOM, which changed the behaviour of Popovers.
This commit is contained in:
parent
721c29ff2d
commit
23c60c18ef
2
theme/boost/amd/build/loader.min.js
vendored
2
theme/boost/amd/build/loader.min.js
vendored
@ -1,2 +1,2 @@
|
||||
define ("theme_boost/loader",["exports","jquery","./aria","./bootstrap/index","core/custom_interaction_events","core/pending","./scroll","./pending"],function(a,b,c,d,e,f,g,h){"use strict";Object.defineProperty(a,"__esModule",{value:!0});Object.defineProperty(a,"Bootstrap",{enumerable:!0,get:function get(){return d.default}});a.init=void 0;b=i(b);c=i(c);d=i(d);e=i(e);f=i(f);g=i(g);h=i(h);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){(0,b.default)(".nav-link[href=\""+a+"\"]").tab("show")}},k=function(){(0,b.default)("body").popover({selector:"[data-toggle=\"popover\"]",trigger:"focus hover",placement:"auto"});e.default.define((0,b.default)("body"),[e.default.events.escape]);(0,b.default)("body").on(e.default.events.escape,"[data-toggle=popover]",function(){(0,b.default)(this).trigger("blur")})},l=function(){(0,b.default)("body").tooltip({container:"body",selector:"[data-toggle=\"tooltip\"]"})},m=function(){var a=new f.default("theme_boost/loader:init");(0,h.default)();j();k();l();new g.default().init();b.default.fn.dropdown.Constructor.Default.flip=!1;c.default.init();a.resolve()};a.init=m});
|
||||
define ("theme_boost/loader",["exports","jquery","./aria","./bootstrap/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}});a.init=void 0;b=h(b);c=h(c);d=h(d);e=h(e);f=h(f);g=h(g);function h(a){return a&&a.__esModule?a:{default:a}}var i=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){(0,b.default)(".nav-link[href=\""+a+"\"]").tab("show")}},j=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")}})},k=function(){(0,b.default)("body").tooltip({container:"body",selector:"[data-toggle=\"tooltip\"]"})},l=function(){var a=new e.default("theme_boost/loader:init");(0,g.default)();i();j();k();new f.default().init();b.default.fn.dropdown.Constructor.Default.flip=!1;c.default.init();a.resolve()};a.init=l});
|
||||
//# 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","enablePopovers","popover","selector","trigger","placement","CustomEvents","define","events","escape","enableTooltips","tooltip","container","init","pendingPromise","Pending","Scroll","$","fn","dropdown","Constructor","Default","flip","Aria","resolve"],"mappings":"sVA0BA,OACA,OACA,OACA,OACA,OACA,OACA,O,sDAKMA,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,GAAIA,CAAAA,CAAI,CAAGM,MAAM,CAACD,QAAP,CAAgBL,IAA3B,CACA,GAAIA,CAAJ,CAAU,CACP,cAAE,oBAAqBA,CAArB,CAA4B,KAA9B,EAAoCO,GAApC,CAAwC,MAAxC,CACF,CACJ,C,CAMKC,CAAc,CAAG,UAAM,CACzB,cAAE,MAAF,EAAUC,OAAV,CAAkB,CACdC,QAAQ,CAAE,2BADI,CAEdC,OAAO,CAAE,aAFK,CAGdC,SAAS,CAAE,MAHG,CAAlB,EAMAC,UAAaC,MAAb,CAAoB,cAAE,MAAF,CAApB,CAA+B,CAC3BD,UAAaE,MAAb,CAAoBC,MADO,CAA/B,EAGA,cAAE,MAAF,EAAUlB,EAAV,CAAae,UAAaE,MAAb,CAAoBC,MAAjC,CAAyC,uBAAzC,CAAkE,UAAW,CACzE,cAAE,IAAF,EAAQL,OAAR,CAAgB,MAAhB,CACH,CAFD,CAGH,C,CAMKM,CAAc,CAAG,UAAM,CACzB,cAAE,MAAF,EAAUC,OAAV,CAAkB,CACdC,SAAS,CAAE,MADG,CAEdT,QAAQ,CAAE,2BAFI,CAAlB,CAIH,C,CAKKU,CAAI,CAAG,UAAM,CACf,GAAMC,CAAAA,CAAc,CAAG,GAAIC,UAAJ,CAAY,yBAAZ,CAAvB,CAEA,gBAGAzB,CAAY,GAGZW,CAAc,GAGdS,CAAc,GAGb,GAAIM,UAAJ,EAAD,CAAeH,IAAf,GAGAI,UAAEC,EAAF,CAAKC,QAAL,CAAcC,WAAd,CAA0BC,OAA1B,CAAkCC,IAAlC,IAGAC,UAAKV,IAAL,GAEAC,CAAc,CAACU,OAAf,EACH,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 * Template renderer for Moodle. Load and render Moodle templates with Mustache.\n *\n * @module core/templates\n * @package core\n * @class templates\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 Aria from './aria';\nimport Bootstrap from './bootstrap/index';\nimport CustomEvents from 'core/custom_interaction_events';\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 var hash = window.location.hash;\n if (hash) {\n $('.nav-link[href=\"' + hash + '\"]').tab('show');\n }\n};\n\n/**\n * Enable all popovers\n *\n */\nconst enablePopovers = () => {\n $('body').popover({\n selector: '[data-toggle=\"popover\"]',\n trigger: 'focus hover',\n placement: 'auto'\n });\n\n CustomEvents.define($('body'), [\n CustomEvents.events.escape,\n ]);\n $('body').on(CustomEvents.events.escape, '[data-toggle=popover]', function() {\n $(this).trigger('blur');\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\n/**\n * Bootstrap init function\n */\nconst init = () => {\n const pendingPromise = new Pending('theme_boost/loader:init');\n\n setupBootstrapPendingChecks();\n\n // Remember the last visited tabs.\n rememberTabs();\n\n // Enable all popovers.\n enablePopovers();\n\n // Enable all tooltips.\n enableTooltips();\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\n // Setup Aria helpers for Bootstrap features.\n Aria.init();\n\n pendingPromise.resolve();\n};\n\n/**\n * Set up the search.\n *\n * @method init\n */\nexport {\n init,\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","enablePopovers","popover","container","selector","trigger","document","addEventListener","key","closest","enableTooltips","tooltip","init","pendingPromise","Pending","Scroll","$","fn","dropdown","Constructor","Default","flip","Aria","resolve"],"mappings":"mTA0BA,OACA,OACA,OACA,OACA,OACA,O,sDAKMA,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,GAAIA,CAAAA,CAAI,CAAGM,MAAM,CAACD,QAAP,CAAgBL,IAA3B,CACA,GAAIA,CAAJ,CAAU,CACP,cAAE,oBAAqBA,CAArB,CAA4B,KAA9B,EAAoCO,GAApC,CAAwC,MAAxC,CACF,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,EAMAC,QAAQ,CAACC,gBAAT,CAA0B,SAA1B,CAAqC,SAAAf,CAAC,CAAI,CACtC,GAAc,QAAV,GAAAA,CAAC,CAACgB,GAAF,EAAsBhB,CAAC,CAACE,MAAF,CAASe,OAAT,CAAiB,2BAAjB,CAA1B,CAAuE,CACnE,cAAEjB,CAAC,CAACE,MAAJ,EAAYQ,OAAZ,CAAoB,MAApB,CACH,CACJ,CAJD,CAKH,C,CAMKQ,CAAc,CAAG,UAAM,CACzB,cAAE,MAAF,EAAUC,OAAV,CAAkB,CACdR,SAAS,CAAE,MADG,CAEdC,QAAQ,CAAE,2BAFI,CAAlB,CAIH,C,CAKKQ,CAAI,CAAG,UAAM,CACf,GAAMC,CAAAA,CAAc,CAAG,GAAIC,UAAJ,CAAY,yBAAZ,CAAvB,CAEA,gBAGAxB,CAAY,GAGZW,CAAc,GAGdS,CAAc,GAGb,GAAIK,UAAJ,EAAD,CAAeH,IAAf,GAGAI,UAAEC,EAAF,CAAKC,QAAL,CAAcC,WAAd,CAA0BC,OAA1B,CAAkCC,IAAlC,IAGAC,UAAKV,IAAL,GAEAC,CAAc,CAACU,OAAf,EACH,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 * Template renderer for Moodle. Load and render Moodle templates with Mustache.\n *\n * @module core/templates\n * @package core\n * @class templates\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 Aria from './aria';\nimport Bootstrap from './bootstrap/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 var hash = window.location.hash;\n if (hash) {\n $('.nav-link[href=\"' + hash + '\"]').tab('show');\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\n/**\n * Bootstrap init function\n */\nconst init = () => {\n const pendingPromise = new Pending('theme_boost/loader:init');\n\n setupBootstrapPendingChecks();\n\n // Remember the last visited tabs.\n rememberTabs();\n\n // Enable all popovers.\n enablePopovers();\n\n // Enable all tooltips.\n enableTooltips();\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\n // Setup Aria helpers for Bootstrap features.\n Aria.init();\n\n pendingPromise.resolve();\n};\n\n/**\n * Set up the search.\n *\n * @method init\n */\nexport {\n init,\n Bootstrap\n};\n"],"file":"loader.min.js"}
|
@ -27,7 +27,6 @@
|
||||
import $ from 'jquery';
|
||||
import Aria from './aria';
|
||||
import Bootstrap from './bootstrap/index';
|
||||
import CustomEvents from 'core/custom_interaction_events';
|
||||
import Pending from 'core/pending';
|
||||
import Scroll from './scroll';
|
||||
import setupBootstrapPendingChecks from './pending';
|
||||
@ -56,16 +55,15 @@ const rememberTabs = () => {
|
||||
*/
|
||||
const enablePopovers = () => {
|
||||
$('body').popover({
|
||||
container: 'body',
|
||||
selector: '[data-toggle="popover"]',
|
||||
trigger: 'focus hover',
|
||||
placement: 'auto'
|
||||
trigger: 'focus',
|
||||
});
|
||||
|
||||
CustomEvents.define($('body'), [
|
||||
CustomEvents.events.escape,
|
||||
]);
|
||||
$('body').on(CustomEvents.events.escape, '[data-toggle=popover]', function() {
|
||||
$(this).trigger('blur');
|
||||
document.addEventListener('keydown', e => {
|
||||
if (e.key === 'Escape' && e.target.closest('[data-toggle="popover"]')) {
|
||||
$(e.target).popover('hide');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@ -76,7 +74,7 @@ const enablePopovers = () => {
|
||||
const enableTooltips = () => {
|
||||
$('body').tooltip({
|
||||
container: 'body',
|
||||
selector: '[data-toggle="tooltip"]'
|
||||
selector: '[data-toggle="tooltip"]',
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user