Make WordPress Core

Ticket #24425: 24425.draft.17b.diff

File 24425.draft.17b.diff, 5.9 KB (added by ocean90, 12 years ago)
  • wp-admin/css/wp-admin-rtl.css

     
    975975        left: 6px;
    976976}
    977977
    978 #toggle-revision-compare-mode {
     978.revision-toggle-compare-mode {
    979979        right: auto;
    980980        left: 0;
    981981        padding: 9px 0 0 9px;
    982982}
    983983
    984 #diff-next-revision {
     984.revisions-next {
    985985        float: left;
    986986}
    987987
    988 #diff-previous-revision {
     988.revisions-previous {
    989989        float: right;
    990990}
    991991
  • wp-admin/js/revisions.js

     
    3030
    3131                comparator: function( revision ) {
    3232                        return revision.id;
    33                 },
     33                }
    3434        });
    3535
    3636        revisions.model.Field = Backbone.Model.extend({});
     
    101101                        return this.fetch({ data: { compare: comparisons }, remove: false });
    102102                },
    103103
    104 /**/
    105104                loadLast: function( num ) {
    106105                        num     = num || 1;
    107106                        var ids = this.getProximalDiffIds();
     
    273272
    274273                initialize: function() {
    275274                        // Add the button view
    276                         this.views.add( new revisions.view.Buttons({ 
     275                        this.views.add( new revisions.view.Buttons({
    277276                                model: this.model
    278277                        }));
    279278
     
    314313                        if( this.model.get( 'to' ).attributes.current ) {
    315314                                $( '#restore-revision' ).prop( 'disabled', true);
    316315                        } else {
    317                                 $( '#restore-revision' ).prop( 'disabled', false)
     316                                $( '#restore-revision' ).prop( 'disabled', false);
    318317                        }
    319318                }
    320319        });
     
    328327                template: wp.template('revisions-controls'),
    329328
    330329                initialize: function() {
    331                         this.$el.html( this.template() )
     330                        this.$el.html( this.template() );
    332331                },
    333332
    334333                events: {
    335334                        'click #next': 'nextRevision',
    336335                        'click #previous': 'previousRevision'
    337336                },
    338                
     337
    339338                gotoModel: function( toIndex ) {
    340339                        var attributes = {
    341340                                to: this.model.revisions.at( isRtl ? this.model.revisions.length - toIndex - 1 : toIndex ) // Reverse directions for Rtl
     
    350349                },
    351350
    352351                nextRevision: function() {
    353                         var toIndex = this.model.revisions.indexOf( this.model.get( 'to' ) );
     352                        var toIndex = isRtl ? this.model.revisions.length - this.model.revisions.indexOf( this.model.get( 'to' ) ) - 1 : this.model.revisions.indexOf( this.model.get( 'to' ) );
    354353                        toIndex     = isRtl ? toIndex - 1 : toIndex + 1;
    355354                        this.gotoModel( toIndex );
    356355                },
    357                
     356
    358357                previousRevision: function() {
    359                         var toIndex = this.model.revisions.indexOf( this.model.get('to') );
     358                        var toIndex = isRtl ? this.model.revisions.length - this.model.revisions.indexOf( this.model.get( 'to' ) ) - 1 : this.model.revisions.indexOf( this.model.get( 'to' ) );
    360359                        toIndex     = isRtl ? toIndex + 1 : toIndex - 1;
    361360                        this.gotoModel( toIndex );
    362361                },
     
    367366
    368367                // Check to see if the Previous or Next buttons need to be disabled or enabled
    369368                disabledButtonCheck: function() {
    370                         var maxVal   = isRtl ? 0 : this.model.revisions.length - 1,
    371                                 minVal   = isRtl ? this.model.revisions.length - 1 : 0,
     369                        var maxVal   = this.model.revisions.length - 1,
     370                                minVal   = 0,
    372371                                next     = $( '.revisions-next .button' ),
    373372                                previous = $( '.revisions-previous .button' ),
    374373                                val      = this.model.revisions.indexOf( this.model.get( 'to' ) );
     
    384383                                previous.prop( 'disabled', true );
    385384                        else
    386385                                previous.prop( 'disabled', false );
    387                 },
    388 
    389 
     386                }
    390387        });
    391388
    392389        // The slider view.
     
    404401
    405402                        // Find the initially selected revision
    406403                        var initiallySelectedRevisionIndex =
    407                                 this.model.revisions.indexOf( 
     404                                this.model.revisions.indexOf(
    408405                                        this.model.revisions.findWhere(  { id: Number( revisions.settings.selectedRevision ) } ) );
    409406
    410407                        this.settings = new revisions.model.Slider({
     
    420417                        this.$el.slider( this.settings.toJSON() );
    421418                        this.settings.on( 'change', function( model, options ) {
    422419                                // 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
     420                                if ( isRtl ) {
     421                                        this.$el.slider( { // Order reversed in RTL mode
     422                                                value: this.model.revisions.length - this.model.revisions.indexOf( this.model.get( 'to' ) ) - 1
     423                                        } );
     424                                } else {
     425                                        this.$el.slider( { // Set handle to current to model
     426                                                value: this.model.revisions.indexOf( this.model.get( 'to' ) )
     427                                        } );
     428                                }
    424429                        }, this );
    425430                        // Reset to the initially selected revision
    426431                        this.slide( '', this.settings.attributes );
    427432
    428433                        // Listen for changes in the diffId
    429434                        this.listenTo( this.model, 'change:diffId', this.diffIdChanged );
    430 
    431435                },
    432436
    433437                diffIdChanged: function() {
     
    436440                },
    437441
    438442                start: function( event, ui ) {
    439                         // Track the mouse position to enable smooth dragging, overrides default jquery ui step behaviour 
    440                         $( window ).mousemove( function( e ) { 
     443                        // Track the mouse position to enable smooth dragging, overrides default jquery ui step behaviour
     444                        $( window ).mousemove( function( e ) {
    441445                                var sliderLeft  = $( '.wp-slider' ).offset().left,
    442446                                        sliderRight = sliderLeft + $( '.wp-slider' ).width();
    443447
     
    449453                                } else {
    450454                                        $( ui.handle ).css( 'left', e.clientX - sliderLeft ); // Mouse in slider
    451455                                }
    452                         } ); // End mousemove 
     456                        } ); // End mousemove
    453457                },
    454458
    455459                slide: function( event, ui ) {
    456460                        var attributes = {
    457                                 to: this.model.revisions.at( isRtl ? this.model.revisions.length - ui.value - 1 : ui.value ) // Reverse directions for Rtl
     461                                to: this.model.revisions.at( isRtl ? this.model.revisions.length - ui.value - 1 : ui.value ) // Reverse directions for RTL
    458462                        };
    459463
    460464                        // 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
     465                        if ( isRtl ? this.model.revisions.length - ui.value - 1 : ui.value ) // Reverse directions for RTL
    462466                                attributes.from = this.model.revisions.at( isRtl ? this.model.revisions.length - ui.value - 2 : ui.value - 1 );
    463467                        else
    464468                                this.model.unset('from', { silent: true });