chore: remove unused files and clean up project structure
This commit is contained in:
@@ -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) });
|
||||
});
|
||||
@@ -1,5 +0,0 @@
|
||||
export const CHROME_SYNC_STORAGE_KEY = "chrome-extension-template";
|
||||
|
||||
export const PRESET_CONFIGURATION = {
|
||||
"storageValue": "https://clydedsouza.net",
|
||||
};
|
||||
@@ -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");
|
||||
});
|
||||
});
|
||||
@@ -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});
|
||||
};
|
||||
@@ -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"});
|
||||
});
|
||||
});
|
||||
@@ -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);
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 897 B |
BIN
icons/icon16.png
BIN
icons/icon16.png
Binary file not shown.
|
Before Width: | Height: | Size: 300 B |
BIN
icons/icon48.png
BIN
icons/icon48.png
Binary file not shown.
|
Before Width: | Height: | Size: 552 B |
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Chrome Extension Template New Tab</title>
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1" />
|
||||
<meta name="description" content="Chrome Extension Template" />
|
||||
<script src="newtab.js" type="text/javascript"></script>
|
||||
<link href="newtab.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>This is the customized new tab page inserted by Chrome Extension Template</body>
|
||||
</html>
|
||||
@@ -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);
|
||||
};
|
||||
@@ -1,10 +0,0 @@
|
||||
@import "./variables";
|
||||
|
||||
body {
|
||||
background-color: $light-gray;
|
||||
color: $dark-gray;
|
||||
font: {
|
||||
family: $font-family;
|
||||
size: 16px;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -1,2 +0,0 @@
|
||||
@import "./variables";
|
||||
@import "./page";
|
||||
@@ -1,31 +0,0 @@
|
||||
<!-- (c) 2022 Clyde D'Souza -->
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Chrome Extension Template</title>
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1" />
|
||||
<meta name="description" content="Chrome Extension Template" />
|
||||
<script src="options.js" type="text/javascript"></script>
|
||||
<link href="options.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<form>
|
||||
<label>
|
||||
Chrome storage value
|
||||
<input type="text" id="storageValue" aria-label="Chrome storage value" />
|
||||
</label>
|
||||
<br/>
|
||||
<button id="SaveConfiguration" type="button" class="btn-primary">Save new Chrome Storage value</button>
|
||||
</form>
|
||||
</main>
|
||||
<footer>
|
||||
<a href="https://github.com/ClydeDz/google-meet-exit-page-chrome-extension/issues/new/choose" target="_blank" rel="noreferrer">
|
||||
Visit this on GitHub</a><span class="link-separator"></span>
|
||||
<a href="https://sponsor.clydedsouza.net/" target="_blank" rel="noreferrer">
|
||||
Buy me a coffee</a><span class="link-separator"></span>
|
||||
<a href="https://clydedsouza.net" target="_blank" rel="noreferrer">
|
||||
Developed by Clyde D'Souza</a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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);
|
||||
};
|
||||
@@ -1,10 +0,0 @@
|
||||
@import "./variables";
|
||||
|
||||
body {
|
||||
background-color: $light-gray;
|
||||
color: $dark-gray;
|
||||
font: {
|
||||
family: $font-family;
|
||||
size: 16px;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -1,2 +0,0 @@
|
||||
@import "./variables";
|
||||
@import "./page";
|
||||
@@ -1,11 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Chrome Extension Template Popup</title>
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1" />
|
||||
<meta name="description" content="Chrome Extension Template" />
|
||||
<script src="popup.js" type="text/javascript"></script>
|
||||
<link href="popup.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>This is a Chrome Extension popup window</body>
|
||||
</html>
|
||||
@@ -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);
|
||||
};
|
||||
@@ -1,10 +0,0 @@
|
||||
@import "./variables";
|
||||
|
||||
body {
|
||||
background-color: $light-gray;
|
||||
color: $dark-gray;
|
||||
font: {
|
||||
family: $font-family;
|
||||
size: 16px;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -1,2 +0,0 @@
|
||||
@import "./variables";
|
||||
@import "./page";
|
||||
Reference in New Issue
Block a user