mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-14 19:24:42 +00:00
Make use of JavaScript "in" feature instead of "undefined"
Change-Id: I914f7281101bc4873eff3574c884253775e9b4bb
This commit is contained in:
parent
91c157e0f4
commit
2d5b40c40b
|
@ -63,7 +63,7 @@
|
|||
}
|
||||
|
||||
revs.forEach( function ( rev ) {
|
||||
if ( typeof rev.user !== 'undefined' && typeof genderData[ rev.user ] !== 'undefined' ) {
|
||||
if ( 'user' in rev && rev.user in genderData ) {
|
||||
rev.userGender = genderData[ rev.user ];
|
||||
}
|
||||
} );
|
||||
|
@ -99,7 +99,7 @@
|
|||
var dir, data;
|
||||
|
||||
options = options || {};
|
||||
dir = options.dir !== undefined ? options.dir : 'older';
|
||||
dir = 'dir' in options ? options.dir : 'older';
|
||||
data = {
|
||||
action: 'query',
|
||||
prop: 'revisions',
|
||||
|
@ -112,13 +112,13 @@
|
|||
rvdir: dir
|
||||
};
|
||||
|
||||
if ( options.startId !== undefined ) {
|
||||
if ( 'startId' in options ) {
|
||||
data.rvstartid = options.startId;
|
||||
}
|
||||
if ( options.endId !== undefined ) {
|
||||
if ( 'endId' in options ) {
|
||||
data.rvendid = options.endId;
|
||||
}
|
||||
if ( options.limit !== undefined && options.limit <= 500 ) {
|
||||
if ( 'limit' in options && options.limit <= 500 ) {
|
||||
data.rvlimit = options.limit;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,15 +11,15 @@
|
|||
this.minor = data.hasOwnProperty( 'minor' ) && ( data.minor || data.minor === '' );
|
||||
|
||||
// Comments and users can be suppressed thus we must check if they exist
|
||||
if ( typeof data.comment !== 'undefined' ) {
|
||||
if ( 'comment' in data ) {
|
||||
this.comment = data.comment;
|
||||
}
|
||||
if ( typeof data.parsedcomment !== 'undefined' ) {
|
||||
if ( 'parsedcomment' in data ) {
|
||||
this.parsedComment = data.parsedcomment;
|
||||
}
|
||||
if ( typeof data.user !== 'undefined' ) {
|
||||
if ( 'user' in data ) {
|
||||
this.user = data.user;
|
||||
if ( typeof data.userGender !== 'undefined' ) {
|
||||
if ( 'userGender' in data ) {
|
||||
this.userGender = data.userGender;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -894,7 +894,7 @@
|
|||
|
||||
self.addRevisionsAtEnd( $slider, revs );
|
||||
|
||||
if ( data.continue === undefined ) {
|
||||
if ( !( 'continue' in data ) ) {
|
||||
self.noMoreNewerRevisions = true;
|
||||
}
|
||||
} );
|
||||
|
@ -933,7 +933,7 @@
|
|||
}
|
||||
self.addRevisionsAtStart( $slider, revs, precedingRevisionSize );
|
||||
|
||||
if ( data.continue === undefined ) {
|
||||
if ( !( 'continue' in data ) ) {
|
||||
self.noMoreOlderRevisions = true;
|
||||
}
|
||||
} );
|
||||
|
|
Loading…
Reference in a new issue