mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 09:48:00 +01:00
Move bindings.xmlbindings.xmltab back to regular bindings file. Adjust completion arrow layout. Reload highlight data on new window.
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE bindings [
|
||||
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
|
||||
%globalDTD;
|
||||
]>
|
||||
|
||||
<bindings xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:liberator="http://vimperator.org/namespaces/liberator"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
@@ -21,6 +16,22 @@
|
||||
<!-- 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://global/content/bindings/tabbox.xml#tab">
|
||||
<content chromedir="ltr" closetabtext="Close Tab">
|
||||
<xul:stack class="liberator-tab-stack">
|
||||
<xul:image xbl:inherits="validate,src=image" class="tab-icon-image" liberator:highlight="TabIcon"/>
|
||||
<xul:vbox>
|
||||
<xul:spring flex="1"/>
|
||||
<xul:label xbl:inherits="value=ordinal" liberator:highlight="TabIconNumber"/>
|
||||
<xul:spring flex="1"/>
|
||||
</xul:vbox>
|
||||
</xul:stack>
|
||||
<xul:label xbl:inherits="value=ordinal" liberator:highlight="TabNumber"/>
|
||||
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" class="tab-text" liberator:highlight="TabText"/>
|
||||
<xul:toolbarbutton anonid="close-button" tabindex="-1" class="tab-close-button" liberator:highlight="TabClose"/>
|
||||
</content>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
||||
<!-- vim:se ft=xbl sw=4 sts=4 tw=0 et: -->
|
||||
|
||||
@@ -1405,6 +1405,8 @@ function Completion() //{{{
|
||||
{
|
||||
let opt = options.get(name);
|
||||
let completer = opt.completer;
|
||||
if (!completer)
|
||||
return;
|
||||
|
||||
let curValues = curValue != null ? opt.parseValues(curValue) : opt.values;
|
||||
let newValues = opt.parseValues(context.filter);
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
it under any or all of those licenseses.
|
||||
}}} ***** END LICENSE BLOCK *****/
|
||||
|
||||
function Highlights(name, store, serial)
|
||||
{
|
||||
const highlightCSS = <![CDATA[
|
||||
Highlights.prototype.CSS = <![CDATA[
|
||||
Boolean color: red;
|
||||
Function color: navy;
|
||||
Null color: blue;
|
||||
@@ -38,9 +36,9 @@ function Highlights(name, store, serial)
|
||||
CompIcon>img max-width: 16px; max-height: 16px; vertical-align: middle;
|
||||
CompResult width: 45%; overflow: hidden;
|
||||
CompDesc color: gray; width: 50%;
|
||||
CompLess text-align: center; height: .5ex; line-height: .5ex; padding-top: 1ex;
|
||||
CompLess text-align: center; height: 0; line-height: .5ex; padding-top: 1ex;
|
||||
CompLess::after content: "\2303" /* Unicode up arrowhead */
|
||||
CompMore text-align: center; height: .5ex; line-height: .5ex;
|
||||
CompMore text-align: center; height: .5ex; line-height: .5ex; margin-bottom: -.5ex;
|
||||
CompMore::after content: "\2304" /* Unicode down arrowhead */
|
||||
|
||||
Gradient height: 1px; margin-bottom: -1px; margin-top: -1px;
|
||||
@@ -111,6 +109,8 @@ function Highlights(name, store, serial)
|
||||
padding: 0;
|
||||
}
|
||||
]]>.toString();
|
||||
function Highlights(name, store, serial)
|
||||
{
|
||||
var self = this;
|
||||
var highlight = {};
|
||||
var styles = storage.styles;
|
||||
@@ -144,6 +144,7 @@ function Highlights(name, store, serial)
|
||||
if (style.default == null)
|
||||
{
|
||||
delete highlight[style.class];
|
||||
styles.removeSheet(style.selector, null, null, null, true);
|
||||
return null;
|
||||
}
|
||||
newStyle = style.default;
|
||||
@@ -167,14 +168,24 @@ function Highlights(name, store, serial)
|
||||
return "[liberator|highlight~=" + hl + "]" + rest
|
||||
};
|
||||
|
||||
highlightCSS.replace(/\{((?:.|\n)*?)\}/g, function (_, _1) _1.replace(/\n\s*/g, " "))
|
||||
this.reload = function ()
|
||||
{
|
||||
this.CSS.replace(/\{((?:.|\n)*?)\}/g, function (_, _1) _1.replace(/\n\s*/g, " "))
|
||||
.split("\n").filter(function (s) /\S/.test(s))
|
||||
.forEach(function (style)
|
||||
{
|
||||
style = Highlight.apply(Highlight, Array.slice(style.match(/^\s*([^,\s]+)(?:,([^,\s]+)?)?(?:,([^,\s]+))?\s*(.*)$/), 1));
|
||||
let old = highlight[style.class];
|
||||
highlight[style.class] = style;
|
||||
self.set(style.class);
|
||||
if (old && old.value != old.default)
|
||||
style.value = old.value;
|
||||
});
|
||||
for (let [class, hl] in Iterator(highlight))
|
||||
{
|
||||
if (hl.value == hl.default)
|
||||
this.set(class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Styles(name, store, serial)
|
||||
@@ -402,6 +413,8 @@ let (array = util.Array)
|
||||
|
||||
const styles = storage.newObject("styles", Styles, false);
|
||||
const highlight = storage.newObject("highlight", Highlights, false);
|
||||
highlight.CSS = Highlights.prototype.CSS;
|
||||
highlight.reload();
|
||||
|
||||
liberator.registerObserver("load_commands", function ()
|
||||
{
|
||||
|
||||
@@ -220,8 +220,8 @@ function Tabs() //{{{
|
||||
validator: options.validateCompleter
|
||||
});
|
||||
// TODO: Add option, or only apply when go~=[nN]
|
||||
styles.addSheet("tab-binding", "chrome://*",
|
||||
".tabbrowser-tab { -moz-binding: url(chrome://liberator/content/vimperator/bindings.xml#tab) !important; }", true);
|
||||
styles.addSheet("tab-binding", "chrome://browser/content/browser.xul",
|
||||
".tabbrowser-tab { -moz-binding: url(chrome://liberator/content/bindings.xml#tab) !important; }", true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1418,9 +1418,11 @@ function ItemList(id) //{{{
|
||||
|
||||
let haveCompletions = false;
|
||||
let off = 0;
|
||||
let end = endIndex;
|
||||
function getRows(context)
|
||||
{
|
||||
function fix(n) Math.max(0, Math.min(len, n));
|
||||
end -= context.message + context.incomplete;
|
||||
let len = context.items.length;
|
||||
let start = off;
|
||||
off += len;
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE bindings [
|
||||
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
|
||||
%globalDTD;
|
||||
]>
|
||||
|
||||
<bindings xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:liberator="http://vimperator.org/namespaces/liberator"
|
||||
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">
|
||||
<binding id="tab" display="xul:hbox"
|
||||
extends="chrome://global/content/bindings/tabbox.xml#tab">
|
||||
<content chromedir="ltr" closetabtext="Close Tab">
|
||||
<xul:stack class="liberator-tab-stack">
|
||||
<xul:image xbl:inherits="validate,src=image" class="tab-icon-image" liberator:highlight="TabIcon"/>
|
||||
<xul:vbox>
|
||||
<xul:spring flex="1"/>
|
||||
<xul:label xbl:inherits="value=ordinal" liberator:highlight="TabIconNumber"/>
|
||||
<xul:spring flex="1"/>
|
||||
</xul:vbox>
|
||||
</xul:stack>
|
||||
<xul:label xbl:inherits="value=ordinal" liberator:highlight="TabNumber"/>
|
||||
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" class="tab-text" liberator:highlight="TabText"/>
|
||||
<xul:toolbarbutton anonid="close-button" tabindex="-1" class="tab-close-button" liberator:highlight="TabClose"/>
|
||||
</content>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
||||
Reference in New Issue
Block a user