diff --git a/.eslintrc.json b/.eslintrc.json index 68d9b5d1..9bf03bc3 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,11 +2,13 @@ "env": { "browser": true, "commonjs": true, - "es2021": true + "es2021": true, + "node": true // add this line to allow Node.js-specific globals }, "extends": "eslint:recommended", "parserOptions": { - "ecmaVersion": "latest" + "ecmaVersion": "latest", + "sourceType": "module" // add this line to allow 'import' and 'export' statements }, "rules": { "indent": ["error", 2], @@ -14,4 +16,4 @@ "quotes": ["error", "double"], "semi": ["error", "always"] } -} +} \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..222861c3 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "tabWidth": 2, + "useTabs": false +} diff --git a/package.json b/package.json index 4427ded7..132029d8 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,12 @@ { "name": "evenbetterseqta", "version": "1.0.0", + "type": "module", "description": "![Logo](https://raw.githubusercontent.com/SethBurkart123/BetterThanBetterSeqta/c96edd5956fc11571408310aea98cf7222d6876f/src/icons/betterseqta-light-full.png#gh-dark-mode-only) ![Logo](https://raw.githubusercontent.com/SethBurkart123/BetterThanBetterSeqta/c96edd5956fc11571408310aea98cf7222d6876f/src/icons/betterseqta-dark-full.png#gh-light-mode-only)", "main": "webpack.config.js", "scripts": { - "build": "webpack --config webpack.config.js", - "dev": "webpack --config webpack.config.js --watch" + "build": "webpack --config webpack.config.js --mode production", + "dev": "webpack --config webpack.config.js --watch --mode production" }, "keywords": [], "author": "", @@ -13,6 +14,7 @@ "devDependencies": { "copy-webpack-plugin": "^11.0.0", "css-loader": "^6.8.1", + "dompurify": "^3.0.5", "eslint": "^8.48.0", "eslint-config-prettier": "^9.0.0", "eslint-webpack-plugin": "^4.0.1", @@ -22,6 +24,7 @@ "sass": "^1.65.1", "sass-loader": "^13.3.2", "style-loader": "^3.3.3", + "webextension-polyfill": "^0.10.0", "webpack": "^5.88.2", "webpack-cli": "^5.1.4" } diff --git a/public/popup/info.js b/public/popup/info.js index f1b406b4..9bbff158 100644 --- a/public/popup/info.js +++ b/public/popup/info.js @@ -11,13 +11,15 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +/*global chrome*/ + const onoffselection = document.querySelector("#onoff"); const notificationcollector = document.querySelector("#notification"); const lessonalert = document.querySelector("#lessonalert"); const aboutsection = document.querySelector("#aboutsection"); const shortcutsection = document.querySelector("#shortcutsection"); const miscsection = document.querySelector("#miscsection"); -const mainpage = document.querySelector("#mainpage"); +//const mainpage = document.querySelector("#mainpage"); const colorpicker = document.querySelector("#colorpicker"); const animatedbk = document.querySelector("#animatedbk"); const customshortcutbutton = document.getElementsByClassName( @@ -63,7 +65,7 @@ function openGithub() { url: "https://github.com/SethBurkart123/EvenBetterSEQTA", }); } - +/* function openPage(page) { mainpage.style.left = "-350px"; page.style.right = "0px"; @@ -75,7 +77,7 @@ function backToMainMenu() { menupage.style.right = "-350px"; shortcutpage.style.right = "-350px"; miscpage.style.right = "-350px"; -} +}*/ function resetActive() { for (let i = 0; i < navbuttons.length; i++) { diff --git a/src/.DS_Store b/src/.DS_Store index 3c2d477e..f54b8ea6 100644 Binary files a/src/.DS_Store and b/src/.DS_Store differ diff --git a/src/SEQTA.js b/src/SEQTA.js index a284dece..07ed8397 100644 --- a/src/SEQTA.js +++ b/src/SEQTA.js @@ -1,5 +1,12 @@ -const ShortcutLinks = require("./seqta/content/links.json"); -var MenuitemSVGKey = require("./seqta/content/MenuItemSVGKey.json"); +/*global chrome*/ + +import ShortcutLinks from "./seqta/content/links.json"; +import MenuitemSVGKey from "./seqta/content/MenuItemSVGKey.json"; +import { stringToHTML } from "./seqta/utils/stringToHTML.js"; + +// Icons +import assessmentsicon from "./seqta/icons/assessmentsIcon.svg"; +import coursesicon from "./seqta/icons/coursesIcon.svg"; var isChrome = window.chrome; var SettingsClicked = false; @@ -9,19 +16,8 @@ var currentSelectedDate = new Date(); var WhatsNewOpen = false; var LessonInterval; -function stringToHTML(str, styles = false) { - var parser = new DOMParser(); - var 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; -} - function loading() { - loadinghtml = stringToHTML( + let loadinghtml = stringToHTML( `