|
|
Zeile 1: |
Zeile 1: |
β | /* Jedes JavaScript hier wird fΓΌr alle Benutzer fΓΌr jede Seite geladen. */
| |
β | /* Any JavaScript here will be loaded for all users on every page load. */
| |
β | /* Jedes JavaScript hier wird fΓΌr alle Benutzer fΓΌr jede Seite geladen. */
| |
| | | |
β | //============================================================
| |
β | // de: FΓGT NEUE BUTTON IN DIE WERKZEUGLEISTE
| |
β | // aus Wikipedia, Benutzer:Olliminatore/Extra-Editbuttons
| |
β | // Converted by [[Benutzer:A.Burgermeister]] 15.10.2007
| |
β | //============================================================
| |
β |
| |
β | var XEBOrder=[];
| |
β | rmEditButtons=[4];
| |
β | var usersignature = '-- \~\~\~ <small>\~\~\~\~\~<\/small>';
| |
β |
| |
β |
| |
β | var attributes = ["imageFile","speedTip","tagOpen","tagClose","sampleText"];
| |
β | // isMSIE55
| |
β |
| |
β | //fills the variable mwCustomEditButtons (s. function in /wikibits.js), with buttons for the toolbar
| |
β | function addCustomButton(){
| |
β | var a = {};
| |
β | for (d in attributes) a[attributes[d]] = arguments[d];
| |
β | mwCustomEditButtons.push(a);
| |
β | };
| |
β |
| |
β | var Isrc='http://upload.wikimedia.org/wikipedia/commons/';
| |
β | var BDict={
| |
β | 'A':['e/e9/Button_headline2.png','SekundΓ€re Γberschrift','\n=== ',' ===','SekundΓ€re Γberschrift'],
| |
β | 'A1':['b/ba/Headline_icon.png','PrimΓ€re Γberschrift','\== ','==','PrimΓ€re Γberschrift'],
| |
β | 'A3':['/3/3a/Button_headline3.png','Untergeordnete Γberschrift','\n==== ',' ====','Untergeordnete Γberschrift'],
| |
β | 'B':['1/13/Button_enter.png','Zeilenumbruch','<br />','',''],
| |
β | 'B1':['6/62/Button_desambig.png','BegriffsklΓ€rungseite','{{BegriffsklΓ€rung}}','',''],
| |
β | 'B2':['5/5e/Button_disambig_small.png','Dieser Artikel erlΓ€utertβ¦','{{Dieser Artikel|','}}','erlΓ€utert den Buchstaben X, zu anderen Bedeutungen siehe [[X (BegriffsklΓ€rung)]].'],
| |
β | 'C':['5/5f/Button_center.png','Zentriert','<div style="text-align: center;">\n','\n<\/div>','Zentriert'],
| |
β | 'CF':['3/37/Btn_toolbar_commentaire.png','Chemische Formel',':<math>\u005Cmathrm{','}</math>',''],
| |
β | 'CO':['6/6c/Button_commons.png','Commons','{{Commons|Category:','}}','Seitenname'],
| |
β | 'D':['e/ea/Button_align_left.png','Left-Align','<div style="text-align: left; direction: ltr; margin-left: 1em;">\n','\n<\/div>','Left-aligned Text'],
| |
β | 'DS':['4/4e/Button_romain.png','DEFAULTSORT','{{DEFAULTSORT:','}}','Sortierbegriff'],
| |
β | 'DO':['e/e9/Button_done.png','Erledigt (kurz)','{{Erl.}}','',''],
| |
β | 'ER':['9/9d/Button_fait.png','Erledigt (lang)','{{Erledigt|1=' + usersignature,'}}',''],
| |
β | 'E':['0/04/Button_array.png','Tabelle','\n{| class="prettytable" \n|- \n| 1 || 2\n|- \n| 3 || 4','\n|}\n',''],
| |
β | 'F':['8/8f/Button_poeme.png','Farbiger Text','<span style="color: color">','<\/span>','Farbig'],
| |
β | 'FS':['1/1b/Button_miss_signature.png','Fehlende Signatur','\{\{subst\:Unsigned|','3='+usersignature+'}}',''],
| |
β | 'G':['9/9e/Btn_toolbar_gallery.png','Bildergalerie',"\n<gallery>\nBild:M63.jpg|[[M63]]\nBild:Mona Lisa.jpg|[[Mona Lisa]]\nBild:Truite arc-en-ciel.jpg|Eine [[Forelle ]]\n<\/gallery>","",''],
| |
β | 'H':['7/74/Button_comment.png','Versteckter Kommentar',"<!--","-->",'Versteckt'],
| |
β | 'I':['4/41/Button_hr_halfwidth.png','Gedankenstrich','β','',''],
| |
β | 'I1':['6/6a/Button_sup_letter.png','Hochgestellter Text (superscript)','<sup>','<\/sup>','Hochgestellt'],
| |
β | 'I2':['a/aa/Button_sub_letter.png','Tiefgestellter Text (subscript)','<sub>','<\/sub>','Tiefgestellt'],
| |
β | 'J1':['5/58/Button_small.png','Kleingeschriebener Text (small)','<small>','<\/small>','Klein'],
| |
β | 'J2':['5/56/Button_big.png','GrΓΆΓerer Text (big)','<big>','<\/big>','GroΓ'],
| |
β | 'K':['b/b4/Button_category03.png','Kategorie',"[[Kategorie:","]]",'Name der Kategorie'],
| |
β | 'KR':['b/b1/Button_dagger.png','Kreuz','β ','',''],
| |
β | 'L':['8/8e/Button_shifting.png','Setze Tab(s)',':','',':'],
| |
β | 'M':['f/fd/Button_blockquote.png','Markiert ein Zitat mit Absatz','<blockquote style="border: 1px solid blue; padding: 2em;">\n','\n<\/blockquote>','Text'],
| |
β | 'N':['4/4b/Button_nbsp.png','GeschΓΌtztes Leerzeichen (nonbreaking space)',' ','',''],
| |
β | 'NT':['b/bf/Button_thinsp.png','Schmales geschΓΌtztes Leerzeichen',' ','',''],
| |
β | 'O':['2/23/Button_code.png','Code einfΓΌgen','<code>','<\/code>','Code'],
| |
β | 'P':['3/3c/Button_pre.png','Vorformatierter Text','<pre>','<\/pre>','PrΓ€formatierter Text'],
| |
β | 'P1':['9/93/Button_sub_link.png','Link zu einem Seiten-Abschnitt','[[Seite#',']]','Abschnitt'],
| |
β | 'PF':['f/ff/Button_arrow_right.png','Pfeil nach rechts','\u2192','',''],
| |
β | 'Q':['d/d3/Button_definition_list.png','Definitionsliste','\n; ',' : ','Text'],
| |
β | 'Q1':['0/05/Button_Anf%C3%BChrung.png','AnfΓΌhrungszeichen',"β","β",'Text'],
| |
β | 'R':['7/79/Button_reflink.png','Markiere eine Referenz','<ref>','<\/ref>','Bezugsangabe'],
| |
β | 'R1':['c/c4/Button_ref.png','Referenz mit Name','<ref name="">','<\/ref>','Bezugsangabe'],
| |
β | 'R2':['f/fe/Button_refs.png','Wiederholungs-Referenz','<ref name="','"/>','Referenzname'],
| |
β | 'R3':['9/9a/Button_references.png','Referenz-Footer','\n== Einzelnachweise ==\n<references/>\n','',''],
| |
β | 'RD':['7/70/Button_fusion.png','Redundanz','{{subst:Redundanz|','}}','Artikel1|Artikel2|Artikel3β¦'],
| |
β | 'SA':['b/bb/Seealso.png','Siehe auch','\n== Siehe auch ==\n','',''],
| |
β | 'SC':['0/02/Button_S_yellow.png','SourceCode hervorheben','<source lang="javascript">',"<\/source>",'Quelltext'],
| |
β | 'SM':['7/74/Button_oeil.png','Smiley','<tt style="background:#FE3">','</tt>',':D'],
| |
β | 'ST':['7/72/Button_span_2.png','span-tag mit CSS-Angabe','<span style="">','<\/span>','Markierter Inhalt'],
| |
β | 'T':['e/eb/Button_plantilla.png','Vorlage','{{','}}','Vorlagenname'],
| |
β | 'TL':['e/eb/Button_templatelink.png','Vorlagenlink','{{[[Vorlage:','|]]}}','Vorlagenname'],
| |
β | 'TT':['3/30/Tt_icon.png','Schreibmaschinenstil','<tt>','<\/tt>','Teletyper Text'],
| |
β | 'U':['f/fd/Button_underline.png','Unterstreichen',"<u>","<\/u>",'Unterstrichener Text'],
| |
β | 'UR':['e/ec/Button_aviso.png','Urheberrecht ungeklΓ€rt',"{{Urheberrecht ungeklΓ€rt}}","",''],
| |
β | 'URV':['9/9d/Button_halt.png','Urheberrechtsverletzung',"{{URV}} [","] " + usersignature,'Url'],
| |
β | 'V':['c/c8/Button_redirect.png','Weiterleitung (Redirect)',"#REDIRECT [[","]]",'Ziel einfΓΌgen'],
| |
β | 'VP':['b/ba/Button_conserver.png','Vote *pro*',"# {{pro}} " + usersignature,"",''],
| |
β | 'VC':['f/fc/Button_supp.png','Vote *contra*',"# {{contra}} " + usersignature,"",''],
| |
β | 'VN':['4/4e/Button_neutre.png','Vote *neutral*',"# {{neutral}} " + usersignature,"",''],
| |
β | 'WB':['6/61/Button_wikibooks.png','Wikibooks',"{{Wikibooks","}}",'|Seitenname'],
| |
β | 'WS':['e/eb/Button_wikisource.png','Wikisource',"{{Wikisource","}}",'|Seitenname'],
| |
β | 'WT':['b/bf/WP-icon.png','Wiktionary',"{{Wiktionary","}}",'|Seitenname'],
| |
β | 'WV':['b/b5/Button_wikiversity.png','Wikiversity',"{{Wikiversity","}}",'|Seitenname'],
| |
β | 'W':['8/88/Btn_toolbar_enum.png','Nummerierung',"\n# Element 1\n# Element 2\n# Element 3","",''],
| |
β | 'X':['1/11/Btn_toolbar_liste.png','Liste',"\n* Element A\n* Element B\n* Element C","",''],
| |
β | 'Y1':['c/ce/Button_no_include.png','No Include',"<noinclude>","<\/noinclude>",'Text'],
| |
β | 'Y2':['7/79/Button_include.png','Include only',"<includeonly>","<\/includeonly>",'Text'],
| |
β | 'Z':['3/35/Button_substitute.png','Substitute',"{{subst:","}}",'Vorlage'],
| |
β | 'ZI':['8/83/Button_biocitas.png','Zitat',"{{Zitat|","}}",'Text|Autor (optional)|Quelle (optional)'],
| |
β | 'T1':['c/c6/Blending_blue_button_background.png','Spacer (no function)','','',''],
| |
β | 'ZE':['a/ab/Button_100%25.png','einfache Tabelle','\n{| class="prettytable sortable" \n|- \n| 1 || 2\n|- \n| 3 || 4','\n|}\n','']
| |
β | };
| |
β |
| |
β | if (typeof customEditButtons!='string') // can be modified
| |
β | XEBOrder="A1,A,A3,PF,B,ZE,E,F,H,I1,I2,J1,M,O,P,Q,R,R1,R2,R3,TT,U,W,X,ZI".split(",");
| |
β | else if (customEditButtons.toLowerCase()=='all')
| |
β | for (b in BDict) XEBOrder.push(b);
| |
β | else XEBOrder=customEditButtons.split(",");
| |
β |
| |
β |
| |
β | function initButtons(){
| |
β | var bc,d;
| |
β | for (b in BDict) BDict[b][0] = Isrc+BDict[b][0]; // // Add the start of the URL (Isrc) to the XEB buttons
| |
β | // If the user has defined any buttons then add them into the available button lists
| |
β | if (typeof myButtons=='object')
| |
β | for (b in myButtons) BDict[b] = myButtons[b]; // custom user buttons
| |
β | // Add the media wiki standard buttons into the available buttons
| |
β | for (b in mwEditButtons) { // add standard buttons for full XEB order changing
| |
β | BDict[b]=[];
| |
β | // for (d in mwEditButtons[b])
| |
β | for (d in attributes) BDict[b].push(mwEditButtons[b][attributes[d]]);
| |
β | }
| |
β |
| |
β | // Build the new buttons
| |
β | for (i=0;i<XEBOrder.length;i++) {
| |
β | bc = BDict[XEBOrder[i]];
| |
β | //try { // catch not existing button names
| |
β | addCustomButton(bc[0],bc[1],bc[2],bc[3],bc[4]);
| |
β | //}
| |
β | // catch(e) {continue}
| |
β | }
| |
β | // Remove the default buttons (if requested by the user)
| |
β | eraseButtons();
| |
β | };
| |
β |
| |
β | //============================================================
| |
β | // Table generator
| |
β | //============================================================
| |
β | /** en: Generate an array using Mediawiki syntax
| |
β | * @author: originally from fr:user:dake
| |
β | * @version: 0.2 */
| |
β | function generateTable(caption, exhead, nbCol, nbRow, exfield, align){
| |
β | var code = "\n";
| |
β | code += '{| class="prettytable sortable" ' + align + '\n'
| |
β | + caption + exhead;
| |
β | if (exfield) code += '!\n';
| |
β | for (i=1;i<nbCol+1;i++) code += '! FELD ' + i + '\n';
| |
β | var items = 0;
| |
β | for (var j=0;j<nbRow;j++){
| |
β | if (exfield) {
| |
β | items++;
| |
β | code += '|-\n! style="background: #FFDDDD;"|ITEM ' + items + '\n';
| |
β | } else code += '|-\n';
| |
β | for (i=0;i<nbCol;i++) code += '| Element\n';
| |
β | }
| |
β | code += '|}\n';
| |
β | insertTags('','', code);
| |
β | editform.elements['wpSummary'].value+=' table+';
| |
β | return false
| |
β | };
| |
β |
| |
β |
| |
β | /** en: Open a popup with parameters to generate an array.
| |
β | * The number of rows/columns can be modified.
| |
β | * @author: originally fr:user:dake
| |
β | * @version: 0.2 */
| |
β | function popupTable(){
| |
β | var popup = window.open('about:blank','WPtable','height=400,width=400,scrollbars=yes');
| |
β | var javaCode = '<script type="text\/javascript">function insertCode(){'
| |
β | +'var caption = (document.paramForm.inputCaption.checked)?"\|\+ TABLE CAPTION \\n":""; '
| |
β | +'var exhead = (document.paramForm.inputHead.checked)?\'\|\- style=\"background: #DDFFDD;\"\\n\':""; '
| |
β | +'var row = parseInt(document.paramForm.inputRow.value); '
| |
β | +'var col = parseInt(document.paramForm.inputCol.value); '
| |
β | +'var exfield = document.paramForm.inputItems.checked; '
| |
β | +'var align = (document.paramForm.inputAlign.checked)?\'align="center"\':""; '
| |
β | +'window.opener.generateTable(caption,exhead,col,row,exfield,align); '
| |
β | +'window.close()}<\/script>';
| |
β |
| |
β | popup.document.write('<html><head><title>Make table<\/title>'
| |
β | // +'<script type="text\/javascript" src="\/skins-1.5\/common\/wikibits.js"><\/script>'
| |
β | //+'<style type="text\/css" media="screen,projection">/*<![CDATA[*/ @import "\/skins-1.5\/monobook\/main.css?5"; /*]]>*/<\/style>'
| |
β | + javaCode +'<\/head><body>'
| |
β | +'<p><b>Gib die Parameterwerte fΓΌr die Tabelle ein: <\/b><\/p><hr>'
| |
β | +'<form name="paramForm">'
| |
β | +'Tabellen Γberschrift: <input type="checkbox" name="inputCaption"><p\/>'
| |
β | +'Tabellen Ausrichtung: center<input type="checkbox" name="inputAlign"><p\/>'
| |
β | +'Tabellen Γberschrift: colored<input type="checkbox" name="inputHead"><p\/>'
| |
β | +'Anzahl von Zeilen: <input type="text" name="inputRow" value="3" size="2"><p\/>'
| |
β | +'Anzahl von Spalten: <input type="text" name="inputCol" value="3" size="2"><p\/>'
| |
β | +'Beschreibungsspalte: <input type="checkbox" name="inputItems" ><p\/>'
| |
β | +'<\/form"><hr>'
| |
β | +'<i>Die Standardtabelle erlaubt fΓΌr alle Felder nur Zahlen.<\/i><p\/>'
| |
β | +'<p><a href="javascript:insertCode()"> FΓΌge die Tabelle ein<\/a> |'
| |
β | +' <a href="javascript:self.close()">Abbruch<\/a><\/p>'
| |
β | +'<\/body><\/html>');
| |
β | popup.document.close();
| |
β | return false
| |
β | };
| |
β |
| |
β |
| |
β | /** en: Removes arbitrary standard buttons from the toolbar
| |
β | * @author: [[:de:User:Olliminatore]]
| |
β | * @version: 0.2 (01.10.2006) **/
| |
β | function eraseButtons(){
| |
β | if(typeof rmEditButtons!='object') return;
| |
β | if (typeof rmEditButtons[0] == 'string' && rmEditButtons[0].toLowerCase() == 'all')
| |
β | return mwEditButtons=[];
| |
β | //Remove the buttons the user doesn't want
| |
β | for(i=0;i<rmEditButtons.length;i++){
| |
β | var n=rmEditButtons[i]-i;
| |
β | if(n>=0 && n<mwEditButtons.length){
| |
β | if(n<mwEditButtons.length){
| |
β | var x = -1;
| |
β | while((++x)<mwEditButtons.length)
| |
β | if(x>=n)
| |
β | mwEditButtons[x] = mwEditButtons[x+1];
| |
β | }
| |
β | mwEditButtons.pop();
| |
β | }
| |
β | }
| |
β | };
| |
β |
| |
β | addOnloadHook(initButtons);
| |
β |
| |
β | // Adds extended onclick-function to some buttons
| |
β | function extendButtons(){
| |
β | if(!(allEditButtons = document.getElementById('toolbar'))) return false;
| |
β | if(typeof editform == 'undefined')
| |
β | if(!(window.editform = document.editform)) return false;
| |
β |
| |
β | XEBOrder.getIndex = function (item){
| |
β | if(is_gecko) return this.indexOf(item);
| |
β | else //is IE (Opera < 9)
| |
β | for (var i=0;i < this.length;i++) if (this[i]==item) return Number(i);
| |
β | return -1
| |
β | }
| |
β | var searchbox = allEditButtons.getElementsByTagName('span')[0];
| |
β | if (searchbox) allEditButtons.appendChild(searchbox) // pay Zocky/Search Box
| |
β |
| |
β | allEditButtons = allEditButtons.getElementsByTagName('img');
| |
β |
| |
β | var bu_len = mwEditButtons.length;
| |
β | var c=0;
| |
β |
| |
β | if(!allEditButtons.length) return false;
| |
β |
| |
β | // own signature
| |
β | if (bu_len>0){
| |
β | if(typeof rmEditButtons=='object' && rmEditButtons.pop()==10) c=1;
| |
β | mwEditButtons[bu_len-2+c].tagOpen=usersignature;
| |
β | if(usersignature != '-- \~\~\~\~')
| |
β | allEditButtons[bu_len-1+c].src=Isrc+'d/d1/Button_mysignature.png';
| |
β | }
| |
β |
| |
β | // table
| |
β | if((c=XEBOrder.getIndex('F')) != -1) allEditButtons[bu_len+c].onclick=popupTable;
| |
β |
| |
β | // redirect
| |
β | c=XEBOrder.getIndex('V');
| |
β | if(c != -1)
| |
β | allEditButtons[bu_len+c].onclick=function(){
| |
β | if (a = window.prompt("Wohin soll der Redirect\?", "")) {
| |
β | a = '\#REDIRECT \[\[' + a + '\]\]';
| |
β | editform.wpTextbox1.value=a;
| |
β | editform.wpSummary.value=a; // not more needed?
| |
β | editform.wpWatchthis.checked=false
| |
β | }
| |
β | };
| |
β |
| |
β | // spacer width
| |
β | if((c = XEBOrder.getIndex('T1')) != -1) allEditButtons[bu_len+c].width = 6;
| |
β | };
| |
β |
| |
β | if(!wgIsArticle) // only if edit
| |
β | hookEvent("load", extendButtons);
| |
β |
| |
β | /* ######################################################
| |
β | Toggles the display of elements on a page
| |
β | Author/contact: Austin Che http://openwetware.org/wiki/User:Austin_J._Che
| |
β | See http://openwetware.org/wiki/OpenWetWare:Toggle for examples and documentation
| |
β | ######################################################*/
| |
β |
| |
β | // indexed array of toggler ids to array of associated toggle operations
| |
β | // each operation is a two element array, the first being the type, the second a class name or array of elements
| |
β | // operation types are strings like "_reset" or "" for the default toggle operation
| |
β | var togglers = new Array();
| |
β | var allClasses = new Object(); // associative map of class names to page elements
| |
β |
| |
β | function toggler(id)
| |
β | {
| |
β | var toBeToggled = togglers[id];
| |
β | if (!toBeToggled)
| |
β | return;
| |
β |
| |
β | // if some element is in list more than once, it will be toggled multiple times
| |
β | for (var i = 0; i < toBeToggled.length; i++)
| |
β | {
| |
β | // get array of elements to operate on
| |
β | var toggles = toBeToggled[i][1];
| |
β | if (typeof(toggles) == "string")
| |
β | {
| |
β | if (toggles.charAt(0) == '-')
| |
β | {
| |
β | // treat as an element ID, not as class
| |
β | toggles = document.getElementById(toggles.substring(1));
| |
β | if (toggles)
| |
β | toggles = new Array(toggles);
| |
β | }
| |
β | else
| |
β | toggles = allClasses[toggles];
| |
β | }
| |
β | if (!toggles || !toggles.length)
| |
β | continue;
| |
β |
| |
β | var op = toBeToggled[i][0]; // what the operation will be
| |
β |
| |
β | switch (op)
| |
β | {
| |
β | case "_reset":
| |
β | for (var j in toggles)
| |
β | toggles[j].style.display = toggles[j]._toggle_original_display;
| |
β | break;
| |
β | case "_show":
| |
β | for (var j in toggles)
| |
β | toggles[j].style.display = '';
| |
β | break;
| |
β | case "_hide":
| |
β | for (var j in toggles)
| |
β | toggles[j].style.display = 'none';
| |
β | break;
| |
β | case "":
| |
β | default:
| |
β | // Toggle
| |
β | for (var j in toggles)
| |
β | toggles[j].style.display = ((toggles[j].style.display == 'none') ? '' : 'none');
| |
β | break;
| |
β | }
| |
β | }
| |
β | }
| |
β |
| |
β | function createTogglerLink(toggler, id)
| |
β | {
| |
β | var toggle = document.createElement("a");
| |
β | toggle.className = 'toggler-link';
| |
β | toggle.setAttribute('id', 'toggler' + id);
| |
β | toggle.setAttribute('href', 'javascript:toggler("' + id + '");');
| |
β | var child = toggler.firstChild;
| |
β | toggler.removeChild(child);
| |
β | toggle.appendChild(child);
| |
β | toggler.insertBefore(toggle, toggler.firstChild);
| |
β | }
| |
β |
| |
β | function toggleInit()
| |
β | {
| |
β | var togglerElems = new Array();
| |
β | var toggleGroup = new Array();
| |
β |
| |
β | // initialize/clear any old information
| |
β | togglers = new Array();
| |
β | allClasses = new Object();
| |
β |
| |
β | // make list of all document classes
| |
β | var elems = document.getElementsByTagName("*");
| |
β | var numelems = elems.length;
| |
β | for (var i = 0; i < elems.length; i++)
| |
β | {
| |
β | var elem = elems[i];
| |
β | if (!elem.className)
| |
β | continue;
| |
β |
| |
β | elem._toggle_original_display = elem.style.display;
| |
β | var togglerID = -1;
| |
β | var elemClasses = elem.className.split(' '); // get list of classes
| |
β | for (var j = 0; j < elemClasses.length; j++)
| |
β | {
| |
β | var elemClass = elemClasses[j];
| |
β | if (! allClasses[elemClass])
| |
β | allClasses[elemClass] = new Array();
| |
β | allClasses[elemClass].push(elem);
| |
β |
| |
β | // all the special classes begin with _toggle
| |
β | if (elemClass.substring(0, 7) != "_toggle")
| |
β | continue;
| |
β |
| |
β | if (elemClass == "_togglegroup")
| |
β | toggleGroup = new Array();
| |
β | else if (elemClass == "_toggle")
| |
β | toggleGroup.push(elem);
| |
β | else if (elemClass.substring(0, 12) == "_toggle_init")
| |
β | {
| |
β | // set initial value for display (ignore the original CSS set value)
| |
β | // understands _toggle_initshow and _toggle_inithide
| |
β | var disp = elemClass.substring(12);
| |
β | if (disp == "show")
| |
β | elem.style.display = '';
| |
β | else if (disp == "hide")
| |
β | elem.style.display = 'none';
| |
β | elem._toggle_original_display = disp;
| |
β | }
| |
β | else if (elemClass.substring(0, 8) == "_toggler")
| |
β | {
| |
β | if (togglerID == -1)
| |
β | {
| |
β | togglerID = togglers.length;
| |
β | togglers[togglerID] = new Array();
| |
β | togglerElems[togglerID] = elem;
| |
β | }
| |
β |
| |
β | // all classes are of form _toggler_op-CLASS
| |
β | // figure out what class we're toggling
| |
β | // if none is specified, then we use the current toggle group
| |
β | var toBeToggled;
| |
β | var hyphen = elemClass.indexOf('-');
| |
β | if (hyphen != -1)
| |
β | toBeToggled = elemClass.substring(hyphen+1);
| |
β | else
| |
β | {
| |
β | toBeToggled = toggleGroup;
| |
β | hyphen = elemClass.length;
| |
β | }
| |
β |
| |
β | var op = elemClass.substring(8, hyphen);
| |
β | togglers[togglerID].push(new Array(op, toBeToggled));
| |
β | }
| |
β | }
| |
β | }
| |
β |
| |
β | // add javascript links to all toggler elements
| |
β | for (var i = 0; i < togglerElems.length; i++)
| |
β | createTogglerLink(togglerElems[i], i);
| |
β | }
| |
β |
| |
β | addOnloadHook(toggleInit);
| |
β |
| |
β | // </syntax>
| |