Skip to content

Instantly share code, notes, and snippets.

@briantw
Created April 21, 2020 11:04
Show Gist options
  • Save briantw/c8ad09f695d654aeb1131a19ab8360d9 to your computer and use it in GitHub Desktop.
Save briantw/c8ad09f695d654aeb1131a19ab8360d9 to your computer and use it in GitHub Desktop.
Since WordPress removed the original bookmarklet functionality, I needed to make a plan to restore the functionality in my Chrome browser. Create a new bookmark, right-click, Edit..., paste the code in the URL field. Just replace yoursite.com with your Wordpress URL
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 = 'https://yoursite.com/wp-admin/press-this.php',
l = d.location,
e = encodeURIComponent,
g = f + '?u=' + e(l.href) + '&t=' + e(d.title) + '&s=' + e(s) + '&url-scan-submit=Scan';
function a() {
if (!w.open(g, 't', 'toolbar=1,resizable=1,scrollbars=1,status=1,left=480,width=960,height=800')) {
l.href = g;
}
}
setTimeout(a, 0);
void(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment