diff options
author | Ruben Rodriguez <ruben@gnu.org> | 2018-11-07 23:45:25 -0500 |
---|---|---|
committer | Ruben Rodriguez <ruben@gnu.org> | 2018-11-07 23:45:25 -0500 |
commit | 9fe427ff45778f53214ce110bf94fe43459491d1 (patch) | |
tree | 6e5cb35267234e58677d55141f05e2b8bcb3a43e /data/extensions/tortm-browser-button@jeremybenthum/lib/chrome | |
parent | 21250de51aae2f76cb33d4083d7c91d378c0055d (diff) |
Updated extensions through running updated data/update-extensions.sh
Diffstat (limited to 'data/extensions/tortm-browser-button@jeremybenthum/lib/chrome')
-rw-r--r-- | data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/background.html | 9 | ||||
-rw-r--r-- | data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/chrome.js | 49 |
2 files changed, 58 insertions, 0 deletions
diff --git a/data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/background.html b/data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/background.html new file mode 100644 index 0000000..12a37a9 --- /dev/null +++ b/data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/background.html @@ -0,0 +1,9 @@ +<!DOCTYPE html>
+<html>
+ <head><meta charset="utf-8"></head>
+ <body>
+ <script src="../proxy.js"></script>
+ <script src="../config.js"></script>
+ <script src="chrome.js"></script>
+ </body>
+</html>
diff --git a/data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/chrome.js b/data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/chrome.js new file mode 100644 index 0000000..14491f7 --- /dev/null +++ b/data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/chrome.js @@ -0,0 +1,49 @@ +var app = {};
+
+app.button = {set icon (o) {chrome.browserAction.setIcon(o)}};
+app.version = function () {return chrome.runtime.getManifest().version};
+app.homepage = function () {return chrome.runtime.getManifest().homepage_url};
+app.tab = {"open": function (url) {chrome.tabs.create({"url": url, "active": true})}};
+if (chrome.runtime.setUninstallURL) chrome.runtime.setUninstallURL(app.homepage() + "?v=" + app.version() + "&type=uninstall", function () {});
+
+app.storage = (function () {
+ var objs = {};
+ window.setTimeout(function () {
+ chrome.storage.local.get(null, function (o) {
+ objs = o;
+ var script = document.createElement("script");
+ script.src = "../common.js";
+ document.body.appendChild(script);
+ });
+ }, 300);
+ /* */
+ return {
+ "read": function (id) {return objs[id]},
+ "write": function (id, data) {
+ var tmp = {};
+ objs[id] = data;
+ tmp[id] = data;
+ chrome.storage.local.set(tmp, function () {});
+ }
+ }
+})();
+
+app.popup = (function () {
+ var _tmp = {};
+ chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
+ for (var id in _tmp) {
+ if (_tmp[id] && (typeof _tmp[id] === "function")) {
+ if (request.path === 'popup-to-background') {
+ if (request.method === id) _tmp[id](request.data);
+ }
+ }
+ }
+ });
+ /* */
+ return {
+ "receive": function (id, callback) {_tmp[id] = callback},
+ "send": function (id, data, tabId) {
+ chrome.runtime.sendMessage({"path": 'background-to-popup', "method": id, "data": data});
+ }
+ }
+})();
|