Changeset 24638
- Timestamp:
- 07/10/2013 06:08:56 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/js/revisions.js
r24636 r24638 7 7 8 8 // Link settings. 9 revisions.settings = typeof _wpRevisionsSettings === 'undefined'? {} : _wpRevisionsSettings;9 revisions.settings = _.isUndefined( _wpRevisionsSettings ) ? {} : _wpRevisionsSettings; 10 10 11 11 // For debugging … … 719 719 // In single handle mode, the 1st stored revision is 'blank' and the 'from' model is not set 720 720 // In this case we move the to index over one 721 if ( 'undefined' == typeof this.model.get('from') ) {721 if ( _.isUndefined( this.model.get('from') ) ) { 722 722 if ( isRtl ) { 723 723 leftValue = this.model.revisions.length - this.model.revisions.indexOf( this.model.get('to') ) - 2; … … 837 837 var attributes; 838 838 // Compare two revisions mode 839 if ( 'undefined' !== typeof ui.values&& this.model.get('compareTwoMode') ) {839 if ( ! _.isUndefined( ui.values ) && this.model.get('compareTwoMode') ) { 840 840 // Prevent sliders from occupying same spot 841 841 if ( ui.values[1] === ui.values[0] ) … … 894 894 895 895 routes: { 896 'revision/from/:from/to/:to/handles/:handles': 'gotoRevisionId' 896 'from/:from/to/:to': 'handleRoute', 897 'at/:to': 'routeSingle' 897 898 }, 898 899 … … 900 901 var from = this.model.has('from') ? this.model.get('from').id : 0; 901 902 var to = this.model.get('to').id; 902 var handles = this.model.get('compareTwoMode') ? '2' : '1'; 903 904 this.navigate( '/revision/from/' + from + '/to/' + to + '/handles/' + handles ); 905 }, 906 907 gotoRevisionId: function( from, to, handles ) { 908 from = parseInt( from, 10 ); 909 to = parseInt( to, 10 ); 910 911 this.model.set({ compareTwoMode: ( '2' === handles ) }); 912 913 if ( 'undefined' !== typeof this.model ) { 903 if ( this.model.get('compareTwoMode' ) ) 904 this.navigate( 'from/' + from + '/to/' + to ); 905 else 906 this.navigate( 'at/' + to ); 907 }, 908 909 handleRoute: function( a, b ) { 910 var from, to, compareTwo; 911 912 // If `b` is undefined, this was a 'revision/:to' route 913 if ( _.isUndefined( b ) ) { 914 b = a; 915 a = 0; 916 compareTwo = true; 917 } else { 918 compareTwo = false; 919 } 920 921 from = parseInt( a, 10 ); 922 to = parseInt( b, 10 ); 923 924 this.model.set({ compareTwoMode: compareTwo }); 925 926 if ( ! _.isUndefined( this.model ) ) { 914 927 var selectedToRevision = this.model.revisions.findWhere({ id: to }), 915 928 selectedFromRevision = this.model.revisions.findWhere({ id: from });
Note: See TracChangeset
for help on using the changeset viewer.