<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[31535] trunk/src: PressThis:</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/31535">31535</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/31535","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>azaozz</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-02-25 03:02:48 +0000 (Wed, 25 Feb 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>PressThis:
- Hard-code the minified bookmarklet js. Adding the non-minified bookmarklet to the browser bookmarks bar may have unexpected effect.
- Fix type juggling when checking the bookmarklet version.
Props stephdau, see <a href="https://core.trac.wordpress.org/ticket/31373">#31373</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjspressthisjs">trunk/src/wp-admin/js/press-this.js</a></li>
<li><a href="#trunksrcwpincludeslinktemplatephp">trunk/src/wp-includes/link-template.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjspressthisjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/press-this.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/press-this.js 2015-02-25 01:49:26 UTC (rev 31534)
+++ trunk/src/wp-admin/js/press-this.js 2015-02-25 03:02:48 UTC (rev 31535)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -636,7 +636,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Prompt user to upgrade their bookmarklet if there is a version mismatch.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( data.v && data._version && data.v !== data._version ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( data.v && data._version && ( data.v + '' ) !== ( data._version + '' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $( '.should-upgrade-bookmarklet' ).removeClass( 'is-hidden' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludeslinktemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/link-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/link-template.php 2015-02-25 01:49:26 UTC (rev 31534)
+++ trunk/src/wp-includes/link-template.php 2015-02-25 03:02:48 UTC (rev 31535)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2596,7 +2596,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function get_shortcut_link() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $is_IE, $wp_version;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $bookmarklet_version = 5;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $bookmarklet_version = '5';
</ins><span class="cx" style="display: block; padding: 0 10px"> $link = '';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $is_IE ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2628,17 +2628,35 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $link ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $suffix = '.min';
- $develop_src = false !== strpos( $wp_version, '-src' );
-
- if ( $develop_src || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ) {
- $suffix = '';
- }
-
- $url = admin_url( 'press-this.php' ) . '?v=' . $bookmarklet_version;
-
- $link = 'javascript:' . file_get_contents( ABSPATH . "wp-admin/js/bookmarklet$suffix.js" );
- $link = str_replace( 'window.pt_url', wp_json_encode( $url ), $link );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * A non-minified version if this script is in /wp-admin/js/bookmarklet.js
+ */
+ $link = '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=new Image,s="_press_this_app";if(d){if(a.getSelection?n=a.getSelection()+"":' .
+ 'b.getSelection?n=b.getSelection()+"":b.selection&&(n=b.selection.createRange().text),d+=(d.indexOf("?")>-1?"&":"?")+' .
+ '"buster="+(new Date).getTime(),b.title.length&&b.title.length<=512&&(d+="&t="+o(b.title)),n&&n.length<=512&&(d+="&s="+o(n)),' .
+ '!c.match(/^https?:/))return void(top.location.href=d);d+="&u="+o(c),c.match(/\/\/www\.youtube\.com\/watch/)?e("_embed[]",c):' .
+ 'c.match(/\/\/vimeo\.com\/(.+\/)?([\d]+)$/)?e("_embed[]",c):c.match(/\/\/(www\.)?dailymotion\.com\/video\/.+$/)?e("_embed[]",c):' .
+ 'c.match(/\/\/soundcloud\.com\/.+$/)?e("_embed[]",c):c.match(/\/\/twitter\.com\/[^\/]+\/status\/[\d]+$/)?e("_embed[]",c):' .
+ 'c.match(/\/\/vine\.co\/v\/[^\/]+/)&&e("_embed[]",c),h=q.getElementsByTagName("meta")||[];for(var t=0;' .
+ 't<h.length&&!(t>=50);t++){var u=h[t],v=u.getAttribute("name"),w=u.getAttribute("property"),x=u.getAttribute("content");' .
+ 'v?e("_meta["+v+"]",x):w&&e("_meta["+w+"]",x)}i=q.getElementsByTagName("link")||[];for(var y=0;y<i.length&&!(y>=50);y++)' .
+ '{var z=i[y],A=z.getAttribute("rel");if(A)switch(A){case"canonical":case"icon":case"shortlink":e("_links["+A+"]",' .
+ 'z.getAttribute("href"));break;case"alternate":"application/json+oembed"===z.getAttribute("type")?e("_links["+A+"]",' .
+ 'z.getAttribute("href")):"handheld"===z.getAttribute("media")&&e("_links["+A+"]",z.getAttribute("href"))}}' .
+ 'b.body.getElementsByClassName&&(j=b.body.getElementsByClassName("hfeed")[0]),j=b.getElementById("content")||j||b.body,' .
+ 'k=j.getElementsByTagName("img")||[];for(var B=0;B<k.length&&!(B>=100);B++)k[B].src.indexOf("avatar")>-1||' .
+ 'k[B].className.indexOf("avatar")>-1||(r.src=k[B].src,r.width>=256&&r.height>=128&&e("_img[]",r.src));' .
+ 'l=b.body.getElementsByTagName("iframe")||[];for(var C=0;C<l.length&&!(C>=100);C++)' .
+ 'm=l[C].src.match(/\/\/www\.youtube\.com\/embed\/([^\?]+)\?.+$/),m&&2===m.length&&e("_embed[]",' .
+ '"https://www.youtube.com/watch?v="+m[1]),m=l[C].src.match(/\/\/player\.vimeo\.com\/video\/([\d]+)$/),' .
+ 'm&&2===m.length&&e("_embed[]","https://vimeo.com/"+m[1]),m=l[C].src.match(/\/\/vine\.co\/v\/([^\/]+)\/embed/),' .
+ 'm&&2===m.length&&e("_embed[]","https://vine.co/v/"+m[1]);b.title&&b.title>512&&e("t",b.title),n&&n.length>512&&e("s",n),' .
+ 'p.setAttribute("method","POST"),p.setAttribute("action",d),p.setAttribute("target",s),p.setAttribute("style","display: none;"),' .
+ 'f=a.outerWidth||b.documentElement.clientWidth||600,g=a.outerHeight||b.documentElement.clientHeight||700,f=800>f||f>5e3?600:.7*f,' .
+ 'g=800>g||g>3e3?700:.9*g,a.open("about:blank",s,"width="+f+",height="+g),b.body.appendChild(p),p.submit()}}' .
+ '(window,document,top.location.href,"' . admin_url( 'press-this.php' ) . '?v=' . $bookmarklet_version . '");';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $link = str_replace( array( "\r", "\n", "\t" ), '', $link );
</span></span></pre>
</div>
</div>
</body>
</html>