Browse Source

ctrl+enter now copies the href of whatever element you're targeting

master
mort 6 years ago
parent
commit
ab3c599944
3 changed files with 28 additions and 1 deletions
  1. 18
    0
      data/onload.js
  2. 5
    0
      index.js
  3. 5
    1
      package.json

+ 18
- 0
data/onload.js View File

@@ -235,6 +235,22 @@ var blobList = {
blobList.hideBlobs();
},

clickClipboard: function() {
if (!blobList.visible)
return;

var blob = blobList.blobs[blobList.currentKey];
if (!blob)
return;

if (!blob.linkElem.href)
return;

self.port.emit("clipboard_set", blob.linkElem.href);

blobList.hideBlobs();
},

appendKey: function(c) {
blobList.currentKey += c;
blobList.overview.innerHTML = blobList.currentKey;
@@ -344,6 +360,8 @@ window.addEventListener("keydown", function(evt) {
blobList.click();
} else if (onWebPage && blobList.visible && isMatch(keys.blobs_click_new_tab, evt)) {
blobList.clickNewTab();
} else if (onWebPage && blobList.visible && isMatch(keys.blobs_click_clipboard, evt)) {
blobList.clickClipboard();

//Scrolling
} else if (onWebPage && isMatch(keys.scroll_up, evt)) {

+ 5
- 0
index.js View File

@@ -1,6 +1,7 @@
var tabs = require("sdk/tabs");
var self = require("sdk/self");
var simple_prefs = require("sdk/simple-prefs");
var clipboard = require("sdk/clipboard");

var conf = {};
var keys = {};
@@ -100,4 +101,8 @@ tabs.on("ready", function(tab) {
worker.port.on("move_tab_right", function() {
moveRelativeTab(1);
});

worker.port.on("clipboard_set", function(text) {
clipboard.set(text);
});
});

+ 5
- 1
package.json View File

@@ -1,7 +1,7 @@
{
"title": "Mouseless",
"name": "mouseless",
"version": "0.4.1",
"version": "0.5.0",
"description": "For a mouseless future.",
"main": "index.js",
"author": "Martin Dørum Nygaard",
@@ -47,6 +47,10 @@
"name": "blobs_click_new_tab", "title": "Open in New Tab",
"type": "string",
"value": "<Shift>Enter"
}, {
"name": "blobs_click_clipboard", "title": "Copy Link",
"type": "string",
"value": "<Control>Enter"
}, {
"name": "blobs_backspace", "title": "Blobs Backspace",
"type": "string",

Loading…
Cancel
Save