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