[Pkg-mozext-commits] [tabmixplus] 27/51: Remove long inline script from shortcuts.xul, use xml Instead
David Prévot
taffit at moszumanska.debian.org
Mon Feb 2 18:36:50 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 627261b67e3c6ce6960a5123c508e7317a41e019
Author: onemen <tabmix.onemen at gmail.com>
Date: Mon Jan 5 16:45:56 2015 +0200
Remove long inline script from shortcuts.xul, use xml Instead
---
chrome/content/overlay/browsr.css | 4 +++
chrome/content/preferences/shortcuts.xul | 29 --------------------
chrome/content/preferences/shortcutsLabels.xml | 38 ++++++++++++++++++++++++++
modules/Shortcuts.jsm | 21 ++++++++++----
4 files changed, 58 insertions(+), 34 deletions(-)
diff --git a/chrome/content/overlay/browsr.css b/chrome/content/overlay/browsr.css
index a16d342..aa9098b 100644
--- a/chrome/content/overlay/browsr.css
+++ b/chrome/content/overlay/browsr.css
@@ -6,6 +6,10 @@
*
**/
+vbox[shortcutsLabels="true"] {
+ -moz-binding: url(chrome://tabmixplus/content/preferences/shortcutsLabels.xml#shortcut-labels) !important;
+}
+
/* for Firefox 11.0-19.0, not in use for Firefox 20.0+ */
label.text-link, label[onclick] {
-moz-binding: url(chrome://tabmixplus/content/tab/text.xml#tmp-text-link);
diff --git a/chrome/content/preferences/shortcuts.xul b/chrome/content/preferences/shortcuts.xul
index 31fe991..5ca11de 100644
--- a/chrome/content/preferences/shortcuts.xul
+++ b/chrome/content/preferences/shortcuts.xul
@@ -1,8 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE overlay [
-<!ENTITY % pref-tabmixDTD SYSTEM "chrome://tabmixplus/locale/pref-tabmix.dtd">
-%pref-tabmixDTD;
<!ENTITY % tabmixDTD SYSTEM "chrome://tabmixplus/locale/tabmix.dtd">
%tabmixDTD;
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
@@ -26,31 +24,4 @@
<key id="key_tm_toggleFLST" label="&shortcuts.toggleFLST;" keycode="VK_F9" oncommand="Tabmix.flst.toggle();" disabled="true"/>
</keyset>
- <script type="application/javascript">
- // we only need to get the labels one time
- if (!Tabmix.ShortcutsInitialized) {
- let sc = Tabmix.shortcutsLabels = {};
- sc.dupTabToWin = "&clicktab.duplicatetabw;";
- sc.protecttab = "&clicktab.protecttab;";
- sc.locktab = "&clicktab.locktab;";
- sc.freezetab = "&clicktab.freezetab;";
- sc.renametab = "&clicktab.renametab;";
- sc.copyTabUrl = "&clicktab.copyTabUrl;";
- sc.pasteTabUrl = "&clicktab.copyUrlFromClipboard;";
- sc.selectMerge = "&clicktab.selectMerge;";
- sc.reload = "&clicktab.reloadtab;";
- sc.reloadtabs = "&clicktab.reloadtabs;";
- sc.reloadothertabs = "&clicktab.reloadothertabs;";
- sc.reloadlefttabs = "&clicktab.reloadlefttabs;";
- sc.reloadrighttabs = "&clicktab.reloadrighttabs;";
- sc.autoReloadTab = "&clicktab.autoReloadTab;";
- sc.removeall = "&clicktab.removeall;";
- sc.removesimilar = "&clicktab.removesimilar;";
- sc.removeother = "&clicktab.removeother;";
- sc.removeleft = "&clicktab.removetoLeft;";
- sc.removeright = "&clicktab.removetoRight;";
- sc.undoClose = "&clicktab.uctab;";
- sc.ucatab = "&clicktab.ucatab;";
- }
- </script>
</overlay>
diff --git a/chrome/content/preferences/shortcutsLabels.xml b/chrome/content/preferences/shortcutsLabels.xml
new file mode 100644
index 0000000..645d83f
--- /dev/null
+++ b/chrome/content/preferences/shortcutsLabels.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE bindings [
+<!ENTITY % pref-tabmixDTD SYSTEM "chrome://tabmixplus/locale/pref-tabmix.dtd">
+%pref-tabmixDTD;
+]>
+
+<bindings id="tmp_shortcuts_labels"
+ xmlns="http://www.mozilla.org/xbl"
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:xbl="http://www.mozilla.org/xbl">
+
+ <binding id="shortcut-labels" display="xul:vbox">
+ <content hidden="true"
+ dupTabToWin="&clicktab.duplicatetabw;"
+ protecttab="&clicktab.protecttab;"
+ locktab="&clicktab.locktab;"
+ freezetab="&clicktab.freezetab;"
+ renametab="&clicktab.renametab;"
+ copyTabUrl="&clicktab.copyTabUrl;"
+ pasteTabUrl="&clicktab.copyUrlFromClipboard;"
+ selectMerge="&clicktab.selectMerge;"
+ reload="&clicktab.reloadtab;"
+ reloadtabs="&clicktab.reloadtabs;"
+ reloadothertabs="&clicktab.reloadothertabs;"
+ reloadlefttabs="&clicktab.reloadlefttabs;"
+ reloadrighttabs="&clicktab.reloadrighttabs;"
+ autoReloadTab="&clicktab.autoReloadTab;"
+ removeall="&clicktab.removeall;"
+ removesimilar="&clicktab.removesimilar;"
+ removeother="&clicktab.removeother;"
+ removeleft="&clicktab.removetoLeft;"
+ removeright="&clicktab.removetoRight;"
+ undoClose="&clicktab.uctab;">
+ </content>
+ </binding>
+
+</bindings>
diff --git a/modules/Shortcuts.jsm b/modules/Shortcuts.jsm
index 98b5370..e38183f 100644
--- a/modules/Shortcuts.jsm
+++ b/modules/Shortcuts.jsm
@@ -74,17 +74,28 @@ this.Shortcuts = {
getService(Ci.nsIPrivateBrowsingService).autoStarted;
// update keys initial value and label
- let labels = aWindow.Tabmix.shortcutsLabels;
+ // get our key labels from shortcutsLabels.xml
+ let $ = function(id) id && aWindow.document.getElementById(id);
+ let container = $("tabmixScrollBox") || $("tabbrowser-tabs");
+ let labels = {};
+ if (container) {
+ let box = aWindow.document.createElement("vbox");
+ box.setAttribute("shortcutsLabels", true);
+ container.appendChild(box);
+ Array.slice(box.attributes).forEach(function(a) labels[a.name] = a.value);
+ container.removeChild(box);
+ }
labels.togglePinTab =
- aWindow.document.getElementById("context_pinTab").getAttribute("label") + "/" +
- aWindow.document.getElementById("context_unpinTab").getAttribute("label");
+ $("context_pinTab").getAttribute("label") + "/" +
+ $("context_unpinTab").getAttribute("label");
for (let key of Object.keys(this.keys)) {
let keyData = this.keys[key];
keyData.value = keyData.default || "";
- if (key in labels)
+ if (container && key in labels)
keyData.label = labels[key];
+ else if (!container && !key.id)
+ keyData.label = "tabmix_key_" + key;
}
- delete aWindow.Tabmix.shortcutsLabels;
if (aWindow.keyconfig) {
this.keyConfigInstalled = true;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list