mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 18:42: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
|
special versions for the old behavior
|
||||||
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
|
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
|
||||||
VimperatorLeave respectively
|
VimperatorLeave respectively
|
||||||
|
* add guioptions=nN to number tabs
|
||||||
* add :loadplugins command
|
* add :loadplugins command
|
||||||
* add . mapping
|
* add . mapping
|
||||||
* add N% normal mode command
|
* add N% normal mode command
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
<?xml version="1.0"?>
|
<?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"
|
<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:xbl="http://www.mozilla.org/xbl"
|
||||||
xmlns:html="http://www.w3.org/1999/xhtml">
|
xmlns:html="http://www.w3.org/1999/xhtml">
|
||||||
|
|
||||||
@@ -10,6 +18,23 @@
|
|||||||
<children/>
|
<children/>
|
||||||
</content>
|
</content>
|
||||||
</binding>
|
</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">
|
<binding id="compitem-td">
|
||||||
<!-- No white space. The table is white-space: pre; :( -->
|
<!-- No white space. The table is white-space: pre; :( -->
|
||||||
<content><html:span class="compitem-td-span"><children/></html:span></content>
|
<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",
|
const highlightClasses = ["Boolean", "ErrorMsg", "Filter", "Function", "InfoMsg", "Keyword",
|
||||||
"LineNr", "ModeMsg", "MoreMsg", "Normal", "Null", "Number", "Object", "Question",
|
"LineNr", "ModeMsg", "MoreMsg", "Normal", "Null", "Number", "Object", "Question",
|
||||||
"StatusLine", "StatusLineBroken", "StatusLineSecure", "String", "Tag",
|
"StatusLine", "StatusLineBroken", "StatusLineSecure", "String", "TabClose", "TabIcon",
|
||||||
"Title", "URL", "WarningMsg",
|
"TabIconNumber", "TabNumber", "TabText", "Tag", "Title", "URL", "WarningMsg",
|
||||||
["Hint", ".liberator-hint", "*"],
|
["Hint", ".liberator-hint", "*"],
|
||||||
["Search", ".__liberator-search", "*"],
|
["Search", ".__liberator-search", "*"],
|
||||||
["Bell", "#liberator-visualbell"],
|
["Bell", "#liberator-visualbell"],
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ const liberator = (function () //{{{
|
|||||||
// Only general options are added here, which are valid for all vimperator like extensions
|
// Only general options are added here, which are valid for all vimperator like extensions
|
||||||
function addOptions()
|
function addOptions()
|
||||||
{
|
{
|
||||||
|
const tabopts = [
|
||||||
|
["n", "Tab number", null, ".hl-TabNumber"],
|
||||||
|
["N", "Tab number over icon", null, ".hl-TabIconNumber"],
|
||||||
|
];
|
||||||
liberator.options.add(["guioptions", "go"],
|
liberator.options.add(["guioptions", "go"],
|
||||||
"Show or hide certain GUI elements like the menu or toolbar",
|
"Show or hide certain GUI elements like the menu or toolbar",
|
||||||
"charlist", liberator.config.defaults.guioptions || "",
|
"charlist", liberator.config.defaults.guioptions || "",
|
||||||
@@ -69,14 +73,23 @@ const liberator = (function () //{{{
|
|||||||
|
|
||||||
for (let option in guioptions)
|
for (let option in guioptions)
|
||||||
{
|
{
|
||||||
guioptions[option].forEach(function (elem) {
|
if (option in guioptions)
|
||||||
try
|
{
|
||||||
{
|
guioptions[option].forEach(function (elem) {
|
||||||
document.getElementById(elem).collapsed = (value.indexOf(option.toString()) < 0);
|
try
|
||||||
}
|
{
|
||||||
catch (e) {}
|
document.getElementById(elem).collapsed = (value.indexOf(option.toString()) < 0);
|
||||||
});
|
}
|
||||||
|
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;
|
return value;
|
||||||
},
|
},
|
||||||
@@ -86,17 +99,9 @@ const liberator = (function () //{{{
|
|||||||
["m", "Menubar"],
|
["m", "Menubar"],
|
||||||
["T", "Toolbar"],
|
["T", "Toolbar"],
|
||||||
["b", "Bookmark bar"]
|
["b", "Bookmark bar"]
|
||||||
];
|
].concat(!liberator.has("tabs") ? [] : tabopts);
|
||||||
},
|
},
|
||||||
validator: function (value)
|
validator: function (value) Array.every(value, function (c) c in liberator.config.guioptions || tabopts.some(function (a) a[0] == c)),
|
||||||
{
|
|
||||||
var regex = "[^";
|
|
||||||
|
|
||||||
for (let option in liberator.config.guioptions)
|
|
||||||
regex += option.toString();
|
|
||||||
|
|
||||||
return !(new RegExp(regex + "]").test(value));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.options.add(["helpfile", "hf"],
|
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
|
// 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)
|
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;
|
var focused = document.commandDispatcher.focusedElement;
|
||||||
if (focused && focused == commandWidget.inputField || focused == multilineInputWidget.inputField)
|
if (focused && focused == commandWidget.inputField || focused == multilineInputWidget.inputField)
|
||||||
return false;
|
return false;
|
||||||
@@ -619,6 +612,13 @@ liberator.CommandLine = function () //{{{
|
|||||||
if (flags & this.APPEND_TO_MESSAGES)
|
if (flags & this.APPEND_TO_MESSAGES)
|
||||||
messageHistory.add({ str: str, highlight: highlightGroup });
|
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;
|
var where = setLine;
|
||||||
if (flags & this.FORCE_MULTILINE)
|
if (flags & this.FORCE_MULTILINE)
|
||||||
where = setMultiline;
|
where = setMultiline;
|
||||||
@@ -1593,6 +1593,10 @@ liberator.StatusLine = function () //{{{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let tabs = getBrowser().mTabs;
|
||||||
|
for (let i = 0; i < tabs.length; i++)
|
||||||
|
tabs[i].setAttribute("ordinal", i + 1);
|
||||||
|
|
||||||
if (!currentIndex || typeof currentIndex != "number")
|
if (!currentIndex || typeof currentIndex != "number")
|
||||||
currentIndex = liberator.tabs.index() + 1;
|
currentIndex = liberator.tabs.index() + 1;
|
||||||
if (!totalTabs || typeof currentIndex != "number")
|
if (!totalTabs || typeof currentIndex != "number")
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ liberator.config = { //{{{
|
|||||||
|
|
||||||
/*** optional options, there are checked for existance and a fallback provided ***/
|
/*** optional options, there are checked for existance and a fallback provided ***/
|
||||||
features: ["bookmarks", "hints", "history", "marks", "quickmarks", "session", "tabs", "windows"],
|
features: ["bookmarks", "hints", "history", "marks", "quickmarks", "session", "tabs", "windows"],
|
||||||
defaults: { guioptions: "" },
|
defaults: { guioptions: "N" },
|
||||||
guioptions: { m: ["toolbar-menubar"], T: ["nav-bar"], b: ["PersonalToolbar"] },
|
guioptions: { m: ["toolbar-menubar"], T: ["nav-bar"], b: ["PersonalToolbar"] },
|
||||||
|
|
||||||
get visualbellWindow() getBrowser().mPanelContainer,
|
get visualbellWindow() getBrowser().mPanelContainer,
|
||||||
|
|||||||
@@ -318,6 +318,8 @@ Show or hide certain GUI elements like the menu or toolbar. Supported characters
|
|||||||
*m* Menubar
|
*m* Menubar
|
||||||
*T* Toolbar
|
*T* Toolbar
|
||||||
*b* Bookmark bar
|
*b* Bookmark bar
|
||||||
|
*n* Tab number
|
||||||
|
*N* Tab number over image
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
You can also hide the tab bar with [c]:set showtabline=0[c].
|
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
|
@-moz-document
|
||||||
url-prefix(chrome://) {
|
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 {
|
#liberator-container {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user