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"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
<!DOCTYPE bindings [
|
|
||||||
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
|
|
||||||
%globalDTD;
|
|
||||||
]>
|
|
||||||
|
|
||||||
<bindings xmlns="http://www.mozilla.org/xbl"
|
<bindings xmlns="http://www.mozilla.org/xbl"
|
||||||
xmlns:liberator="http://vimperator.org/namespaces/liberator"
|
xmlns:liberator="http://vimperator.org/namespaces/liberator"
|
||||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
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; :( -->
|
<!-- No white space. The table is white-space: pre; :( -->
|
||||||
<content><html:span class="td-strut"/><html:span class="td-span"><children/></html:span></content>
|
<content><html:span class="td-strut"/><html:span class="td-span"><children/></html:span></content>
|
||||||
</binding>
|
</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>
|
</bindings>
|
||||||
|
|
||||||
<!-- vim:se ft=xbl sw=4 sts=4 tw=0 et: -->
|
<!-- vim:se ft=xbl sw=4 sts=4 tw=0 et: -->
|
||||||
|
|||||||
@@ -1405,6 +1405,8 @@ function Completion() //{{{
|
|||||||
{
|
{
|
||||||
let opt = options.get(name);
|
let opt = options.get(name);
|
||||||
let completer = opt.completer;
|
let completer = opt.completer;
|
||||||
|
if (!completer)
|
||||||
|
return;
|
||||||
|
|
||||||
let curValues = curValue != null ? opt.parseValues(curValue) : opt.values;
|
let curValues = curValue != null ? opt.parseValues(curValue) : opt.values;
|
||||||
let newValues = opt.parseValues(context.filter);
|
let newValues = opt.parseValues(context.filter);
|
||||||
|
|||||||
233
content/style.js
233
content/style.js
@@ -6,111 +6,111 @@
|
|||||||
it under any or all of those licenseses.
|
it under any or all of those licenseses.
|
||||||
}}} ***** END LICENSE BLOCK *****/
|
}}} ***** END LICENSE BLOCK *****/
|
||||||
|
|
||||||
|
Highlights.prototype.CSS = <![CDATA[
|
||||||
|
Boolean color: red;
|
||||||
|
Function color: navy;
|
||||||
|
Null color: blue;
|
||||||
|
Number color: blue;
|
||||||
|
Object color: maroon;
|
||||||
|
String color: green;
|
||||||
|
|
||||||
|
Normal color: black; background: white;
|
||||||
|
ErrorMsg color: white; background: red; font-weight: bold;
|
||||||
|
InfoMsg color: black; background: white;
|
||||||
|
ModeMsg color: black; background: white;
|
||||||
|
MoreMsg color: green; background: white;
|
||||||
|
WarningMsg color: red; background: white;
|
||||||
|
Message white-space: normal; min-width: 100%; padding-left: 2em; text-indent: -2em; display: block;
|
||||||
|
NonText color: blue; min-height: 16px; padding-left: 2px;
|
||||||
|
Preview color: gray;
|
||||||
|
|
||||||
|
CompGroup
|
||||||
|
CompGroup:not(:first-of-type) margin-top: .5em;
|
||||||
|
CompTitle color: magenta; background: white; font-weight: bold;
|
||||||
|
CompTitle>* /* border-bottom: 1px dashed magenta; */
|
||||||
|
CompMsg font-style: italic; margin-left: 16px;
|
||||||
|
CompItem
|
||||||
|
CompItem[selected] background: yellow;
|
||||||
|
CompItem>* padding: 0 .5ex;
|
||||||
|
CompIcon width: 16px; min-width: 16px; display: inline-block; margin-right: .5ex;
|
||||||
|
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: 0; line-height: .5ex; padding-top: 1ex;
|
||||||
|
CompLess::after content: "\2303" /* Unicode up arrowhead */
|
||||||
|
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;
|
||||||
|
GradientLeft background-color: magenta;
|
||||||
|
GradientRight background-color: white;
|
||||||
|
|
||||||
|
Indicator color: blue;
|
||||||
|
Filter font-weight: bold;
|
||||||
|
|
||||||
|
Keyword color: red;
|
||||||
|
Tag color: blue;
|
||||||
|
|
||||||
|
LineNr color: orange; background: white;
|
||||||
|
Question color: green; background: white; font-weight: bold;
|
||||||
|
|
||||||
|
StatusLine color: white; background: black;
|
||||||
|
StatusLineBroken color: black; background: #FF6060; /* light-red */
|
||||||
|
StatusLineSecure color: black; background: #B0FF00; /* light-green */
|
||||||
|
|
||||||
|
TabClose
|
||||||
|
TabIcon
|
||||||
|
TabText
|
||||||
|
TabNumber font-weight: bold; margin: 0px; padding-right: .3ex;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
Title color: magenta; background: white; font-weight: bold;
|
||||||
|
URL text-decoration: none; color: green; background: inherit;
|
||||||
|
URL:hover text-decoration: underline; cursor: pointer;
|
||||||
|
|
||||||
|
FrameIndicator,,* {
|
||||||
|
background-color: red;
|
||||||
|
opacity: 0.5;
|
||||||
|
z-index: 999;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bell border: none; background-color: black;
|
||||||
|
Hint,,* {
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: white;
|
||||||
|
background-color: red;
|
||||||
|
border-color: ButtonShadow;
|
||||||
|
border-width: 0px;
|
||||||
|
border-style: solid;
|
||||||
|
padding: 0px 1px 0px 1px;
|
||||||
|
}
|
||||||
|
Hint::after,,* content: attr(number);
|
||||||
|
HintElem,,* background-color: yellow; color: black;
|
||||||
|
HintActive,,* background-color: #88FF00; color: black;
|
||||||
|
HintImage,,* opacity: .5;
|
||||||
|
|
||||||
|
Search,,* {
|
||||||
|
font-size: inherit;
|
||||||
|
padding: 0;
|
||||||
|
color: black;
|
||||||
|
background-color: yellow;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
]]>.toString();
|
||||||
function Highlights(name, store, serial)
|
function Highlights(name, store, serial)
|
||||||
{
|
{
|
||||||
const highlightCSS = <![CDATA[
|
|
||||||
Boolean color: red;
|
|
||||||
Function color: navy;
|
|
||||||
Null color: blue;
|
|
||||||
Number color: blue;
|
|
||||||
Object color: maroon;
|
|
||||||
String color: green;
|
|
||||||
|
|
||||||
Normal color: black; background: white;
|
|
||||||
ErrorMsg color: white; background: red; font-weight: bold;
|
|
||||||
InfoMsg color: black; background: white;
|
|
||||||
ModeMsg color: black; background: white;
|
|
||||||
MoreMsg color: green; background: white;
|
|
||||||
WarningMsg color: red; background: white;
|
|
||||||
Message white-space: normal; min-width: 100%; padding-left: 2em; text-indent: -2em; display: block;
|
|
||||||
NonText color: blue; min-height: 16px; padding-left: 2px;
|
|
||||||
Preview color: gray;
|
|
||||||
|
|
||||||
CompGroup
|
|
||||||
CompGroup:not(:first-of-type) margin-top: .5em;
|
|
||||||
CompTitle color: magenta; background: white; font-weight: bold;
|
|
||||||
CompTitle>* /* border-bottom: 1px dashed magenta; */
|
|
||||||
CompMsg font-style: italic; margin-left: 16px;
|
|
||||||
CompItem
|
|
||||||
CompItem[selected] background: yellow;
|
|
||||||
CompItem>* padding: 0 .5ex;
|
|
||||||
CompIcon width: 16px; min-width: 16px; display: inline-block; margin-right: .5ex;
|
|
||||||
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::after content: "\2303" /* Unicode up arrowhead */
|
|
||||||
CompMore text-align: center; height: .5ex; line-height: .5ex;
|
|
||||||
CompMore::after content: "\2304" /* Unicode down arrowhead */
|
|
||||||
|
|
||||||
Gradient height: 1px; margin-bottom: -1px; margin-top: -1px;
|
|
||||||
GradientLeft background-color: magenta;
|
|
||||||
GradientRight background-color: white;
|
|
||||||
|
|
||||||
Indicator color: blue;
|
|
||||||
Filter font-weight: bold;
|
|
||||||
|
|
||||||
Keyword color: red;
|
|
||||||
Tag color: blue;
|
|
||||||
|
|
||||||
LineNr color: orange; background: white;
|
|
||||||
Question color: green; background: white; font-weight: bold;
|
|
||||||
|
|
||||||
StatusLine color: white; background: black;
|
|
||||||
StatusLineBroken color: black; background: #FF6060; /* light-red */
|
|
||||||
StatusLineSecure color: black; background: #B0FF00; /* light-green */
|
|
||||||
|
|
||||||
TabClose
|
|
||||||
TabIcon
|
|
||||||
TabText
|
|
||||||
TabNumber font-weight: bold; margin: 0px; padding-right: .3ex;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
Title color: magenta; background: white; font-weight: bold;
|
|
||||||
URL text-decoration: none; color: green; background: inherit;
|
|
||||||
URL:hover text-decoration: underline; cursor: pointer;
|
|
||||||
|
|
||||||
FrameIndicator,,* {
|
|
||||||
background-color: red;
|
|
||||||
opacity: 0.5;
|
|
||||||
z-index: 999;
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bell border: none; background-color: black;
|
|
||||||
Hint,,* {
|
|
||||||
font-family: monospace;
|
|
||||||
font-size: 10px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: white;
|
|
||||||
background-color: red;
|
|
||||||
border-color: ButtonShadow;
|
|
||||||
border-width: 0px;
|
|
||||||
border-style: solid;
|
|
||||||
padding: 0px 1px 0px 1px;
|
|
||||||
}
|
|
||||||
Hint::after,,* content: attr(number);
|
|
||||||
HintElem,,* background-color: yellow; color: black;
|
|
||||||
HintActive,,* background-color: #88FF00; color: black;
|
|
||||||
HintImage,,* opacity: .5;
|
|
||||||
|
|
||||||
Search,,* {
|
|
||||||
font-size: inherit;
|
|
||||||
padding: 0;
|
|
||||||
color: black;
|
|
||||||
background-color: yellow;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
]]>.toString();
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var highlight = {};
|
var highlight = {};
|
||||||
var styles = storage.styles;
|
var styles = storage.styles;
|
||||||
@@ -144,6 +144,7 @@ function Highlights(name, store, serial)
|
|||||||
if (style.default == null)
|
if (style.default == null)
|
||||||
{
|
{
|
||||||
delete highlight[style.class];
|
delete highlight[style.class];
|
||||||
|
styles.removeSheet(style.selector, null, null, null, true);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
newStyle = style.default;
|
newStyle = style.default;
|
||||||
@@ -167,14 +168,24 @@ function Highlights(name, store, serial)
|
|||||||
return "[liberator|highlight~=" + hl + "]" + rest
|
return "[liberator|highlight~=" + hl + "]" + rest
|
||||||
};
|
};
|
||||||
|
|
||||||
highlightCSS.replace(/\{((?:.|\n)*?)\}/g, function (_, _1) _1.replace(/\n\s*/g, " "))
|
this.reload = function ()
|
||||||
.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));
|
this.CSS.replace(/\{((?:.|\n)*?)\}/g, function (_, _1) _1.replace(/\n\s*/g, " "))
|
||||||
highlight[style.class] = style;
|
.split("\n").filter(function (s) /\S/.test(s))
|
||||||
self.set(style.class);
|
.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;
|
||||||
|
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)
|
function Styles(name, store, serial)
|
||||||
@@ -402,6 +413,8 @@ let (array = util.Array)
|
|||||||
|
|
||||||
const styles = storage.newObject("styles", Styles, false);
|
const styles = storage.newObject("styles", Styles, false);
|
||||||
const highlight = storage.newObject("highlight", Highlights, false);
|
const highlight = storage.newObject("highlight", Highlights, false);
|
||||||
|
highlight.CSS = Highlights.prototype.CSS;
|
||||||
|
highlight.reload();
|
||||||
|
|
||||||
liberator.registerObserver("load_commands", function ()
|
liberator.registerObserver("load_commands", function ()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -220,8 +220,8 @@ function Tabs() //{{{
|
|||||||
validator: options.validateCompleter
|
validator: options.validateCompleter
|
||||||
});
|
});
|
||||||
// TODO: Add option, or only apply when go~=[nN]
|
// TODO: Add option, or only apply when go~=[nN]
|
||||||
styles.addSheet("tab-binding", "chrome://*",
|
styles.addSheet("tab-binding", "chrome://browser/content/browser.xul",
|
||||||
".tabbrowser-tab { -moz-binding: url(chrome://liberator/content/vimperator/bindings.xml#tab) !important; }", true);
|
".tabbrowser-tab { -moz-binding: url(chrome://liberator/content/bindings.xml#tab) !important; }", true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1418,9 +1418,11 @@ function ItemList(id) //{{{
|
|||||||
|
|
||||||
let haveCompletions = false;
|
let haveCompletions = false;
|
||||||
let off = 0;
|
let off = 0;
|
||||||
|
let end = endIndex;
|
||||||
function getRows(context)
|
function getRows(context)
|
||||||
{
|
{
|
||||||
function fix(n) Math.max(0, Math.min(len, n));
|
function fix(n) Math.max(0, Math.min(len, n));
|
||||||
|
end -= context.message + context.incomplete;
|
||||||
let len = context.items.length;
|
let len = context.items.length;
|
||||||
let start = off;
|
let start = off;
|
||||||
off += len;
|
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