aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/background.js9
-rw-r--r--app/scripts/chromereload.js22
-rw-r--r--app/scripts/contentscript.js8
-rw-r--r--app/scripts/popup.js3
-rw-r--r--app/scripts/web3.js2
5 files changed, 44 insertions, 0 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
new file mode 100644
index 000000000..87a27d0db
--- /dev/null
+++ b/app/scripts/background.js
@@ -0,0 +1,9 @@
+'use strict';
+
+chrome.runtime.onInstalled.addListener(function (details) {
+ console.log('previousVersion', details.previousVersion);
+});
+
+chrome.browserAction.setBadgeText({text: '2'});
+
+console.log('\'Allo \'Allo! Event Page for Browser Action');
diff --git a/app/scripts/chromereload.js b/app/scripts/chromereload.js
new file mode 100644
index 000000000..a01466484
--- /dev/null
+++ b/app/scripts/chromereload.js
@@ -0,0 +1,22 @@
+'use strict';
+
+// Reload client for Chrome Apps & Extensions.
+// The reload client has a compatibility with livereload.
+// WARNING: only supports reload command.
+
+var LIVERELOAD_HOST = 'localhost:';
+var LIVERELOAD_PORT = 35729;
+var connection = new WebSocket('ws://' + LIVERELOAD_HOST + LIVERELOAD_PORT + '/livereload');
+
+connection.onerror = function (error) {
+ console.log('reload connection got error:', error);
+};
+
+connection.onmessage = function (e) {
+ if (e.data) {
+ var data = JSON.parse(e.data);
+ if (data && data.command === 'reload') {
+ chrome.runtime.reload();
+ }
+ }
+};
diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js
new file mode 100644
index 000000000..30cf50ef9
--- /dev/null
+++ b/app/scripts/contentscript.js
@@ -0,0 +1,8 @@
+console.log('\'Allo \'Allo! Content script')
+
+var scriptTag = document.createElement('script')
+// TODO: add "script.js" to web_accessible_resources in manifest.json
+scriptTag.src = chrome.extension.getURL('scripts/web3.js')
+
+// scriptTag.onload = function() { this.parentNode.removeChild(this) }
+;(document.head||document.documentElement).appendChild(scriptTag) \ No newline at end of file
diff --git a/app/scripts/popup.js b/app/scripts/popup.js
new file mode 100644
index 000000000..815abcb42
--- /dev/null
+++ b/app/scripts/popup.js
@@ -0,0 +1,3 @@
+'use strict';
+
+console.log('\'Allo \'Allo! Popup');
diff --git a/app/scripts/web3.js b/app/scripts/web3.js
new file mode 100644
index 000000000..2bbf95ac3
--- /dev/null
+++ b/app/scripts/web3.js
@@ -0,0 +1,2 @@
+console.log('injecting web3....')
+window.web3 = {} \ No newline at end of file