Skip to content
This repository has been archived by the owner on May 3, 2023. It is now read-only.

Commit

Permalink
Opening links, and prefs display works in TB60
Browse files Browse the repository at this point in the history
Prefs still look horribly broken and I don't think they save
  • Loading branch information
mikehardy committed Nov 9, 2018
1 parent eee3040 commit 72135c1
Show file tree
Hide file tree
Showing 14 changed files with 135 additions and 143 deletions.
Empty file modified .eslintrc.json
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified CREDITS
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
31 changes: 22 additions & 9 deletions chrome/thunderlink/content/preferences.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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");
Expand All @@ -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, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
},

};
126 changes: 63 additions & 63 deletions chrome/thunderlink/content/preferences.xul
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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/.
-->

<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<prefwindow id="appPreferences"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
<prefpane id="pane1" label="Preferences">
<preferences>
<preference id="prefs_customTlString1" name="extensions.thunderlink.custom-tl-string-1" type="string"/>
<preference id="prefs_customTlString2" name="extensions.thunderlink.custom-tl-string-2" type="string"/>
<preference id="prefs_customTlString3" name="extensions.thunderlink.custom-tl-string-3" type="string"/>
<preference id="prefs_customTlString4" name="extensions.thunderlink.custom-tl-string-4" type="string"/>
<preference id="prefs_customTlString5" name="extensions.thunderlink.custom-tl-string-5" type="string"/>
<preference id="prefs_customTlString6" name="extensions.thunderlink.custom-tl-string-6" type="string"/>
<preference id="prefs_customTlString7" name="extensions.thunderlink.custom-tl-string-7" type="string"/>
<preference id="prefs_customTlString8" name="extensions.thunderlink.custom-tl-string-8" type="string"/>
<preference id="prefs_customTlString1title" name="extensions.thunderlink.custom-tl-string-1-title" type="string"/>
<preference id="prefs_customTlString2title" name="extensions.thunderlink.custom-tl-string-2-title" type="string"/>
<preference id="prefs_customTlString3title" name="extensions.thunderlink.custom-tl-string-3-title" type="string"/>
<preference id="prefs_customTlString4title" name="extensions.thunderlink.custom-tl-string-4-title" type="string"/>
<preference id="prefs_customTlString5title" name="extensions.thunderlink.custom-tl-string-5-title" type="string"/>
<preference id="prefs_customTlString6title" name="extensions.thunderlink.custom-tl-string-6-title" type="string"/>
<preference id="prefs_customTlString7title" name="extensions.thunderlink.custom-tl-string-7-title" type="string"/>
<preference id="prefs_customTlString8title" name="extensions.thunderlink.custom-tl-string-8-title" type="string"/>
<preference id="prefs_customTlString1tagcheckbox" name="extensions.thunderlink.custom-tl-string-1-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString2tagcheckbox" name="extensions.thunderlink.custom-tl-string-2-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString3tagcheckbox" name="extensions.thunderlink.custom-tl-string-3-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString4tagcheckbox" name="extensions.thunderlink.custom-tl-string-4-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString5tagcheckbox" name="extensions.thunderlink.custom-tl-string-5-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString6tagcheckbox" name="extensions.thunderlink.custom-tl-string-6-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString7tagcheckbox" name="extensions.thunderlink.custom-tl-string-7-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString8tagcheckbox" name="extensions.thunderlink.custom-tl-string-8-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString1tag" name="extensions.thunderlink.custom-tl-string-1-tag" type="int"/>
<preference id="prefs_customTlString2tag" name="extensions.thunderlink.custom-tl-string-2-tag" type="int"/>
<preference id="prefs_customTlString3tag" name="extensions.thunderlink.custom-tl-string-3-tag" type="int"/>
<preference id="prefs_customTlString4tag" name="extensions.thunderlink.custom-tl-string-4-tag" type="int"/>
<preference id="prefs_customTlString5tag" name="extensions.thunderlink.custom-tl-string-5-tag" type="int"/>
<preference id="prefs_customTlString6tag" name="extensions.thunderlink.custom-tl-string-6-tag" type="int"/>
<preference id="prefs_customTlString7tag" name="extensions.thunderlink.custom-tl-string-7-tag" type="int"/>
<preference id="prefs_customTlString8tag" name="extensions.thunderlink.custom-tl-string-8-tag" type="int"/>
<preference id="prefs_openTlBehaviour" name="extensions.thunderlink.open-tl-behaviour" type="string"/>
</preferences>
<vbox>
<hbox>
<label control="openTlBehaviour" value="When running, open TLs "/>
<menulist id="openTlBehaviour" preference="prefs_openTlBehaviour">
<menupopup>
<menuitem label="in new tab" value="openInNewTab"/>
<menuitem label="in new window" value="openInNewWindow"/>
<menuitem label="by selecting in mailbox" value="bySelecting" />
</menupopup>
</menulist>
</hbox>
<separator orient="horizontal" class="groove" />
<label control="csLabel" value="Custom ThunderLink string settings"/>
<separator class="groove-thin"/>
<label control="csLabel" value="You can use the following placeholders:"/>
<spacer size="10"/>
<label control="csLabel" value="&#60;thunderlink&#62; &#60;messageid&#62; &#60;subject&#62; &#60;filteredSubject&#62; &#60;sender&#62; &#60;tbexe&#62;"/>
<separator class="groove-thin"/>
</vbox>
<tabbox id="thunderlink-custom-strings-tabbox" selectedIndex="0"/>
</prefpane>
<prefwindow id="appPreferences"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="pane1" label="Preferences">
<preferences>
<preference id="prefs_customTlString1" name="extensions.thunderlink.custom-tl-string-1" type="string"/>
<preference id="prefs_customTlString2" name="extensions.thunderlink.custom-tl-string-2" type="string"/>
<preference id="prefs_customTlString3" name="extensions.thunderlink.custom-tl-string-3" type="string"/>
<preference id="prefs_customTlString4" name="extensions.thunderlink.custom-tl-string-4" type="string"/>
<preference id="prefs_customTlString5" name="extensions.thunderlink.custom-tl-string-5" type="string"/>
<preference id="prefs_customTlString6" name="extensions.thunderlink.custom-tl-string-6" type="string"/>
<preference id="prefs_customTlString7" name="extensions.thunderlink.custom-tl-string-7" type="string"/>
<preference id="prefs_customTlString8" name="extensions.thunderlink.custom-tl-string-8" type="string"/>
<preference id="prefs_customTlString1title" name="extensions.thunderlink.custom-tl-string-1-title" type="string"/>
<preference id="prefs_customTlString2title" name="extensions.thunderlink.custom-tl-string-2-title" type="string"/>
<preference id="prefs_customTlString3title" name="extensions.thunderlink.custom-tl-string-3-title" type="string"/>
<preference id="prefs_customTlString4title" name="extensions.thunderlink.custom-tl-string-4-title" type="string"/>
<preference id="prefs_customTlString5title" name="extensions.thunderlink.custom-tl-string-5-title" type="string"/>
<preference id="prefs_customTlString6title" name="extensions.thunderlink.custom-tl-string-6-title" type="string"/>
<preference id="prefs_customTlString7title" name="extensions.thunderlink.custom-tl-string-7-title" type="string"/>
<preference id="prefs_customTlString8title" name="extensions.thunderlink.custom-tl-string-8-title" type="string"/>
<preference id="prefs_customTlString1tagcheckbox" name="extensions.thunderlink.custom-tl-string-1-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString2tagcheckbox" name="extensions.thunderlink.custom-tl-string-2-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString3tagcheckbox" name="extensions.thunderlink.custom-tl-string-3-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString4tagcheckbox" name="extensions.thunderlink.custom-tl-string-4-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString5tagcheckbox" name="extensions.thunderlink.custom-tl-string-5-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString6tagcheckbox" name="extensions.thunderlink.custom-tl-string-6-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString7tagcheckbox" name="extensions.thunderlink.custom-tl-string-7-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString8tagcheckbox" name="extensions.thunderlink.custom-tl-string-8-tagcheckbox" type="bool"/>
<preference id="prefs_customTlString1tag" name="extensions.thunderlink.custom-tl-string-1-tag" type="int"/>
<preference id="prefs_customTlString2tag" name="extensions.thunderlink.custom-tl-string-2-tag" type="int"/>
<preference id="prefs_customTlString3tag" name="extensions.thunderlink.custom-tl-string-3-tag" type="int"/>
<preference id="prefs_customTlString4tag" name="extensions.thunderlink.custom-tl-string-4-tag" type="int"/>
<preference id="prefs_customTlString5tag" name="extensions.thunderlink.custom-tl-string-5-tag" type="int"/>
<preference id="prefs_customTlString6tag" name="extensions.thunderlink.custom-tl-string-6-tag" type="int"/>
<preference id="prefs_customTlString7tag" name="extensions.thunderlink.custom-tl-string-7-tag" type="int"/>
<preference id="prefs_customTlString8tag" name="extensions.thunderlink.custom-tl-string-8-tag" type="int"/>
<preference id="prefs_openTlBehaviour" name="extensions.thunderlink.open-tl-behaviour" type="string"/>
</preferences>
<vbox>
<hbox>
<label control="openTlBehaviour" value="When running, open TLs "/>
<menulist id="openTlBehaviour" preference="prefs_openTlBehaviour">
<menupopup>
<menuitem label="in new tab" value="openInNewTab"/>
<menuitem label="in new window" value="openInNewWindow"/>
<menuitem label="by selecting in mailbox" value="bySelecting" />
</menupopup>
</menulist>
</hbox>
<separator orient="horizontal" class="groove" />
<label control="csLabel" value="Custom ThunderLink string settings"/>
<separator class="groove-thin"/>
<label control="csLabel" value="You can use the following placeholders:"/>
<spacer size="10"/>
<label control="csLabel" value="&#60;thunderlink&#62; &#60;messageid&#62; &#60;subject&#62; &#60;filteredSubject&#62; &#60;sender&#62; &#60;tbexe&#62;"/>
<separator class="groove-thin"/>
</vbox>
<tabbox id="thunderlink-custom-strings-tabbox" selectedIndex="0"/>
</prefpane>

