From a18a51c294acb2c59b4ace2bc0db98ad7473b3d3 Mon Sep 17 00:00:00 2001 From: sienori Date: Sun, 24 Feb 2019 05:08:26 +0900 Subject: [PATCH] Fix to not embed images in content --- package-lock.json | 36 ----------------------- package.json | 1 - src/content/components/TranslateButton.js | 3 ++ src/content/styles/TranslateButton.scss | 1 - src/manifest-chrome.json | 2 ++ src/manifest-firefox.json | 2 ++ src/manifest-opera.json | 2 ++ webpack.config.dev.js | 5 ---- webpack.config.dist.js | 5 ---- 9 files changed, 9 insertions(+), 48 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3d26cb4..280891c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1137,12 +1137,6 @@ "uri-js": "^4.2.1" } }, - "ajv-errors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz", - "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==", - "dev": true - }, "ajv-keywords": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", @@ -5381,12 +5375,6 @@ "brorand": "^1.0.1" } }, - "mime": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.0.tgz", - "integrity": "sha512-ikBcWwyqXQSHKtciCcctu9YfPbFYZ4+gbHEmE0Q8jzcTYQg5dHCr3g2wwAZjPoJfQVXZq6KXAjpXOTf5/cjT7w==", - "dev": true - }, "mime-db": { "version": "1.36.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", @@ -9739,30 +9727,6 @@ } } }, - "url-loader": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/url-loader/-/url-loader-1.1.2.tgz", - "integrity": "sha512-dXHkKmw8FhPqu8asTc1puBfe3TehOCo2+RmOOev5suNCIYBcT626kxiWg1NBVkwc4rO8BGa7gP70W7VXuqHrjg==", - "dev": true, - "requires": { - "loader-utils": "^1.1.0", - "mime": "^2.0.3", - "schema-utils": "^1.0.0" - }, - "dependencies": { - "schema-utils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", - "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - } - } - } - }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", diff --git a/package.json b/package.json index 63d2770..d4ee786 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "sass-loader": "^7.0.3", "style-loader": "^0.21.0", "uglifyjs-webpack-plugin": "^1.2.5", - "url-loader": "^1.1.2", "webextension-polyfill": "^0.3.1", "webpack": "^4.10.2", "webpack-cli": "^3.0.1", diff --git a/src/content/components/TranslateButton.js b/src/content/components/TranslateButton.js index 0be03e2..811cc12 100644 --- a/src/content/components/TranslateButton.js +++ b/src/content/components/TranslateButton.js @@ -1,4 +1,5 @@ import React from "react"; +import browser from "webextension-polyfill"; import { getSettings } from "src/settings/settings"; import "../styles/TranslateButton.scss"; @@ -30,7 +31,9 @@ export default props => { const { position, shouldShow } = props; const buttonSize = parseInt(getSettings("buttonSize")); const { top, left } = calcPosition(); + const iconUrl = browser.extension.getURL("icons/512.png"); const buttonStyle = { + backgroundImage: `url(${iconUrl})`, height: buttonSize, width: buttonSize, top: top + position.y, diff --git a/src/content/styles/TranslateButton.scss b/src/content/styles/TranslateButton.scss index 69f1fb1..9fd03f3 100644 --- a/src/content/styles/TranslateButton.scss +++ b/src/content/styles/TranslateButton.scss @@ -4,7 +4,6 @@ background-color: #fff; box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08); border-radius: 10%; - background-image: url("../../icons/512.png"); background-size: 75%; background-repeat: no-repeat; background-position: center; diff --git a/src/manifest-chrome.json b/src/manifest-chrome.json index e962628..d22fbdc 100644 --- a/src/manifest-chrome.json +++ b/src/manifest-chrome.json @@ -47,6 +47,8 @@ } ], + "web_accessible_resources": ["icons/512.png"], + "commands": { "_execute_browser_action": { "description": "__MSG_openPopupDescription__", diff --git a/src/manifest-firefox.json b/src/manifest-firefox.json index ace407f..059777b 100644 --- a/src/manifest-firefox.json +++ b/src/manifest-firefox.json @@ -53,6 +53,8 @@ } ], + "web_accessible_resources": ["icons/512.png"], + "commands": { "_execute_browser_action": { "description": "__MSG_openPopupDescription__" diff --git a/src/manifest-opera.json b/src/manifest-opera.json index c80e70b..f96f30c 100644 --- a/src/manifest-opera.json +++ b/src/manifest-opera.json @@ -47,6 +47,8 @@ } ], + "web_accessible_resources": ["icons/512.png"], + "commands": { "_execute_browser_action": { "description": "__MSG_openPopupDescription__", diff --git a/webpack.config.dev.js b/webpack.config.dev.js index 5efcb4e..83482c6 100644 --- a/webpack.config.dev.js +++ b/webpack.config.dev.js @@ -74,11 +74,6 @@ const generalConfig = { } } ] - }, - { - test: /\.(png|jpg|gif)$/, - loader: "url-loader", - options: {} } ] } diff --git a/webpack.config.dist.js b/webpack.config.dist.js index 4b3475c..00ad956 100644 --- a/webpack.config.dist.js +++ b/webpack.config.dist.js @@ -80,11 +80,6 @@ const generalConfig = { } } ] - }, - { - test: /\.(png|jpg|gif)$/, - loader: "url-loader", - options: {} } ] }