-
-
Save mxgrn/5402155 to your computer and use it in GitHub Desktop.
Adds a new entry in nvALT, with title set to page title, tags set to "bookmarks", and body containing page title, link, and text selected on page (if present).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Source code */ | |
javascript:(function(){ | |
var w=window,d=document,pageSelectedTxt=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0),pageTitle=d.title,pageUri=w.location.href,tmplt=""; | |
tmplt="Title: "+pageTitle+"\nLink: "+pageUri+"\n"; | |
if (pageSelectedTxt != "") { | |
pageSelectedTxt="\n---\n"+pageSelectedTxt; | |
} | |
w.location.href="nvalt://make/?txt="+encodeURIComponent(tmplt+pageSelectedTxt)+"&title="+encodeURIComponent(pageTitle)+"&tags=bookmarks"; | |
})(); | |
/* Minified - use as bookmarklet */ | |
javascript:(function(){var e=window,t=document,n=e.getSelection?e.getSelection():t.getSelection?t.getSelection():t.selection?t.selection.createRange().text:0,r=t.title,i=e.location.href,s="";s="Title: "+r+"\nLink: "+i+"\n";if(n!=""){n="\n---\n"+n}e.location.href="nvalt://make/?txt="+encodeURIComponent(s+n)+"&title="+encodeURIComponent(r)+"&tags=bookmarks"})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment