From 72135c14a24b9e05d3c7ee96418ac490c26f4a03 Mon Sep 17 00:00:00 2001 From: Mike Hardy Date: Fri, 9 Nov 2018 00:31:13 -0500 Subject: [PATCH] Opening links, and prefs display works in TB60 Prefs still look horribly broken and I don't think they save --- .eslintrc.json | 0 .gitignore | 0 CREDITS | 0 LICENSE | 0 README.md | 0 chrome/thunderlink/content/preferences.js | 31 +++-- chrome/thunderlink/content/preferences.xul | 126 +++++++++--------- .../content/thunderlink-overlay.xul | 65 +++------ chrome/thunderlink/content/thunderlink.js | 29 ++-- components/thunderlinkCommandLineHandler.js | 23 ++-- defaults/preferences/thunderlink.js | 0 install.rdf | 4 +- package-lock.json | 0 package.json | 0 14 files changed, 135 insertions(+), 143 deletions(-) mode change 100644 => 100755 .eslintrc.json mode change 100644 => 100755 .gitignore mode change 100644 => 100755 CREDITS mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md mode change 100644 => 100755 chrome/thunderlink/content/preferences.js mode change 100644 => 100755 chrome/thunderlink/content/preferences.xul mode change 100644 => 100755 defaults/preferences/thunderlink.js mode change 100644 => 100755 package-lock.json mode change 100644 => 100755 package.json diff --git a/.eslintrc.json b/.eslintrc.json old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/CREDITS b/CREDITS old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/chrome/thunderlink/content/preferences.js b/chrome/thunderlink/content/preferences.js old mode 100644 new mode 100755 index b2538af..60f5dbc --- a/chrome/thunderlink/content/preferences.js +++ b/chrome/thunderlink/content/preferences.js @@ -11,8 +11,7 @@ var ThunderLinkPrefNS = { - - CreateCustomStringTabbox: () => { + CreateCustomStringTabbox: function CreateCustomStringTabbox() { var XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; Components.utils.import("resource:///modules/mailServices.js"); function createCstrTabPanel(cstrnum) { @@ -85,14 +84,12 @@ var ThunderLinkPrefNS = { return tabpanel; } - function createCstrTab(cstrnum) { var tab = window.document.createElementNS(XUL_NS, "tab"); tab.setAttribute("label", "String " + cstrnum); return tab; } - var tabbox = window.document.getElementById("thunderlink-custom-strings-tabbox"); if (tabbox.hasChildNodes()) { while (tabbox.firstChild) { @@ -112,7 +109,7 @@ var ThunderLinkPrefNS = { tabbox.appendChild(tabpanels); }, - ToggleTlTagField: (cstrnum) => { + ToggleTlTagField: function ToggleTlTagField(cstrnum) { function $(aID) { return document.getElementById(aID); } var tlTagCheckbox = $("prefCustomTlString" + cstrnum + "-tagcheckbox"); var tlTagField = $("prefCustomTlString" + cstrnum + "-tag"); @@ -123,20 +120,36 @@ var ThunderLinkPrefNS = { } }, - GetPreferenceValue: (prefname, argIgnored) => { + GetPreferenceValue: function GetPreferenceValue(prefname, bool) { var prefService = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService) .getBranch("extensions.thunderlink."); - prefService.QueryInterface(Components.interfaces.nsIPrefBranch2); + prefService.QueryInterface(Components.interfaces.nsIPrefBranch); - return prefService.getBoolPref(prefname); + console.log("Looking for pref " + prefname + " / is it bool? " + bool); + var prefValue = ""; + if (bool === "bool") { + prefValue = prefService.getBoolPref(prefname); + } else { + prefValue = prefService.getCharPref(prefname); + } + return prefValue; }, - LOG: (msg) => { + LOG: function LOG(msg) { var consoleService = Components.classes["@mozilla.org/consoleservice;1"] .getService(Components.interfaces.nsIConsoleService); consoleService.logStringMessage(msg); }, + escapeHtml: function escapeHtml(unsafe) { + console.log(`attempting to escape ${unsafe}`); + return unsafe + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); + }, }; diff --git a/chrome/thunderlink/content/preferences.xul b/chrome/thunderlink/content/preferences.xul old mode 100644 new mode 100755 index 2414c01..6176d5c --- a/chrome/thunderlink/content/preferences.xul +++ b/chrome/thunderlink/content/preferences.xul @@ -8,72 +8,72 @@ - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - - file, You can obtain one at http://mozilla.org/MPL/2.0/. + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/chrome/thunderlink/content/thunderlink-overlay.xul b/chrome/thunderlink/content/thunderlink-overlay.xul index c9d2c2d..d68cf7f 100755 --- a/chrome/thunderlink/content/thunderlink-overlay.xul +++ b/chrome/thunderlink/content/thunderlink-overlay.xul @@ -8,52 +8,25 @@ - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - - file, You can obtain one at http://mozilla.org/MPL/2.0/. + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - -