Fix Press This bookmarklet for Safari 4. Props noel. fixes #10749

git-svn-id: http://svn.automattic.com/wordpress/trunk@11906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-09-08 20:06:52 +00:00
parent c6debbd596
commit 3dfaac6960
1 changed files with 8 additions and 16 deletions

View File

@ -1648,27 +1648,19 @@ function paginate_comments_links($args = array()) {
*/ */
function get_shortcut_link() { function get_shortcut_link() {
$link = "javascript: $link = "javascript:
var d=document, var d=document,
w=window, w=window,
e=w.getSelection, e=w.getSelection,
k=d.getSelection, k=d.getSelection,
x=d.selection, x=d.selection,
s=(e?e():(k)?k():(x?x.createRange().text:0)), s=(e?e():(k)?k():(x?x.createRange().text:0)),
f='" . admin_url('press-this.php') . "', f='" . admin_url('press-this.php') . "',
l=d.location, l=d.location,
e=encodeURIComponent, e=encodeURIComponent,
g=f+'?u='+e(l.href)+'&t='+e(d.title)+'&s='+e(s)+'&v=2'; u=f+'?u='+e(l.href)+'&t='+e(d.title)+'&s='+e(s)+'&v=4';
function a(){ a=function(){if(!w.open(u,'t','toolbar=0,resizable=0,status=1,width=720,height=570'))l.href=u;};
if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=720,height=570')){ if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); else a();
l.href=g; void(0)";
}
}";
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false)
$link .= 'setTimeout(a,0);';
else
$link .= 'a();';
$link .= "void(0);";
$link = str_replace(array("\r", "\n", "\t"), '', $link); $link = str_replace(array("\r", "\n", "\t"), '', $link);