Ticket #23497: 23497.34.diff
File 23497.34.diff, 63.8 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
1310 1310 /* translators: revision date format, see http://php.net/date */ 1311 1311 $datef = _x( 'j F, Y @ G:i:s', 'revision date format'); 1312 1312 1313 $gravatar = get_avatar( $revision->post_author, 18);1313 $gravatar = get_avatar( $revision->post_author, 24 ); 1314 1314 1315 1315 $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); 1316 1316 if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) … … 1388 1388 } 1389 1389 1390 1390 /* translators: post revision: 1: when, 2: author name */ 1391 $titlef = _x( '%1$s by %2$s', 'post revision' );1391 $titlef = _x( '%1$s', 'post revision' ); 1392 1392 1393 1393 if ( $parent ) 1394 1394 array_unshift( $revisions, $post ); 1395 1395 1396 // since 3.6 revisions include a copy of the current post data as a revision 1397 // the collowing removes this current revision if present from the list of 1398 // revisions returned by wp_list_post_revisions, remove these to include the 1399 // crrent post revision in the list of revisions 1400 if ( wp_first_revision_matches_current_version( $post_id ) ) 1401 array_pop( $revisions ); 1402 1396 1403 $rows = $right_checked = ''; 1397 1404 $class = false; 1398 1405 $can_edit_post = current_user_can( 'edit_post', $post->ID ); … … 1403 1410 continue; 1404 1411 1405 1412 $date = wp_post_revision_title( $revision ); 1406 $name = get_the_author_meta( 'display_name', $revision->post_author );1407 1413 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"' : ''; 1414 $title = sprintf( $titlef, $date ); 1415 $rows .= "\t<li>$title</li>\n"; 1414 1416 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 1417 } 1434 1418 1435 1419 if ( 'form-table' == $format ) : ?> … … 1479 1463 // if the post was previously restored from a revision 1480 1464 // show the restore event details 1481 1465 // 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' ) ) . __( ' ago ' ); 1488 ?> 1466 if ( $restored_from_meta = get_post_meta( $post->ID, '_post_restored_from', true ) ) { 1467 $author = get_the_author_meta( 'display_name', $restored_from_meta[ 'restored_by_user' ] ); 1468 /* translators: revision date format, see http://php.net/date */ 1469 $datef = _x( 'j F, Y @ G:i:s', 'revision date format'); 1470 $date = date_i18n( $datef, strtotime( $restored_from_meta[ 'restored_time' ] ) ); 1471 $timesince = human_time_diff( $restored_from_meta[ 'restored_time' ], current_time( 'timestamp' ) ) . __( ' ago ' ); 1472 ?> 1489 1473 <hr /> 1490 <div id="revisions-meta-restored"> 1491 <?php 1492 printf( 'Previously restored from Revision ID %d, %s by %s (%s)', 1493 $restored_from_meta[ 'restored_revision_id'], 1494 $timesince, 1495 $author, 1496 $date ); 1497 ?> 1498 </div> 1499 <?php 1474 <div id="revisions-meta-restored"> 1475 <?php 1476 printf( 'Previously restored from Revision ID %d, %s by %s (%s)', 1477 $restored_from_meta[ 'restored_revision_id'], 1478 $timesince, 1479 $author, 1480 $date ); 1481 ?> 1482 </div> 1483 <?php 1500 1484 echo "</ul>"; 1501 } 1485 } 1502 1486 1503 1487 endif; 1504 1488 -
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; … … 329 349 if ( $post_id ) 330 350 do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] ); 331 351 352 //store revision event in post meta 353 $restore_details = array( 354 'restored_revision_id' => $revision_id, 355 'restored_by_user' => get_current_user_id(), 356 'restored_time' => time() 357 ); 358 update_post_meta( $post_id, '_post_restored_from', $restore_details ); 359 update_post_meta( $post_id, '_edit_last', get_current_user_id() ); 360 332 361 return $post_id; 333 362 } 334 363 … … 418 447 add_filter('the_preview', '_set_preview'); 419 448 } 420 449 } 450 451 /** 452 * Determines if the specified post's most recent revision matches the post (by checking post_modified). 453 * 454 * @package WordPress 455 * @subpackage Post_Revisions 456 * @since 3.6.0 457 * 458 * @param int|object $post Post ID or post object. 459 * @return bool false if not a match, otherwise true. 460 */ 461 function wp_first_revision_matches_current_version( $post ) { 462 463 if ( ! $post = get_post( $post ) ) 464 return false; 465 466 if ( ! $revisions = wp_get_post_revisions( $post->ID ) ) 467 return false; 468 469 $last_revision = array_shift( $revisions ); 470 471 if ( ! ($last_revision->post_modified == $post->post_modified ) ) 472 return false; 473 474 return true; 475 } -
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
2130 2130 /* translators: revision date format, see http://php.net/date */ 2131 2131 $datef = _x( 'j F, Y @ G:i:s', 'revision date format'); 2132 2132 2133 $left_revision = get_post( $compare_to ); 2134 //error_log($left_revision); 2133 2135 //single model fetch mode 2136 //return the diff of a single revision comparison 2134 2137 if ( 0 != $single_revision_id ) { 2135 $left_revision = get_post( $compare_to );2136 2138 $right_revision = get_post( $single_revision_id ); 2137 2139 2138 if ( $compare_two_mode ) {2139 $compare_to_gravatar = get_avatar( $left_revision->post_author, 18 );2140 $compare_to_author = get_the_author_meta( 'display_name', $left_revision->post_author );2141 $compare_to_date = date_i18n( $datef, strtotime( $left_revision->post_modified ) );2142 2143 $revision_from_date_author = sprintf(2144 '%s %s, %s %s (%s)',2145 $compare_to_gravatar,2146 $compare_to_author,2147 human_time_diff( strtotime( $left_revision->post_modified ), current_time( 'timestamp' ) ),2148 __( ' ago ' ),2149 $compare_to_date2150 );2151 }2152 2153 2140 // 2154 2141 //make sure the left revision is the most recent 2155 2142 // … … 2159 2146 $right_revision = $temp; 2160 2147 } 2161 2148 2149 $linesadded=0; 2150 $linesdeleted=0; 2151 2162 2152 // 2163 2153 //compare from left to right, passed from application 2164 2154 // … … 2174 2164 if ( ! empty( $show_split_view ) ) 2175 2165 $args = array( 'show_split_view' => true ); 2176 2166 2177 $content .= wp_text_diff( $left_content, $right_content, $args ); 2167 $diff = wp_text_diff_with_count( $left_content, $right_content, $args ); 2168 2169 if ( isset( $diff[ 'html' ] ) ) 2170 $content .= $diff[ 'html' ]; 2171 2172 if ( isset( $diff[ 'linesadded' ] ) ) 2173 $linesadded = $linesadded + $diff[ 'linesadded' ]; 2174 2175 if ( isset( $diff[ 'linesdeleted' ] ) ) 2176 $linesdeleted = $linesdeleted + $diff[ 'linesdeleted' ]; 2177 2178 2178 2179 } 2179 $content = '' == $content ? __( 'No difference' ) : $content; 2180 $alltherevisions = array ( 2181 'revisiondiff' => $content 2182 ); 2180 $content = '' == $content ? __( 'No difference' ) : $content; 2181 2182 $alltherevisions = array ( 2183 'revisiondiff' => $content, 2184 'lines_deleted' => $linesdeleted, 2185 'lines_added' => $linesadded 2186 ); 2183 2187 echo json_encode( $alltherevisions ); 2184 2188 exit(); 2185 } 2189 } //end single model fetch 2186 2190 2191 //fetch the list of revisions available 2192 2187 2193 //if we are comparing two revisions, the first 'revision' represented by the leftmost 2188 2194 //slider position is the current revision, prepend a comparison to this revision 2189 if ( $compare_two_mode ) 2190 array_unshift( $revisions, get_post( $post_id ) ); 2191 2195 if ( ! wp_first_revision_matches_current_version( $post_id ) ) //revisions don't have current version 2196 array_unshift( $revisions, get_post( $post_id ) ) ; 2197 //$revisions->append ( get_post( $post_id ) ); 2198 //error_log( var_dump( $revisions )); 2192 2199 $count = -1; 2193 2200 2201 //reverse the list to start with oldes revision 2202 $revisions = array_reverse( $revisions ); 2203 2204 $previous_revision_id = 0; 2194 2205 foreach ( $revisions as $revision ) : 2195 if ( ! empty( $show_autosaves ) && wp_is_post_autosave( $revision ) ) 2206 //error_log( ( $show_autosaves )); 2207 if ( empty( $show_autosaves ) && wp_is_post_autosave( $revision ) ) 2196 2208 continue; 2197 2209 2198 2210 $revision_from_date_author = ''; 2199 2211 $count++; 2200 2212 // return blank data for diffs to the left of the left handle (for right handel model) 2201 2213 // or to the right of the right handle (for left handel model) 2202 if ( ( 0 != $left_handle_at && $count <= $left_handle_at ) || 2203 ( 0 != $right_handle_at && $count > $right_handle_at )) { 2214 if ( ( 0 != $left_handle_at && $count <= $left_handle_at ) || 2215 ( 0 != $right_handle_at && $count > $right_handle_at )) { 2204 2216 $alltherevisions[] = array ( 2205 2217 'ID' => $revision->ID, 2206 2218 ); 2207 2208 2219 continue; 2209 2220 } 2210 2221 2211 $gravatar = get_avatar( $revision->post_author, 18 ); 2222 if ( $compare_two_mode ) { 2223 $compare_to_gravatar = get_avatar( $left_revision->post_author, 24 ); 2224 $compare_to_author = get_the_author_meta( 'display_name', $left_revision->post_author ); 2225 $compare_to_date = date_i18n( $datef, strtotime( $left_revision->post_modified ) ); 2226 2227 $revision_from_date_author = sprintf( 2228 '%s %s, %s %s (%s)', 2229 $compare_to_gravatar, 2230 $compare_to_author, 2231 human_time_diff( strtotime( $left_revision->post_modified ), current_time( 'timestamp' ) ), 2232 __( ' ago ' ), 2233 $compare_to_date 2234 ); 2235 } 2236 2237 $gravatar = get_avatar( $revision->post_author, 24 ); 2212 2238 $author = get_the_author_meta( 'display_name', $revision->post_author ); 2213 2239 $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); 2214 2240 $revision_date_author = sprintf( … … 2219 2245 __( ' ago ' ), 2220 2246 $date 2221 2247 ); 2248 $datef2 = __( 'j M @ G:i' ); 2249 $date2 = date_i18n( $datef2, strtotime( $revision->post_modified ) ); 2222 2250 2251 $revision_date_author_short = sprintf( 2252 '%s <strong>%s</strong><br />%s', 2253 $gravatar, 2254 $author, 2255 $date2 2256 ); 2257 2223 2258 $restoreaction = wp_nonce_url( 2224 2259 add_query_arg( 2225 2260 array( 'revision' => $revision->ID, 2226 2261 'action' => 'restore' ), 2227 2262 admin_url( 'revision.php' ) 2228 2263 ), 2229 "restore-post_{$ compare_to}|{$revision->ID}"2264 "restore-post_{$revision->ID}" 2230 2265 ); 2231 2266 2232 $alltherevisions[] = array ( 2267 if ( ( $compare_two_mode || 0 !== $previous_revision_id ) ) { 2268 $alltherevisions[] = array ( 2233 2269 'ID' => $revision->ID, 2234 2270 'revision_date_author' => $revision_date_author, 2235 2271 'revision_from_date_author' => $revision_from_date_author, 2272 'revision_date_author_short' => $revision_date_author_short, 2236 2273 'restoreaction' => urldecode( $restoreaction ), 2237 'revision_toload' => true 2274 'revision_toload' => true, 2275 'previous_revision_id' => $previous_revision_id 2238 2276 ); 2277 } 2278 $previous_revision_id = $revision->ID; 2239 2279 2240 2280 endforeach; 2241 2281 -
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 }), … … 35 49 _revisionsOptions : null, 36 50 _left_diff : 0, 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 60 //TODO add ability to arrive on specific revision 45 61 routes : { … … 54 70 var revisions_to_load = model_collection.where( { revision_toload : true } ); 55 71 //console.log(revisions_to_load); 56 72 var delay=0; 57 _.each(revisions_to_load, function( the_model ) { 73 //match slider to passed revision_id 74 _.each( revisions_to_load, function( the_model ) { 75 if ( the_model.get( 'ID' ) == wpRevisionsSettings.revision_id ) { 76 //console.log ( the_model.get( 'ID' ) +'-' +wpRevisionsSettings.revision_id); 77 self._right_diff = self._revisions.indexOf( the_model ) + 1; 78 } 79 80 }); 81 _.each( revisions_to_load, function( the_model ) { 58 82 the_model.urlRoot = model_collection.url; 59 83 _.delay( function() { 60 84 the_model.fetch( { … … 63 87 remove : false, 64 88 //async : false, 65 89 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 90 model.set( 'revision_toload', 'false' ); 91 //console.log(model_collection.where( { revision_toload : true } ).length); 92 93 //stop spinner when all models are loaded 94 if ( 0 === model_collection.where( { revision_toload : true } ).length ) 95 self.stop_model_loading_spinner(); 96 97 self._tickmarkView.render(); 98 99 var total_changes = model.get( 'lines_added' ) + model.get( 'lines_deleted'); 100 // console.log(total_changes); 101 var scope_of_changes = 'vsmall'; 102 103 //hard coded scope of changes 104 //TODO change to dynamic based on range of values 105 if ( total_changes > 1 && total_changes <= 3 ) { 106 scope_of_changes = 'small'; 107 } else if(total_changes > 3 && total_changes <= 5 ) { 108 scope_of_changes = 'med'; 109 } else if(total_changes > 5 && total_changes <= 10 ) { 110 scope_of_changes = 'large'; 111 } else if(total_changes > 10 ) { 112 scope_of_changes = 'vlarge'; 113 } 114 model.set( 'scope_of_changes', scope_of_changes ); 115 //console.log (self._right_diff); 116 if ( 0 !== self._right_diff && 117 model.get( 'ID' ) === self._revisions.at( self._right_diff - 1 ).get( 'ID' ) ) { 118 //reload if current model refreshed 68 119 //console.log('render'); 69 120 self._revisionView.render(); 70 121 } 122 71 123 } 72 124 } ); 73 125 }, delay ) ; 74 delay = delay + 200; //stagger model loads by 200 ms to avoid hammering server with requests126 delay = delay + 150; //stagger model loads to avoid hammering server with requests 75 127 } 76 128 ); 77 129 }, … … 83 135 84 136 stop_left_model_loading : function() { 85 137 this._left_model_loading = false; 86 $('.revisiondiffcontainer').removeClass('leftmodelloading');87 138 }, 88 139 89 140 start_right_model_loading : function() { … … 93 144 94 145 stop_right_model_loading : function() { 95 146 this._right_model_loading = false; 147 }, 148 149 stop_model_loading_spinner : function() { 96 150 $('.revisiondiffcontainer').removeClass('rightmodelloading'); 151 $('.revisiondiffcontainer').removeClass('leftmodelloading'); 97 152 }, 98 153 99 154 reloadmodel : function() { … … 107 162 reloadmodelsingle : function() { 108 163 var self = this; 109 164 self._revisions.url = ajaxurl + '?action=revisions-data&compare_to=' + wpRevisionsSettings.post_id + 110 '&show_autosaves=' + self._autosaves +165 '&show_autosaves=' + REVAPP._autosaves + 111 166 '&show_split_view=' + REVAPP._show_split_view + 112 167 '&nonce=' + wpRevisionsSettings.nonce; 113 168 self.start_right_model_loading(); 114 this._revisions.fetch({ //reload revision data169 self._revisions.fetch({ //reload revision data 115 170 success : function() { 116 171 self.stop_right_model_loading(); 117 172 var revisioncount = self._revisions.length; 118 if ( self._right_diff > revisioncount ) //if right handle past rightmost, move 119 self._right_diff = revisioncount; 173 //if ( self._right_diff > revisioncount ) //if right handle past rightmost, move 120 174 175 // self._right_diff = revisioncount; 176 177 178 121 179 self._revisionView.render(); 122 180 self.reload_toload_revisions( self._revisions ); 123 181 124 182 $( '#slider' ).slider( 'option', 'max', revisioncount-1 ); //TODO test this, autsaves changed 183 $( '#slider' ).slider( 'value', REVAPP._right_diff - 1 ).trigger( 'slide' ); 184 REVAPP._tickmarkView.model = self._revisions; 185 REVAPP._tickmarkView.render(); 125 186 }, 126 187 127 188 error : function () { … … 136 197 var self = this; 137 198 self.start_left_model_loading(); 138 199 self._left_handle_revisions = new wp.revisions.Collection(); 200 //console.log( 'right - ' + self._right_diff ); 201 //if ( self._right_diff > self._revisions.length) 202 //self._right_diff = self._right_diff-1; 203 //console.log (REVAPP._right_diff ); 204 139 205 self._left_handle_revisions.url = 140 206 ajaxurl + 141 207 '?action=revisions-data&compare_to=' + self._revisions.at( self._right_diff - 1 ).get( 'ID' ) + 142 208 '&post_id=' + wpRevisionsSettings.post_id + 143 '&show_autosaves=' + self._autosaves +144 '&show_split_view=' + self._show_split_view +209 '&show_autosaves=' + REVAPP._autosaves + 210 '&show_split_view=' + REVAPP._show_split_view + 145 211 '&nonce=' + wpRevisionsSettings.nonce + 146 212 '&right_handle_at=' + ( self._right_diff ); 147 213 … … 150 216 success : function(){ 151 217 self.stop_left_model_loading(); 152 218 self.reload_toload_revisions( self._left_handle_revisions ); 219 self._tickmarkView.model = self._left_handle_revisions; 220 $( '#slider' ).slider( 'option', 'max', self._revisions.length ); 153 221 }, 154 222 155 223 error : function () { … … 163 231 var self = this; 164 232 self.start_right_model_loading(); 165 233 self._right_handle_revisions = new wp.revisions.Collection(); 166 if ( 0 === self._left_diff ) { 234 //console.log (REVAPP._left_diff ); 235 167 236 self._right_handle_revisions.url = 168 237 ajaxurl + 169 '?action=revisions-data&compare_to=' + wpRevisionsSettings.post_id+238 '?action=revisions-data&compare_to=' + ( self._revisions.at( self._left_diff ).get( 'ID' ) - 1 )+ 170 239 '&post_id=' + wpRevisionsSettings.post_id + 171 '&show_autosaves=' + self._autosaves +172 '&show_split_view=' + self._show_split_view +240 '&show_autosaves=' + REVAPP._autosaves + 241 '&show_split_view=' + REVAPP._show_split_view + 173 242 '&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 243 185 244 self._right_handle_revisions.fetch({ 186 245 187 246 success : function(){ 188 247 self.stop_right_model_loading(); 189 248 self.reload_toload_revisions( self._right_handle_revisions ); 249 self._tickmarkView.model = self._right_handle_revisions; 250 $( '#slider' ).slider( 'option', 'max', self._revisions.length ); 251 $( '#slider' ).slider( 'values', [ REVAPP._left_diff, REVAPP._right_diff] ).trigger( 'slide' ); 252 253 //REVAPP._revisionView.render(); 254 190 255 }, 191 256 192 257 error : function ( response ) { … … 208 273 initialize : function( options ) { 209 274 var self = this; //store the application instance 210 275 if (this._revisions === null) { 211 self._autosaves = '';212 276 self._revisions = new wp.revisions.Collection(); //set up collection 213 277 self.start_right_model_loading(); 214 278 self._revisions.fetch({ //load revision data 215 279 216 280 success : function() { 217 281 self.stop_right_model_loading(); 218 self. revisionDiffSetup();282 self.completeApplicationSetup(); 219 283 } 220 284 }); 221 285 } 222 286 return this; 223 287 }, 224 288 225 revisionDiffSetup : function() { 289 addTooltip : function( handle, message ) { 290 291 handle.attr( 'title', '' ).tooltip({ 292 track: false, 293 294 position: { 295 my: "left-22 top-66", 296 at: "top left", 297 using: function( position, feedback ) { 298 //console.log(this); 299 $( this ).css( position ); 300 $( "<div>" ) 301 .addClass( "arrow" ) 302 .addClass( feedback.vertical ) 303 .addClass( feedback.horizontal ) 304 .appendTo( $( this ) ); 305 } 306 }, 307 show: false, 308 hide: false, 309 content: function() { 310 return message; 311 } 312 313 } ); 314 }, 315 /**/ 316 317 completeApplicationSetup : function() { 226 318 this._revisionView = new wp.revisions.views.View({ 227 319 model : this._revisions 228 320 }); 229 321 this._revisionView.render(); 230 $( '#diff_max, #diff_maxof' ).html( this._revisions.length );231 $( '#diff_count' ).html( REVAPP._right_diff );232 322 $( '#slider' ).slider( 'option', 'max', this._revisions.length - 1 ); 233 323 234 324 this.reload_toload_revisions( this._revisions ); 325 235 326 this._revisionsInteractions = new wp.revisions.views.Interact({ 236 327 model : this._revisions 237 328 }); 238 329 this._revisionsInteractions.render(); 239 330 331 this._tickmarkView = new wp.revisions.views.Tickmarks({ 332 model : this._revisions 333 }); 334 this._tickmarkView.render(); 335 this._tickmarkView.resetticks(); 336 337 240 338 /* 339 .on( 'mouseup', function( event ) { 340 REVAPP._keep_tooltip_open = false; 341 $( this ).find('.ui-slider-tooltip').hide(); 342 } ).on( 'mousedown', function( event ) { 343 REVAPP._keep_tooltip_open = true; 344 } ).on( 'mouseout', function( event ) { 345 if ( REVAPP._keep_tooltip_open) 346 event.stopImmediatePropagation(); 347 }); 348 */ 349 /* 241 350 //Options hidden for now, moving to screen options 242 351 this._revisionsOptions = new wp.revisions.views.Options({ 243 352 model : this._revisions … … 252 361 wp.revisions.Collection = Backbone.Collection.extend({ 253 362 model : wp.revisions.Model, 254 363 url : ajaxurl + '?action=revisions-data&compare_to=' + wpRevisionsSettings.post_id + 255 '&show_autosaves= false&show_split_view=true&nonce=' + wpRevisionsSettings.nonce,364 '&show_autosaves=true&show_split_view=true&nonce=' + wpRevisionsSettings.nonce, 256 365 257 366 initialize : function() { 258 367 } 259 368 } ); 260 369 261 370 _.extend(wp.revisions.views, { 371 372 //Ticks inside slider view 262 373 // 374 Tickmarks : Backbone.View.extend({ 375 el : $('#diff-slider-ticks')[0], 376 tagName : 'diff-slider-ticks-view', 377 className : 'diff-slider-ticks-container', 378 template : wp.template('revision-ticks'), 379 model : wp.revisions.Model, 380 381 resetticks : function() { 382 var slider_max = $( '#slider' ).slider( 'option', 'max'); 383 var slider_width = $( '#slider' ).width(); 384 var adjust_max = ( 2 === REVAPP._compareoneortwo ) ? 1 : 0; 385 var tick_width = Math.floor( slider_width / ( slider_max - adjust_max ) ); 386 387 //TODO: adjust right margins for wider ticks so they stay centered on handle stop point 388 389 tick_width = (tick_width > 50 ) ? 50 : tick_width; 390 tick_width = (tick_width < 10 ) ? 10 : tick_width; 391 392 slider_width = tick_width * (slider_max - adjust_max ) +1; 393 394 $( '#slider' ).width( slider_width ); 395 $( '.diff-slider-ticks-wrapper' ).width( slider_width ); 396 $( '#diffslider' ).width( slider_width ); 397 $( '#diff-slider-ticks' ).width( slider_width ); 398 399 var a_tick_width = $( '.revision-tick' ).width(); 400 401 if ( tick_width !== a_tick_width ) { // is the width already set correctly? 402 $( '.revision-tick' ).each( function( ) { 403 $(this).css( 'margin-right', tick_width - 1 + 'px'); //space the ticks out using right margin 404 }); 405 406 if( 2 === REVAPP._compareoneortwo ) { 407 $( '.revision-tick' ).first().remove(); //TODO - remove the check 408 } 409 $( '.revision-tick' ).last().css( 'margin-right', '0' ); // last tick gets no right margin 410 } 411 412 }, 413 414 //render the tickmark view 415 render : function() { 416 var self = this; 417 418 if ( null !== self.model ) { 419 //TODO remove this initial model when ticket #16215 rolls because 420 //revisions will then include current version 421 var add_placeholder = ( 2 === REVAPP._compareoneortwo ) ? self.template('') : ''; 422 423 var addhtml = "";//add_placeholder; 424 _.each ( self.model.models, function ( the_model ) { 425 426 addhtml = addhtml + self.template ( the_model.toJSON() ); 427 428 }); 429 self.$el.html( addhtml ); 430 431 } 432 self.resetticks(); 433 return self; 434 } 435 }), 436 437 // 263 438 //primary revision diff view 264 439 // 265 440 View : Backbone.View.extend({ … … 267 442 tagName : 'revisionvview', 268 443 className : 'revisionview-container', 269 444 template : wp.template('revision'), 270 revvapp : null,271 445 comparetwochecked : '', 272 446 draggingleft : false, 273 447 274 initialize : function(){275 },276 277 448 // 278 449 //render the revisions 279 450 // 280 451 render : function() { 281 452 var addhtml = ''; 282 453 //compare two revisions mode? 454 283 455 if ( 2 === REVAPP._compareoneortwo ) { 284 456 this.comparetwochecked = 'checked'; 285 457 if ( this.draggingleft ) { … … 291 463 } 292 464 } else { //dragging right handle 293 465 var thediff = REVAPP._right_diff; 466 //console.log( thediff ) 294 467 if ( this.model.at( thediff ) ) { 295 468 addhtml = this.template( _.extend( 296 469 this.model.at( thediff ).toJSON(), … … 310 483 this.$el.html( addhtml ); 311 484 if ( this.model.length < 3 ) { 312 485 $( 'div#comparetworevisions' ).hide(); //don't allow compare two if fewer than three revisions 486 } 487 if ( this.model.length < 2 ) { 488 $( 'div#diffslider' ).hide(); //don't allow compare two if fewer than three revisions 489 $( 'div.diff-slider-ticks-wrapper' ).hide(); 490 } 491 //console.log ( (this.model.at( REVAPP._right_diff - 1 )).url()); 313 492 493 // 494 // add tooltips to the handles 495 // 496 if ( 2 === REVAPP._compareoneortwo ) { 497 REVAPP.addTooltip ( $( 'a.ui-slider-handle.left-handle' ), 498 ( REVAPP._right_diff >= REVAPP._revisions.length ) ? '' : REVAPP._revisions.at( REVAPP._left_diff ).get( 'revision_date_author_short' ) ); 499 REVAPP.addTooltip ( $( 'a.ui-slider-handle.right-handle' ), 500 ( REVAPP._right_diff >= REVAPP._revisions.length ) ? '' : REVAPP._revisions.at( REVAPP._right_diff ).get( 'revision_date_author_short' ) ); 501 } else { 502 REVAPP.addTooltip ( $( 'a.ui-slider-handle' ), 503 ( REVAPP._right_diff >= REVAPP._revisions.length ) ? '' : REVAPP._revisions.at( REVAPP._right_diff ).get( 'revision_date_author_short' ) ); 314 504 } 315 //console.log ( (this.model.at( REVAPP._right_diff - 1 )).url()); 505 506 // 507 // hide the restore button when on the last sport/current post data 508 // 509 if ( ( 2 === REVAPP._compareoneortwo && ! REVAPP._revisionView.draggingleft ) || 510 1 === REVAPP._compareoneortwo ) { 511 if ( REVAPP._right_diff === REVAPP._revisions.length ){ 512 //console.log ('hide'); 513 $( '.restore-button' ).hide(); 514 } else { 515 $( '.restore-button' ).show(); 516 } 517 } 518 316 519 return this; 317 520 }, 318 521 … … 326 529 // 327 530 clickcomparetwo : function(){ 328 531 self = this; 532 329 533 if ( $( 'input#comparetwo' ).is( ':checked' ) ) { 330 534 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(); 535 if ( 0 === REVAPP._left_diff ) 536 REVAPP._left_diff = 1; 537 538 if ( 1 === REVAPP._right_diff ) 539 REVAPP._right_diff = 2; 540 541 REVAPP._revisionView.draggingleft = true; 542 543 wpRevisionsSettings.revision_id = ''; // reset passed revision id so switching back to one handle mode doesn't re-select revision 544 REVAPP.reloadleftright(); 545 if ( REVAPP._revisionView.model !== REVAPP._left_handle_revisions && 546 null !== REVAPP._left_handle_revisions ) { 547 REVAPP._revisionView.model = REVAPP._left_handle_revisions; 548 REVAPP._tickmarkView.model = REVAPP._left_handle_revisions; 549 } 550 } else { 551 REVAPP._compareoneortwo = 1 ; 552 REVAPP._revisionView.draggingleft = false; 553 REVAPP._left_diff = 0; 554 REVAPP._right_diff = (REVAPP._revisions.length <= REVAPP._right_diff ) ? REVAPP._right_diff : REVAPP._right_diff +1; 555 REVAPP.reloadmodelsingle(); 556 } 557 REVAPP._revisionsInteractions.render(); 558 REVAPP._tickmarkView.render(); 559 //REVAPP._revisionView.render(); 339 560 } 340 561 }), 341 562 342 563 // 343 564 //options view for show autosaves and show split view options 344 565 // 566 /* DISABLED for now 345 567 Options : Backbone.View.extend({ 346 568 el : $('#backbonerevisionsoptions')[0], 347 569 tagName : 'revisionoptionsview', 348 570 className : 'revisionoptions-container', 349 571 template : wp.template('revisionoptions'), 350 572 351 initialize : function() {352 },353 354 573 //render the options view 355 574 render : function() { 356 575 var addhtml = this.template; … … 396 615 REVAPP.reloadmodel(); 397 616 } 398 617 }), 399 618 */ 400 619 // 401 620 //main interactions view 402 621 // … … 405 624 tagName : 'revisionvinteract', 406 625 className : 'revisionvinteract-container', 407 626 template : wp.template('revisionvinteract'), 408 _restoreword : '',409 627 410 628 initialize : function() { 411 this._restoreword = $( 'input#restore' ).attr( 'value' );412 629 }, 413 630 414 reset_restore_button : function() {415 $( 'input#restore' ).attr( 'value', this._restoreword + ' ' + REVAPP._revisions.at( REVAPP._right_diff - 1 ).get( 'ID' ) );416 },417 418 631 render : function() { 419 632 var self = this; 420 633 421 634 var addhtml = this.template; 422 635 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 636 428 637 var modelcount = REVAPP._revisions.length; 429 638 … … 431 640 if ( 1 === REVAPP._compareoneortwo ) { 432 641 //set up the slider with a single handle 433 642 slider.slider({ 434 value 435 min 436 max 437 step 643 value: REVAPP._right_diff-1, 644 min: 0, 645 max: modelcount-1, 646 step: 1, 438 647 648 439 649 //slide interactions for one handles slider 440 650 slide : function( event, ui ) { 441 if ( REVAPP._right_model_loading ) //left model stoll loading, prevent sliding left handle442 return false;443 651 444 REVAPP._right_diff =( ui.value+1 ); 445 $( '#diff_count' ).html( REVAPP._right_diff ); 652 REVAPP._right_diff = ( ui.value +1 ); 446 653 REVAPP._revisionView.render(); 447 self.reset_restore_button(); 448 } 654 /* 655 $( 'a.ui-slider-handle' ).tooltip( { 656 content: REVAPP._revisions.at( ui.value ).get( 'revision_date_author_short' ), 657 position: { 658 my: "top-65", 659 using: function( position, feedback ) { 660 $( this ).css( position ); 661 $( "<div>" ) 662 .addClass( "arrow" ) 663 .addClass( feedback.vertical ) 664 .addClass( feedback.horizontal ) 665 .appendTo( this ); 666 } 667 } 668 });//.trigger( 'close' ).trigger( 'open' ); 669 */ 670 } 449 671 }); 450 672 $( '.revisiondiffcontainer' ).removeClass( 'comparetwo' ); 673 451 674 } else { //comparing more than one, eg 2 452 675 //set up the slider with two handles 453 676 slider.slider({ … … 460 683 //in two handled mode when user starts dragging, swap in precalculated diff for handle 461 684 start : function (event, ui ) { 462 685 var index = $( ui.handle ).index(); //0 (left) or 1 (right) 463 686 //console.log (REVAPP._right_model_loading ); 464 687 switch ( index ) { 465 688 case 1: //left handle drag 466 if ( REVAPP._left_model_loading ) //left model st oll loading, prevent sliding left handle689 if ( REVAPP._left_model_loading ) //left model still loading, prevent sliding left handle 467 690 return false; 468 691 469 692 if ( REVAPP._revisionView.model !== REVAPP._left_handle_revisions && 470 null !== REVAPP._left_handle_revisions ) 693 null !== REVAPP._left_handle_revisions ) { 471 694 REVAPP._revisionView.model = REVAPP._left_handle_revisions; 472 695 REVAPP._tickmarkView.model = REVAPP._left_handle_revisions; 696 REVAPP._tickmarkView.render(); 697 } 473 698 REVAPP._revisionView.draggingleft = true; 474 699 REVAPP._left_diff_start = ui.values[ 0 ]; 475 700 break; 476 701 477 702 case 2: //right 478 if ( REVAPP._right_model_loading ) //right model st oll loading, prevent sliding right handle703 if ( REVAPP._right_model_loading ) //right model still loading, prevent sliding right handle 479 704 return false; 480 705 481 //one extra spot at left end when comparing two482 706 if ( REVAPP._revisionView.model !== REVAPP._right_handle_revisions && 483 null !== REVAPP._right_handle_revisions ) 707 null !== REVAPP._right_handle_revisions ) { 484 708 REVAPP._revisionView.model = REVAPP._right_handle_revisions; 709 REVAPP._tickmarkView.model = REVAPP._right_handle_revisions; 710 REVAPP._tickmarkView.render(); 711 } 485 712 486 713 REVAPP._revisionView.draggingleft = false; 487 714 REVAPP._right_diff_start = ui.values[ 1 ]; … … 501 728 if ( REVAPP._left_model_loading ) //left model still loading, prevent sliding left handle 502 729 return false; 503 730 504 REVAPP._left_diff = ui.values[ 0 ] - 1; //one extra spot at left end when comparing two731 REVAPP._left_diff = ui.values[ 0 ]; //one extra spot at left end when comparing two 505 732 break; 506 733 507 734 case 2: //right 508 if ( REVAPP._right_model_loading ) //right model still loading, prevent sliding right handle 509 return false; 735 REVAPP._right_diff = ui.values[ 1 ] ; 736 //console.log('setting ' + REVAPP._right_diff ); 737 //$last_revision->post_modified == $post->post_modified 738 console.log( ui.values[ 1 ] ); 739 console.log(REVAPP._revisions.length); 510 740 511 REVAPP._right_diff = ui.values[ 1 ] - 1 ; 741 512 742 break; 513 743 } 514 744 515 $( '#diff_count' ).html( REVAPP._right_diff );516 517 745 if ( 0 === REVAPP._left_diff ) { 518 746 $( '.revisiondiffcontainer' ).addClass( 'currentversion' ); 519 747 520 748 } else { 521 749 $( '.revisiondiffcontainer' ).removeClass( 'currentversion' ); 522 $( '#diff_left_count_inner' ).html( REVAPP._left_diff );523 750 } 524 751 525 REVAPP._revisionView.render(); //render the diff view526 self.reset_restore_button(); 752 REVAPP._revisionView.render(); 753 527 754 }, 528 755 529 756 //when the user stops sliding in 2 handle mode, recalculate diffs … … 536 763 537 764 switch ( index ) { 538 765 case 1: //left 766 539 767 //left handle dragged & changed, reload right handle model 540 if ( ! ( REVAPP._left_diff_start === ui.values[ 0 ] || REVAPP._left_model_loading ))768 if ( REVAPP._left_diff_start !== ui.values[ 0 ] ) 541 769 REVAPP.reloadright(); 542 770 543 771 break; 544 772 545 773 case 2: //right 774 //REVAPP._right_diff = ( 1 >= REVAPP._right_diff ) ? 1 : REVAPP._right_diff-1; 546 775 //right handle dragged & changed, reload left handle model if changed 547 if ( ! ( REVAPP._right_diff_start === ui.values[ 1 ] || REVAPP._right_model_loading ) ) {776 if ( REVAPP._right_diff_start !== ui.values[ 1 ] ) 548 777 REVAPP.reloadleft(); 549 } 778 550 779 break; 551 780 } 552 781 } 553 782 } 554 783 }); 555 784 $( '.revisiondiffcontainer' ).addClass( 'comparetwo' ); 785 $( '#diffslider a.ui-slider-handle' ).first().addClass( 'left-handle' ).next().addClass( 'right-handle' ); 556 786 } 557 787 558 788 return this; … … 571 801 572 802 REVAPP._revisionView.render(); 573 803 574 $( '#diff_count' ).html( REVAPP._right_diff );575 804 $( '#slider' ).slider( 'value', REVAPP._right_diff - 1 ).trigger( 'slide' ); 576 this.reset_restore_button();577 805 }, 578 806 579 807 //go the the previous revision … … 583 811 584 812 REVAPP._revisionView.render(); 585 813 586 $( '#diff_count' ).html( REVAPP._right_diff );587 814 $( '#slider' ).slider( 'value', REVAPP._right_diff - 1 ).trigger( 'slide' ); 588 this.reset_restore_button();589 815 } 590 816 }) 591 817 }); -
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' ) ); … … 80 76 $parent_file = $submenu_file = 'edit.php?post_type=' . $post->post_type; 81 77 else 82 78 $parent_file = $submenu_file = 'edit.php'; 83 84 79 wp_enqueue_script( 'revisions' ); 85 80 86 81 require_once( './admin-header.php' ); 87 82 88 83 //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 84 //TODO can we pass the context in a better way 85 $wpRevisionsSettings = array( 'post_id' => $post->ID, 86 'nonce' => wp_create_nonce( 'revisions-ajax-nonce' ), 87 'revision_id' => $revision_id ); 88 wp_localize_script( 'revisions', 'wpRevisionsSettings', $wpRevisionsSettings ); 89 90 $comparetworevisionslink = get_edit_post_link( $revision->ID ); 90 91 ?> 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 92 98 <div id="backbonerevisionsoptions"></div> 93 <div id="backbonerevisionsoptions"> 94 </div> 99 95 <div class="wrap"> 100 <div class="icon32 icon32-posts-post" id="icon-edit"><br></div> 96 <div class="icon32 icon32-posts-post" id="icon-edit"> 97 <br> 98 </div> 101 99 <div class="revisiondiffcontainer diffsplit currentversion rightmodelloading"> 102 <div id="modelsloading" class="updated message"><span class="spinner" ></span> <?php _e( 'Calculating revision diffs' ); ?></div> 100 <div id="modelsloading" class="updated message"> 101 <span class="spinner" ></span> <?php _e( 'Calculating revision diffs' ); ?> 102 </div> 103 103 <h2 class="long-header"><?php echo $h2; ?></h2> 104 <div id="backbonerevisionsinteract"></div> 105 <div id="backbonerevisionsdiff"></div> 104 <div class="diff-slider-ticks-wrapper"> 105 <div id="diff-slider-ticks"> 106 </div> 107 </div> 108 <div id="backbonerevisionsinteract"> 109 </div> 110 <div id="backbonerevisionsdiff"> 111 </div> 106 112 <hr /> 107 113 </div> 108 114 </div> 109 115 110 116 <script id="tmpl-revision" type="text/html"> 117 <div id="diffsubheader" class="diff-left-hand-meta-row"> 118 <div id="diff_from_current_revision"> 119 <b><?php _e( 'From:' ); ?></b> <?php _e( 'the current version' ); ?> 120 </div> 121 <div id="difftitlefrom"> 122 <div class="diff-from-title"><?php _e( 'From:' ); ?></div>{{{ data.revision_from_date_author }}} 123 </div> 124 </div> 125 111 126 <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> 127 <div id="difftitle"> 128 <div class="diff-to-title"><?php _e( 'To:' ); ?></div>{{{ data.revision_date_author }}} 129 </div> 130 <div id="diffrestore"> 131 <input class="button button-primary restore-button" onClick="document.location='{{{ data.restoreaction }}}'" type="submit" id="restore" value="<?php esc_attr_e( 'Restore This Revision' )?>" /> 132 </div> 133 <div id="comparetworevisions"> 134 <input type="checkbox" id="comparetwo" value="comparetwo" {{{ data.comparetwochecked }}} name="comparetwo"/> 135 <label for="comparetwo"><?php esc_attr_e( 'Compare two revisions' ); ?></a></label> 136 </div> 137 </div> 138 118 139 <div id="removedandadded"> 119 140 <div id="removed"><?php _e( 'Removed -' ); ?></div> 120 141 <div id="added"><?php _e( 'Added +' ); ?></div> … … 124 145 125 146 <script id="tmpl-revisionvinteract" type="text/html"> 126 147 <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> 148 <div id="diffprevious"><input class="button" type="submit" id="previous" value="<?php esc_attr_e( 'Previous' ); ?>" /> 142 149 </div> 150 <div id="diffnext"><input class="button" type="submit" id="next" value="<?php esc_attr_e( 'Next' ); ?>" /> 151 </div> 152 <div id="diffslider"> 153 <div id="slider" class="wp-slider"> 154 </div> 155 </div> 143 156 </div> 144 157 </script> 158 <script id="tmpl-revision-ticks" type="text/html"> 159 <div class="revision-tick revision-toload{{{ data.revision_toload }}} revision-scopeofchanges-{{{ data.scope_of_changes }}}"> 160 </div> 161 </script> 145 162 <?php 146 163 /* 147 164 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
3582 3582 vertical-align: middle; 3583 3583 } 3584 3584 3585 .diff-from-title, 3586 .diff-to-title { 3587 font-size: 14px; 3588 font-weight: bold; 3589 width:60px; 3590 text-align: right; 3591 float: left; 3592 margin-right: 5px; 3593 } 3594 3585 3595 .revisiondiffcontainer { 3586 3596 width: 96%; 3587 3597 } … … 3590 3600 margin: 2px; 3591 3601 } 3592 3602 3593 #diffrestore, 3594 #diffnext, 3595 #diffcancel { 3603 #diffnext { 3596 3604 float: right; 3597 3605 margin-right: 5px; 3598 3606 } 3599 3607 3608 #diffrestore input{ 3609 margin-left: 10px; 3610 } 3611 3600 3612 #diffprevious, 3601 3613 #difftitle, 3602 3614 #difftitlefrom, … … 3608 3620 3609 3621 #diffprevious, 3610 3622 #diffnext { 3611 margin-top: 7px;3612 3623 height: 30px; 3613 3624 } 3614 3625 … … 3620 3631 #diffheader { 3621 3632 border-bottom: 1px solid #dfdfdf; 3622 3633 width: 100%; 3623 height: 4 5px;3624 line-height: 4 5px;3625 padding-top: 10px;3634 height: 40px; 3635 line-height: 40px; 3636 padding-top: 30px; 3626 3637 } 3627 3638 3628 #diffsubheader { 3629 border-bottom: 1px solid #dfdfdf; 3639 #diffsubheader,.diff-left-hand-meta-row { 3630 3640 width: 100%; 3631 3641 height:35px; 3632 3642 line-height: 35px; 3643 display: block; 3633 3644 } 3634 3645 3635 #diffslider 3646 #diffslider{ 3636 3647 width: 70%; 3637 3648 margin-left: auto; 3638 3649 margin-right: auto; 3639 3650 text-align: center; 3640 height: 3.5em; 3651 height: 0.8em; 3652 margin-top: 20px; 3641 3653 } 3642 3654 3655 .diff-slider-ticks-wrapper { 3656 margin-left: auto; 3657 margin-right: auto; 3658 text-align: center; 3659 } 3660 3661 #diff-slider-ticks { 3662 position: absolute; 3663 margin-top: 50px; 3664 z-index: 1; 3665 } 3666 3643 3667 #revisioncount { 3644 3668 width: 50%; 3645 3669 margin-left: auto; … … 3707 3731 3708 3732 #comparetworevisions { 3709 3733 float: right; 3734 position: absolute; 3735 top: 10px; 3736 right: 10px; 3710 3737 line-height: 35px; 3711 3738 padding-right: 5px; 3712 3739 } … … 3716 3743 } 3717 3744 3718 3745 #difftitle img, 3719 #difftitlefrom img { 3746 #difftitlefrom img, 3747 .post-revisions li img { 3720 3748 vertical-align: middle; 3721 3749 margin-left: 5px; 3722 3750 } 3751 .post-revisions li { 3752 vertical-align: middle; 3753 height: 28px; 3754 } 3723 3755 3724 3756 #showsplitviewoption, 3725 3757 #toggleshowautosavesoption { … … 3742 3774 .comparetwo #diffprevious, 3743 3775 .comparetwo #diffnext, 3744 3776 span#diff_left_current_revision, 3745 span#diff_from_current_revision,3777 #diff_from_current_revision, 3746 3778 .currentversion span#diff_left_count, 3747 3779 .currentversion span#diff_left_count_inner, 3748 .c urrentversion #difftitlefrom,3749 .comparetwo.currentversion #difftitlefrom{3780 .comparetwo.currentversion #diff_from_current_revision, 3781 #diffsubheader.diff-left-hand-meta-row { 3750 3782 display: none; 3751 3783 } 3752 3784 … … 3754 3786 span#diff_left_count, 3755 3787 span#diff_left_count_inner, 3756 3788 .comparetwo #difftitlefrom, 3757 .comparetwo.currentversion span#diff_from_current_revision,3758 3789 .leftmodelloading #modelsloading, 3759 3790 .rightmodelloading #modelsloading, 3760 3791 .leftmodelloading #modelsloading .spinner, 3761 3792 .rightmodelloading #modelsloading .spinner, 3762 {3763 display: inline;3793 .comparetwo #diffsubheader.diff-left-hand-meta-row { 3794 display: block; 3764 3795 } 3765 3796 3797 .revision-tick { 3798 width: 1px; 3799 float: left; 3800 margin-right: 15px; 3801 height: 11px; 3802 padding: 0; 3803 margin-left: 0px; 3804 } 3805 3806 .revision-tick.revision-scopeofchanges-vsmall { 3807 width: 1px; 3808 background-color: #aaa; 3809 } 3810 3811 .revision-tick.revision-scopeofchanges-small { 3812 width: 2px; 3813 background-color: #aaa; 3814 margin-left: -1px; 3815 } 3816 3817 .revision-tick.revision-scopeofchanges-med { 3818 width: 3px; 3819 margin-left: -2px; 3820 background-color: #666; 3821 } 3822 3823 .revision-tick.revision-scopeofchanges-large { 3824 width: 4px; 3825 margin-left: -3px; 3826 background-color: #333; 3827 } 3828 3829 .revision-tick.revision-scopeofchanges-vlarge { 3830 margin-left: -3px; 3831 width: 4px; 3832 background-color: #111; 3833 left: 1; 3834 } 3835 3766 3836 .diff-loading { 3767 3837 margin-top: 50px; 3768 3838 width: 100%; … … 3777 3847 float: none; 3778 3848 } 3779 3849 3780 #difftitlefrom {3781 float: left;3782 display: none;3783 }3784 3785 3850 #modelsloading { 3786 3851 float: right; 3852 position: absolute; 3787 3853 line-height: 30px; 3788 3854 display: none; 3789 3855 clear: none; 3790 margin: 0;3856 right: 170px; 3791 3857 margin-top: -40px; 3792 3858 } 3793 3859 3794 3860 #modelsloading .spinner { 3795 3861 float: left; 3796 3862 } 3797 3863 3864 .ui-tooltip-content img { 3865 float: left; 3866 margin-right: 5px; 3867 } 3868 3869 3870 3871 /* jQuery UI Tooltip 1.10.1 */ 3872 3873 .ui-tooltip { 3874 padding: 8px; 3875 position: absolute; 3876 z-index: 9999; 3877 max-width: 300px; 3878 min-width: 130px; 3879 } 3880 3881 body .ui-tooltip { 3882 border-width: 1px; 3883 } 3884 3885 .ui-tooltip, .arrow:after { 3886 border: 1px solid #d7d7d7; 3887 } 3888 3889 .ui-tooltip { 3890 padding: 5px 10px; 3891 } 3892 3893 .arrow { 3894 width: 70px; 3895 height: 16px; 3896 overflow: hidden; 3897 position: absolute; 3898 left: 50%; 3899 margin-left: -35px; 3900 bottom: -16px; 3901 z-index: 99999; 3902 3903 } 3904 3905 .arrow.top { 3906 top: -16px; 3907 bottom: auto; 3908 } 3909 3910 .arrow.left { 3911 left: 20%; 3912 } 3913 3914 .arrow:after { 3915 content: ""; 3916 position: absolute; 3917 left: 20px; 3918 top: -20px; 3919 width: 25px; 3920 height: 25px; 3921 background-color: #FFF; 3922 -webkit-transform: rotate(45deg); 3923 -moz-transform: rotate(45deg); 3924 -ms-transform: rotate(45deg); 3925 -o-transform: rotate(45deg); 3926 tranform: rotate(45deg); 3927 } 3928 3929 .arrow.top:after { 3930 bottom: -20px; 3931 top: auto; 3932 } 3933 3798 3934 /* jQuery UI Slider */ 3799 3935 3800 3936 .wp-slider.ui-slider { … … 3809 3945 .wp-slider .ui-slider-handle { 3810 3946 position: absolute; 3811 3947 z-index: 2; 3812 width: 1.2em; 3813 height: 1.2em; 3814 border-width: 1px; 3815 border-style: solid; 3816 border-radius: 3px; 3948 width: 17px; 3949 height: 17px; 3950 border: none; 3817 3951 } 3818 3952 3819 3953 .wp-slider .ui-slider-range {