From 95ff1046b8ea0cc7d0eaea50911557595a38c0d7 Mon Sep 17 00:00:00 2001 From: Lukas Winkler Date: Sat, 2 Sep 2017 21:14:37 +0200 Subject: [PATCH] extention -> extension --- _locales/de/messages.json | 8 ++++---- _locales/en/messages.json | 28 ++++++++++++++------------ css/style.css | 4 ++++ js/options.js | 41 +++++++++++++++++++++++++++++++++++++++ js/popup.js | 2 +- manifest.json | 8 ++++++-- options.html | 35 +++++++++++++++++++++++++++++++++ 7 files changed, 107 insertions(+), 19 deletions(-) create mode 100644 js/options.js create mode 100644 options.html diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 62fadab..9f9a5e2 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -1,11 +1,11 @@ { - "extention_name": { + "extension_name": { "message": "Piwik Injector", - "description": "name of the extention" + "description": "name of the extension" }, - "extention_description": { + "extension_description": { "message": "Füge eigenes Javascript auf beliebigen Seiten ein.", - "description": "a short description shown in the extention list" + "description": "a short description shown in the extension list" }, "host_title": { "message": "Webseiten mit benutzerdefiniertem Javascript", diff --git a/_locales/en/messages.json b/_locales/en/messages.json index d38142c..33db1cd 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1,33 +1,33 @@ { - "extention_name": { + "extension_name": { "message": "Piwik Injector", - "description": "name of the extention" + "description": "name of the extension" }, - "extention_description": { + "extension_description": { "message": "Try out Piwik, the open source, privacy aware web analytics software, without the need to modify anything.", - "description": "a short description shown in the extention list; should be pretty short, but descriptive" + "description": "a short description shown in the extension list; should be pretty short, but descriptive" }, - "extention_firefox_description": { + "extension_firefox_description": { "message": "piwik, analytics, javascript, debugging", - "description": "longer description text for firefox extention page; can use HTML to stucture the content" + "description": "longer description text for firefox extension page; can use HTML to stucture the content" }, - "extention_chrome_description": { + "extension_chrome_description": { "message": "piwik, analytics, javascript, debugging", - "description": "longer description text for chrome extention page; can't use any formatting" + "description": "longer description text for chrome extension page; can't use any formatting" }, - "extention_tags": { + "extension_tags": { "message": "piwik, analytics, javascript, debugging, injecting, open source,", "description": "tags for Firefox addon description (maximum 20)" }, - "extention_screenshot_1": { + "extension_screenshot_1": { "message": "Add the piwik tracking code to every website without access to the website source", "description": "description for the first screenshot (https://github.com/Findus23/piwik-injector/blob/master/docs/screenshot_firefox_1.png)" }, - "extention_screenshot_2": { + "extension_screenshot_2": { "message": "", "description": "description for the second screenshot (https://github.com/Findus23/piwik-injector/blob/master/docs/screenshot_firefox_2.png)" }, - "extention_screenshot_3": { + "extension_screenshot_3": { "message": "", "description": "description for the third screenshot (https://github.com/Findus23/piwik-injector/blob/master/docs/screenshot_firefox_3.png)" }, @@ -110,5 +110,9 @@ "expert_mode_label": { "message": "Expert mode", "description": "label of expert mode checkbox" + }, + "global_label": { + "message": "inject globally", + "description": "checkbox on settings page" } } \ No newline at end of file diff --git a/css/style.css b/css/style.css index ef8ca7b..678ff4f 100644 --- a/css/style.css +++ b/css/style.css @@ -121,4 +121,8 @@ label span { #ace-editor { font-family: monospace +} + +.options { + padding: 10px; } \ No newline at end of file diff --git a/js/options.js b/js/options.js new file mode 100644 index 0000000..4207e78 --- /dev/null +++ b/js/options.js @@ -0,0 +1,41 @@ +function initl18n() { + var translatableIDs = ["global-label", "save", "reset"]; + translatableIDs.forEach(function(id) { + var translateKey = id.replace(/-/g, "_"); + document.getElementById(id).innerText = chrome.i18n.getMessage(translateKey); + }); +} + +function initAce() { + var editor = ace.edit(document.getElementById("ace-editor")); + editor.setTheme("ace/theme/tomorrow"); + editor.getSession().setMode("ace/mode/javascript"); + editor.$blockScrolling = Infinity; + editor.setReadOnly(true); + editor.setHighlightGutterLine(false); + editor.setHighlightActiveLine(false); + return editor; +} + + +initl18n(); +var editor = initAce(); + +var globalEl = document.getElementById("global"); + +globalEl.addEventListener("click", function() { + var enabled = globalEl.checked; + editor.setOptions({ + readOnly: !enabled, + highlightActiveLine: enabled, + highlightGutterLine: enabled + }); + if (globalEl.checked) { + } +}); + +document.getElementById("save").addEventListener("click", function() { + chrome.storage.sync.set({global:globalEl.checked}, function() { + window.close() + }) +}); \ No newline at end of file diff --git a/js/popup.js b/js/popup.js index dcd40c3..b3b41df 100644 --- a/js/popup.js +++ b/js/popup.js @@ -30,7 +30,7 @@ document.addEventListener('DOMContentLoaded', function() { }); popup.el.piwikURL.setAttribute("placeholder", chrome.i18n.getMessage("piwik_url_placeholder")); popup.el.siteID.setAttribute("placeholder", chrome.i18n.getMessage("site_id_placeholder")); - document.title = chrome.i18n.getMessage("extention_name"); + document.title = chrome.i18n.getMessage("extension_name"); }, host: undefined, url: undefined, diff --git a/manifest.json b/manifest.json index 79a5794..77c9e8b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,10 @@ { "manifest_version": 2, - "name": "__MSG_extention_name__", + "name": "__MSG_extension_name__", "short_name": "piwik-injector", "version": "3.1.1", "author": "Lukas Winkler, xcv58, hromadadan", - "description": "__MSG_extention_description__", + "description": "__MSG_extension_description__", "icons": { "128": "img/logo-128x128.png", "256": "img/logo-256x256.png" @@ -39,5 +39,9 @@ "id": "{59f7eef0-6361-4f57-9e7c-7fdbd6a33710}", "strict_min_version": "42.0" } + }, + "options_ui": { + "page": "options.html", + "chrome_style": false } } diff --git a/options.html b/options.html new file mode 100644 index 0000000..d618b74 --- /dev/null +++ b/options.html @@ -0,0 +1,35 @@ + + + + + + + + + + + + + +
+ + +
+

+                
+            
+ +
+ + + +
+
+ + + +