Discussion utilisateur:Dr Brains/MenuActions.js
/*
![](http://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/Vampire_Smiley.png/50px-Vampire_Smiley.png)
![]() Moi | ![]() Bla-bla | ![]() Contributions | ![]() Travaux | ![]() Outils | ![]() Scripts | ![]() Bot | ![]() Administration | ![]() Bureaucratie | ![]() Divers |
|
![]() | |
MENU-ACTIONS
Fonction
[modifier le code]- Transforme les onglets en menu déroulants facilement personnalisables
Code original : [1]
Aperçu
[modifier le code]-
Menu de la page principale
-
Menu de la page de discussion
-
Menu actions
-
Menu pages spéciales
-
Menu recherche
-
Menu favoris
Installation
[modifier le code]Pour installer ce menu, ajoutez à votre monobook.js le code suivant :
importScript('Utilisateur:Dr Brains/MenuActions.js');
Personnalisation
[modifier le code]Pour ajouter un menu
[modifier le code]Ajoutez à votre monobook.js le code suivant :
window.nouveauMenuPerso = function(){
var Cactions = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; // Recherche des onglets
addlimenu(Cactions,'TEXTE','ID','URL','POSITION');
}
$(nouveauMenuPerso);
- avec
- TEXTE = texte de l'onglet ;
- ID = id du menu ;
- URL = adresse URL (optionnel) ;
- POSITION = place du menu (optionnel)
pour ajouter une entrée à un menu
[modifier le code]Ajoutez à votre monobook.js le code suivant :
window.nouveauLienPerso = function(){
addMenuActionsLink('ID', 'URL', 'TEXTE');
}
$(nouveauLienPerso);
- avec
- ID = id du menu ;
- URL = adresse URL de l'entrée ;
- TEXTE = texte de l'entrée
pour ajouter de nombreux menus/liens
[modifier le code]Créez une fonction telle que l'exemple ci-dessous
window.PersonaliseMenuActions = function(){
window.pCactions = document.getElementById('p-cactions');
if(!pCactions)return;
window.tabs = pCactions.getElementsByTagName('ul')[0];
window.caMain = pCactions.getElementsByTagName('li')[0];
//////////////////////////////////////////// PARTIE PERSONNALISABLE ////////////////////////////////////////
////////////////// * nouveaux menus * //////////////////
MenuActions_PlusMenus = new Array();
MenuActions_PlusMenusTEXTE = new Array();
MenuActions_PlusMenusURL = new Array();
MenuActions_PlusMenus[0] = "MenuPlus1"; // Id du menu
MenuActions_PlusMenusTEXTE[0] = "Menu Perso 1"; // Texte de l'onglet
MenuActions_PlusMenusURL[0] = ""; // Cible de l'onglet
MenuActions_PlusMenus[1] = "MenuPlus2"; // Id du menu
MenuActions_PlusMenusTEXTE[1] = "Menu Perso 2"; // Texte de l'onglet
MenuActions_PlusMenusURL[1] = ""; // Cible de l'onglet
MenuActions_PlusMenus[2] = "MenuPlus3"; // Id du menu
MenuActions_PlusMenusTEXTE[2] = "Menu Perso 3"; // Texte de l'onglet
MenuActions_PlusMenusURL[2] = ""; // Cible de l'onglet
////////////////// * nouveaux liens * //////////////////
MenuActions_PlusID = new Array();
MenuActions_PlusTexte = new Array();
MenuActions_PlusURL = new Array();
MenuActions_PlusID[0] = "MenuPlus1"; // Id du menu
MenuActions_PlusTexte[0] = "Lien 1"; // Texte de la case
MenuActions_PlusURL[0] = ""; // Cible de la case
MenuActions_PlusID[1] = "MenuPlus1"; // Id du menu
MenuActions_PlusTexte[1] = "Lien 2"; // Texte de la case
MenuActions_PlusURL[1] = ""; // Cible de la case
MenuActions_PlusID[2] = "MenuPlus3"; // Id du menu
MenuActions_PlusTexte[2] = "Lien 3"; // Texte de la case
MenuActions_PlusURL[2] = ""; // Cible de la case
MenuActions_PlusID[3] = "MenuPlus2"; // Id du menu
MenuActions_PlusTexte[3] = "Lien 4"; // Texte de la case
MenuActions_PlusURL[3] = ""; // Cible de la case
MenuActions_PlusID[4] = "MenuPlus1"; // Id du menu
MenuActions_PlusTexte[4] = "Lien 5"; // Texte de la case
MenuActions_PlusURL[4] = ""; // Cible de la case
//////////////////////////////////////////// FIN DE LA PARTIE PERSONNALISABLE ////////////////////////////////////////
// Ajout des onglets //
for(a=0;a<MenuActions_PlusMenus.length;a++){
if(MenuActions_PlusMenusTEXTE[a].length > 0){
var newMenu_1 = addlimenu(tabs,MenuActions_PlusMenusTEXTE[a],MenuActions_PlusMenus[a],MenuActions_PlusMenusURL[a]);
newMenu_1.className = caMain.className;
}
}
//Ajout des liens //
for(b=0;b<MenuActions_PlusID.length;b++){
if(MenuActions_PlusTexte.length > 0){
addMenuActionsLink(MenuActions_PlusID[b], MenuActions_PlusURL[b], MenuActions_PlusTexte[b]);
}
}
}
$(PersonaliseMenuActions);
CODE SOURCE
[modifier le code]// <nowiki>
// MENU-ACTIONS
== Fonction ==
* Transforme les onglets en menu déroulants [[Discussion utilisateur:Dr Brains/MenuActions.js#Fonction de personnalisation|Facilement personnalisables]]
Code original : [http://en.wikipedia.org/w/index.php?title=Wikipedia:WikiProject_User_scripts/Scripts/Compact_Navigation&oldid=231298438 ext]
*/
window.MenuActions_navigateur =navigator.userAgent.toLowerCase();
window.MenuActions_navigateur_ie = ((MenuActions_navigateur.indexOf("msie") != -1) && (MenuActions_navigateur.indexOf("opera") == -1));
window.MenuActions = function() {
var pCactions = document.getElementById('p-cactions');
if(!pCactions)return;
var tabs = pCactions.getElementsByTagName('ul')[0];
var caMain = pCactions.getElementsByTagName('li')[0];
var caTalk = pCactions.getElementsByTagName('li')[1];
var caSection = document.getElementById('ca-addsection');
var caEdit = document.getElementById('ca-edit');
var caVEEdit = document.getElementById('ca-ve-edit');
var caView = document.getElementById('ca-viewsource');
var caHistory = document.getElementById('ca-history');
var caMove = document.getElementById('ca-move');
var caWatch = document.getElementById('ca-watch');
var caUnwatch = document.getElementById('ca-unwatch');
var caProtect = document.getElementById('ca-protect');
var caUnprotect = document.getElementById('ca-unprotect');
var caDelete = document.getElementById('ca-delete');
var caUndelete = document.getElementById('ca-undelete');
// Hide tabs
if (caMain) caMain.style.display = 'none';
if (caEdit) caEdit.style.display = 'none';
if (caVEEdit) caVEEdit.style.display = 'none';
if (caView) caView.style.display = 'none';
if (caTalk) caTalk.style.display = 'none';
//if (caSection) caSection.style.display = 'none';
if (caHistory) caHistory.style.display = 'none';
if (caMove) caMove.style.display = 'none';
if (caWatch) caWatch.style.display = 'none';
if (caUnwatch) caUnwatch.style.display = 'none';
if (caProtect) caProtect.style.display = 'none';
if (caUnprotect) caUnprotect.style.display = 'none';
if (caDelete) caDelete.style.display = 'none';
if (caUndelete) caUndelete.style.display = 'none';
// Check if page is editable
if ( caEdit ) {
edittxt = 'modifier';
} else {
edittxt = 'voir la source';
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Menu page principale ( ns ≠ spécial )
if(mw.config.get('wgNamespaceNumber') >= 0){
var newPage = addlimenu(tabs, getElementUrlText(caMain), 'new-page', getElementUrl(false, SubjectPageName), caMain);
newPage.className = caMain.className;
if( caMain.className.search('new') == 0 ) {
addMenuActionsLink('new-page', getElementUrl('&action=edit&redlink=1', SubjectPageName), 'créer');
} else {
if (caEdit)addMenuActionsLink('new-page', getElementUrl('&action=edit', SubjectPageName), edittxt);
if (caView)addMenuActionsLink('new-page', getElementUrl('&action=edit', SubjectPageName), edittxt);
if (caEdit)addMenuActionsLink('new-page', getElementUrl('&action=edit§ion=0', SubjectPageName), edittxt + ' en-tête');
addMenuActionsLink('new-page', getElementUrl('&action=history', SubjectPageName), 'historique');
addMenuActionsLink('new-page', getElementUrl('&diff=cur&oldid=prev', SubjectPageName), 'dernière');
}
addMenuActionsLink('new-page', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Log&page=' + encodeURIComponent(SubjectPageName), 'journal');
if(mw.config.get('wgNamespaceNumber')%2==1){
addMenuActionsLink('new-page', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Prefixindex/' + encodeURIComponent(mw.config.get('wgTitle')) + '/' + '&namespace=' + (mw.config.get('wgNamespaceNumber')-1), 'sous-pages');
}else {
addMenuActionsLink('new-page', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Prefixindex/' + encodeURIComponent(mw.config.get('wgTitle')) + '/' + '&namespace=' + mw.config.get('wgNamespaceNumber'), 'sous-pages');
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Menu page de discussion ( ns ≠ spécial )
var newTalk = addlimenu(tabs, getElementUrlText(caTalk), 'new-talk', getElementUrl(false, TalkPageName), caTalk);
newTalk.className = caTalk.className;
if( caTalk.className.search('new') == 0 ) {
addMenuActionsLink('new-talk', getElementUrl('&action=edit&redlink=1', TalkPageName), 'créer');
} else {
if (caEdit)addMenuActionsLink('new-talk', getElementUrl('&action=edit', TalkPageName), edittxt);
if (caView)addMenuActionsLink('new-talk', getElementUrl('&action=view', TalkPageName), edittxt);
if (caEdit)addMenuActionsLink('new-talk', getElementUrl('&action=edit§ion=0', TalkPageName), edittxt + ' en-tête');
addMenuActionsLink('new-talk', getElementUrl('&action=edit§ion=new', TalkPageName), 'nouvelle section');
addMenuActionsLink('new-talk', getElementUrl('&action=history', TalkPageName), 'historique');
addMenuActionsLink('new-talk', getElementUrl('&diff=cur&oldid=prev', TalkPageName), 'dernière');
}
addMenuActionsLink('new-talk', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Log&page=' + encodeURIComponent(TalkPageName), 'journal');
if(mw.config.get('wgNamespaceNumber')%2==1){
addMenuActionsLink('new-talk', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Prefixindex/' + encodeURIComponent(mw.config.get('wgTitle')) + '/' + '&namespace=' + mw.config.get('wgNamespaceNumber'), 'sous-pages');
} else {
addMenuActionsLink('new-talk', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Prefixindex/' + encodeURIComponent(mw.config.get('wgTitle')) + '/' + '&namespace=' + (mw.config.get('wgNamespaceNumber')+1), 'sous-pages');
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Menu actions ( ns ≠ spécial )
var WatchLi = (caWatch || caUnwatch);
var encodedpage = encodeURIComponent(mw.config.get('wgPageName')).replace(/\\/g, '\\\\').replace(/[\\]+n/g, '\\n').replace(/'/g, "\\'")
if (caEdit){ var newLog = addlimenu(tabs, 'actions', 'new-actions', '', caEdit);}
if (caView){ var newLog = addlimenu(tabs, 'actions', 'new-actions', '', caView);}
if (caEdit)addMenuActionsLink('new-actions', getElementUrl('&action=edit'), edittxt);
if (caView)addMenuActionsLink('new-actions', getElementUrl('&action=view'), edittxt);
if (caEdit) addMenuActionsLink('new-actions', getElementUrl('&action=edit§ion=0'), edittxt + ' en-tête');
if (caEdit) addMenuActionsLink('new-actions', getElementUrl('&action=edit§ion=0&nulledit=1'), 'null edit');
if (caHistory) addMenuActionsLink('new-actions', getElementUrl('&action=history'), 'historique');
addMenuActionsLink('new-actions', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Log&page=' + encodeURIComponent(mw.config.get('wgPageName')), 'journal');
document.getElementById('new-actions').getElementsByTagName('ul')[0].appendChild(WatchLi);
WatchLi.style.display = "block";
WatchLi.id = "new"+WatchLi.id;
addMenuActionsLink('new-actions', getElementUrl('&action=purge'), 'purger');
if (caMove){
if(typeof(RenommageCategorie_AddLink)==="function" && mw.config.get('wgNamespaceNumber')==14){
addMenuActionsLink('new-actions', "javascript:RenommageCategorie_OpenMenu();", 'renommer');
}else{
addMenuActionsLink('new-actions', caMove.firstChild.href, 'renommer');
}
}
if (caProtect) addMenuActionsLink('new-actions', getElementUrl('&action=protect'), 'protéger');
if (caUnprotect) addMenuActionsLink('new-actions', getElementUrl('&action=protect'), 'déprotéger');
if (caDelete) addMenuActionsLink('new-actions', getElementUrl('&action=delete'), 'supprimer');
if (caUndelete) addMenuActionsLink('new-actions', getElementUrl(false, 'Special:Undelete/'+mw.config.get('wgPageName')), 'restaurer');
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Menu user ( ns = 2 ou 3 )
if (mw.config.get('wgNamespaceNumber') == 2 || mw.config.get('wgNamespaceNumber') == 3) {
if ( mw.config.get('wgTitle').indexOf("/") == -1 ) {
uname = mw.config.get('wgTitle');
} else {
uname = mw.config.get('wgTitle').substring(0, mw.config.get('wgTitle').indexOf("/"));
}
if (caEdit){var newUser = addlimenu(tabs, 'user', 'new-user', '', caEdit);}
if (caView){var newUser = addlimenu(tabs, 'user', 'new-user', '', caView);}
newUser.className = caMain.className;
addMenuActionsLink('new-user', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Listusers&limit=1&username=' + encodeURIComponent(uname), 'statut de l\'utilisateur');
if (caDelete) addMenuActionsLink('new-user', mw.config.get('wgServer') + mw.config.get('wgArticlePath').split("$1").join('Special:Userrights/' + encodeURIComponent(uname)), 'modifier le statut');
addMenuActionsLink('new-user', mw.config.get('wgServer') + mw.config.get('wgArticlePath').split("$1").join('Special:Contributions/' + encodeURIComponent(uname)), 'contributions de l\'utilisateur');
if (caDelete) addMenuActionsLink('new-user', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:DeletedContributions&target=' + encodeURIComponent(uname), 'contributions supprimées');
addMenuActionsLink('new-user', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Log&user=' + uname, 'journal utilisateur');
addMenuActionsLink('new-user', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Log&type=block&page=User:' + encodeURIComponent(uname), 'blocages utilisateur');
if (caDelete) addMenuActionsLink('new-user', mw.config.get('wgServer') + mw.config.get('wgArticlePath').split("$1").join('Special:Blockip/' + encodeURIComponent(uname)), 'bloquer l\'utilisateur');
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Menu pages spéciales
if(mw.config.get('wgNamespaceNumber') == -1){
var newSpecial = addlimenu(tabs, getElementUrlText(caMain), 'new-special', getElementUrl(false, 'Special:Specialpages'), caMain);
} else {
if (caWatch){ var newSpecial = addlimenu(tabs, 'Pages spéciales', 'new-special', getElementUrl(false, 'Special:Specialpages'));}
if (caUnwatch){ var newSpecial = addlimenu(tabs, 'Pages spéciales', 'new-special', getElementUrl(false, 'Special:Specialpages'));}
}
newSpecial.className = caMain.className;
addMenuActionsLink('new-special', '#', '-');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Specialpages'), 'Toutes les pages spéciales');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Prefixindex'), 'Pages débutant par...');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Shortpages'), 'Pages courtes');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Deadendpages'), 'Pages en impasse');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Fewestrevisions'), 'Pages les moins modifiées');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Ancientpages'), 'Pages anciennes');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Newpages'), 'Nouvelles pages');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Wantedpages'), 'Pages demandées');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Longpages'), 'Pages longues');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Uncategorizedpages'), 'Pages non catégorisées');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Lonelypages'), 'Pages orphelines');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Protectedpages'), 'Pages protégées');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Withoutinterwiki'), 'Pages sans interwiki');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Mostlinked'), 'Pages les plus liées');
addMenuActionsLink('new-special', '#', '-');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Categories'), 'Liste des catégories');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:ArbreCategorie'), 'Arborescence des catégories');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Unusedcategories'), 'Catégories inutilisées');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Wantedcategories'), 'Catégories demandées');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Uncategorizedcategories'), 'Catégories non catégorisées');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Mostlinkedcategories'), 'Catégories les plus liées');
addMenuActionsLink('new-special', '#', '-');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Listfiles'), 'Liste des fichiers');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Wantedfiles'), 'Fichiers demandés');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Uncategorizedfiles'), 'Fichiers non catégorisés');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Unusedfiles'), 'Fichiers inutilisées');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Mostlinkedfiles'), 'Fichiers les plus liés');
addMenuActionsLink('new-special', '#', '-');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Wantedtemplates'), 'Modèles demandés');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Uncategorizedtemplates'), 'Modèles non catégorisés');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Unusedtemplates'), 'Modèles inutilisées');
addMenuActionsLink('new-special', mw.config.get('wgServer') + mw.config.get('wgArticlePath').split("$1").join('Special:Mostlinkedtemplates'), 'Modèles les plus liés');
addMenuActionsLink('new-special', '#', '-');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Listredirects'), 'Liste des redirections');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:DoubleRedirects'), 'Doubles redirections');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:BrokenRedirects'), 'Redirections cassées');
addMenuActionsLink('new-special', '#', '-');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Disambiguations'), 'Homonymies');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:Protectedtitles'), 'Titres protégés');
addMenuActionsLink('new-special', getElementUrl(false, 'Special:CrossNamespaceLinks'), 'Liens entre espaces de noms');
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Menu Recherche
if(mw.config.get('wgNamespaceNumber') > -1){
var newSearch = addlimenu(tabs, 'recherche', 'new-search', getElementUrl(false, 'Special:Search'));
function GoogleQuoteSearch(noWP) {
var result = mw.config.get('wgPageName').replace(/_/g, "+");
if (mw.config.get('wgPageName').search(/\(/) == -1)
result = "%22" + result + "%22" +(noWP ? " -site:wikipedia.*" : "");
return result;
}
//addMenuActionsLink('new-search', '' + GoogleQuoteSearch() + '', '');
addMenuActionsLink('new-search', getElementUrl('&fulltext=Rechercher&advanced=1&ns0=1&redirs=0&search=' + mw.config.get('wgPageName'), 'Special:Search'), mw.config.get('wgServer').split('http://').join(''));
addMenuActionsLink('new-search', 'http://www.google.fr/search?num=100&hl=fr&safe=off&q=site%3A' + mw.config.get('wgServer').split('http://').join('') + '+' + GoogleQuoteSearch(false) + '&btnG=Rechercher&meta=lr%3D&aq=f&oq=', 'Google ' + mw.config.get('wgServer').split('http://').join(''));
addMenuActionsLink('new-search', 'http://www.google.fr/search?hl=fr&safe=off&num=100&q=' + GoogleQuoteSearch(true) + '&btnG=Rechercher&meta=lr%3D&aq=f&oq=', 'Google Web');
addMenuActionsLink('new-search', 'http://www.google.fr/search?hl=fr&safe=off&num=100&q=' + GoogleQuoteSearch(true) + '&btnG=Rechercher&meta=lr%3Dlang_fr&aq=f&oq=', 'Google Fr');
addMenuActionsLink('new-search', 'http://images.google.fr/images?hl=fr&lr=&um=1&sa=1&q=' + GoogleQuoteSearch() + '&btnG=Recherche+d\'images&aq=f&oq=&start=0', 'Google Images');
addMenuActionsLink('new-search', 'http://video.google.fr/videosearch?hl=fr&lr=&um=1&q=' + GoogleQuoteSearch() + '&ie=UTF-8&sa=N&tab=iv&start=0#', 'Google Vidéos');
addMenuActionsLink('new-search', 'http://maps.google.fr/maps?hl=fr&lr=&um=1&q=' + GoogleQuoteSearch() + '&ie=UTF-8&sa=N&tab=vl', 'Google Maps');
addMenuActionsLink('new-search', 'http://www.lycos.fr/?tab=web&query=' + GoogleQuoteSearch(true) + '&Search=Rechercher&searchArea=web', 'Lycos Web');
addMenuActionsLink('new-search', 'http://www.lycos.fr/?tab=multi&cat=images&searchArea=web&query=' + GoogleQuoteSearch() + '', 'Lycos Images');
addMenuActionsLink('new-search', 'http://www.lycos.fr/?tab=multi&cat=video&searchArea=web&query=' + GoogleQuoteSearch() + '', 'Lycos Vidéos');
addMenuActionsLink('new-search', 'http://fr.search.yahoo.com/search?rd=r1&p=' + GoogleQuoteSearch(true) + '&toggle=1&cop=mss&ei=UTF-8&fr=yfp-t-703', 'Yahoo Web');
addMenuActionsLink('new-search', 'http://fr.images.search.yahoo.com/search/images;_ylt=A1f4cfmLyPRK_mEBPuhjAQx.?ei=UTF-8&p=' + GoogleQuoteSearch() + '&rd=r1&fr2=tab-web&fr=yfp-t-703', 'Yahoo Images');
addMenuActionsLink('new-search', 'http://fr.video.search.yahoo.com/search/video?ei=UTF-8&p=' + GoogleQuoteSearch() + '&rd=r1&fr2=tab-img&fr=yfp-t-703', 'Yahoo Vidéos');
addMenuActionsLink('new-search', 'http://www.youtube.com/results?search_query=' + GoogleQuoteSearch() + '&search_type=&aq=f', 'You Tube');
addMenuActionsLink('new-search', 'http://www.dailymotion.com/relevance/search/' + GoogleQuoteSearch() + '', 'Dailymotion');
addMenuActionsLink('new-search', 'http://www.deezer.com/fr/#music/result/all/' + mw.config.get('wgPageName').replace(/_/g, " ") + '', 'Deezer Music');
addMenuActionsLink('new-search', 'http://www.flickr.com/search/?q=' + mw.config.get('wgPageName').replace(/_/g, "+") + '&ct=0&mt=all&adv=1', 'FlickR tous');
addMenuActionsLink('new-search', 'http://www.flickr.com/search/?q=' + mw.config.get('wgPageName').replace(/_/g, "+") + '&l=commderiv&ct=0&mt=all&adv=1', 'FlickR libres');
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Menu utilisateur
/*
var caUser = document.getElementById('pt-userpage');
var usertabs = caUser.parentNode;
var UserPage = mw.config.get('wgFormattedNamespaces')[2]+":"+mw.config.get('wgUserName');
var newUser = addlimenu(usertabs, getElementUrlText(caUser), 'new-ptUser', getElementUrl(false, UserPage), caUser);
newUser.className = caUser.className;
caUser.style.display = "none";
for(var a=0,l=25;a<l;a++){
addMenuActionsLink('new-ptUser', getElementUrl(UserPage + '/Travaux/'+(a+1)), 'Brouillon '+(a+1), 'Brouillon_'+(a+1));
}
addMenuActionsLink('new-ptUser', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Prefixindex/' + encodeURIComponent(UserPage) + '/' + '&namespace=' + (mw.config.get('wgNamespaceNumber')+1), 'autres sous-pages');
var caUserTalk = document.getElementById('pt-mytalk');
var UserTalkPage = mw.config.get('wgFormattedNamespaces')[3]+":"+mw.config.get('wgUserName');
var newUserTalk = addlimenu(usertabs, getElementUrlText(caUserTalk), 'new-Mytalk', getElementUrl(false, UserTalkPage), caUserTalk);
newUserTalk.className = caUserTalk.className;
caUserTalk.style.display = "none";
if( caUserTalk.className.search('new') == 0 ) {
addMenuActionsLink('new-talk', getElementUrl('&action=edit&redlink=1', TalkPageName), 'créer');
} else {
addMenuActionsLink('new-Mytalk', getElementUrl('&action=edit', UserTalkPage), edittxt);
addMenuActionsLink('new-Mytalk', getElementUrl('&action=edit§ion=0', UserTalkPage), edittxt + ' en-tête');
addMenuActionsLink('new-Mytalk', getElementUrl('&action=edit§ion=new', UserTalkPage), 'nouvelle section');
addMenuActionsLink('new-Mytalk', getElementUrl('&action=history', UserTalkPage), 'historique');
addMenuActionsLink('new-Mytalk', getElementUrl('&diff=cur&oldid=prev', UserTalkPage), 'dernière');
}
addMenuActionsLink('new-Mytalk', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Log&page=' + encodeURIComponent(TalkPageName), 'journal');
addMenuActionsLink('new-Mytalk', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Prefixindex/' + encodeURIComponent(TalkPageName) + '/' + '&namespace=' + 3, 'sous-pages');
*/
$(document.body).addClass("MenuActionOnline");
}
//</nowiki>
window.addMenuActionsLink = function(portlet, href, text, id, tooltip, accesskey, nextnode) {
var root = document.getElementById(portlet); if ( !root ) return null; var node = root.getElementsByTagName( "ul" )[0]; if ( !node ) return null; // unhide portlet if it was hidden before root.className = root.className.replace( /(^| )emptyPortlet( |$)/, "$2" ); var span = document.createElement( "span" ); span.appendChild( document.createTextNode( text ) ); var link = document.createElement( "a" ); link.appendChild( span ); link.href = href; var item = document.createElement( "li" ); item.appendChild( link ); item.style.display = 'block'; if ( id ) item.id = id; if ( accesskey ) { link.setAttribute( "accesskey", accesskey ); tooltip += " ["+accesskey+"]"; } if ( tooltip ) { link.setAttribute( "title", tooltip ); } if ( accesskey && tooltip ) { updateTooltipAccessKeys( new Array( link ) ); } if ( nextnode && nextnode.parentNode == node ) node.insertBefore( item, nextnode ); else node.appendChild( item ); // IE compatibility (?) return item;
}
// Null edit if(mw.config.get('wgAction') == "edit"){ addOnloadHook(function(){
var URL = document.URL; var AllParams = URL.split("&"); for(var a=0,l=AllParams.length;a<l;a++){ var ThisParam = AllParams[a]; var ParamName = ThisParam.split("=")[0]; var ParamValue = ThisParam.split("=")[1]; if(ParamName=="nulledit" && ParamValue=="1"){ document.editform.submit(); } }
}); }
if(!MenuActions_navigateur_ie){
//Styles mw.loader.load('//fr.wikipedia.org/w/index.php?title=Utilisateur:Dr_Brains/MenuActions.css&action=raw&ctype=text/css', "text/css");
// Fonctions
window.ULmenuOnMouseOver = function(id){
var Ul = document.getElementById('limenu_'+id); var Lis = Ul.getElementsByTagName('li'); for(a=0;a<Lis.length;a++){ Lis[a].style.display = 'block' }
} window.ULmenuOnMouseOut = function(id){
var Ul = document.getElementById('limenu_'+id); var Lis = Ul.getElementsByTagName('li'); for(a=0;a<Lis.length;a++){ Lis[a].style.display = 'none' }
}
window.Limenu_Index = -1; window.addlimenu = function(tabs, name, id, href, position) {
Limenu_Index++ var mn; var li; if (!id) id = name; if ((!href)||(href==)) href = '#'; li = document.createElement("li"); li.innerHTML = '<a href="'+href+'" onblur="ULmenuOnMouseOut(\+Limenu_Index+'\')" onfocus="ULmenuOnMouseOver(\+Limenu_Index+'\')" >'+name+'</a>'; mn = document.createElement("ul"); mn.id = 'limenu_'+Limenu_Index; li.appendChild(mn); if (id) li.id = id; li.className = 'tabmenu'; if (position) { tabs.insertBefore(li, position); } else { tabs.appendChild(li); } mn.style.display = "none";return mn; // useful because it gives us the
- to add
- s to } window.getElementUrl = function(params, Page) { if(!Page) Page = mw.config.get('wgPageName'); if(params){ var url = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(Page) + params; }else{ var url = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split("$1").join(encodeURIComponent(Page)); } return url; } window.getElementUrlText = function(id) { return id.firstChild.textContent; } window.SubjectPageName = false; if(mw.config.get('wgNamespaceNumber')!=-1){ if(mw.config.get('wgNamespaceNumber')%2==0){ window.SubjectNamespaceNumber = mw.config.get('wgNamespaceNumber'); }else{ window.SubjectNamespaceNumber = mw.config.get('wgNamespaceNumber')-1; } SubjectPageName = mw.config.get('wgFormattedNamespaces')[SubjectNamespaceNumber] + ":" + mw.config.get('wgTitle'); } window.TalkPageName = false; if(mw.config.get('wgNamespaceNumber')!=-1){ if(mw.config.get('wgNamespaceNumber')%2==0){ var TalkNamespaceNumber = mw.config.get('wgNamespaceNumber')+1; }else{ var TalkNamespaceNumber = mw.config.get('wgNamespaceNumber'); } TalkPageName = mw.config.get('wgFormattedNamespaces')[TalkNamespaceNumber] + ":" + mw.config.get('wgTitle'); } // Fonction principale $(MenuActions); } //