diff --git a/public/src/overrides.js b/public/src/overrides.js index df4ab27f24..fe29fdf80e 100644 --- a/public/src/overrides.js +++ b/public/src/overrides.js @@ -1,3 +1,5 @@ +'use strict'; + if ('undefined' !== typeof window) { (function ($, undefined) { @@ -17,7 +19,9 @@ if ('undefined' !== typeof window) { }; $.fn.selectRange = function(start, end) { - if(!end) end = start; + if(!end) { + end = start; + } return this.each(function() { if (this.setSelectionRange) { this.focus(); @@ -48,4 +52,25 @@ if ('undefined' !== typeof window) { }; })(jQuery || {fn:{}}); + + + // FIX FOR #1245 - https://github.com/designcreateplay/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 + e.button === 2 || _clearMenus(); + }); + } \ No newline at end of file