mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 10:46:14 +01:00
Fixed translator backwards compatibility issue
Also removed the _clearMenus global object because populating the global namespace is bad, bad, bad
This commit is contained in:
@@ -295,11 +295,13 @@
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define('translator', translator);
|
||||
|
||||
var _translator = translator;
|
||||
|
||||
// Expose a global `translator` object for backwards compatibility
|
||||
window.translator = {
|
||||
translate: function() {
|
||||
console.warn('[translator] Global invocation of the translator is now deprecated, please `require` the module instead.');
|
||||
translator.translate.apply(translator, arguments);
|
||||
_translator.translate.apply(_translator, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,25 +79,27 @@ if ('undefined' !== typeof window) {
|
||||
|
||||
})(jQuery || {fn:{}});
|
||||
|
||||
|
||||
// FIX FOR #1245 - https://github.com/NodeBB/NodeBB/issues/1245
|
||||
// from http://stackoverflow.com/questions/15931962/bootstrap-dropdown-disappear-with-right-click-on-firefox
|
||||
// obtain a reference to the original handler
|
||||
var _clearMenus = $._data(document, "events").click.filter(function (el) {
|
||||
return el.namespace === 'bs.data-api.dropdown' && el.selector === undefined;
|
||||
});
|
||||
|
||||
if(_clearMenus.length) {
|
||||
_clearMenus = _clearMenus[0].handler;
|
||||
}
|
||||
|
||||
// disable the old listener
|
||||
$(document)
|
||||
.off('click.data-api.dropdown', _clearMenus)
|
||||
.on('click.data-api.dropdown', function (e) {
|
||||
// call the handler only when not right-click
|
||||
if (e.button !== 2) {
|
||||
_clearMenus();
|
||||
}
|
||||
(function(){
|
||||
// FIX FOR #1245 - https://github.com/NodeBB/NodeBB/issues/1245
|
||||
// from http://stackoverflow.com/questions/15931962/bootstrap-dropdown-disappear-with-right-click-on-firefox
|
||||
// obtain a reference to the original handler
|
||||
var _clearMenus = $._data(document, "events").click.filter(function (el) {
|
||||
return el.namespace === 'bs.data-api.dropdown' && el.selector === undefined;
|
||||
});
|
||||
|
||||
if(_clearMenus.length) {
|
||||
_clearMenus = _clearMenus[0].handler;
|
||||
}
|
||||
|
||||
// disable the old listener
|
||||
$(document)
|
||||
.off('click.data-api.dropdown', _clearMenus)
|
||||
.on('click.data-api.dropdown', function (e) {
|
||||
// call the handler only when not right-click
|
||||
if (e.button !== 2) {
|
||||
_clearMenus();
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user