Skip to content

Instantly share code, notes, and snippets.

@jpluimers
Last active September 10, 2017 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpluimers/1afbafbee87f7e7230c23c78d6a7aa23 to your computer and use it in GitHub Desktop.
Save jpluimers/1afbafbee87f7e7230c23c78d6a7aa23 to your computer and use it in GitHub Desktop.
WordPress "Press This" bookmarklet for wiert.wordpress.com; old one works with GitHub and keeps # fragments, new one doesn't. Decoded via https://www.urldecoder.org/ ; beautified via http://jsbeautifier.org/

New Press This generated URIs:

Old Press This generated URIs

javascript:(function(a,b,c,d)%7Bfunction e(a,c)%7Bif("undefined"!%3Dtypeof c)%7Bvar d%3Db.createElement("input")%3Bd.name%3Da,d.value%3Dc,d.type%3D"hidden",p.appendChild(d)%7D%7Dvar f,g,h,i,j,k,l,m,n,o%3Da.encodeURIComponent,p%3Db.createElement("form"),q%3Db.getElementsByTagName("head")%5B0%5D,r%3D"_press_this_app",s%3D!0%3Bif(d)%7Bif(!c.match(/%5Ehttps%3F:/))return void(top.location.href%3Dd)%3Bif(d%2B%3D"%26u%3D"%2Bo(c),c.match(/%5Ehttps:/)%26%26d.match(/%5Ehttp:/)%26%26(s%3D!1),a.getSelection%3Fh%3Da.getSelection()%2B"":b.getSelection%3Fh%3Db.getSelection()%2B"":b.selection%26%26(h%3Db.selection.createRange().text%7C%7C""),d%2B%3D"%26buster%3D"%2B(new Date).getTime(),s%7C%7C(b.title%26%26(d%2B%3D"%26t%3D"%2Bo(b.title.substr(0,256))),h%26%26(d%2B%3D"%26s%3D"%2Bo(h.substr(0,512)))),f%3Da.outerWidth%7C%7Cb.documentElement.clientWidth%7C%7C600,g%3Da.outerHeight%7C%7Cb.documentElement.clientHeight%7C%7C700,f%3Df<800%7C%7Cf>5e3%3F600:.7*f,g%3Dg<800%7C%7Cg>3e3%3F700:.9*g,!s)return void a.open(d,r,"location,resizable,scrollbars,width%3D"%2Bf%2B",height%3D"%2Bg)%3Bi%3Dq.getElementsByTagName("meta")%7C%7C%5B%5D%3Bfor(var t%3D0%3Bt<i.length%26%26!(t>200)%3Bt%2B%2B)%7Bvar u%3Di%5Bt%5D,v%3Du.getAttribute("name"),w%3Du.getAttribute("property"),x%3Du.getAttribute("content")%3Bx%26%26(v%3Fe("_meta%5B"%2Bv%2B"%5D",x):w%26%26e("_meta%5B"%2Bw%2B"%5D",x))%7Dj%3Dq.getElementsByTagName("link")%7C%7C%5B%5D%3Bfor(var y%3D0%3By<j.length%26%26!(y>%3D50)%3By%2B%2B)%7Bvar z%3Dj%5By%5D,A%3Dz.getAttribute("rel")%3B"canonical"!%3D%3DA%26%26"icon"!%3D%3DA%26%26"shortlink"!%3D%3DA%7C%7Ce("_links%5B"%2BA%2B"%5D",z.getAttribute("href"))%7Db.body.getElementsByClassName%26%26(k%3Db.body.getElementsByClassName("hfeed")%5B0%5D),k%3Db.getElementById("content")%7C%7Ck%7C%7Cb.body,l%3Dk.getElementsByTagName("img")%7C%7C%5B%5D%3Bfor(var B%3D0%3BB<l.length%26%26!(B>%3D100)%3BB%2B%2B)n%3Dl%5BB%5D,n.src.indexOf("avatar")>-1%7C%7Cn.className.indexOf("avatar")>-1%7C%7Cn.width%26%26n.width<256%7C%7Cn.height%26%26n.height<128%7C%7Ce("_images%5B%5D",n.src)%3Bm%3Db.body.getElementsByTagName("iframe")%7C%7C%5B%5D%3Bfor(var C%3D0%3BC<m.length%26%26!(C>%3D50)%3BC%2B%2B)e("_embeds%5B%5D",m%5BC%5D.src)%3Bb.title%26%26e("t",b.title),h%26%26e("s",h),p.setAttribute("method","POST"),p.setAttribute("action",d),p.setAttribute("target",r),p.setAttribute("style","display: none%3B"),a.open("about:blank",r,"location,resizable,scrollbars,width%3D"%2Bf%2B",height%3D"%2Bg),b.body.appendChild(p),p.submit()%7D%7D)(window,document,top.location.href,"https:%5C/%5C/wiert.wordpress.com%5C/wp-admin%5C/press-this.php%3Fv%3D8")%3B
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://wiert.wordpress.com/wp-admin/press-this.php',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)
javascript: (function (a, b, c, d) {
function e(a, c) {
if ("undefined" != typeof c) {
var d = b.createElement("input");
d.name = a, d.value = c, d.type = "hidden", p.appendChild(d)
}
}
var f, g, h, i, j, k, l, m, n, o = a.encodeURIComponent,
p = b.createElement("form"),
q = b.getElementsByTagName("head")[0],
r = "_press_this_app",
s = !0;
if (d) {
if (!c.match(/^https?:/)) return void(top.location.href = d);
if (d += "&u=" + o(c), c.match(/^https:/) && d.match(/^http:/) && (s = !1), a.getSelection ? h = a.getSelection() + "" : b.getSelection ? h = b.getSelection() + "" : b.selection && (h = b.selection.createRange()
.text || ""), d += "&buster=" + (new Date)
.getTime(), s || (b.title && (d += "&t=" + o(b.title.substr(0, 256))), h && (d += "&s=" + o(h.substr(0, 512)))), f = a.outerWidth || b.documentElement.clientWidth || 600, g = a.outerHeight || b.documentElement.clientHeight || 700, f = f < 800 || f > 5e3 ? 600 : .7 * f, g = g < 800 || g > 3e3 ? 700 : .9 * g, !s) return void a.open(d, r, "location,resizable,scrollbars,width=" + f + ",height=" + g);
i = q.getElementsByTagName("meta") || [];
for (var t = 0; t < i.length && !(t > 200); t++) {
var u = i[t],
v = u.getAttribute("name"),
w = u.getAttribute("property"),
x = u.getAttribute("content");
x && (v ? e("_meta[" + v + "]", x) : w && e("_meta[" + w + "]", x))
}
j = q.getElementsByTagName("link") || [];
for (var y = 0; y < j.length && !(y >= 50); y++) {
var z = j[y],
A = z.getAttribute("rel");
"canonical" !== A && "icon" !== A && "shortlink" !== A || e("_links[" + A + "]", z.getAttribute("href"))
}
b.body.getElementsByClassName && (k = b.body.getElementsByClassName("hfeed")[0]), k = b.getElementById("content") || k || b.body, l = k.getElementsByTagName("img") || [];
for (var B = 0; B < l.length && !(B >= 100); B++) n = l[B], n.src.indexOf("avatar") > -1 || n.className.indexOf("avatar") > -1 || n.width && n.width < 256 || n.height && n.height < 128 || e("_images[]", n.src);
m = b.body.getElementsByTagName("iframe") || [];
for (var C = 0; C < m.length && !(C >= 50); C++) e("_embeds[]", m[C].src);
b.title && e("t", b.title), h && e("s", h), p.setAttribute("method", "POST"), p.setAttribute("action", d), p.setAttribute("target", r), p.setAttribute("style", "display: none;"), a.open("about:blank", r, "location,resizable,scrollbars,width=" + f + ",height=" + g), b.body.appendChild(p), p.submit()
}
})(window, document, top.location.href, "https:\/\/wiert.wordpress.com\/wp-admin\/press-this.php?v=8");
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://wiert.wordpress.com/wp-admin/press-this.php',
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