summaryrefslogtreecommitdiff
path: root/2016_lamp_browser/chrome
diff options
context:
space:
mode:
Diffstat (limited to '2016_lamp_browser/chrome')
-rw-r--r--2016_lamp_browser/chrome/icon-16.pngbin0 -> 343 bytes
-rw-r--r--2016_lamp_browser/chrome/icon-32.pngbin0 -> 567 bytes
-rw-r--r--2016_lamp_browser/chrome/icon-64.pngbin0 -> 1036 bytes
-rw-r--r--2016_lamp_browser/chrome/icon.pngbin0 -> 771 bytes
-rw-r--r--2016_lamp_browser/chrome/lamp.css3
-rw-r--r--2016_lamp_browser/chrome/lamp.js22
-rw-r--r--2016_lamp_browser/chrome/manifest.json23
-rw-r--r--2016_lamp_browser/chrome/popup.html52
8 files changed, 100 insertions, 0 deletions
diff --git a/2016_lamp_browser/chrome/icon-16.png b/2016_lamp_browser/chrome/icon-16.png
new file mode 100644
index 0000000..698e8bf
--- /dev/null
+++ b/2016_lamp_browser/chrome/icon-16.png
Binary files differ
diff --git a/2016_lamp_browser/chrome/icon-32.png b/2016_lamp_browser/chrome/icon-32.png
new file mode 100644
index 0000000..a629ac6
--- /dev/null
+++ b/2016_lamp_browser/chrome/icon-32.png
Binary files differ
diff --git a/2016_lamp_browser/chrome/icon-64.png b/2016_lamp_browser/chrome/icon-64.png
new file mode 100644
index 0000000..80130ab
--- /dev/null
+++ b/2016_lamp_browser/chrome/icon-64.png
Binary files differ
diff --git a/2016_lamp_browser/chrome/icon.png b/2016_lamp_browser/chrome/icon.png
new file mode 100644
index 0000000..21fd4ae
--- /dev/null
+++ b/2016_lamp_browser/chrome/icon.png
Binary files differ
diff --git a/2016_lamp_browser/chrome/lamp.css b/2016_lamp_browser/chrome/lamp.css
new file mode 100644
index 0000000..78c8a81
--- /dev/null
+++ b/2016_lamp_browser/chrome/lamp.css
@@ -0,0 +1,3 @@
+/*
+empty
+*/
diff --git a/2016_lamp_browser/chrome/lamp.js b/2016_lamp_browser/chrome/lamp.js
new file mode 100644
index 0000000..b732f8d
--- /dev/null
+++ b/2016_lamp_browser/chrome/lamp.js
@@ -0,0 +1,22 @@
+document.addEventListener('DOMContentLoaded', init);
+
+function init(){
+ var elem = document.getElementById('on');
+ elem.addEventListener('click',funcon);
+ var elem2 = document.getElementById('off');
+ elem2.addEventListener('click',funcoff);
+}
+
+function funcon(){
+ chrome.tabs.insertCSS({
+ code: "body{transition: opacity 0.2s ease-in; opacity: 1}"
+ });
+}
+
+function funcoff(){
+ chrome.tabs.insertCSS({
+ code: "body{transition: opacity 0.2s ease-in; opacity: 0}"
+ });
+}
+
+
diff --git a/2016_lamp_browser/chrome/manifest.json b/2016_lamp_browser/chrome/manifest.json
new file mode 100644
index 0000000..64fa4ea
--- /dev/null
+++ b/2016_lamp_browser/chrome/manifest.json
@@ -0,0 +1,23 @@
+{
+ "manifest_version": 2,
+
+ "name": "Lamp",
+ "description": "If you turn off this lamp it will darken your browser!",
+ "version": "1.0",
+ "author": "joak",
+ "permissions": ["activeTab"],
+ "browser_action": {
+ "default_icon": "icon.png",
+ "default_popup": "popup.html",
+ "default_title": "Turns off the light!"
+ },
+ "icons": {
+ "16": "icon-16.png",
+ "32": "icon-32.png",
+ "64": "icon-64.png"
+ },
+ "content_scripts": [{
+ "matches": ["<all_urls>"],
+ "css": ["lamp.css"]
+ }]
+}
diff --git a/2016_lamp_browser/chrome/popup.html b/2016_lamp_browser/chrome/popup.html
new file mode 100644
index 0000000..3aeee38
--- /dev/null
+++ b/2016_lamp_browser/chrome/popup.html
@@ -0,0 +1,52 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Lamp</title>
+ <style>
+ body {
+ font-family: "Segoe UI", "Lucida Grande", Tahoma, sans-serif;
+ font-size: 100%;
+ background: white;
+ width: 400px;
+ height: 105px;
+ }
+ #button {
+ text-align: center;
+ margin-top: 15px;
+ margin-bottom: 5px;
+ }
+ #start {
+ position: absolute:
+ top: 50%;
+ }
+ #wrapper{
+ border: 5px solid black;
+ padding: 10px;
+ }
+ #title{
+ text-align: center;
+ }
+ #title h2{
+ margin-top: 1px;
+ }
+ #settings{
+ text-align: center;
+ }
+ </style>
+ <script src="lamp.js"></script>
+ </head>
+ <body>
+ <div id="wrapper">
+ <div id="title">
+ <h2>Lamp</h2>
+ </div>
+ <div id="settings">
+ <div id="button">
+ <button type="button" id="on">On</button>
+ <button type="button" id="off">Off</button>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
+