mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
fix webpack config
This commit is contained in:
+4
-2
@@ -2,11 +2,13 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"commonjs": true,
|
"commonjs": true,
|
||||||
"es2021": true
|
"es2021": true,
|
||||||
|
"node": true // add this line to allow Node.js-specific globals
|
||||||
},
|
},
|
||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": "latest"
|
"ecmaVersion": "latest",
|
||||||
|
"sourceType": "module" // add this line to allow 'import' and 'export' statements
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"indent": ["error", 2],
|
"indent": ["error", 2],
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false
|
||||||
|
}
|
||||||
+5
-2
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "evenbetterseqta",
|
"name": "evenbetterseqta",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
"type": "module",
|
||||||
"description": " ",
|
"description": " ",
|
||||||
"main": "webpack.config.js",
|
"main": "webpack.config.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack --config webpack.config.js",
|
"build": "webpack --config webpack.config.js --mode production",
|
||||||
"dev": "webpack --config webpack.config.js --watch"
|
"dev": "webpack --config webpack.config.js --watch --mode production"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
@@ -13,6 +14,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"copy-webpack-plugin": "^11.0.0",
|
"copy-webpack-plugin": "^11.0.0",
|
||||||
"css-loader": "^6.8.1",
|
"css-loader": "^6.8.1",
|
||||||
|
"dompurify": "^3.0.5",
|
||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
"eslint-config-prettier": "^9.0.0",
|
"eslint-config-prettier": "^9.0.0",
|
||||||
"eslint-webpack-plugin": "^4.0.1",
|
"eslint-webpack-plugin": "^4.0.1",
|
||||||
@@ -22,6 +24,7 @@
|
|||||||
"sass": "^1.65.1",
|
"sass": "^1.65.1",
|
||||||
"sass-loader": "^13.3.2",
|
"sass-loader": "^13.3.2",
|
||||||
"style-loader": "^3.3.3",
|
"style-loader": "^3.3.3",
|
||||||
|
"webextension-polyfill": "^0.10.0",
|
||||||
"webpack": "^5.88.2",
|
"webpack": "^5.88.2",
|
||||||
"webpack-cli": "^5.1.4"
|
"webpack-cli": "^5.1.4"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,13 +11,15 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/*global chrome*/
|
||||||
|
|
||||||
const onoffselection = document.querySelector("#onoff");
|
const onoffselection = document.querySelector("#onoff");
|
||||||
const notificationcollector = document.querySelector("#notification");
|
const notificationcollector = document.querySelector("#notification");
|
||||||
const lessonalert = document.querySelector("#lessonalert");
|
const lessonalert = document.querySelector("#lessonalert");
|
||||||
const aboutsection = document.querySelector("#aboutsection");
|
const aboutsection = document.querySelector("#aboutsection");
|
||||||
const shortcutsection = document.querySelector("#shortcutsection");
|
const shortcutsection = document.querySelector("#shortcutsection");
|
||||||
const miscsection = document.querySelector("#miscsection");
|
const miscsection = document.querySelector("#miscsection");
|
||||||
const mainpage = document.querySelector("#mainpage");
|
//const mainpage = document.querySelector("#mainpage");
|
||||||
const colorpicker = document.querySelector("#colorpicker");
|
const colorpicker = document.querySelector("#colorpicker");
|
||||||
const animatedbk = document.querySelector("#animatedbk");
|
const animatedbk = document.querySelector("#animatedbk");
|
||||||
const customshortcutbutton = document.getElementsByClassName(
|
const customshortcutbutton = document.getElementsByClassName(
|
||||||
@@ -63,7 +65,7 @@ function openGithub() {
|
|||||||
url: "https://github.com/SethBurkart123/EvenBetterSEQTA",
|
url: "https://github.com/SethBurkart123/EvenBetterSEQTA",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
function openPage(page) {
|
function openPage(page) {
|
||||||
mainpage.style.left = "-350px";
|
mainpage.style.left = "-350px";
|
||||||
page.style.right = "0px";
|
page.style.right = "0px";
|
||||||
@@ -75,7 +77,7 @@ function backToMainMenu() {
|
|||||||
menupage.style.right = "-350px";
|
menupage.style.right = "-350px";
|
||||||
shortcutpage.style.right = "-350px";
|
shortcutpage.style.right = "-350px";
|
||||||
miscpage.style.right = "-350px";
|
miscpage.style.right = "-350px";
|
||||||
}
|
}*/
|
||||||
|
|
||||||
function resetActive() {
|
function resetActive() {
|
||||||
for (let i = 0; i < navbuttons.length; i++) {
|
for (let i = 0; i < navbuttons.length; i++) {
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
+241
-240
File diff suppressed because one or more lines are too long
+19
-19
@@ -1,3 +1,5 @@
|
|||||||
|
/*global chrome*/
|
||||||
|
|
||||||
function ReloadSEQTAPages() {
|
function ReloadSEQTAPages() {
|
||||||
chrome.tabs.query({}, function (tabs) {
|
chrome.tabs.query({}, function (tabs) {
|
||||||
for (let tab of tabs) {
|
for (let tab of tabs) {
|
||||||
@@ -8,7 +10,7 @@ function ReloadSEQTAPages() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
chrome.runtime.onMessage.addListener(function (request, sender) {
|
chrome.runtime.onMessage.addListener(function (request) {
|
||||||
if (request.type == "reloadTabs") {
|
if (request.type == "reloadTabs") {
|
||||||
ReloadSEQTAPages();
|
ReloadSEQTAPages();
|
||||||
} else if (request.type == "githubTab") {
|
} else if (request.type == "githubTab") {
|
||||||
@@ -29,7 +31,7 @@ chrome.runtime.onMessage.addListener(function (request, sender) {
|
|||||||
{ permissions: ["declarativeContent"], origins: ["*://*/*"] },
|
{ permissions: ["declarativeContent"], origins: ["*://*/*"] },
|
||||||
function (granted) {
|
function (granted) {
|
||||||
if (granted) {
|
if (granted) {
|
||||||
rules = [
|
let rules = [
|
||||||
{
|
{
|
||||||
conditions: [
|
conditions: [
|
||||||
new chrome.declarativeContent.PageStateMatcher({
|
new chrome.declarativeContent.PageStateMatcher({
|
||||||
@@ -70,7 +72,18 @@ chrome.runtime.onMessage.addListener(function (request, sender) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var NewsJSON = {};
|
function GetNews(url, sendResponse) {
|
||||||
|
fetch(url)
|
||||||
|
.then((result) => result.json())
|
||||||
|
.then((response) => {
|
||||||
|
if (response.code == "rateLimited") {
|
||||||
|
url += "%00";
|
||||||
|
GetNews();
|
||||||
|
} else {
|
||||||
|
sendResponse({ news: response });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
|
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
|
||||||
if (request.type === "sendNews") {
|
if (request.type === "sendNews") {
|
||||||
@@ -92,20 +105,7 @@ chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
|
|||||||
// var url = `https://newsapi.org/v2/everything?sources=abc-news&from=${TodayFormatted}&sortBy=popularity&apiKey=17c0da766ba347c89d094449504e3080`;
|
// var url = `https://newsapi.org/v2/everything?sources=abc-news&from=${TodayFormatted}&sortBy=popularity&apiKey=17c0da766ba347c89d094449504e3080`;
|
||||||
var url = `https://newsapi.org/v2/everything?domains=abc.net.au&from=${from}&apiKey=17c0da766ba347c89d094449504e3080`;
|
var url = `https://newsapi.org/v2/everything?domains=abc.net.au&from=${from}&apiKey=17c0da766ba347c89d094449504e3080`;
|
||||||
|
|
||||||
function GetNews() {
|
GetNews(url, sendResponse);
|
||||||
fetch(url)
|
|
||||||
.then((result) => result.json())
|
|
||||||
.then((response) => {
|
|
||||||
if (response.code == "rateLimited") {
|
|
||||||
url += "%00";
|
|
||||||
GetNews();
|
|
||||||
} else {
|
|
||||||
sendResponse({ news: response });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
GetNews();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -196,9 +196,9 @@ function UpdateCurrentValues(details) {
|
|||||||
NewValue[i] = Object.assign({}, DefaultValues[i], CurrentValues[i]);
|
NewValue[i] = Object.assign({}, DefaultValues[i], CurrentValues[i]);
|
||||||
} else {
|
} else {
|
||||||
// If the object is an array, turn it back after
|
// If the object is an array, turn it back after
|
||||||
length = DefaultValues[i].length;
|
let length = DefaultValues[i].length;
|
||||||
NewValue[i] = Object.assign({}, DefaultValues[i], CurrentValues[i]);
|
NewValue[i] = Object.assign({}, DefaultValues[i], CurrentValues[i]);
|
||||||
NewArray = [];
|
let NewArray = [];
|
||||||
for (let j = 0; j < length; j++) {
|
for (let j = 0; j < length; j++) {
|
||||||
NewArray.push(NewValue[i][j]);
|
NewArray.push(NewValue[i][j]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<svg style="width:24px;height:24px;border-radius:0;" viewBox="0 0 24 24">
|
||||||
|
<path fill="currentColor" d="M6 20H13V22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H18C19.11 2 20 2.9 20 4V12.54L18.5 11.72L18 12V4H13V12L10.5 9.75L8 12V4H6V20M24 17L18.5 14L13 17L18.5 20L24 17M15 19.09V21.09L18.5 23L22 21.09V19.09L18.5 21L15 19.09Z"></path>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 340 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg style="width:24px;height:24px;border-radius:0;" viewBox="0 0 24 24">
|
||||||
|
<path fill="currentColor" d="M19 1L14 6V17L19 12.5V1M21 5V18.5C19.9 18.15 18.7 18 17.5 18C15.8 18 13.35 18.65 12 19.5V6C10.55 4.9 8.45 4.5 6.5 4.5C4.55 4.5 2.45 4.9 1 6V20.65C1 20.9 1.25 21.15 1.5 21.15C1.6 21.15 1.65 21.1 1.75 21.1C3.1 20.45 5.05 20 6.5 20C8.45 20 10.55 20.4 12 21.5C13.35 20.65 15.8 20 17.5 20C19.15 20 20.85 20.3 22.25 21.05C22.35 21.1 22.4 21.1 22.5 21.1C22.75 21.1 23 20.85 23 20.6V6C22.4 5.55 21.75 5.25 21 5M10 18.41C8.75 18.09 7.5 18 6.5 18C5.44 18 4.18 18.19 3 18.5V7.13C3.91 6.73 5.14 6.5 6.5 6.5C7.86 6.5 9.09 6.73 10 7.13V18.41Z"></path>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 649 B |
@@ -0,0 +1,12 @@
|
|||||||
|
import DOMPurify from "dompurify";
|
||||||
|
|
||||||
|
export function stringToHTML(str, styles = false) {
|
||||||
|
var parser = new DOMParser();
|
||||||
|
str = DOMPurify.sanitize(str, { ADD_ATTR: ["onclick"] });
|
||||||
|
var doc = parser.parseFromString(str, "text/html");
|
||||||
|
if (styles) {
|
||||||
|
doc.body.style.cssText =
|
||||||
|
"height: auto; overflow: scroll; margin: 0px; background: var(--background-primary);";
|
||||||
|
}
|
||||||
|
return doc.body;
|
||||||
|
}
|
||||||
+26
-18
@@ -1,9 +1,14 @@
|
|||||||
const path = require("path");
|
import path from "path";
|
||||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
||||||
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
import CopyWebpackPlugin from "copy-webpack-plugin";
|
||||||
const ESLintPlugin = require("eslint-webpack-plugin");
|
import ESLintPlugin from "eslint-webpack-plugin";
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
|
export default {
|
||||||
|
target: "web",
|
||||||
|
node: {
|
||||||
|
__dirname: true
|
||||||
|
},
|
||||||
performance: {
|
performance: {
|
||||||
hints: false,
|
hints: false,
|
||||||
maxEntrypointSize: 512000,
|
maxEntrypointSize: 512000,
|
||||||
@@ -13,9 +18,9 @@ module.exports = {
|
|||||||
entry: {
|
entry: {
|
||||||
SEQTA: "./src/SEQTA.js",
|
SEQTA: "./src/SEQTA.js",
|
||||||
background: "./src/background.js",
|
background: "./src/background.js",
|
||||||
"inject-documentload": "./src/inject/documentload.css", // Entry for CSS
|
"inject/documentload": "./src/inject/documentload.css", // Entry for CSS
|
||||||
"inject-iframe": "./src/inject/iframe.css", // Entry for CSS
|
"inject/iframe": "./src/inject/iframe.css", // Entry for CSS
|
||||||
"inject-injected": "./src/inject/injected.css", // Entry for CSS
|
"inject/injected": "./src/inject/injected.css", // Entry for CSS
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
filename: (pathData) => {
|
filename: (pathData) => {
|
||||||
@@ -23,15 +28,22 @@ module.exports = {
|
|||||||
return name.includes("inject") ? `inject/${name}.js` : `${name}.js`;
|
return name.includes("inject") ? `inject/${name}.js` : `${name}.js`;
|
||||||
},
|
},
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
path: path.resolve(__dirname, "build"),
|
path: path.resolve("build"),
|
||||||
|
publicPath: "",
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.css$/,
|
test: /\.css$/,
|
||||||
use: [MiniCssExtractPlugin.loader, "css-loader"],
|
use: [
|
||||||
// eslint-disable-next-line no-undef
|
MiniCssExtractPlugin.loader,
|
||||||
include: path.resolve(__dirname, "src"),
|
{
|
||||||
|
loader: "css-loader",
|
||||||
|
options: {
|
||||||
|
importLoaders: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
||||||
@@ -45,17 +57,13 @@ module.exports = {
|
|||||||
plugins: [
|
plugins: [
|
||||||
new ESLintPlugin(),
|
new ESLintPlugin(),
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: (pathData) => {
|
filename: "[name].css"
|
||||||
const name = pathData.chunk.name.replace("inject-", "");
|
|
||||||
return name.includes("inject")
|
|
||||||
? `inject/${name}.css`
|
|
||||||
: `inject/${name}.css`;
|
|
||||||
},
|
|
||||||
}),
|
}),
|
||||||
new CopyWebpackPlugin({
|
new CopyWebpackPlugin({
|
||||||
patterns: [
|
patterns: [
|
||||||
{ from: "public", to: "." },
|
{ from: "public", to: "." },
|
||||||
{ from: "src/inject/preview", to: "inject/preview" },
|
{ from: "src/inject/preview", to: "inject/preview" },
|
||||||
|
{ from: "node_modules/webextension-polyfill/dist/browser-polyfill.js", to: "."},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user