Skip to content

Commit

Permalink
optimize: remove the insertion of "content_script.css" from the conte…
Browse files Browse the repository at this point in the history
…nt page. (openai-translator#381)

* fix:reset's css overrides the CSS of the content page in content_script.css

* chore:remove unused grants in userscript.js
  • Loading branch information
soeyu authored Mar 19, 2023
1 parent ad37175 commit fb63b35
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 15 deletions.
4 changes: 1 addition & 3 deletions build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ async function build() {
const commonFiles = [
{ src: `${browserExtensionOutDir}/content_script/index.js`, dst: 'js/content_script.js' },
{ src: `${browserExtensionOutDir}/content_script/index.js.map`, dst: 'js/content_script.js.map' },
{ src: `${browserExtensionOutDir}/content_script/index.css`, dst: 'css/content_script.css' },
{ src: `${browserExtensionOutDir}/background/index.js`, dst: 'js/background.js' },
{ src: `${browserExtensionOutDir}/options/index.js`, dst: 'js/options.js' },
{ src: `${browserExtensionOutDir}/options/index.css`, dst: 'css/options.css' },
Expand Down Expand Up @@ -87,8 +86,7 @@ async function build() {
// userscript
await copyFiles(
[
{ src: `${browserExtensionOutDir}/content_script/index.js`, dst: 'index.js' },
{ src: `${browserExtensionOutDir}/content_script/index.css`, dst: 'index.css' },
{ src: `${browserExtensionOutDir}/content_script/index.js`, dst: 'index.js' }
],
`./${userscriptOutDir}`
)
Expand Down
3 changes: 1 addition & 2 deletions public/manifest.firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
{
"matches": ["<all_urls>"],
"all_frames": true,
"js": ["js/content_script.js"],
"css": ["css/content_script.css"]
"js": ["js/content_script.js"]
}
],

Expand Down
3 changes: 1 addition & 2 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
{
"matches": ["<all_urls>"],
"all_frames": true,
"js": ["js/content_script.js"],
"css": ["css/content_script.css"]
"js": ["js/content_script.js"]
}
],

Expand Down
8 changes: 0 additions & 8 deletions public/userscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,10 @@
// @icon https://cdn.jsdelivr.net/gh/yetone/[email protected]/public/icon.png
// @match *://*/*
// @require https://cdn.jsdelivr.net/gh/yetone/[email protected]/dist/userscript/index.js
// @resource MAIN_CSS https://cdn.jsdelivr.net/gh/yetone/[email protected]/dist/userscript/index.css
// @grant GM.setValue
// @grant GM.getValue
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
// @grant GM_getResourceText
// @license MIT
// ==/UserScript==

/* eslint-disable no-undef */
;(function () {
'use strict'
const css = GM_getResourceText('MAIN_CSS')
GM_addStyle(css)
})()

0 comments on commit fb63b35

Please sign in to comment.