Created
June 20, 2012 15:03
-
-
Save georgestephanis/2960335 to your computer and use it in GitHub Desktop.
New Press This
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
var d=document, | |
w=window, | |
e=w.getSelection, | |
k=d.getSelection, | |
x=d.selection, | |
s=(e?e():(k)?k():(x?x.createRange().text:0)), | |
l=d.location, | |
e=encodeURIComponent, | |
metas=d.head.getElementsByTagName('meta'), | |
imgs=d.body.getElementsByTagName('img'), | |
r=new Image(), | |
f=d.createElement('form'), | |
fAdd=function(n,v){ | |
if(typeof(v)==='undefined')return; | |
e=d.createElement('input'); | |
e.name=n; | |
e.value=v; | |
e.type='hidden'; | |
f.appendChild(e); | |
}; | |
for(m in metas){ | |
q=metas[m]; | |
if(q.name){ | |
fAdd('_meta['+q.name+']',q.content); | |
// q.property doesn't currently work, this is just a pseudocode placeholder | |
// We need it to work to get OG tags, which use off meta property not meta name | |
}else if(q.property){ | |
fAdd('_meta['+q.property+']',q.content); | |
} | |
} | |
for(i in imgs){ | |
r.src=imgs[i].src; | |
if(r.width>=50||r.height>=50){ | |
fAdd('_img[]',r.src); | |
} | |
} | |
fAdd('_u',l.href); | |
fAdd('_t',d.title); | |
fAdd('_s',s); | |
f.method='POST'; | |
f.action='http://stephanis.info/dump.php?u='+e(l.href)+'&t='+e(d.title)+'&s='+e(s)+'&v=4'; | |
// Need this to stop getting caught by popup blockers. | |
t=w.open('','t','toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=570'); | |
t.document.body.appendChild(f); | |
t.document.forms[0].submit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment