diff --git a/README.md b/README.md index bf82bb3..9d32408 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,6 @@ Once installed, open a new tab to see the extension's homepage. *Note: You can exit fullscreen by pressing ctrl+T after you've set up the shortcuts.* - + If you need to install extensions with chromewebstore.google.com blocked, try [Skebstore.](https://github.com/bypassiwastaken/skebstore) diff --git a/manifest.json b/manifest.json index a1a0d5d..34b43e7 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "manifest_version": 2, - "version": "2.4.1", + "version": "2.4.2", "name": "Skiovox Helper", "description": "A helper for the Skiovox exploit -- read more at skiovox.com", "icons": { @@ -100,4 +100,4 @@ "run-at": "document_start" } ] -} \ No newline at end of file +} diff --git a/new-tab/date-display.js b/new-tab/date-display.js index 91e14cf..6dbe2b0 100644 --- a/new-tab/date-display.js +++ b/new-tab/date-display.js @@ -1,12 +1,9 @@ -const DateStyles = { - DEFAULT: 1, - SWAP_MD: 2 -} - +const DateStyles = ["DEFAULT", "SWAP_MD", "YMD"] class DateDisplay { constructor(element) { this.element = element this.dateStyle = this.getSavedStyle() + this.validityCheck() this.render() this.startInterval() } @@ -25,24 +22,28 @@ class DateDisplay { year: date.getFullYear() } - if (this.dateStyle == 2) { + if (this.dateStyle == "1") { + this.element.textContent = [ + parts.day, parts.month, parts.year + ].join('/') + } + else if (this.dateStyle == "2") { this.element.textContent = [ parts.month, parts.day, parts.year ].join('/') - } else { + } + else if (this.dateStyle == "3") { this.element.textContent = [ - parts.day, parts.month, parts.year + parts.year, parts.month, parts.day ].join('/') } } onClickedDate() { - if (this.dateStyle === DateStyles.DEFAULT) { - this.dateStyle = DateStyles.SWAP_MD - } else { - this.dateStyle = DateStyles.DEFAULT - } // TODO: fix this middery - + this.dateStyle = parseInt(this.dateStyle)+1 + if (parseInt(this.dateStyle) > DateStyles.length) { + this.dateStyle = 1 + } this.setSavedStyle(this.dateStyle) } @@ -51,8 +52,50 @@ class DateDisplay { } getSavedStyle() { - return Number(localStorage.dateStyle) || DateStyles.DEFAULT + if (localStorage.dateStyle == null) { + autoDetect(chrome.i18n.getUILanguage()) + } + return localStorage.dateStyle || "1" + } + + validityCheck() { + if (parseInt(this.dateStyle) < 1) { + //this.autoDetect(chrome.i18n.getUILanguage()) + this.dateStyle = "1"; + } + if (typeof this.dateStyle === 'string' || this.dateStyle instanceof String) { + // ok cool + } else { + if (this.dateStyle = DateStyles.DEFAULT) { + this.dateStyle = "1" + } + else if (this.dateStyle = DateStyles.SWAP_MD) { + this.dateStyle = "2" + } + else if (this.dateStyle = DateStyles.YMD) { + this.dateStyle = "3" + } + } + this.setSavedStyle(this.dateStyle) } } export { DateDisplay } +/*const dmyLangs = ["el", "ml", "en-GB", "en-AU", "ca", "es", "es-419", "pt-BR", "pt-PT", "ro", "ru", "th", "kn", "mr", "uk", "pl", "ar", "fil", "he"] +const mdyLangs = ["en-US"] +const ymdLangs = ["ko", "vi", "zh-CN", "zh-TW", "sv", "sw"]*/ + /*autoDetect(lang) { + if (this.dmyLangs.find(lang) > 0) { + this.dateStyle = "1" + } else if (this.mdyLangs.find(lang) > 0) { + this.dateStyle = "2" + } else if (this.ymdLangs.find(lang) > 0) { + this.dateStyle = "3" + } else { + this.dateStyle = "1" + } + this.setSavedStyle(this.dateStyle) + this.getSavedStyle() + this.render() + } +}*/ diff --git a/new-tab/main.html b/new-tab/main.html index 4533722..1800464 100644 --- a/new-tab/main.html +++ b/new-tab/main.html @@ -10,7 +10,7 @@