E |
E |
Linio 1: |
Linio 1: |
- | /* Ĉiu ajn JavaSkriptaĵo ĉi tie estos ŝarĝita por ĉiu uzanto sur ĉiu paĝo.
| |
- | */
| |
- | /* <pre> <nowiki>
| |
- | */
| |
| | | |
- | /**
| |
- | * Aldonas apartan signon al interlingvaj ligiloj al elstaraj au legindaj artikoloj
| |
- | */
| |
- | function LinkFA() {
| |
- | // links are only replaced in p-lang
| |
- | var pLang = document.getElementById("p-lang");
| |
- | if (!pLang) return;
| |
- | var lis = pLang.getElementsByTagName("li");
| |
- | for (var i=0; i<lis.length; i++) {
| |
- | var li = lis[i];
| |
- | // FA- estas celita por respndi al ŝablono LigoElstara : nepre ne ŝanĝenda
| |
- | if (document.getElementById("FA-" + li.className)) {
| |
- | li.className += " FA";
| |
- | li.title = "Ĉi tiu estas elstara artikolo.";
| |
- | } else if (document.getElementById("BA-" + li.className)) {
| |
- | li.className += " BA";
| |
- | li.title = "Ĉi tiu estas leginda artikolo.";
| |
- | } else if (document.getElementById("PdQ-" + li.className)) {
| |
- | li.className += " PdQ";
| |
- | li.title = "Ĉi tiu estas elstara portalo";
| |
- | }
| |
- | }
| |
- | }
| |
- | addOnloadHook(LinkFA);
| |
- |
| |
- | //============================================================
| |
- | //
| |
- | // Kaŝskatoloj
| |
- | //
| |
- | //============================================================
| |
- |
| |
- | // ============================================================
| |
- | // BEGIN Dynamic Navigation Bars (experimantal)
| |
- |
| |
- |
| |
- | /** Dynamic Navigation Bars (experimental) *************************************
| |
- | *
| |
- | * Description: See [[Wikipedia:NavFrame]].
| |
- | * Maintainers: UNMAINTAINED
| |
- | */
| |
- |
| |
- | // set up the words in your language
| |
- | var NavigationBarHide = '[' + collapseCaption + ']';
| |
- | var NavigationBarShow = '[' + expandCaption + ']';
| |
- |
| |
- | // shows and hides content and picture (if available) of navigation bars
| |
- | // Parameters:
| |
- | // indexNavigationBar: the index of navigation bar to be toggled
| |
- | function toggleNavigationBar(indexNavigationBar)
| |
- | {
| |
- | var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
| |
- | var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
| |
- |
| |
- | if (!NavFrame || !NavToggle) {
| |
- | return false;
| |
- | }
| |
- |
| |
- | // if shown now
| |
- | if (NavToggle.firstChild.data == NavigationBarHide) {
| |
- | for (
| |
- | var NavChild = NavFrame.firstChild;
| |
- | NavChild != null;
| |
- | NavChild = NavChild.nextSibling
| |
- | ) {
| |
- | if ( hasClass( NavChild, 'NavPic' ) ) {
| |
- | NavChild.style.display = 'none';
| |
- | }
| |
- | if ( hasClass( NavChild, 'NavContent') ) {
| |
- | NavChild.style.display = 'none';
| |
- | }
| |
- | }
| |
- | NavToggle.firstChild.data = NavigationBarShow;
| |
- |
| |
- | // if hidden now
| |
- | } else if (NavToggle.firstChild.data == NavigationBarShow) {
| |
- | for (
| |
- | var NavChild = NavFrame.firstChild;
| |
- | NavChild != null;
| |
- | NavChild = NavChild.nextSibling
| |
- | ) {
| |
- | if (hasClass(NavChild, 'NavPic')) {
| |
- | NavChild.style.display = 'block';
| |
- | }
| |
- | if (hasClass(NavChild, 'NavContent')) {
| |
- | NavChild.style.display = 'block';
| |
- | }
| |
- | }
| |
- | NavToggle.firstChild.data = NavigationBarHide;
| |
- | }
| |
- | }
| |
- |
| |
- | // adds show/hide-button to navigation bars
| |
- | function createNavigationBarToggleButton()
| |
- | {
| |
- | var indexNavigationBar = 0;
| |
- | // iterate over all < div >-elements
| |
- | var divs = document.getElementsByTagName("div");
| |
- | for(
| |
- | var i=0;
| |
- | NavFrame = divs[i];
| |
- | i++
| |
- | ) {
| |
- | // if found a navigation bar
| |
- | if (hasClass(NavFrame, "NavFrame")) {
| |
- |
| |
- | indexNavigationBar++;
| |
- | var NavToggle = document.createElement("a");
| |
- | NavToggle.className = 'NavToggle';
| |
- | NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
| |
- | NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
| |
- |
| |
- | var NavToggleText = document.createTextNode(NavigationBarHide);
| |
- | for (
| |
- | var NavChild = NavFrame.firstChild;
| |
- | NavChild != null;
| |
- | NavChild = NavChild.nextSibling
| |
- | ) {
| |
- | if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
| |
- | if (NavChild.style.display == 'none') {
| |
- | NavToggleText = document.createTextNode(NavigationBarShow);
| |
- | break;
| |
- | }
| |
- | }
| |
- | }
| |
- |
| |
- | NavToggle.appendChild(NavToggleText);
| |
- | // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
| |
- | for(
| |
- | var j=0;
| |
- | j < NavFrame.childNodes.length;
| |
- | j++
| |
- | ) {
| |
- | if (hasClass(NavFrame.childNodes[j], "NavHead")) {
| |
- | NavFrame.childNodes[j].appendChild(NavToggle);
| |
- | }
| |
- | }
| |
- | NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
| |
- | }
| |
- | }
| |
- | }
| |
- |
| |
- | addOnloadHook( createNavigationBarToggleButton );
| |
- |
| |
- |
| |
- |
| |
- | //============================================================
| |
- | // Tabelkreilo
| |
- | //============================================================
| |
- |
| |
- | /**
| |
- | *
| |
- | * English: Generate an array using Mediawiki syntax
| |
- | *
| |
- | * @author: fr:user:dake
| |
- | * @version: 0.1
| |
- | */
| |
- |
| |
- | function generateTableau(nbCol, nbRow, border, styleHeader, styleLine)
| |
- | {
| |
- | var code = "\n";
| |
- | if (styleHeader==1) {
| |
- | code += '{'+'{TabelKapoLaŭĈarta}'+'}\n';
| |
- | } else {
| |
- | code += '{| border="' + border + '"\n';
| |
- | code += '|+ Tabeltitolo\n';
| |
- | }
| |
- |
| |
- | for (var i=0;i<nbCol;i++) code += '! kapo ' + i + '\n'
| |
- |
| |
- | for (var j=0;j<nbRow;j++) {
| |
- | if ((j+1)%2==0 && styleLine==1) {
| |
- | code += '|-{'+'{GrizaLinio}'+'}\n'
| |
- | } else {
| |
- | code += '|-----\n'
| |
- | }
| |
- |
| |
- | for (var i=0;i<nbCol;i++) code += '| elemento\n';
| |
- | }
| |
- |
| |
- | code += '|}';
| |
- | insertTags('','', code);
| |
- | }
| |
- |
| |
- | /**
| |
- | *
| |
- | * English: Open a popup with parameters to generate an array.
| |
- | * The number of rows/columns can be modified. Some additional
| |
- | * parameters are related to templates available on :fr
| |
- | *
| |
- | * @author: fr:user:dake
| |
- | * @version: 0.1
| |
- | */
| |
- |
| |
- | function popupTableau()
| |
- | {
| |
- | var popup = window.open('','name','height=400,width=500');
| |
- |
| |
- | javaCode = '<script type="text\/javascript">function insertCode(){';
| |
- | javaCode += 'var row = parseInt(document.paramForm.inputRow.value); '
| |
- | javaCode += 'var col = parseInt(document.paramForm.inputCol.value); '
| |
- | javaCode += 'var bord = parseInt(document.paramForm.inputBorder.value); '
| |
- | javaCode += 'var styleHeader = document.paramForm.inputHeader.checked; '
| |
- | javaCode += 'var styleLine = document.paramForm.inputLine.checked; '
| |
- | javaCode += 'window.opener.generateTableau(col,row,bord,styleHeader,styleLine); '
| |
- | javaCode += '}<\/script>';
| |
- |
| |
- | popup.document.write('<html><head><title>Parametroj de la tabelo</title>');
| |
- | popup.document.write('<script type="text\/javascript" src="\/skins-1.5\/common\/wikibits.js"><!-- wikibits js --><\/script>');
| |
- | popup.document.write('<style type="text\/css" media="screen,projection">/*<![CDATA[*/ @import "\/skins-1.5\/monobook\/main.css?5"; *]]>*/<\/style>');
| |
- | popup.document.write(javaCode);
| |
- | popup.document.write('</head><body>');
| |
- | popup.document.write('<p>Bonvolu entajpi la parametrojn de la tabelo : </p>');
| |
- | popup.document.write('<form name="paramForm">');
| |
- | popup.document.write('Lininombro : <input type="text" name="inputRow" value="3" ><p>');
| |
- | popup.document.write('Kolumnnombro : <input type="text" name="inputCol" value="3" ><p>');
| |
- | popup.document.write('Randolarĝeco : <input type="text" name="inputBorder" value="1" ><p>');
| |
- | popup.document.write('Griza tabelkapo (stilo lauĉarta) : <input type="checkbox" name="inputHeader" checked="1" ><p>');
| |
- | popup.document.write('Alternaj grizaj linioj (stilo lauĉarta) : <input type="checkbox" name="inputLine" checked="1" ><p>');
| |
- | popup.document.write('</form">');
| |
- | popup.document.write('<p><a href="javascript:insertCode()"> Enmetu la kodon en la redaktofenestron</a></p>');
| |
- | popup.document.write('<p><a href="javascript:self.close()"> Fermu</a></p>');
| |
- | popup.document.write('</body></html>');
| |
- | popup.document.close();
| |
- | }
| |
- |
| |
- | //============================================================
| |
- | // Enmeto de novaj butonoj en la redaktilarstrio
| |
- | //============================================================
| |
- |
| |
- | //Ressemble à la fonction de /skins-1.5/commons/wikibits.js pour insérer un autre lien que insertTags
| |
- |
| |
- |
| |
- | //Plenigas la variablon mwCustomEditButtons (vidu /skins-1.5/commons/wikibits.js) por aldoni butonojn en la redaktostrio
| |
- | function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText, imageId) {
| |
- | mwCustomEditButtons[mwCustomEditButtons.length] =
| |
- | {"imageId": imageId,
| |
- | "imageFile": imageFile,
| |
- | "speedTip": speedTip,
| |
- | "tagOpen": tagOpen,
| |
- | "tagClose": tagClose,
| |
- | "sampleText": sampleText};
| |
- | }
| |
- |
| |
- |
| |
- | addCustomButton('http://upload.wikimedia.org/wikipedia/commons/0/04/Button_array.png','Tabelo','{|\n|-\n|\n|\n|}','','','mw-editbutton-array');
| |
- | if (wgNamespaceNumber != 0) addCustomButton('http://upload.wikimedia.org/wikipedia/commons/c/c9/Button_strike.png','Forstreki','<s>','</s>','','mw-editbutton-strike');
| |
- | addCustomButton('http://upload.wikimedia.org/wikipedia/commons/8/88/Btn_toolbar_enum.png','Numerita listo','\n# elemento 1\n# elemento 2\n# elemento 3','','','mw-editbutton-enum');
| |
- | addCustomButton('http://upload.wikimedia.org/wikipedia/commons/1/11/Btn_toolbar_liste.png','Listo','\n* elemento A\n* elemento B\n* elemento C','','','mw-editbutton-liste');
| |
- | addCustomButton('http://upload.wikimedia.org/wikipedia/commons/9/9e/Btn_toolbar_gallery.png','Bildaro','\n<gallery>\nDosiero:M63.jpg|[[M63]]\nDosiero:Mona Lisa.jpg|[[La Gioconda]]\nDosiero:Truite arc-en-ciel.jpg|[[Fiŝo|Ĉielarka truto]]\n</gallery>','','','mw-editbutton-gallery');
| |
- | addCustomButton('http://upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png','Komento','<!--','-->','','mw-editbutton-comment');
| |
- | addCustomButton('http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png','Redirekto','#REDIRECT [[',']]','redirektocelo','mw-editbutton-redir');
| |
- | addCustomButton('http://upload.wikimedia.org/wikipedia/commons/3/3b/Button_template_alt.png','Ŝablono','{{','}}','enmetenda ŝablono aŭ paĝo','mw-editbutton-template');
| |
- | addCustomButton('http://upload.wikimedia.org/wikipedia/commons/c/c4/Button_ref.png','Referenco','<ref>','</ref>','reference, citaĵo aŭ ligilo','mw-editbutton-ref');
| |
- | addCustomButton('http://upload.wikimedia.org/wikipedia/commons/6/64/Buttonrefvs8.png','Referenca sekcio','== Notoj kaj referencoj ==\n<references /> <!-- Helpo : http://eo.wikipedia.org/wiki/Helpo:Referencoj kaj piednotoj -->','','','mw-editbutton-references');
| |
- | addCustomButton('http://upload.wikimedia.org/wikipedia/commons/b/b0/Button_category02.png','Kategorio','[[Kategorio:',']]','Kategorionomo','mw-editbutton-category');
| |
- | var viduAnkau = '<!-- Aneksprezentsugesto helpo : http://eo.wikipedia.org/wiki/Helpo:Referencoj kaj piednotoj -->\n'
| |
- | + '== Notoj kaj referencoj de la artikolo ==\n'
| |
- | + '<references/>\n'
| |
- | + '== Vidu ankaŭ ==\n'
| |
- | + '=== Rilataj artikoloj ===\n'
| |
- | + '* [[Anstataŭigenda]]\n'
| |
- | + '*\n'
| |
- | + '=== Eksteraj ligiloj kaj dokumentoj===\n'
| |
- | + '*\n';
| |
- | addCustomButton('http://upload.wikimedia.org/wikipedia/commons/b/bb/Seealso.png','Sekcio Vidu ankaŭ',viduAnkau,'','','mw-editbutton-voiraussi');
| |
- |
| |
- |
| |
- | // Ŝanĝi la ligilon de la tabelkrea butono kaj forigas la subskriban butonon el artikolaj paĝoj
| |
- |
| |
- | function chang_buttons() {
| |
- | toolbarArray = document.getElementById('mw-editbutton-array');
| |
- | if (toolbarArray) {
| |
- | toolbarArray.onclick = function() {
| |
- | popupTableau();
| |
- | return false;
| |
- | }
| |
- | }
| |
- |
| |
- | var btnSigImg = document.getElementById('mw-editbutton-signature');
| |
- | if (btnSigImg && wgNamespaceNumber == 0) btnSigImg.style.display = "none";
| |
- | }
| |
- | hookEvent('load', chang_buttons);
| |
- |
| |
- |
| |
- |
| |
- | /** WikiMiniAtlas *******************************************************
| |
- | *
| |
- | * Priskribo: WikiMiniAtlas estas ŝprucanta alklakebla kaj tirebla mondmapo.
| |
- | * La skripto estigas ke ĉiuj viaj koordinataj ligiloj montras la WikiMiniAtlas-ŝprucbutonon.
| |
- | * La skripto mem estas lokita sur meta ĉar ĝi estas uzata de multaj projektoj.
| |
- | * Vidu [[Meta:WikiMiniAtlas]] por plia informo.
| |
- | * Kreita de : [[:en:User:Dschwen]]
| |
- | */
| |
- |
| |
- | document.write('<script type="text/javascript" src="'
| |
- | + 'http://meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js'
| |
- | + '&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400"></script>');
| |
- |
| |
- | /* </nowiki> </pre>*/
| |