mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
closes #1245
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
if ('undefined' !== typeof window) {
|
if ('undefined' !== typeof window) {
|
||||||
|
|
||||||
(function ($, undefined) {
|
(function ($, undefined) {
|
||||||
@@ -17,7 +19,9 @@ if ('undefined' !== typeof window) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$.fn.selectRange = function(start, end) {
|
$.fn.selectRange = function(start, end) {
|
||||||
if(!end) end = start;
|
if(!end) {
|
||||||
|
end = start;
|
||||||
|
}
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
if (this.setSelectionRange) {
|
if (this.setSelectionRange) {
|
||||||
this.focus();
|
this.focus();
|
||||||
@@ -48,4 +52,25 @@ if ('undefined' !== typeof window) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
})(jQuery || {fn:{}});
|
})(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();
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user