Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nyped committed Jan 6, 2021
0 parents commit deaff2f
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <https://unlicense.org>
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# savetabs

# general

save your tabs in your clipboard with one keybind

This extension should be compatible with latest versions of Firefox and Chrome.

# install

- Firefox:
- download the xpi file in the Releases section

- Chrome based browsers:
- clone the repository
- open `chrome://extensions/`
- turn the developper mode on (top right corner)
- load the module with `Load unpacked`

# TODO
- make it available on the extension stores.
23 changes: 23 additions & 0 deletions foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
chrome.commands.onCommand.addListener(async function() {
await chrome.tabs.query({currentWindow: true}, async function(tabs) {
var cb = document.createElement("textarea"), acc = "", i;

for (i = 0; i < tabs.length; i++) {
acc += tabs[i].url.toString() + "\n";
}

/* this line: works fine with firefox,
* but not with chrome.
* await navigator.clipboard.writeText(acc);
* TODO: get rid of execCommand()...
* https://stackoverflow.com/questions/3436102/copy-to-clipboard-in-chrome-extension
*/
document.body.appendChild(cb);
cb.value = acc;
cb.select();
document.execCommand("copy");
document.body.removeChild(cb);
});
});

// vim: set ts=2 sts=2 sw=2 et:
25 changes: 25 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"manifest_version": 2,
"name": "savetabs",
"version": "1",
"description": "save your tabs in your clipboard with one keybind",
"permissions": [
"tabs",
"clipboardWrite"
],
"commands": {
"save": {
"description": "save all",
"suggested_key": {
"default": "Alt+Shift+Z"
}
}
},
"background": {
"scripts": [
"foo.js"
]
}
}

// vim: set ts=2 sts=2 sw=2 et:

0 comments on commit deaff2f

Please sign in to comment.