Ticket #24425: 24425.draft.26.diff
File 24425.draft.26.diff, 23.2 KB (added by , 12 years ago) |
---|
-
wp-admin/css/colors-fresh.css
1379 1379 border: 1px solid #dfdfdf; 1380 1380 } 1381 1381 1382 #diff-slider.ui-slider-tooltip,1383 #diff-slider-ticks.ui-slider-tooltip {1382 .ui-slider-tooltip, 1383 .ui-slider-tooltip { 1384 1384 border-color: #d7d7d7; 1385 1385 background-color: #fff; 1386 1386 } -
wp-admin/css/wp-admin-rtl.css
975 975 left: 6px; 976 976 } 977 977 978 #toggle-revision-compare-mode {978 .revision-toggle-compare-mode { 979 979 right: auto; 980 980 left: 0; 981 981 padding: 9px 0 0 9px; 982 982 } 983 983 984 #diff-next-revision{984 .revisions-next { 985 985 float: left; 986 986 } 987 987 988 #diff-previous-revision{988 .revisions-previous { 989 989 float: right; 990 990 } 991 991 -
wp-admin/css/wp-admin.css
3502 3502 margin-bottom: 10px; 3503 3503 } 3504 3504 3505 .comparing-two-revisions .revisions-controls { 3506 height: 90px; 3507 } 3508 3505 3509 .revisions-meta { 3506 3510 margin-top: 15px; 3507 3511 } … … 3510 3514 top: 0; 3511 3515 right: 0; 3512 3516 } 3517 .comparing-two-revisions .revisions-previous, 3518 .comparing-two-revisions .revisions-next { 3519 display: none; 3520 } 3513 3521 3514 3522 .revisions-previous { 3515 3523 float: left; … … 3590 3598 width: 95%; 3591 3599 } 3592 3600 3593 #diff-slider .ui-slider-tooltip, 3594 #diff-slider-ticks .ui-slider-tooltip { 3601 .revisions .ui-slider-tooltip { 3602 position: absolute; 3603 bottom: 86px; 3604 margin-left: -70px; 3595 3605 display: none; 3596 position: absolute; 3597 bottom: 21px; 3598 margin-left: -74px; 3606 line-height: 28px; 3599 3607 } 3600 3608 3601 #diff-slider .ui-state-active .ui-slider-tooltip,3602 #diff-slider .ui-state-focus .ui-slider-tooltip,3603 #diff-slider .ui-state-hover .ui-slider-tooltip {3604 display: block;3605 }3606 3607 3609 #diff-title-to strong { 3608 3610 display: inline; 3609 3611 } … … 3655 3657 margin-top: 20px; 3656 3658 } 3657 3659 3658 .comparing-two-revisions#diff-previous-revision,3659 .comparing-two-revisions#diff-next-revision,3660 #diff-previous-revision, 3661 #diff-next-revision, 3660 3662 #diff-header-from { 3661 3663 display: none; 3662 3664 } … … 3740 3742 .ui-slider-tooltip img { 3741 3743 float: left; 3742 3744 margin-right: 5px; 3743 margin-top: 5px; 3745 margin-top: 2px; 3746 padding: 0; 3747 vertical-align: middle; 3744 3748 } 3745 3749 3746 3750 … … 3748 3752 3749 3753 .ui-tooltip, 3750 3754 .ui-slider-tooltip { 3751 padding: 8px;3755 padding: 4px; 3752 3756 position: absolute; 3753 3757 z-index: 9999; 3754 3758 max-width: 300px; … … 3768 3772 3769 3773 .ui-tooltip, 3770 3774 .ui-slider-tooltip { 3771 padding: 5px 10px;3775 padding: 4px 4px; 3772 3776 } 3773 3777 3774 3778 .arrow { … … 3776 3780 height: 16px; 3777 3781 overflow: hidden; 3778 3782 position: absolute; 3779 left: 50%;3783 left: 0; 3780 3784 margin-left: -35px; 3781 bottom: -16px; 3782 z-index: 99999; 3785 bottom: 71px; 3786 z-index: 10000; 3787 display: none; 3783 3788 } 3784 3789 3785 3790 .arrow.top { … … 3871 3876 3872 3877 .wp-slider.ui-slider-horizontal { 3873 3878 height: .8em; 3879 z-index: 10001; 3874 3880 } 3875 3881 3876 3882 .wp-slider.ui-slider-horizontal .ui-slider-handle { -
wp-admin/js/revisions.js
3 3 (function($) { 4 4 var revisions; 5 5 6 revisions = wp.revisions = { model: {}, view: {}, controller: {} };6 revisions = wp.revisions = { model: {}, view: {}, controller: {}, router: {} }; 7 7 8 8 // Link settings. 9 9 revisions.settings = typeof _wpRevisionsSettings === 'undefined' ? {} : _wpRevisionsSettings; … … 30 30 31 31 comparator: function( revision ) { 32 32 return revision.id; 33 } ,33 } 34 34 }); 35 35 36 36 revisions.model.Field = Backbone.Model.extend({}); … … 101 101 return this.fetch({ data: { compare: comparisons }, remove: false }); 102 102 }, 103 103 104 /**/105 104 loadLast: function( num ) { 106 105 num = num || 1; 107 106 var ids = this.getProximalDiffIds(); … … 194 193 initialize: function( attributes, options ) { 195 194 this.revisions = options.revisions; 196 195 this.diffs = new revisions.model.Diffs( [], {revisions: this.revisions} ); 196 this.listenTo( this, 'change:from', this.updateDiffFrom ); 197 this.listenTo( this, 'change:to', this.updateDiffTo ); 198 this.revisionsRouter = new revisions.router.Router(); 199 this.revisionsRouter.model = this; 197 200 198 this.listenTo( this, 'change:from change:to', this.updateDiffId );199 201 }, 200 202 201 updateDiff Id: function() {203 updateDiffTo: function() { 202 204 var from = this.get( 'from' ); 203 205 var to = this.get( 'to' ); 204 this.set( 'diffId', (from ? from.id : '0') + ':' + to.id ); 206 this.set( 'diffId', (from ? from.id : '0' ) + ':' + to.id ); 207 }, 208 209 updateDiffFrom: function() { 210 if ( this.get( 'compareTwoMode' ) ) { 211 this.updateDiffTo(); 212 } 205 213 } 214 206 215 }); 207 216 208 217 … … 243 252 this.model.diffs.loadAllBy( 50 ); 244 253 }, this ) ); 245 254 } 255 Backbone.history.start(); 246 256 }, 247 257 248 258 render: function() { … … 266 276 }); 267 277 268 278 // The control view. 269 // This contains the revision slider, previous/next buttons, and the compare checkbox.279 // This contains the revision slider, previous/next buttons, the meta info and the compare checkbox. 270 280 revisions.view.Controls = wp.Backbone.View.extend({ 271 281 tagName: 'div', 272 282 className: 'revisions-controls', 273 283 274 284 initialize: function() { 275 285 // Add the button view 276 this.views.add( new revisions.view.Buttons({ 286 this.views.add( new revisions.view.Buttons({ 277 287 model: this.model 278 288 })); 279 289 … … 314 324 if( this.model.get( 'to' ).attributes.current ) { 315 325 $( '#restore-revision' ).prop( 'disabled', true); 316 326 } else { 317 $( '#restore-revision' ).prop( 'disabled', false) 327 $( '#restore-revision' ).prop( 'disabled', false); 318 328 } 319 329 } 320 330 }); 321 331 322 323 332 // The buttons view. 324 // Encapsulates all of the configuration for the previous /next buttons, and the compare checkbox.333 // Encapsulates all of the configuration for the previous / next buttons, and the compare check-box. 325 334 revisions.view.Buttons = wp.Backbone.View.extend({ 326 335 tagName: 'div', 327 336 className: 'revisions-buttons', 328 337 template: wp.template('revisions-controls'), 329 338 330 339 initialize: function() { 331 this.$el.html( this.template() ) 340 this.$el.html( this.template() ); 341 this.listenTo( this.model, 'change:compareTwoMode', this.updateCompareTwoMode ); 342 332 343 }, 333 344 334 345 events: { 335 346 'click #next': 'nextRevision', 336 'click #previous': 'previousRevision' 347 'click #previous': 'previousRevision', 348 'click .compare-two-revisions': 'compareTwoToggle' 337 349 }, 338 350 351 updateCompareTwoMode: function(){ 352 if ( this.model.get( 'compareTwoMode' ) ){ 353 $( '.revisions-control-frame' ).addClass( 'comparing-two-revisions' ); 354 // in RTL mode the 'left handle' is the second in the slider, 'right' is first 355 $( '.wp-slider a.ui-slider-handle' ).first().addClass( isRtl ? 'right-handle' : 'left-handle' ); 356 $( '.wp-slider a.ui-slider-handle' ).last().addClass( isRtl ? 'left-handle' : 'right-handle' ); 357 } else { 358 $( '.revisions-control-frame' ).removeClass( 'comparing-two-revisions' ); 359 $( '.wp-slider a.ui-slider-handle' ).removeClass( 'left-handle' ).removeClass( 'right-handle' ); 360 } 361 362 }, 363 364 // Toggle the compare two mode feature when the compare two check-box is checked. 365 compareTwoToggle: function( event ){ 366 // Activate compare two mode? 367 if ( $( '.compare-two-revisions' ).is( ':checked' ) ) { 368 this.model.set( { compareTwoMode: true } ); 369 } else { 370 this.model.set( { compareTwoMode: false } ); 371 } 372 this.model.revisionsRouter.navigateRoute( this.model.get( 'to').id, this.model.get( 'from' ).id ); 373 374 }, 375 376 // Go to a specific modelindex, taking into account RTL mode. 339 377 gotoModel: function( toIndex ) { 340 378 var attributes = { 341 to: this.model.revisions.at( isRtl ? this.model.revisions.length - toIndex - 1 : toIndex ) // Reverse directions for R tl379 to: this.model.revisions.at( isRtl ? this.model.revisions.length - toIndex - 1 : toIndex ) // Reverse directions for RTL. 342 380 }; 343 381 // If we're at the first revision, unset 'from'. 344 if ( isRtl ? this.model.revisions.length - toIndex - 1 : toIndex ) // Reverse directions for R tl382 if ( isRtl ? this.model.revisions.length - toIndex - 1 : toIndex ) // Reverse directions for RTL 345 383 attributes.from = this.model.revisions.at( isRtl ? this.model.revisions.length - toIndex - 2 : toIndex - 1 ); 346 384 else 347 385 this.model.unset('from', { silent: true }); 348 386 349 387 this.model.set( attributes ); 388 389 this.model.revisionsRouter.navigateRoute( attributes.to.id, attributes.from ? attributes.from.id : 0 ); 390 350 391 }, 351 392 393 // Go to the 'next' revision, direction takes into account RTL mode. 352 394 nextRevision: function() { 353 var toIndex = this.model.revisions.indexOf( this.model.get( 'to' ) );395 var toIndex = isRtl ? this.model.revisions.length - this.model.revisions.indexOf( this.model.get( 'to' ) ) - 1 : this.model.revisions.indexOf( this.model.get( 'to' ) ); 354 396 toIndex = isRtl ? toIndex - 1 : toIndex + 1; 355 397 this.gotoModel( toIndex ); 356 398 }, 357 399 400 // Go to the 'previous' revision, direction takes into account RTL mode. 358 401 previousRevision: function() { 359 var toIndex = this.model.revisions.indexOf( this.model.get('to') );402 var toIndex = isRtl ? this.model.revisions.length - this.model.revisions.indexOf( this.model.get( 'to' ) ) - 1 : this.model.revisions.indexOf( this.model.get( 'to' ) ); 360 403 toIndex = isRtl ? toIndex + 1 : toIndex - 1; 361 404 this.gotoModel( toIndex ); 362 405 }, 363 406 364 407 ready: function() { 365 408 this.listenTo( this.model, 'change:diffId', this.disabledButtonCheck ); 409 410 // Hide compare two mode toggle when fewer than three revisions. 411 if ( this.model.revisions.length < 3 ) { 412 $( '.revision-toggle-compare-mode' ).hide(); 413 } 366 414 }, 367 415 368 // Check to see if the Previous or Next buttons need to be disabled or enabled 416 // Check to see if the Previous or Next buttons need to be disabled or enabled. 369 417 disabledButtonCheck: function() { 370 var maxVal = isRtl ? 0 :this.model.revisions.length - 1,371 minVal = isRtl ? this.model.revisions.length - 1 :0,372 next 418 var maxVal = this.model.revisions.length - 1, 419 minVal = 0, 420 next = $( '.revisions-next .button' ), 373 421 previous = $( '.revisions-previous .button' ), 374 val 422 val = this.model.revisions.indexOf( this.model.get( 'to' ) ); 375 423 376 // Disable "Next" button if you're on the last node 424 // Disable "Next" button if you're on the last node. 377 425 if ( maxVal === val ) 378 426 next.prop( 'disabled', true ); 379 427 else 380 428 next.prop( 'disabled', false ); 381 429 382 // Disable "Previous" button if you're on the first node 430 // Disable "Previous" button if you're on the first node. 383 431 if ( minVal === val ) 384 432 previous.prop( 'disabled', true ); 385 433 else 386 434 previous.prop( 'disabled', false ); 387 }, 388 389 435 } 390 436 }); 391 437 392 438 // The slider view. … … 395 441 tagName: 'div', 396 442 className: 'wp-slider', 397 443 444 events: { 445 'mousemove' : 'mousemove', 446 'mouseenter' : 'mouseenter', 447 'mouseleave' : 'mouseleave' 448 }, 449 398 450 initialize: function() { 399 451 _.bindAll( this, 'start', 'slide', 'stop' ); 400 452 … … 404 456 405 457 // Find the initially selected revision 406 458 var initiallySelectedRevisionIndex = 407 this.model.revisions.indexOf( 459 this.model.revisions.indexOf( 408 460 this.model.revisions.findWhere( { id: Number( revisions.settings.selectedRevision ) } ) ); 409 461 410 462 this.settings = new revisions.model.Slider({ … … 418 470 419 471 ready: function() { 420 472 this.$el.slider( this.settings.toJSON() ); 473 474 // Listen for changes in Compare Two Mode setting 475 this.listenTo( this.model, 'change:compareTwoMode', this.updateSliderSettings ); 476 421 477 this.settings.on( 'change', function( model, options ) { 422 // Apply changes to slider settings here. 423 this.$el.slider( { value: this.model.revisions.indexOf( this.model.get( 'to' ) ) } ); // Set handle to current to model 478 this.updateSliderSettings(); 424 479 }, this ); 425 // Reset to the initially selected revision426 this.slide( '', this.settings.attributes );427 480 428 481 // Listen for changes in the diffId 429 482 this.listenTo( this.model, 'change:diffId', this.diffIdChanged ); 430 483 484 // Reset to the initially selected revision 485 this.slide( '', this.settings.attributes ); 486 487 if ( this.model.get( 'compareTwoMode' ) ) 488 $( '.compare-two-revisions' ).trigger( 'click' ); 431 489 }, 432 490 491 mousemove: function( e ) { 492 var sliderLeft = Math.ceil( this.$el.offset().left ), 493 sliderWidth = Math.ceil( this.$el.width() ) + 2, 494 tickWidth = Math.ceil( ( sliderWidth ) / this.model.revisions.length ), 495 hoveringAt = Math.floor( ( e.clientX - sliderLeft ) / tickWidth ); 496 497 // Ensure sane value for hoveringAt. 498 if ( hoveringAt < 0 ) 499 hoveringAt = 0; 500 else if ( hoveringAt >= this.model.revisions.length ) 501 hoveringAt = this.model.revisions.length - 1; 502 503 var tooltipHtml = this.model.revisions.at( hoveringAt ).get( 'author' ).avatar + 504 this.model.revisions.at( hoveringAt ).get( 'author' ).name + 505 ', ' + this.model.revisions.at( hoveringAt ).get( 'dateShort' ); 506 507 this.addTooltip( $( e.currentTarget ), tooltipHtml, e ); 508 }, 509 510 mouseenter: function( e ) { 511 $( e.currentTarget ).parent().find( '.ui-slider-tooltip' ).show(); 512 $( e.currentTarget ).parent().find( '.arrow' ).show(); 513 }, 514 515 mouseleave: function( e ) { 516 $( e.currentTarget ).parent().find( '.ui-slider-tooltip' ).hide(); 517 $( e.currentTarget ).parent().find( '.arrow' ).hide(); 518 }, 519 520 updateSliderSettings: function() { 521 if ( isRtl ) { 522 this.$el.slider( { // Order reversed in RTL mode 523 value: this.model.revisions.length - this.model.revisions.indexOf( this.model.get( 'to' ) ) - 1 524 } ); 525 } else { 526 if ( this.model.get( 'compareTwoMode' ) ) { 527 this.$el.slider( { // Set handles to current from/to models 528 values: [ 529 this.model.revisions.indexOf( this.model.get( 'from' ) ), 530 this.model.revisions.indexOf( this.model.get( 'to' ) ) 531 ], 532 value: null, 533 range: true // Range mode ensures handles can't cross 534 } ); 535 } else { 536 this.$el.slider( { // Set handle to current to model 537 value: this.model.revisions.indexOf( this.model.get( 'to' ) ), 538 values: null, // Clear existing two handled values 539 range: false 540 } ); 541 } 542 } 543 if ( this.model.get( 'compareTwoMode' ) ){ 544 $( '.revisions' ).addClass( 'comparing-two-revisions' ); 545 546 // in RTL mode the 'left handle' is the second in the slider, 'right' is first 547 $( 'a.ui-slider-handle', this.$el ) 548 .first() 549 .addClass( isRtl ? 'right-handle' : 'left-handle' ) 550 .removeClass( isRtl ? 'left-handle' : 'right-handle' ); 551 $( 'a.ui-slider-handle', this.$el ) 552 .last() 553 .addClass( isRtl ? 'left-handle' : 'right-handle' ) 554 .removeClass( isRtl ? 'right-handle' : 'left-handle' ); 555 } else { 556 $( '.revisions' ).removeClass( 'comparing-two-revisions' ); 557 } 558 }, 559 433 560 diffIdChanged: function() { 434 561 // Reset the view settings when diffId is changed 435 this.settings.set( { 'value': this.model.revisions.indexOf( this.model.get( 'to' ) ) } ); 562 if ( this.model.get( 'compareTwoMode' ) ) { 563 this.settings.set( { 'values': [ 564 this.model.revisions.indexOf( this.model.get( 'from' ) ), 565 this.model.revisions.indexOf( this.model.get( 'to' ) ) 566 ] } ); 567 } else { 568 this.settings.set( { 'value': this.model.revisions.indexOf( this.model.get( 'to' ) ) } ); 569 } 436 570 }, 437 571 438 572 start: function( event, ui ) { 439 // Track the mouse position to enable smooth dragging, overrides default jquery ui step behaviour 440 $( window ).mousemove( function( e ) { 441 var sliderLeft = $( '.wp-slider' ).offset().left, 442 sliderRight = sliderLeft + $( '.wp-slider' ).width(); 573 if ( true !== this.model.get( 'compareTwoMode' )) { 574 // Track the mouse position to enable smooth dragging, overrides default jquery ui step behaviour . 575 $( window ).mousemove( function( e ) { 576 var sliderLeft = this.$el.offset().left, 577 sliderRight = sliderLeft + this.$el.width(); 443 578 444 // Follow mouse movements, as long as handle remains inside slider 445 if ( e.clientX < sliderLeft ) { 446 $( ui.handle ).css( 'left', 0 ); // Mouse to left of slider 447 } else if ( e.clientX > sliderRight ) { 448 $( ui.handle ).css( 'left', sliderRight - sliderLeft); // Mouse to right of slider 449 } else { 450 $( ui.handle ).css( 'left', e.clientX - sliderLeft ); // Mouse in slider 451 } 452 } ); // End mousemove 579 // Follow mouse movements, as long as handle remains inside slider. 580 if ( e.clientX < sliderLeft ) { 581 $( ui.handle ).css( 'left', 0 ); // Mouse to left of slider. 582 } else if ( e.clientX > sliderRight ) { 583 $( ui.handle ).css( 'left', sliderRight - sliderLeft); // Mouse to right of slider. 584 } else { 585 $( ui.handle ).css( 'left', e.clientX - sliderLeft ); // Mouse in slider. 586 } 587 } ); // End mousemove. 588 } 453 589 }, 454 590 591 getSliderPosition: function( ui ){ 592 return isRtl ? this.model.revisions.length - ui.value - 1 : ui.value; 593 }, 594 595 addTooltip: function( handle, message, e ) { 596 var offset = $( '.revisions-buttons' ).offset().left, 597 calculatedX = e.clientX - offset; 598 599 handle.parent().find( '.ui-slider-tooltip' ).html( message ).css( 'left', calculatedX ); 600 handle.parent().find( '.arrow' ).css( 'left', calculatedX ); 601 }, 602 455 603 slide: function( event, ui ) { 456 var attributes = { 457 to: this.model.revisions.at( isRtl ? this.model.revisions.length - ui.value - 1 : ui.value ) // Reverse directions for Rtl 458 }; 604 var attributes; 605 // Compare two revisions mode 606 if ( 'undefined' !== typeof ui.values && this.model.get( 'compareTwoMode' ) ) { 607 // Prevent sliders from occupying same spot 608 if ( ui.values[1] === ui.values[0] ) 609 return false; 610 attributes = { 611 to: this.model.revisions.at( isRtl ? this.model.revisions.length - ui.values[1] - 1 : ui.values[1] ), // Reverse directions for RTL. 612 from: this.model.revisions.at( isRtl ? this.model.revisions.length - ui.values[0] - 1 : ui.values[0] ) // Reverse directions for RTL. 613 }; 459 614 460 // If we're at the first revision, unset 'from'. 461 if ( isRtl ? this.model.revisions.length - ui.value - 1 : ui.value ) // Reverse directions for Rtl 462 attributes.from = this.model.revisions.at( isRtl ? this.model.revisions.length - ui.value - 2 : ui.value - 1 ); 463 else 464 this.model.unset('from', { silent: true }); 615 } else { 616 // Compare single revision mode 617 var sliderPosition = this.getSliderPosition( ui ); 618 attributes = { 619 to: this.model.revisions.at( sliderPosition ) 620 }; 465 621 622 // If we're at the first revision, unset 'from'. 623 if ( sliderPosition ) // Reverse directions for RTL. 624 attributes.from = this.model.revisions.at( sliderPosition - 1 ); 625 else 626 this.model.unset('from', { silent: true }); 627 628 } 466 629 this.model.set( attributes ); 630 631 // Maintain state history when dragging 632 this.model.revisionsRouter.navigateRoute( attributes.to.id, ( attributes.from ? attributes.from.id : 0 ) ); 633 467 634 }, 468 635 469 636 stop: function( event, ui ) { 470 $( window ).unbind( 'mousemove' ); // Stop tracking the mouse 471 // Reset settings pops handle back to the step position 472 this.settings.trigger( 'change' ); 637 if ( true !== this.model.get( 'compareTwoMode' )) { 638 $( window ).unbind( 'mousemove' ); // Stop tracking the mouse. 639 // Reset settings pops handle back to the step position. 640 this.settings.trigger( 'change' ); 641 } 473 642 } 474 643 }); 475 644 … … 486 655 } 487 656 }); 488 657 658 // The revisions router 659 // takes URLs with #hash fragments and routes them 660 revisions.router.Router = Backbone.Router.extend({ 661 model: null, 662 663 routes: { 664 'revision/from/:from/to/:to/handles/:handles': 'gotoRevisionId' 665 }, 666 667 navigateRoute: function( to, from ) { 668 var navigateTo = '/revision/from/' + from + '/to/' + to + '/handles/'; 669 if ( this.model.get( 'compareTwoMode' ) ){ 670 navigateTo = navigateTo + '2'; 671 } else { 672 navigateTo = navigateTo + '1'; 673 } 674 this.navigate( navigateTo ); 675 }, 676 677 gotoRevisionId: function( from, to, handles ) { 678 if ( '2' === handles ) { 679 this.model.set( { compareTwoMode: true } ); 680 $( '.compare-two-revisions' ).prop( 'checked', true ); 681 } else { 682 this.model.set( { compareTwoMode: false } ); 683 $( '.compare-two-revisions' ).prop( 'checked', false ); 684 } 685 if ('undefined' !== typeof this.model ) { 686 var selectedToRevision = 687 this.model.revisions.findWhere( { 'id': Number( to ) } ), 688 selectedFromRevision = 689 this.model.revisions.findWhere( { 'id': Number( from ) } ); 690 691 this.model.set( { 692 to: selectedToRevision, 693 from: selectedFromRevision } ); 694 } 695 } 696 }); 697 489 698 // Initialize the revisions UI. 490 699 revisions.init = function() { 491 700 revisions.view.frame = new revisions.view.Frame({ 492 701 collection: new revisions.model.Revisions( revisions.settings.revisionData ) 493 702 }).render(); 703 // Only allow compare two mode if three or more revisions 494 704 }; 495 705 496 706 $( revisions.init ); -
wp-admin/revision.php
118 118 <span class="spinner"></span> 119 119 <div class="revisions-control-frame"></div> 120 120 <div class="revisions-diff-frame"></div> 121 121 122 </script> 122 123 123 124 <script id="tmpl-revisions-controls" type="text/html"> 124 125 <div class="revisions-tooltip"> 126 <div class="ui-slider-tooltip ui-widget-content ui-corner-all "></div> 127 <div class="arrow"></div> 128 </div> 125 129 <div class="revision-toggle-compare-mode"> 126 130 <label> 127 131 <input type="checkbox" class="compare-two-revisions" /> … … 177 181 <# }); #> 178 182 </script> 179 183 180 <script id="tmpl-revisions-diff-old" type="text/html">181 <div id="toggle-revision-compare-mode">182 <label>183 <input type="checkbox" id="compare-two-revisions" />184 <?php esc_attr_e( 'Compare two revisions' ); ?>185 </label>186 </div>187 184 188 <div id="diff-header">189 <div id="diff-header-from" class="diff-header">190 <div id="diff-title-from" class="diff-title">191 <strong><?php _ex( 'From:', 'Followed by post revision info' ); ?></strong> {{{ data.titleFrom }}}192 </div>193 <div class="clear"></div>194 </div>195 185 196 <div id="diff-header-to" class="diff-header">197 <div id="diff-title-to" class="diff-title">198 <strong><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong> {{{ data.titleTo }}}199 </div>200 186 201 <input type="button" id="restore-revision" class="button button-primary" data-restore-link="{{{ data.restoreLink }}}" value="<?php esc_attr_e( 'Restore This Revision' )?>" />202 <div class="clear"></div>203 </div>204 </div>205 206 <div id="diff-table">{{{ data.diff }}}</div>207 </script>208 209 <script id="tmpl-revision-interact-old" type="text/html">210 <div id="diff-previous-revision">211 <input class="button" type="button" id="previous" value="<?php echo esc_attr_x( 'Previous', 'Button label for a previous revision' ); ?>" />212 </div>213 214 <div id="diff-next-revision">215 <input class="button" type="button" id="next" value="<?php echo esc_attr_x( 'Next', 'Button label for a next revision' ); ?>" />216 </div>217 218 </script>219 220 187 <script id="tmpl-revision-ticks" type="text/html"> 221 188 <div class="revision-tick completed-{{{ data.completed }}} scope-of-changes-{{{ data.scopeOfChanges }}}"> 222 189 <span class="ui-slider-tooltip ui-widget-content ui-corner-all hidden"></span>