Skip to content

Commit 7c28e8e

Browse files
Merge pull request #19660 from MauricioFauth/noSelect-jquery-plugin-removal
Remove .noSelect() jQuery plugin
2 parents 47be11f + 69efbbc commit 7c28e8e

2 files changed

Lines changed: 3 additions & 49 deletions

File tree

resources/js/global.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ interface Window {
1818
interface JQuery {
1919
sortableTable: (method: any) => any;
2020

21-
noSelect: (p?: any) => any;
22-
2321
menuResizer: (method: string|Function) => any;
2422

2523
filterByValue: (value: any) => any;

resources/js/src/makegrid.ts

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ const makeGrid = function (t, enableResize = undefined, enableReorder = undefine
108108
objWidth: $(g.t).find('th.draggable:visible').eq(n).find('span').outerWidth()
109109
};
110110

111-
// eslint-disable-next-line compat/compat
112-
$(document.body).css('cursor', 'col-resize').noSelect();
111+
$(document.body).css('cursor', 'col-resize').addClass('user-select-none');
113112
if (g.isCellEditActive) {
114113
g.hideEditCell();
115114
}
@@ -149,8 +148,7 @@ const makeGrid = function (t, enableResize = undefined, enableReorder = undefine
149148
objLeft: objPos.left
150149
};
151150

152-
// eslint-disable-next-line compat/compat
153-
$(document.body).css('cursor', 'move').noSelect();
151+
$(document.body).css('cursor', 'move').addClass('user-select-none');
154152
if (g.isCellEditActive) {
155153
g.hideEditCell();
156154
}
@@ -250,8 +248,7 @@ const makeGrid = function (t, enableResize = undefined, enableReorder = undefine
250248
g.colReorder = false;
251249
}
252250

253-
// eslint-disable-next-line compat/compat
254-
$(document.body).css('cursor', 'inherit').noSelect(false);
251+
$(document.body).css('cursor', 'inherit').removeClass('user-select-none');
255252
},
256253

257254
/**
@@ -2431,44 +2428,3 @@ declare global {
24312428
}
24322429

24332430
window.makeGrid = makeGrid;
2434-
2435-
/**
2436-
* jQuery plugin to cancel selection in HTML code.
2437-
*/
2438-
(function ($) {
2439-
$.fn.noSelect = function (p = null) { // no select plugin by Paulo P.Marinas
2440-
var prevent = (p === null) ? true : p;
2441-
/* eslint-disable compat/compat */
2442-
var isMsie = navigator.userAgent.indexOf('MSIE') > -1 || !! window.navigator.userAgent.match(/Trident.*rv:11\./);
2443-
var isFirefox = navigator.userAgent.indexOf('Firefox') > -1;
2444-
var isSafari = navigator.userAgent.indexOf('Safari') > -1;
2445-
var isOpera = navigator.userAgent.indexOf('Presto') > -1;
2446-
/* eslint-enable compat/compat */
2447-
if (prevent) {
2448-
return this.each(function () {
2449-
if (isMsie || isSafari) {
2450-
$(this).on('selectstart', false);
2451-
} else if (isFirefox) {
2452-
$(this).css('MozUserSelect', 'none');
2453-
$('body').trigger('focus');
2454-
} else if (isOpera) {
2455-
$(this).on('mousedown', false);
2456-
} else {
2457-
$(this).attr('unselectable', 'on');
2458-
}
2459-
});
2460-
} else {
2461-
return this.each(function () {
2462-
if (isMsie || isSafari) {
2463-
$(this).off('selectstart');
2464-
} else if (isFirefox) {
2465-
$(this).css('MozUserSelect', 'inherit');
2466-
} else if (isOpera) {
2467-
$(this).off('mousedown');
2468-
} else {
2469-
$(this).removeAttr('unselectable');
2470-
}
2471-
});
2472-
}
2473-
}; // end noSelect
2474-
}($));

0 commit comments

Comments
 (0)