Utilisateur:Cantons-de-l'Est/common.js
Note : après avoir enregistré vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
- Firefox / Safari : Maintenez la touche Maj (Shift) en cliquant sur le bouton Actualiser ou pressez Ctrl-F5 ou Ctrl-R (⌘-R sur un Mac) ;
- Google Chrome : Appuyez sur Ctrl-Maj-R (⌘-Shift-R sur un Mac) ;
- Internet Explorer : Maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5 ;
- Opera : Allez dans Menu → Settings (Opera → Préférences sur un Mac) et ensuite à Confidentialité & sécurité → Effacer les données d'exploration → Images et fichiers en cache.
///////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
// Créé un ToDo list (un bouton est ajouté en haut des pages de Wikipédia en français
// Copie de https://en.wikipedia.org/w/index.php?title=User:BrandonXLF/TodoList.js
// 2021-07-11
/*** Todo List ***/
// Adds a todo list that also has a convient popup
// Documentation at [[User:BrandonXLF/TodoList]]
// By [[User:BrandonXLF]]
$.when(mw.loader.using([
'mediawiki.user',
'oojs-ui-core',
'oojs-ui-windows',
'oojs-ui.styles.icons-movement',
'oojs-ui.styles.icons-editing-core',
'oojs-ui.styles.icons-interactions',
'oojs-ui.styles.icons-moderation',
'oojs-ui.styles.icons-content'
]), $.ready).then(function() {
mw.util.addCSS(
'.userjs-todo-list .item:hover .act { visibility: visible !important; }' +
'[data-drop="above"]::before { display: block; border-top: 2px solid #066; margin-top: -2px; content: ""; }' +
'[data-drop="below"]::after { display: block; border-top: 2px solid #066; margin-top: -2px; content: ""; }' +
'.userjs-todo-list .items:empty { border: none !important; margin: 0 !important; padding: 0 !important;}' +
'.userjs-todo-moreinfo > a { min-width: unset !important; min-height: unset !important; padding: 0.65em !important; }' +
'.userjs-todo-moreinfo > a > span { min-width: unset !important; min-height: unset !important; width: 1.3em !important; left: 0 !important; }'
);
if (mw.config.get('skin') === 'minerva') {
mw.util.addCSS(
'.userjs-todo-list .item .act { visibility: visible !important; }' +
'#userjs-todo-popup { top: 0 !important; bottom: 0 !important; left: 0 !important; right: 0 !important; width: 100%; height: 100%; }' +
'#userjs-todo-popup .userjs-todo-list { width: 100%; height: 100%; } '
);
}
var api = new mw.Api(),
link = $(mw.util.addPortletLink(
'p-personal',
mw.util.getUrl('Special:BlankPage/todo'),
'Todo',
'userjs-todo',
'Click to see your todo list',
'd',
'#pt-preferences')
),
changes = [mw.user.options.get('userjs-todo-script')],
undo = 0,
req = 0,
parent,
ispopup = false,
loader = $('<input type="file" accept=".json" style="display:none;">').on('change', function() {
if (!this.files || !this.files[0]) return;
var file = this.files[0],
reader = new FileReader();
reader.onload = function() {
save(reader.result, true, true);
};
reader.readAsText(file);
}).appendTo(document.body);
$(window).on('beforeunload', function() {
if (req > 0) return true;
});
function save(what, record, relist) {
if (typeof what != 'string') {
what = JSON.stringify(what);
}
mw.user.options.set('userjs-todo-script', what);
req++;
parent.find('.status').text('Saving changes...');
api.saveOption('userjs-todo-script', what).done(function() {
req--;
if (req === 0) {
parent.find('.status').text('');
}
});
if (record !== false) {
while (undo > 0) {
changes.pop();
undo--;
}
changes.push(mw.user.options.get('userjs-todo-script'));
if (changes.length > 50) changes.shift();
}
if (relist) {
list();
if (req > 0) {
parent.find('.status').text('Saving changes...');
}
}
}
Math.clamp = function(max, x, min) {
return Math.min(max, Math.max(min, x));
};
function item(parent, array) {
var date = new Date(+array[2]),
url = array[0] || '',
txt = array[0] || '';
if (url.match(/^(https:|http:|:)\/\//) && url.match(/ /)) {
var reg = /(.*?) (.*)/.exec(url);
url = reg[1];
txt = reg[2];
} else if (!url.match(/^(https:|http:|:)\/\//)) {
url = mw.util.getUrl(url);
}
parent.append($('<div class="item" style="margin:5px 0;white-space:nowrap;"></div>')
.attr('data-page', array[0] || '')
.attr('data-info', array[1] || '')
.attr('data-date', array[2] || '')
.append((new OO.ui.IconWidget({icon: 'draggable', title: 'Drag'})).$element
.css({cursor: 'move', height: '1.2em', width: '1.2em', minWidth: 'unset', minHeight: 'unset', marginRight: '0.5em'})
.on('mousedown', function() {
$(this).parent().attr('draggable', 'true');
})
.on('mouseup', function() {
$(this).parent().attr('draggable', 'false');
})
)
.append($('<a>').addClass('page').attr('href', url).text(txt))
.append(array[0] && array[1] ? ' . . ' : '')
.append($('<span>').addClass('info').text(array[1] || ''))
.append(array[0] || array[1] ? '<span class="act" style="visibility:hidden;"> . . </span>' : '')
.append((new OO.ui.IconWidget({icon: 'trash', title: 'Delete', flags: ['destructive']})).$element
.css({cursor: 'pointer', visibility: 'hidden', height: '1.1em', width: '1.1em', minWidth: 'unset', minHeight: 'unset', marginRight: '0.5em'})
.addClass('act')
.click(function() {
var arr = [];
$(this).parent().siblings().each(function() {
arr.push([$(this).attr('data-page'), $(this).attr('data-info'), $(this).attr('data-date')]);
});
$(this).parent().remove();
save(arr);
})
)
.append((new OO.ui.IconWidget({icon: 'edit', title: 'Edit', flags: ['progressive']})).$element
.css({cursor: 'pointer', visibility: 'hidden', height: '1em', width: '1em', minWidth: 'unset', minHeight: 'unset', marginRight: '0.5em'})
.addClass('act edit')
.click(function() {
$(this).css('display', 'none');
$('<div style="border:1px solid #a2a9b1;padding:0 4px;margin:0.5em 0;border-radius:4px;"></div>')
.append((new OO.ui.TextInputWidget({
placeholder: 'Page name or URL',
value: $(this).parent().attr('data-page')
})).$element.css({maxWidth: 'unset', margin: '4px 0'}))
.append((new OO.ui.TextInputWidget({
placeholder: 'Comment',
value: $(this).parent().attr('data-info')
})).$element.css({maxWidth: 'unset', margin: '4px 0'}))
.append($('<table style="width:100%;border-spacing:0;margin-bottom:0.5em;"></table>').append($('<tr></tr>')
.append($('<td style="width:50%;padding-right:4px;"></td>').append((new OO.ui.ButtonWidget({
label: 'Save',
flags: ['progressive']
}).$element.css('width', '100%').children().css('width', '100%').parent()).click(function() {
var editbox = $(this).parent().parent().parent().parent(),
listitem = editbox.parent();
listitem.find('.page').text(editbox.find('input[placeholder="Page name or URL"]').val());
listitem.attr('data-page', editbox.find('input[placeholder="Page name or URL"]').val());
listitem.find('.info').text(editbox.find('input[placeholder="Comment"]').val());
if (listitem.find('.info')[0].previousSibling.nodeType != 3 && editbox.find('input[placeholder="Comment"]').val() !== '') {
listitem.find('.info').before(' . . ');
} else if (
listitem.find('.info')[0].previousSibling.nodeType == 3 &&
editbox.find('input[placeholder="Comment"]').val() === ''
) {
$(listitem.find('.info')[0].previousSibling).remove();
}
listitem.attr('data-info', editbox.find('input[placeholder="Comment"]').val());
var arr = [];
listitem.parent().children().each(function() {
arr.push([$(this).attr('data-page'), $(this).attr('data-info'), $(this).attr('data-date')]);
});
save(arr);
link.find('.redo').remove();
listitem.find('.edit').css('display', 'inline-block');
editbox.remove();
})
))
.append($('<td style="width:50%;padding-left:4px;"></td>').append((new OO.ui.ButtonWidget({
label: 'Cancel',
flags: ['destructive']
}).$element.css('width', '100%').children().css('width', '100%').parent()).click(function() {
var editbox = $(this).parent().parent().parent().parent(),
listitem = editbox.parent();
listitem.find('.edit').css('display', 'inline-block');
editbox.remove();
})
))
)).appendTo(this.parentNode);
})
)
.append(array[2] ? (new OO.ui.PopupButtonWidget({
icon: 'info',
framed: false,
label: 'More information',
invisibleLabel: true,
title: 'More information',
popup: {
$content: $('<p></p>').text(
'Added: ' +
date.getDate() +
' ' +
mw.config.get('wgMonthNames')[date.getMonth() + 1] +
', ' +
date.getFullYear() +
' at ' +
date.getHours() +
':' +
('' + date.getMinutes()).padStart(2, '0')
),
padded: true,
align: 'forwards'
}
})).$element
.addClass('userjs-todo-moreinfo')
.css({cursor: 'pointer', visibility: 'hidden', height: '1.3em', width: '1.3em', minWidth: 'unset', minHeight: 'unset', marginRight: '0.5em'})
.addClass('act') : ''
)
.on('dragover', function(e) {
e.preventDefault();
e.dataTransfer = e.originalEvent.dataTransfer;
if (e.offsetY < ($(this).height()/2)) {
this.setAttribute('data-drop', 'above');
} else {
this.setAttribute('data-drop', 'below');
}
})
.on('dragleave', function() {
this.setAttribute('data-drop', '');
})
.on('drop', function(e) {
e.dataTransfer = e.originalEvent.dataTransfer;
this.setAttribute('data-drop', '');
var ele = $('[data-dragid="' + e.dataTransfer.getData('text/plain') + '"]')[0];
if (e.offsetY < ($(this).height()/2)) {
this.insertAdjacentElement('beforebegin', ele);
} else {
this.insertAdjacentElement('afterend', ele);
}
var arr = [];
$(this).parent().children().each(function() {
arr.push([$(this).attr('data-page'), $(this).attr('data-info'), $(this).attr('data-date') || '']);
});
save(arr);
})
.on('dragstart', function(e) {
e.dataTransfer = e.originalEvent.dataTransfer;
var uid = ('' + Math.random()).replace('.', '');
$(this).attr('data-dragid', uid);
e.dataTransfer.setData('text/plain', uid);
})
);
}
function list() {
$('.userjs-todo-list').remove();
var todo = parent.append($('<div class="userjs-todo-list" style="overflow:auto;"></div>')
.append($('<div style="padding:0.5em;" class="todo-menu"></div>')
.append(new OO.ui.ButtonWidget({
framed: false,
icon: 'undo',
invisibleLabel: true,
title: 'Undo'
}).$element.click(function() {
if (changes[changes.length-undo-2] !== undefined) {
save(changes[changes.length-undo-2], false, true);
undo++;
}
}))
.append(new OO.ui.ButtonWidget({
framed: false,
icon: 'redo',
invisibleLabel: true,
title: 'Redo'
}).$element.click(function() {
if (changes[changes.length-undo] !== undefined) {
save(changes[changes.length-undo], false, true);
undo--;
}
}))
.append(new OO.ui.ButtonWidget({
framed: false,
icon: 'trash',
invisibleLabel: true,
title: 'Clear'
}).$element.click(function() {
OO.ui.confirm('Are you sure you want to clear your todo list?').done(function(confirmed) {
if (confirmed) {
parent.find('.items').empty();
save('', true, true);
}
});
}))
.append(new OO.ui.ButtonWidget({
framed: false,
icon: 'download',
invisibleLabel: true,
title: 'Download'
}).$element.click(function() {
$($('<a download="todo.json" style="display:none;"></a>')
.attr('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(mw.user.options.get('userjs-todo-script')))
.appendTo(document.body)[0].click()
).remove();
}))
.append(new OO.ui.ButtonWidget({
framed: false,
icon: 'upload',
invisibleLabel: true,
title: 'Upload'
}).$element.click(function() {
loader.click();
}))
.append(new OO.ui.ButtonWidget({
framed: false,
icon: 'info',
invisibleLabel: true,
title: 'Help'
}).$element.click(function() {
window.open('https://en.wikipedia.org/wiki/User:BrandonXLF/TodoList/Help');
}))
)
.append($('<div style="padding:0 0.5em 0.5em;"></div>')
.append((new OO.ui.TextInputWidget({
placeholder: 'Page name or URL',
value: mw.config.get('wgPageName').replace(/_/g, ' ') != 'Special:BlankPage/todo' ? mw.config.get('wgPageName').replace(/_/g, ' ') : ''
})).$element.css({maxWidth: 'unset', margin: '4px 0'}))
.append((new OO.ui.TextInputWidget({
placeholder: 'Comment'
})).$element.css({maxWidth: 'unset', margin: '4px 0'}))
.append((new OO.ui.ButtonWidget({
label: 'Add'
}).$element.css('width', '100%').children().css('width', '100%').parent()).click(function() {
var opts = JSON.parse(mw.user.options.get('userjs-todo-script') || '[]'),
arr = [];
arr.push($(this).parent().parent().find('input[placeholder="Page name or URL"]').val());
arr.push($(this).parent().parent().find('input[placeholder="Comment"]').val());
if (!arr.join('')) return;
arr.push((new Date()).getTime());
item($('.userjs-todo-list .items'), arr);
opts.push(arr);
save(opts);
$('#userjs-todo-popup').css({top: Math.max(parseInt($('#userjs-todo-popup').css('top')), 0)});
}))
)
.append($('<div class="items" style="margin:0.5em;padding-top:0.5em;border-top:1px solid #a2a9b1;"></div>'))
.append('<div class="status" style="padding:0 0.5em 0.5em;"></div>')
);
if (ispopup) {
todo.find('.todo-menu')
.css('cursor', 'grab')
.append((new OO.ui.ButtonWidget({
framed: false,
icon: 'close',
invisibleLabel: true,
title: 'Close'
}).$element.css({float: 'right', marginRight: '0'}).click(function() {
parent.remove();
})))
.append(($('<a></a>').attr('href', mw.util.getUrl('Special:BlankPage/todo')).append((new OO.ui.ButtonWidget({
framed: false,
icon: 'newWindow',
invisibleLabel: true,
title: 'Your Todo List'
}).$element.css('float', 'right').click(function() {
location.url = mw.util.getUrl('Special:BlankPage/todo');
})))))
.on('mousedown', function(e) {
if (e.target !== this) return;
this.style.cursor = 'grabbing';
var x = parent.position().left - e.pageX,
y = parent.position().top - e.pageY,
b = $(document.body);
function move(e) {
parent.css({
left: Math.clamp($(window).width() - parent.width(), e.pageX + x, 0) + 'px',
top: Math.clamp($(window).height() - parent.height(), e.pageY + y, 0) + 'px',
right: '',
bottom: ''
});
}
function up() {
e.target.style.cursor = 'grab';
b.off('mousemove', move);
b.off('mouseup', up);
}
b.on('mousemove', move);
b.on('mouseup', up);
});
}
$.each(JSON.parse(mw.user.options.get('userjs-todo-script') || '[]'), function(a, b) {
item(todo.find('.items'), b);
});
return todo;
}
function repos(pos, css, pvar, cond, pcss, ccss) {
return $('<div style="pointer-events:all;position:absolute;"></div>').attr('id', pos + 'gfdgfdgfd').css('cursor', pos + '-resize').css(css).on('mousedown', function(e) {
if (e.target !== this) return;
var p = parent,
c = p.find('.userjs-todo-list'),
q = eval(pvar),
b = $(document.body);
b.css('user-select', 'none');
function move(e) {
if (eval(cond)) return;
(new Function('e', 'p', 'q', 'p.css(' + pcss + ')'))(e, p, q);
(new Function('e', 'c', 'q', 'c.css(' + ccss + ')'))(e, c, q);
}
function up() {
b.css('user-select', '');
b.off('mousemove', move);
b.off('mouseup', up);
}
b.on('mousemove', move);
b.on('mouseup', up);
});
}
if (mw.config.get('wgPageName') === 'Special:BlankPage/todo') {
document.title = 'Your Todo List - ' + mw.config.get('wgSiteName');
$('#firstHeading').text('Your Todo List');
parent = mw.util.$content.empty();
list();
link.children().first().click(function(e) {
e.preventDefault();
mw.notify('Unable to open todo list popup while on the todo list page.', {tag: 'rtbyilounmt7udfnod'});
});
} else {
link.children().first().click(function(e) {
e.preventDefault();
if ($('#userjs-todo-popup')[0]) {
$('#userjs-todo-popup').remove();
return;
}
ispopup = true;
parent = $('<div style="overflow:auto;min-height:3em;z-index:' + (mw.config.get('skin') === 'minerva' ? '3' : '4') + ';box-shadow:0 2px 2px 0 rgba(0,0,0,0.25);color:#222;min-width:20em;position:fixed;right:1em;background-color:white;border-radius:4px;border: 1px solid #a2a9b1;font-size:0.75rem;max-width:100vw;max-height:100vh;" id="userjs-todo-popup"></div>')
.appendTo(document.body)
.css('top', link.position().top + link.height() + 8 + 'px')
.append($('<div style="pointer-events:none;position:absolute;top:0;left:0;bottom:0;right:0;"></div>')
.append(repos('e', {top: 0, right: 0, width: '7px', height: '100%'}, 'p.position().left', 'e.clientX - q < 40', '{right:"",minWidth:"",left:q + "px"}', '{width:e.clientX - q + "px"}'))
.append(repos('n', {top: 0, height: '7px', width: '100%'}, 'p.position().top + p.height()', 'q <= e.clientY + 40', '{top:Math.max(e.clientY, 0) + "px"}', '{height:q - e.clientY + "px"}'))
.append(repos('s', {bottom: 0, height: '7px', width: '100%'}, 'p.position().top', 'e.clientY - q < 40', '{top:Math.max(q,0) + "px"}', '{height:e.clientY - q + "px"}'))
.append(repos('w', {left: 0, width: '7px', height: '100%'}, 'p.position().left + parent.width()', 'q <= e.clientX + 40', '{right:"",minWidth:"",left:e.clientX + "px"}', '{width:q - e.clientX + "px"}'))
.append($('<div style="pointer-events:all;position:absolute;height:100%;top:0;right:0;width:7px;height:7px;cursor:ne-resize;"></div>').on('mousedown', function(e) {
e.originalEvent.stopImmediatePropagation();
$('#egfdgfdgfd').trigger('mousedown');
$('#ngfdgfdgfd').trigger('mousedown');
}))
.append($('<div style="pointer-events:all;position:absolute;height:100%;top:0;left:0;width:7px;height:7px;cursor:nw-resize;"></div>').on('mousedown', function(e) {
e.originalEvent.stopImmediatePropagation();
$('#wgfdgfdgfd').trigger('mousedown');
$('#ngfdgfdgfd').trigger('mousedown');
}))
.append($('<div style="pointer-events:all;position:absolute;height:100%;bottom:0;right:0;width:7px;height:7px;cursor:se-resize;"></div>').on('mousedown', function(e) {
e.originalEvent.stopImmediatePropagation();
$('#egfdgfdgfd').trigger('mousedown');
$('#sgfdgfdgfd').trigger('mousedown');
}))
.append($('<div style="pointer-events:all;position:absolute;height:100%;bottom:0;left:0;width:7px;height:7px;cursor:sw-resize;"></div>').on('mousedown', function(e) {
e.originalEvent.stopImmediatePropagation();
$('#wgfdgfdgfd').trigger('mousedown');
$('#sgfdgfdgfd').trigger('mousedown');
}))
);
parent.css('top', Math.max(parseInt(parent.css('top')), 0));
list();
});
}
});
///////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
// Dans n'importe quel historique, transforme le bouton « Comparer les versions sélectionnées » en hyperlien (on peut donc charger n'importe quel diff dans un autre onglet :-)
// Copie de https://en.wikipedia.org/w/index.php?title=User:Mattflaschen/Compare_link.js
// 2020-01-05
/**
* Convert the "Compare selected versions" button to a link
* (Based on [[w:en:User:Superm401/Compare_link.js]])
* @source: http://www.mediawiki.org/wiki/Snippets/Compare_link
* @rev: 2
* @see: [[bugzilla:16165]]
*
* Copyright 2006-2013 Matthew Flaschen ([[User:Superm401]]), [[User:Helder.wiki]]
*
* In addition to the GFDL and CC-BY-SA:
*
* This function (compare link) is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This function is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* A copy of the GPL is available at https://www.gnu.org/licenses/gpl-2.0.txt .
*
* By modifying [[Snippets/Compare_link]]:
* You agree to dual-license your contributions under both the
* GFDL (http://en.wikipedia.org/wiki/WP:GFDL) and version 2 of the GPL
* (https://www.gnu.org/licenses/gpl-2.0.txt) or any later version
* of the GPL published by the FSF.
*
*/
function fixCompare() {
var $histForm = $('#mw-history-compare'),
$diffList = $('#pagehistory'),
$buttons = $histForm.find('input.historysubmit'),
buttonText, $compareLink;
if ( $buttons.length === 0 ) {
// Only one version, so do nothing
return;
}
buttonText = $buttons
.remove()
.first().val();
$compareLink = $('<a></a>', {
'class': 'compare-link',
'text': buttonText
});
$histForm
.prepend($compareLink)
.append($compareLink.clone());
var updateCompare = function(){
var $radio = $histForm.find('input[type=radio]:checked'),
genLink = mw.config.get('wgScript')
+ '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) )
+ '&diff=' + $radio.eq(0).val()
+ '&oldid=' + $radio.eq(1).val();
$('.compare-link').each(function() {
$(this).attr('href', genLink);
});
};
updateCompare();
$diffList.change(updateCompare);
}
if ( mw.config.get('wgAction') === 'history' ) {
mw.util.addCSS( '.compare-link { border-radius:5px; color:black; text-decoration:none; border-width:1px 2px 2px 1px; border-style:solid; border-color:#DDDDDD #BBBBBB #BBBBBB #DDDDDD; padding:0.2em 1em; background-color:#EEEEEE; white-space:nowrap; } .compare-link:active{ border-width:0.1em; margin:0.1em; }' );
$(fixCompare);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Barre de navigation
//
// Pour créer votre barre, consultez
// https://fr.wikipedia.org/wiki/Modèle:Barre_de_navigation
//
// (Concept de Cantons-de-l'Est inspiré d'un outil du contributeur Lepsyleon.)
//////////////////////////////////////////////////////////////////////////////
var BoutonsNavigation3 = function ($) {
var Today = function() {
var m = ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"];
var today = new Date();
var day = today.getDate();
var month = m[today.getMonth()];
var year = today.getYear();
if (year<2000) year = year + 1900;
return (day + "_" + month + "_" + year);
};
var MonthYear = function() {
var m = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"];
var today = new Date();
var month = m[today.getMonth()];
var year = today.getYear();
if (year<2000) year = year + 1900;
return (month + "_" + year);
};
var CurrentYear = function() {
var today = new Date();
var year = today.getYear();
if (year<2000) year = year + 1900;
return year;
};
var Semaine = function() {
var semaine = new Date();
var jour = semaine.getDate();
var mois = semaine.getMonth();
var annee = semaine.getFullYear();
var ListeMois = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if (annee %4 === 0 && annee %100 !==0 || annee %400 === 0) {ListeMois[1]=29;}
var TotalJour=0;
for(var cpt=0; cpt<mois; cpt++){TotalJour+=ListeMois[cpt];}
TotalJour+=jour;
var DebutAn = new Date(annee,0,1);
var JourDebutAn=DebutAn.getDay();
if(JourDebutAn===0){JourDebutAn=7;}
TotalJour-=8-JourDebutAn;
var NumSemaine = 1;
NumSemaine+=Math.floor(TotalJour/7);
if(TotalJour%7!==0){NumSemaine+=1;}
return("semaine_" + NumSemaine + "_" + annee);
};
var Mois = function() {
var m = ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"];
var today = new Date();
var month = m[today.getMonth()];
var year = today.getYear();
if (year<2000) year = year + 1900;
return (month + "_" + year);
};
var _DivRight = document.createElement('div');
_DivRight.className = "noprint";
_DivRight.setAttribute("style", "position:fixed; display:block; width:20px; margin:0; padding:0; top:20%; right:4px; background-color:#FFF; z-index:3;");
var _HtmlRight = '<ul style="list-style:none; margin:0; padding:0;" class="noprint">';
// Haut de la page
_HtmlRight += ' '
+ ' <li style="border:1px solid #A7D7F9; margin-bottom:3px; background-color:#F6F6F6;">'
+ ' <a title="Haut de la page" href="#" >'
+ ' <img src="//upload.wikimedia.org/wikipedia/commons/f/fc/2uparrow.png" height=20 width=20 border=0 />'
+ ' </a>'
+ ' </li>';
// Bulletin des administrateurs
_HtmlRight += ' '
+ ' <li style="border:1px solid #A7D7F9; margin-bottom:3px; background-color:#F6F6F6;">'
+ ' <a title="Bulletin des administrateurs" href="//fr.wikipedia.org/wiki/Wikipédia:Bulletin_des_administrateurs" >'
+ ' <img src="//upload.wikimedia.org/wikipedia/commons/a/a3/Nuvola_apps_klipper.png" height=20 width=20 border=0 />'
+ ' </a>'
+ ' </li>';
// Autobiographie
_HtmlRight += ''
+ ' <li style="border:1px solid #A7D7F9; margin-bottom:3px; background-color:#F6F6F6;">'
+ ' <a title="Autobiographie" href="//fr.wikisource.org/wiki/Utilisateur:Cantons-de-l\'Est/Autobiographie_(' + CurrentYear() + ')#' + MonthYear() + '">'
+ ' <img src="//upload.wikimedia.org/wikipedia/commons/2/26/Noia_64_apps_wp.png" style="height:20px; border:0;" />'
+ ' </a>'
+ ' </li>';
// Biens patrimoniaux du RPCQ sans photo
_HtmlRight += ''
+ ' <li style="border:1px solid #A7D7F9; margin-bottom:3px; background-color:#F6F6F6;">'
+ ' <a title="Carte RPCQ" href="https://w.wiki/F6o">'
+ ' <img src="//upload.wikimedia.org/wikipedia/commons/5/5f/Flag_of_Quebec.svg" style="width:20px; border:0;" />'
+ ' </a>'
+ ' </li>';
// Biens du Heritage Places of Ontario sans photo
_HtmlRight += ''
+ ' <li style="border:1px solid #A7D7F9; margin-bottom:3px; background-color:#F6F6F6;">'
+ ' <a title="Carte HPO" href="https://w.wiki/UyX">'
+ ' <img src="//upload.wikimedia.org/wikipedia/commons/8/88/Flag_of_Ontario.svg" style="width:20px; border:0;" />'
+ ' </a>'
+ ' </li>';
// Biens du Heritage Places of Canada sans photo
_HtmlRight += ''
+ ' <li style="border:1px solid #A7D7F9; margin-bottom:3px; background-color:#F6F6F6;">'
+ ' <a title="Carte HPC" href="https://w.wiki/Jqs">'
+ ' <img src="//upload.wikimedia.org/wikipedia/commons/d/d9/Flag_of_Canada_%28Pantone%29.svg" style="width:20px; border:0;" />'
+ ' </a>'
+ ' </li>';
// Bas de la page
_HtmlRight += ' '
+ ' <li style="border:1px solid #A7D7F9; margin-bottom:3px; background-color:#F6F6F6;">'
+ ' <a title="Bas de la page" href="#footer" >'
+ ' <img src="//upload.wikimedia.org/wikipedia/commons/6/68/2downarrow.png" height=20 width=20 border=0 />'
+ ' </a>'
+ ' </li>';
_HtmlRight += '</ul>';
_DivRight.innerHTML = _HtmlRight;
document.body.insertBefore(_DivRight, document.body.firstChild);
};
$(document).ready(BoutonsNavigation3);
// Voir https://fr.wikisource.org/wiki/Wikisource:Scriptorium/Septembre_2023#Wikidata_et_Wikisource
//mw.loader.load('//fr.wikisource.org/w/index.php?title=User:Seudo/wikidatafy.js&action=raw&ctype=text/javascript');