Created
September 26, 2017 23:34
-
-
Save blairanderson/369ccbf49fa8b718ff84300ac6484704 to your computer and use it in GitHub Desktop.
basic javascript bookmarklet
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
javascript: var d = document, | |
w = window, | |
e = w.getSelection, | |
k = d.getSelection, | |
x = d.selection, | |
s = e ? e() : k ? k() : x ? x.createRange().text : 0, | |
f = 'http://awesomewebsite.com/bookmarklet/iframe', | |
l = d.location, | |
e = encodeURIComponent, | |
u = f + '?u=' + e(l.href) + '&t=' + e(d.title) + '&s=' + e(s) + '&v=4'; | |
a = function() { | |
if ( | |
!w.open( | |
u, | |
't', | |
'toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=570' | |
) | |
) | |
l.href = u; | |
}; | |
if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); | |
else a(); | |
void 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment