<!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>[31545] trunk: PressThis: go back to loading the minified bookmarklet content with file_get_contents().</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/31545">31545</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/31545","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 20:15:46 +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: go back to loading the minified bookmarklet content with file_get_contents(). Add Grunt task to minify bookmarklet.js on precommit and update it in /src. See <a href="https://core.trac.wordpress.org/ticket/31373">#31373</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkGruntfilejs">trunk/Gruntfile.js</a></li>
<li><a href="#trunksrcwpincludeslinktemplatephp">trunk/src/wp-includes/link-template.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjsbookmarkletminjs">trunk/src/wp-admin/js/bookmarklet.min.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkGruntfilejs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/Gruntfile.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/Gruntfile.js        2015-02-25 08:19:54 UTC (rev 31544)
+++ trunk/Gruntfile.js  2015-02-25 20:15:46 UTC (rev 31545)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -376,6 +376,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        '!wp-admin/js/custom-header.js', // Why? We should minify this.
</span><span class="cx" style="display: block; padding: 0 10px">                                        '!wp-admin/js/farbtastic.js',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '!wp-admin/js/iris.min.js',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        '!wp-admin/js/bookmarklet.js', // Minified and updated in /src with the precommit task. See uglify:bookmarklet.
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '!wp-includes/js/backbone.min.js',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '!wp-includes/js/swfobject.js',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '!wp-includes/js/underscore.min.js',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -403,6 +404,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                dest: BUILD_DIR,
</span><span class="cx" style="display: block; padding: 0 10px">                                ext: '.min.js',
</span><span class="cx" style="display: block; padding: 0 10px">                                src: ['wp-includes/js/jquery/ui/*.js']
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        },
+                       bookmarklet: {
+                               options: {
+                                       compress: {
+                                               negate_iife: false
+                                       }
+                               },
+                               src: SOURCE_DIR + 'wp-admin/js/bookmarklet.js',
+                               dest: SOURCE_DIR + 'wp-admin/js/bookmarklet.min.js'
</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">                concat: {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -528,7 +538,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // Pre-commit task.
</span><span class="cx" style="display: block; padding: 0 10px">        grunt.registerTask('precommit', 'Runs front-end dev/test tasks in preparation for a commit.',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                ['autoprefixer:core', 'imagemin:core', 'jshint:corejs', 'qunit:compiled']);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         ['autoprefixer:core', 'imagemin:core', 'jshint:corejs', 'qunit:compiled', 'uglify:bookmarklet']);
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // Copy task.
</span><span class="cx" style="display: block; padding: 0 10px">        grunt.registerTask('copy:all', ['copy:files', 'copy:wp-admin-rtl', 'copy:version']);
</span></span></pre></div>
<a id="trunksrcwpadminjsbookmarkletminjs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-admin/js/bookmarklet.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/bookmarklet.min.js                          (rev 0)
+++ trunk/src/wp-admin/js/bookmarklet.min.js    2015-02-25 20:15:46 UTC (rev 31545)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+(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(&quot
 ;_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"));br
 eak;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,window.pt_url);
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/src/wp-admin/js/bookmarklet.min.js
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><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 08:19:54 UTC (rev 31544)
+++ trunk/src/wp-includes/link-template.php     2015-02-25 20:15:46 UTC (rev 31545)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2621,37 +2621,12 @@
</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">-                $url = wp_json_encode( admin_url( 'press-this.php' ) . '?v=' . $bookmarklet_version );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $src = @file_get_contents( ABSPATH . 'wp-admin/js/bookmarklet.min.js' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; 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,' . $url . ');';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $src ) {
+                       $url = wp_json_encode( admin_url( 'press-this.php' ) . '?v=' . $bookmarklet_version );
+                       $link = 'javascript:' . str_replace( 'window.pt_url', $url, $src );
+               }
</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>