From c9ec25c1da1b0a72238804f1923f256fdd94a9ad Mon Sep 17 00:00:00 2001 From: arakilian0 Date: Sun, 12 Dec 2021 11:10:41 -0800 Subject: [PATCH] Remove old js --- src/js/ApplicationToggle.js | 11 ------- src/js/FileClear.js | 8 ----- src/js/FileLockToggle.js | 42 ------------------------ src/js/FileSave.js | 0 src/js/FileToggle.js | 42 ------------------------ src/js/FileVisibilityToggle.js | 23 -------------- src/js/InsertPage.js | 21 ------------ src/js/InsertURL.js | 21 ------------ src/js/SettingsClose.js | 9 ------ src/js/SettingsOpen.js | 9 ------ src/js/ThemeToggle.js | 58 ---------------------------------- 11 files changed, 244 deletions(-) delete mode 100644 src/js/ApplicationToggle.js delete mode 100644 src/js/FileClear.js delete mode 100644 src/js/FileLockToggle.js delete mode 100644 src/js/FileSave.js delete mode 100644 src/js/FileToggle.js delete mode 100644 src/js/FileVisibilityToggle.js delete mode 100644 src/js/InsertPage.js delete mode 100644 src/js/InsertURL.js delete mode 100644 src/js/SettingsClose.js delete mode 100644 src/js/SettingsOpen.js delete mode 100644 src/js/ThemeToggle.js diff --git a/src/js/ApplicationToggle.js b/src/js/ApplicationToggle.js deleted file mode 100644 index 585e955..0000000 --- a/src/js/ApplicationToggle.js +++ /dev/null @@ -1,11 +0,0 @@ -const snipxTurnOnIcon = document.getElementById('snipx-header-turnon-icon') -const snipxTurnOffIcon = document.getElementById('snipx-header-turnoff-icon') - -snipxTurnOnIcon.addEventListener('click', (e) => { - snipxTurnOnIcon.style.display = 'none' - snipxTurnOffIcon.style.display = 'inline-block' -}) -snipxTurnOffIcon.addEventListener('click', (e) => { - snipxTurnOffIcon.style.display = 'none' - snipxTurnOnIcon.style.display = 'inline-block' -}) \ No newline at end of file diff --git a/src/js/FileClear.js b/src/js/FileClear.js deleted file mode 100644 index 97c500d..0000000 --- a/src/js/FileClear.js +++ /dev/null @@ -1,8 +0,0 @@ -const snipxEditorClearBtn = document.getElementById('snipx-editor-menu-clearBtn') -const snipxEditorTextarea = document.getElementById(`snipx-editor-textarea-${localStorage.getItem('SnipXFile')}`) - -snipxEditorClearBtn.addEventListener('click', (e) => { - // console.log(snipxEditorTextarea.value) - snipxEditorTextarea.value = '' - // window.location.reload() -}) \ No newline at end of file diff --git a/src/js/FileLockToggle.js b/src/js/FileLockToggle.js deleted file mode 100644 index 1ee3573..0000000 --- a/src/js/FileLockToggle.js +++ /dev/null @@ -1,42 +0,0 @@ -const snipxEditorFileLock = document.getElementById('snipx-editor-action-locked') -const snipxEditorFileUnlock = document.getElementById('snipx-editor-action-unlocked') - -if(localStorage.getItem('SnipXFileIsLocked')) { - snipxEditorFileUnlock.style.display = 'none' -} -else snipxEditorFileLock.style.display = 'none' - -function fileLock() { - snipxEditorFileUnlock.style.display = 'none' - snipxEditorFileLock.style.display = 'inline-block' -} -function fileUnlock() { - snipxEditorFileLock.style.display = 'none' - snipxEditorFileUnlock.style.display = 'inline-block' -} -if(!localStorage.getItem('SnipXFileIsLocked')) { - localStorage.setItem('SnipXFileIsLocked', false) - snipxEditorFileUnlock.style.display = 'none' - snipxEditorFileLock.style.display = 'inline-block' -} -else { - if(localStorage.getItem('SnipXFileIsLocked') === true) { - snipxEditorFileLock.style.display = 'none' - snipxEditorFileUnlock.style.display = 'inline-block' - } - if(localStorage.getItem('SnipXFileIsLocked') === false) { - snipxEditorFileUnlock.style.display = 'none' - snipxEditorFileLock.style.display = 'inline-block' - } -} - -// Lock File -snipxEditorFileLock.addEventListener('click', (e) => { - localStorage.setItem('SnipXFileIsLocked', true) - fileUnlock() -}) -// Unlock File -snipxEditorFileUnlock.addEventListener('click', (e) => { - localStorage.setItem('SnipXFileIsLocked', false) - fileLock() -}) \ No newline at end of file diff --git a/src/js/FileSave.js b/src/js/FileSave.js deleted file mode 100644 index e69de29..0000000 diff --git a/src/js/FileToggle.js b/src/js/FileToggle.js deleted file mode 100644 index eba5b29..0000000 --- a/src/js/FileToggle.js +++ /dev/null @@ -1,42 +0,0 @@ -const snipxFileType = document.getElementById('snipx-editor-menu-select') -const snipxEditorCSS = document.getElementById('snipx-editor-textarea-css') -const snipxEditorJS = document.getElementById('snipx-editor-textarea-js') -const snipxMenuCSS = document.getElementById('snipx-editor-menu-css') -const snipxMenuJS = document.getElementById('snipx-editor-menu-js') - -if(!localStorage.getItem('SnipXFile')) { - localStorage.setItem('SnipXFile', 'css') - snipxEditorCSS.style.display = 'block' - snipxMenuCSS.setAttribute('selected', true) -} -else { - if(localStorage.getItem('SnipXFile') === 'css') { - snipxEditorCSS.style.display = 'block' - snipxMenuCSS.setAttribute('selected', true) - } - if(localStorage.getItem('SnipXFile') === 'js') { - snipxEditorJS.style.display = 'block' - snipxMenuJS.setAttribute('selected', true) - } -} - -snipxFileType.addEventListener('change', (e) => { - localStorage.setItem('SnipXFile', snipxFileType.value) - switch(snipxFileType.value) { - case 'css': - snipxMenuCSS.setAttribute('selected', true) - snipxEditorJS.style.display = 'none' - snipxEditorCSS.style.display = 'block' - window.location.reload() - break - case 'js': - snipxMenuJS.setAttribute('selected', true) - snipxEditorCSS.style.display = 'none' - snipxEditorJS.style.display = 'block' - window.location.reload() - break - default: - return undefined - } -}) - diff --git a/src/js/FileVisibilityToggle.js b/src/js/FileVisibilityToggle.js deleted file mode 100644 index ffe5401..0000000 --- a/src/js/FileVisibilityToggle.js +++ /dev/null @@ -1,23 +0,0 @@ -const snipxEditorFileRender = document.getElementById('snipx-editor-action-shown') -const snipxEditorFileRemoveRender = document.getElementById('snipx-editor-action-hidden') - -if(localStorage.getItem('SnipXFileIsRendered') === true) { - snipxEditorFileRender.style.display = 'none' - snipxEditorFileRemoveRender.style.display = 'inline-block' -} -else { - snipxEditorFileRemoveRender.style.display = 'none' - snipxEditorFileRender.style.display = 'inline-block' -} - -snipxEditorFileRender.addEventListener('click', (e) => { - localStorage.setItem('SnipXFileIsRendered', false) - snipxEditorFileRender.style.display = 'none' - snipxEditorFileRemoveRender.style.display = 'inline-block' -}) - -snipxEditorFileRemoveRender.addEventListener('click', (e) => { - localStorage.setItem('SnipXFileIsRendered', true) - snipxEditorFileRemoveRender.style.display = 'none' - snipxEditorFileRender.style.display = 'inline-block' -}) \ No newline at end of file diff --git a/src/js/InsertPage.js b/src/js/InsertPage.js deleted file mode 100644 index 2651638..0000000 --- a/src/js/InsertPage.js +++ /dev/null @@ -1,21 +0,0 @@ -if(!localStorage.getItem('SnipXPage')) { - localStorage.setItem('SnipXPage', 'editor') - const settings = document.getElementById('snipx-settings') - const editor = document.getElementById(`snipx-editor-textarea-${localStorage.getItem('SnipXFile')}`) - settings.style.display = 'none' - editor.style.display = 'block' -} -else { - if(localStorage.getItem('SnipXPage') === 'editor') { - const settings = document.getElementById('snipx-settings') - const editor = document.getElementById(`snipx-editor-textarea-${localStorage.getItem('SnipXFile')}`) - settings.style.display = 'none' - editor.style.display = 'block' - } - if(localStorage.getItem('SnipXPage') === 'settings') { - const editor = document.getElementById('snipx-editor') - const settings = document.getElementById('snipx-settings') - editor.style.display = 'none' - settings.style.display = 'block' - } -} diff --git a/src/js/InsertURL.js b/src/js/InsertURL.js deleted file mode 100644 index cc751ba..0000000 --- a/src/js/InsertURL.js +++ /dev/null @@ -1,21 +0,0 @@ -const snipxEditorTablink = document.getElementById('snipx-editor-menu-tablink') - -chrome.tabs.query({ - active: true, - currentWindow: true -}, ([currentTab]) => { - // Take only the domain name and remove everything else - let array = currentTab.url.split('') - let newArray = [] - let slashCount = 0 - for(let i = 0; i <= array.length; i++) { - newArray.push(array[i]) - if(array[i] === '/') slashCount++ - if(slashCount === 3) break - } - let currentTabURL = newArray.join('') - currentTabURL = currentTabURL.substr(0, currentTabURL.length - 1) - - localStorage.setItem('SnipXTabURL', currentTabURL) - snipxEditorTablink.innerText = currentTabURL -}) \ No newline at end of file diff --git a/src/js/SettingsClose.js b/src/js/SettingsClose.js deleted file mode 100644 index 2445fe1..0000000 --- a/src/js/SettingsClose.js +++ /dev/null @@ -1,9 +0,0 @@ -const snipxEditorTemplate = document.getElementById('snipx-editor') -const snipxSettingsTemplate = document.getElementById('snipx-settings') -const snipxSettingsCloserIcon = document.getElementById('snipx-settings-closer') - -snipxSettingsCloserIcon.addEventListener('click', (e) => { - snipxSettingsTemplate.style.display = 'none' - snipxEditorTemplate.style.display = 'block' - localStorage.setItem('SnipXPage', 'editor') -}) \ No newline at end of file diff --git a/src/js/SettingsOpen.js b/src/js/SettingsOpen.js deleted file mode 100644 index d034509..0000000 --- a/src/js/SettingsOpen.js +++ /dev/null @@ -1,9 +0,0 @@ -const snipxEditorTemplate = document.getElementById('snipx-editor') -const snipxSettingsTemplate = document.getElementById('snipx-settings') -const snipxSettingsIcon = document.getElementById('snipx-header-settings-icon') - -snipxSettingsIcon.addEventListener('click', (e) => { - snipxEditorTemplate.style.display = 'none' - snipxSettingsTemplate.style.display = 'block' - localStorage.setItem('SnipXPage', 'settings') -}) \ No newline at end of file diff --git a/src/js/ThemeToggle.js b/src/js/ThemeToggle.js deleted file mode 100644 index ba96da3..0000000 --- a/src/js/ThemeToggle.js +++ /dev/null @@ -1,58 +0,0 @@ -const snipxThemeLightIcon = document.getElementById('snipx-header-themelight-icon') -const snipxThemeDarkIcon = document.getElementById('snipx-header-themedark-icon') -const snipxEditor = document.getElementById('snipx-editor') -const snipxLoader = document.getElementById('snipx-loader') - -function createStyleElement(id, href) { - const el = document.createElement('link') - el.rel = 'stylesheet' - el.id = id - el.href = href - return el -} - -if(!localStorage.getItem('SnipXTheme')) { - localStorage.setItem('SnipXTheme', 'dark') - snipxThemeLightIcon.style.display = 'inline-block' - const el = createStyleElement('snipx-theme-file', 'css/theme.dark.css') - document.head.appendChild(el) -} -else { - if(localStorage.getItem('SnipXTheme') === 'dark') { - snipxThemeLightIcon.style.display = 'inline-block' - const el = createStyleElement('snipx-theme-file', 'css/theme.dark.css') - document.head.appendChild(el) - } - if(localStorage.getItem('SnipXTheme') === 'light') { - snipxThemeDarkIcon.style.display = 'inline-block' - const el = createStyleElement('snipx-theme-file', 'css/theme.light.css') - document.head.appendChild(el) - } -} - -// Change to Dark Theme -snipxThemeLightIcon.addEventListener('click', (e) => { - // Switch Icon to Dark Mode Icon - snipxThemeLightIcon.style.display = 'none' - snipxThemeDarkIcon.style.display = 'inline-block' - // Update Local Storage to Light Mode - localStorage.setItem('SnipXTheme', 'light') - // Switch Theme File - // NOT WORKING PROPERLY - window.location.reload() - // const el = document.getElementById('snipx-theme-file') - // el.setAttribute('href', 'css/theme.dark.css') -}) -// Change to Light Theme -snipxThemeDarkIcon.addEventListener('click', (e) => { - // Switch Icon to Light Mode Icon - snipxThemeDarkIcon.style.display = 'none' - snipxThemeLightIcon.style.display = 'inline-block' - // Update Local Storage to Dark Mode - localStorage.setItem('SnipXTheme', 'dark') - // Switch Theme File - // NOT WORKING PROPERLY - window.location.reload() - // const el = document.getElementById('snipx-theme-file') - // el.setAttribute('href', 'css/theme.light.css') -}) \ No newline at end of file