Fix #11864 Move noSelect mehthod to makegrid.js

Signed-off-by: Vishal Pandey <vishpandey2014@gmail.com>
This commit is contained in:
flash1452 2016-02-03 17:24:36 +05:30 committed by Michal Čihař
parent dc161e86f5
commit 0d8085c070
2 changed files with 43 additions and 42 deletions

View File

@ -4286,48 +4286,6 @@ AJAX.registerOnload('functions.js', function () {
$(this).data('val-hash', AJAX.hash($(this).is(":checked")));
});
});
/**
* jQuery plugin to cancel selection in HTML code.
*/
(function ($) {
$.fn.noSelect = function (p) { //no select plugin by Paulo P.Marinas
var prevent = (p === null) ? true : p;
var is_msie = navigator.userAgent.indexOf('MSIE') > -1 || !!window.navigator.userAgent.match(/Trident.*rv\:11\./);
var is_firefox = navigator.userAgent.indexOf('Firefox') > -1;
var is_safari = navigator.userAgent.indexOf("Safari") > -1;
var is_opera = navigator.userAgent.indexOf("Presto") > -1;
if (prevent) {
return this.each(function () {
if (is_msie || is_safari) {
$(this).bind('selectstart', function () {
return false;
});
} else if (is_firefox) {
$(this).css('MozUserSelect', 'none');
$('body').trigger('focus');
} else if (is_opera) {
$(this).bind('mousedown', function () {
return false;
});
} else {
$(this).attr('unselectable', 'on');
}
});
} else {
return this.each(function () {
if (is_msie || is_safari) {
$(this).unbind('selectstart');
} else if (is_firefox) {
$(this).css('MozUserSelect', 'inherit');
} else if (is_opera) {
$(this).unbind('mousedown');
} else {
$(this).removeAttr('unselectable');
}
});
}
}; //end noSelect
})(jQuery);
/**
* jQuery plugin to correctly filter input fields by value, needed

View File

@ -2228,3 +2228,46 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$(t).removeClass('data');
$(g.gDiv).addClass('data');
}
/**
* jQuery plugin to cancel selection in HTML code.
*/
(function ($) {
$.fn.noSelect = function (p) { //no select plugin by Paulo P.Marinas
var prevent = (p === null) ? true : p;
var is_msie = navigator.userAgent.indexOf('MSIE') > -1 || !!window.navigator.userAgent.match(/Trident.*rv\:11\./);
var is_firefox = navigator.userAgent.indexOf('Firefox') > -1;
var is_safari = navigator.userAgent.indexOf("Safari") > -1;
var is_opera = navigator.userAgent.indexOf("Presto") > -1;
if (prevent) {
return this.each(function () {
if (is_msie || is_safari) {
$(this).bind('selectstart', function () {
return false;
});
} else if (is_firefox) {
$(this).css('MozUserSelect', 'none');
$('body').trigger('focus');
} else if (is_opera) {
$(this).bind('mousedown', function () {
return false;
});
} else {
$(this).attr('unselectable', 'on');
}
});
} else {
return this.each(function () {
if (is_msie || is_safari) {
$(this).unbind('selectstart');
} else if (is_firefox) {
$(this).css('MozUserSelect', 'inherit');
} else if (is_opera) {
$(this).unbind('mousedown');
} else {
$(this).removeAttr('unselectable');
}
});
}
}; //end noSelect
})(jQuery);