From ebe5bede54ca63a3ac20c8b46d7cd943a40a12cf Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Thu, 31 Aug 2023 06:08:10 +1000 Subject: [PATCH] improve styling, fix dark mode bugs --- README.md | 2 +- package.json | 2 +- public/manifest.json | 2 +- public/popup/info.html | 6 +- src/SEQTA.js | 199 ++++++------------ src/inject/injected.css | 40 ++-- ...assessmentsIcon.svg => assessmentsIcon.js} | 4 +- .../icons/{coursesIcon.svg => coursesIcon.js} | 4 +- src/seqta/ui/Loading.js | 81 +++++++ src/seqta/utils/stringToHTML.js | 2 +- 10 files changed, 183 insertions(+), 159 deletions(-) rename src/seqta/icons/{assessmentsIcon.svg => assessmentsIcon.js} (90%) rename src/seqta/icons/{coursesIcon.svg => coursesIcon.js} (94%) create mode 100644 src/seqta/ui/Loading.js diff --git a/README.md b/README.md index 40de5be3..a201b7af 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![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) -# Even BetterSEQTA +# BetterSEQTA+ Forking the BetterSEQTA project to add extra functionality Looking for contributors! diff --git a/package.json b/package.json index 132029d8..93285561 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "evenbetterseqta", + "name": "betterseqtaplus", "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)", diff --git a/public/manifest.json b/public/manifest.json index f15ae02d..4a8f95d1 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,6 +1,6 @@ { "manifest_version": 3, - "name": "Even BetterSEQTA", + "name": "BetterSEQTA+", "version": "3.0.0", "description": "An extension that makes the SEQTA experience customizable and unique to you!", "icons": { diff --git a/public/popup/info.html b/public/popup/info.html index 76c52271..f2584170 100644 --- a/public/popup/info.html +++ b/public/popup/info.html @@ -50,7 +50,7 @@ Created and developed and maintained by CK and AH

- EvenBetterSEQTA is a revived or BetterSEQTA which is no longer + BetterSEQTA+ is a revived or BetterSEQTA which is no longer maintained.

@@ -330,7 +330,7 @@

Animated Background

- Adds an animated background to EvenBetterSEQTA. + Adds an animated background to BetterSEQTA+.

@@ -374,7 +374,7 @@
-

EvenBetterSEQTA

+

BetterSEQTA+

