From 3e55a2487c80de417a61158bd8a5833fde154503 Mon Sep 17 00:00:00 2001 From: brook hong Date: Tue, 22 Dec 2015 22:01:28 +0800 Subject: [PATCH] 0.2.5 fixed #17 #18 --- content_scripts.js | 34 +++++++++++++++++++--------------- manifest.json | 2 +- pages/popup.js | 2 +- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/content_scripts.js b/content_scripts.js index fecc5241b..6c6e92850 100644 --- a/content_scripts.js +++ b/content_scripts.js @@ -344,15 +344,16 @@ function initPort() { } var port = initPort(); -var runtime_handlers = { - getBlacklist: function(msg, sender, response) { +var runtime_handlers = {}; +if (window === top) { + runtime_handlers['getBlacklist'] = function(msg, sender, response) { response({ "all": settings.blacklist.hasOwnProperty('.*'), "this": settings.blacklist.hasOwnProperty(window.location.origin), "origin": window.location.origin }); - }, - toggleBlacklist: function(msg, sender, response) { + }; + runtime_handlers['toggleBlacklist'] = function(msg, sender, response) { if (settings.blacklist.hasOwnProperty(msg.origin)) { delete settings.blacklist[msg.origin]; } else { @@ -368,14 +369,14 @@ var runtime_handlers = { "this": settings.blacklist.hasOwnProperty(window.location.origin), "origin": window.location.origin }); - }, - focusFrame: function(msg, sender, response) { - if (msg.frameId === window.frameId) { - top.surfingkeys_active_window = window; - top.surfingkeys_active_window.focus(); - Normal.highlightDocument(); - } - }, + }; +} +runtime_handlers['focusFrame'] = function(msg, sender, response) { + if (msg.frameId === window.frameId) { + top.surfingkeys_active_window = window; + top.surfingkeys_active_window.focus(); + Normal.highlightDocument(); + } }; function prepareFrames() { var frames = Array.prototype.slice.call(top.document.querySelectorAll('iframe')).map(function(f) { @@ -450,7 +451,8 @@ Hints.genLabels = function(M) { Hints.create = function(cssSelector, onHintKey, attrs) { attrs = $.extend({ active: true, - tabbed: false + tabbed: false, + multipleHits: false }, attrs || {}); for (var attr in attrs) { Hints[attr] = attrs[attr]; @@ -1521,7 +1523,6 @@ Normal.init = function() { document.lastElementChild.appendChild(Normal.ui_container[0]); Normal.clipboard_holder = $('