commit 214cd46de938b00a5c8e27f9c3918db4d3c197e0 Author: Stian Aune Date: Sun Oct 27 10:32:14 2019 +0100 Ze först kommit. diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..5c98b42 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/.idea/cyclefraudster.iml b/.idea/cyclefraudster.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/cyclefraudster.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f6ef29e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/background.js b/background.js new file mode 100644 index 0000000..d0a2ce3 --- /dev/null +++ b/background.js @@ -0,0 +1,20 @@ +chrome.runtime.onInstalled.addListener(function() { + chrome.storage.sync.set({color: '#3aa757'}, function() { + console.log("The color is green."); + }); + + chrome.declarativeContent.onPageChanged.removeRules(undefined, function() { + chrome.declarativeContent.onPageChanged.addRules([{ + conditions: [new chrome.declarativeContent.PageStateMatcher({ + pageUrl: {hostEquals: 'developer.chrome.com'}, + }) + ], + actions: [new chrome.declarativeContent.ShowPageAction()] + }]); + }); + + let i = 0; + setInterval(() => { + console.log(`${++i}s since start`) + }, 1000); +}); \ No newline at end of file diff --git a/contentScript.js b/contentScript.js new file mode 100644 index 0000000..3ce1153 --- /dev/null +++ b/contentScript.js @@ -0,0 +1 @@ +alert("Surprise motherfuckers"); \ No newline at end of file diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..f346927 Binary files /dev/null and b/icon.png differ diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..e4bb8ea --- /dev/null +++ b/manifest.json @@ -0,0 +1,23 @@ +{ + "name": "YKonsole Helper", + "version": "1.0", + "manifest_version": 2, + "description": "Extension to control YKonsole", + "background": { + "scripts": ["background.js"], + "persistent": false + }, + "page_action": { + "default_icon": "icon.png", + "default_popup": "popup.html" + }, + "icons": { + "32": "icon.png" + }, + "permissions": [ + "storage", + "activeTab", + "declarativeContent", + "https://indigo.stian-aune.com/" + ] +} \ No newline at end of file diff --git a/popup.html b/popup.html new file mode 100644 index 0000000..e308c63 --- /dev/null +++ b/popup.html @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/popup.js b/popup.js new file mode 100644 index 0000000..0fd55fd --- /dev/null +++ b/popup.js @@ -0,0 +1,19 @@ +let changeColor = document.getElementById('changeColor'); +chrome.storage.sync.get('color', function(data) { + changeColor.style.backgroundColor = data.color; + changeColor.setAttribute('value', data.color); +}); + +let mOverlay = document.createElement("div"); +mOverlay.innerHTML = "QUQ"; + +changeColor.onclick = function(element) { + // TODO: Add settings to STORAGE + + let color = element.target.value; + chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { + chrome.tabs.executeScript( + tabs[0].id, + {file: 'contentScript.js'}); + }); +}; \ No newline at end of file