Browse Source

Ze först kommit.

master
Stian Aune 5 years ago
commit
214cd46de9
  1. 2
      .idea/.gitignore
  2. 8
      .idea/cyclefraudster.iml
  3. 6
      .idea/misc.xml
  4. 8
      .idea/modules.xml
  5. 0
      README.md
  6. 20
      background.js
  7. 1
      contentScript.js
  8. BIN
      icon.png
  9. 23
      manifest.json
  10. 16
      popup.html
  11. 19
      popup.js

2
.idea/.gitignore

@ -0,0 +1,2 @@
# Default ignored files
/workspace.xml

8
.idea/cyclefraudster.iml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/misc.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>

8
.idea/modules.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/cyclefraudster.iml" filepath="$PROJECT_DIR$/.idea/cyclefraudster.iml" />
</modules>
</component>
</project>

0
README.md

20
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);
});

1
contentScript.js

@ -0,0 +1 @@
alert("Surprise motherfuckers");

BIN
icon.png

After

Width: 32  |  Height: 32  |  Size: 988 B

23
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/"
]
}

16
popup.html

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="NO">
<head>
<style>
button {
height: 30px;
width: 30px;
outline: none;
}
</style>
</head>
<body>
<button id="changeColor" value="#FF0000">qqq</button>
<script src="popup.js"></script>
</body>
</html>

19
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 = "<b>QUQ</b>";
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'});
});
};
Loading…
Cancel
Save