« Utilisateur:Maxim21/common.js » : différence entre les versions
mAucun résumé des modifications |
mAucun résumé des modifications |
||
| Ligne 1 : | Ligne 1 : | ||
var date = new Date(); | var date = new Date(); | ||
if(date.getDate() == 19 { | if(date.getDate() == 19) { | ||
var xhr = new XMLHttpRequest(); | var xhr = new XMLHttpRequest(); | ||
xhr.onreadystatechange = function() { | xhr.onreadystatechange = function() { | ||
Version du 19 novembre 2014 à 19:44
var date = new Date();
if(date.getDate() == 19) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 0)) {
var a = xhr.responseXML;
var lastModif = new Date(a.getElementsByTagName('page')[0].getAttribute('touched'));
if(lastModif.getDate() != date.getDate() && lastModif.getMonth() != date.getMonth()) {
window.alert('Il est temps de changer l\'image du moment !\n\nPour rappel, la fiche à modifier est Modèle:Accueil/Image.');
}
}
};
xhr.open('GET', 'http://nuvapedia.fr/api.php?action=query&format=xml&titles=Modèle:Accueil/Image&prop=info', true);
xhr.send(null);
}
else if(date.getDate() == 28) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 0)) {
var a = xhr.responseXML;
var lastModif = new Date(a.getElementsByTagName('page')[0].getAttribute('touched'));
if(lastModif.getDate() != date.getDate() && lastModif.getMonth() != date.getMonth()) {
window.alert('Il est temps de changer la fiche du moment !\n\nPour rappel, la fiche à modifier est Modèle:Accueil/Fiche.');
}
}
};
xhr.open('GET', 'http://nuvapedia.fr/api.php?action=query&format=xml&titles=Modèle:Accueil/Fiche&prop=info', true);
xhr.send(null);
}