Benutzer:TestBotOnly/vector.js
Erscheinungsbild
Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.
- Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
- Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
- Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
jQuery(document).ready( function() {
// If the survey should not be hidden...
if ( document.cookie.indexOf('isDoneWithSurvey=1') == -1 ) {
initSurveyIfNeeded();
}
} );
function initSurveyIfNeeded() {
var tsSetting = 'surveyStartTime=';
var timeStampLocation = document.cookie.indexOf( tsSetting );
// If the start of the survey is set, display it when still within 5 mins, otherwise set done.
if ( timeStampLocation != -1 ) {
if ( parseInt( document.cookie.substr( timeStampLocation + tsSetting.length, 13 ) ) + ( 1000*60*5 ) > (new Date()).getTime() ) {
displaySurvey();
}
else {
setSurveyDone();
}
} // If the survey has not started yet and the user is an editor, do lottery.
else if ( window.location.toString().indexOf( 'action=edit' ) != -1 ) {
var selectionSize = 1 / 1;
// If the user wins the lottery, set the start of the survey and display it.
if ( Math.random() < selectionSize ) {
var currentTime = (new Date()).getTime();
document.cookie = 'surveyStartTime=' + currentTime.toString() + '; expires=' + ( currentTime + (31*24*60*60*1000) ).toString() + '; path=/';
displaySurvey();
} // If the user loses, set done.
else {
setSurveyDone();
}
}
}
function setSurveyDone() {
document.cookie = 'isDoneWithSurvey=1; expires=' + ( (new Date()).getTime() + (31*24*60*60*1000) ).toString() + '; path=/';
}
function displaySurvey() {
jQuery('#editorSurvey2011').show();
jQuery('head').append('<link rel="stylesheet" href="http://wikimediafoundation.org/tracker/bannerImpression.php?req=css&surveyView=1 " type="text/css" />');
}