MediaWiki:Extraeditbuttons.js: відмінності між версіями

доповнення, оновлення даних (тест)
Немає опису редагування
 
(Не показано 3 проміжні версії ще одного користувача)
Рядок 93: Рядок 93:
mwCustomEditButtons[mwCustomEditButtons.length] = {
mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/e/ea/Button_align_left.png",
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/e/ea/Button_align_left.png",
     "speedTip": "Вирівняти зліва",
     "speedTip": "Вирівняти по лівому краю",
     "tagOpen": "<div style='text-align: left; direction: ltr; margin-left: 1em;'>\n",
     "tagOpen": "<div style='text-align: left; direction: ltr; margin-left: 1em;'>\n",
     "tagClose": "\n</div>",
     "tagClose": "\n</div>",
Рядок 106: Рядок 106:
//Right-Text Button
//Right-Text Button
mwCustomEditButtons[mwCustomEditButtons.length] = {
mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.uncyc.org/uk/a/a5/Button_align_right.png",
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/a/a5/Button_align_right.png",
     "speedTip": "Вирівняти зправа",
     "speedTip": "Вирівняти по правому краю",
     "tagOpen": "<div style='text-align: right;'>\n",
     "tagOpen": "<div style='text-align: right;'>\n",
     "tagClose": "\n</div>",
     "tagClose": "\n</div>",
Рядок 190: Рядок 190:
}
}
addOnloadHook( InsertButtonsToToolBar );
addOnloadHook( InsertButtonsToToolBar );
// </nowiki></pre>
/**
*
* 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 popupTable()
{
  var popup = window.open('','name','height=180,width=300,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 bord = 0; '
  javaCode += 'var styleHeader = false; '
  javaCode += 'var styleLine = false; '
  javaCode += 'var exfield = false; '
  javaCode += 'var align = document.paramForm.inputAlign.value; '
  javaCode += 'var padding = false; '
  javaCode += 'window.opener.generateTableau(col,row,bord,styleHeader,styleLine,exfield,align,padding); '
  javaCode += "alert('Таблиця створена!'); "
  javaCode += 'window.close(); '
  javaCode += '}<\/script>';
  popup.document.write('<html><head><title>Створення таблиці</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>Введіть параметри таблиці: </p>');
  popup.document.write('<form name="paramForm">');
  popup.document.write('Вирівнювання&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <input type="text" name="inputAlign" value="center" ><p>');
  popup.document.write('Кількість рядків&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <input type="text" name="inputRow" value="3" ><p>');
  popup.document.write('Кількість стовпчиків: <input type="text" name="inputCol" value="3" ><p>');
  popup.document.write('</form">');
  popup.document.write('<p><a href="javascript:insertCode()">Вставити таблицю</a>    |');
  popup.document.write('    <a href="javascript:self.close()">Відмінити (зачинити вікно)</a></p>');
  popup.document.write('</body></html>');
  popup.document.close();
}