Skip to content

Commit

Permalink
0.2.5 fixed #17 #18
Browse files Browse the repository at this point in the history
  • Loading branch information
brookhong committed Dec 22, 2015
1 parent d39719f commit 3e55a24
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
34 changes: 19 additions & 15 deletions content_scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -1521,7 +1523,6 @@ Normal.init = function() {
document.lastElementChild.appendChild(Normal.ui_container[0]);
Normal.clipboard_holder = $('<textarea/>').attr('surfingkeys', 1).css('position', 'fixed').css('z-index', '-999')
.css('top', '0').css('left', '0').css('opacity', '0');
Normal.clipboard_holder.appendTo(Normal.ui_container);
Normal.keystroke = $('<div id=surfingkeys_keystroke/>');
Normal.keystroke.appendTo(Normal.ui_container);
Normal.popover = $('<div id=surfingkeys_popover/>');
Expand Down Expand Up @@ -1668,22 +1669,25 @@ Normal.chooseTab = function() {
};
Normal.getContentFromClipboard = function() {
var result = '';
Normal.clipboard_holder.appendTo(Normal.ui_container);
var clipboard_holder = Normal.clipboard_holder[0];
clipboard_holder.value = '';
clipboard_holder.select();
if (document.execCommand('paste')) {
result = clipboard_holder.value;
}
clipboard_holder.value = '';
Normal.clipboard_holder.remove();
return result;
};
Normal.writeClipboard = function(text) {
Normal.clipboard_holder.appendTo(Normal.ui_container);
var clipboard_holder = Normal.clipboard_holder[0];
clipboard_holder.value = text;
clipboard_holder.select();
document.execCommand('copy');
clipboard_holder.value = '';
clipboard_holder.blur();
Normal.clipboard_holder.remove();
};
Normal.showKeystroke = function(msg) {
if (Normal.keystroke) {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Surfingkeys",
"short_name": "Map your keys for web surfing",
"version": "0.2.3",
"version": "0.2.5",
"description": "Expand your browser with javascript and keyboard.",
"icons": {
"128": "icons/128.png",
Expand Down
2 changes: 1 addition & 1 deletion pages/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var disableAll = document.getElementById('disableAll'),

function onSurfingkeysStatus(status) {
surfingkeysStatus = status;
disableThis.textContent = status.this ? 'Enable Surfingkeys on this domain' : 'Disable Surfingkeys on this domain';
disableThis.textContent = status.this ? 'Enable Surfingkeys on ' + status.origin : 'Disable Surfingkeys on ' + status.origin;
disableAll.textContent = status.all ? 'Enable Surfingkeys' : 'Disable Surfingkeys';
}

Expand Down

0 comments on commit 3e55a24

Please sign in to comment.