<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[12500] trunk:
  Improve the revision comparison user interface to hilight that we compare 
 &quot;old on left&quot; to &quot;new on right&quot;.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12500">12500</a></dd>
<dt>Author</dt> <dd>westi</dd>
<dt>Date</dt> <dd>2009-12-23 09:15:13 +0000 (Wed, 23 Dec 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Improve the revision comparison user interface to hilight that we compare &quot;old on left&quot; to &quot;new on right&quot;.  Includes some js to hide the radio buttons to stop you selecting reverse comparisions.
Fixes <a href="http://trac.wordpress.org/ticket/11088">#11088</a> props filosofo.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminrevisionphp">trunk/wp-admin/revision.php</a></li>
<li><a href="#trunkwpincludesposttemplatephp">trunk/wp-includes/post-template.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpincludesjswplistrevisionsdevjs">trunk/wp-includes/js/wp-list-revisions.dev.js</a></li>
<li><a href="#trunkwpincludesjswplistrevisionsjs">trunk/wp-includes/js/wp-list-revisions.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminrevisionphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/revision.php (12499 => 12500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/revision.php        2009-12-23 09:10:26 UTC (rev 12499)
+++ trunk/wp-admin/revision.php        2009-12-23 09:15:13 UTC (rev 12500)
</span><span class="lines">@@ -9,6 +9,8 @@
</span><span class="cx"> /** WordPress Administration Bootstrap */
</span><span class="cx"> require_once('admin.php');
</span><span class="cx"> 
</span><ins>+wp_enqueue_script('list-revisions');
+
</ins><span class="cx"> wp_reset_vars(array('revision', 'left', 'right', 'diff', 'action'));
</span><span class="cx"> $revision_id = absint($revision);
</span><span class="cx"> $diff        = absint($diff);
</span></span></pre></div>
<a id="trunkwpincludesjswplistrevisionsdevjs"></a>
<div class="addfile"><h4>Added: trunk/wp-includes/js/wp-list-revisions.dev.js (0 => 12500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/wp-list-revisions.dev.js                                (rev 0)
+++ trunk/wp-includes/js/wp-list-revisions.dev.js        2009-12-23 09:15:13 UTC (rev 12500)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+(function(w) {
+        var init = function() {
+                var pr = document.getElementById('post-revisions'),
+                inputs = pr ? pr.getElementsByTagName('input') : [];
+                pr.onclick = function() {
+                        var i, checkCount = 0, side;
+                        for ( i = 0; i &lt; inputs.length; i++ ) {
+                                checkCount += inputs[i].checked ? 1 : 0;
+                                side = inputs[i].getAttribute('name');
+                                if ( ! inputs[i].checked &amp;&amp; 
+                                ( 'left' == side &amp;&amp; 1 &gt; checkCount || 'right' == side &amp;&amp; 1 &lt; checkCount &amp;&amp; ( ! inputs[i-1] || ! inputs[i-1].checked ) ) &amp;&amp;
+                                ! ( inputs[i+1] &amp;&amp; inputs[i+1].checked &amp;&amp; 'right' == inputs[i+1].getAttribute('name') ) )
+                                        inputs[i].style.visibility = 'hidden';                
+                                else if ( 'left' == side || 'right' == side )
+                                        inputs[i].style.visibility = 'visible';
+                        }
+                }
+                pr.onclick();
+        }
+        if ( w &amp;&amp; w.addEventListener ) 
+                w.addEventListener('load', init, false);
+        else if ( w &amp;&amp; w.attachEvent )
+                w.attachEvent('onload', init);
+})(window);
</ins></span></pre></div>
<a id="trunkwpincludesjswplistrevisionsjs"></a>
<div class="addfile"><h4>Added: trunk/wp-includes/js/wp-list-revisions.js (0 => 12500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/wp-list-revisions.js                                (rev 0)
+++ trunk/wp-includes/js/wp-list-revisions.js        2009-12-23 09:15:13 UTC (rev 12500)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+(function(a){var b=function(){var d=document.getElementById(&quot;post-revisions&quot;),c=d?d.getElementsByTagName(&quot;input&quot;):[];d.onclick=function(){var g,f=0,e;for(g=0;g&lt;c.length;g++){f+=c[g].checked?1:0;e=c[g].getAttribute(&quot;name&quot;);if(!c[g].checked&amp;&amp;(&quot;left&quot;==e&amp;&amp;1&gt;f||&quot;right&quot;==e&amp;&amp;1&lt;f&amp;&amp;(!c[g-1]||!c[g-1].checked))&amp;&amp;!(c[g+1]&amp;&amp;c[g+1].checked&amp;&amp;&quot;right&quot;==c[g+1].getAttribute(&quot;name&quot;))){c[g].style.visibility=&quot;hidden&quot;}else{if(&quot;left&quot;==e||&quot;right&quot;==e){c[g].style.visibility=&quot;visible&quot;}}}};d.onclick()};if(a&amp;&amp;a.addEventListener){a.addEventListener(&quot;load&quot;,b,false)}else{if(a&amp;&amp;a.attachEvent){a.attachEvent(&quot;onload&quot;,b)}}})(window);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesposttemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post-template.php (12499 => 12500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post-template.php        2009-12-23 09:10:26 UTC (rev 12499)
+++ trunk/wp-includes/post-template.php        2009-12-23 09:15:13 UTC (rev 12500)
</span><span class="lines">@@ -1299,7 +1299,8 @@
</span><span class="cx">                                 $actions = '';
</span><span class="cx"> 
</span><span class="cx">                         $rows .= &quot;&lt;tr$class&gt;\n&quot;;
</span><del>-                        $rows .= &quot;\t&lt;th style='white-space: nowrap' scope='row'&gt;&lt;input type='radio' name='left' value='$revision-&gt;ID'$left_checked /&gt;&lt;input type='radio' name='right' value='$revision-&gt;ID'$right_checked /&gt;&lt;/th&gt;\n&quot;;
</del><ins>+                        $rows .= &quot;\t&lt;th style='white-space: nowrap' scope='row'&gt;&lt;input type='radio' name='left' value='$revision-&gt;ID'$left_checked /&gt;\n&quot;;
+                        $rows .= &quot;\t&lt;th style='white-space: nowrap' scope='row'&gt;&lt;input type='radio' name='right' value='$revision-&gt;ID'$right_checked /&gt;&lt;/th&gt;\n&quot;;
</ins><span class="cx">                         $rows .= &quot;\t&lt;td&gt;$date&lt;/td&gt;\n&quot;;
</span><span class="cx">                         $rows .= &quot;\t&lt;td&gt;$name&lt;/td&gt;\n&quot;;
</span><span class="cx">                         $rows .= &quot;\t&lt;td class='action-links'&gt;$actions&lt;/td&gt;\n&quot;;
</span><span class="lines">@@ -1323,14 +1324,16 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;br class=&quot;clear&quot; /&gt;
</span><span class="cx"> 
</span><del>-&lt;table class=&quot;widefat post-revisions&quot; cellspacing=&quot;0&quot;&gt;
</del><ins>+&lt;table class=&quot;widefat post-revisions&quot; cellspacing=&quot;0&quot; id=&quot;post-revisions&quot;&gt;
</ins><span class="cx">         &lt;col /&gt;
</span><ins>+        &lt;col /&gt;
</ins><span class="cx">         &lt;col style=&quot;width: 33%&quot; /&gt;
</span><span class="cx">         &lt;col style=&quot;width: 33%&quot; /&gt;
</span><span class="cx">         &lt;col style=&quot;width: 33%&quot; /&gt;
</span><span class="cx"> &lt;thead&gt;
</span><span class="cx"> &lt;tr&gt;
</span><del>-        &lt;th scope=&quot;col&quot;&gt;&lt;/th&gt;
</del><ins>+        &lt;th scope=&quot;col&quot;&gt;&lt;?php _e( 'Old' ); ?&gt;&lt;/th&gt;
+        &lt;th scope=&quot;col&quot;&gt;&lt;?php _e( 'New' ); ?&gt;&lt;/th&gt;
</ins><span class="cx">         &lt;th scope=&quot;col&quot;&gt;&lt;?php _e( 'Date Created' ); ?&gt;&lt;/th&gt;
</span><span class="cx">         &lt;th scope=&quot;col&quot;&gt;&lt;?php _e( 'Author' ); ?&gt;&lt;/th&gt;
</span><span class="cx">         &lt;th scope=&quot;col&quot; class=&quot;action-links&quot;&gt;&lt;?php _e( 'Actions' ); ?&gt;&lt;/th&gt;
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (12499 => 12500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2009-12-23 09:10:26 UTC (rev 12499)
+++ trunk/wp-includes/script-loader.php        2009-12-23 09:15:13 UTC (rev 12500)
</span><span class="lines">@@ -373,6 +373,8 @@
</span><span class="cx">                 $scripts-&gt;add( 'hoverIntent', &quot;/wp-includes/js/hoverIntent$suffix.js&quot;, array('jquery'), '20090102' );
</span><span class="cx">                 $scripts-&gt;add_data( 'hoverIntent', 'group', 1 );
</span><span class="cx"> 
</span><ins>+                $scripts-&gt;add( 'list-revisions', &quot;/wp-includes/js/wp-list-revisions$suffix.js&quot;, null, '20091223' );
+
</ins><span class="cx">                 $scripts-&gt;add( 'media', &quot;/wp-admin/js/media$suffix.js&quot;, array( 'jquery-ui-draggable' ), '20090415' );
</span><span class="cx">                 $scripts-&gt;add_data( 'media', 'group', 1 );
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>