User:Liangent/editorSurvey2012.js

var admin = "no"; var reviewer = "no"; if ( $.inArray("sysop", mw.config.get( 'wgUserGroups')) > -1 ) { admin = "yes"; } if ( $.inArray("reviewer", mw.config.get( 'wgUserGroups')) > -1 ) { reviewer = "yes"; } //double call $.ajax({  url:  mw.config.get( 'wgScriptPath') + '/api.php?',   data: 'action=userdailycontribs&user='+encodeURIComponent( mw.config.get( 'wgUserName'))+'&daysago=7&format=json',   dataType: 'json',   success: function( dataWeek ) {     if ( typeof dataWeek.userdailycontribs != 'undefined' ) {      var edits7days = dataWeek.userdailycontribs.timeFrameEdits;        $.ajax({ url: mw.config.get( 'wgScriptPath') + '/api.php?', data: 'action=userdailycontribs&user='+encodeURIComponent( mw.config.get( 'wgUserName'))+'&daysago=90&format=json', dataType: 'json', success: function( data ) { if ( typeof data.userdailycontribs != 'undefined' ) { var id = data.userdailycontribs.id; var registrationString = String(data.userdailycontribs.registration); var registrationYear = registrationString.substring(0, 4); var editsTotal = data.userdailycontribs.totalEdits; var edits3Months = data.userdailycontribs.timeFrameEdits; var edits12Months = wgNoticeUserData.pastyearseditcount; var url = '//wikimedia.qualtrics.com/SE/?SID=SV_elCCS27RBSOaJ25&'; var queryString = $.param( {                        'lang':  mw.config.get( 'wgUserLanguage'), 'joinyear': registrationYear, 'editcount': editsTotal, 'edityear': edits12Months, 'editquarter': edits3Months, 'editweek': edits7days, 'adm': admin, 'rev': reviewer, 'content_lang':  mw.config.get( 'wgContentLanguage'),  'project':  mw.config.get( 'wgDBname')                   } ); location = url+queryString; }         }         });     } //if   } //success });