diff --git a/packages/chrome-plugin/package.json b/packages/chrome-plugin/package.json index 84dc2c170..80dbef669 100644 --- a/packages/chrome-plugin/package.json +++ b/packages/chrome-plugin/package.json @@ -29,7 +29,6 @@ "@playwright/test": "^1.52.0", "@sveltejs/vite-plugin-svelte": "^4.0.0", "@types/chrome": "^0.0.246", - "@types/jquery": "^3.5.32", "@types/lodash-es": "^4.17.12", "@types/node": "catalog:", "flowbite": "^3.1.2", @@ -52,7 +51,6 @@ "@tailwindcss/vite": "^4.1.4", "@webcomponents/custom-elements": "^1.6.0", "harper.js": "workspace:*", - "jquery": "^3.7.1", "lint-framework": "workspace:*", "lodash-es": "^4.17.21", "lru-cache": "^11.1.0", diff --git a/packages/chrome-plugin/src/contentScript/index.ts b/packages/chrome-plugin/src/contentScript/index.ts index 5d5b9e4a0..9f008d9cf 100644 --- a/packages/chrome-plugin/src/contentScript/index.ts +++ b/packages/chrome-plugin/src/contentScript/index.ts @@ -1,5 +1,4 @@ import '@webcomponents/custom-elements'; -import $ from 'jquery'; import { isVisible, LintFramework, leafNodes } from 'lint-framework'; import ProtocolClient from '../ProtocolClient'; @@ -19,24 +18,31 @@ const keepAliveCallback = () => { keepAliveCallback(); function scan() { - $('textarea:visible').each(function () { - if (this.getAttribute('data-enable-grammarly') == 'false' || this.disabled || this.readOnly) { + document.querySelectorAll('textarea').forEach((element) => { + if ( + !isVisible(element) || + element.getAttribute('data-enable-grammarly') === 'false' || + element.disabled || + element.readOnly + ) { return; } - fw.addTarget(this as HTMLTextAreaElement); + fw.addTarget(element); }); - $('input[type="text"][spellcheck="true"]').each(function () { - if (this.disabled || this.readOnly) { - return; - } + document + .querySelectorAll('input[type="text"][spellcheck="true"]') + .forEach((element) => { + if (element.disabled || element.readOnly) { + return; + } - fw.addTarget(this as HTMLInputElement); - }); + fw.addTarget(element); + }); - $('[data-testid="gutenberg-editor"]').each(function () { - const leafs = leafNodes(this); + document.querySelectorAll('[data-testid="gutenberg-editor"]').forEach((element) => { + const leafs = leafNodes(element); for (const leaf of leafs) { if (!isVisible(leaf)) { @@ -47,8 +53,8 @@ function scan() { } }); - $('[contenteditable="true"],[contenteditable]').each(function () { - const leafs = leafNodes(this); + document.querySelectorAll('[contenteditable="true"],[contenteditable]').forEach((element) => { + const leafs = leafNodes(element); for (const leaf of leafs) { if (leaf.parentElement?.closest('[contenteditable="false"],[disabled],[readonly]') != null) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d55e5da50..df612a618 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,9 +49,6 @@ importers: harper.js: specifier: workspace:* version: link:../harper.js - jquery: - specifier: ^3.7.1 - version: 3.7.1 lint-framework: specifier: workspace:* version: link:../lint-framework @@ -77,9 +74,6 @@ importers: '@types/chrome': specifier: ^0.0.246 version: 0.0.246 - '@types/jquery': - specifier: ^3.5.32 - version: 3.5.32 '@types/lodash-es': specifier: ^4.17.12 version: 4.17.12 @@ -3320,9 +3314,6 @@ packages: '@types/jasmine@5.1.7': resolution: {integrity: sha512-DVOfk9FaClQfNFpSfaML15jjB5cjffDMvjtph525sroR5BEAW2uKnTOYUTqTFuZFjNvH0T5XMIydvIctnUKufw==} - '@types/jquery@3.5.32': - resolution: {integrity: sha512-b9Xbf4CkMqS02YH8zACqN1xzdxc3cO735Qe5AbSUFmyOiaWAbcpqh9Wna+Uk0vgACvoQHpWDg2rGdHkYPLmCiQ==} - '@types/js-yaml@4.0.9': resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==} @@ -3412,9 +3403,6 @@ packages: '@types/simple-peer@9.11.8': resolution: {integrity: sha512-rvqefdp2rvIA6wiomMgKWd2UZNPe6LM2EV5AuY3CPQJF+8TbdrL5TjYdMf0VAjGczzlkH4l1NjDkihwbj3Xodw==} - '@types/sizzle@2.3.9': - resolution: {integrity: sha512-xzLEyKB50yqCUPUJkIsrVvoWNfFUbIZI+RspLWt8u+tIW/BetMBZtgV2LY/2o+tYH8dRvQ+eoPf3NdhQCcLE2w==} - '@types/sockjs@0.3.36': resolution: {integrity: sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==} @@ -7401,9 +7389,6 @@ packages: jpeg-js@0.4.4: resolution: {integrity: sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==} - jquery@3.7.1: - resolution: {integrity: sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==} - js-library-detector@6.7.0: resolution: {integrity: sha512-c80Qupofp43y4cJ7+8TTDN/AsDwLi5oOm/plBrWI+iQt485vKXCco+yVmOwEgdo9VOdsYTuV0UlTeetVPTriXA==} engines: {node: '>=12'} @@ -15204,10 +15189,6 @@ snapshots: '@types/jasmine@5.1.7': {} - '@types/jquery@3.5.32': - dependencies: - '@types/sizzle': 2.3.9 - '@types/js-yaml@4.0.9': {} '@types/jsdom@20.0.1': @@ -15294,8 +15275,6 @@ snapshots: dependencies: '@types/node': 22.13.10 - '@types/sizzle@2.3.9': {} - '@types/sockjs@0.3.36': dependencies: '@types/node': 22.13.10 @@ -20864,8 +20843,6 @@ snapshots: jpeg-js@0.4.4: {} - jquery@3.7.1: {} - js-library-detector@6.7.0: {} js-tokens@4.0.0: {}