MediaWiki:Onlyifediting.js
Qiyofa
Eʼtibor bering: Oʻzgartirishlaringizni koʻrish uchun, yangi moslamalaringizning saqlashdan keyin, brauzer keshini tozalash kerak:
Mozilla / Firefox: Ctrl+Shift+R, IE: Ctrl+F5, Safari: Cmd+Shift+R, Konqueror: F5, Opera: Tools → Preferences orqali keshni tozalang.
/*
See also [[MediaWiki:Monobook.js]]
<pre><nowiki>
*/
//============================================================
//
// Barre d'outil
//
//============================================================
//============================================================
// Générateur de tableaux
//============================================================
/**
*
* 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 += '{| class="wikitable"\n';
} else {
code += '{| border="' + border + '"\n';
code += '|+ Jadval - Жадвал\n';
}
for (var i=0;i<nbCol;i++) code += '! sarlavha ' + i + '\n'
for (var j=0;j<nbRow;j++) {
if ((j+1)%2==0 && styleLine==1) {
code += '|-bgcolor="#EFEFEF"\n'
} else {
code += '|-----\n'
}
for (var i=0;i<nbCol;i++) code += '| uya\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>Jadval strukturasi</title>');
popup.document.write(javaCode);
popup.document.write('</head><body>');
popup.document.write('<p>Jadval xossalarini kiriting : </p>');
popup.document.write('<form name="paramForm">');
popup.document.write('Satrlar soni: <input type="text" name="inputRow" value="3" ><p>');
popup.document.write('Ustunlar soni: <input type="text" name="inputCol" value="3" ><p>');
popup.document.write('Hoshiya qalinligi: <input type="text" name="inputBorder" value="1" ><p>');
popup.document.write('Sarlavha foni boʻyalsin: <input type="checkbox" name="inputHeader" checked="1" ><p>');
popup.document.write('Satrlar ola boʻlsin: <input type="checkbox" name="inputLine" checked="1" ><p>');
popup.document.write('</form">');
popup.document.write('<p><a href="javascript:insertCode()"> Jadvalni tayyorla</a></p>');
popup.document.write('<p><a href="javascript:self.close()"> Bu oynani yop</a></p>');
popup.document.write('</body></html>');
popup.document.close();
}
function marque_tab()
{
var toolbar = document.getElementById('toolbar');
if (!toolbar) return false;
var textbox = document.getElementById('wpTextbox1');
if (!textbox) return false;
if (!document.selection && textbox.selectionStart == null)
return false;
var image = document.createElement("img");
image.width = 23;
image.height = 22;
image.src = '//upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png';
image.border = 0;
image.alt = 'Jadval - жадвал';
image.title = 'Jadval - жадвал';
image.style.cursor = "pointer";
image.onclick = function() {
popupTableau();
return false;
}
toolbar.appendChild(image);
}
$(marque_tab);
// ============================================================
// Optionen für das Sonderzeichenmenü in [[MediaWiki:Edittools]]
// wird in [[MediaWiki:Monobook.js]] ganz unten eingebunden
/* add menu for selecting subsets of secial characters */
/***** must match MediaWiki:Edittools *****/
function addCharSubsetMenu() {
var specialchars = document.getElementById('specialchars');
if (specialchars) {
var menu = "<select id=\"charsetBox\" style=\"display:inline\" onkeyup=\"chooseCharSubset(selectedIndex)\" onChange=\"chooseCharSubset(selectedIndex)\">";
menu += "<option>Арнайы нышандар</option>";
menu += "<option>Математика</option>";
menu += "<option>IPA</option>";
menu += "<option>Араб жазуы</option>";
menu += "<option>Грек жазуы</option>";
menu += "<option>Идишше</option>";
menu += "<option>Иероглифтер</option>";
menu += "<option>Индоеуропеистика</option>";
menu += "<option>Көне-ағылшынша</option>";
menu += "<option>Латын/Роман жазуы</option>";
menu += "<option>Пин-ин</option>";
menu += "<option>Ромадзи</option>";
menu += "<option>Славян кирилл жазуы</option>";
menu += "<option>Славян латын жазуы</option>";
menu += "<option>Түркі кирилл жазуы</option>";
menu += "<option>Түркі латын жазуы</option>";
menu += "<option>Эсперанто</option>";
menu += "</select>";
specialchars.innerHTML = menu + specialchars.innerHTML;
/* default subset - try to use a cookie some day */
chooseCharSubset(0);
}
}
/* select subsection of special characters */
function chooseCharSubset(s) {
var l = document.getElementById('specialchars').getElementsByTagName('p');
for (var i = 0; i < l.length ; i++) {
l[i].style.display = i == s ? 'inline' : 'none';
l[i].style.visibility = i == s ? 'visible' : 'hidden';
}
}
$(addCharSubsetMenu);
/*
</nowiki></pre>
*/