Tips:
- http://streetpc.instanceof.me/text-utilities/ to unescape a bookmarklet
- http://jsbeautifier.org/ to prettify and make readable
- http://ted.mielczarek.org/code/mozilla/bookmarklet.html to crunch back into a bookmarklet
javascript: (function () { | |
var d = document, | |
w = window, | |
enc = encodeURIComponent, | |
e = w.getSelection, | |
k = d.getSelection, | |
x = d.selection, | |
s = (e ? e() : (k) ? k() : (x ? x.createRange().text : 0)), | |
s2 = ((s.toString() == '') ? s : enc(s)), | |
f = '<?php echo YOURLS_SITE . ' / result.php '; ?>', | |
l = d.location, | |
k = prompt("Custom URL"), | |
k2 = (k ? '&keyword=' + k : ""), | |
p = '?url=' + enc(l.href) + '&title=' + enc(d.title) + '&text=' + s2 + k2, | |
u = f + p; | |
if (k != null) { | |
try { | |
throw ('ozhismygod'); | |
} catch (z) { | |
a = function () { | |
if (!w.open(u)) l.href = u; | |
}; | |
if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); | |
else a(); | |
} | |
void(0) | |
} | |
})(); |
javascript: (function () { | |
var d = document, | |
k = prompt('Custom URL'), | |
s = d.createElement('script'); | |
if (k != null) { | |
window.yourls_callback = function (r) { | |
if (r.short_url) { | |
prompt(r.message, r.short_url); | |
} else { | |
alert('An error occured: ' + r.message); | |
} | |
}; | |
s.src = '<?php echo YOURLS_SITE . ' / result.php '; ?>?url=' + encodeURIComponent(d.location.href) + '&keyword=' + k + '&jsonp=yourls'; | |
void(d.body.appendChild(s)); | |
} | |
})(); |
javascript: (function () { | |
var d = document, | |
s = d.createElement('script'); | |
window.yourls_callback = function (r) { | |
if (r.short_url) { | |
prompt(r.message, r.short_url); | |
} else { | |
alert('An error occured: ' + r.message); | |
} | |
}; | |
s.src = '<?php echo YOURLS_SITE . ' / result.php '; ?>?url=' + encodeURIComponent(d.location.href) + '&jsonp=yourls'; | |
void(d.body.appendChild(s)); | |
})(); |
javascript: (function () { | |
var d = document, | |
w = window, | |
enc = encodeURIComponent, | |
e = w.getSelection, | |
k = d.getSelection, | |
x = d.selection, | |
s = (e ? e() : (k) ? k() : (x ? x.createRange().text : 0)), | |
s2 = ((s.toString() == '') ? s : enc(s)), | |
f = '<?php echo YOURLS_SITE . ' / result.php '; ?>', | |
l = d.location, | |
p = '?url=' + enc(l.href) + '&title=' + enc(d.title) + '&text=' + s2, | |
u = f + p; | |
try { | |
throw ('ozhismygod'); | |
} catch (z) { | |
a = function () { | |
if (!w.open(u)) l.href = u; | |
}; | |
if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); | |
else a(); | |
} | |
void(0); | |
})(); |
Tips: