aboutsummaryrefslogtreecommitdiffstats
path: root/background_page.html
diff options
context:
space:
mode:
authorAlex Kovar2010-10-30 17:29:21 -0500
committerAlex Kovar2010-10-30 17:29:21 -0500
commit51d08f17f40d5da07d49b424b3ec94d17dc59cf0 (patch)
treee32cdac63546d3c6e9b5131f0949943a9e3030be /background_page.html
parent8feb7df5e4185e2f28262a3524f7fb3d9b1e470d (diff)
parent7df813ef221be04e4d4a459ecc941dcbddfb6056 (diff)
downloadvimium-51d08f17f40d5da07d49b424b3ec94d17dc59cf0.tar.bz2
Merge branch 'master' of http://github.com/philc/vimium
Diffstat (limited to 'background_page.html')
-rw-r--r--background_page.html20
1 files changed, 14 insertions, 6 deletions
diff --git a/background_page.html b/background_page.html
index e0c1f3ce..c3c9f952 100644
--- a/background_page.html
+++ b/background_page.html
@@ -1,6 +1,7 @@
<html>
<head>
<script type="text/javascript" src="commands.js"></script>
+<script type="text/javascript" src="lib/clipboard.js"></script>
<script type="text/javascript" charset="utf-8">
// Chromium #15242 will make this XHR request to access the manifest unnecessary.
var manifestRequest = new XMLHttpRequest();
@@ -58,7 +59,6 @@
var portHandlers = {
keyDown: handleKeyDown,
returnScrollPosition: handleReturnScrollPosition,
- isEnabledForUrl: isEnabledForUrl,
getCurrentTabUrl: getCurrentTabUrl,
getZoomLevel: getZoomLevel,
saveZoomLevel: saveZoomLevel,
@@ -74,7 +74,9 @@
registerFrame: registerFrame,
frameFocused: handleFrameFocused,
upgradeNotificationClosed: upgradeNotificationClosed,
- updateScrollPosition: handleUpdateScrollPosition
+ updateScrollPosition: handleUpdateScrollPosition,
+ copyToClipboard: copyToClipboard,
+ isEnabledForUrl: isEnabledForUrl
};
// Event handlers
@@ -133,18 +135,17 @@
/*
* Checks the user's preferences in local storage to determine if Vimium is enabled for the given URL.
*/
- function isEnabledForUrl(args, port) {
- var returnPort = chrome.tabs.connect(port.tab.id, { name: "returnIsEnabledForUrl" });
+ function isEnabledForUrl(request) {
// excludedUrls are stored as a series of URL expressions separated by newlines.
var excludedUrls = (localStorage["excludedUrls"] || "").split("\n");
var isEnabled = true;
for (var i = 0; i < excludedUrls.length; i++) {
// The user can add "*" to the URL which means ".*"
var regexp = new RegExp("^" + excludedUrls[i].replace(/\*/g, ".*") + "$");
- if (args.url.match(regexp))
+ if (request.url.match(regexp))
isEnabled = false;
}
- returnPort.postMessage({ isEnabledForUrl: isEnabled });
+ return { isEnabledForUrl: isEnabled };
}
/*
@@ -252,6 +253,13 @@
}
/*
+ * Copies some data (request.data) to the clipboard.
+ */
+ function copyToClipboard(request) {
+ Clipboard.copy(request.data);
+ }
+
+ /*
* Used by the content scripts to get settings from the local storage.
*/
function getSetting(args, port) {