1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 22:58:01 +01:00

hint work on xhtml pages now (slight problem with not disapperaring them still open)

This commit is contained in:
Martin Stubenschrott
2007-05-08 21:21:05 +00:00
parent 4a963c2441
commit fd39e7fb7a
4 changed files with 48 additions and 17 deletions

View File

@@ -1,6 +1,9 @@
<pre>
2007-05-02:
* version ???
* hints work on xhtml pages now (you need to reset the 'hinttags' and
'extendedhinttags' settings with :set hinttags& and :set extendedhinttags&
* :set option& resets the option to the default value
* added :tabonly and :tabrewind and :tablast commands and some futher aliases :tabNext, etc. (by Doug Kearns)
* added vimparator.vim for .vimperatorrc syntax highlighting in the XPI (by Doug Kearns)
* Added keyword support for bookmarks to the :[tab]open commands

View File

@@ -338,6 +338,7 @@ var g_commands = [/*{{{*/
"<code>:set</code> without an argument opens <code>about:config</code> in a new tab to change advanced Firefox options.<br/>"+
"<code>:set!</code> opens the GUI preference panel from Firefox in a new tab.<br/>"+
"<code>:set option?</code> or <code>:set option</code> shows the current value of the option.<br/>"+
"<code>:set option&</code> resets 'option' to the default value.<br/>"+
"<code>:set option+=foo</code> and <code>:set option-=foo</code> WILL add/remove foo from list options.<br/>",
set,
function(filter) { return get_settings_completions(filter); }
@@ -1488,11 +1489,12 @@ function getCurrentLocation()
/* returns the current title or null */
function getCurrentTitle()
{
var titles = window.content.document.getElementsByTagName('title');
if (titles.length >= 1)
return titles[0];
else
return null;
return window.content.document.title;
// var titles = window.content.document.getElementsByTagName('title');
// if (titles.length >= 1)
// return titles[0];
// else
// return null;
}
@@ -1969,7 +1971,7 @@ function set(args, special)
}
else
{
var matches = args.match(/^\s*(no)?([a-z]+)(\?)?(([+-])?=(.*))?/);
var matches = args.match(/^\s*(no)?([a-z]+)(\?|&)?(([+-])?=(.*))?/);
if (!matches)
{
echoerr("E518: Unknown option: " + args);
@@ -1985,13 +1987,20 @@ function set(args, special)
return;
}
var get = false; if (matches[3] != undefined ||
var get = false; if (matches[3] == "?" ||
(setting[TYPE] != 'boolean' && matches[4] == undefined)) get = true;
var reset = false; if (matches[3] == "&") reset = true;
var oper = matches[5];
var val = matches[6]; if (val == undefined) val = "";
// reset a variable to its default value.
if (reset)
{
var def = setting[DEFAULT];
setting[SETFUNC].call(this, def);
}
// read access
if (get)
else if (get)
{
var cur_val = setting[GETFUNC].call(this);
echo(" " + setting[COMMANDS][0] + "=" + cur_val);
@@ -2078,8 +2087,26 @@ function source(filename, silent)
}
}
// returns an XPathResult object
function evaluateXPath(expression, doc, ordered)
{
if(!doc)
doc = window.content.document;
var res = doc.evaluate(expression, doc,
function lookupNamespaceURI(prefix) {
switch (prefix) {
case 'xhtml':
return 'http://www.w3.org/1999/xhtml';
default:
return null;
}
},
ordered ? XPathResult.ORDERED_NODE_SNAPSHOT_TYPE : XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null
);
return res;
}
@@ -2183,8 +2210,7 @@ function selectInput()
// if (! (ev.charCode == 47 /* ord('/') */ && ev.ctrlKey))
// return;
var texts = document.evaluate("//input[@type='text']", document,
null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
var texts = evaluateXPath("//input[@type='text']");
texts.snapshotItem(0).focus();
}

View File

@@ -78,7 +78,7 @@ function hit_a_hint()
wins.push(win);
}
// logMessage("winId:"+win.winId);
win.res = doc.evaluate(get_pref("hinttags"), doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
win.res = evaluateXPath(get_pref("hinttags"), doc);
win.coordLoaderId = window.setTimeout("hah.loadCoord(" + win.winId + ", 0);", 1);
}
@@ -135,7 +135,7 @@ function hit_a_hint()
area[3] = area[1] + win.innerHeight;
var doc = win.document;
var res = doc.evaluate(get_pref("hinttags"), doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
var res = evaluateXPath(get_pref("hinttags"), doc);
var elem, i;
@@ -253,7 +253,7 @@ function hit_a_hint()
win = window.content;
var doc = win.document;
var res = doc.evaluate("//HINTS/SPAN", doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
var res = evaluateXPath("//HINTS/SPAN", doc)
var elem, i;
for (i = 0; i < res.snapshotLength; i++)
@@ -272,7 +272,7 @@ function hit_a_hint()
if(event)
doc = event.originalTarget;
else
doc = window._content.document;
doc = window.content.document;
invalidateCoords(doc);
startCoordLoader(doc);

View File

@@ -98,7 +98,8 @@ var g_settings = [/*{{{*/
null,
function(value) { set_pref("extendedhinttags", value); },
function() { return get_pref("extendedhinttags"); },
"//*[@onclick or @onmouseover or @onmousedown or @onmouseup or @oncommand or @class='lk' or @class='s'] | //input[@type!='hidden' or not(boolean(@type))] | //a | //area | //iframe | //textarea | //button | //select",
"//*[@onclick or @onmouseover or @onmousedown or @onmouseup or @oncommand or @class='lk' or @class='s'] | //input[@type!='hidden' or not(boolean(@type))] | //a | //area | //iframe | //textarea | //button | //select | "+
"//xhtml:*[@onclick or @onmouseover or @onmousedown or @onmouseup or @oncommand or @class='lk' or @class='s'] | //xhtml:input[@type!='hidden' or not(boolean(@type))] | //xhtml:a | //xhtml:area | //xhtml:iframe | //xhtml:textarea | //xhtml:button | //xhtml:select",
null
],
[
@@ -170,7 +171,8 @@ var g_settings = [/*{{{*/
null,
function(value) { set_pref("hinttags", value); },
function() { return get_pref("hinttags"); },
"//*[@onclick or @onmouseover or @onmousedown or @onmouseup or @oncommand or @class='lk' or @class='s'] | //input[@type!='hidden'] | //a | //area | //iframe | //textarea | //button | //select",
"//*[@onclick or @onmouseover or @onmousedown or @onmouseup or @oncommand or @class='lk' or @class='s'] | //input[@type!='hidden'] | //a | //area | //iframe | //textarea | //button | //select | "+
"//xhtml:*[@onclick or @onmouseover or @onmousedown or @onmouseup or @oncommand or @class='lk' or @class='s'] | //xhtml:input[@type!='hidden'] | //xhtml:a | //xhtml:area | //xhtml:iframe | //xhtml:textarea | //xhtml:button | //xhtml:select",
null
],
[