- - - - - -
v${ - chrome.runtime.getManifest().version -}
`, - ); - var html = document.getElementsByTagName("html")[0]; - html.append(loadinghtml.firstChild); -} - -function AppendLoadingSymbol(givenID, position) { - let loadingsymbol = stringToHTML(` -
- - - - -
`).firstChild; - - document.querySelector(position).appendChild(loadingsymbol); -} +let isChrome = window.chrome; +let SettingsClicked = false; +let MenuOptionsOpen = false; +let UserInitalCode = ""; +let currentSelectedDate = new Date(); +let WhatsNewOpen = false; +let LessonInterval; +let DarkMode; function delay(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); @@ -109,7 +32,7 @@ function ApplyCSSToHiddenMenuItems() { if (!Object.values(result.menuitems)[i].toggle) { stylesheetInnerText += SetDisplayNone(Object.keys(result.menuitems)[i]); console.log( - `[Even BetterSEQTA] Hiding ${ + `[BetterSEQTA+] Hiding ${ Object.keys(result.menuitems)[i] } menu item`, ); @@ -131,7 +54,7 @@ function OpenWhatsNewPopup() { var header = stringToHTML(`

What's New

-

Even BetterSEQTA V${chrome.runtime.getManifest().version}

+

BetterSEQTA+ V${chrome.runtime.getManifest().version}

`).firstChild; let imagecont = document.createElement("div"); @@ -150,17 +73,17 @@ function OpenWhatsNewPopup() { textcontainer.append(textheader); let text = stringToHTML( - ` + String.raw`
-

3.0.0 - Even BetterSEQTA *Complete Overhaul*

+

3.0.0 - BetterSEQTA+ *Complete Overhaul*

  • Redesigned appearance
  • Upgraded to manifest V3 (longer support)
  • Fixed transitional glitches
  • Under the hood improvements
  • Fixed News Feed
  • -

    2.0.7 - Added support to other domains + Minor bug fixes

  • Fixed Even BetterSEQTA not loading on some pages
  • Fixed text colour of notices being unreadable
  • Fixed pages not reloading when saving changes
  • +

    2.0.7 - Added support to other domains + Minor bug fixes

  • Fixed BetterSEQTA+ not loading on some pages
  • Fixed text colour of notices being unreadable
  • Fixed pages not reloading when saving changes
  • 2.0.2 - Minor bug fixes

  • Fixed indicator for current lesson
  • Fixed text colour for DM messages list in Light mode
  • Fixed user info text colour
  • -

    Sleek New Layout

  • Updated with a new font and presentation, Even BetterSEQTA has never looked better.
  • +

    Sleek New Layout

  • Updated with a new font and presentation, BetterSEQTA+ has never looked better.
  • New Updated Sidebar

  • Condensed appearance with new updated icons.
  • Independent Light Mode and Dark Mode

  • Dark mode and Light mode are now available to pick alongside your chosen Theme Colour. Your Theme Colour will now become an accent colour for the page. Light/Dark mode can be toggled with the new button, found in the top-right of the menu bar. @@ -168,7 +91,7 @@ function OpenWhatsNewPopup() { -

    Create Custom Shortcuts

  • Found in the Even BetterSEQTA Settings menu, custom shortcuts can now be created with a name and URL of your choice.
  • +

    Create Custom Shortcuts

  • Found in the BetterSEQTA+ Settings menu, custom shortcuts can now be created with a name and URL of your choice.
  • @@ -176,20 +99,19 @@ function OpenWhatsNewPopup() { `, ).firstChild; - let footer = stringToHTML(` -
    -
    - Report bugs and feedback: - - - - - - -
    -
    + let footer = stringToHTML( + String.raw` +
    +
    + Report bugs and feedback: + + + + + + +
    +
    `).firstChild; let exitbutton = document.createElement("div"); @@ -318,7 +240,8 @@ function CheckiFrameItems() { mutation.addedNodes.forEach(function (added_node) { if (added_node.tagName == "IFRAME") { chrome.storage.local.get(["DarkMode"], function (result) { - if (result.DarkMode) { + DarkMode = result.DarkMode; + if (DarkMode) { RunColourCheck(added_node); if ( added_node.contentDocument.documentElement.childNodes[1].style @@ -398,7 +321,7 @@ function LoadPageElements() { var sublink = window.location.href.split("/")[4]; switch (sublink) { case "news": - console.log("[Even BetterSEQTA] Started Init"); + console.log("[BetterSEQTA+] Started Init"); chrome.storage.local.get(null, function (result) { if (result.onoff) { SendNewsPage(); @@ -424,7 +347,7 @@ function LoadPageElements() { )[0]; if (typeof alertdiv == "undefined") { console.log( - "[Even BetterSEQTA] No notifications currently", + "[BetterSEQTA+] No notifications currently", ); } else { alertdiv.textContent = @@ -477,7 +400,7 @@ function LoadPageElements() { "notifications__bubble___1EkSQ", )[0]; if (typeof alertdiv == "undefined") { - console.log("[Even BetterSEQTA] No notifications currently"); + console.log("[BetterSEQTA+] No notifications currently"); } else { alertdiv.textContent = Notifications.payload.notifications.length; @@ -521,10 +444,11 @@ function CheckNoticeTextColour(notice) { mutations_list.forEach(function (mutation) { mutation.addedNodes.forEach(function (added_node) { chrome.storage.local.get(["DarkMode"], function (result) { + DarkMode = result.DarkMode; if (added_node.classList.contains("notice")) { var hex = added_node.style.cssText.split(" ")[1]; var threshold = GetThresholdofHex(hex); - if (result.DarkMode && threshold < 100) { + if (DarkMode && threshold < 100) { added_node.style.cssText = "--color: undefined;"; } } @@ -757,10 +681,12 @@ function ColorLuminance(hex, lum) { chrome.storage.onChanged.addListener(function (changes) { if (changes.selectedColor) { try { - document.documentElement.style.setProperty( - "--better-pale", - lightenAndPaleColor(changes.selectedColor.newValue), - ); + if (DarkMode) { + document.documentElement.style.setProperty( + "--better-pale", + lightenAndPaleColor(changes.selectedColor.newValue), + ); + } } catch (err) { console.log(err); } @@ -826,12 +752,13 @@ async function CheckLoadOnPeriods() { } function RunFunctionOnTrue(storedSetting) { + DarkMode = storedSetting.DarkMode; // If the option is 'on', open BetterSEQTA if (typeof storedSetting.onoff == "undefined") { chrome.runtime.sendMessage({ type: "setDefaultStorage" }); } if (storedSetting.onoff) { - console.log("[Even BetterSEQTA] Enabled"); + console.log("[BetterSEQTA+] Enabled"); // Injecting CSS File to the webpage to overwrite SEQTA's default CSS var cssFile = chrome.runtime.getURL("inject/injected.css"); var fileref = document.createElement("link"); @@ -965,7 +892,7 @@ document.addEventListener( !IsSEQTAPage ) { IsSEQTAPage = true; - console.log("[BetterSEQTA] Verified SEQTA Page"); + console.log("[BetterSEQTA+] Verified SEQTA Page"); var link = document.createElement("link"); link.href = chrome.runtime.getURL("inject/documentload.css"); @@ -1338,9 +1265,11 @@ function CallExtensionSettings() { document.head.append(fileref); let Settings = - stringToHTML(`