1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-09 18:25:46 +01:00

Re-enable tab numbers of FF36.

This commit is contained in:
Kris Maglione
2010-12-26 20:45:03 -05:00
parent 467d193694
commit 8c64d0ec44
9 changed files with 84 additions and 18 deletions

View File

@@ -19,11 +19,55 @@
</content>
</binding>
<binding id="compitem-td">
<!-- No white space. The table is white-space: pre; :( -->
<content><html:span class="td-strut"/><html:span class="td-span"><children/></html:span></content>
</binding>
<binding id="tab" display="xul:hbox"
extends="chrome://browser/content/tabbrowser.xml#tabbrowser-tab">
<content context="tabContextMenu" closetabtext="Close Tab">
<xul:stack class="tab-icon dactyl-tab-stack">
<xul:image xbl:inherits="validate,src=image" role="presentation" class="tab-icon-image"/>
<xul:vbox>
<xul:spring flex="1"/>
<xul:label xbl:inherits="value=dactylOrdinal" dactyl:highlight="TabIconNumber"/>
<xul:spring flex="1"/>
</xul:vbox>
</xul:stack>
<xul:label xbl:inherits="value=dactylOrdinal" dactyl:highlight="TabNumber"/>
<xul:label xbl:inherits="value=label,crop,accesskey"
flex="1" class="tab-text" role="presentation"/>
<xul:toolbarbutton anonid="close-button" tabindex="-1"
class="tab-close-button"/>
</content>
</binding>
<binding id="tab-mac"
extends="chrome://browser/content/tabbrowser.xml#tabbrowser-tab">
<content chromedir="ltr" closetabtext="Close Tab">
<xul:hbox class="tab-image-left" xbl:inherits="selected"/>
<xul:hbox class="tab-image-middle" flex="1" align="center" xbl:inherits="selected">
<xul:stack class="tab-icon dactyl-tab-stack">
<xul:image xbl:inherits="validate,src=image" class="tab-icon-image"/>
<xul:image class="tab-extra-status"/>
<xul:vbox>
<xul:spring flex="1"/>
<xul:label xbl:inherits="value=dactylOrdinal" align="center" highlight="TabIconNumber" class="dactyl-tab-icon-number"/>
<xul:spring flex="1"/>
</xul:vbox>
</xul:stack>
<xul:stack class="tab-text-stack">
<xul:label xbl:inherits="value=dactylOrdinal" class="tab-text" dactyl:highlight="TabNumber"/>
</xul:stack>
<xul:stack class="tab-text-stack" flex="1">
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" crop="right" class="tab-text"/>
</xul:stack>
</xul:hbox>
<xul:toolbarbutton anonid="close-button" tabindex="-1" class="tab-close-button"/>
<xul:hbox class="tab-image-right" xbl:inherits="selected"/>
</content>
</binding>
</bindings>
<!-- vim:se ft=xbl sw=4 sts=4 tw=0 et: -->

View File

@@ -176,6 +176,8 @@ var CommandWidgets = Class("CommandWidgets", {
let elem = document.getElementById("dactyl-multiline-output");
elem.contentWindow.addEventListener("unload", function (event) { event.preventDefault(); }, true);
elem.contentDocument.body.id = "dactyl-multiline-output-content";
elem.__defineGetter__("atEnd", function ()
!Buffer.isScrollable(elem.contentDocument.documentElement, 1));
["copy", "copylink", "selectall"].forEach(function (tail) {
// some host apps use "hostPrefixContext-copy" ids
let xpath = "//xul:menuitem[contains(@id, '" + "ontext-" + tail + "') and not(starts-with(@id, 'dactyl-'))]";

View File

@@ -20,6 +20,16 @@ var ConfigBase = Class(ModuleBase, {
highlight.styleableChrome = this.styleableChrome;
highlight.loadCSS(this.CSS);
highlight.loadCSS(this.helpCSS);
if (!util.haveGecko("2b"))
highlight.loadCSS(<![CDATA[
!TabNumber font-weight: bold; margin: 0px; padding-right: .8ex;
!TabIconNumber {
font-weight: bold;
color: white;
text-align: center;
text-shadow: black -1px 0 1px, black 0 1px 1px, black 1px 0 1px, black 0 -1px 1px;
}
]]>);
let img = Image();
img.src = this.logo || "chrome://" + this.name + "/content/logo.png";

View File

@@ -1313,9 +1313,12 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
styles.system.add("taboptions", "chrome://*",
classes.length ? classes.join(",") + "{ display: none; }" : "");
},
validator: function (opts) dactyl.has("Gecko2") ||
Option.validIf(!/[nN]/.test(opts), "Tab numbering not available in this " + config.host + " version")
if (!dactyl.has("Gecko2")) {
tabs.tabBinding.enabled = Array.some(opts, function (k) k in this.opts, this);
tabs.updateTabCount();
}
}
}
].filter(function (group) !group.feature || dactyl.has(group.feature));

View File

@@ -661,7 +661,7 @@ var Options = Module("options", {
}
let closure = function () options._optionMap[name];
memoize(this._options, this._options.length, closure);
memoize(this._optionMap, name, function () Option(names, description, type, defaultValue, extraInfo));
for (let alias in values(names.slice(1)))
memoize(this._optionMap, alias, closure);
@@ -670,6 +670,8 @@ var Options = Module("options", {
closure().initValue();
else
memoize(this.needInit, this.needInit.length, closure);
this._floptions = (this._floptions || []).concat(name);
memoize(this._options, this._options.length, closure);
// quickly access options with options["wildmode"]:
this.__defineGetter__(name, function () this._optionMap[name].value);
@@ -813,9 +815,9 @@ var Options = Module("options", {
*/
remove: function (name) {
let opt = this.get(name);
this._options = this._options.filter(function (o) o != opt);
for (let name in values(opt.names))
delete this._optionMap[name];
this._options = this._options.filter(function (o) o != opt);
},
/** @property {Object} The options store. */

View File

@@ -34,6 +34,11 @@ var Tabs = Module("tabs", {
dactyl.commands["tabs.select"] = function (event) {
tabs.select(event.originalTarget.getAttribute("identifier"));
};
this.tabBinding = styles.system.add("tab-binding", "chrome://browser/content/browser.xul", String.replace(<><![CDATA[
xul|tab { -moz-binding: url(chrome://dactyl/content/bindings.xml#tab) !important; }
]]></>, /tab-./g, function (m) util.OS.isMacOSX ? "tab-mac" : m),
false, true);
},
cleanup: function cleanup() {
@@ -45,9 +50,9 @@ var Tabs = Module("tabs", {
}
},
_updateTabCount: function () {
if (dactyl.has("Gecko2"))
for (let [i, tab] in Iterator(this.visibleTabs)) {
updateTabCount: function () {
for (let [i, tab] in Iterator(this.visibleTabs)) {
if (dactyl.has("Gecko2")) {
function node(clas) document.getAnonymousElementByAttribute(tab, "class", clas);
if (!node("dactyl-tab-number")) {
let nodes = {};
@@ -60,8 +65,10 @@ var Tabs = Module("tabs", {
tab.__defineGetter__("dactylOrdinal", function () Number(nodes.icon.value));
tab.__defineSetter__("dactylOrdinal", function (i) nodes.icon.value = nodes.label.textContent = i);
}
tab.dactylOrdinal = i + 1;
}
tab.setAttribute("dactylOrdinal", i + 1);
tab.dactylOrdinal = i + 1;
}
statusline.updateTabCount(true);
},
@@ -497,7 +504,7 @@ var Tabs = Module("tabs", {
}
}, {
load: function () {
tabs._updateTabCount();
tabs.updateTabCount();
},
commands: function () {
commands.add(["bd[elete]", "bw[ipeout]", "bun[load]", "tabc[lose]"],
@@ -864,7 +871,7 @@ var Tabs = Module("tabs", {
events: function () {
let tabContainer = config.tabbrowser.mTabContainer;
["TabMove", "TabOpen", "TabClose"].forEach(function (event) {
events.addSessionListener(tabContainer, event, this.closure._updateTabCount, false);
events.addSessionListener(tabContainer, event, this.closure.updateTabCount, false);
}, this);
events.addSessionListener(tabContainer, "TabSelect", this.closure._onTabSelect, false);
},

View File

@@ -10,7 +10,6 @@ if (!JSMLoader)
globals: {},
stale: {},
load: function load(url, target) {
dump("dactyl: load: " + url + "\n");
if (this.stale[url]) {
delete this.stale[url];
let global = this.globals[url];
@@ -26,7 +25,6 @@ if (!JSMLoader)
Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader)
.loadSubScript(url, global);
dump("dactyl: load reloaded: " + url + "\n");
}
Components.utils.import(url, target);
},

View File

@@ -77,9 +77,9 @@
@-moz-document
url-prefix(chrome://) {
.tab-icon-image, .tab-throbber { -moz-box-ordinal-group: 10; }
[dactyl|highlight~=tab-number] { -moz-box-ordinal-group: 20; }
.tab-text, .tab-label, .tab-close-button { -moz-box-ordinal-group: 50; }
#TabsToolbar .tab-icon-image, .tab-throbber { -moz-box-ordinal-group: 10; }
[dactyl|highlight~=tab-number] { -moz-box-ordinal-group: 20; }
.tab-text, .tab-label, .tab-close-button { -moz-box-ordinal-group: 50; }
[dactyl|highlight~=Bell] {
-moz-appearance: none !important;

View File

@@ -82,7 +82,7 @@
- Active filters are not highlighted in :style listings.
- :style-related commands now divide their completions between
those active and inactive for the current site.
- CSS property name completion is not available.
- CSS property name completion is now available.
* IMPORTANT option changes:
- Boolean options no longer accept an argument.
- 'cdpath' and 'runtimepath' no longer treat ",,"