diff --git a/background/index.js b/background/index.js deleted file mode 100644 index 63caf8d..0000000 --- a/background/index.js +++ /dev/null @@ -1,22 +0,0 @@ -chrome.runtime.onInstalled.addListener(function (object) { - if (object.reason === chrome.runtime.OnInstalledReason.INSTALL) { - chrome.tabs.create({ url: "https://clydedsouza.net" }); - } -}); - -chrome.commands.onCommand.addListener((command) => { - if(command === 'turn-on') { - chrome.action.setBadgeText({ text: 'ON' }); - chrome.action.setBadgeBackgroundColor({ color: 'green' }); - } - if(command === 'turn-off') { - chrome.action.setBadgeText({ text: 'OFF' }); - chrome.action.setBadgeBackgroundColor({ color: 'red' }); - } -}); - -chrome.omnibox.onInputEntered.addListener((text) => { - chrome.tabs.create({ url: 'https://facebook.com/' + encodeURIComponent(text) }); - chrome.tabs.create({ url: 'https://twitter.com/' + encodeURIComponent(text) }); - chrome.tabs.create({ url: 'https://instagram.com/' + encodeURIComponent(text) }); -}); \ No newline at end of file diff --git a/common/settings.js b/common/settings.js deleted file mode 100644 index ba9904f..0000000 --- a/common/settings.js +++ /dev/null @@ -1,5 +0,0 @@ -export const CHROME_SYNC_STORAGE_KEY = "chrome-extension-template"; - -export const PRESET_CONFIGURATION = { - "storageValue": "https://clydedsouza.net", -}; diff --git a/common/settings.test.js b/common/settings.test.js deleted file mode 100644 index aad8a77..0000000 --- a/common/settings.test.js +++ /dev/null @@ -1,10 +0,0 @@ -import * as settingsModule from "./settings"; - -describe("settings", () => { - test("has a preset configuration key", () => { - const presetConfig = settingsModule.PRESET_CONFIGURATION; - const keys = Object.keys(presetConfig); - expect(keys.length).toBe(1); - expect(presetConfig["storageValue"]).toBe("https://clydedsouza.net"); - }); -}); diff --git a/common/storage.js b/common/storage.js deleted file mode 100644 index 239aa85..0000000 --- a/common/storage.js +++ /dev/null @@ -1,9 +0,0 @@ -export const getStorage = (componentKey, callback) => { - chrome.storage.sync.get([componentKey], function(result) { - callback(result[componentKey]); - }); -}; - -export const setStorage = (componentKey, value) => { - chrome.storage.sync.set({[componentKey]: value}); -}; \ No newline at end of file diff --git a/common/storage.test.js b/common/storage.test.js deleted file mode 100644 index 656bf98..0000000 --- a/common/storage.test.js +++ /dev/null @@ -1,42 +0,0 @@ -import * as storageModule from "./storage"; - -const get = jest.fn(); -const set = jest.fn(); - -global.chrome = { - storage: { - sync: { - set, - get - } - } -}; - -const chromeGetStorageSpy = jest.spyOn(chrome.storage.sync, 'get'); -const chromeSetStorageSpy = jest.spyOn(chrome.storage.sync, 'set'); - -describe("storage → getStorage", () => { - beforeEach(() => { - jest.resetAllMocks(); - }); - - test("chrome get storage api method called", () => { - const getCallback = jest.fn(); - - storageModule.getStorage("Test", getCallback); - - expect(chromeGetStorageSpy).toHaveBeenCalledWith(["Test"], expect.any(Function)); - }); -}); - -describe("storage → setStorage", () => { - beforeEach(() => { - jest.resetAllMocks(); - }); - - test("chrome set storage api method called", () => { - storageModule.setStorage("Test", "Value"); - - expect(chromeSetStorageSpy).toHaveBeenCalledWith({["Test"]: "Value"}); - }); -}); diff --git a/content_scripts/index.js b/content_scripts/index.js deleted file mode 100644 index b50340f..0000000 --- a/content_scripts/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { getStorage } from "../common/storage"; -import { CHROME_SYNC_STORAGE_KEY, PRESET_CONFIGURATION } from "../common/settings"; - -function loadAndDisplayStorageValue(result) { - const savedConfiguration = result || PRESET_CONFIGURATION; - const storageValue = savedConfiguration["storageValue"]; - console.info("Storage value is", storageValue); -} - -window.onload = function() { - console.info("Content script loaded"); - getStorage(CHROME_SYNC_STORAGE_KEY, loadAndDisplayStorageValue); -} diff --git a/icons/icon128.png b/icons/icon128.png deleted file mode 100644 index ef76857..0000000 Binary files a/icons/icon128.png and /dev/null differ diff --git a/icons/icon16.png b/icons/icon16.png deleted file mode 100644 index 14bd54f..0000000 Binary files a/icons/icon16.png and /dev/null differ diff --git a/icons/icon48.png b/icons/icon48.png deleted file mode 100644 index 6d18b47..0000000 Binary files a/icons/icon48.png and /dev/null differ diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 6076fbc..0000000 --- a/manifest.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "manifest_version": 3, - "name": "Chrome Extension Template", - "description": "A Chrome Extension created using a template", - "version": "0.0.1", - "author": "Clyde D'Souza", - "icons": { - "16": "icons/icon16.png", - "48": "icons/icon48.png", - "128": "icons/icon128.png" - }, - "omnibox": { - "keyword" : "@@" - }, - "permissions": [ - "storage" - ], - "chrome_url_overrides" : { - "newtab": "newtab.html" - }, - "options_ui": { - "page": "options.html", - "open_in_tab": true - }, - "background": { - "service_worker": "background.js" - }, - "content_scripts": [{ - "matches": ["*://github.com/*"], - "js": ["content_scripts.js"] - }], - "action": { - "default_popup": "popup.html", - "default_title": "Open template popup" - }, - "commands": { - "turn-on": { - "suggested_key": { - "default": "Alt + Shift + M" - }, - "description": "Adds an ON badge to the action icon." - }, - "turn-off": { - "suggested_key": { - "default": "Alt + Shift + N" - }, - "description": "Adds an OFF badge to the action icon." - }, - "_execute_action": { - "suggested_key": { - "default": "Alt + Shift + L" - } - } - } - } - \ No newline at end of file diff --git a/newtab/newtab.html b/newtab/newtab.html deleted file mode 100644 index c6e59bf..0000000 --- a/newtab/newtab.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Chrome Extension Template New Tab - - - - - - This is the customized new tab page inserted by Chrome Extension Template - \ No newline at end of file diff --git a/newtab/scripts/index.js b/newtab/scripts/index.js deleted file mode 100644 index 807233e..0000000 --- a/newtab/scripts/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { getStorage } from "../../common/storage"; -import { PRESET_CONFIGURATION, CHROME_SYNC_STORAGE_KEY } from "../../common/settings"; - -function loadConfiguration(result) { - const savedConfiguration = result || PRESET_CONFIGURATION; - const storageValue = savedConfiguration["storageValue"]; - console.info("Storage value", storageValue); -} - -window.onload = function() { - console.info("New Tab script loaded"); - getStorage(CHROME_SYNC_STORAGE_KEY, loadConfiguration); -}; diff --git a/newtab/styles/_page.scss b/newtab/styles/_page.scss deleted file mode 100644 index ac069b7..0000000 --- a/newtab/styles/_page.scss +++ /dev/null @@ -1,10 +0,0 @@ -@import "./variables"; - -body { - background-color: $light-gray; - color: $dark-gray; - font: { - family: $font-family; - size: 16px; - } -} diff --git a/newtab/styles/_variables.scss b/newtab/styles/_variables.scss deleted file mode 100644 index 30d3fb5..0000000 --- a/newtab/styles/_variables.scss +++ /dev/null @@ -1,3 +0,0 @@ -$dark-gray: #5600eb; -$light-gray: #b7d6ff; -$font-family: -apple-system, BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,'Fira Sans','Droid Sans','Helvetica Neue',sans-serif; diff --git a/newtab/styles/newtab.scss b/newtab/styles/newtab.scss deleted file mode 100644 index 819ef8e..0000000 --- a/newtab/styles/newtab.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "./variables"; -@import "./page"; \ No newline at end of file diff --git a/options/options.html b/options/options.html deleted file mode 100644 index da94d7e..0000000 --- a/options/options.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - Chrome Extension Template - - - - - - -
-
- -
- -
-
- - - \ No newline at end of file diff --git a/options/scripts/index.js b/options/scripts/index.js deleted file mode 100644 index 1495c66..0000000 --- a/options/scripts/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import { getStorage,setStorage } from "../../common/storage"; -import { PRESET_CONFIGURATION, CHROME_SYNC_STORAGE_KEY } from "../../common/settings"; - -function saveConfiguration() { - const updatedConfiguration = { - storageValue: document.getElementById("storageValue").value - }; - setStorage(CHROME_SYNC_STORAGE_KEY, updatedConfiguration); -} - -function loadConfiguration(result) { - const savedConfiguration = result || PRESET_CONFIGURATION; - const storageValue = savedConfiguration["storageValue"]; - document.getElementById("storageValue").value = storageValue; -} - -window.onload = function() { - console.info("Options script loaded"); - document.getElementById("SaveConfiguration").addEventListener("click", saveConfiguration); - getStorage(CHROME_SYNC_STORAGE_KEY, loadConfiguration); -}; diff --git a/options/styles/_page.scss b/options/styles/_page.scss deleted file mode 100644 index ac069b7..0000000 --- a/options/styles/_page.scss +++ /dev/null @@ -1,10 +0,0 @@ -@import "./variables"; - -body { - background-color: $light-gray; - color: $dark-gray; - font: { - family: $font-family; - size: 16px; - } -} diff --git a/options/styles/_variables.scss b/options/styles/_variables.scss deleted file mode 100644 index 86ac092..0000000 --- a/options/styles/_variables.scss +++ /dev/null @@ -1,3 +0,0 @@ -$dark-gray: #6B6B6B; -$light-gray: #F4F5F7; -$font-family: -apple-system, BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,'Fira Sans','Droid Sans','Helvetica Neue',sans-serif; diff --git a/options/styles/options.scss b/options/styles/options.scss deleted file mode 100644 index 819ef8e..0000000 --- a/options/styles/options.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "./variables"; -@import "./page"; \ No newline at end of file diff --git a/popup/popup.html b/popup/popup.html deleted file mode 100644 index 6b3ec65..0000000 --- a/popup/popup.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Chrome Extension Template Popup - - - - - - This is a Chrome Extension popup window - \ No newline at end of file diff --git a/popup/scripts/index.js b/popup/scripts/index.js deleted file mode 100644 index 0531a38..0000000 --- a/popup/scripts/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { getStorage } from "../../common/storage"; -import { PRESET_CONFIGURATION, CHROME_SYNC_STORAGE_KEY } from "../../common/settings"; - -function loadConfiguration(result) { - const savedConfiguration = result || PRESET_CONFIGURATION; - const storageValue = savedConfiguration["storageValue"]; - console.info("Storage value", storageValue); -} - -window.onload = function() { - console.info("Popup script loaded"); - getStorage(CHROME_SYNC_STORAGE_KEY, loadConfiguration); -}; diff --git a/popup/styles/_page.scss b/popup/styles/_page.scss deleted file mode 100644 index ac069b7..0000000 --- a/popup/styles/_page.scss +++ /dev/null @@ -1,10 +0,0 @@ -@import "./variables"; - -body { - background-color: $light-gray; - color: $dark-gray; - font: { - family: $font-family; - size: 16px; - } -} diff --git a/popup/styles/_variables.scss b/popup/styles/_variables.scss deleted file mode 100644 index 8bcdc70..0000000 --- a/popup/styles/_variables.scss +++ /dev/null @@ -1,3 +0,0 @@ -$dark-gray: #830000; -$light-gray: #fdffd0; -$font-family: -apple-system, BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,'Fira Sans','Droid Sans','Helvetica Neue',sans-serif; diff --git a/popup/styles/popup.scss b/popup/styles/popup.scss deleted file mode 100644 index 819ef8e..0000000 --- a/popup/styles/popup.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "./variables"; -@import "./page"; \ No newline at end of file