Skip to content

Instantly share code, notes, and snippets.

@hyuki
Last active February 25, 2022 12:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyuki/7d67be5278eba0f317d9dccbaaba1a43 to your computer and use it in GitHub Desktop.
Save hyuki/7d67be5278eba0f317d9dccbaaba1a43 to your computer and use it in GitHub Desktop.
WebToScrapbox.js - ブラウザで見ているページのタイトルとURLをScrapboxに保存するBookmarklet
/*
* WebToScrapbox.js
* ブラウザで見ているページのタイトルとURLをScrapboxに保存するBookmarklet
*/
function start() {
const project = 'https://scrapbox.io/YOURPROJECT/';
const url = location.href;
const title = document.title;
const body1 = "\n " + title;
const body2 = "\n [" + title + ' ' + url + ']';
const body3 = "\n\n[" + url + "]";
const body = body1 + body2 + body3;
window.open(project + encodeURIComponent(title) + '?body=' + encodeURIComponent(body));
}
start();
@hyuki
Copy link
Author

hyuki commented Dec 24, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment