From 214cd46de938b00a5c8e27f9c3918db4d3c197e0 Mon Sep 17 00:00:00 2001 From: Stian Aune Date: Sun, 27 Oct 2019 10:32:14 +0100 Subject: [PATCH] =?UTF-8?q?Ze=20f=C3=B6rst=20kommit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 2 ++ .idea/cyclefraudster.iml | 8 ++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ README.md | 0 background.js | 20 ++++++++++++++++++++ contentScript.js | 1 + icon.png | Bin 0 -> 988 bytes manifest.json | 23 +++++++++++++++++++++++ popup.html | 16 ++++++++++++++++ popup.js | 19 +++++++++++++++++++ 11 files changed, 103 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/cyclefraudster.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 README.md create mode 100644 background.js create mode 100644 contentScript.js create mode 100644 icon.png create mode 100644 manifest.json create mode 100644 popup.html create mode 100644 popup.js 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 0000000000000000000000000000000000000000..f3469271d70c3536f4ec7cf4ec83115b7a8fcd33 GIT binary patch literal 988 zcmV<210(#2P)nAjIKi%`-R%0vn(Fs29zRu&->l(QG@z1(we z&!vs4ev_N#w&ywL^PKbiI2953hvXHiycCn}|Md=m8;=0!-m{6GmUY^(o>Bk=ZcZbR z2qdjtV|*P;5=>3KJb?b~t1-@103Io6zdXXhi$jjFLKg!qJr8N^`pbNm0z_`){Ojd> z`(-1UsyDO{pIt~(KQseKgfT}BsbimyRM6`V5INb4Sk!xIO#8U{HNN?3hj!eNbAxQY zJ7Yo^wg!au2)cLIIA)St#8#IF#;M55>M$W3VLbp7+H4fbm|YRp+B$&Flx%A z0%2E4?u3Rq+k9q5L}I;pom#dRDBY|Cas?0)KL38;AQ7r193Kan4V>1lG3A1)t9EvM^7Al_e`e4%HZ1^TuhxMZ(`Ko)x?og0s~nXN zXuS1EZEONM+BYj>w6|hVTeE4P87sBFF4+!jtLCSV-zglxE`K`1rx%Cu*ltCITu!Bc zSfttUeNh1UR5LNlu`{=+c>3IRT>pEkx%5%}{}1q@D#?GtV)P%PD^k&8QZ`2b0000< KMNUMnLSTZyOwUgM literal 0 HcmV?d00001 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