« MediaWiki:Wikimini.js » : différence entre les versions
Jump to navigation
Jump to search
(- fonctions obsolètes ; mise en place Menu d'options de développement pour moi (pour l'instant)) |
Aucun résumé des modifications |
||
| (8 versions intermédiaires par 3 utilisateurs non affichées) | |||
| Ligne 73 : | Ligne 73 : | ||
// ============================================================ |
// ============================================================ |
||
if(wgNamespaceNumber==6){ //////////// ESPACE DE NOMS "FICHIER" ////////////// |
|||
| ⚫ | |||
// Dans la page de description d'une image, ajoute un texte d'aide pour insérer une image |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
var SectionHistory = document.getElementById('filehistory'); |
|||
| ⚫ | |||
if(!SectionHistory) return; |
|||
| ⚫ | |||
mw.loader.load( '/w/index.php?title=MediaWiki:Bot/PagesSansImage.js&action=raw&ctype=text/javascript' ); |
|||
var MessageAide = document.createElement('div'); |
|||
MessageAide.className="fck_mw_template"; |
|||
MessageAide.innerHTML = '<table cellspacing="10" cellpadding="1" width="100%" align="center" style="background-color: #F7F7F7; border: solid 1px #DDDDDD;">' |
|||
+'<tr>' |
|||
+'<td valign="top" width="45" > <img height="44" border="0" width="30" src="http://stock.wikimini.org/w/images/e/e9/Bg-pin.gif" alt=""/>' |
|||
+'</td>' |
|||
+'<td style="text-align:justify;" > Pour insérer cette image dans un article, clique sur l\'icône <img height="21" border="0" width="21" src="http://stock.wikimini.org/w/images/e/e7/Fckeditor-Image.gif" alt="Image:Fckeditor-Image.gif"/> de la barre d\'outils et cherche l\'image nommée <b>\« ' + wgTitle + ' \»</b>.' |
|||
+'</td>' |
|||
+'</table>'; |
|||
SectionHistory.parentNode.insertBefore(MessageAide, SectionHistory); |
|||
| ⚫ | |||
} //////////// FIN DE L'ESPACE DE NOMS "FICHIER" ////////////// |
|||
// ============================================================ |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
} |
} |
||
} |
} |
||
| Ligne 108 : | Ligne 88 : | ||
// ============================================================================ |
// ============================================================================ |
||
///////////////////////////////// Évite le double-post dans les pages de discussion LQT |
///////////////////////////////// Évite le double-post dans les pages de discussion LQT |
||
addOnloadHook( function(){ |
//addOnloadHook( function(){ |
||
| ⚫ | |||
var wpSave = document.getElementById('wpSave'); |
var wpSave = document.getElementById('wpSave'); |
||
var wpForm = document.getElementById('editform'); |
var wpForm = document.getElementById('editform'); |
||
| Ligne 118 : | Ligne 99 : | ||
} |
} |
||
});/////////////////////////////// |
});/////////////////////////////// |
||
// =========================================================================== |
|||
///////////////////////////////// Menu options ergonomiques |
|||
if(wgUserName && wgUserName == "Dr Brains"){ |
|||
importScript('MediaWiki:MenuOptions_Dev.js'); |
|||
}else{ |
|||
importScript('MediaWiki:MenuOptions.js'); |
|||
} |
|||
// =========================================================================== |
// =========================================================================== |
||
///////////////////////////////// Fonctions Javascript liées à des modèles |
///////////////////////////////// Fonctions Javascript liées à des modèles |
||
importScript('MediaWiki:Modeles.js'); |
//importScript('MediaWiki:Modeles.js'); |
||
mw.loader.load( '/w/index.php?title=MediaWiki:Modeles.js&action=raw&ctype=text/javascript' ); |
|||
// =========================================================================== |
// =========================================================================== |
||
///////////////////////////////// Feuille de style Wikimini |
///////////////////////////////// Feuille de style Wikimini |
||
importStylesheet('MediaWiki:Wikimini.css'); |
//importStylesheet('MediaWiki:Wikimini.css'); |
||
mw.loader.load( '/w/index.php?title=MediaWiki:Wikimini.css&action=raw&ctype=text/css', 'text/css' ); |
|||
// =========================================================================== |
// =========================================================================== |
||
///////////////////////////////// Patch forum, en attendant solution PHP |
///////////////////////////////// Patch forum, en attendant solution PHP |
||
addOnloadHook(AWCForum_Patch); |
//addOnloadHook(AWCForum_Patch); |
||
jQuery( function( ) { |
|||
AWCForum_Patch(); |
|||
| ⚫ | |||
function AWCForum_Patch(){ |
function AWCForum_Patch(){ |
||
| Ligne 387 : | Ligne 364 : | ||
// =========================================================================== |
// =========================================================================== |
||
// =========================================================================== |
|||
///////////////////////////////// Ajout boutons "Tout cocher", "Tout décocher" et "Inverser" dans [[Special:Search]] |
|||
if(wgCanonicalSpecialPageName=="Search") addOnloadHook(SearchDeluxe); |
|||
function SearchDeluxe(){ |
|||
var Form = document.getElementById("powersearch"); |
|||
if(!Form) return; |
|||
var P = Form.getElementsByTagName('p')[0]; |
|||
if(!P) return; |
|||
var NewP = document.createElement('p'); |
|||
var NewOption = document.createElement('span'); |
|||
NewOption.setAttribute('style', 'margin-left:1em;margin-bottom:0.5em;'); |
|||
var Content = '<input type="button" onclick="SearchDeluxe_Toggle(1);" onselect="SearchDeluxe_Toggle(1);" title="Tout cocher" value="Tout cocher" />' |
|||
+ ' ' |
|||
+ '<input type="button" onclick="SearchDeluxe_Toggle(0);" onselect="SearchDeluxe_Toggle(0);" title="Tout décocher" value="Tout décocher" />' |
|||
+ ' ' |
|||
+ '<input type="button" onclick="SearchDeluxe_Toggle(-1);" onselect="SearchDeluxe_Toggle(-1)" title="Inverser" value="Inverser" />'; |
|||
NewOption.innerHTML = Content; |
|||
NewP.appendChild(NewOption); |
|||
P.parentNode.insertBefore(NewP, P.nextSibling); |
|||
} |
|||
function SearchDeluxe_Toggle(Mode){ |
|||
var Form = document.getElementById("powersearch"); |
|||
if(!Form) return; |
|||
var Inputs = Form.getElementsByTagName('input'); |
|||
for(var a=0;a<Inputs.length;a++){ |
|||
if(Inputs[a].type!="checkbox") continue; |
|||
if(Mode==1){ |
|||
Inputs[a].checked = "checked"; |
|||
}else if(Mode==0){ |
|||
Inputs[a].checked = false; |
|||
}else{ |
|||
if(Inputs[a].checked){ |
|||
Inputs[a].checked = false; |
|||
}else{ |
|||
Inputs[a].checked = "checked"; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
// =========================================================================== |
|||
///////////////////////////////// Affichage alerte pour vrais liens externes |
///////////////////////////////// Affichage alerte pour vrais liens externes |
||
addOnloadHook(function(){ |
//addOnloadHook(function(){ |
||
jQuery( function( ) { |
|||
var Links = document.getElementsByTagName("a"); |
var Links = document.getElementsByTagName("a"); |
||
for(var a=0,l=Links.length;a<l;a++){ |
for(var a=0,l=Links.length;a<l;a++){ |
||
Dernière version du 22 février 2017 à 10:28
// ============================================================
/* tooltips and access keys */
ta = new Object();
ta['pt-userpage'] = new Array('.','Ta page personnelle où tu peux te présenter');
ta['pt-anonuserpage'] = new Array('.','La page utilisateur pour l’adresse IP que tu utilises');
ta['pt-mytalk'] = new Array('n','Ta page de discussion personnelle');
ta['pt-anontalk'] = new Array('n','La page de discussion de cette adresse IP');
ta['pt-preferences'] = new Array('','Tes préférences');
ta['pt-watchlist'] = new Array('l','La liste des pages que tu suis ou "surveilles"');
ta['pt-mycontris'] = new Array('y','La liste de tes contributions');
ta['pt-login'] = new Array('o','Tu dois te connecter pour participer à Wikimini');
ta['pt-anonlogin'] = new Array('o','Tu dois te connecter pour participer à Wikimini');
ta['pt-logout'] = new Array('o','Se déconnecter');
ta['ca-talk'] = new Array('t','Discussions sur cette page');
ta['ca-edit'] = new Array('e','Tu peux modifier cette page. Merci de prévisualiser avant de publier');
ta['ca-addsection'] = new Array('+','Ajoute un commentaire à cette discussion');
ta['ca-viewsource'] = new Array('e','Cette page est protégée. Tu peux voir son code source.');
ta['ca-history'] = new Array('h','Version précédentes de cette page');
ta['ca-protect'] = new Array('=','Protège cette page');
ta['ca-delete'] = new Array('d','Supprime cette page');
ta['ca-undelete'] = new Array('d','Restaure les modifications faites à cette page avant sa suppression');
ta['ca-move'] = new Array('m','Déplace cette page');
ta['ca-watch'] = new Array('w','Ajoute cette page à la liste des pages que tu surveilles');
ta['ca-unwatch'] = new Array('w','Retire cette page de la liste des articles que tu surveilles');
ta['search'] = new Array('f','Cherche un article dans Wikimini');
ta['p-logo'] = new Array('','Page principale');
ta['n-mainpage'] = new Array('z','Retourne à la page principale');
ta['n-portal'] = new Array('','À propos du projet, ce que tu peux faire, où trouver des renseignements');
ta['n-currentevents'] = new Array('','Trouve des informations sur les événements récents');
ta['n-recentchanges'] = new Array('r','La liste des dernières modifications effectuées sur Wikimini.');
ta['n-randompage'] = new Array('x','Visite une page de Wikimini au hasard');
ta['n-help'] = new Array('','Aide');
ta['n-sitesupport'] = new Array('','Aidez-nous');
ta['t-whatlinkshere'] = new Array('j','Liste des pages qui ont un lien pointant vers celle-ci');
ta['t-recentchangeslinked'] = new Array('k','Liste des modifications récentes sur les pages liées à celle-ci');
ta['feed-rss'] = new Array('','Flux RSS de cette page');
ta['feed-atom'] = new Array('','Flux Atom de cette page');
ta['t-contributions'] = new Array('','Regarde la liste des contributions de ce Wikiminaute');
ta['t-emailuser'] = new Array('','Envoie un courriel (e-mail) à ce Wikiminaute');
ta['t-upload'] = new Array('u','Ajoute une image dans le stock de Wikimini');
ta['t-specialpages'] = new Array('q','Liste des pages spéciales de Wikimini');
ta['ca-nstab-main'] = new Array('c','Affiche le contenu de cette page');
ta['ca-nstab-user'] = new Array('c','Affiche la page personnelle de ce Wikiminaute');
ta['ca-nstab-media'] = new Array('c','Affiche la page média');
ta['ca-nstab-special'] = new Array('','Tu es sur une page spéciale. Tu ne peux pas la modifier.');
ta['ca-nstab-wp'] = new Array('a','Affiche la page du projet');
ta['ca-nstab-image'] = new Array('c','Affiche la page de l’image');
ta['ca-nstab-mediawiki'] = new Array('c','Affiche le message système');
ta['ca-nstab-template'] = new Array('c','Affiche le modèle');
ta['ca-nstab-help'] = new Array('c','Affiche la page d’aide');
ta['ca-nstab-category'] = new Array('c','Affiche la page de catégorie');
// ============================================================
// BEGIN Enable multiple onload functions
// setup onload functions this way:
// aOnloadFunctions[aOnloadFunctions.length] = function_name; // without brackets!
if (!window.aOnloadFunctions) {
var aOnloadFunctions = new Array();
}
window.onload = function() {
if (window.aOnloadFunctions) {
for (var _i=0; _i<aOnloadFunctions.length; _i++) {
aOnloadFunctions[_i]();
}
}
}
// END Enable multiple onload functions
// ============================================================
// ============================================================
// =============================================== BOT : recherche de page sans images
if(mw.config.get('wgUserGroups')!=null){
if(mw.config.get('wgUserGroups').indexOf('sysop')!=-1){
if(mw.config.get('wgPageName')=="Wikimini:Pages_à_illustrer"){
//importScript('MediaWiki:Bot/PagesSansImage.js');
mw.loader.load( '/w/index.php?title=MediaWiki:Bot/PagesSansImage.js&action=raw&ctype=text/javascript' );
}
}
}
// ===============================================
// ============================================================================
///////////////////////////////// Évite le double-post dans les pages de discussion LQT
//addOnloadHook( function(){
jQuery( function( ) {
var wpSave = document.getElementById('wpSave');
var wpForm = document.getElementById('editform');
if((wpSave)&&(wpForm)){
wpSave.onclick = function(){
document.getElementById('editform').submit();
document.getElementById('wpSave').disabled = "disabled";
}
}
});///////////////////////////////
// ===========================================================================
///////////////////////////////// Fonctions Javascript liées à des modèles
//importScript('MediaWiki:Modeles.js');
mw.loader.load( '/w/index.php?title=MediaWiki:Modeles.js&action=raw&ctype=text/javascript' );
// ===========================================================================
///////////////////////////////// Feuille de style Wikimini
//importStylesheet('MediaWiki:Wikimini.css');
mw.loader.load( '/w/index.php?title=MediaWiki:Wikimini.css&action=raw&ctype=text/css', 'text/css' );
// ===========================================================================
///////////////////////////////// Patch forum, en attendant solution PHP
//addOnloadHook(AWCForum_Patch);
jQuery( function( ) {
AWCForum_Patch();
});
function AWCForum_Patch(){
var AllDivs = document.getElementsByTagName('div');
var Count = 0
for(var a=0;a<AllDivs.length;a++){
var ID = AllDivs[a].id;
if(ID){
if(ID == "cat_list_lastaction_title"){
Count++
var Link = AllDivs[a].getElementsByTagName('a')[0];
var Target = DecodeHTMLEntities(decodeURIComponent(Link.href));
Link.href = Target;
var Text = Target.replace(/.*id[^\/]+\//, "").replace(/\.html/, "");
Link.title = Text;
var CuttedText = Text.substring(0, 20);
if(Text!=CuttedText) CuttedText += "...";
Link.innerHTML = CuttedText;
}
}
}
//alert(Count);
}
function DecodeHTMLEntities(text){
var EncodedCharacter = new Array();
var DecodedCharacter = new Array();
var CharacterCount = 0;
EncodedCharacter[CharacterCount] = "&";
DecodedCharacter[CharacterCount] = "&";
CharacterCount++;
EncodedCharacter[CharacterCount] = "'";
DecodedCharacter[CharacterCount] = "'";
CharacterCount++;
EncodedCharacter[CharacterCount] = """;
DecodedCharacter[CharacterCount] = '"';
CharacterCount++;
EncodedCharacter[CharacterCount] = "«";
DecodedCharacter[CharacterCount] = '«';
CharacterCount++;
EncodedCharacter[CharacterCount] = "»";
DecodedCharacter[CharacterCount] = '»';
CharacterCount++;
EncodedCharacter[CharacterCount] = "’";
DecodedCharacter[CharacterCount] = '’';
CharacterCount++;
EncodedCharacter[CharacterCount] = "…";
DecodedCharacter[CharacterCount] = '…';
CharacterCount++;
EncodedCharacter[CharacterCount] = "—";
DecodedCharacter[CharacterCount] = '—';
CharacterCount++;
EncodedCharacter[CharacterCount] = "–";
DecodedCharacter[CharacterCount] = '–';
CharacterCount++;
EncodedCharacter[CharacterCount] = "•";
DecodedCharacter[CharacterCount] = '•';
CharacterCount++;
EncodedCharacter[CharacterCount] = " ";
DecodedCharacter[CharacterCount] = ' ';
CharacterCount++;
EncodedCharacter[CharacterCount] = "À";
DecodedCharacter[CharacterCount] = 'À';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Á";
DecodedCharacter[CharacterCount] = 'Á';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Â";
DecodedCharacter[CharacterCount] = 'Â';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ã";
DecodedCharacter[CharacterCount] = 'Ã';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ä";
DecodedCharacter[CharacterCount] = 'Ä';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Å";
DecodedCharacter[CharacterCount] = 'Å';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Æ";
DecodedCharacter[CharacterCount] = 'Æ';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ç";
DecodedCharacter[CharacterCount] = 'Ç';
CharacterCount++;
EncodedCharacter[CharacterCount] = "È";
DecodedCharacter[CharacterCount] = 'È';
CharacterCount++;
EncodedCharacter[CharacterCount] = "É";
DecodedCharacter[CharacterCount] = 'É';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ê";
DecodedCharacter[CharacterCount] = 'Ê';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ë";
DecodedCharacter[CharacterCount] = 'Ë';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ì";
DecodedCharacter[CharacterCount] = 'Ì';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Í";
DecodedCharacter[CharacterCount] = 'Í';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Î";
DecodedCharacter[CharacterCount] = 'Î';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ï";
DecodedCharacter[CharacterCount] = 'Ï';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ñ";
DecodedCharacter[CharacterCount] = 'Ñ';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ò";
DecodedCharacter[CharacterCount] = 'Ò';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ó";
DecodedCharacter[CharacterCount] = 'Ó';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ô";
DecodedCharacter[CharacterCount] = 'Ô';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Õ";
DecodedCharacter[CharacterCount] = 'Õ';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Œ";
DecodedCharacter[CharacterCount] = 'Œ';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ö";
DecodedCharacter[CharacterCount] = 'Ö';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ø";
DecodedCharacter[CharacterCount] = 'Ø';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ù";
DecodedCharacter[CharacterCount] = 'Ù';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ú";
DecodedCharacter[CharacterCount] = 'Ú';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Û";
DecodedCharacter[CharacterCount] = 'Û';
CharacterCount++;
EncodedCharacter[CharacterCount] = "Ü";
DecodedCharacter[CharacterCount] = 'Ü';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ß";
DecodedCharacter[CharacterCount] = 'ß';
CharacterCount++;
EncodedCharacter[CharacterCount] = "à";
DecodedCharacter[CharacterCount] = 'à';
CharacterCount++;
EncodedCharacter[CharacterCount] = "á";
DecodedCharacter[CharacterCount] = 'á';
CharacterCount++;
EncodedCharacter[CharacterCount] = "â";
DecodedCharacter[CharacterCount] = 'â';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ã";
DecodedCharacter[CharacterCount] = 'ã';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ä";
DecodedCharacter[CharacterCount] = 'ä';
CharacterCount++;
EncodedCharacter[CharacterCount] = "å";
DecodedCharacter[CharacterCount] = 'å';
CharacterCount++;
EncodedCharacter[CharacterCount] = "æ";
DecodedCharacter[CharacterCount] = 'æ';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ç";
DecodedCharacter[CharacterCount] = 'ç';
CharacterCount++;
EncodedCharacter[CharacterCount] = "è";
DecodedCharacter[CharacterCount] = 'è';
CharacterCount++;
EncodedCharacter[CharacterCount] = "é";
DecodedCharacter[CharacterCount] = "é";
CharacterCount++;
EncodedCharacter[CharacterCount] = "ê";
DecodedCharacter[CharacterCount] = 'ê';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ë";
DecodedCharacter[CharacterCount] = 'ë';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ì";
DecodedCharacter[CharacterCount] = 'ì';
CharacterCount++;
EncodedCharacter[CharacterCount] = "í";
DecodedCharacter[CharacterCount] = 'í';
CharacterCount++;
EncodedCharacter[CharacterCount] = "î";
DecodedCharacter[CharacterCount] = 'î';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ï";
DecodedCharacter[CharacterCount] = 'ï';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ñ";
DecodedCharacter[CharacterCount] = 'ñ';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ò";
DecodedCharacter[CharacterCount] = 'ò';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ó";
DecodedCharacter[CharacterCount] = 'ó';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ô";
DecodedCharacter[CharacterCount] = 'ô';
CharacterCount++;
EncodedCharacter[CharacterCount] = "õ";
DecodedCharacter[CharacterCount] = 'õ';
CharacterCount++;
EncodedCharacter[CharacterCount] = "œ";
DecodedCharacter[CharacterCount] = 'œ';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ö";
DecodedCharacter[CharacterCount] = 'ö';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ø";
DecodedCharacter[CharacterCount] = 'ø';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ù";
DecodedCharacter[CharacterCount] = 'ù';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ú";
DecodedCharacter[CharacterCount] = 'ú';
CharacterCount++;
EncodedCharacter[CharacterCount] = "û";
DecodedCharacter[CharacterCount] = 'û';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ü";
DecodedCharacter[CharacterCount] = 'ü';
CharacterCount++;
EncodedCharacter[CharacterCount] = "ÿ";
DecodedCharacter[CharacterCount] = 'ÿ';
CharacterCount++;
for(var a=0;a<EncodedCharacter.length;a++){
while(text.indexOf(EncodedCharacter[a])!=-1){
text = text.split(EncodedCharacter[a]).join(DecodedCharacter[a]);
if(text.indexOf(EncodedCharacter[a])==-1) break;
}
}
return text;
}
// ===========================================================================
///////////////////////////////// Affichage alerte pour vrais liens externes
//addOnloadHook(function(){
jQuery( function( ) {
var Links = document.getElementsByTagName("a");
for(var a=0,l=Links.length;a<l;a++){
if(checkLink(Links[a])){
Links[a].onclick = function(){
var Confirm = confirm("Attention : Tu vas quitter le site Wikimini FR. Es-tu sûr(e) de vouloir continuer ?");
return Confirm;
}
}
}
function checkLink(obj){
var href = obj.href.toLowerCase();
var hostname = "wikimini.";
return ((href.indexOf("http://")!=-1 && href.indexOf(hostname)==-1) ? true : false);
}
});
Ce que tu peux faire
Outils

Outils personnels