User:TestBotOnly/vector.js

jQuery('#siteNotice').html('  How satisfied are you with Wikipedia? Your feedback is important to us! As a token of appreciation for your support you get a chance of winning a Wikipedia T-shirt. Click here to learn more!    ');

var constSamplingRate = 1; var constDisplayTimeSpan = 30; var constDone = 'done'; var constTodo = 'todo'; $(document).ready( function {	wmdeslog( '$(document).ready' );	// If the survey should not be hidden...	if ( $.cookie( 'surveyStatusLOCAL' ) != constDone ) 	{		initSurveyIfNeeded;	} } ); function initSurveyIfNeeded {	wmdeslog( 'initSurveyIfNeeded' ); // If the users has been picked to participate in the survey if ( $.cookie( 'surveyStatusLOCAL' ) == constTodo ) {		var startTime = $.cookie( 'surveyStartTimeLOCAL' ); // If the start of the survey is set, display it when still within 5 mins, otherwise set done. if ( startTime != null ) {				if ( parseInt( startTime ) + ( 1000*60* constDisplayTimeSpan ) > (new Date).getTime ) {					displaySurvey; }				else {					setSurveyStatus( constDone ); }		}			// If the start of the survey is not set, check for the right page (first page that is not an "action" page) else if ( window.location.toString.indexOf( 'action=' ) == -1 ) {			$.cookie( 'surveyStartTimeLOCAL', (new Date).getTime.toString, { 'expires': 31 /* days */, 'path': '/' } ); mw.loader.using( 'jquery.clicktracking', function { $.trackAction( 'wmdesurvey-surveyparticipant' ); } ); displaySurvey; }	}	else {		// If the user is an editor, do lottery. if ( window.location.toString.indexOf( 'action=edit' ) != -1 ) {			var selectionSize = constSamplingRate ; // If the user wins the lottery, set DisplayTodo if ( Math.random < selectionSize ) {				setSurveyStatus( constTodo ); if (!wgNoticeToggleState) toggleNotice; } 			// If the user loses, set done. else {				setSurveyStatus( constDone ); if (wgNoticeToggleState) toggleNotice; }		}		else {		// (If the user is not an editor, hide banner.) if (wgNoticeToggleState) toggleNotice; }

} } function setSurveyStatus( status ) {	wmdeslog( 'setSurveyStatus: ' + status ); $.cookie( 'surveyStatusLOCAL', status, { 'expires': 31 /* days */, 'path': '/' } ); } function displaySurvey {	wmdeslog( 'displaySurvey' ); $( '#editorSurveyLink' ).click( onSurveyLinkClick ); $( '#editorSurveyClose' ).click( onSurveyCloseClick );

if (!wgNoticeToggleState) toggleNotice; $( '#editorSurvey2011' ).show; } var isFirstClick = true; function onSurveyLinkClick {	wmdeslog( 'onSurveyLinkClick' ); if ( isFirstClick ) {		wmdeslog( 'onSurveyLinkClick - first click' ); setSurveyStatus(constDone); var sender = $( this ); sender.attr( 'href', sender.attr( 'href' ) + Math.random.toString.substring(2)); isFirstClick = false; } 	return true; } function onSurveyCloseClick {	$( '#editorSurvey2011' ).hide; toggleNotice; setSurveyStatus( constDone ); } function wmdeslog( message ) { //console.log( 'WMDE survey: ' + message ); }