From 0d8085c070ba34385d4867f377e114442fa31870 Mon Sep 17 00:00:00 2001 From: flash1452 Date: Wed, 3 Feb 2016 17:24:36 +0530 Subject: [PATCH] Fix #11864 Move noSelect mehthod to makegrid.js Signed-off-by: Vishal Pandey --- js/functions.js | 42 ------------------------------------------ js/makegrid.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 42 deletions(-) diff --git a/js/functions.js b/js/functions.js index 75fe3bc6a8..2dd2ced34a 100644 --- a/js/functions.js +++ b/js/functions.js @@ -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 diff --git a/js/makegrid.js b/js/makegrid.js index 75bd4c633f..10ad2049ae 100644 --- a/js/makegrid.js +++ b/js/makegrid.js @@ -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);