Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//============================================================// Table generator//============================================================/** * * English: Generate an array using Mediawiki syntax * * @author: fr:user:dake (language conversion and new options added by en:user:Voice of All) * @version: 0.1 */functiongenerateTable(nbCol,nbRow,exfield){code='\n{| class="wikitable"\n';code+="|+ TABLE CAPTION <!-- if required -->\n";if(exfield==true)code+='!\n';for(vari=1;i<nbCol+1;i++)code+='! FIELD '+i+'\n';varitems=0;for(varj=0;j<nbRow;j++){if(exfield==true){items++;code+='|-\n'code+='! ITEM '+items+'\n';}elseif(exfield==false){code+='|-\n'}for(vari=0;i<nbCol;i++)code+='| element\n';}code+='|}\n';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 */functionpopupTable(){varpopup=window.open('about:blank','WPtable','height=350,width=400,scrollbars=yes');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 exfield = document.paramForm.inputItems.checked; ';javaCode+='window.opener.generateTable(col,row,exfield);';javaCode+='window.close(); 'javaCode+='}<\/script>';popup.document.write('<html><head><title>Make table</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\/wikistandard\/main.css?5"; /*]]>*/<\/style>');popup.document.write(javaCode);popup.document.write('</head><body>');popup.document.write('<p>Enter the table parameters below: </p>');popup.document.write('<form name="paramForm">');popup.document.write('Number of rows: <input type="text" name="inputRow" value="3" ><p>');popup.document.write('Number of columns: <input type="text" name="inputCol" value="3" ><p>');popup.document.write('Item column: <input type="checkbox" name="inputItems" ><p>');popup.document.write('</form">');popup.document.write('<i>The default table contains one row of fields.</i><p>');popup.document.write('Check "Item column" to give the table a field row <i>and</i> an item column.</i><p>');popup.document.write('<p><a href="javascript:insertCode()"> Insert table</a> |');popup.document.write(' <a href="javascript:self.close()">Cancel</a></p>');popup.document.write('</body></html>');popup.document.close();}//Ressemble à la fonction de /skins-1.5/commons/wikibits.js pour insérer un autre lien que insertTagsfunctiontable_button(){vartoolbar=document.getElementById('toolbar');if(!toolbar)returnfalse;vartextbox=document.getElementById('wpTextbox1');if(!textbox)returnfalse;if(!document.selection&&textbox.selectionStart==null)returnfalse;varimage=document.createElement("img");image.width=23;image.height=22;image.src='http://upload.wikimedia.org/wikipedia/commons/0/04/Button_array.png';image.border=0;image.alt='Table';image.title='Make table';image.style.cursor="pointer";image.onclick=function(){popupTable();returnfalse;}toolbar.appendChild(image);}// Changes made on Sat, 30 Sep 2006 20:28 UTC, seems to work on IEaddOnloadHook(table_button);