From 3dfaac6960c832cfa5087b5198861f6cc08e5624 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 8 Sep 2009 20:06:52 +0000 Subject: [PATCH] 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 --- wp-includes/link-template.php | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 53eaee7c1..1b6e8007a 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -1648,27 +1648,19 @@ function paginate_comments_links($args = array()) { */ function get_shortcut_link() { $link = "javascript: - var d=document, - w=window, - e=w.getSelection, - k=d.getSelection, + 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='" . admin_url('press-this.php') . "', l=d.location, e=encodeURIComponent, - g=f+'?u='+e(l.href)+'&t='+e(d.title)+'&s='+e(s)+'&v=2'; - function a(){ - if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=720,height=570')){ - l.href=g; - } - }"; - if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) - $link .= 'setTimeout(a,0);'; - else - $link .= 'a();'; - - $link .= "void(0);"; + 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=0,status=1,width=720,height=570'))l.href=u;}; + if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); else a(); + void(0)"; $link = str_replace(array("\r", "\n", "\t"), '', $link);