| 1 | Index: wp-includes/post-template.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/post-template.php (revision 23693) |
|---|
| 4 | +++ wp-includes/post-template.php (working copy) |
|---|
| 5 | @@ -1315,7 +1315,7 @@ |
|---|
| 6 | $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); |
|---|
| 7 | if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) |
|---|
| 8 | $date = "<a href='$link'>$date</a>"; |
|---|
| 9 | - |
|---|
| 10 | + |
|---|
| 11 | $revision_date_author = sprintf( |
|---|
| 12 | '%s %s, %s %s (%s)', |
|---|
| 13 | $gravatar, |
|---|
| 14 | @@ -1393,6 +1393,9 @@ |
|---|
| 15 | if ( $parent ) |
|---|
| 16 | array_unshift( $revisions, $post ); |
|---|
| 17 | |
|---|
| 18 | + if ( wp_first_revision_matches_current_version( $post_id ) ) |
|---|
| 19 | + array_pop( $revisions ); |
|---|
| 20 | + |
|---|
| 21 | $rows = $right_checked = ''; |
|---|
| 22 | $class = false; |
|---|
| 23 | $can_edit_post = current_user_can( 'edit_post', $post->ID ); |
|---|
| 24 | @@ -1479,26 +1482,26 @@ |
|---|
| 25 | // if the post was previously restored from a revision |
|---|
| 26 | // show the restore event details |
|---|
| 27 | // |
|---|
| 28 | - if ( $restored_from_meta = get_post_meta( $post->ID, '_post_restored_from', true ) ) { |
|---|
| 29 | - $author = get_the_author_meta( 'display_name', $restored_from_meta[ 'restored_by_user' ] ); |
|---|
| 30 | - /* translators: revision date format, see http://php.net/date */ |
|---|
| 31 | - $datef = _x( 'j F, Y @ G:i:s', 'revision date format'); |
|---|
| 32 | - $date = date_i18n( $datef, strtotime( $restored_from_meta[ 'restored_time' ] ) ); |
|---|
| 33 | - $timesince = human_time_diff( $restored_from_meta[ 'restored_time' ], current_time( 'timestamp' ) ) . __( ' ago ' ); |
|---|
| 34 | - ?> |
|---|
| 35 | + if ( $restored_from_meta = get_post_meta( $post->ID, '_post_restored_from', true ) ) { |
|---|
| 36 | + $author = get_the_author_meta( 'display_name', $restored_from_meta[ 'restored_by_user' ] ); |
|---|
| 37 | + /* translators: revision date format, see http://php.net/date */ |
|---|
| 38 | + $datef = _x( 'j F, Y @ G:i:s', 'revision date format'); |
|---|
| 39 | + $date = date_i18n( $datef, strtotime( $restored_from_meta[ 'restored_time' ] ) ); |
|---|
| 40 | + $timesince = human_time_diff( $restored_from_meta[ 'restored_time' ], current_time( 'timestamp' ) ) . __( ' ago ' ); |
|---|
| 41 | + ?> |
|---|
| 42 | <hr /> |
|---|
| 43 | - <div id="revisions-meta-restored"> |
|---|
| 44 | - <?php |
|---|
| 45 | - printf( 'Previously restored from Revision ID %d, %s by %s (%s)', |
|---|
| 46 | - $restored_from_meta[ 'restored_revision_id'], |
|---|
| 47 | - $timesince, |
|---|
| 48 | - $author, |
|---|
| 49 | - $date ); |
|---|
| 50 | - ?> |
|---|
| 51 | - </div> |
|---|
| 52 | - <?php |
|---|
| 53 | + <div id="revisions-meta-restored"> |
|---|
| 54 | + <?php |
|---|
| 55 | + printf( 'Previously restored from Revision ID %d, %s by %s (%s)', |
|---|
| 56 | + $restored_from_meta[ 'restored_revision_id'], |
|---|
| 57 | + $timesince, |
|---|
| 58 | + $author, |
|---|
| 59 | + $date ); |
|---|
| 60 | + ?> |
|---|
| 61 | + </div> |
|---|
| 62 | + <?php |
|---|
| 63 | echo "</ul>"; |
|---|
| 64 | - } |
|---|
| 65 | + } |
|---|
| 66 | |
|---|
| 67 | endif; |
|---|
| 68 | |
|---|
| 69 | Index: wp-includes/revision.php |
|---|
| 70 | =================================================================== |
|---|
| 71 | --- wp-includes/revision.php (revision 23693) |
|---|
| 72 | +++ wp-includes/revision.php (working copy) |
|---|
| 73 | @@ -62,19 +62,27 @@ |
|---|
| 74 | /** |
|---|
| 75 | * Saves an already existing post as a post revision. |
|---|
| 76 | * |
|---|
| 77 | - * Typically used immediately prior to post updates. |
|---|
| 78 | + * Typically used immediately prior and after post updates. |
|---|
| 79 | + * 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 |
|---|
| 80 | + * After update adds a copy of the current post as a revision, so latest revision always matches current post |
|---|
| 81 | * |
|---|
| 82 | * @package WordPress |
|---|
| 83 | * @subpackage Post_Revisions |
|---|
| 84 | * @since 2.6.0 |
|---|
| 85 | * |
|---|
| 86 | * @uses _wp_put_post_revision() |
|---|
| 87 | + * @uses wp_first_revision_matches_current_version() |
|---|
| 88 | * |
|---|
| 89 | * @param int $post_id The ID of the post to save as a revision. |
|---|
| 90 | * @return mixed Null or 0 if error, new revision ID, if success. |
|---|
| 91 | */ |
|---|
| 92 | -function wp_save_post_revision( $post_id, $new_data = null ) { |
|---|
| 93 | - // We do autosaves manually with wp_create_post_autosave() |
|---|
| 94 | +function wp_save_post_revision( $post_id ) { |
|---|
| 95 | + //check to see if the post's first revision already matches the post data |
|---|
| 96 | + //should be true before post update, _except_ for old data which |
|---|
| 97 | + //doesn't include a copy of the current post data in revisions |
|---|
| 98 | + if ( wp_first_revision_matches_current_version( $post_id ) ) |
|---|
| 99 | + return; |
|---|
| 100 | + |
|---|
| 101 | if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) |
|---|
| 102 | return; |
|---|
| 103 | |
|---|
| 104 | @@ -82,40 +90,52 @@ |
|---|
| 105 | if ( ! WP_POST_REVISIONS ) |
|---|
| 106 | return; |
|---|
| 107 | |
|---|
| 108 | - if ( !$post = get_post( $post_id, ARRAY_A ) ) |
|---|
| 109 | + if ( ! $post = get_post( $post_id, ARRAY_A ) ) |
|---|
| 110 | return; |
|---|
| 111 | |
|---|
| 112 | if ( 'auto-draft' == $post['post_status'] ) |
|---|
| 113 | return; |
|---|
| 114 | |
|---|
| 115 | - if ( !post_type_supports($post['post_type'], 'revisions') ) |
|---|
| 116 | + if ( ! post_type_supports( $post['post_type'], 'revisions' ) ) |
|---|
| 117 | return; |
|---|
| 118 | |
|---|
| 119 | - // if new data is supplied, check that it is different from last saved revision, unless a plugin tells us to always save regardless |
|---|
| 120 | - if ( apply_filters( 'wp_save_post_revision_check_for_changes', true, $post, $new_data ) && is_array( $new_data ) ) { |
|---|
| 121 | - $post_has_changed = false; |
|---|
| 122 | - foreach ( array_keys( _wp_post_revision_fields() ) as $field ) { |
|---|
| 123 | - if ( normalize_whitespace( $new_data[ $field ] ) != normalize_whitespace( $post[ $field ] ) ) { |
|---|
| 124 | - $post_has_changed = true; |
|---|
| 125 | - break; |
|---|
| 126 | + // compare the proposed update with the last stored revision, verify |
|---|
| 127 | + // different, unless a plugin tells us to always save regardless |
|---|
| 128 | + if ( $revisions = wp_get_post_revisions( $post_id ) ) { // grab the last revision |
|---|
| 129 | + $last_revision = array_shift( $revisions ); |
|---|
| 130 | + |
|---|
| 131 | + if ( $last_revision_array = get_post( $last_revision->ID, ARRAY_A ) ) { //if no previous revisions, save one for sure |
|---|
| 132 | + |
|---|
| 133 | + if ( apply_filters( 'wp_save_post_revision_check_for_changes', true, $last_revision_array, $post ) && is_array( $post ) ) { |
|---|
| 134 | + $post_has_changed = false; |
|---|
| 135 | + |
|---|
| 136 | + foreach ( array_keys( _wp_post_revision_fields() ) as $field ) { |
|---|
| 137 | + |
|---|
| 138 | + if ( normalize_whitespace( $post[ $field ] ) != normalize_whitespace( $last_revision_array[ $field ] ) ) { |
|---|
| 139 | + $post_has_changed = true; |
|---|
| 140 | + break; |
|---|
| 141 | + |
|---|
| 142 | + } |
|---|
| 143 | + } |
|---|
| 144 | + |
|---|
| 145 | + //don't save revision if post unchanged |
|---|
| 146 | + if( ! $post_has_changed ) |
|---|
| 147 | + return; |
|---|
| 148 | } |
|---|
| 149 | } |
|---|
| 150 | - //don't save revision if post unchanged |
|---|
| 151 | - if( ! $post_has_changed ) |
|---|
| 152 | - return; |
|---|
| 153 | } |
|---|
| 154 | |
|---|
| 155 | $return = _wp_put_post_revision( $post ); |
|---|
| 156 | |
|---|
| 157 | // WP_POST_REVISIONS = true (default), -1 |
|---|
| 158 | - if ( !is_numeric( WP_POST_REVISIONS ) || WP_POST_REVISIONS < 0 ) |
|---|
| 159 | + if ( ! is_numeric( WP_POST_REVISIONS ) || WP_POST_REVISIONS < 0 ) |
|---|
| 160 | return $return; |
|---|
| 161 | |
|---|
| 162 | // all revisions and (possibly) one autosave |
|---|
| 163 | $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) ); |
|---|
| 164 | |
|---|
| 165 | // WP_POST_REVISIONS = (int) (# of autosaves to save) |
|---|
| 166 | - $delete = count($revisions) - WP_POST_REVISIONS; |
|---|
| 167 | + $delete = count( $revisions ) - WP_POST_REVISIONS; |
|---|
| 168 | |
|---|
| 169 | if ( $delete < 1 ) |
|---|
| 170 | return $return; |
|---|
| 171 | @@ -123,9 +143,9 @@ |
|---|
| 172 | $revisions = array_slice( $revisions, 0, $delete ); |
|---|
| 173 | |
|---|
| 174 | for ( $i = 0; isset($revisions[$i]); $i++ ) { |
|---|
| 175 | - if ( false !== strpos( $revisions[$i]->post_name, 'autosave' ) ) |
|---|
| 176 | + if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) ) |
|---|
| 177 | continue; |
|---|
| 178 | - wp_delete_post_revision( $revisions[$i]->ID ); |
|---|
| 179 | + wp_delete_post_revision( $revisions[ $i ]->ID ); |
|---|
| 180 | } |
|---|
| 181 | |
|---|
| 182 | return $return; |
|---|
| 183 | @@ -418,3 +438,29 @@ |
|---|
| 184 | add_filter('the_preview', '_set_preview'); |
|---|
| 185 | } |
|---|
| 186 | } |
|---|
| 187 | + |
|---|
| 188 | +/** |
|---|
| 189 | + * Determines if the specified post's most recent revision matches the post (by checking post_modified). |
|---|
| 190 | + * |
|---|
| 191 | + * @package WordPress |
|---|
| 192 | + * @subpackage Post_Revisions |
|---|
| 193 | + * @since 3.6.0 |
|---|
| 194 | + * |
|---|
| 195 | + * @param int|object $post Post ID or post object. |
|---|
| 196 | + * @return bool false if not a match, otherwise true. |
|---|
| 197 | + */ |
|---|
| 198 | +function wp_first_revision_matches_current_version( $post ) { |
|---|
| 199 | + |
|---|
| 200 | + if ( ! $post = get_post( $post ) ) |
|---|
| 201 | + return false; |
|---|
| 202 | + |
|---|
| 203 | + if ( ! $revisions = wp_get_post_revisions( $post->ID ) ) |
|---|
| 204 | + return false; |
|---|
| 205 | + |
|---|
| 206 | + $last_revision = array_shift( $revisions ); |
|---|
| 207 | + |
|---|
| 208 | + if ( ! ($last_revision->post_modified == $post->post_modified ) ) |
|---|
| 209 | + return false; |
|---|
| 210 | + |
|---|
| 211 | + return true; |
|---|
| 212 | +} |
|---|
| 213 | Index: wp-includes/pluggable.php |
|---|
| 214 | =================================================================== |
|---|
| 215 | --- wp-includes/pluggable.php (revision 23693) |
|---|
| 216 | +++ wp-includes/pluggable.php (working copy) |
|---|
| 217 | @@ -1744,3 +1744,69 @@ |
|---|
| 218 | return $r; |
|---|
| 219 | } |
|---|
| 220 | endif; |
|---|
| 221 | + |
|---|
| 222 | +if ( !function_exists( 'wp_text_diff_with_count' ) ) : |
|---|
| 223 | +/** |
|---|
| 224 | + * Displays a human readable HTML representation of the difference between two strings. |
|---|
| 225 | + * similar to wp_text_diff, but tracks and returns could of lines added and removed |
|---|
| 226 | + * |
|---|
| 227 | + * @since 3.6 |
|---|
| 228 | + * @see wp_parse_args() Used to change defaults to user defined settings. |
|---|
| 229 | + * @uses Text_Diff |
|---|
| 230 | + * @uses WP_Text_Diff_Renderer_Table |
|---|
| 231 | + * |
|---|
| 232 | + * @param string $left_string "old" (left) version of string |
|---|
| 233 | + * @param string $right_string "new" (right) version of string |
|---|
| 234 | + * @param string|array $args Optional. Change 'title', 'title_left', and 'title_right' defaults. |
|---|
| 235 | + * @return array contains html, linesadded & linesdeletd, empty string if strings are equivalent. |
|---|
| 236 | + */ |
|---|
| 237 | +function wp_text_diff_with_count( $left_string, $right_string, $args = null ) { |
|---|
| 238 | + $defaults = array( 'title' => '', 'title_left' => '', 'title_right' => '' ); |
|---|
| 239 | + $args = wp_parse_args( $args, $defaults ); |
|---|
| 240 | + |
|---|
| 241 | + if ( !class_exists( 'WP_Text_Diff_Renderer_Table' ) ) |
|---|
| 242 | + require( ABSPATH . WPINC . '/wp-diff.php' ); |
|---|
| 243 | + |
|---|
| 244 | + $left_string = normalize_whitespace( $left_string ); |
|---|
| 245 | + $right_string = normalize_whitespace( $right_string ); |
|---|
| 246 | + |
|---|
| 247 | + $left_lines = explode( "\n", $left_string ); |
|---|
| 248 | + $right_lines = explode( "\n", $right_string) ; |
|---|
| 249 | + |
|---|
| 250 | + $text_diff = new Text_Diff($left_lines, $right_lines ); |
|---|
| 251 | + $linesadded = $text_diff->countAddedLines(); |
|---|
| 252 | + $linesdeleted = $text_diff->countDeletedLines(); |
|---|
| 253 | + |
|---|
| 254 | + $renderer = new WP_Text_Diff_Renderer_Table(); |
|---|
| 255 | + $diff = $renderer->render( $text_diff ); |
|---|
| 256 | + |
|---|
| 257 | + if ( !$diff ) |
|---|
| 258 | + return ''; |
|---|
| 259 | + |
|---|
| 260 | + $r = "<table class='diff'>\n"; |
|---|
| 261 | + |
|---|
| 262 | + if ( ! empty( $args[ 'show_split_view' ] ) ) { |
|---|
| 263 | + $r .= "<col class='content diffsplit left' /><col class='content diffsplit middle' /><col class='content diffsplit right' />"; |
|---|
| 264 | + } else { |
|---|
| 265 | + $r .= "<col class='content' />"; |
|---|
| 266 | + } |
|---|
| 267 | + |
|---|
| 268 | + if ( $args['title'] || $args['title_left'] || $args['title_right'] ) |
|---|
| 269 | + $r .= "<thead>"; |
|---|
| 270 | + if ( $args['title'] ) |
|---|
| 271 | + $r .= "<tr class='diff-title'><th colspan='4'>$args[title]</th></tr>\n"; |
|---|
| 272 | + if ( $args['title_left'] || $args['title_right'] ) { |
|---|
| 273 | + $r .= "<tr class='diff-sub-title'>\n"; |
|---|
| 274 | + $r .= "\t<td></td><th>$args[title_left]</th>\n"; |
|---|
| 275 | + $r .= "\t<td></td><th>$args[title_right]</th>\n"; |
|---|
| 276 | + $r .= "</tr>\n"; |
|---|
| 277 | + } |
|---|
| 278 | + if ( $args['title'] || $args['title_left'] || $args['title_right'] ) |
|---|
| 279 | + $r .= "</thead>\n"; |
|---|
| 280 | + |
|---|
| 281 | + $r .= "<tbody>\n$diff\n</tbody>\n"; |
|---|
| 282 | + $r .= "</table>"; |
|---|
| 283 | + |
|---|
| 284 | + return array( 'html' => $r, 'linesadded' => $linesadded, 'linesdeleted' => $linesdeleted ); |
|---|
| 285 | + } |
|---|
| 286 | + endif; |
|---|
| 287 | Index: wp-includes/script-loader.php |
|---|
| 288 | =================================================================== |
|---|
| 289 | --- wp-includes/script-loader.php (revision 23693) |
|---|
| 290 | +++ wp-includes/script-loader.php (working copy) |
|---|
| 291 | @@ -273,7 +273,7 @@ |
|---|
| 292 | $scripts->add( 'template', "/wp-includes/js/template$suffix.js", array('underscore'), '1.4.4', 1 ); |
|---|
| 293 | $scripts->add( 'backbone', '/wp-includes/js/backbone.min.js', array('underscore','jquery', 'template'), '0.9.10', 1 ); |
|---|
| 294 | |
|---|
| 295 | - $scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'backbone', 'jquery-ui-slider' ), false, 1 ); |
|---|
| 296 | + $scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'backbone', 'jquery-ui-slider', 'jquery-ui-tooltip' ), false, 1 ); |
|---|
| 297 | |
|---|
| 298 | $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.8', 1 ); |
|---|
| 299 | |
|---|
| 300 | Index: wp-admin/includes/ajax-actions.php |
|---|
| 301 | =================================================================== |
|---|
| 302 | --- wp-admin/includes/ajax-actions.php (revision 23693) |
|---|
| 303 | +++ wp-admin/includes/ajax-actions.php (working copy) |
|---|
| 304 | @@ -2137,26 +2137,13 @@ |
|---|
| 305 | /* translators: revision date format, see http://php.net/date */ |
|---|
| 306 | $datef = _x( 'j F, Y @ G:i:s', 'revision date format'); |
|---|
| 307 | |
|---|
| 308 | + $left_revision = get_post( $compare_to ); |
|---|
| 309 | + //error_log($left_revision); |
|---|
| 310 | //single model fetch mode |
|---|
| 311 | + //return the diff of a single revision comparison |
|---|
| 312 | if ( 0 != $single_revision_id ) { |
|---|
| 313 | - $left_revision = get_post( $compare_to ); |
|---|
| 314 | $right_revision = get_post( $single_revision_id ); |
|---|
| 315 | |
|---|
| 316 | - if ( $compare_two_mode ) { |
|---|
| 317 | - $compare_to_gravatar = get_avatar( $left_revision->post_author, 18 ); |
|---|
| 318 | - $compare_to_author = get_the_author_meta( 'display_name', $left_revision->post_author ); |
|---|
| 319 | - $compare_to_date = date_i18n( $datef, strtotime( $left_revision->post_modified ) ); |
|---|
| 320 | - |
|---|
| 321 | - $revision_from_date_author = sprintf( |
|---|
| 322 | - '%s %s, %s %s (%s)', |
|---|
| 323 | - $compare_to_gravatar, |
|---|
| 324 | - $compare_to_author, |
|---|
| 325 | - human_time_diff( strtotime( $left_revision->post_modified ), current_time( 'timestamp' ) ), |
|---|
| 326 | - __( ' ago ' ), |
|---|
| 327 | - $compare_to_date |
|---|
| 328 | - ); |
|---|
| 329 | - } |
|---|
| 330 | - |
|---|
| 331 | // |
|---|
| 332 | //make sure the left revision is the most recent |
|---|
| 333 | // |
|---|
| 334 | @@ -2166,6 +2153,9 @@ |
|---|
| 335 | $right_revision = $temp; |
|---|
| 336 | } |
|---|
| 337 | |
|---|
| 338 | + $linesadded=0; |
|---|
| 339 | + $linesdeleted=0; |
|---|
| 340 | + |
|---|
| 341 | // |
|---|
| 342 | //compare from left to right, passed from application |
|---|
| 343 | // |
|---|
| 344 | @@ -2181,41 +2171,77 @@ |
|---|
| 345 | if ( ! empty( $show_split_view ) ) |
|---|
| 346 | $args = array( 'show_split_view' => true ); |
|---|
| 347 | |
|---|
| 348 | - $content .= wp_text_diff( $left_content, $right_content, $args ); |
|---|
| 349 | + $diff = wp_text_diff_with_count( $left_content, $right_content, $args ); |
|---|
| 350 | + |
|---|
| 351 | + if ( isset( $diff[ 'html' ] ) ) |
|---|
| 352 | + $content .= $diff[ 'html' ]; |
|---|
| 353 | + |
|---|
| 354 | + if ( isset( $diff[ 'linesadded' ] ) ) |
|---|
| 355 | + $linesadded = $linesadded + $diff[ 'linesadded' ]; |
|---|
| 356 | + |
|---|
| 357 | + if ( isset( $diff[ 'linesdeleted' ] ) ) |
|---|
| 358 | + $linesdeleted = $linesdeleted + $diff[ 'linesdeleted' ]; |
|---|
| 359 | + |
|---|
| 360 | + |
|---|
| 361 | } |
|---|
| 362 | - $content = '' == $content ? __( 'No difference' ) : $content; |
|---|
| 363 | - $alltherevisions = array ( |
|---|
| 364 | - 'revisiondiff' => $content |
|---|
| 365 | - ); |
|---|
| 366 | + $content = '' == $content ? __( 'No difference' ) : $content; |
|---|
| 367 | + |
|---|
| 368 | + $alltherevisions = array ( |
|---|
| 369 | + 'revisiondiff' => $content, |
|---|
| 370 | + 'lines_deleted' => $linesdeleted, |
|---|
| 371 | + 'lines_added' => $linesadded |
|---|
| 372 | + ); |
|---|
| 373 | echo json_encode( $alltherevisions ); |
|---|
| 374 | exit(); |
|---|
| 375 | - } |
|---|
| 376 | + } //end single model fetch |
|---|
| 377 | |
|---|
| 378 | + //fetch the list of revisions available |
|---|
| 379 | + |
|---|
| 380 | //if we are comparing two revisions, the first 'revision' represented by the leftmost |
|---|
| 381 | //slider position is the current revision, prepend a comparison to this revision |
|---|
| 382 | - if ( $compare_two_mode ) |
|---|
| 383 | - array_unshift( $revisions, get_post( $post_id ) ); |
|---|
| 384 | - |
|---|
| 385 | + if ( ! wp_first_revision_matches_current_version( $post_id ) ) //revisions don't have current version |
|---|
| 386 | + array_unshift( $revisions, get_post( $post_id ) ) ; |
|---|
| 387 | + //$revisions->append ( get_post( $post_id ) ); |
|---|
| 388 | + //error_log( var_dump( $revisions )); |
|---|
| 389 | $count = -1; |
|---|
| 390 | |
|---|
| 391 | + //reverse the list to start with oldes revision |
|---|
| 392 | + $revisions = array_reverse( $revisions ); |
|---|
| 393 | + |
|---|
| 394 | + $previous_revision_id = 0; |
|---|
| 395 | foreach ( $revisions as $revision ) : |
|---|
| 396 | - if ( ! empty( $show_autosaves ) && wp_is_post_autosave( $revision ) ) |
|---|
| 397 | + //error_log( ( $show_autosaves )); |
|---|
| 398 | + if ( empty( $show_autosaves ) && wp_is_post_autosave( $revision ) ) |
|---|
| 399 | continue; |
|---|
| 400 | |
|---|
| 401 | $revision_from_date_author = ''; |
|---|
| 402 | $count++; |
|---|
| 403 | // return blank data for diffs to the left of the left handle (for right handel model) |
|---|
| 404 | // or to the right of the right handle (for left handel model) |
|---|
| 405 | - if ( ( 0 != $left_handle_at && $count <= $left_handle_at ) || |
|---|
| 406 | - ( 0 != $right_handle_at && $count > $right_handle_at )) { |
|---|
| 407 | + if ( ( 0 != $left_handle_at && $count <= $left_handle_at ) || |
|---|
| 408 | + ( 0 != $right_handle_at && $count > $right_handle_at )) { |
|---|
| 409 | $alltherevisions[] = array ( |
|---|
| 410 | 'ID' => $revision->ID, |
|---|
| 411 | ); |
|---|
| 412 | - |
|---|
| 413 | continue; |
|---|
| 414 | } |
|---|
| 415 | |
|---|
| 416 | - $gravatar = get_avatar( $revision->post_author, 18 ); |
|---|
| 417 | + if ( $compare_two_mode ) { |
|---|
| 418 | + $compare_to_gravatar = get_avatar( $left_revision->post_author, 24 ); |
|---|
| 419 | + $compare_to_author = get_the_author_meta( 'display_name', $left_revision->post_author ); |
|---|
| 420 | + $compare_to_date = date_i18n( $datef, strtotime( $left_revision->post_modified ) ); |
|---|
| 421 | + |
|---|
| 422 | + $revision_from_date_author = sprintf( |
|---|
| 423 | + '%s %s, %s %s (%s)', |
|---|
| 424 | + $compare_to_gravatar, |
|---|
| 425 | + $compare_to_author, |
|---|
| 426 | + human_time_diff( strtotime( $left_revision->post_modified ), current_time( 'timestamp' ) ), |
|---|
| 427 | + __( ' ago ' ), |
|---|
| 428 | + $compare_to_date |
|---|
| 429 | + ); |
|---|
| 430 | + } |
|---|
| 431 | + |
|---|
| 432 | + $gravatar = get_avatar( $revision->post_author, 24 ); |
|---|
| 433 | $author = get_the_author_meta( 'display_name', $revision->post_author ); |
|---|
| 434 | $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); |
|---|
| 435 | $revision_date_author = sprintf( |
|---|
| 436 | @@ -2226,7 +2252,16 @@ |
|---|
| 437 | __( ' ago ' ), |
|---|
| 438 | $date |
|---|
| 439 | ); |
|---|
| 440 | + $datef2 = __( 'j M @ G:i' ); |
|---|
| 441 | + $date2 = date_i18n( $datef2, strtotime( $revision->post_modified ) ); |
|---|
| 442 | |
|---|
| 443 | + $revision_date_author_short = sprintf( |
|---|
| 444 | + '%s <strong>%s</strong><br />%s', |
|---|
| 445 | + $gravatar, |
|---|
| 446 | + $author, |
|---|
| 447 | + $date2 |
|---|
| 448 | + ); |
|---|
| 449 | + |
|---|
| 450 | $restoreaction = wp_nonce_url( |
|---|
| 451 | add_query_arg( |
|---|
| 452 | array( 'revision' => $revision->ID, |
|---|
| 453 | @@ -2236,13 +2271,18 @@ |
|---|
| 454 | "restore-post_{$compare_to}|{$revision->ID}" |
|---|
| 455 | ); |
|---|
| 456 | |
|---|
| 457 | - $alltherevisions[] = array ( |
|---|
| 458 | + if ( ( $compare_two_mode || 0 !== $previous_revision_id ) ) { |
|---|
| 459 | + $alltherevisions[] = array ( |
|---|
| 460 | 'ID' => $revision->ID, |
|---|
| 461 | 'revision_date_author' => $revision_date_author, |
|---|
| 462 | 'revision_from_date_author' => $revision_from_date_author, |
|---|
| 463 | + 'revision_date_author_short' => $revision_date_author_short, |
|---|
| 464 | 'restoreaction' => urldecode( $restoreaction ), |
|---|
| 465 | - 'revision_toload' => true |
|---|
| 466 | + 'revision_toload' => true, |
|---|
| 467 | + 'previous_revision_id' => $previous_revision_id |
|---|
| 468 | ); |
|---|
| 469 | + } |
|---|
| 470 | + $previous_revision_id = $revision->ID; |
|---|
| 471 | |
|---|
| 472 | endforeach; |
|---|
| 473 | |
|---|
| 474 | Index: wp-admin/js/revisions.js |
|---|
| 475 | =================================================================== |
|---|
| 476 | --- wp-admin/js/revisions.js (revision 23693) |
|---|
| 477 | +++ wp-admin/js/revisions.js (working copy) |
|---|
| 478 | @@ -7,19 +7,33 @@ |
|---|
| 479 | |
|---|
| 480 | Model : Backbone.Model.extend({ |
|---|
| 481 | idAttribute : 'ID', |
|---|
| 482 | - urlRoot : ajaxurl + '?action=revisions-data&compare_to=' + wpRevisionsSettings.post_id + |
|---|
| 483 | - '&show_autosaves=false&show_split_view=true&nonce=' + wpRevisionsSettings.nonce, |
|---|
| 484 | + urlRoot : ajaxurl + '?action=revisions-data' + |
|---|
| 485 | + '&show_autosaves=true&show_split_view=true&nonce=' + wpRevisionsSettings.nonce, |
|---|
| 486 | defaults: { |
|---|
| 487 | ID : 0, |
|---|
| 488 | revision_date_author : '', |
|---|
| 489 | + revision_date_author_short: '', |
|---|
| 490 | revisiondiff : '<div class="diff-loading"><div class="spinner"></div></div>', |
|---|
| 491 | restoreaction : '', |
|---|
| 492 | revision_from_date_author : '', |
|---|
| 493 | - revision_toload : false |
|---|
| 494 | + revision_toload : false, |
|---|
| 495 | + lines_added : 0, |
|---|
| 496 | + lines_deleted : 0, |
|---|
| 497 | + scope_of_changes : 'none', |
|---|
| 498 | + previous_revision_id : 0 |
|---|
| 499 | }, |
|---|
| 500 | |
|---|
| 501 | url : function() { |
|---|
| 502 | - return this.urlRoot + '&single_revision_id=' + this.id; |
|---|
| 503 | + if ( 1 === REVAPP._compareoneortwo ) { |
|---|
| 504 | + return this.urlRoot + |
|---|
| 505 | + '&single_revision_id=' + this.id + |
|---|
| 506 | + '&compare_to=' + this.get( 'previous_revision_id' ) + |
|---|
| 507 | + '&post_id=' + wpRevisionsSettings.post_id; |
|---|
| 508 | + } else { |
|---|
| 509 | + return this.urlRoot + |
|---|
| 510 | + '&single_revision_id=' + this.id; |
|---|
| 511 | + } |
|---|
| 512 | + |
|---|
| 513 | } |
|---|
| 514 | |
|---|
| 515 | }), |
|---|
| 516 | @@ -35,11 +49,13 @@ |
|---|
| 517 | _revisionsOptions : null, |
|---|
| 518 | _left_diff : 0, |
|---|
| 519 | _right_diff : 1, |
|---|
| 520 | - _autosaves : false, |
|---|
| 521 | + _autosaves : true, |
|---|
| 522 | _show_split_view : true, |
|---|
| 523 | _compareoneortwo : 1, |
|---|
| 524 | _left_model_loading : false, //keep track of model loads |
|---|
| 525 | _right_model_loading : false, //disallow slider interaction, also repeat loads, while loading |
|---|
| 526 | + _tickmarkView : null, //the slider tickmarks |
|---|
| 527 | + _has_tooltip : false, |
|---|
| 528 | |
|---|
| 529 | //TODO add ability to arrive on specific revision |
|---|
| 530 | routes : { |
|---|
| 531 | @@ -54,7 +70,15 @@ |
|---|
| 532 | var revisions_to_load = model_collection.where( { revision_toload : true } ); |
|---|
| 533 | //console.log(revisions_to_load); |
|---|
| 534 | var delay=0; |
|---|
| 535 | - _.each(revisions_to_load, function( the_model ) { |
|---|
| 536 | + //match slider to passed revision_id |
|---|
| 537 | + _.each( revisions_to_load, function( the_model ) { |
|---|
| 538 | + if ( the_model.get( 'ID' ) == wpRevisionsSettings.revision_id ) { |
|---|
| 539 | + //console.log ( the_model.get( 'ID' ) +'-' +wpRevisionsSettings.revision_id); |
|---|
| 540 | + self._right_diff = self._revisions.indexOf( the_model ) + 1; |
|---|
| 541 | + } |
|---|
| 542 | + |
|---|
| 543 | + }); |
|---|
| 544 | + _.each( revisions_to_load, function( the_model ) { |
|---|
| 545 | the_model.urlRoot = model_collection.url; |
|---|
| 546 | _.delay( function() { |
|---|
| 547 | the_model.fetch( { |
|---|
| 548 | @@ -63,15 +87,43 @@ |
|---|
| 549 | remove : false, |
|---|
| 550 | //async : false, |
|---|
| 551 | success : function( model ) { |
|---|
| 552 | - //console.log(model.get( 'ID' ) +'-'+self._revisions.at( self._right_diff ).get( 'ID' )); |
|---|
| 553 | - if ( model.get( 'ID' ) === self._revisions.at( self._right_diff - 1 ).get( 'ID' ) ) { //reload if current model refreshed |
|---|
| 554 | + model.set( 'revision_toload', 'false' ); |
|---|
| 555 | + //console.log(model_collection.where( { revision_toload : true } ).length); |
|---|
| 556 | + |
|---|
| 557 | + //stop spinner when all models are loaded |
|---|
| 558 | + if ( 0 === model_collection.where( { revision_toload : true } ).length ) |
|---|
| 559 | + self.stop_model_loading_spinner(); |
|---|
| 560 | + |
|---|
| 561 | + self._tickmarkView.render(); |
|---|
| 562 | + |
|---|
| 563 | + var total_changes = model.get( 'lines_added' ) + model.get( 'lines_deleted'); |
|---|
| 564 | + // console.log(total_changes); |
|---|
| 565 | + var scope_of_changes = 'vsmall'; |
|---|
| 566 | + |
|---|
| 567 | + //hard coded scope of changes |
|---|
| 568 | + //TODO change to dynamic based on range of values |
|---|
| 569 | + if ( total_changes > 1 && total_changes <= 3 ) { |
|---|
| 570 | + scope_of_changes = 'small'; |
|---|
| 571 | + } else if(total_changes > 3 && total_changes <= 5 ) { |
|---|
| 572 | + scope_of_changes = 'med'; |
|---|
| 573 | + } else if(total_changes > 5 && total_changes <= 10 ) { |
|---|
| 574 | + scope_of_changes = 'large'; |
|---|
| 575 | + } else if(total_changes > 10 ) { |
|---|
| 576 | + scope_of_changes = 'vlarge'; |
|---|
| 577 | + } |
|---|
| 578 | + model.set( 'scope_of_changes', scope_of_changes ); |
|---|
| 579 | + //console.log (self._right_diff); |
|---|
| 580 | + if ( 0 !== self._right_diff && |
|---|
| 581 | + model.get( 'ID' ) === self._revisions.at( self._right_diff - 1 ).get( 'ID' ) ) { |
|---|
| 582 | + //reload if current model refreshed |
|---|
| 583 | //console.log('render'); |
|---|
| 584 | self._revisionView.render(); |
|---|
| 585 | } |
|---|
| 586 | + |
|---|
| 587 | } |
|---|
| 588 | } ); |
|---|
| 589 | }, delay ) ; |
|---|
| 590 | - delay = delay + 200; //stagger model loads by 200 ms to avoid hammering server with requests |
|---|
| 591 | + delay = delay + 150; //stagger model loads to avoid hammering server with requests |
|---|
| 592 | } |
|---|
| 593 | ); |
|---|
| 594 | }, |
|---|
| 595 | @@ -83,7 +135,6 @@ |
|---|
| 596 | |
|---|
| 597 | stop_left_model_loading : function() { |
|---|
| 598 | this._left_model_loading = false; |
|---|
| 599 | - $('.revisiondiffcontainer').removeClass('leftmodelloading'); |
|---|
| 600 | }, |
|---|
| 601 | |
|---|
| 602 | start_right_model_loading : function() { |
|---|
| 603 | @@ -93,7 +144,11 @@ |
|---|
| 604 | |
|---|
| 605 | stop_right_model_loading : function() { |
|---|
| 606 | this._right_model_loading = false; |
|---|
| 607 | + }, |
|---|
| 608 | + |
|---|
| 609 | + stop_model_loading_spinner : function() { |
|---|
| 610 | $('.revisiondiffcontainer').removeClass('rightmodelloading'); |
|---|
| 611 | + $('.revisiondiffcontainer').removeClass('leftmodelloading'); |
|---|
| 612 | }, |
|---|
| 613 | |
|---|
| 614 | reloadmodel : function() { |
|---|
| 615 | @@ -107,21 +162,27 @@ |
|---|
| 616 | reloadmodelsingle : function() { |
|---|
| 617 | var self = this; |
|---|
| 618 | self._revisions.url = ajaxurl + '?action=revisions-data&compare_to=' + wpRevisionsSettings.post_id + |
|---|
| 619 | - '&show_autosaves=' + self._autosaves + |
|---|
| 620 | + '&show_autosaves=' + REVAPP._autosaves + |
|---|
| 621 | '&show_split_view=' + REVAPP._show_split_view + |
|---|
| 622 | '&nonce=' + wpRevisionsSettings.nonce; |
|---|
| 623 | self.start_right_model_loading(); |
|---|
| 624 | - this._revisions.fetch({ //reload revision data |
|---|
| 625 | + self._revisions.fetch({ //reload revision data |
|---|
| 626 | success : function() { |
|---|
| 627 | self.stop_right_model_loading(); |
|---|
| 628 | var revisioncount = self._revisions.length; |
|---|
| 629 | - if ( self._right_diff > revisioncount ) //if right handle past rightmost, move |
|---|
| 630 | - self._right_diff = revisioncount; |
|---|
| 631 | + //if ( self._right_diff > revisioncount ) //if right handle past rightmost, move |
|---|
| 632 | |
|---|
| 633 | + // self._right_diff = revisioncount; |
|---|
| 634 | + |
|---|
| 635 | + |
|---|
| 636 | + |
|---|
| 637 | self._revisionView.render(); |
|---|
| 638 | self.reload_toload_revisions( self._revisions ); |
|---|
| 639 | |
|---|
| 640 | $( '#slider' ).slider( 'option', 'max', revisioncount-1 ); //TODO test this, autsaves changed |
|---|
| 641 | + $( '#slider' ).slider( 'value', REVAPP._right_diff - 1 ).trigger( 'slide' ); |
|---|
| 642 | + REVAPP._tickmarkView.model = self._revisions; |
|---|
| 643 | + REVAPP._tickmarkView.render(); |
|---|
| 644 | }, |
|---|
| 645 | |
|---|
| 646 | error : function () { |
|---|
| 647 | @@ -136,12 +197,17 @@ |
|---|
| 648 | var self = this; |
|---|
| 649 | self.start_left_model_loading(); |
|---|
| 650 | self._left_handle_revisions = new wp.revisions.Collection(); |
|---|
| 651 | + //console.log( 'right - ' + self._right_diff ); |
|---|
| 652 | + //if ( self._right_diff > self._revisions.length) |
|---|
| 653 | + //self._right_diff = self._right_diff-1; |
|---|
| 654 | + //console.log (REVAPP._right_diff ); |
|---|
| 655 | + |
|---|
| 656 | self._left_handle_revisions.url = |
|---|
| 657 | ajaxurl + |
|---|
| 658 | '?action=revisions-data&compare_to=' + self._revisions.at( self._right_diff - 1 ).get( 'ID' ) + |
|---|
| 659 | '&post_id=' + wpRevisionsSettings.post_id + |
|---|
| 660 | - '&show_autosaves=' + self._autosaves + |
|---|
| 661 | - '&show_split_view=' + self._show_split_view + |
|---|
| 662 | + '&show_autosaves=' + REVAPP._autosaves + |
|---|
| 663 | + '&show_split_view=' + REVAPP._show_split_view + |
|---|
| 664 | '&nonce=' + wpRevisionsSettings.nonce + |
|---|
| 665 | '&right_handle_at=' + ( self._right_diff ); |
|---|
| 666 | |
|---|
| 667 | @@ -150,6 +216,8 @@ |
|---|
| 668 | success : function(){ |
|---|
| 669 | self.stop_left_model_loading(); |
|---|
| 670 | self.reload_toload_revisions( self._left_handle_revisions ); |
|---|
| 671 | + self._tickmarkView.model = self._left_handle_revisions; |
|---|
| 672 | + $( '#slider' ).slider( 'option', 'max', self._revisions.length ); |
|---|
| 673 | }, |
|---|
| 674 | |
|---|
| 675 | error : function () { |
|---|
| 676 | @@ -163,30 +231,27 @@ |
|---|
| 677 | var self = this; |
|---|
| 678 | self.start_right_model_loading(); |
|---|
| 679 | self._right_handle_revisions = new wp.revisions.Collection(); |
|---|
| 680 | - if ( 0 === self._left_diff ) { |
|---|
| 681 | + //console.log (REVAPP._left_diff ); |
|---|
| 682 | + |
|---|
| 683 | self._right_handle_revisions.url = |
|---|
| 684 | ajaxurl + |
|---|
| 685 | - '?action=revisions-data&compare_to=' + wpRevisionsSettings.post_id + |
|---|
| 686 | + '?action=revisions-data&compare_to=' + ( self._revisions.at( self._left_diff ).get( 'ID' ) - 1 )+ |
|---|
| 687 | '&post_id=' + wpRevisionsSettings.post_id + |
|---|
| 688 | - '&show_autosaves=' + self._autosaves + |
|---|
| 689 | - '&show_split_view=' + self._show_split_view + |
|---|
| 690 | + '&show_autosaves=' + REVAPP._autosaves + |
|---|
| 691 | + '&show_split_view=' + REVAPP._show_split_view + |
|---|
| 692 | '&nonce=' + wpRevisionsSettings.nonce; |
|---|
| 693 | - } else { |
|---|
| 694 | - self._right_handle_revisions.url = |
|---|
| 695 | - ajaxurl + |
|---|
| 696 | - '?action=revisions-data&compare_to=' + self._revisions.at( self._left_diff - 1 ).get( 'ID' ) + |
|---|
| 697 | - '&post_id=' + wpRevisionsSettings.post_id + |
|---|
| 698 | - '&show_autosaves=' + self._autosaves + |
|---|
| 699 | - '&show_split_view=' + self._show_split_view + |
|---|
| 700 | - '&nonce=' + wpRevisionsSettings.nonce + |
|---|
| 701 | - '&left_handle_at=' + (self._left_diff ) ; |
|---|
| 702 | - } |
|---|
| 703 | |
|---|
| 704 | self._right_handle_revisions.fetch({ |
|---|
| 705 | |
|---|
| 706 | success : function(){ |
|---|
| 707 | self.stop_right_model_loading(); |
|---|
| 708 | self.reload_toload_revisions( self._right_handle_revisions ); |
|---|
| 709 | + self._tickmarkView.model = self._right_handle_revisions; |
|---|
| 710 | + $( '#slider' ).slider( 'option', 'max', self._revisions.length ); |
|---|
| 711 | + $( '#slider' ).slider( 'values', [ REVAPP._left_diff, REVAPP._right_diff] ).trigger( 'slide' ); |
|---|
| 712 | + |
|---|
| 713 | + //REVAPP._revisionView.render(); |
|---|
| 714 | + |
|---|
| 715 | }, |
|---|
| 716 | |
|---|
| 717 | error : function ( response ) { |
|---|
| 718 | @@ -208,36 +273,81 @@ |
|---|
| 719 | initialize : function( options ) { |
|---|
| 720 | var self = this; //store the application instance |
|---|
| 721 | if (this._revisions === null) { |
|---|
| 722 | - self._autosaves = ''; |
|---|
| 723 | self._revisions = new wp.revisions.Collection(); //set up collection |
|---|
| 724 | self.start_right_model_loading(); |
|---|
| 725 | self._revisions.fetch({ //load revision data |
|---|
| 726 | |
|---|
| 727 | success : function() { |
|---|
| 728 | self.stop_right_model_loading(); |
|---|
| 729 | - self.revisionDiffSetup(); |
|---|
| 730 | + self.completeApplicationSetup(); |
|---|
| 731 | } |
|---|
| 732 | }); |
|---|
| 733 | } |
|---|
| 734 | return this; |
|---|
| 735 | }, |
|---|
| 736 | |
|---|
| 737 | - revisionDiffSetup : function() { |
|---|
| 738 | + addTooltip : function( handle, message ) { |
|---|
| 739 | + |
|---|
| 740 | + handle.attr( 'title', '' ).tooltip({ |
|---|
| 741 | + track: false, |
|---|
| 742 | + |
|---|
| 743 | + position: { |
|---|
| 744 | + my: "left-22 top-66", |
|---|
| 745 | + at: "top left", |
|---|
| 746 | + of: handle, |
|---|
| 747 | + using: function( position, feedback ) { |
|---|
| 748 | + //console.log(this); |
|---|
| 749 | + $( this ).css( position ); |
|---|
| 750 | + $( "<div>" ) |
|---|
| 751 | + .addClass( "arrow" ) |
|---|
| 752 | + .addClass( feedback.vertical ) |
|---|
| 753 | + .addClass( feedback.horizontal ) |
|---|
| 754 | + .appendTo( $( this ) ); |
|---|
| 755 | + } |
|---|
| 756 | + }, |
|---|
| 757 | + show: false, |
|---|
| 758 | + hide: false, |
|---|
| 759 | + content: function() { |
|---|
| 760 | + return message; |
|---|
| 761 | + } |
|---|
| 762 | + |
|---|
| 763 | + } ); |
|---|
| 764 | + }, |
|---|
| 765 | +/**/ |
|---|
| 766 | + |
|---|
| 767 | + completeApplicationSetup : function() { |
|---|
| 768 | this._revisionView = new wp.revisions.views.View({ |
|---|
| 769 | model : this._revisions |
|---|
| 770 | }); |
|---|
| 771 | this._revisionView.render(); |
|---|
| 772 | - $( '#diff_max, #diff_maxof' ).html( this._revisions.length ); |
|---|
| 773 | - $( '#diff_count' ).html( REVAPP._right_diff ); |
|---|
| 774 | $( '#slider' ).slider( 'option', 'max', this._revisions.length - 1 ); |
|---|
| 775 | |
|---|
| 776 | this.reload_toload_revisions( this._revisions ); |
|---|
| 777 | + |
|---|
| 778 | this._revisionsInteractions = new wp.revisions.views.Interact({ |
|---|
| 779 | model : this._revisions |
|---|
| 780 | }); |
|---|
| 781 | this._revisionsInteractions.render(); |
|---|
| 782 | |
|---|
| 783 | + this._tickmarkView = new wp.revisions.views.Tickmarks({ |
|---|
| 784 | + model : this._revisions |
|---|
| 785 | + }); |
|---|
| 786 | + this._tickmarkView.render(); |
|---|
| 787 | + this._tickmarkView.resetticks(); |
|---|
| 788 | + |
|---|
| 789 | + |
|---|
| 790 | /* |
|---|
| 791 | + .on( 'mouseup', function( event ) { |
|---|
| 792 | + REVAPP._keep_tooltip_open = false; |
|---|
| 793 | + $( this ).find('.ui-slider-tooltip').hide(); |
|---|
| 794 | + } ).on( 'mousedown', function( event ) { |
|---|
| 795 | + REVAPP._keep_tooltip_open = true; |
|---|
| 796 | + } ).on( 'mouseout', function( event ) { |
|---|
| 797 | + if ( REVAPP._keep_tooltip_open) |
|---|
| 798 | + event.stopImmediatePropagation(); |
|---|
| 799 | + }); |
|---|
| 800 | + */ |
|---|
| 801 | + /* |
|---|
| 802 | //Options hidden for now, moving to screen options |
|---|
| 803 | this._revisionsOptions = new wp.revisions.views.Options({ |
|---|
| 804 | model : this._revisions |
|---|
| 805 | @@ -252,14 +362,80 @@ |
|---|
| 806 | wp.revisions.Collection = Backbone.Collection.extend({ |
|---|
| 807 | model : wp.revisions.Model, |
|---|
| 808 | url : ajaxurl + '?action=revisions-data&compare_to=' + wpRevisionsSettings.post_id + |
|---|
| 809 | - '&show_autosaves=false&show_split_view=true&nonce=' + wpRevisionsSettings.nonce, |
|---|
| 810 | + '&show_autosaves=true&show_split_view=true&nonce=' + wpRevisionsSettings.nonce, |
|---|
| 811 | |
|---|
| 812 | initialize : function() { |
|---|
| 813 | } |
|---|
| 814 | } ); |
|---|
| 815 | |
|---|
| 816 | _.extend(wp.revisions.views, { |
|---|
| 817 | + |
|---|
| 818 | + //Ticks inside slider view |
|---|
| 819 | // |
|---|
| 820 | + Tickmarks : Backbone.View.extend({ |
|---|
| 821 | + el : $('#diff-slider-ticks')[0], |
|---|
| 822 | + tagName : 'diff-slider-ticks-view', |
|---|
| 823 | + className : 'diff-slider-ticks-container', |
|---|
| 824 | + template : wp.template('revision-ticks'), |
|---|
| 825 | + model : wp.revisions.Model, |
|---|
| 826 | + |
|---|
| 827 | + resetticks : function() { |
|---|
| 828 | + var slider_max = $( '#slider' ).slider( 'option', 'max'); |
|---|
| 829 | + var slider_width = $( '#slider' ).width(); |
|---|
| 830 | + var adjust_max = ( 2 === REVAPP._compareoneortwo ) ? 1 : 0; |
|---|
| 831 | + var tick_width = Math.floor( slider_width / ( slider_max - adjust_max ) ); |
|---|
| 832 | + |
|---|
| 833 | + //TODO: adjust right margins for wider ticks so they stay centered on handle stop point |
|---|
| 834 | + |
|---|
| 835 | + tick_width = (tick_width > 50 ) ? 50 : tick_width; |
|---|
| 836 | + tick_width = (tick_width < 10 ) ? 10 : tick_width; |
|---|
| 837 | + |
|---|
| 838 | + slider_width = tick_width * (slider_max - adjust_max ) +1; |
|---|
| 839 | + |
|---|
| 840 | + $( '#slider' ).width( slider_width ); |
|---|
| 841 | + $( '.diff-slider-ticks-wrapper' ).width( slider_width ); |
|---|
| 842 | + $( '#diffslider' ).width( slider_width ); |
|---|
| 843 | + $( '#diff-slider-ticks' ).width( slider_width ); |
|---|
| 844 | + |
|---|
| 845 | + var a_tick_width = $( '.revision-tick' ).width(); |
|---|
| 846 | + |
|---|
| 847 | + if ( tick_width !== a_tick_width ) { // is the width already set correctly? |
|---|
| 848 | + $( '.revision-tick' ).each( function( ) { |
|---|
| 849 | + $(this).css( 'margin-right', tick_width - 1 + 'px'); //space the ticks out using right margin |
|---|
| 850 | + }); |
|---|
| 851 | + |
|---|
| 852 | + if( 2 === REVAPP._compareoneortwo ) { |
|---|
| 853 | + $( '.revision-tick' ).first().remove(); //TODO - remove the check |
|---|
| 854 | + } |
|---|
| 855 | + $( '.revision-tick' ).last().css( 'margin-right', '0' ); // last tick gets no right margin |
|---|
| 856 | + } |
|---|
| 857 | + |
|---|
| 858 | + }, |
|---|
| 859 | + |
|---|
| 860 | + //render the tickmark view |
|---|
| 861 | + render : function() { |
|---|
| 862 | + var self = this; |
|---|
| 863 | + |
|---|
| 864 | + if ( null !== self.model ) { |
|---|
| 865 | + //TODO remove this initial model when ticket #16215 rolls because |
|---|
| 866 | + //revisions will then include current version |
|---|
| 867 | + var add_placeholder = ( 2 === REVAPP._compareoneortwo ) ? self.template('') : ''; |
|---|
| 868 | + |
|---|
| 869 | + var addhtml = "";//add_placeholder; |
|---|
| 870 | + _.each ( self.model.models, function ( the_model ) { |
|---|
| 871 | + |
|---|
| 872 | + addhtml = addhtml + self.template ( the_model.toJSON() ); |
|---|
| 873 | + |
|---|
| 874 | + }); |
|---|
| 875 | + self.$el.html( addhtml ); |
|---|
| 876 | + |
|---|
| 877 | + } |
|---|
| 878 | + self.resetticks(); |
|---|
| 879 | + return self; |
|---|
| 880 | + } |
|---|
| 881 | + }), |
|---|
| 882 | + |
|---|
| 883 | + // |
|---|
| 884 | //primary revision diff view |
|---|
| 885 | // |
|---|
| 886 | View : Backbone.View.extend({ |
|---|
| 887 | @@ -267,19 +443,16 @@ |
|---|
| 888 | tagName : 'revisionvview', |
|---|
| 889 | className : 'revisionview-container', |
|---|
| 890 | template : wp.template('revision'), |
|---|
| 891 | - revvapp : null, |
|---|
| 892 | comparetwochecked : '', |
|---|
| 893 | draggingleft : false, |
|---|
| 894 | |
|---|
| 895 | - initialize : function(){ |
|---|
| 896 | - }, |
|---|
| 897 | - |
|---|
| 898 | // |
|---|
| 899 | //render the revisions |
|---|
| 900 | // |
|---|
| 901 | render : function() { |
|---|
| 902 | var addhtml = ''; |
|---|
| 903 | //compare two revisions mode? |
|---|
| 904 | + |
|---|
| 905 | if ( 2 === REVAPP._compareoneortwo ) { |
|---|
| 906 | this.comparetwochecked = 'checked'; |
|---|
| 907 | if ( this.draggingleft ) { |
|---|
| 908 | @@ -291,6 +464,7 @@ |
|---|
| 909 | } |
|---|
| 910 | } else { //dragging right handle |
|---|
| 911 | var thediff = REVAPP._right_diff; |
|---|
| 912 | + //console.log( thediff ) |
|---|
| 913 | if ( this.model.at( thediff ) ) { |
|---|
| 914 | addhtml = this.template( _.extend( |
|---|
| 915 | this.model.at( thediff ).toJSON(), |
|---|
| 916 | @@ -310,9 +484,25 @@ |
|---|
| 917 | this.$el.html( addhtml ); |
|---|
| 918 | if ( this.model.length < 3 ) { |
|---|
| 919 | $( 'div#comparetworevisions' ).hide(); //don't allow compare two if fewer than three revisions |
|---|
| 920 | + } |
|---|
| 921 | + if ( this.model.length < 2 ) { |
|---|
| 922 | + $( 'div#diffslider' ).hide(); //don't allow compare two if fewer than three revisions |
|---|
| 923 | + $( 'div.diff-slider-ticks-wrapper' ).hide(); |
|---|
| 924 | + } |
|---|
| 925 | + //console.log ( (this.model.at( REVAPP._right_diff - 1 )).url()); |
|---|
| 926 | |
|---|
| 927 | + if ( 2 === REVAPP._compareoneortwo && REVAPP._revisionView.draggingleft ) { |
|---|
| 928 | + REVAPP.addTooltip ( $( 'a.ui-slider-handle.left-handle' ), |
|---|
| 929 | + ( REVAPP._right_diff >= REVAPP._revisions.length ) ? '' : REVAPP._revisions.at( REVAPP._left_diff ).get( 'revision_date_author_short' ) ); |
|---|
| 930 | + REVAPP.addTooltip ( $( 'a.ui-slider-handle.right-handle' ), |
|---|
| 931 | + ( REVAPP._right_diff >= REVAPP._revisions.length ) ? '' : REVAPP._revisions.at( REVAPP._right_diff ).get( 'revision_date_author_short' ) ); |
|---|
| 932 | + } else { |
|---|
| 933 | + REVAPP.addTooltip ( $( 'a.ui-slider-handle' ), |
|---|
| 934 | + ( REVAPP._right_diff >= REVAPP._revisions.length ) ? '' : REVAPP._revisions.at( REVAPP._right_diff ).get( 'revision_date_author_short' ) ); |
|---|
| 935 | } |
|---|
| 936 | - //console.log ( (this.model.at( REVAPP._right_diff - 1 )).url()); |
|---|
| 937 | + // } else { |
|---|
| 938 | + |
|---|
| 939 | + // } |
|---|
| 940 | return this; |
|---|
| 941 | }, |
|---|
| 942 | |
|---|
| 943 | @@ -326,31 +516,44 @@ |
|---|
| 944 | // |
|---|
| 945 | clickcomparetwo : function(){ |
|---|
| 946 | self = this; |
|---|
| 947 | + |
|---|
| 948 | if ( $( 'input#comparetwo' ).is( ':checked' ) ) { |
|---|
| 949 | REVAPP._compareoneortwo = 2 ; |
|---|
| 950 | + if ( 0 === REVAPP._left_diff ) |
|---|
| 951 | + REVAPP._left_diff = 1; |
|---|
| 952 | + |
|---|
| 953 | + |
|---|
| 954 | + if ( 1 === REVAPP._right_diff ) |
|---|
| 955 | + REVAPP._right_diff = 2; |
|---|
| 956 | + |
|---|
| 957 | + wpRevisionsSettings.revision_id = ''; // reset passed revision id so switching back to one handle mode doesn't re-select revision |
|---|
| 958 | REVAPP.reloadleftright(); |
|---|
| 959 | + REVAPP._revisionView.draggingleft = true; |
|---|
| 960 | + REVAPP._revisionView.model = REVAPP._left_handle_revisions; |
|---|
| 961 | + REVAPP._tickmarkView.model = REVAPP._left_handle_revisions; |
|---|
| 962 | } else { |
|---|
| 963 | REVAPP._compareoneortwo = 1 ; |
|---|
| 964 | REVAPP._revisionView.draggingleft = false; |
|---|
| 965 | REVAPP._left_diff = 0; |
|---|
| 966 | + REVAPP._right_diff = (REVAPP._revisions.length <= REVAPP._right_diff ) ? REVAPP._right_diff : REVAPP._right_diff +1; |
|---|
| 967 | REVAPP.reloadmodelsingle(); |
|---|
| 968 | } |
|---|
| 969 | REVAPP._revisionsInteractions.render(); |
|---|
| 970 | + REVAPP._tickmarkView.render(); |
|---|
| 971 | + //REVAPP._revisionView.render(); |
|---|
| 972 | } |
|---|
| 973 | }), |
|---|
| 974 | |
|---|
| 975 | // |
|---|
| 976 | //options view for show autosaves and show split view options |
|---|
| 977 | // |
|---|
| 978 | + /* DISABLED for now |
|---|
| 979 | Options : Backbone.View.extend({ |
|---|
| 980 | el : $('#backbonerevisionsoptions')[0], |
|---|
| 981 | tagName : 'revisionoptionsview', |
|---|
| 982 | className : 'revisionoptions-container', |
|---|
| 983 | template : wp.template('revisionoptions'), |
|---|
| 984 | |
|---|
| 985 | - initialize : function() { |
|---|
| 986 | - }, |
|---|
| 987 | - |
|---|
| 988 | //render the options view |
|---|
| 989 | render : function() { |
|---|
| 990 | var addhtml = this.template; |
|---|
| 991 | @@ -396,7 +599,7 @@ |
|---|
| 992 | REVAPP.reloadmodel(); |
|---|
| 993 | } |
|---|
| 994 | }), |
|---|
| 995 | - |
|---|
| 996 | + */ |
|---|
| 997 | // |
|---|
| 998 | //main interactions view |
|---|
| 999 | // |
|---|
| 1000 | @@ -405,25 +608,15 @@ |
|---|
| 1001 | tagName : 'revisionvinteract', |
|---|
| 1002 | className : 'revisionvinteract-container', |
|---|
| 1003 | template : wp.template('revisionvinteract'), |
|---|
| 1004 | - _restoreword : '', |
|---|
| 1005 | |
|---|
| 1006 | initialize : function() { |
|---|
| 1007 | - this._restoreword = $( 'input#restore' ).attr( 'value' ); |
|---|
| 1008 | }, |
|---|
| 1009 | |
|---|
| 1010 | - reset_restore_button : function() { |
|---|
| 1011 | - $( 'input#restore' ).attr( 'value', this._restoreword + ' ' + REVAPP._revisions.at( REVAPP._right_diff - 1 ).get( 'ID' ) ); |
|---|
| 1012 | - }, |
|---|
| 1013 | - |
|---|
| 1014 | render : function() { |
|---|
| 1015 | var self = this; |
|---|
| 1016 | |
|---|
| 1017 | var addhtml = this.template; |
|---|
| 1018 | this.$el.html( addhtml ); |
|---|
| 1019 | - $( '#diff_max, #diff_maxof' ).html( this.model.length ); |
|---|
| 1020 | - $( '#diff_count' ).html( REVAPP._right_diff ); |
|---|
| 1021 | - $( '#diff_left_count_inner' ).html( 0 === REVAPP._left_diff ? '' : 'revision' + REVAPP._left_diff ); |
|---|
| 1022 | - self.reset_restore_button(); |
|---|
| 1023 | |
|---|
| 1024 | var modelcount = REVAPP._revisions.length; |
|---|
| 1025 | |
|---|
| 1026 | @@ -431,23 +624,45 @@ |
|---|
| 1027 | if ( 1 === REVAPP._compareoneortwo ) { |
|---|
| 1028 | //set up the slider with a single handle |
|---|
| 1029 | slider.slider({ |
|---|
| 1030 | - value : REVAPP._right_diff-1, |
|---|
| 1031 | - min : 0, |
|---|
| 1032 | - max : modelcount-1, |
|---|
| 1033 | - step : 1, |
|---|
| 1034 | + value: REVAPP._right_diff-1, |
|---|
| 1035 | + min: 0, |
|---|
| 1036 | + max: modelcount-1, |
|---|
| 1037 | + step: 1, |
|---|
| 1038 | |
|---|
| 1039 | + |
|---|
| 1040 | //slide interactions for one handles slider |
|---|
| 1041 | slide : function( event, ui ) { |
|---|
| 1042 | - if ( REVAPP._right_model_loading ) //left model stoll loading, prevent sliding left handle |
|---|
| 1043 | - return false; |
|---|
| 1044 | |
|---|
| 1045 | - REVAPP._right_diff =( ui.value+1 ); |
|---|
| 1046 | - $( '#diff_count' ).html( REVAPP._right_diff ); |
|---|
| 1047 | + REVAPP._right_diff = ( ui.value +1 ); |
|---|
| 1048 | REVAPP._revisionView.render(); |
|---|
| 1049 | - self.reset_restore_button(); |
|---|
| 1050 | - } |
|---|
| 1051 | + console.log(REVAPP._revisions.at( ui.value ).get( 'ID')); |
|---|
| 1052 | + console.log(wpRevisionsSettings.post_id); |
|---|
| 1053 | + |
|---|
| 1054 | + if ( REVAPP._revisions.at( ui.value ).get( 'ID') == wpRevisionsSettings.post_id ){ |
|---|
| 1055 | + $( '#diffrestore' ).hide(); |
|---|
| 1056 | + } else { |
|---|
| 1057 | + $( '#diffrestore' ).show(); |
|---|
| 1058 | + } |
|---|
| 1059 | + /* |
|---|
| 1060 | + $( 'a.ui-slider-handle' ).tooltip( { |
|---|
| 1061 | + content: REVAPP._revisions.at( ui.value ).get( 'revision_date_author_short' ), |
|---|
| 1062 | + position: { |
|---|
| 1063 | + my: "top-65", |
|---|
| 1064 | + using: function( position, feedback ) { |
|---|
| 1065 | + $( this ).css( position ); |
|---|
| 1066 | + $( "<div>" ) |
|---|
| 1067 | + .addClass( "arrow" ) |
|---|
| 1068 | + .addClass( feedback.vertical ) |
|---|
| 1069 | + .addClass( feedback.horizontal ) |
|---|
| 1070 | + .appendTo( this ); |
|---|
| 1071 | + } |
|---|
| 1072 | + } |
|---|
| 1073 | + });//.trigger( 'close' ).trigger( 'open' ); |
|---|
| 1074 | +*/ |
|---|
| 1075 | + } |
|---|
| 1076 | }); |
|---|
| 1077 | $( '.revisiondiffcontainer' ).removeClass( 'comparetwo' ); |
|---|
| 1078 | + |
|---|
| 1079 | } else { //comparing more than one, eg 2 |
|---|
| 1080 | //set up the slider with two handles |
|---|
| 1081 | slider.slider({ |
|---|
| 1082 | @@ -467,21 +682,26 @@ |
|---|
| 1083 | return false; |
|---|
| 1084 | |
|---|
| 1085 | if ( REVAPP._revisionView.model !== REVAPP._left_handle_revisions && |
|---|
| 1086 | - null !== REVAPP._left_handle_revisions ) |
|---|
| 1087 | + null !== REVAPP._left_handle_revisions ) { |
|---|
| 1088 | REVAPP._revisionView.model = REVAPP._left_handle_revisions; |
|---|
| 1089 | - |
|---|
| 1090 | + REVAPP._tickmarkView.model = REVAPP._left_handle_revisions; |
|---|
| 1091 | + REVAPP._tickmarkView.render(); |
|---|
| 1092 | + } |
|---|
| 1093 | REVAPP._revisionView.draggingleft = true; |
|---|
| 1094 | REVAPP._left_diff_start = ui.values[ 0 ]; |
|---|
| 1095 | break; |
|---|
| 1096 | |
|---|
| 1097 | case 2: //right |
|---|
| 1098 | - if ( REVAPP._right_model_loading ) //right model stoll loading, prevent sliding right handle |
|---|
| 1099 | + if ( REVAPP._right_model_loading ) //left model stoll loading, prevent sliding left handle |
|---|
| 1100 | return false; |
|---|
| 1101 | |
|---|
| 1102 | //one extra spot at left end when comparing two |
|---|
| 1103 | if ( REVAPP._revisionView.model !== REVAPP._right_handle_revisions && |
|---|
| 1104 | - null !== REVAPP._right_handle_revisions ) |
|---|
| 1105 | + null !== REVAPP._right_handle_revisions ) { |
|---|
| 1106 | REVAPP._revisionView.model = REVAPP._right_handle_revisions; |
|---|
| 1107 | + REVAPP._tickmarkView.model = REVAPP._right_handle_revisions; |
|---|
| 1108 | + REVAPP._tickmarkView.render(); |
|---|
| 1109 | + } |
|---|
| 1110 | |
|---|
| 1111 | REVAPP._revisionView.draggingleft = false; |
|---|
| 1112 | REVAPP._right_diff_start = ui.values[ 1 ]; |
|---|
| 1113 | @@ -501,29 +721,30 @@ |
|---|
| 1114 | if ( REVAPP._left_model_loading ) //left model still loading, prevent sliding left handle |
|---|
| 1115 | return false; |
|---|
| 1116 | |
|---|
| 1117 | - REVAPP._left_diff = ui.values[ 0 ] - 1; //one extra spot at left end when comparing two |
|---|
| 1118 | + REVAPP._left_diff = ui.values[ 0 ]; //one extra spot at left end when comparing two |
|---|
| 1119 | break; |
|---|
| 1120 | |
|---|
| 1121 | case 2: //right |
|---|
| 1122 | - if ( REVAPP._right_model_loading ) //right model still loading, prevent sliding right handle |
|---|
| 1123 | - return false; |
|---|
| 1124 | + REVAPP._right_diff = ui.values[ 1 ] ; |
|---|
| 1125 | + //console.log('setting ' + REVAPP._right_diff ); |
|---|
| 1126 | + if ( REVAPP._revisions.at( ui.values[ 1 ] -1 ).get( 'ID') == wpRevisionsSettings.post_id ){ |
|---|
| 1127 | + $( '#diffrestore' ).hide(); |
|---|
| 1128 | + } else { |
|---|
| 1129 | + $( '#diffrestore' ).show(); |
|---|
| 1130 | + } |
|---|
| 1131 | |
|---|
| 1132 | - REVAPP._right_diff = ui.values[ 1 ] - 1 ; |
|---|
| 1133 | break; |
|---|
| 1134 | } |
|---|
| 1135 | |
|---|
| 1136 | - $( '#diff_count' ).html( REVAPP._right_diff ); |
|---|
| 1137 | - |
|---|
| 1138 | if ( 0 === REVAPP._left_diff ) { |
|---|
| 1139 | $( '.revisiondiffcontainer' ).addClass( 'currentversion' ); |
|---|
| 1140 | |
|---|
| 1141 | } else { |
|---|
| 1142 | $( '.revisiondiffcontainer' ).removeClass( 'currentversion' ); |
|---|
| 1143 | - $( '#diff_left_count_inner' ).html( REVAPP._left_diff ); |
|---|
| 1144 | } |
|---|
| 1145 | |
|---|
| 1146 | - REVAPP._revisionView.render(); //render the diff view |
|---|
| 1147 | - self.reset_restore_button(); |
|---|
| 1148 | + REVAPP._revisionView.render(); |
|---|
| 1149 | + |
|---|
| 1150 | }, |
|---|
| 1151 | |
|---|
| 1152 | //when the user stops sliding in 2 handle mode, recalculate diffs |
|---|
| 1153 | @@ -536,23 +757,26 @@ |
|---|
| 1154 | |
|---|
| 1155 | switch ( index ) { |
|---|
| 1156 | case 1: //left |
|---|
| 1157 | + |
|---|
| 1158 | //left handle dragged & changed, reload right handle model |
|---|
| 1159 | - if ( ! ( REVAPP._left_diff_start === ui.values[ 0 ] || REVAPP._left_model_loading ) ) |
|---|
| 1160 | + if ( REVAPP._left_diff_start !== ui.values[ 0 ] ) |
|---|
| 1161 | REVAPP.reloadright(); |
|---|
| 1162 | |
|---|
| 1163 | break; |
|---|
| 1164 | |
|---|
| 1165 | case 2: //right |
|---|
| 1166 | + //REVAPP._right_diff = ( 1 >= REVAPP._right_diff ) ? 1 : REVAPP._right_diff-1; |
|---|
| 1167 | //right handle dragged & changed, reload left handle model if changed |
|---|
| 1168 | - if ( ! ( REVAPP._right_diff_start === ui.values[ 1 ] || REVAPP._right_model_loading ) ) { |
|---|
| 1169 | + if ( REVAPP._right_diff_start !== ui.values[ 1 ] ) |
|---|
| 1170 | REVAPP.reloadleft(); |
|---|
| 1171 | - } |
|---|
| 1172 | + |
|---|
| 1173 | break; |
|---|
| 1174 | } |
|---|
| 1175 | } |
|---|
| 1176 | } |
|---|
| 1177 | }); |
|---|
| 1178 | $( '.revisiondiffcontainer' ).addClass( 'comparetwo' ); |
|---|
| 1179 | + $( 'a.ui-slider-handle' ).first().addClass( 'left-handle' ).next().addClass( 'right-handle' ); |
|---|
| 1180 | } |
|---|
| 1181 | |
|---|
| 1182 | return this; |
|---|
| 1183 | @@ -571,9 +795,7 @@ |
|---|
| 1184 | |
|---|
| 1185 | REVAPP._revisionView.render(); |
|---|
| 1186 | |
|---|
| 1187 | - $( '#diff_count' ).html( REVAPP._right_diff ); |
|---|
| 1188 | $( '#slider' ).slider( 'value', REVAPP._right_diff - 1 ).trigger( 'slide' ); |
|---|
| 1189 | - this.reset_restore_button(); |
|---|
| 1190 | }, |
|---|
| 1191 | |
|---|
| 1192 | //go the the previous revision |
|---|
| 1193 | @@ -583,9 +805,7 @@ |
|---|
| 1194 | |
|---|
| 1195 | REVAPP._revisionView.render(); |
|---|
| 1196 | |
|---|
| 1197 | - $( '#diff_count' ).html( REVAPP._right_diff ); |
|---|
| 1198 | $( '#slider' ).slider( 'value', REVAPP._right_diff - 1 ).trigger( 'slide' ); |
|---|
| 1199 | - this.reset_restore_button(); |
|---|
| 1200 | } |
|---|
| 1201 | }) |
|---|
| 1202 | }); |
|---|
| 1203 | Index: wp-admin/revision.php |
|---|
| 1204 | =================================================================== |
|---|
| 1205 | --- wp-admin/revision.php (revision 23693) |
|---|
| 1206 | +++ wp-admin/revision.php (working copy) |
|---|
| 1207 | @@ -80,41 +80,66 @@ |
|---|
| 1208 | $parent_file = $submenu_file = 'edit.php?post_type=' . $post->post_type; |
|---|
| 1209 | else |
|---|
| 1210 | $parent_file = $submenu_file = 'edit.php'; |
|---|
| 1211 | - |
|---|
| 1212 | wp_enqueue_script( 'revisions' ); |
|---|
| 1213 | |
|---|
| 1214 | require_once( './admin-header.php' ); |
|---|
| 1215 | |
|---|
| 1216 | //TODO - Some of the translations below split things into multiple strings that are contextually related and this makes it pretty impossible for RTL translation. |
|---|
| 1217 | //TODO can we pass the context in a better way |
|---|
| 1218 | +$wpRevisionsSettings = array( 'post_id' => $post->ID, |
|---|
| 1219 | + 'nonce' => wp_create_nonce( 'revisions-ajax-nonce' ), |
|---|
| 1220 | + 'revision_id' => $revision_id ); |
|---|
| 1221 | +wp_localize_script( 'revisions', 'wpRevisionsSettings', $wpRevisionsSettings ); |
|---|
| 1222 | + |
|---|
| 1223 | +$comparetworevisionslink = get_edit_post_link( $revision->ID ); |
|---|
| 1224 | ?> |
|---|
| 1225 | -<script type="text/javascript"> |
|---|
| 1226 | -var wpRevisionsSettings = <?php echo json_encode( array( 'post_id' => $post->ID, 'nonce' => wp_create_nonce( 'revisions-ajax-nonce' ) ) ); ?>; |
|---|
| 1227 | -</script> |
|---|
| 1228 | -<?php |
|---|
| 1229 | - $comparetworevisionslink = get_edit_post_link( $revision->ID ); |
|---|
| 1230 | -?> |
|---|
| 1231 | |
|---|
| 1232 | -<div id="backbonerevisionsoptions"></div> |
|---|
| 1233 | +<div id="backbonerevisionsoptions"> |
|---|
| 1234 | +</div> |
|---|
| 1235 | <div class="wrap"> |
|---|
| 1236 | - <div class="icon32 icon32-posts-post" id="icon-edit"><br></div> |
|---|
| 1237 | + <div class="icon32 icon32-posts-post" id="icon-edit"> |
|---|
| 1238 | + <br> |
|---|
| 1239 | + </div> |
|---|
| 1240 | <div class="revisiondiffcontainer diffsplit currentversion rightmodelloading"> |
|---|
| 1241 | - <div id="modelsloading" class="updated message"><span class="spinner" ></span> <?php _e( 'Calculating revision diffs' ); ?></div> |
|---|
| 1242 | + <div id="modelsloading" class="updated message"> |
|---|
| 1243 | + <span class="spinner" ></span> <?php _e( 'Calculating revision diffs' ); ?> |
|---|
| 1244 | + </div> |
|---|
| 1245 | <h2 class="long-header"><?php echo $h2; ?></h2> |
|---|
| 1246 | - <div id="backbonerevisionsinteract"></div> |
|---|
| 1247 | - <div id="backbonerevisionsdiff"></div> |
|---|
| 1248 | + <div class="diff-slider-ticks-wrapper"> |
|---|
| 1249 | + <div id="diff-slider-ticks"> |
|---|
| 1250 | + </div> |
|---|
| 1251 | + </div> |
|---|
| 1252 | + <div id="backbonerevisionsinteract"> |
|---|
| 1253 | + </div> |
|---|
| 1254 | + <div id="backbonerevisionsdiff"> |
|---|
| 1255 | + </div> |
|---|
| 1256 | <hr /> |
|---|
| 1257 | </div> |
|---|
| 1258 | </div> |
|---|
| 1259 | |
|---|
| 1260 | <script id="tmpl-revision" type="text/html"> |
|---|
| 1261 | + <div id="diffsubheader" class="diff-left-hand-meta-row"> |
|---|
| 1262 | + <div id="diff_from_current_revision"> |
|---|
| 1263 | + <b><?php _e( 'From:' ); ?></b> <?php _e( 'the current version' ); ?> |
|---|
| 1264 | + </div> |
|---|
| 1265 | + <div id="difftitlefrom"> |
|---|
| 1266 | + <div class="diff-from-title"><?php _e( 'From:' ); ?></div>{{{ data.revision_from_date_author }}} |
|---|
| 1267 | + </div> |
|---|
| 1268 | + </div> |
|---|
| 1269 | + |
|---|
| 1270 | <div id="diffsubheader"> |
|---|
| 1271 | - <span id="diff_from_current_revision"><?php _e( 'Current version' ); ?><?php _e( '- compared to -' ); ?></span> |
|---|
| 1272 | - <div id="difftitlefrom">{{{ data.revision_from_date_author }}} <?php _e( '- compared to -' ); ?></div> |
|---|
| 1273 | - <div id="difftitle">{{{ data.revision_date_author }}}</div> |
|---|
| 1274 | - <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> |
|---|
| 1275 | - <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> |
|---|
| 1276 | - <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> |
|---|
| 1277 | + <div id="difftitle"> |
|---|
| 1278 | + <div class="diff-to-title"><?php _e( 'To:' ); ?></div>{{{ data.revision_date_author }}} |
|---|
| 1279 | + </div> |
|---|
| 1280 | + <div id="diffrestore"> |
|---|
| 1281 | + <input class="button button-primary" onClick="document.location='{{{ data.restoreaction }}}'" type="submit" id="restore" value="<?php esc_attr_e( 'Restore This Revision' )?>" /> |
|---|
| 1282 | + </div> |
|---|
| 1283 | + <div id="comparetworevisions"> |
|---|
| 1284 | + <input type="checkbox" id="comparetwo" value="comparetwo" {{{ data.comparetwochecked }}} name="comparetwo"/> |
|---|
| 1285 | + <label for="comparetwo"><?php esc_attr_e( 'Compare two revisions' ); ?></a></label> |
|---|
| 1286 | + </div> |
|---|
| 1287 | + </div> |
|---|
| 1288 | + |
|---|
| 1289 | <div id="removedandadded"> |
|---|
| 1290 | <div id="removed"><?php _e( 'Removed -' ); ?></div> |
|---|
| 1291 | <div id="added"><?php _e( 'Added +' ); ?></div> |
|---|
| 1292 | @@ -124,24 +149,20 @@ |
|---|
| 1293 | |
|---|
| 1294 | <script id="tmpl-revisionvinteract" type="text/html"> |
|---|
| 1295 | <div id="diffheader"> |
|---|
| 1296 | -<div id="diffprevious"><input class="button" type="submit" id="previous" value="<?php esc_attr_e( 'Previous' ); ?>" /></div> |
|---|
| 1297 | - <div id="diffnext"><input class="button" type="submit" id="next" value="<?php esc_attr_e( 'Next' ); ?>" /></div> |
|---|
| 1298 | - <div id="diffslider"> |
|---|
| 1299 | - <div id="revisioncount"> |
|---|
| 1300 | - <?php _e( 'Comparing' ); ?> |
|---|
| 1301 | - <span id="diff_left_count"> <?php _e( 'revision' ); ?></span> <span id="diff_left_count_inner"></span> |
|---|
| 1302 | - <span id="diff_left_current_revision"><?php _e( 'current version' ); ?></span> |
|---|
| 1303 | - <span id="diff_revision_from">{{{ data.diff_revision_from }}}</span> |
|---|
| 1304 | - <?php _e( ' to revision' ); ?> |
|---|
| 1305 | - <span id="diff_count">{{{ data.current_diff }}}</span> |
|---|
| 1306 | - <?php _e( ' of ' ); ?> |
|---|
| 1307 | - <span id="diff_max" ></span> |
|---|
| 1308 | - </div> |
|---|
| 1309 | - |
|---|
| 1310 | - <div id="slider" class="wp-slider"></div> |
|---|
| 1311 | + <div id="diffprevious"><input class="button" type="submit" id="previous" value="<?php esc_attr_e( 'Previous' ); ?>" /> |
|---|
| 1312 | </div> |
|---|
| 1313 | + <div id="diffnext"><input class="button" type="submit" id="next" value="<?php esc_attr_e( 'Next' ); ?>" /> |
|---|
| 1314 | + </div> |
|---|
| 1315 | + <div id="diffslider"> |
|---|
| 1316 | + <div id="slider" class="wp-slider"> |
|---|
| 1317 | + </div> |
|---|
| 1318 | + </div> |
|---|
| 1319 | </div> |
|---|
| 1320 | </script> |
|---|
| 1321 | +<script id="tmpl-revision-ticks" type="text/html"> |
|---|
| 1322 | + <div class="revision-tick revision-toload{{{ data.revision_toload }}} revision-scopeofchanges-{{{ data.scope_of_changes }}}"> |
|---|
| 1323 | + </div> |
|---|
| 1324 | +</script> |
|---|
| 1325 | <?php |
|---|
| 1326 | /* |
|---|
| 1327 | TODO Convert these into screen options |
|---|
| 1328 | Index: wp-admin/css/colors-fresh.css |
|---|
| 1329 | =================================================================== |
|---|
| 1330 | --- wp-admin/css/colors-fresh.css (revision 23693) |
|---|
| 1331 | +++ wp-admin/css/colors-fresh.css (working copy) |
|---|
| 1332 | @@ -175,8 +175,7 @@ |
|---|
| 1333 | .sidebar-name, |
|---|
| 1334 | #nav-menu-header, |
|---|
| 1335 | #nav-menu-footer, |
|---|
| 1336 | -.menu-item-handle, |
|---|
| 1337 | -.wp-slider .ui-slider-handle { |
|---|
| 1338 | +.menu-item-handle { |
|---|
| 1339 | background: #f1f1f1; |
|---|
| 1340 | background-image: -webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9)); |
|---|
| 1341 | background-image: -webkit-linear-gradient(bottom, #ececec, #f9f9f9); |
|---|
| 1342 | @@ -185,6 +184,8 @@ |
|---|
| 1343 | background-image: linear-gradient(to top, #ececec, #f9f9f9); |
|---|
| 1344 | } |
|---|
| 1345 | |
|---|
| 1346 | + |
|---|
| 1347 | + |
|---|
| 1348 | .widget .widget-top, |
|---|
| 1349 | .postbox h3, |
|---|
| 1350 | .stuffbox h3 { |
|---|
| 1351 | @@ -1378,14 +1379,38 @@ |
|---|
| 1352 | background-color: #e9f6ea; |
|---|
| 1353 | } |
|---|
| 1354 | |
|---|
| 1355 | +.diff-to-title { |
|---|
| 1356 | + color: #0080AA; |
|---|
| 1357 | +} |
|---|
| 1358 | + |
|---|
| 1359 | #diffsubheader{ |
|---|
| 1360 | background-color: #f7f7f7; |
|---|
| 1361 | } |
|---|
| 1362 | |
|---|
| 1363 | +.comparetwo#diffsubheader.diff-left-hand-meta-row { |
|---|
| 1364 | + background-color: #fcfcfc; |
|---|
| 1365 | +} |
|---|
| 1366 | + |
|---|
| 1367 | +.revision-tick.revision-toloadtrue { |
|---|
| 1368 | + background-color: #9999cc; |
|---|
| 1369 | + background: url(../images/wpspin_light.gif) no-repeat; |
|---|
| 1370 | + background-position: middle; |
|---|
| 1371 | + background-size: 1px 10px; |
|---|
| 1372 | +} |
|---|
| 1373 | + |
|---|
| 1374 | +.revision-tick.revision-toloadfalse { |
|---|
| 1375 | + background-color: #aaa; |
|---|
| 1376 | +} |
|---|
| 1377 | + |
|---|
| 1378 | #att-info { |
|---|
| 1379 | background-color: #e4f2Fd; |
|---|
| 1380 | } |
|---|
| 1381 | |
|---|
| 1382 | +body .ui-tooltip { |
|---|
| 1383 | + border-color: #d7d7d7; |
|---|
| 1384 | + background-color: #fff; |
|---|
| 1385 | +} |
|---|
| 1386 | + |
|---|
| 1387 | /* jQuery UI Slider */ |
|---|
| 1388 | .wp-slider.ui-slider { |
|---|
| 1389 | border-color: #d7d7d7; |
|---|
| 1390 | @@ -1393,22 +1418,30 @@ |
|---|
| 1391 | } |
|---|
| 1392 | |
|---|
| 1393 | .wp-slider .ui-slider-handle { |
|---|
| 1394 | - border-color: #d7d7d7; |
|---|
| 1395 | + border-color: none; |
|---|
| 1396 | } |
|---|
| 1397 | |
|---|
| 1398 | +.wp-slider .ui-slider-handle.left-handle { |
|---|
| 1399 | +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==); |
|---|
| 1400 | +} |
|---|
| 1401 | + |
|---|
| 1402 | +.wp-slider .ui-slider-handle.ui-state-active.left-handle { |
|---|
| 1403 | +background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAA3NCSVQICAjb4U/gAAAAzFBMVEXZ5ejU4eXM3ODG2NzE1tvB1Nq90deux86sxs2qxcynwsqlwcmjwMihvseevMWdvMSbusOXuMGTtb6IrbiHrLeCqbSBqLN/p7J3oa11oKxzn6tvnKhrmaZqmKVpmKVol6RllaJhk6Bej51djptaiZZZiJVYhpNWg5BUf4xSfYlRfIhPeYRMdYBKcXxFaXNDZnA+X2g9XmY8XGU4VV43VFw2U1s0UFgyTVQxS1IwSVAuR00sREosQ0orQkgqQEYpPkQoPkMoPUMoPUL///8pY4MvAAAARHRSTlP/////////////////////////////////////////////////////////////////////////////////////////AHHSjxIAAAAJcEhZcwAACusAAArrAYKLDVoAAAAUdEVYdENyZWF0aW9uIFRpbWUAMy85LzEzrdD8jAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAACUSURBVBiVVctXEoJQEETRMaIo5qwF5hwxYOY9ev97EiQ43q+pUz2EYk9n5UElU0rpRO016toO79WhxlVysWqkroRgsswSjAsbnasgpGdsMk25gooZvR3K8CQxCuU9jH8FhZ3022rwJTZ4CK9nnwJBbiO8yVpFKDButm1bOn6iLFyZt5igeZLHOrhgfJ8k/yXTVoLrAxo1P5iCdUg7AAAAAElFTkSuQmCC); |
|---|
| 1404 | +} |
|---|
| 1405 | + |
|---|
| 1406 | +.wp-slider .ui-slider-handle { |
|---|
| 1407 | + /* Slider drag Triangle CSS */ |
|---|
| 1408 | +background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAA3NCSVQICAjb4U/gAAAA8FBMVEU2dZipwNBJl8VGmcX///+EpLlBgqpymrNFjru3ydNWiKs6eZzY4uuRrL08faPL3OZBjLSBqsCTssRHlMJEf59cj657o7xKl8OEqsE9gag2dJtEkb+ct8iZs8BHmMePq8BejKZAiK5llK5FjrlJl8c6dZdGl8avxdBJlcZ4nbc6ep6XrbpKgZ+Lqr5KmcdIkbqsws1Gk8E+f6c4dptaiadFirRKl8V8pblImcNIl8eGpruVscZCh7BMlsdIlcFImchEkbs9eJpCjbdGjbk8fJ84dp02dpo8gatMlsM2dps8faVAg61Ej71Ek75IksFIlcOaLCw7AAAAUHRSTlP/////AP///////////////////////////////////////////////////////////////////////////////////////////////////xB6m5UAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAUdEVYdENyZWF0aW9uIFRpbWUAMy85LzEzrdD8jAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAACaSURBVBiVVcxZD8FAGIXhjxzUVktQgqKmo7ZYhkgsiS1tQuj//zeomo736uS5OFSo2W6UXc/R5hxXW5foxDlXqUKZx0GFZpXynuM4kXhjgjgyJkGzQIjpvi9Fx1uQ0iQUh4GkR/Ini0CQ2IfQ24YC4X8T+Mn0zj8lO1IgnqZpzlxE0m4YhrFsKYJVn126UGV+W1wHf4LdpByuF0goFKI7tv/dAAAAAElFTkSuQmCC); |
|---|
| 1409 | +} |
|---|
| 1410 | + |
|---|
| 1411 | .wp-slider .ui-slider-handle.ui-state-hover, |
|---|
| 1412 | .wp-slider .ui-slider-handle.ui-state-focus { |
|---|
| 1413 | - border-color: #aaa; |
|---|
| 1414 | + border-color: none; |
|---|
| 1415 | + outline: none; |
|---|
| 1416 | } |
|---|
| 1417 | |
|---|
| 1418 | .wp-slider .ui-slider-handle.ui-state-active { |
|---|
| 1419 | - border-color: #aaa; |
|---|
| 1420 | - background: #eee; |
|---|
| 1421 | - background-image: -webkit-gradient(linear, left bottom, left top, from(#f9f9f9), to(#ececec)); |
|---|
| 1422 | - background-image: -webkit-linear-gradient(bottom, #f9f9f9, #ececec); |
|---|
| 1423 | - background-image: -moz-linear-gradient(bottom, #f9f9f9, #ececec); |
|---|
| 1424 | - background-image: -o-linear-gradient(bottom, #f9f9f9, #ececec); |
|---|
| 1425 | - background-image: linear-gradient(to top, #f9f9f9, #ececec); |
|---|
| 1426 | + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAA3NCSVQICAjb4U/gAAAA51BMVEUgZpDkzc0yd6f///8mcqFJm8cjbZZzr80mg78lh8BDk8UngLl+s9AmfKk4hrGeweBaoMhNlMORwt4nd6Zdm8BAjMEnf7RYmsMkb50mhsFWlsYhZ5ImhbwocZg0f61Lk8E9i7twqNBgo8VSmMUofLBcm8o3faUpfK8mh8Aia5MgZpFMmcgpeapDmcJjo8sliMEmh70nhLkkcKAqgLF2sc8sc5ojbZsngrMkh8EnfKw1eaUjbpkkapImeKQgaJAohb0mh8MmhcMng7kkcKEpf68iZ48haJMmhb8kicEmc6MibJkia5UnhLsw1mWvAAAATXRSTlP/AP8A/////////////////////////////////////////////////////////////////////////////////////////////////9/iR18AAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAUdEVYdENyZWF0aW9uIFRpbWUAMy85LzEzrdD8jAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAACaSURBVBiVVc15D8FAEIfh+Ymj6761LIrSiCNVVyjbRGgifP/PQ6q22/evyZPJDNXzD6G0qNDq5PtO3DJDFyfRpk+po2Eo0h5Qx9U0LRa3SejdlR2rDMLI41yKh6/AtOSzUiuU4kvemSMUDBsRXGuRIHj/CvCXyTNcSXelQBQYY1uBWMY651xfK4KzbdgzqJI73LK7hGC6r0bTB5apIhqIH/YIAAAAAElFTkSuQmCC); |
|---|
| 1427 | } |
|---|
| 1428 | |
|---|
| 1429 | /* edit image */ |
|---|
| 1430 | Index: wp-admin/css/wp-admin.css |
|---|
| 1431 | =================================================================== |
|---|
| 1432 | --- wp-admin/css/wp-admin.css (revision 23693) |
|---|
| 1433 | +++ wp-admin/css/wp-admin.css (working copy) |
|---|
| 1434 | @@ -3582,6 +3582,16 @@ |
|---|
| 1435 | vertical-align: middle; |
|---|
| 1436 | } |
|---|
| 1437 | |
|---|
| 1438 | +.diff-from-title, |
|---|
| 1439 | +.diff-to-title { |
|---|
| 1440 | + font-size: 14px; |
|---|
| 1441 | + font-weight: bold; |
|---|
| 1442 | + width:60px; |
|---|
| 1443 | + text-align: right; |
|---|
| 1444 | + float: left; |
|---|
| 1445 | + margin-right: 5px; |
|---|
| 1446 | +} |
|---|
| 1447 | + |
|---|
| 1448 | .revisiondiffcontainer { |
|---|
| 1449 | width: 96%; |
|---|
| 1450 | } |
|---|
| 1451 | @@ -3590,13 +3600,15 @@ |
|---|
| 1452 | margin: 2px; |
|---|
| 1453 | } |
|---|
| 1454 | |
|---|
| 1455 | -#diffrestore, |
|---|
| 1456 | -#diffnext, |
|---|
| 1457 | -#diffcancel { |
|---|
| 1458 | +#diffnext { |
|---|
| 1459 | float: right; |
|---|
| 1460 | margin-right: 5px; |
|---|
| 1461 | } |
|---|
| 1462 | |
|---|
| 1463 | +#diffrestore input{ |
|---|
| 1464 | + margin-left: 10px; |
|---|
| 1465 | +} |
|---|
| 1466 | + |
|---|
| 1467 | #diffprevious, |
|---|
| 1468 | #difftitle, |
|---|
| 1469 | #difftitlefrom, |
|---|
| 1470 | @@ -3608,7 +3620,6 @@ |
|---|
| 1471 | |
|---|
| 1472 | #diffprevious, |
|---|
| 1473 | #diffnext { |
|---|
| 1474 | - margin-top: 7px; |
|---|
| 1475 | height: 30px; |
|---|
| 1476 | } |
|---|
| 1477 | |
|---|
| 1478 | @@ -3620,26 +3631,39 @@ |
|---|
| 1479 | #diffheader { |
|---|
| 1480 | border-bottom: 1px solid #dfdfdf; |
|---|
| 1481 | width: 100%; |
|---|
| 1482 | - height: 45px; |
|---|
| 1483 | - line-height: 45px; |
|---|
| 1484 | - padding-top: 10px; |
|---|
| 1485 | + height: 40px; |
|---|
| 1486 | + line-height: 40px; |
|---|
| 1487 | + padding-top: 30px; |
|---|
| 1488 | } |
|---|
| 1489 | |
|---|
| 1490 | -#diffsubheader { |
|---|
| 1491 | - border-bottom: 1px solid #dfdfdf; |
|---|
| 1492 | +#diffsubheader,.diff-left-hand-meta-row { |
|---|
| 1493 | width: 100%; |
|---|
| 1494 | height:35px; |
|---|
| 1495 | line-height: 35px; |
|---|
| 1496 | + display: block; |
|---|
| 1497 | } |
|---|
| 1498 | |
|---|
| 1499 | -#diffslider { |
|---|
| 1500 | +#diffslider{ |
|---|
| 1501 | width: 70%; |
|---|
| 1502 | margin-left: auto; |
|---|
| 1503 | margin-right: auto; |
|---|
| 1504 | text-align: center; |
|---|
| 1505 | - height: 3.5em; |
|---|
| 1506 | + height: 0.8em; |
|---|
| 1507 | + margin-top: 20px; |
|---|
| 1508 | } |
|---|
| 1509 | |
|---|
| 1510 | +.diff-slider-ticks-wrapper { |
|---|
| 1511 | + margin-left: auto; |
|---|
| 1512 | + margin-right: auto; |
|---|
| 1513 | + text-align: center; |
|---|
| 1514 | +} |
|---|
| 1515 | + |
|---|
| 1516 | +#diff-slider-ticks { |
|---|
| 1517 | + position: absolute; |
|---|
| 1518 | + margin-top: 50px; |
|---|
| 1519 | + z-index: 1; |
|---|
| 1520 | +} |
|---|
| 1521 | + |
|---|
| 1522 | #revisioncount { |
|---|
| 1523 | width: 50%; |
|---|
| 1524 | margin-left: auto; |
|---|
| 1525 | @@ -3707,6 +3731,9 @@ |
|---|
| 1526 | |
|---|
| 1527 | #comparetworevisions { |
|---|
| 1528 | float: right; |
|---|
| 1529 | + position: absolute; |
|---|
| 1530 | + top: 10px; |
|---|
| 1531 | + right: 10px; |
|---|
| 1532 | line-height: 35px; |
|---|
| 1533 | padding-right: 5px; |
|---|
| 1534 | } |
|---|
| 1535 | @@ -3742,11 +3769,11 @@ |
|---|
| 1536 | .comparetwo #diffprevious, |
|---|
| 1537 | .comparetwo #diffnext, |
|---|
| 1538 | span#diff_left_current_revision, |
|---|
| 1539 | -span#diff_from_current_revision, |
|---|
| 1540 | +#diff_from_current_revision, |
|---|
| 1541 | .currentversion span#diff_left_count, |
|---|
| 1542 | .currentversion span#diff_left_count_inner, |
|---|
| 1543 | -.currentversion #difftitlefrom, |
|---|
| 1544 | -.comparetwo.currentversion #difftitlefrom { |
|---|
| 1545 | +.comparetwo.currentversion #diff_from_current_revision, |
|---|
| 1546 | +#diffsubheader.diff-left-hand-meta-row { |
|---|
| 1547 | display: none; |
|---|
| 1548 | } |
|---|
| 1549 | |
|---|
| 1550 | @@ -3754,15 +3781,53 @@ |
|---|
| 1551 | span#diff_left_count, |
|---|
| 1552 | span#diff_left_count_inner, |
|---|
| 1553 | .comparetwo #difftitlefrom, |
|---|
| 1554 | -.comparetwo.currentversion span#diff_from_current_revision, |
|---|
| 1555 | .leftmodelloading #modelsloading, |
|---|
| 1556 | .rightmodelloading #modelsloading, |
|---|
| 1557 | .leftmodelloading #modelsloading .spinner, |
|---|
| 1558 | .rightmodelloading #modelsloading .spinner, |
|---|
| 1559 | -{ |
|---|
| 1560 | - display: inline; |
|---|
| 1561 | +.comparetwo #diffsubheader.diff-left-hand-meta-row { |
|---|
| 1562 | + display: block; |
|---|
| 1563 | } |
|---|
| 1564 | |
|---|
| 1565 | +.revision-tick { |
|---|
| 1566 | + width: 1px; |
|---|
| 1567 | + float: left; |
|---|
| 1568 | + margin-right: 15px; |
|---|
| 1569 | + height: 11px; |
|---|
| 1570 | + padding: 0; |
|---|
| 1571 | + margin-left: 0px; |
|---|
| 1572 | +} |
|---|
| 1573 | + |
|---|
| 1574 | +.revision-tick.revision-scopeofchanges-vsmall { |
|---|
| 1575 | + width: 1px; |
|---|
| 1576 | + background-color: #aaa; |
|---|
| 1577 | +} |
|---|
| 1578 | + |
|---|
| 1579 | +.revision-tick.revision-scopeofchanges-small { |
|---|
| 1580 | + width: 2px; |
|---|
| 1581 | + background-color: #aaa; |
|---|
| 1582 | + margin-left: -1px; |
|---|
| 1583 | +} |
|---|
| 1584 | + |
|---|
| 1585 | +.revision-tick.revision-scopeofchanges-med { |
|---|
| 1586 | + width: 3px; |
|---|
| 1587 | + margin-left: -2px; |
|---|
| 1588 | + background-color: #666; |
|---|
| 1589 | +} |
|---|
| 1590 | + |
|---|
| 1591 | +.revision-tick.revision-scopeofchanges-large { |
|---|
| 1592 | + width: 4px; |
|---|
| 1593 | + margin-left: -3px; |
|---|
| 1594 | + background-color: #333; |
|---|
| 1595 | +} |
|---|
| 1596 | + |
|---|
| 1597 | +.revision-tick.revision-scopeofchanges-vlarge { |
|---|
| 1598 | + margin-left: -3px; |
|---|
| 1599 | + width: 4px; |
|---|
| 1600 | + background-color: #111; |
|---|
| 1601 | + left: 1; |
|---|
| 1602 | +} |
|---|
| 1603 | + |
|---|
| 1604 | .diff-loading { |
|---|
| 1605 | margin-top: 50px; |
|---|
| 1606 | width: 100%; |
|---|
| 1607 | @@ -3777,24 +3842,87 @@ |
|---|
| 1608 | float: none; |
|---|
| 1609 | } |
|---|
| 1610 | |
|---|
| 1611 | -#difftitlefrom { |
|---|
| 1612 | - float: left; |
|---|
| 1613 | - display: none; |
|---|
| 1614 | -} |
|---|
| 1615 | - |
|---|
| 1616 | #modelsloading { |
|---|
| 1617 | float: right; |
|---|
| 1618 | + position: absolute; |
|---|
| 1619 | line-height: 30px; |
|---|
| 1620 | display: none; |
|---|
| 1621 | clear: none; |
|---|
| 1622 | - margin: 0; |
|---|
| 1623 | + right: 170px; |
|---|
| 1624 | margin-top: -40px; |
|---|
| 1625 | } |
|---|
| 1626 | |
|---|
| 1627 | #modelsloading .spinner { |
|---|
| 1628 | float: left; |
|---|
| 1629 | - } |
|---|
| 1630 | +} |
|---|
| 1631 | |
|---|
| 1632 | +.ui-tooltip-content img { |
|---|
| 1633 | + float: left; |
|---|
| 1634 | + margin-right: 5px; |
|---|
| 1635 | +} |
|---|
| 1636 | +/* jQuery UI Tooltip 1.10.1 */ |
|---|
| 1637 | + |
|---|
| 1638 | +.ui-tooltip { |
|---|
| 1639 | + padding: 8px; |
|---|
| 1640 | + position: absolute; |
|---|
| 1641 | + z-index: 9999; |
|---|
| 1642 | + max-width: 300px; |
|---|
| 1643 | + min-width: 130px; |
|---|
| 1644 | +} |
|---|
| 1645 | + |
|---|
| 1646 | +body .ui-tooltip { |
|---|
| 1647 | + border-width: 1px; |
|---|
| 1648 | +} |
|---|
| 1649 | + |
|---|
| 1650 | +.ui-tooltip, .arrow:after { |
|---|
| 1651 | + border: 1px solid #d7d7d7; |
|---|
| 1652 | +} |
|---|
| 1653 | + |
|---|
| 1654 | +.ui-tooltip { |
|---|
| 1655 | + padding: 5px 10px; |
|---|
| 1656 | +} |
|---|
| 1657 | + |
|---|
| 1658 | +.arrow { |
|---|
| 1659 | + width: 70px; |
|---|
| 1660 | + height: 16px; |
|---|
| 1661 | + overflow: hidden; |
|---|
| 1662 | + position: absolute; |
|---|
| 1663 | + left: 50%; |
|---|
| 1664 | + margin-left: -35px; |
|---|
| 1665 | + bottom: -16px; |
|---|
| 1666 | + z-index: 99999; |
|---|
| 1667 | + |
|---|
| 1668 | +} |
|---|
| 1669 | + |
|---|
| 1670 | +.arrow.top { |
|---|
| 1671 | + top: -16px; |
|---|
| 1672 | + bottom: auto; |
|---|
| 1673 | +} |
|---|
| 1674 | + |
|---|
| 1675 | +.arrow.left { |
|---|
| 1676 | + left: 20%; |
|---|
| 1677 | +} |
|---|
| 1678 | + |
|---|
| 1679 | +.arrow:after { |
|---|
| 1680 | + content: ""; |
|---|
| 1681 | + position: absolute; |
|---|
| 1682 | + left: 20px; |
|---|
| 1683 | + top: -20px; |
|---|
| 1684 | + width: 25px; |
|---|
| 1685 | + height: 25px; |
|---|
| 1686 | + background-color: #FFF; |
|---|
| 1687 | + -webkit-transform: rotate(45deg); |
|---|
| 1688 | + -moz-transform: rotate(45deg); |
|---|
| 1689 | + -ms-transform: rotate(45deg); |
|---|
| 1690 | + -o-transform: rotate(45deg); |
|---|
| 1691 | + tranform: rotate(45deg); |
|---|
| 1692 | +} |
|---|
| 1693 | + |
|---|
| 1694 | +.arrow.top:after { |
|---|
| 1695 | + bottom: -20px; |
|---|
| 1696 | + top: auto; |
|---|
| 1697 | +} |
|---|
| 1698 | + |
|---|
| 1699 | /* jQuery UI Slider */ |
|---|
| 1700 | |
|---|
| 1701 | .wp-slider.ui-slider { |
|---|
| 1702 | @@ -3809,11 +3937,9 @@ |
|---|
| 1703 | .wp-slider .ui-slider-handle { |
|---|
| 1704 | position: absolute; |
|---|
| 1705 | z-index: 2; |
|---|
| 1706 | - width: 1.2em; |
|---|
| 1707 | - height: 1.2em; |
|---|
| 1708 | - border-width: 1px; |
|---|
| 1709 | - border-style: solid; |
|---|
| 1710 | - border-radius: 3px; |
|---|
| 1711 | + width: 17px; |
|---|
| 1712 | + height: 17px; |
|---|
| 1713 | + border: none; |
|---|
| 1714 | } |
|---|
| 1715 | |
|---|
| 1716 | .wp-slider .ui-slider-range { |
|---|