MediaWiki:MenuChanges.js

/* */

/* ============== MENU CHANGES =============================== author:       Petr Kajzar User:Slepi date:         10/2009, last update 07/2010 dokumentation: -- description:  menu changes ==========================================================

/* ============================== Personal menu ========================================= */

// FUNCTION ADDING SANDBOX function piskoviste { // not logged in if(wgUserName==null) { // login vs anonlogin if(document.getElementById("pt-anonlogin")) piskovisteId = "pt-anonlogin"; if(document.getElementById("pt-login")) piskovisteId = "pt-login"; if(!piskovisteId) return;

addPortletLink('p-personal', wgServer + wgScriptPath + '/index.php?title=WikiLectures:Sandbox', 'My sandbox', 'pt-piskoviste', 'Place, where I can experiment', 'a', document.getElementById(piskovisteId));

} else { // personal sandbox addPortletLink('p-personal', wgServer + wgScriptPath + '/index.php?title=User:' + wgUserName + '/Sandbox', 'My sandbox', 'pt-piskoviste', 'Place, where I can experiment', 'a', document.getElementById('pt-preferences')); } }

/* ============================== Sidebar ====================================== */

// FUNCTION ADDING CATEGORY HISTORY LIK TO SIDEBAR function categoryHistory { addPortletLink('p-tb', wgServer + wgScriptPath + '/index.php/Special:CategoryHistory/'+wgTitle, 'Historie kategorie', 't-cathistory', 'History of changes of the articles in this category'); }

// FUNCTION ADDING EDUCATIONAL PORTALS TO SIDEBAR function addEdu {

// portal box novaSekce = document.createElement("div"); novaSekce.id = "p-edu"; novaSekce.className = "portal"; document.getElementById("mw-panel").appendChild(novaSekce);

// open section eduPortaly = ' ';

// MEFANET eduPortaly += '  ';

// Facebook eduPortaly += '  ';

// WebArchiv eduPortaly += '  ';

// close section eduPortaly += ' ';

novaSekce.innerHTML = eduPortaly; }

// FUNCTION ADDING LINK TO CITATION SERVER CITACE.COM function addCitaceCom { if(wgNamespaceNumber != 0) return;

ctAdresa = "http://www.citace.com/import.php?druh=14&nazev=" + encodeURI(wgTitle) + "&casopis_nazev=WikiLectures&misto=Praha&nakl=" + encodeURI("MEFANET") + "&rok=2008-&url=" + wgServer + wgScript + "?title=" + encodeURI(wgPageName) + "%26oldid=" + wgCurRevisionId;

addPortletLink('p-tb', ctAdresa, 'Create citation', 't-citacecom', 'Create citation by Citace.com'); document.getElementById("t-citacecom").className = "popup"; }

/* ============================== Footer ============================================== */

// FUNCTION ADDING FACEBOOK LIKE BUTTON // to the end of the article function addFbLikeButton { // check NS // only main namespace or portal if (wgNamespaceNumber != 0 && wgNamespaceNumber != 100) return false; // check main page if (wgTitle == "Main Page") return false; // action ahould be "view" only if (wgAction != "view") return false; // create button fbLikeButton = document.createElement("div"); fbLikeButton.className = "fb_likebutton"; fbLikeButton.id = "fb_likebutton"; document.getElementById("content").appendChild(fbLikeButton); if (document.getElementById("catlinks")) { fbLikeButton.parentNode.insertBefore(document.getElementById("catlinks"), fbLikeButton.nextSibling); } fbLikeButton.innerHTML = '  '; }

// FOOTER function addLfFooter { links = document.createElement("div"); links.id = "myLfFooter"; document.getElementById("footer").appendChild(links); links.innerHTML = 'WikiLectures, project of the medical faculties network MEFANET • e-mail: info&#64;wikilectures.eu 1st LF UK, 2nd LF UK</a>, 3nd LF UK</a> in Prague • LF UK in Pilsen</a> • LF MU in Brno</a> • LF UP in Olomouc</a> • LF UPJS in Kosice</a> • LF UK in Bratislava</a> • JLF UK in Martin</a>'; }

/* =========================== Edit buttons ==================== */

// add Redirect if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png", "speedTip": "Redirect", "tagOpen": "#REDIRECT ",   "tagClose": "", "sampleText": "Page"} }

// checkuserrights if (wgUserGroups) { userrights = wgUserGroups.toString; ur_sysop = userrights.search("sysop"); } else { ur_sysop = -1; }

// spam button for sysops if ((ur_sysop != -1) && mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/1/1b/Button_miss_signature.png", "speedTip": "SPAM to talk page", "tagOpen": " \nIP blocked and reported to provider. --~", "tagClose": "", "sampleText": ""} }

/* ============================== Recent changes ====================================== */

// SHOW REAL NAMES IN RECENT CHANGES function showRealName { jmena = getElementsByClass("mw-recent-realname"); for(i=0; i<jmena.length; i++) jmena[i].style.display = "inline"; }

/* ============================== Focus at logging in ============================== */

// FOCUS FIELDS DURING LOGGING IN function focusLogIn {

// only Special:Userlogin if (wgPageName!="Special:Userlogin") return false;

// name of form that is shown jmenoForm = ""; if (document.forms["userlogin"]) jmenoForm = "userlogin"; if (document.forms["userlogin2"]) jmenoForm = "userlogin2"; if (jmenoForm=="") return false;

// identificators of fields with username and password // - log in if (document.forms[jmenoForm].elements["wpName1"]) { jmenoName = "wpName1" jmenoHeslo = "wpPassword1"; }

// - registration if (document.forms[jmenoForm].elements["wpName2"]) { jmenoName = "wpName2"; jmenoHeslo = "wpPassword2"; }

// focus if (!document.forms[jmenoForm].elements[jmenoName].value) document.forms[jmenoForm].elements[jmenoName].focus; else document.forms[jmenoForm].elements[jmenoHeslo].focus; }

/* ============================== Start! ===================================== */

// ONLY LOGGED IN USERS if (wgUserName!=null) { addOnloadHook(showRealName); if (wgCanonicalNamespace == "Category" && wgTitle) addOnloadHook(categoryHistory); } else {

// ONLY GUESTS } // end else

// EVERYONE addOnloadHook(addCitaceCom); addOnloadHook(addEdu); addOnloadHook(addFbLikeButton);

if (wgNamespaceNumber == 0 && wgTitle != "Main Page" && wgAction != "markpatrolled") { var xmlPortaly; addOnloadHook(function{   getXMLHttpRequest("xmlPortaly", wgServer + "/api.php?action=query&list=backlinks&bltitle=" + wgPageName + "&blnamespace=100&format=json", "odkazujiciPortaly")  }); }

addOnloadHook(addLfFooter); addOnloadHook(focusLogIn); addOnloadHook(piskoviste);

/* */