Ticket #23497: 23497.38.diff
File 23497.38.diff, 67.3 KB (added by , 12 years ago) |
---|
-
wp-includes/default-filters.php
250 250 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 ); 251 251 add_action( 'plugins_loaded', 'wp_maybe_load_embeds', 0 ); 252 252 add_action( 'shutdown', 'wp_ob_end_flush_all', 1 ); 253 add_action( 'pre_post_update', 'wp_save_post_revision', 10, 2 ); 253 add_action( 'pre_post_update', 'wp_save_post_revision', 10, 1 ); 254 add_action( 'post_updated', 'wp_save_post_revision', 10, 1 ); 254 255 add_action( 'publish_post', '_publish_post_hook', 5, 1 ); 255 256 add_action( 'transition_post_status', '_transition_post_status', 5, 3 ); 256 257 add_action( 'transition_post_status', '_update_term_count_on_transition_post_status', 10, 3 ); -
wp-includes/post-template.php
1306 1306 if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) 1307 1307 return false; 1308 1308 1309 /* translators: revision date format, see http://php.net/date */ 1310 $datef = _x( 'j F, Y @ G:i', 'revision date format'); 1311 /* translators: 1: date */ 1312 $autosavef = __( '%1$s [Autosave]' ); 1313 /* translators: 1: date */ 1314 $currentf = __( '%1$s [Current Revision]' ); 1315 1316 $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); 1317 if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) 1318 $date = "<a href='$link'>$date</a>"; 1319 1320 if ( !wp_is_post_revision( $revision ) ) 1321 $date = sprintf( $currentf, $date ); 1322 elseif ( wp_is_post_autosave( $revision ) ) 1323 $date = sprintf( $autosavef, $date ); 1324 1325 return $date; 1326 } 1327 1328 /** 1329 * Retrieve formatted date timestamp of a revision (linked to that revisions's page). 1330 * 1331 * @package WordPress 1332 * @subpackage Post_Revisions 1333 * @since 3.6.0 1334 * 1335 * @uses date_i18n() 1336 * 1337 * @param int|object $revision Revision ID or revision object. 1338 * @param bool $link Optional, default is true. Link to revisions's page? 1339 * @return string gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'. 1340 */ 1341 function wp_post_revision_title_expanded( $revision, $link = true ) { 1342 if ( !$revision = get_post( $revision ) ) 1343 return $revision; 1344 1345 if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) 1346 return false; 1347 1309 1348 $author = get_the_author_meta( 'display_name', $revision->post_author ); 1310 1349 /* translators: revision date format, see http://php.net/date */ 1311 1350 $datef = _x( 'j F, Y @ G:i:s', 'revision date format'); 1312 1351 1313 $gravatar = get_avatar( $revision->post_author, 18);1352 $gravatar = get_avatar( $revision->post_author, 24 ); 1314 1353 1315 1354 $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); 1316 1355 if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) … … 1388 1427 } 1389 1428 1390 1429 /* translators: post revision: 1: when, 2: author name */ 1391 $titlef = _x( '%1$s by %2$s', 'post revision' );1430 $titlef = _x( '%1$s', 'post revision' ); 1392 1431 1393 1432 if ( $parent ) 1394 1433 array_unshift( $revisions, $post ); 1395 1434 1435 // since 3.6 revisions include a copy of the current post data as a revision 1436 // the collowing removes this current revision if present from the list of 1437 // revisions returned by wp_list_post_revisions, remove these to include the 1438 // crrent post revision in the list of revisions 1439 if ( wp_first_revision_matches_current_version( $post_id ) ) 1440 array_pop( $revisions ); 1441 1396 1442 $rows = $right_checked = ''; 1397 1443 $class = false; 1398 1444 $can_edit_post = current_user_can( 'edit_post', $post->ID ); … … 1402 1448 if ( 'revision' === $type && wp_is_post_autosave( $revision ) ) 1403 1449 continue; 1404 1450 1405 $date = wp_post_revision_title( $revision ); 1406 $name = get_the_author_meta( 'display_name', $revision->post_author ); 1451 $date = wp_post_revision_title_expanded( $revision ); 1407 1452 1408 if ( 'form-table' == $format ) { 1409 if ( $left ) 1410 $left_checked = $left == $revision->ID ? ' checked="checked"' : ''; 1411 else 1412 $left_checked = $right_checked ? ' checked="checked"' : ''; // [sic] (the next one) 1413 $right_checked = $right == $revision->ID ? ' checked="checked"' : ''; 1453 $title = sprintf( $titlef, $date ); 1454 $rows .= "\t<li>$title</li>\n"; 1414 1455 1415 $class = $class ? '' : " class='alternate'";1416 1417 if ( $post->ID != $revision->ID && $can_edit_post )1418 $actions = '<a href="' . wp_nonce_url( add_query_arg( array( 'revision' => $revision->ID, 'action' => 'restore' ) ), "restore-post_$post->ID|$revision->ID" ) . '">' . __( 'Restore' ) . '</a>';1419 else1420 $actions = '';1421 1422 $rows .= "<tr$class>\n";1423 $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='left' value='$revision->ID'$left_checked /></th>\n";1424 $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='right' value='$revision->ID'$right_checked /></th>\n";1425 $rows .= "\t<td>$date</td>\n";1426 $rows .= "\t<td>$name</td>\n";1427 $rows .= "\t<td class='action-links'>$actions</td>\n";1428 $rows .= "</tr>\n";1429 } else {1430 $title = sprintf( $titlef, $date, $name );1431 $rows .= "\t<li>$title</li>\n";1432 }1433 1456 } 1434 1457 1435 1458 if ( 'form-table' == $format ) : ?> … … 1479 1502 // if the post was previously restored from a revision 1480 1503 // show the restore event details 1481 1504 // 1482 if ( $restored_from_meta = get_post_meta( $post->ID, '_post_restored_from', true ) ) { 1483 $author = get_the_author_meta( 'display_name', $restored_from_meta[ 'restored_by_user' ] ); 1484 /* translators: revision date format, see http://php.net/date */ 1485 $datef = _x( 'j F, Y @ G:i:s', 'revision date format'); 1486 $date = date_i18n( $datef, strtotime( $restored_from_meta[ 'restored_time' ] ) ); 1487 $timesince = human_time_diff( $restored_from_meta[ 'restored_time' ], current_time( 'timestamp' ) ) ;1488 ?> 1505 if ( $restored_from_meta = get_post_meta( $post->ID, '_post_restored_from', true ) ) { 1506 $author = get_the_author_meta( 'display_name', $restored_from_meta[ 'restored_by_user' ] ); 1507 /* translators: revision date format, see http://php.net/date */ 1508 $datef = _x( 'j F, Y @ G:i:s', 'revision date format'); 1509 $date = date_i18n( $datef, strtotime( $restored_from_meta[ 'restored_time' ] ) ); 1510 $timesince = human_time_diff( $restored_from_meta[ 'restored_time' ], current_time( 'timestamp' ) ) ; 1511 ?> 1489 1512 <hr /> 1490 <div id="revisions-meta-restored"> 1491 <?php 1513 <div id="revisions-meta-restored"> 1514 <?php 1492 1515 /* translators: restored revision details: 1: revision ID, 2: time ago, 3: author name, 4: date */ 1493 printf( _x( 'Previously restored from revision ID %1$d, %2$s ago by %3$s (%4$s)', 'restored revision details' ), 1494 $restored_from_meta[ 'restored_revision_id'], 1495 $timesince, 1496 $author, 1497 $date ); 1498 ?> 1499 </div> 1500 <?php 1516 printf( _x( 'Previously restored from revision ID %1$d, %2$s ago by %3$s (%4$s)', 'restored revision details' ), 1517 $restored_from_meta[ 'restored_revision_id'], 1518 $timesince, 1519 $author, 1520 $date ); 1521 ?> 1522 </div> 1523 <?php 1501 1524 echo "</ul>"; 1502 } 1525 } 1503 1526 1504 1527 endif; 1505 1528 -
wp-includes/revision.php
62 62 /** 63 63 * Saves an already existing post as a post revision. 64 64 * 65 * Typically used immediately prior to post updates. 65 * Typically used immediately prior and after post updates. 66 * Prior to update checks for old revision data (latest revision != current post before update) and adds a copy of the current post as a revision if missing 67 * After update adds a copy of the current post as a revision, so latest revision always matches current post 66 68 * 67 69 * @package WordPress 68 70 * @subpackage Post_Revisions 69 71 * @since 2.6.0 70 72 * 71 73 * @uses _wp_put_post_revision() 74 * @uses wp_first_revision_matches_current_version() 72 75 * 73 76 * @param int $post_id The ID of the post to save as a revision. 74 77 * @return mixed Null or 0 if error, new revision ID, if success. 75 78 */ 76 function wp_save_post_revision( $post_id, $new_data = null ) { 77 // We do autosaves manually with wp_create_post_autosave() 79 function wp_save_post_revision( $post_id ) { 80 //check to see if the post's first revision already matches the post data 81 //should be true before post update, _except_ for old data which 82 //doesn't include a copy of the current post data in revisions 83 if ( wp_first_revision_matches_current_version( $post_id ) ) 84 return; 85 78 86 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 79 87 return; 80 88 … … 82 90 if ( ! WP_POST_REVISIONS ) 83 91 return; 84 92 85 if ( ! $post = get_post( $post_id, ARRAY_A ) )93 if ( ! $post = get_post( $post_id, ARRAY_A ) ) 86 94 return; 87 95 88 96 if ( 'auto-draft' == $post['post_status'] ) 89 97 return; 90 98 91 if ( ! post_type_supports($post['post_type'], 'revisions') )99 if ( ! post_type_supports( $post['post_type'], 'revisions' ) ) 92 100 return; 93 101 94 // if new data is supplied, check that it is different from last saved revision, unless a plugin tells us to always save regardless 95 if ( apply_filters( 'wp_save_post_revision_check_for_changes', true, $post, $new_data ) && is_array( $new_data ) ) { 96 $post_has_changed = false; 97 foreach ( array_keys( _wp_post_revision_fields() ) as $field ) { 98 if ( normalize_whitespace( $new_data[ $field ] ) != normalize_whitespace( $post[ $field ] ) ) { 99 $post_has_changed = true; 100 break; 102 // compare the proposed update with the last stored revision, verify 103 // different, unless a plugin tells us to always save regardless 104 if ( $revisions = wp_get_post_revisions( $post_id ) ) { // grab the last revision 105 $last_revision = array_shift( $revisions ); 106 107 if ( $last_revision_array = get_post( $last_revision->ID, ARRAY_A ) ) { //if no previous revisions, save one for sure 108 109 if ( apply_filters( 'wp_save_post_revision_check_for_changes', true, $last_revision_array, $post ) && is_array( $post ) ) { 110 $post_has_changed = false; 111 112 foreach ( array_keys( _wp_post_revision_fields() ) as $field ) { 113 114 if ( normalize_whitespace( $post[ $field ] ) != normalize_whitespace( $last_revision_array[ $field ] ) ) { 115 $post_has_changed = true; 116 break; 117 118 } 119 } 120 121 //don't save revision if post unchanged 122 if( ! $post_has_changed ) 123 return; 101 124 } 102 125 } 103 //don't save revision if post unchanged104 if( ! $post_has_changed )105 return;106 126 } 107 127 108 128 $return = _wp_put_post_revision( $post ); 109 129 110 130 // WP_POST_REVISIONS = true (default), -1 111 if ( ! is_numeric( WP_POST_REVISIONS ) || WP_POST_REVISIONS < 0 )131 if ( ! is_numeric( WP_POST_REVISIONS ) || WP_POST_REVISIONS < 0 ) 112 132 return $return; 113 133 114 134 // all revisions and (possibly) one autosave 115 135 $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) ); 116 136 117 137 // WP_POST_REVISIONS = (int) (# of autosaves to save) 118 $delete = count( $revisions) - WP_POST_REVISIONS;138 $delete = count( $revisions ) - WP_POST_REVISIONS; 119 139 120 140 if ( $delete < 1 ) 121 141 return $return; … … 123 143 $revisions = array_slice( $revisions, 0, $delete ); 124 144 125 145 for ( $i = 0; isset($revisions[$i]); $i++ ) { 126 if ( false !== strpos( $revisions[ $i]->post_name, 'autosave' ) )146 if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) ) 127 147 continue; 128 wp_delete_post_revision( $revisions[ $i]->ID );148 wp_delete_post_revision( $revisions[ $i ]->ID ); 129 149 } 130 150 131 151 return $return; … … 316 336 if ( $post_id ) 317 337 do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] ); 318 338 339 //store revision event in post meta 340 $restore_details = array( 341 'restored_revision_id' => $revision_id, 342 'restored_by_user' => get_current_user_id(), 343 'restored_time' => time() 344 ); 345 update_post_meta( $post_id, '_post_restored_from', $restore_details ); 346 update_post_meta( $post_id, '_edit_last', get_current_user_id() ); 347 319 348 return $post_id; 320 349 } 321 350 … … 404 433 add_filter('the_preview', '_set_preview'); 405 434 } 406 435 } 436 437 /** 438 * Determines if the specified post's most recent revision matches the post (by checking post_modified). 439 * 440 * @package WordPress 441 * @subpackage Post_Revisions 442 * @since 3.6.0 443 * 444 * @param int|object $post Post ID or post object. 445 * @return bool false if not a match, otherwise true. 446 */ 447 function wp_first_revision_matches_current_version( $post ) { 448 449 if ( ! $post = get_post( $post ) ) 450 return false; 451 452 if ( ! $revisions = wp_get_post_revisions( $post->ID ) ) 453 return false; 454 455 $last_revision = array_shift( $revisions ); 456 457 if ( ! ($last_revision->post_modified == $post->post_modified ) ) 458 return false; 459 460 return true; 461 } -
wp-includes/pluggable.php
1744 1744 return $r; 1745 1745 } 1746 1746 endif; 1747 1748 if ( !function_exists( 'wp_text_diff_with_count' ) ) : 1749 /** 1750 * Displays a human readable HTML representation of the difference between two strings. 1751 * similar to wp_text_diff, but tracks and returns could of lines added and removed 1752 * 1753 * @since 3.6 1754 * @see wp_parse_args() Used to change defaults to user defined settings. 1755 * @uses Text_Diff 1756 * @uses WP_Text_Diff_Renderer_Table 1757 * 1758 * @param string $left_string "old" (left) version of string 1759 * @param string $right_string "new" (right) version of string 1760 * @param string|array $args Optional. Change 'title', 'title_left', and 'title_right' defaults. 1761 * @return array contains html, linesadded & linesdeletd, empty string if strings are equivalent. 1762 */ 1763 function wp_text_diff_with_count( $left_string, $right_string, $args = null ) { 1764 $defaults = array( 'title' => '', 'title_left' => '', 'title_right' => '' ); 1765 $args = wp_parse_args( $args, $defaults ); 1766 1767 if ( !class_exists( 'WP_Text_Diff_Renderer_Table' ) ) 1768 require( ABSPATH . WPINC . '/wp-diff.php' ); 1769 1770 $left_string = normalize_whitespace( $left_string ); 1771 $right_string = normalize_whitespace( $right_string ); 1772 1773 $left_lines = explode( "\n", $left_string ); 1774 $right_lines = explode( "\n", $right_string) ; 1775 1776 $text_diff = new Text_Diff($left_lines, $right_lines ); 1777 $linesadded = $text_diff->countAddedLines(); 1778 $linesdeleted = $text_diff->countDeletedLines(); 1779 1780 $renderer = new WP_Text_Diff_Renderer_Table(); 1781 $diff = $renderer->render( $text_diff ); 1782 1783 if ( !$diff ) 1784 return ''; 1785 1786 $r = "<table class='diff'>\n"; 1787 1788 if ( ! empty( $args[ 'show_split_view' ] ) ) { 1789 $r .= "<col class='content diffsplit left' /><col class='content diffsplit middle' /><col class='content diffsplit right' />"; 1790 } else { 1791 $r .= "<col class='content' />"; 1792 } 1793 1794 if ( $args['title'] || $args['title_left'] || $args['title_right'] ) 1795 $r .= "<thead>"; 1796 if ( $args['title'] ) 1797 $r .= "<tr class='diff-title'><th colspan='4'>$args[title]</th></tr>\n"; 1798 if ( $args['title_left'] || $args['title_right'] ) { 1799 $r .= "<tr class='diff-sub-title'>\n"; 1800 $r .= "\t<td></td><th>$args[title_left]</th>\n"; 1801 $r .= "\t<td></td><th>$args[title_right]</th>\n"; 1802 $r .= "</tr>\n"; 1803 } 1804 if ( $args['title'] || $args['title_left'] || $args['title_right'] ) 1805 $r .= "</thead>\n"; 1806 1807 $r .= "<tbody>\n$diff\n</tbody>\n"; 1808 $r .= "</table>"; 1809 1810 return array( 'html' => $r, 'linesadded' => $linesadded, 'linesdeleted' => $linesdeleted ); 1811 } 1812 endif; -
wp-includes/script-loader.php
273 273 $scripts->add( 'template', "/wp-includes/js/template$suffix.js", array('underscore'), '1.4.4', 1 ); 274 274 $scripts->add( 'backbone', '/wp-includes/js/backbone.min.js', array('underscore','jquery', 'template'), '0.9.10', 1 ); 275 275 276 $scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'backbone', 'jquery-ui-slider' ), false, 1 );276 $scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'backbone', 'jquery-ui-slider', 'jquery-ui-tooltip' ), false, 1 ); 277 277 278 278 $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.8', 1 ); 279 279 -
wp-admin/includes/ajax-actions.php
2123 2123 /* translators: revision date format, see http://php.net/date */ 2124 2124 $datef = _x( 'j F, Y @ G:i:s', 'revision date format'); 2125 2125 2126 $left_revision = get_post( $compare_to ); 2127 2126 2128 //single model fetch mode 2129 //return the diff of a single revision comparison 2127 2130 if ( 0 != $single_revision_id ) { 2128 $left_revision = get_post( $compare_to );2129 2131 $right_revision = get_post( $single_revision_id ); 2130 2132 2131 if ( $compare_two_mode ) {2132 $compare_to_gravatar = get_avatar( $left_revision->post_author, 18 );2133 $compare_to_author = get_the_author_meta( 'display_name', $left_revision->post_author );2134 $compare_to_date = date_i18n( $datef, strtotime( $left_revision->post_modified ) );2135 2136 $revision_from_date_author = sprintf(2137 /* translators: post revision title: 1: author avatar, 2: author name, 3: time ago, 4: date */2138 _x( '%1$s %2$s, %3$s ago (%4$s)', 'post revision title' ),2139 $compare_to_gravatar,2140 $compare_to_author,2141 human_time_diff( strtotime( $left_revision->post_modified ), current_time( 'timestamp' ) ),2142 $compare_to_date2143 );2144 }2145 2146 2133 // 2147 2134 //make sure the left revision is the most recent 2148 2135 // 2136 2149 2137 if ( strtotime( $right_revision->post_modified_gmt ) < strtotime( $left_revision->post_modified_gmt ) ) { 2150 2138 $temp = $left_revision; 2151 2139 $left_revision = $right_revision; 2152 2140 $right_revision = $temp; 2153 2141 } 2154 2142 2143 $linesadded=0; 2144 $linesdeleted=0; 2145 2155 2146 // 2156 2147 //compare from left to right, passed from application 2157 2148 // … … 2167 2158 if ( ! empty( $show_split_view ) ) 2168 2159 $args = array( 'show_split_view' => true ); 2169 2160 2170 $content .= wp_text_diff( $left_content, $right_content, $args ); 2161 $diff = wp_text_diff_with_count( $left_content, $right_content, $args ); 2162 2163 if ( isset( $diff[ 'html' ] ) ) 2164 $content .= $diff[ 'html' ]; 2165 2166 if ( isset( $diff[ 'linesadded' ] ) ) 2167 $linesadded = $linesadded + $diff[ 'linesadded' ]; 2168 2169 if ( isset( $diff[ 'linesdeleted' ] ) ) 2170 $linesdeleted = $linesdeleted + $diff[ 'linesdeleted' ]; 2171 2172 2171 2173 } 2172 $content = '' == $content ? __( 'No difference' ) : $content; 2173 $alltherevisions = array ( 2174 'revisiondiff' => $content 2175 ); 2174 $content = '' == $content ? __( 'No difference' ) : $content; 2175 2176 $alltherevisions = array ( 2177 'revisiondiff' => $content, 2178 'lines_deleted' => $linesdeleted, 2179 'lines_added' => $linesadded 2180 ); 2176 2181 echo json_encode( $alltherevisions ); 2177 2182 exit(); 2178 } 2183 } //end single model fetch 2179 2184 2185 //fetch the list of revisions available 2186 2180 2187 //if we are comparing two revisions, the first 'revision' represented by the leftmost 2181 2188 //slider position is the current revision, prepend a comparison to this revision 2182 if ( $compare_two_mode ) 2183 array_unshift( $revisions, get_post( $post_id ) ); 2184 2189 if ( ! wp_first_revision_matches_current_version( $post_id ) ) //revisions don't have current version 2190 array_unshift( $revisions, get_post( $post_id ) ) ; 2191 //$revisions->append ( get_post( $post_id ) ); 2192 //error_log( var_dump( $revisions )); 2185 2193 $count = -1; 2186 2194 2195 //reverse the list to start with oldes revision 2196 $revisions = array_reverse( $revisions ); 2197 2198 $previous_revision_id = 0; 2187 2199 foreach ( $revisions as $revision ) : 2188 if ( ! empty( $show_autosaves ) && wp_is_post_autosave( $revision ) ) 2200 //error_log( ( $show_autosaves )); 2201 if ( empty( $show_autosaves ) && wp_is_post_autosave( $revision ) ) 2189 2202 continue; 2190 2203 2191 2204 $revision_from_date_author = ''; 2192 2205 $count++; 2193 2206 // return blank data for diffs to the left of the left handle (for right handel model) 2194 2207 // or to the right of the right handle (for left handel model) 2195 if ( ( 0 != $left_handle_at && $count <= $left_handle_at ) || 2196 ( 0 != $right_handle_at && $count > $right_handle_at )) { 2208 if ( ( 0 != $left_handle_at && $count <= $left_handle_at ) || 2209 ( 0 != $right_handle_at && $count > $right_handle_at )) { 2197 2210 $alltherevisions[] = array ( 2198 2211 'ID' => $revision->ID, 2199 2212 ); 2200 2201 2213 continue; 2202 2214 } 2203 2215 2204 $gravatar = get_avatar( $revision->post_author, 18 ); 2216 if ( $compare_two_mode ) { 2217 $compare_to_gravatar = get_avatar( $left_revision->post_author, 24 ); 2218 $compare_to_author = get_the_author_meta( 'display_name', $left_revision->post_author ); 2219 $compare_to_date = date_i18n( $datef, strtotime( $left_revision->post_modified ) ); 2220 2221 $revision_from_date_author = sprintf( 2222 /* translators: post revision title: 1: author avatar, 2: author name, 3: time ago, 4: date */ 2223 _x( '%1$s %2$s, %3$s ago (%4$s)', 'post revision title' ), 2224 $compare_to_gravatar, 2225 $compare_to_author, 2226 human_time_diff( strtotime( $left_revision->post_modified ), current_time( 'timestamp' ) ), 2227 $compare_to_date 2228 ); 2229 } 2230 2231 $gravatar = get_avatar( $revision->post_author, 24 ); 2205 2232 $author = get_the_author_meta( 'display_name', $revision->post_author ); 2206 2233 $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); 2207 2234 $revision_date_author = sprintf( … … 2213 2240 $date 2214 2241 ); 2215 2242 2243 $autosavef = __( '%1$s [Autosave]' ); 2244 $currentf = __( '%1$s [Current Revision]' ); 2245 2246 if ( ! $post = get_post( $post_id)) 2247 exit(); 2248 2249 if ( $left_revision->post_modified === $post->post_modified ) 2250 $revision_from_date_author = sprintf( $currentf, $revision_from_date_author ); 2251 elseif ( wp_is_post_autosave( $left_revision ) ) 2252 $revision_from_date_author = sprintf( $autosavef, $revision_from_date_author ); 2253 2254 if ( $revision->post_modified === $post->post_modified ) 2255 $revision_date_author = sprintf( $currentf, $revision_date_author ); 2256 elseif ( wp_is_post_autosave( $revision ) ) 2257 $revision_date_author = sprintf( $autosavef, $revision_date_author ); 2258 2259 $date_short_format = __( 'j M @ G:i' ); 2260 $date_short = date_i18n( $date_short_format, strtotime( $revision->post_modified ) ); 2261 2262 $revision_date_author_short = sprintf( 2263 '%s <strong>%s</strong><br />%s', 2264 $gravatar, 2265 $author, 2266 $date_short 2267 ); 2268 2216 2269 $restoreaction = wp_nonce_url( 2217 2270 add_query_arg( 2218 2271 array( 'revision' => $revision->ID, 2219 2272 'action' => 'restore' ), 2220 2273 admin_url( 'revision.php' ) 2221 2274 ), 2222 "restore-post_{$ compare_to}|{$revision->ID}"2275 "restore-post_{$revision->ID}" 2223 2276 ); 2224 2225 $alltherevisions[] = array ( 2277 // if this is a left handled calculation swap data 2278 if ( 0 != $right_handle_at ) { 2279 $tmp = $revision_from_date_author; 2280 $revision_from_date_author = $revision_date_author; 2281 $revision_date_author = $tmp; 2282 } 2283 if ( ( $compare_two_mode || 0 !== $previous_revision_id ) ) { 2284 $alltherevisions[] = array ( 2226 2285 'ID' => $revision->ID, 2227 2286 'revision_date_author' => $revision_date_author, 2228 2287 'revision_from_date_author' => $revision_from_date_author, 2288 'revision_date_author_short' => $revision_date_author_short, 2229 2289 'restoreaction' => urldecode( $restoreaction ), 2230 'revision_toload' => true 2290 'revision_toload' => true, 2291 'previous_revision_id' => $previous_revision_id 2231 2292 ); 2293 } 2294 $previous_revision_id = $revision->ID; 2232 2295 2233 2296 endforeach; 2234 2297 -
wp-admin/js/revisions.js
7 7 8 8 Model : Backbone.Model.extend({ 9 9 idAttribute : 'ID', 10 urlRoot : ajaxurl + '?action=revisions-data &compare_to=' + wpRevisionsSettings.post_id+11 '&show_autosaves= false&show_split_view=true&nonce=' + wpRevisionsSettings.nonce,10 urlRoot : ajaxurl + '?action=revisions-data' + 11 '&show_autosaves=true&show_split_view=true&nonce=' + wpRevisionsSettings.nonce, 12 12 defaults: { 13 13 ID : 0, 14 14 revision_date_author : '', 15 revision_date_author_short: '', 15 16 revisiondiff : '<div class="diff-loading"><div class="spinner"></div></div>', 16 17 restoreaction : '', 17 18 revision_from_date_author : '', 18 revision_toload : false 19 revision_toload : false, 20 lines_added : 0, 21 lines_deleted : 0, 22 scope_of_changes : 'none', 23 previous_revision_id : 0 19 24 }, 20 25 21 26 url : function() { 22 return this.urlRoot + '&single_revision_id=' + this.id; 27 if ( 1 === REVAPP._compareoneortwo ) { 28 return this.urlRoot + 29 '&single_revision_id=' + this.id + 30 '&compare_to=' + this.get( 'previous_revision_id' ) + 31 '&post_id=' + wpRevisionsSettings.post_id; 32 } else { 33 return this.urlRoot + 34 '&single_revision_id=' + this.id; 35 } 36 23 37 } 24 38 25 39 }), … … 33 47 _right_handle_revisions : null, 34 48 _revisionsInteractions : null, 35 49 _revisionsOptions : null, 36 _left_diff : 0,50 _left_diff : 1, 37 51 _right_diff : 1, 38 _autosaves : false,52 _autosaves : true, 39 53 _show_split_view : true, 40 54 _compareoneortwo : 1, 41 55 _left_model_loading : false, //keep track of model loads 42 56 _right_model_loading : false, //disallow slider interaction, also repeat loads, while loading 57 _tickmarkView : null, //the slider tickmarks 58 _has_tooltip : false, 43 59 44 //TODO add ability to arrive on specific revision45 60 routes : { 46 61 }, 47 62 48 viewrevision : function( revision ) {49 //coming soon50 },51 52 63 reload_toload_revisions : function( model_collection, reverse_direction ) { 53 64 var self = this; 54 65 var revisions_to_load = model_collection.where( { revision_toload : true } ); 55 //console.log(revisions_to_load);56 66 var delay=0; 57 _.each(revisions_to_load, function( the_model ) { 67 //match slider to passed revision_id 68 _.each( revisions_to_load, function( the_model ) { 69 if ( the_model.get( 'ID' ) == wpRevisionsSettings.revision_id ) { 70 self._right_diff = self._revisions.indexOf( the_model ) + 1; 71 } 72 73 }); 74 _.each( revisions_to_load, function( the_model ) { 58 75 the_model.urlRoot = model_collection.url; 59 76 _.delay( function() { 60 77 the_model.fetch( { 61 78 update : true, 62 79 add : false, 63 80 remove : false, 64 //async : false,65 81 success : function( model ) { 66 //console.log(model.get( 'ID' ) +'-'+self._revisions.at( self._right_diff ).get( 'ID' )); 67 if ( model.get( 'ID' ) === self._revisions.at( self._right_diff - 1 ).get( 'ID' ) ) { //reload if current model refreshed 68 //console.log('render'); 82 model.set( 'revision_toload', 'false' ); 83 84 //stop spinner when all models are loaded 85 if ( 0 === model_collection.where( { revision_toload : true } ).length ) 86 self.stop_model_loading_spinner(); 87 88 self._tickmarkView.render(); 89 90 var total_changes = model.get( 'lines_added' ) + model.get( 'lines_deleted'); 91 var scope_of_changes = 'vsmall'; 92 93 // Note: hard coded scope of changes 94 // TODO change to dynamic based on range of values 95 if ( total_changes > 1 && total_changes <= 3 ) { 96 scope_of_changes = 'small'; 97 } else if(total_changes > 3 && total_changes <= 5 ) { 98 scope_of_changes = 'med'; 99 } else if(total_changes > 5 && total_changes <= 10 ) { 100 scope_of_changes = 'large'; 101 } else if(total_changes > 10 ) { 102 scope_of_changes = 'vlarge'; 103 } 104 model.set( 'scope_of_changes', scope_of_changes ); 105 if ( 0 !== self._right_diff && 106 model.get( 'ID' ) === self._revisions.at( self._right_diff - 1 ).get( 'ID' ) ) { 107 //reload if current model refreshed 69 108 self._revisionView.render(); 70 109 } 110 71 111 } 72 112 } ); 73 113 }, delay ) ; 74 delay = delay + 200; //stagger model loads by 200 ms to avoid hammering server with requests114 delay = delay + 150; //stagger model loads to avoid hammering server with requests 75 115 } 76 116 ); 77 117 }, … … 83 123 84 124 stop_left_model_loading : function() { 85 125 this._left_model_loading = false; 86 $('.revisiondiffcontainer').removeClass('leftmodelloading');87 126 }, 88 127 89 128 start_right_model_loading : function() { … … 93 132 94 133 stop_right_model_loading : function() { 95 134 this._right_model_loading = false; 135 }, 136 137 stop_model_loading_spinner : function() { 96 138 $('.revisiondiffcontainer').removeClass('rightmodelloading'); 139 $('.revisiondiffcontainer').removeClass('leftmodelloading'); 97 140 }, 98 141 99 142 reloadmodel : function() { … … 104 147 } 105 148 }, 106 149 150 //load the models for the single handle mode 107 151 reloadmodelsingle : function() { 108 152 var self = this; 109 153 self._revisions.url = ajaxurl + '?action=revisions-data&compare_to=' + wpRevisionsSettings.post_id + 110 154 '&show_autosaves=' + self._autosaves + 111 '&show_split_view=' + REVAPP._show_split_view +155 '&show_split_view=' + self._show_split_view + 112 156 '&nonce=' + wpRevisionsSettings.nonce; 113 157 self.start_right_model_loading(); 114 this._revisions.fetch({ //reload revision data158 self._revisions.fetch({ //reload revision data 115 159 success : function() { 116 self.stop_right_model_loading(); 160 console.log('loaded'); 161 //self.stop_right_model_loading(); 162 //REVAPP._right_diff -= 1; 117 163 var revisioncount = self._revisions.length; 118 if ( self._right_diff > revisioncount ) //if right handle past rightmost, move 119 self._right_diff = revisioncount; 120 164 self._revisionView.model = self._revisions; 121 165 self._revisionView.render(); 122 166 self.reload_toload_revisions( self._revisions ); 167 self._tickmarkView.model = self._revisions; 168 self._tickmarkView.render(); 169 $( '#slider' ).slider( 'option', 'max', revisioncount-1 ); //TODO test this, if autsave option changed 170 $( '#slider' ).slider( 'value', self._right_diff - 1 ).trigger( 'slide' ); 123 171 124 $( '#slider' ).slider( 'option', 'max', revisioncount-1 ); //TODO test this, autsaves changed125 172 }, 126 173 127 174 error : function () { 128 175 self.stop_right_model_loading(); 129 //console.log( 'Error loading revision data' );130 176 } 131 177 132 178 }); 133 179 }, 134 180 181 //load the models for the left handle 135 182 reloadleft : function() { 136 183 var self = this; 137 184 self.start_left_model_loading(); 138 185 self._left_handle_revisions = new wp.revisions.Collection(); 186 139 187 self._left_handle_revisions.url = 140 188 ajaxurl + 141 189 '?action=revisions-data&compare_to=' + self._revisions.at( self._right_diff - 1 ).get( 'ID' ) + 142 190 '&post_id=' + wpRevisionsSettings.post_id + 143 '&show_autosaves=' + self._autosaves +144 '&show_split_view=' + self._show_split_view +191 '&show_autosaves=' + REVAPP._autosaves + 192 '&show_split_view=' + REVAPP._show_split_view + 145 193 '&nonce=' + wpRevisionsSettings.nonce + 146 194 '&right_handle_at=' + ( self._right_diff ); 147 195 … … 150 198 success : function(){ 151 199 self.stop_left_model_loading(); 152 200 self.reload_toload_revisions( self._left_handle_revisions ); 153 }, 201 self._tickmarkView.model = self._left_handle_revisions; 202 $( '#slider' ).slider( 'option', 'max', self._revisions.length ); 203 // ensure right handle not beyond length, in particular if viewing autosaves is switched from on to off 204 // the number of models in the collection might get shorter, this ensures right handle is not beyond last model 205 if ( self._right_diff > self._revisions.length ) 206 self._right_diff = self._revisions.length; 207 }, 154 208 155 209 error : function () { 156 //console.log( 'Error loading revision data' );157 210 self.stop_left_model_loading(); 158 211 } 159 212 }); 160 213 }, 161 214 215 //load the models for the right handle 162 216 reloadright : function() { 163 217 var self = this; 164 218 self.start_right_model_loading(); 165 219 self._right_handle_revisions = new wp.revisions.Collection(); 166 if ( 0 === self._left_diff ) { 220 167 221 self._right_handle_revisions.url = 168 222 ajaxurl + 169 '?action=revisions-data&compare_to=' + wpRevisionsSettings.post_id+223 '?action=revisions-data&compare_to=' + ( self._revisions.at( self._left_diff ).get( 'ID' ) -1)+ 170 224 '&post_id=' + wpRevisionsSettings.post_id + 171 '&show_autosaves=' + self._autosaves +172 '&show_split_view=' + self._show_split_view +225 '&show_autosaves=' + REVAPP._autosaves + 226 '&show_split_view=' + REVAPP._show_split_view + 173 227 '&nonce=' + wpRevisionsSettings.nonce; 174 } else {175 self._right_handle_revisions.url =176 ajaxurl +177 '?action=revisions-data&compare_to=' + self._revisions.at( self._left_diff - 1 ).get( 'ID' ) +178 '&post_id=' + wpRevisionsSettings.post_id +179 '&show_autosaves=' + self._autosaves +180 '&show_split_view=' + self._show_split_view +181 '&nonce=' + wpRevisionsSettings.nonce +182 '&left_handle_at=' + (self._left_diff ) ;183 }184 228 185 229 self._right_handle_revisions.fetch({ 186 230 187 231 success : function(){ 188 232 self.stop_right_model_loading(); 189 233 self.reload_toload_revisions( self._right_handle_revisions ); 234 self._tickmarkView.model = self._right_handle_revisions; 235 $( '#slider' ).slider( 'option', 'max', self._revisions.length ); 236 $( '#slider' ).slider( 'values', [ REVAPP._left_diff, REVAPP._right_diff] ).trigger( 'slide' ); 237 238 //REVAPP._revisionView.render(); 239 190 240 }, 191 241 192 242 error : function ( response ) { 193 //console.log( 'Error loading revision data - ' + response.toSource() );194 243 self.stop_right_model_loading(); 195 244 } 196 245 }); … … 198 247 }, 199 248 200 249 reloadleftright : function() { 250 this.start_right_model_loading(); 251 this.start_left_model_loading(); 201 252 this.reloadleft(); 202 253 this.reloadright(); 203 254 }, … … 208 259 initialize : function( options ) { 209 260 var self = this; //store the application instance 210 261 if (this._revisions === null) { 211 self._autosaves = '';212 262 self._revisions = new wp.revisions.Collection(); //set up collection 213 263 self.start_right_model_loading(); 214 264 self._revisions.fetch({ //load revision data 215 265 216 266 success : function() { 217 267 self.stop_right_model_loading(); 218 self.revisionDiffSetup(); 268 //self._right_handle_revisions = self._revisions; 269 self.completeApplicationSetup(); 219 270 } 220 271 }); 221 272 } 222 273 return this; 223 274 }, 224 275 225 revisionDiffSetup : function() { 276 addTooltip : function( handle, message ) { 277 278 handle.attr( 'title', '' ).tooltip({ 279 track: false, 280 281 position: { 282 my: "left-30 top-66", 283 at: "top left", 284 using: function( position, feedback ) { 285 $( this ).css( position ); 286 $( "<div>" ) 287 .addClass( "arrow" ) 288 .addClass( feedback.vertical ) 289 .addClass( feedback.horizontal ) 290 .appendTo( $( this ) ); 291 } 292 }, 293 show: false, 294 hide: false, 295 content: function() { 296 return message; 297 } 298 299 } ); 300 }, 301 /**/ 302 303 completeApplicationSetup : function() { 226 304 this._revisionView = new wp.revisions.views.View({ 227 305 model : this._revisions 228 306 }); 229 307 this._revisionView.render(); 230 $( '#diff_max, #diff_maxof' ).html( this._revisions.length );231 $( '#diff_count' ).html( REVAPP._right_diff );232 308 $( '#slider' ).slider( 'option', 'max', this._revisions.length - 1 ); 233 309 234 310 this.reload_toload_revisions( this._revisions ); 311 235 312 this._revisionsInteractions = new wp.revisions.views.Interact({ 236 313 model : this._revisions 237 314 }); 238 315 this._revisionsInteractions.render(); 239 316 317 this._tickmarkView = new wp.revisions.views.Tickmarks({ 318 model : this._revisions 319 }); 320 this._tickmarkView.render(); 321 this._tickmarkView.resetticks(); 322 323 240 324 /* 325 .on( 'mouseup', function( event ) { 326 REVAPP._keep_tooltip_open = false; 327 $( this ).find('.ui-slider-tooltip').hide(); 328 } ).on( 'mousedown', function( event ) { 329 REVAPP._keep_tooltip_open = true; 330 } ).on( 'mouseout', function( event ) { 331 if ( REVAPP._keep_tooltip_open) 332 event.stopImmediatePropagation(); 333 }); 334 */ 335 /* 241 336 //Options hidden for now, moving to screen options 242 337 this._revisionsOptions = new wp.revisions.views.Options({ 243 338 model : this._revisions … … 252 347 wp.revisions.Collection = Backbone.Collection.extend({ 253 348 model : wp.revisions.Model, 254 349 url : ajaxurl + '?action=revisions-data&compare_to=' + wpRevisionsSettings.post_id + 255 '&show_autosaves= false&show_split_view=true&nonce=' + wpRevisionsSettings.nonce,350 '&show_autosaves=true&show_split_view=true&nonce=' + wpRevisionsSettings.nonce, 256 351 257 352 initialize : function() { 258 353 } 259 354 } ); 260 355 261 356 _.extend(wp.revisions.views, { 357 358 //Ticks inside slider view 262 359 // 360 Tickmarks : Backbone.View.extend({ 361 el : $('#diff-slider-ticks')[0], 362 tagName : 'diff-slider-ticks-view', 363 className : 'diff-slider-ticks-container', 364 template : wp.template('revision-ticks'), 365 model : wp.revisions.Model, 366 367 resetticks : function() { 368 var slider_max = $( '#slider' ).slider( 'option', 'max'); 369 var slider_width = $( '#slider' ).width(); 370 var adjust_max = ( 2 === REVAPP._compareoneortwo ) ? 1 : 0; 371 var tick_width = Math.floor( slider_width / ( slider_max - adjust_max ) ); 372 373 //TODO: adjust right margins for wider ticks so they stay centered on handle stop point 374 375 //set minimum and maximum widths for tick marks 376 tick_width = (tick_width > 50 ) ? 50 : tick_width; 377 tick_width = (tick_width < 10 ) ? 10 : tick_width; 378 379 slider_width = tick_width * (slider_max - adjust_max ) +1; 380 381 $( '#slider' ).width( slider_width ); 382 $( '.diff-slider-ticks-wrapper' ).width( slider_width ); 383 $( '#diffslider' ).width( slider_width ); 384 $( '#diff-slider-ticks' ).width( slider_width ); 385 386 var a_tick_width = $( '.revision-tick' ).width(); 387 388 if ( tick_width !== a_tick_width ) { // is the width already set correctly? 389 $( '.revision-tick' ).each( function( ) { 390 $(this).css( 'margin-right', tick_width - 1 + 'px'); //space the ticks out using right margin 391 }); 392 393 if( 2 === REVAPP._compareoneortwo ) { 394 $( '.revision-tick' ).first().remove(); //TODO - remove the check 395 } 396 $( '.revision-tick' ).last().css( 'margin-right', '0' ); // last tick gets no right margin 397 } 398 399 }, 400 401 //render the tickmark view 402 render : function() { 403 var self = this; 404 405 if ( null !== self.model ) { 406 var addhtml = ""; 407 _.each ( self.model.models, function ( the_model ) { 408 addhtml = addhtml + self.template ( the_model.toJSON() ); 409 }); 410 self.$el.html( addhtml ); 411 412 } 413 self.resetticks(); 414 return self; 415 } 416 }), 417 418 // 263 419 //primary revision diff view 264 420 // 265 421 View : Backbone.View.extend({ … … 267 423 tagName : 'revisionvview', 268 424 className : 'revisionview-container', 269 425 template : wp.template('revision'), 270 revvapp : null,271 426 comparetwochecked : '', 272 427 draggingleft : false, 273 428 274 initialize : function(){275 },276 277 429 // 278 430 //render the revisions 279 431 // 280 432 render : function() { 281 433 var addhtml = ''; 282 434 //compare two revisions mode? 435 283 436 if ( 2 === REVAPP._compareoneortwo ) { 284 437 this.comparetwochecked = 'checked'; 285 438 if ( this.draggingleft ) { … … 310 463 this.$el.html( addhtml ); 311 464 if ( this.model.length < 3 ) { 312 465 $( 'div#comparetworevisions' ).hide(); //don't allow compare two if fewer than three revisions 466 } 467 if ( this.model.length < 2 ) { 468 $( 'div#diffslider' ).hide(); //don't allow compare two if fewer than three revisions 469 $( 'div.diff-slider-ticks-wrapper' ).hide(); 470 } 313 471 472 // 473 // add tooltips to the handles 474 // 475 if ( 2 === REVAPP._compareoneortwo ) { 476 REVAPP.addTooltip ( $( 'a.ui-slider-handle.left-handle' ), 477 ( REVAPP._right_diff >= REVAPP._revisions.length ) ? '' : REVAPP._revisions.at( REVAPP._left_diff ).get( 'revision_date_author_short' ) ); 478 REVAPP.addTooltip ( $( 'a.ui-slider-handle.right-handle' ), 479 ( REVAPP._right_diff >= REVAPP._revisions.length ) ? '' : REVAPP._revisions.at( REVAPP._right_diff ).get( 'revision_date_author_short' ) ); 480 } else { 481 REVAPP.addTooltip ( $( 'a.ui-slider-handle' ), 482 ( REVAPP._right_diff >= REVAPP._revisions.length ) ? '' : REVAPP._revisions.at( REVAPP._right_diff ).get( 'revision_date_author_short' ) ); 314 483 } 315 //console.log ( (this.model.at( REVAPP._right_diff - 1 )).url()); 484 485 // 486 // hide the restore button when on the last sport/current post data 487 // 488 if ( REVAPP._right_diff === REVAPP._revisions.length ){ 489 $( '.restore-button' ).hide(); 490 } else { 491 $( '.restore-button' ).show(); 492 } 493 316 494 return this; 317 495 }, 318 496 … … 326 504 // 327 505 clickcomparetwo : function(){ 328 506 self = this; 329 if ( $( 'input#comparetwo' ).is( ':checked' ) ) { 507 508 if ( $( 'input#comparetwo' ).is( ':checked' ) ) { //compare 2 mode 330 509 REVAPP._compareoneortwo = 2 ; 331 REVAPP.reloadleftright(); 332 } else { 333 REVAPP._compareoneortwo = 1 ; 334 REVAPP._revisionView.draggingleft = false; 335 REVAPP._left_diff = 0; 336 REVAPP.reloadmodelsingle(); 337 } 338 REVAPP._revisionsInteractions.render(); 510 511 if ( 1 === REVAPP._right_diff ) 512 REVAPP._right_diff = 2; 513 REVAPP._revisionView.draggingleft = false; 514 515 wpRevisionsSettings.revision_id = ''; // reset passed revision id so switching back to one handle mode doesn't re-select revision 516 REVAPP.reloadleftright(); 517 REVAPP._revisionView.model = REVAPP._right_handle_revisions; 518 519 } else { //compare one mode 520 REVAPP._compareoneortwo = 1 ; 521 REVAPP._revisionView.draggingleft = false; 522 //REVAPP._left_diff = 0; 523 //REVAPP._right_diff = (REVAPP._revisions.length <= REVAPP._right_diff ) ? REVAPP._right_diff + 1 : REVAPP._right_diff + 1; 524 REVAPP.reloadmodelsingle(); 525 } 526 //REVAPP._revisionView.render(); 527 REVAPP._revisionsInteractions.render(); 528 REVAPP._tickmarkView.render(); 529 339 530 } 340 531 }), 341 532 342 533 // 343 534 //options view for show autosaves and show split view options 344 535 // 536 /* DISABLED for now 345 537 Options : Backbone.View.extend({ 346 538 el : $('#backbonerevisionsoptions')[0], 347 539 tagName : 'revisionoptionsview', 348 540 className : 'revisionoptions-container', 349 541 template : wp.template('revisionoptions'), 350 542 351 initialize : function() {352 },353 354 543 //render the options view 355 544 render : function() { 356 545 var addhtml = this.template; … … 396 585 REVAPP.reloadmodel(); 397 586 } 398 587 }), 399 588 */ 400 589 // 401 590 //main interactions view 402 591 // … … 405 594 tagName : 'revisionvinteract', 406 595 className : 'revisionvinteract-container', 407 596 template : wp.template('revisionvinteract'), 408 _restoreword : '',409 597 410 598 initialize : function() { 411 this._restoreword = $( 'input#restore' ).attr( 'value' );412 599 }, 413 600 414 reset_restore_button : function() {415 $( 'input#restore' ).attr( 'value', this._restoreword + ' ' + REVAPP._revisions.at( REVAPP._right_diff - 1 ).get( 'ID' ) );416 },417 418 601 render : function() { 419 602 var self = this; 420 603 421 604 var addhtml = this.template; 422 605 this.$el.html( addhtml ); 423 $( '#diff_max, #diff_maxof' ).html( this.model.length );424 $( '#diff_count' ).html( REVAPP._right_diff );425 $( '#diff_left_count_inner' ).html( 0 === REVAPP._left_diff ? '' : 'revision' + REVAPP._left_diff );426 self.reset_restore_button();427 606 428 607 var modelcount = REVAPP._revisions.length; 429 608 … … 431 610 if ( 1 === REVAPP._compareoneortwo ) { 432 611 //set up the slider with a single handle 433 612 slider.slider({ 434 value 435 min 436 max 437 step 613 value: REVAPP._right_diff-1, 614 min: 0, 615 max: modelcount-1, 616 step: 1, 438 617 618 439 619 //slide interactions for one handles slider 440 620 slide : function( event, ui ) { 441 if ( REVAPP._right_model_loading ) //left model stoll loading, prevent sliding left handle442 return false;443 621 444 REVAPP._right_diff =( ui.value+1 ); 445 $( '#diff_count' ).html( REVAPP._right_diff ); 622 REVAPP._right_diff = ( ui.value + 1 ); 446 623 REVAPP._revisionView.render(); 447 self.reset_restore_button(); 448 } 624 /* 625 $( 'a.ui-slider-handle' ).tooltip( { 626 content: REVAPP._revisions.at( ui.value ).get( 'revision_date_author_short' ), 627 position: { 628 my: "top-65", 629 using: function( position, feedback ) { 630 $( this ).css( position ); 631 $( "<div>" ) 632 .addClass( "arrow" ) 633 .addClass( feedback.vertical ) 634 .addClass( feedback.horizontal ) 635 .appendTo( this ); 636 } 637 } 638 });//.trigger( 'close' ).trigger( 'open' ); 639 */ 640 } 449 641 }); 450 642 $( '.revisiondiffcontainer' ).removeClass( 'comparetwo' ); 643 451 644 } else { //comparing more than one, eg 2 452 645 //set up the slider with two handles 453 646 slider.slider({ … … 460 653 //in two handled mode when user starts dragging, swap in precalculated diff for handle 461 654 start : function (event, ui ) { 462 655 var index = $( ui.handle ).index(); //0 (left) or 1 (right) 463 464 656 switch ( index ) { 465 657 case 1: //left handle drag 466 if ( REVAPP._left_model_loading ) //left model st oll loading, prevent sliding left handle658 if ( REVAPP._left_model_loading ) //left model still loading, prevent sliding left handle 467 659 return false; 468 660 661 REVAPP._revisionView.draggingleft = true; 662 469 663 if ( REVAPP._revisionView.model !== REVAPP._left_handle_revisions && 470 null !== REVAPP._left_handle_revisions ) 664 null !== REVAPP._left_handle_revisions ) { 471 665 REVAPP._revisionView.model = REVAPP._left_handle_revisions; 666 REVAPP._tickmarkView.model = REVAPP._left_handle_revisions; 667 REVAPP._tickmarkView.render(); 668 } 472 669 473 REVAPP._revisionView.draggingleft = true;474 670 REVAPP._left_diff_start = ui.values[ 0 ]; 475 671 break; 476 672 477 673 case 2: //right 478 if ( REVAPP._right_model_loading ) //right model stoll loading, prevent sliding right handle674 if ( REVAPP._right_model_loading || 0 === REVAPP._right_handle_revisions.length) //right model still loading, prevent sliding right handle 479 675 return false; 480 676 481 //one extra spot at left end when comparing two482 677 if ( REVAPP._revisionView.model !== REVAPP._right_handle_revisions && 483 null !== REVAPP._right_handle_revisions ) 678 null !== REVAPP._right_handle_revisions ) { 484 679 REVAPP._revisionView.model = REVAPP._right_handle_revisions; 680 REVAPP._tickmarkView.model = REVAPP._right_handle_revisions; 681 REVAPP._tickmarkView.render(); 682 } 485 683 486 684 REVAPP._revisionView.draggingleft = false; 487 685 REVAPP._right_diff_start = ui.values[ 1 ]; … … 501 699 if ( REVAPP._left_model_loading ) //left model still loading, prevent sliding left handle 502 700 return false; 503 701 504 REVAPP._left_diff = ui.values[ 0 ] - 1; //one extra spot at left end when comparing two702 REVAPP._left_diff = ui.values[ 0 ]; 505 703 break; 506 704 507 705 case 2: //right 508 706 if ( REVAPP._right_model_loading ) //right model still loading, prevent sliding right handle 509 707 return false; 510 708 511 REVAPP._right_diff = ui.values[ 1 ] - 1;709 REVAPP._right_diff = ui.values[ 1 ]; 512 710 break; 513 711 } 514 712 515 $( '#diff_count' ).html( REVAPP._right_diff );516 517 713 if ( 0 === REVAPP._left_diff ) { 518 714 $( '.revisiondiffcontainer' ).addClass( 'currentversion' ); 519 715 520 716 } else { 521 717 $( '.revisiondiffcontainer' ).removeClass( 'currentversion' ); 522 $( '#diff_left_count_inner' ).html( REVAPP._left_diff );523 718 } 524 719 525 REVAPP._revisionView.render(); //render the diff view526 self.reset_restore_button(); 720 REVAPP._revisionView.render(); 721 527 722 }, 528 723 529 724 //when the user stops sliding in 2 handle mode, recalculate diffs … … 536 731 537 732 switch ( index ) { 538 733 case 1: //left 734 539 735 //left handle dragged & changed, reload right handle model 540 if ( ! ( REVAPP._left_diff_start === ui.values[ 0 ] || REVAPP._left_model_loading ))736 if ( REVAPP._left_diff_start !== ui.values[ 0 ] ) 541 737 REVAPP.reloadright(); 542 738 543 739 break; 544 740 545 741 case 2: //right 742 //REVAPP._right_diff = ( 1 >= REVAPP._right_diff ) ? 1 : REVAPP._right_diff-1; 546 743 //right handle dragged & changed, reload left handle model if changed 547 if ( ! ( REVAPP._right_diff_start === ui.values[ 1 ] || REVAPP._right_model_loading ) ) {744 if ( REVAPP._right_diff_start !== ui.values[ 1 ] ) 548 745 REVAPP.reloadleft(); 549 } 746 550 747 break; 551 748 } 552 749 } 553 750 } 554 751 }); 555 752 $( '.revisiondiffcontainer' ).addClass( 'comparetwo' ); 753 $( '#diffslider a.ui-slider-handle' ).first().addClass( 'left-handle' ).next().addClass( 'right-handle' ); 556 754 } 557 755 558 756 return this; … … 571 769 572 770 REVAPP._revisionView.render(); 573 771 574 $( '#diff_count' ).html( REVAPP._right_diff );575 772 $( '#slider' ).slider( 'value', REVAPP._right_diff - 1 ).trigger( 'slide' ); 576 this.reset_restore_button();577 773 }, 578 774 579 775 //go the the previous revision … … 583 779 584 780 REVAPP._revisionView.render(); 585 781 586 $( '#diff_count' ).html( REVAPP._right_diff );587 782 $( '#slider' ).slider( 'value', REVAPP._right_diff - 1 ).trigger( 'slide' ); 588 this.reset_restore_button();589 783 } 590 784 }) 591 785 }); 592 786 593 787 //instantiate Revision Application 594 788 REVAPP = new wp.revisions.App(); 595 //TODO consider enable back button to step back thru states?596 //Backbone.history.start({pushState: true});597 789 598 790 }(jQuery)); -
wp-admin/revision.php
17 17 case 'restore' : 18 18 if ( ! $revision = wp_get_post_revision( $revision_id ) ) 19 19 break; 20 20 21 if ( ! current_user_can( 'edit_post', $revision->post_parent ) ) 21 22 break; 23 24 22 25 if ( ! $post = get_post( $revision->post_parent ) ) 23 26 break; 24 27 25 // Revisions disabled and we're not looking at an autosave26 if ( ( ! WP_POST_REVISIONS || ! post_type_supports( $post->post_type, 'revisions' ) ) && ! wp_is_post_autosave( $revision )) {28 // Revisions disabled (previously checked autosavegs && ! wp_is_post_autosave( $revision )) 29 if ( ( ! WP_POST_REVISIONS || ! post_type_supports( $post->post_type, 'revisions' ) ) ) { 27 30 $redirect = 'edit.php?post_type=' . $post->post_type; 28 31 break; 29 32 } 30 check_admin_referer( "restore-post_{$post->ID}|{$revision->ID}" );31 33 32 //store revision event in post meta 33 $restore_details = array( 34 'restored_revision_id' => $revision->ID, 35 'restored_by_user' => get_current_user_id(), 36 'restored_time' => time() 37 ); 38 update_post_meta( $post->ID, '_post_restored_from', $restore_details ); 34 check_admin_referer( "restore-post_{$revision->ID}" ); 39 35 40 36 wp_restore_post_revision( $revision->ID ); 41 37 $redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) ); … … 58 54 } 59 55 60 56 $post_title = '<a href="' . get_edit_post_link() . '">' . get_the_title() . '</a>'; 61 $revision_title = wp_post_revision_title( $revision, false );62 57 $h2 = sprintf( __( 'Compare Revisions of “%1$s”' ), $post_title ); 63 58 $title = __( 'Revisions' ); 64 59 … … 80 75 $parent_file = $submenu_file = 'edit.php?post_type=' . $post->post_type; 81 76 else 82 77 $parent_file = $submenu_file = 'edit.php'; 83 84 78 wp_enqueue_script( 'revisions' ); 85 79 86 80 require_once( './admin-header.php' ); 87 81 88 82 //TODO - Some of the translations below split things into multiple strings that are contextually related and this makes it pretty impossible for RTL translation. 89 83 //TODO can we pass the context in a better way 84 $wpRevisionsSettings = array( 'post_id' => $post->ID, 85 'nonce' => wp_create_nonce( 'revisions-ajax-nonce' ), 86 'revision_id' => $revision_id ); 87 wp_localize_script( 'revisions', 'wpRevisionsSettings', $wpRevisionsSettings ); 88 89 $comparetworevisionslink = get_edit_post_link( $revision->ID ); 90 90 ?> 91 <script type="text/javascript">92 var wpRevisionsSettings = <?php echo json_encode( array( 'post_id' => $post->ID, 'nonce' => wp_create_nonce( 'revisions-ajax-nonce' ) ) ); ?>;93 </script>94 <?php95 $comparetworevisionslink = get_edit_post_link( $revision->ID );96 ?>97 91 98 <div id="backbonerevisionsoptions"></div> 92 <div id="backbonerevisionsoptions"> 93 </div> 99 94 <div class="wrap"> 100 <div class="icon32 icon32-posts-post" id="icon-edit"><br></div> 95 <div class="icon32 icon32-posts-post" id="icon-edit"> 96 <br> 97 </div> 101 98 <div class="revisiondiffcontainer diffsplit currentversion rightmodelloading"> 102 <div id="modelsloading" class="updated message"><span class="spinner" ></span> <?php _e( 'Calculating revision diffs' ); ?></div> 99 <div id="modelsloading" class="updated message"> 100 <span class="spinner" ></span> <?php _e( 'Calculating revision diffs' ); ?> 101 </div> 103 102 <h2 class="long-header"><?php echo $h2; ?></h2> 104 <div id="backbonerevisionsinteract"></div> 105 <div id="backbonerevisionsdiff"></div> 103 <div class="diff-slider-ticks-wrapper"> 104 <div id="diff-slider-ticks"> 105 </div> 106 </div> 107 <div id="backbonerevisionsinteract"> 108 </div> 109 <div id="backbonerevisionsdiff"> 110 </div> 106 111 <hr /> 107 112 </div> 108 113 </div> 109 114 110 115 <script id="tmpl-revision" type="text/html"> 116 <div id="diffsubheader" class="diff-left-hand-meta-row"> 117 <div id="diff_from_current_revision"> 118 <?php printf( '<b>%1$s</b> %2$s.' , __( 'From:' ), __( 'the current version' ) ); ?> 119 </div> 120 <div id="difftitlefrom"> 121 <div class="diff-from-title"><?php _e( 'From:' ); ?></div>{{{ data.revision_from_date_author }}} 122 </div> 123 </div> 124 111 125 <div id="diffsubheader"> 112 <span id="diff_from_current_revision"><?php _e( 'Current version' ); ?><?php _e( '- compared to -' ); ?></span> 113 <div id="difftitlefrom">{{{ data.revision_from_date_author }}} <?php _e( '- compared to -' ); ?></div> 114 <div id="difftitle">{{{ data.revision_date_author }}}</div> 115 <div id="diffcancel"><input class="button" onClick="document.location='<?php echo get_edit_post_link( $post->ID ); ?>'" type="submit" id="cancel" value="<?php esc_attr_e( 'Cancel' )?>" /></div> 116 <div id="diffrestore"><input class="button button-primary" onClick="document.location='{{{ data.restoreaction }}}'" type="submit" id="restore" value="<?php esc_attr_e( 'Restore revision ID' )?>" /></div> 117 <div id="comparetworevisions"><input type="checkbox" id="comparetwo" value="comparetwo" {{{ data.comparetwochecked }}} name="comparetwo"/> <label for="comparetwo"><?php esc_attr_e( 'Compare two revisions' ); ?></a></div> </div> 126 <div id="difftitle"> 127 <div class="diff-to-title"><?php _e( 'To:' ); ?></div>{{{ data.revision_date_author }}} 128 </div> 129 <div id="diffrestore"> 130 <input class="button button-primary restore-button" onClick="document.location='{{{ data.restoreaction }}}'" type="submit" id="restore" value="<?php esc_attr_e( 'Restore This Revision' )?>" /> 131 </div> 132 <div id="comparetworevisions"> 133 <input type="checkbox" id="comparetwo" value="comparetwo" {{{ data.comparetwochecked }}} name="comparetwo"/> 134 <label for="comparetwo"><?php esc_attr_e( 'Compare two revisions' ); ?></a></label> 135 </div> 136 </div> 137 118 138 <div id="removedandadded"> 119 139 <div id="removed"><?php _e( 'Removed -' ); ?></div> 120 140 <div id="added"><?php _e( 'Added +' ); ?></div> … … 124 144 125 145 <script id="tmpl-revisionvinteract" type="text/html"> 126 146 <div id="diffheader"> 127 <div id="diffprevious"><input class="button" type="submit" id="previous" value="<?php esc_attr_e( 'Previous' ); ?>" /></div> 128 <div id="diffnext"><input class="button" type="submit" id="next" value="<?php esc_attr_e( 'Next' ); ?>" /></div> 129 <div id="diffslider"> 130 <div id="revisioncount"> 131 <?php _e( 'Comparing' ); ?> 132 <span id="diff_left_count"> <?php _e( 'revision' ); ?></span> <span id="diff_left_count_inner"></span> 133 <span id="diff_left_current_revision"><?php _e( 'current version' ); ?></span> 134 <span id="diff_revision_from">{{{ data.diff_revision_from }}}</span> 135 <?php _e( ' to revision' ); ?> 136 <span id="diff_count">{{{ data.current_diff }}}</span> 137 <?php _e( ' of ' ); ?> 138 <span id="diff_max" ></span> 139 </div> 140 141 <div id="slider" class="wp-slider"></div> 147 <div id="diffprevious"><input class="button" type="submit" id="previous" value="<?php esc_attr_e( 'Previous' ); ?>" /> 142 148 </div> 149 <div id="diffnext"><input class="button" type="submit" id="next" value="<?php esc_attr_e( 'Next' ); ?>" /> 150 </div> 151 <div id="diffslider"> 152 <div id="slider" class="wp-slider"> 153 </div> 154 </div> 143 155 </div> 144 156 </script> 157 <script id="tmpl-revision-ticks" type="text/html"> 158 <div class="revision-tick revision-toload{{{ data.revision_toload }}} revision-scopeofchanges-{{{ data.scope_of_changes }}}"> 159 </div> 160 </script> 145 161 <?php 146 162 /* 147 163 TODO Convert these into screen options -
wp-admin/css/colors-fresh.css
175 175 .sidebar-name, 176 176 #nav-menu-header, 177 177 #nav-menu-footer, 178 .menu-item-handle, 179 .wp-slider .ui-slider-handle { 178 .menu-item-handle { 180 179 background: #f1f1f1; 181 180 background-image: -webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9)); 182 181 background-image: -webkit-linear-gradient(bottom, #ececec, #f9f9f9); … … 185 184 background-image: linear-gradient(to top, #ececec, #f9f9f9); 186 185 } 187 186 187 188 188 189 .widget .widget-top, 189 190 .postbox h3, 190 191 .stuffbox h3 { … … 1378 1379 background-color: #e9f6ea; 1379 1380 } 1380 1381 1382 .diff-to-title { 1383 color: #0080AA; 1384 } 1385 1381 1386 #diffsubheader{ 1382 1387 background-color: #f7f7f7; 1383 1388 } 1384 1389 1390 .comparetwo#diffsubheader.diff-left-hand-meta-row { 1391 background-color: #fcfcfc; 1392 } 1393 1394 .revision-tick.revision-toloadtrue { 1395 background-color: #9999cc; 1396 background: url(../images/wpspin_light.gif) no-repeat; 1397 background-position: middle; 1398 background-size: 1px 10px; 1399 } 1400 1401 .revision-tick.revision-toloadfalse { 1402 background-color: #aaa; 1403 } 1404 1385 1405 #att-info { 1386 1406 background-color: #e4f2Fd; 1387 1407 } 1388 1408 1409 body .ui-tooltip { 1410 border-color: #d7d7d7; 1411 background-color: #fff; 1412 } 1413 1389 1414 /* jQuery UI Slider */ 1390 1415 .wp-slider.ui-slider { 1391 1416 border-color: #d7d7d7; … … 1393 1418 } 1394 1419 1395 1420 .wp-slider .ui-slider-handle { 1396 border-color: #d7d7d7;1421 border-color: none; 1397 1422 } 1398 1423 1424 .wp-slider .ui-slider-handle.left-handle { 1425 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAA3NCSVQICAjb4U/gAAABAlBMVEXR2uHM1dzCzNW4ydOzxtSxw9Gqwc+bs7+Ss8SVscaZrLqQq7yNrMCKqr+EqsGDqb6GpruCpbl8pL15o7t1n7hwnLVika1djq5giqJXiqlYiqNJgp9ieYlDfqA/epw3dpk7dpg2dpo3dZo6dZc4dJY4dJg3cZY2bpE1bosxaIYxZIMrYX0tXnwtXHYsWHEnVW0mTmglT2cjTGIhRVsfQlYaN0kYM0QULDgTKTYRJzQTJzINISoLHCYNGyYKGCEIFxwJEhcJEhsHEhQDDAkHCg8EBwwCBwoEBAQBAwIBAQEBAQMAAgEBAAAAAAQAAQMBAAIAAAICAAEBAQAAAQAAAAD///+62qV+AAAAVnRSTlP/////////////////////////////////////////////////////////////////////////////////////////////////////////////////AEpNbNkAAAAJcEhZcwAACusAAArrAYKLDVoAAAAUdEVYdENyZWF0aW9uIFRpbWUAMy85LzEzrdD8jAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAACbSURBVBiVVcvVDoNQEEXRqbu781B3d/dQQknh/P+vtBQKt/tpsnKGEOW4klkQFFvIsqwYzUJUvCts1wJl9gIruxT5hpLEyMBLKG+Z0ToJgrPLTDqOjyCxNN7mcahiaz50uDWsX0Fk+tKahKGJpX55qp1qpAsCY0lt5MdPUD2KoniowBRXn+f5Xp4RZDfCKg1W0D637P/iznn06w0M+083NZW9ZwAAAABJRU5ErkJggg==); 1426 } 1427 1428 .wp-slider .ui-slider-handle.ui-state-active.left-handle { 1429 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAA3NCSVQICAjb4U/gAAAAzFBMVEXZ5ejU4eXM3ODG2NzE1tvB1Nq90deux86sxs2qxcynwsqlwcmjwMihvseevMWdvMSbusOXuMGTtb6IrbiHrLeCqbSBqLN/p7J3oa11oKxzn6tvnKhrmaZqmKVpmKVol6RllaJhk6Bej51djptaiZZZiJVYhpNWg5BUf4xSfYlRfIhPeYRMdYBKcXxFaXNDZnA+X2g9XmY8XGU4VV43VFw2U1s0UFgyTVQxS1IwSVAuR00sREosQ0orQkgqQEYpPkQoPkMoPUMoPUL///8pY4MvAAAARHRSTlP/////////////////////////////////////////////////////////////////////////////////////////AHHSjxIAAAAJcEhZcwAACusAAArrAYKLDVoAAAAUdEVYdENyZWF0aW9uIFRpbWUAMy85LzEzrdD8jAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAACUSURBVBiVVctXEoJQEETRMaIo5qwF5hwxYOY9ev97EiQ43q+pUz2EYk9n5UElU0rpRO016toO79WhxlVysWqkroRgsswSjAsbnasgpGdsMk25gooZvR3K8CQxCuU9jH8FhZ3022rwJTZ4CK9nnwJBbiO8yVpFKDButm1bOn6iLFyZt5igeZLHOrhgfJ8k/yXTVoLrAxo1P5iCdUg7AAAAAElFTkSuQmCC); 1430 } 1431 1432 .wp-slider .ui-slider-handle { 1433 /* Slider drag Triangle CSS */ 1434 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAA3NCSVQICAjb4U/gAAAA8FBMVEU2dZipwNBJl8VGmcX///+EpLlBgqpymrNFjru3ydNWiKs6eZzY4uuRrL08faPL3OZBjLSBqsCTssRHlMJEf59cj657o7xKl8OEqsE9gag2dJtEkb+ct8iZs8BHmMePq8BejKZAiK5llK5FjrlJl8c6dZdGl8avxdBJlcZ4nbc6ep6XrbpKgZ+Lqr5KmcdIkbqsws1Gk8E+f6c4dptaiadFirRKl8V8pblImcNIl8eGpruVscZCh7BMlsdIlcFImchEkbs9eJpCjbdGjbk8fJ84dp02dpo8gatMlsM2dps8faVAg61Ej71Ek75IksFIlcOaLCw7AAAAUHRSTlP/////AP///////////////////////////////////////////////////////////////////////////////////////////////////xB6m5UAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAUdEVYdENyZWF0aW9uIFRpbWUAMy85LzEzrdD8jAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAACaSURBVBiVVcxZD8FAGIXhjxzUVktQgqKmo7ZYhkgsiS1tQuj//zeomo736uS5OFSo2W6UXc/R5hxXW5foxDlXqUKZx0GFZpXynuM4kXhjgjgyJkGzQIjpvi9Fx1uQ0iQUh4GkR/Ini0CQ2IfQ24YC4X8T+Mn0zj8lO1IgnqZpzlxE0m4YhrFsKYJVn126UGV+W1wHf4LdpByuF0goFKI7tv/dAAAAAElFTkSuQmCC); 1435 } 1436 1399 1437 .wp-slider .ui-slider-handle.ui-state-hover, 1400 1438 .wp-slider .ui-slider-handle.ui-state-focus { 1401 border-color: #aaa; 1439 border-color: none; 1440 outline: none; 1402 1441 } 1403 1442 1404 1443 .wp-slider .ui-slider-handle.ui-state-active { 1405 border-color: #aaa; 1406 background: #eee; 1407 background-image: -webkit-gradient(linear, left bottom, left top, from(#f9f9f9), to(#ececec)); 1408 background-image: -webkit-linear-gradient(bottom, #f9f9f9, #ececec); 1409 background-image: -moz-linear-gradient(bottom, #f9f9f9, #ececec); 1410 background-image: -o-linear-gradient(bottom, #f9f9f9, #ececec); 1411 background-image: linear-gradient(to top, #f9f9f9, #ececec); 1444 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAA3NCSVQICAjb4U/gAAAA51BMVEUgZpDkzc0yd6f///8mcqFJm8cjbZZzr80mg78lh8BDk8UngLl+s9AmfKk4hrGeweBaoMhNlMORwt4nd6Zdm8BAjMEnf7RYmsMkb50mhsFWlsYhZ5ImhbwocZg0f61Lk8E9i7twqNBgo8VSmMUofLBcm8o3faUpfK8mh8Aia5MgZpFMmcgpeapDmcJjo8sliMEmh70nhLkkcKAqgLF2sc8sc5ojbZsngrMkh8EnfKw1eaUjbpkkapImeKQgaJAohb0mh8MmhcMng7kkcKEpf68iZ48haJMmhb8kicEmc6MibJkia5UnhLsw1mWvAAAATXRSTlP/AP8A/////////////////////////////////////////////////////////////////////////////////////////////////9/iR18AAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAUdEVYdENyZWF0aW9uIFRpbWUAMy85LzEzrdD8jAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAACaSURBVBiVVc15D8FAEIfh+Ymj6761LIrSiCNVVyjbRGgifP/PQ6q22/evyZPJDNXzD6G0qNDq5PtO3DJDFyfRpk+po2Eo0h5Qx9U0LRa3SejdlR2rDMLI41yKh6/AtOSzUiuU4kvemSMUDBsRXGuRIHj/CvCXyTNcSXelQBQYY1uBWMY651xfK4KzbdgzqJI73LK7hGC6r0bTB5apIhqIH/YIAAAAAElFTkSuQmCC); 1412 1445 } 1413 1446 1414 1447 /* edit image */ -
wp-admin/css/wp-admin.css
3552 3552 vertical-align: middle; 3553 3553 } 3554 3554 3555 .diff-from-title, 3556 .diff-to-title { 3557 font-size: 14px; 3558 font-weight: bold; 3559 width:60px; 3560 text-align: right; 3561 float: left; 3562 margin-right: 5px; 3563 } 3564 3555 3565 .revisiondiffcontainer { 3556 3566 width: 96%; 3557 3567 } … … 3560 3570 margin: 2px; 3561 3571 } 3562 3572 3563 #diffrestore, 3564 #diffnext, 3565 #diffcancel { 3573 #diffnext { 3566 3574 float: right; 3567 3575 margin-right: 5px; 3568 3576 } 3569 3577 3578 #diffrestore input{ 3579 margin-left: 10px; 3580 } 3581 3570 3582 #diffprevious, 3571 3583 #difftitle, 3572 3584 #difftitlefrom, … … 3578 3590 3579 3591 #diffprevious, 3580 3592 #diffnext { 3581 margin-top: 7px;3582 3593 height: 30px; 3583 3594 } 3584 3595 … … 3590 3601 #diffheader { 3591 3602 border-bottom: 1px solid #dfdfdf; 3592 3603 width: 100%; 3593 height: 4 5px;3594 line-height: 4 5px;3595 padding-top: 10px;3604 height: 40px; 3605 line-height: 40px; 3606 padding-top: 30px; 3596 3607 } 3597 3608 3598 #diffsubheader { 3599 border-bottom: 1px solid #dfdfdf; 3609 #diffsubheader,.diff-left-hand-meta-row { 3600 3610 width: 100%; 3601 3611 height:35px; 3602 3612 line-height: 35px; 3613 display: block; 3603 3614 } 3604 3615 3605 #diffslider 3616 #diffslider{ 3606 3617 width: 70%; 3607 3618 margin-left: auto; 3608 3619 margin-right: auto; 3609 3620 text-align: center; 3610 height: 3.5em; 3621 height: 0.8em; 3622 margin-top: 20px; 3611 3623 } 3612 3624 3625 .diff-slider-ticks-wrapper { 3626 margin-left: auto; 3627 margin-right: auto; 3628 text-align: center; 3629 } 3630 3631 #diff-slider-ticks { 3632 position: absolute; 3633 margin-top: 50px; 3634 z-index: 1; 3635 } 3636 3613 3637 #revisioncount { 3614 3638 width: 50%; 3615 3639 margin-left: auto; … … 3677 3701 3678 3702 #comparetworevisions { 3679 3703 float: right; 3704 position: absolute; 3705 top: 10px; 3706 right: 10px; 3680 3707 line-height: 35px; 3681 3708 padding-right: 5px; 3682 3709 } … … 3686 3713 } 3687 3714 3688 3715 #difftitle img, 3689 #difftitlefrom img { 3716 #difftitlefrom img, 3717 .post-revisions li img { 3690 3718 vertical-align: middle; 3691 3719 margin-left: 5px; 3692 3720 } 3721 .post-revisions li { 3722 vertical-align: middle; 3723 height: 28px; 3724 } 3693 3725 3694 3726 #showsplitviewoption, 3695 3727 #toggleshowautosavesoption { … … 3712 3744 .comparetwo #diffprevious, 3713 3745 .comparetwo #diffnext, 3714 3746 span#diff_left_current_revision, 3715 span#diff_from_current_revision,3747 #diff_from_current_revision, 3716 3748 .currentversion span#diff_left_count, 3717 3749 .currentversion span#diff_left_count_inner, 3718 .c urrentversion #difftitlefrom,3719 .comparetwo.currentversion #difftitlefrom{3750 .comparetwo.currentversion #diff_from_current_revision, 3751 #diffsubheader.diff-left-hand-meta-row { 3720 3752 display: none; 3721 3753 } 3722 3754 … … 3724 3756 span#diff_left_count, 3725 3757 span#diff_left_count_inner, 3726 3758 .comparetwo #difftitlefrom, 3727 .comparetwo.currentversion span#diff_from_current_revision,3728 3759 .leftmodelloading #modelsloading, 3729 3760 .rightmodelloading #modelsloading, 3730 3761 .leftmodelloading #modelsloading .spinner, 3731 3762 .rightmodelloading #modelsloading .spinner, 3732 {3733 display: inline;3763 .comparetwo #diffsubheader.diff-left-hand-meta-row { 3764 display: block; 3734 3765 } 3735 3766 3767 .revision-tick { 3768 width: 1px; 3769 float: left; 3770 margin-right: 15px; 3771 height: 11px; 3772 padding: 0; 3773 margin-left: 0px; 3774 } 3775 3776 .revision-tick.revision-scopeofchanges-vsmall { 3777 width: 1px; 3778 background-color: #aaa; 3779 } 3780 3781 .revision-tick.revision-scopeofchanges-small { 3782 width: 2px; 3783 background-color: #aaa; 3784 margin-left: -1px; 3785 } 3786 3787 .revision-tick.revision-scopeofchanges-med { 3788 width: 3px; 3789 margin-left: -2px; 3790 background-color: #666; 3791 } 3792 3793 .revision-tick.revision-scopeofchanges-large { 3794 width: 4px; 3795 margin-left: -3px; 3796 background-color: #333; 3797 } 3798 3799 .revision-tick.revision-scopeofchanges-vlarge { 3800 margin-left: -3px; 3801 width: 4px; 3802 background-color: #111; 3803 left: 1; 3804 } 3805 3736 3806 .diff-loading { 3737 3807 margin-top: 50px; 3738 3808 width: 100%; … … 3747 3817 float: none; 3748 3818 } 3749 3819 3750 #difftitlefrom {3751 float: left;3752 display: none;3753 }3754 3755 3820 #modelsloading { 3756 3821 float: right; 3822 position: absolute; 3757 3823 line-height: 30px; 3758 3824 display: none; 3759 3825 clear: none; 3760 margin: 0;3826 right: 170px; 3761 3827 margin-top: -40px; 3762 3828 } 3763 3829 3764 3830 #modelsloading .spinner { 3765 3831 float: left; 3766 3832 } 3767 3833 3834 .ui-tooltip-content img { 3835 float: left; 3836 margin-right: 5px; 3837 } 3838 3839 3840 3841 /* jQuery UI Tooltip 1.10.1 */ 3842 3843 .ui-tooltip { 3844 padding: 8px; 3845 position: absolute; 3846 z-index: 9999; 3847 max-width: 300px; 3848 min-width: 130px; 3849 } 3850 3851 body .ui-tooltip { 3852 border-width: 1px; 3853 } 3854 3855 .ui-tooltip, .arrow:after { 3856 border: 1px solid #d7d7d7; 3857 } 3858 3859 .ui-tooltip { 3860 padding: 5px 10px; 3861 } 3862 3863 .arrow { 3864 width: 70px; 3865 height: 16px; 3866 overflow: hidden; 3867 position: absolute; 3868 left: 50%; 3869 margin-left: -35px; 3870 bottom: -16px; 3871 z-index: 99999; 3872 3873 } 3874 3875 .arrow.top { 3876 top: -16px; 3877 bottom: auto; 3878 } 3879 3880 .arrow.left { 3881 left: 20%; 3882 } 3883 3884 .arrow:after { 3885 content: ""; 3886 position: absolute; 3887 left: 20px; 3888 top: -20px; 3889 width: 25px; 3890 height: 25px; 3891 background-color: #FFF; 3892 -webkit-transform: rotate(45deg); 3893 -moz-transform: rotate(45deg); 3894 -ms-transform: rotate(45deg); 3895 -o-transform: rotate(45deg); 3896 tranform: rotate(45deg); 3897 } 3898 3899 .arrow.top:after { 3900 bottom: -20px; 3901 top: auto; 3902 } 3903 3768 3904 /* jQuery UI Slider */ 3769 3905 3770 3906 .wp-slider.ui-slider { … … 3779 3915 .wp-slider .ui-slider-handle { 3780 3916 position: absolute; 3781 3917 z-index: 2; 3782 width: 1.2em; 3783 height: 1.2em; 3784 border-width: 1px; 3785 border-style: solid; 3786 border-radius: 3px; 3918 width: 17px; 3919 height: 17px; 3920 border: none; 3787 3921 } 3788 3922 3789 3923 .wp-slider .ui-slider-range {