<script type="application/x-javascript" src="chrome://thunderlink/content/preferences.js" />
<script type="application/x-javascript" for="window" event="onload" >
<script type="application/x-javascript" src="chrome://thunderlink/content/preferences.js" />
<script type="application/x-javascript" for="window" event="onload">
this.ThunderLinkPrefNS.CreateCustomStringTabbox();
</script>
</script>
</prefwindow>
65 changes: 19 additions & 46 deletions chrome/thunderlink/content/thunderlink-overlay.xul
Original file line number Diff line number Diff line change
Expand Up @@ -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/.
-->

<overlay id="thunderbird-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://thunderlink/content/thunderlink.js"/>
<keyset>
<key id="cpCstTlStr1" modifiers="control alt" key="1"
oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(1);"/>
<key id="cpCstTlStr2" modifiers="control alt" key="2"
oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(2);"/>
<key id="cpCstTlStr3" modifiers="control alt" key="3"
oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(3);"/>
<key id="cpCstTlStr4" modifiers="control alt" key="4"
oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(4);"/>
<key id="cpCstTlStr5" modifiers="control alt" key="5"
oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(5);"/>
<key id="cpCstTlStr6" modifiers="control alt" key="6"
oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(6);"/>
<key id="cpCstTlStr7" modifiers="control alt" key="7"
oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(7);"/>
<key id="cpCstTlStr8" modifiers="control alt" key="8"
oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(8);"/>
<!--
<key id="cpTlStr" modifiers="control alt" key="5"
oncommand="ThunderLinkChromeNS.CopyMessageUrlToClp();"/>
<key id="cpTlStrWtExe" modifiers="control alt" key="6"
oncommand="ThunderLinkChromeNS.CopyMessageUrlToClpWithExe();"/>
-->
</keyset>
<popup id="mailContext">
<menu id="thunderlink-options" label="ThunderLink..." onpopupshowing="ThunderLinkChromeNS.OnTlMenuLoad();">
<menupopup id="thunderlink-custom-strings" >
<!-- <menuitem
id="thunderlink_option"
label="Copy plain TL to clipboard"
oncommand="ThunderLinkChromeNS.CopyMessageUrlToClp();"/>
<menuitem
id="thunderlink_exe_option"
label="Copy call to executable + TL to clipboard"
oncommand="ThunderLinkChromeNS.CopyMessageUrlToClpWithExe();"/>
<menu label="Copy user-defined TL string to clipboard:" onpopupshowing="ThunderLinkChromeNS.OnTlMenuLoad();">
<menupopup id="thunderlink-custom-strings" />
</menu>-->
</menupopup>
</menu>
</popup>

<overlay id="thunderbird-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://thunderlink/content/thunderlink.js"/>
<keyset>
<key id="cpCstTlStr1" modifiers="control alt" key="1" oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(1);"/>
<key id="cpCstTlStr2" modifiers="control alt" key="2" oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(2);"/>
<key id="cpCstTlStr3" modifiers="control alt" key="3" oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(3);"/>
<key id="cpCstTlStr4" modifiers="control alt" key="4" oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(4);"/>
<key id="cpCstTlStr5" modifiers="control alt" key="5" oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(5);"/>
<key id="cpCstTlStr6" modifiers="control alt" key="6" oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(6);"/>
<key id="cpCstTlStr7" modifiers="control alt" key="7" oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(7);"/>
<key id="cpCstTlStr8" modifiers="control alt" key="8" oncommand="ThunderLinkChromeNS.CopyCustomTlStringToClp(8);"/>
</keyset>
<popup id="mailContext">
<menu id="thunderlink-options" label="ThunderLink..." onpopupshowing="ThunderLinkChromeNS.OnTlMenuLoad();">
<menupopup id="thunderlink-custom-strings" />
</menu>
</popup>
</overlay>
Loading

0 comments on commit 72135c1

Please sign in to comment.