mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 16:32:27 +01:00
Add tab numbering
This commit is contained in:
1
NEWS
1
NEWS
@@ -7,6 +7,7 @@
|
||||
special versions for the old behavior
|
||||
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
|
||||
VimperatorLeave respectively
|
||||
* add guioptions=nN to number tabs
|
||||
* add :loadplugins command
|
||||
* add . mapping
|
||||
* add N% normal mode command
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE bindings [
|
||||
<!ENTITY % tabBrowserDTD SYSTEM "chrome://browser/locale/tabbrowser.dtd" >
|
||||
%tabBrowserDTD;
|
||||
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
|
||||
%globalDTD;
|
||||
]>
|
||||
|
||||
<bindings 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"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
|
||||
@@ -10,6 +18,23 @@
|
||||
<children/>
|
||||
</content>
|
||||
</binding>
|
||||
<binding id="tab"
|
||||
extends="chrome://browser/content/tabbrowser.xml#tabbrowser-tab">
|
||||
<content chromedir="&locale.dir;"
|
||||
closetabtext="&closeTab.label;">
|
||||
<xul:stack class="liberator-tab-stack">
|
||||
<xul:image xbl:inherits="validate,src=image" class="tab-icon-image hl-TabIcon"/>
|
||||
<xul:vbox>
|
||||
<xul:spring flex="1"/>
|
||||
<xul:label xbl:inherits="value=ordinal" class="hl-TabIconNumber"/>
|
||||
<xul:spring flex="1"/>
|
||||
</xul:vbox>
|
||||
</xul:stack>
|
||||
<xul:label xbl:inherits="value=ordinal" class="hl-TabNumber"/>
|
||||
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" class="tab-text hl-TabText"/>
|
||||
<xul:toolbarbutton anonid="close-button" tabindex="-1" class="tab-close-button hl-TabClose"/>
|
||||
</content>
|
||||
</binding>
|
||||
<binding id="compitem-td">
|
||||
<!-- No white space. The table is white-space: pre; :( -->
|
||||
<content><html:span class="compitem-td-span"><children/></html:span></content>
|
||||
|
||||
@@ -36,8 +36,8 @@ liberator.Buffer = function () //{{{
|
||||
|
||||
const highlightClasses = ["Boolean", "ErrorMsg", "Filter", "Function", "InfoMsg", "Keyword",
|
||||
"LineNr", "ModeMsg", "MoreMsg", "Normal", "Null", "Number", "Object", "Question",
|
||||
"StatusLine", "StatusLineBroken", "StatusLineSecure", "String", "Tag",
|
||||
"Title", "URL", "WarningMsg",
|
||||
"StatusLine", "StatusLineBroken", "StatusLineSecure", "String", "TabClose", "TabIcon",
|
||||
"TabIconNumber", "TabNumber", "TabText", "Tag", "Title", "URL", "WarningMsg",
|
||||
["Hint", ".liberator-hint", "*"],
|
||||
["Search", ".__liberator-search", "*"],
|
||||
["Bell", "#liberator-visualbell"],
|
||||
|
||||
@@ -59,6 +59,10 @@ const liberator = (function () //{{{
|
||||
// Only general options are added here, which are valid for all vimperator like extensions
|
||||
function addOptions()
|
||||
{
|
||||
const tabopts = [
|
||||
["n", "Tab number", null, ".hl-TabNumber"],
|
||||
["N", "Tab number over icon", null, ".hl-TabIconNumber"],
|
||||
];
|
||||
liberator.options.add(["guioptions", "go"],
|
||||
"Show or hide certain GUI elements like the menu or toolbar",
|
||||
"charlist", liberator.config.defaults.guioptions || "",
|
||||
@@ -68,6 +72,8 @@ const liberator = (function () //{{{
|
||||
var guioptions = liberator.config.guioptions || {};
|
||||
|
||||
for (let option in guioptions)
|
||||
{
|
||||
if (option in guioptions)
|
||||
{
|
||||
guioptions[option].forEach(function (elem) {
|
||||
try
|
||||
@@ -77,6 +83,13 @@ const liberator = (function () //{{{
|
||||
catch (e) {}
|
||||
});
|
||||
}
|
||||
}
|
||||
let classes = tabopts.filter(function (o) value.indexOf(o[0]) == -1)
|
||||
.map(function (a) a[3])
|
||||
if (!classes.length)
|
||||
liberator.storage.styles.removeSheet("taboptions", null, null, null, true);
|
||||
else
|
||||
liberator.storage.styles.addSheet("taboptions", "chrome://*", classes.join(",") + "{ display: none; }", true, true);
|
||||
|
||||
return value;
|
||||
},
|
||||
@@ -86,17 +99,9 @@ const liberator = (function () //{{{
|
||||
["m", "Menubar"],
|
||||
["T", "Toolbar"],
|
||||
["b", "Bookmark bar"]
|
||||
];
|
||||
].concat(!liberator.has("tabs") ? [] : tabopts);
|
||||
},
|
||||
validator: function (value)
|
||||
{
|
||||
var regex = "[^";
|
||||
|
||||
for (let option in liberator.config.guioptions)
|
||||
regex += option.toString();
|
||||
|
||||
return !(new RegExp(regex + "]").test(value));
|
||||
}
|
||||
validator: function (value) Array.every(value, function (c) c in liberator.config.guioptions || tabopts.some(function (a) a[0] == c)),
|
||||
});
|
||||
|
||||
liberator.options.add(["helpfile", "hf"],
|
||||
|
||||
@@ -603,13 +603,6 @@ liberator.CommandLine = function () //{{{
|
||||
// liberator.echo uses different order of flags as it omits the hightlight group, change v.commandline.echo argument order? --mst
|
||||
echo: function (str, highlightGroup, flags)
|
||||
{
|
||||
// if we are modifing the GUI while we are not in the main thread
|
||||
// Firefox will hang up
|
||||
var threadManager = Components.classes["@mozilla.org/thread-manager;1"]
|
||||
.getService(Components.interfaces.nsIThreadManager);
|
||||
if (!threadManager.isMainThread)
|
||||
return false;
|
||||
|
||||
var focused = document.commandDispatcher.focusedElement;
|
||||
if (focused && focused == commandWidget.inputField || focused == multilineInputWidget.inputField)
|
||||
return false;
|
||||
@@ -619,6 +612,13 @@ liberator.CommandLine = function () //{{{
|
||||
if (flags & this.APPEND_TO_MESSAGES)
|
||||
messageHistory.add({ str: str, highlight: highlightGroup });
|
||||
|
||||
// if we are modifing the GUI while we are not in the main thread
|
||||
// Firefox will hang up
|
||||
var threadManager = Components.classes["@mozilla.org/thread-manager;1"]
|
||||
.getService(Components.interfaces.nsIThreadManager);
|
||||
if (!threadManager.isMainThread)
|
||||
return false;
|
||||
|
||||
var where = setLine;
|
||||
if (flags & this.FORCE_MULTILINE)
|
||||
where = setMultiline;
|
||||
@@ -1593,6 +1593,10 @@ liberator.StatusLine = function () //{{{
|
||||
return;
|
||||
}
|
||||
|
||||
let tabs = getBrowser().mTabs;
|
||||
for (let i = 0; i < tabs.length; i++)
|
||||
tabs[i].setAttribute("ordinal", i + 1);
|
||||
|
||||
if (!currentIndex || typeof currentIndex != "number")
|
||||
currentIndex = liberator.tabs.index() + 1;
|
||||
if (!totalTabs || typeof currentIndex != "number")
|
||||
|
||||
@@ -33,7 +33,7 @@ liberator.config = { //{{{
|
||||
|
||||
/*** optional options, there are checked for existance and a fallback provided ***/
|
||||
features: ["bookmarks", "hints", "history", "marks", "quickmarks", "session", "tabs", "windows"],
|
||||
defaults: { guioptions: "" },
|
||||
defaults: { guioptions: "N" },
|
||||
guioptions: { m: ["toolbar-menubar"], T: ["nav-bar"], b: ["PersonalToolbar"] },
|
||||
|
||||
get visualbellWindow() getBrowser().mPanelContainer,
|
||||
|
||||
@@ -318,6 +318,8 @@ Show or hide certain GUI elements like the menu or toolbar. Supported characters
|
||||
*m* Menubar
|
||||
*T* Toolbar
|
||||
*b* Bookmark bar
|
||||
*n* Tab number
|
||||
*N* Tab number over image
|
||||
----------------
|
||||
|
||||
You can also hide the tab bar with [c]:set showtabline=0[c].
|
||||
|
||||
@@ -120,6 +120,22 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
||||
@-moz-document
|
||||
url-prefix(chrome://) {
|
||||
|
||||
.tabbrowser-tab {
|
||||
-moz-binding: url(chrome://liberator/content/bindings.xml#tab);
|
||||
}
|
||||
|
||||
.hl-TabIconNumber {
|
||||
font-weight: bold;
|
||||
text-shadow: black -1px 0 1px, black 0 1px 1px, black 1px 0 1px, black 0 -1px 1px;
|
||||
text-align: center;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.hl-TabNumber {
|
||||
font-weight: bold;
|
||||
padding-right: .3ex;
|
||||
}
|
||||
|
||||
#liberator-container {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user