aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorilya2010-04-25 18:56:39 -0700
committerilya2010-04-25 18:56:39 -0700
commit87e611dccd8a9c6b4ee681fc88f2a461f76e830a (patch)
treed7bb16ed633050747e183065181b0d93682f4f82
parent44189294c8a6097abd22116dc35345e7cab55344 (diff)
parente85cbd38194df9d867cc815afb99d60727d6561b (diff)
downloadvimium-87e611dccd8a9c6b4ee681fc88f2a461f76e830a.tar.bz2
Merge branch 'master' of git://github.com/philc/vimium
-rw-r--r--background_page.html11
-rw-r--r--helpDialog.html4
-rw-r--r--linkHints.js20
3 files changed, 25 insertions, 10 deletions
diff --git a/background_page.html b/background_page.html
index 4c328a20..e2252b4d 100644
--- a/background_page.html
+++ b/background_page.html
@@ -2,9 +2,12 @@
<head>
<script type="text/javascript" src="commands.js"/>
<script type="text/javascript" charset="utf-8">
- // Currently we need to remember to change this each time we push. Chromium #15242 will enable us
- // to retrieve this programmatically.
- var currentVersion = "1.16";
+ // Chromium #15242 will make this XHR request unnecessary.
+ var manifestRequest = new XMLHttpRequest();
+ manifestRequest.open("GET", chrome.extension.getURL("manifest.json"), false);
+ manifestRequest.send(null);
+
+ var currentVersion = JSON.parse(manifestRequest.responseText).version;
var tabQueue = {}; // windowId -> Array
var openTabs = {}; // tabId -> object with various tab properties
@@ -316,7 +319,7 @@
openTabs[tab.id].scrollX = scrollX;
openTabs[tab.id].scrollY = scrollY;
}
-
+
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (changeInfo.status != "loading") { return; } // only do this once per URL change
diff --git a/helpDialog.html b/helpDialog.html
index eb5d72f7..a9af647a 100644
--- a/helpDialog.html
+++ b/helpDialog.html
@@ -4,7 +4,7 @@
-->
<div id="vimiumHelpDialog">
<style>
- #vimiumHelpDialog * { font-size:12px; line-height:130%; color:black; }
+ #vimiumHelpDialog * { font-size:12px; line-height:130%; color:black; background-color:transparent; }
#vimiumHelpDialog {
text-align:left;
border:3px solid red;
@@ -30,7 +30,7 @@
float:left;
}
.vimiumColumn table, .vimiumColumn td, .vimiumColumn tr { padding:0; margin:0; }
- .vimiumColumn table { width:100%; }
+ .vimiumColumn table { width:100%; table-layout:auto; }
.vimiumColumn td { vertical-align:top; padding:1px; }
#vimiumHelpDialog .vimiumColumn tr > td:first-of-type {
text-align:right;
diff --git a/linkHints.js b/linkHints.js
index 6c4fb3d0..de140581 100644
--- a/linkHints.js
+++ b/linkHints.js
@@ -16,9 +16,18 @@ var shouldOpenLinkHintInNewTab = false;
// Whether we have added to the page the CSS needed to display link hints.
var linkHintsCssAdded = false;
-// An XPath describing what a clickable element is. We could also look for images with an onclick
-// attribute, but let's wait to see if that really is necessary.
-var clickableElementsXPath = "//a | //textarea | //button | //select | //input[not(@type='hidden')] | //*[@onclick]";
+/*
+ * Generate an XPath describing what a clickable element is.
+ * The final expression will be something like "//button | //xhtml:button | ..."
+ */
+var clickableElementsXPath = (function() {
+ var clickableElements = ["a", "textarea", "button", "select", "input[not(@type='hidden')]"];
+ var xpath = [];
+ for (var i in clickableElements)
+ xpath.push("//" + clickableElements[i], "//xhtml:" + clickableElements[i]);
+ xpath.push("//*[@onclick]");
+ return xpath.join(" | ")
+})();
// We need this as a top-level function because our command system doesn't yet support arguments.
function activateLinkHintsModeToOpenInNewTab() { activateLinkHintsMode(true); }
@@ -66,7 +75,10 @@ function logXOfBase(x, base) { return Math.log(x) / Math.log(base); }
* of digits needed to enumerate all of the links on screen.
*/
function getVisibleClickableElements() {
- var resultSet = document.evaluate(clickableElementsXPath, document.body, null,
+ var resultSet = document.evaluate(clickableElementsXPath, document.body,
+ function (namespace) {
+ return namespace == "xhtml" ? "http://www.w3.org/1999/xhtml" : null;
+ },
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
var visibleElements = [];