MediaWiki:Common.js/edit.js
Dėmesio: Išsaugojus jums gali prireikti išvalyti jūsų naršyklės podėlį, kad pamatytumėte pokyčius.
- Firefox / Safari: Laikydami Shift pasirinkite Perkrauti, arba paspauskite Ctrl-F5 ar Ctrl-R (sistemoje Apple Mac ⌘-R)
- Google Chrome: Spauskite Ctrl-Shift-R (sistemoje Apple Mac ⌘-Shift-R)
- Internet Explorer / Edge: Laikydami Ctrl paspauskite Naujinti, arba paspauskite Ctrl-F5
- Opera: Eikite į Meniu → Nuostatos (sistemoje Apple Mac Opera → Nustatymai), tuomet Privatumas ir sauga → išvalyti naršymo podėlį → išsaugotos talpyklos vaizdai ir failai.
//if ( typeof $j != 'undefined' && typeof $j.fn.wikiEditor != 'undefined' ) {
// Execute on load
//$j( function() {
// To add a button to an existing toolbar group:
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'main',
'group': 'insert',
'tools': {
'linkold': {
label: 'Nuoroda (seno tipo)', // or use labelMsg for a localized label, see above
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/c/c0/Button_link.png',
action: {
type: 'encapsulate',
options: {
pre: "[[", // text to be inserted
'periMsg': 'wikieditor-toolbar-tool-ilink-example',
post: "]]"
}
}
},
'kab': {
label: 'Kabutės', // or use labelMsg for a localized label, see above
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/2/23/Quotes-Lithuanian.png',
action: {
type: 'encapsulate',
options: {
pre: "„", // text to be inserted
post: "“"
}
}
},
'bru': {
label: 'Brūkšnys', // or use labelMsg for a localized label, see above
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/2/2c/Norwegian_ndash_sign.png',
action: {
type: 'encapsulate',
options: {
pre: "–" // text to be inserted
}
}
}
}
} );
// To add a button to an existing toolbar group:
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'advanced',
'group': 'format',
'tools': {
'perb': {
label: 'Perbraukti', // or use labelMsg for a localized label, see above
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png',
action: {
type: 'encapsulate',
options: {
pre: "<s>", // text to be inserted
post: "</s>"
}
}
},
'Komen': {
label: 'Komentarai', // or use labelMsg for a localized label, see above
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png',
action: {
type: 'encapsulate',
options: {
pre: "<!-- ", // text to be inserted
post: " -->"
}
}
}
}
} );
// To add a button to an existing toolbar group:
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'advanced',
'group': 'insert',
'tools': {
'kateg': {
label: 'Kategorija', // or use labelMsg for a localized label, see above
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/1/11/Button_category.png',
action: {
type: 'encapsulate',
options: {
pre: "[[Kategorija:", // text to be inserted
periMsg: 'Kategorija',
post: "]]",
ownline: true
}
}
}
}
} );
// To add a toolbar section:
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'sablonai': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'Šablonai'
// or 'labelMsg': 'section-emoticons-label' for a localized label
}
}
} );
// To add a group to an existing toolbar section:
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'sablonai',
'groups': {
'zymes': {
'label': 'Žymės' // or use labelMsg for a localized label, see above
}
}
} );
// To add a button to an existing toolbar group:
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'sablonai',
'group': 'zymes',
'tools': {
'tvark': {
label: 'Tvarkymui', // or use labelMsg for a localized label, see above
'type': 'select',
'list': {
'trinti' : {
label: 'Trinti', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Trinti|", // text to be inserted
periMsg: 'Priežastis',
post: "}}",
ownline: true
}
}
},
'tvarkyti' : {
label: 'Tvarkyti', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Tvarkyti|", // text to be inserted
periMsg: 'Priežastis',
post: "}}",
ownline: true
}
}
},
'neplaningai' : {
label: 'Parašyta neplaningai', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Parašyta neplaningai|", // text to be inserted
periMsg: 'Priežastis',
post: "}}",
ownline: true
}
}
},
'vikizuoti' : {
label: 'Vikizuoti', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Vikizuoti|", // text to be inserted
periMsg: 'Priežastis',
post: "}}",
ownline: true
}
}
},
'klaidos' : {
label: 'Klaidos', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Klaidos|", // text to be inserted
periMsg: 'Priežastis',
post: "}}",
ownline: true
}
}
},
'beviltiskas' : {
label: 'Beviltiškas', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Beviltiškas|", // text to be inserted
periMsg: 'Priežastis',
post: "}}",
ownline: true
}
}
},
'kontekstas' : {
label: 'Kontekstas', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Kontekstas|", // text to be inserted
periMsg: 'Priežastis',
post: "}}",
ownline: true
}
}
},
'abejotinas' : {
label: 'Abejotinas', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Abejotinas|", // text to be inserted
periMsg: 'Priežastis',
post: "}}",
ownline: true
}
}
},
'atnaujinti' : {
label: 'Atnaujinti', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Atnaujinti|", // text to be inserted
periMsg: 'Priežastis',
post: "}}",
ownline: true
}
}
},
'demesio' : {
label: 'Dėmesio', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Dėmesio|", // text to be inserted
periMsg: 'Priežastis',
post: "}}",
ownline: true
}
}
},
'copyvio' : {
label: 'Teisių pažeidimas', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Copyvio|", // text to be inserted
periMsg: 'Šaltinis',
post: "}}",
ownline: true
}
}
},
'pov' : {
label: 'Neutralumas', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{POV|", // text to be inserted
periMsg: 'Priežastis',
post: "}}",
ownline: true
}
}
},
'kategorizuoti' : {
label: 'Kategorizuoti', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Kateg}}", // text to be inserted
ownline: true
}
}
}
}
},
'nuorod': {
label: 'Nuorodiniams', // or use labelMsg for a localized label, see above
'type': 'select',
'list': {
'disambig' : {
label: 'Nuorodinis', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Nuorodinis}}", // text to be inserted
ownline: true
}
}
},
'pavard' : {
label: 'Pavardė', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Pavardė}}", // text to be inserted
ownline: true
}
}
},
'reiksmes' : {
label: 'Reikšmės', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: "{"+"{Reikšmės|", // text to be inserted
periMsg: 'žodis',
post: "}}",
ownline: true
}
}
}
}
}
}
} );
// To add a group to an existing toolbar section:
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'sablonai',
'groups': {
'infolent': {
'label': 'Info lentelės' // or use labelMsg for a localized label, see above
}
}
} );
// To add a button to an existing toolbar group:
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'sablonai',
'group': 'infolent',
'tools': {
'biograf': {
label: 'Įstatyti', // or use labelMsg for a localized label, see above
'type': 'select',
'list': {
'FC' : {
label: 'Futbolo klubas', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre:
'{'+'{futkom\n' +
'|fed=\n' +
'|kod=\n' +
'|iku=\n' +
'|mst=\n' +
'|lyga=\n' +
'|nuo=\n' +
'}'+'}\n' +
'\n' +
'==Istorija==\n' +
'{{fkp|\n' +
'\n' +
'== varžybos==\n' +
'{{sezonai}}\n' +
'\n' +
'{{komlyg}}\n', // text to be inserted
ownline: true
}
}
},
'Lygsez' : {
label: 'Lygos sezonas', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre:
'{'+'{varsez\n' +
'|fed=\n' +
'|tip=\n' +
'|met=\n' +
'|uef=\n' +
'}'+'}\n' +
'\n' +
'==Lyga==\n', // text to be inserted
ownline: true
}
}
},
'Tausez' : {
label: 'Taurės sezonas', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre:
'{'+'{varsez\n' +
'|fed=\n' +
'|tip=\n' +
'|met=\n' +
'|uef=\n' +
'}'+'}\n' +
'\n' +
'==Turnyras==\n', // text to be inserted
ownline: true
}
}
},
'player' : {
label: 'Žaidėjas', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre:
'{'+'{player\n' +
'|iw=en:\n' +
'|ltu=\n' +
'|var=\n' +
'|pav=\n' +
'|fot=\n' +
'|fed=\n' +
'|gim=\n' +
'|gvt=\n' +
'|poz=\n' +
'|rin=\n' +
'|met=\n' +
'|run=\n' +
'|iva=\n' +
'|k1=|m1=\n' +
'|k2=|m2=\n' +
'|k3=|m3=\n' +
'|k4=|m4=\n' +
'|k5=|m5=\n' +
'|k6=|m6=\n' +
'|k7=|m7=\n' +
'|k8=|m8=\n' +
'|k9=|m9=\n' +
'|k10=|m10=\n' +
'|tk1=|tm1=\n' +
'|tk2=|tm2=\n' +
'|tk3=|tm3=\n' +
'|tk4=|tm4=\n' +
'|tk5=|tm5=\n' +
'|tk6=|tm6=\n' +
'|tk7=|tm7=\n' +
'|tk8=|tm8=\n' +
'|tk9=|tm9=\n' +
'|tk10=|tm10=\n' +
'}'+'}\n' +
'\n', // text to be inserted
ownline: true
}
}
},
'miestas' : {
label: 'Miestas', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre: '{'+'{miestas\n' +
'|iw=en:\n' +
'|pla=\n' +
'|ilg=\n' +
'|ofi=\n' +
'|val=\n' +
'|reg=\n' +
'|gyv=\n' +
'|met=\n' +
'}'+'}\n' +
'\n' +
'{{miestas/q}}\n', // text to be inserted
ownline: true
}
}
}
}
},
'npage': {
label: 'Naujas pus.', // or use labelMsg for a localized label, see above
'type': 'select',
'list': {
'nFC' : {
label: 'Futbolo klubas', // or use labelMsg for a localized label, see above
action: {
type: 'encapsulate',
options: {
pre:
'{'+'{futkom\n' +
'|fed=\n' +
'|kod=\n' +
'|iku=\n' +
'|mst=\n' +
'|lyga=\n' +
'|nuo=\n' +
'}'+'}\n' +
'\n' +
'==Istorija==\n' +
'{{fkp|\n' +
'\n' +
'== varžybos==\n' +
'{{sezonai}}\n', // text to be inserted
ownline: true
}
}
}
}
}
}
} );
//} );
//}
//*importScript("MediaWiki:Wikificator.js")*/
function wgImg(img){
return /^http:/i.test(img) ? img : 'http://upload.wikimedia.org/wikipedia/'+img
}
mwCustomEditButtons['wikif'] = [function(){Wikify()}, 'commons/0/06/Wikify-toolbutton.png', 'Vikifikatorius — automatinis teksto apdorojimas']
var _cnt
if ($.wikiEditor){
appendCSS('#local-toolbar {height:26px; border-right:1px solid #ddd;\
margin:3px; padding-right:6px} #local-toolbar img {padding:2px}')
_cnt = '#wikiEditor-ui-toolbar'
}else if (document.getElementById('toolbar')){
_cnt = '#toolbar'
// importMW('ToolbarOld')
}else{ //no toolbar
_cnt = '#editform'
appendCSS('#local-toolbar img {border:1px outset gray; background:#ddd; margin:2px; height:22px}')
}
addOnloadHook(function(){
//attach local toolbar
$('<div id=local-toolbar style="float:left" />')
.prependTo(_cnt)
//attach local buttons
for (var id in mwCustomEditButtons){
var b = mwCustomEditButtons[id]
if (!b.length) continue
attachFuncBtn(id, b[0], b[1], b[2])
}
})
function attachFuncBtn(id, func, img, tip){
$('<img id="'+id+'" src="'+wgImg(img)+'" style="cursor:pointer" '
+'title="'+tip+'" alt="'+tip.substr(0,3)+'" />')
.appendTo('#local-toolbar')
.click(func)
}
function addFuncBtn(id, func, img, tip){
if (document.getElementById('local-toolbar'))
attachFuncBtn(id, func, img, tip)
else
mwCustomEditButtons[id] = [func, img, tip]
}
//============================================================
//
// Įrankių juosta
//
//============================================================
//============================================================
// Lentelės šablonas
//============================================================
/**
*
* 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 += '{'+'{lentelės viršus}'+'}\n';
} else {
code += '{| border="' + border + '"\n';
code += '|+ Lentelės pavadinimas\n';
}
for (var i=0;i<nbCol;i++) code += '! antraštė ' + i + '\n'
for (var j=0;j<nbRow;j++) {
if ((j+1)%2==0 && styleLine==1) {
code += '|-{'+'{pilka eilutė}'+'}\n'
} else {
code += '|-----\n'
}
for (var i=0;i<nbCol;i++) code += '| celė\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>Lentelės įterpimas</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>Prašome pasirinkti įterpiamos lentelės parametrus: </p>');
popup.document.write('<form name="paramForm"><table border=0>');
popup.document.write('<tr><td>Eilučių skaičius:</td><td><input type="text" name="inputRow" value="3" ></td></tr>');
popup.document.write('<tr><td>Stulpelių skaičius:</td><td><input type="text" name="inputCol" value="3" ></td></tr>');
popup.document.write('<tr><td>Linijos storis:</td><td><input type="text" name="inputBorder" value="1" ></td></tr>');
popup.document.write('<tr><td>Paryškinta antraštinė eilutė:</td><td><input type="checkbox" name="inputHeader" checked="1" ></td></tr>');
popup.document.write('<tr><td>Keisti spalvą (kas antrą eilutę):</td><td><input type="checkbox" name="inputLine" checked="1" ></td></tr>');
popup.document.write('</table></form">');
popup.document.write('<p><a href="javascript:insertCode()">Įterpti kodą</a></p>');
popup.document.write('<p><a href="javascript:self.close()">Uždaryti</a></p>');
popup.document.write('</body></html>');
popup.document.close();
}
//============================================================
// Papildomų ikonų pridėjimas įrankių juostoje
//============================================================
//Remplit la variable mwCustomEditButtons (voir /skins-1.5/commons/wikibits.js) pour ajouter des boutons à la barre d'outils
/*function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText)
{
if (mwCustomEditButtons) {
mwCustomEditButtons.push(
{"imageFile": imageFile,
"speedTip": speedTip,
"tagOpen": tagOpen,
"tagClose": tagClose,
"sampleText": sampleText});
}
}
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/2/23/Quotes-Lithuanian.png','Kabutės',"„","“",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/2/2c/Norwegian_ndash_sign.png','Brūkšnys',"–","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png','Perbraukti',"<s>","</s>",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png','Nauja eilutė',"<br />","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png','Pakeltas tekstas',"<sup>","</sup>",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png','Nuleistas tekstas',"<sub>","</sub>",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/8/88/Btn_toolbar_enum.png','Sąrašas',"\n# elementas 1\n# elementas 2\n# elementas 3","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/1/11/Btn_toolbar_liste.png','Vardijimas',"\n* elementas A\n* elementas B\n* elementas C","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/9/9e/Btn_toolbar_gallery.png','Iliustracijų galerija',"\n<gallery>\nImage:M63.jpg|[[M63]]\nImage:Mona Lisa.jpg|[[La Joconde]]\nImage:Truite arc-en-ciel.jpg|Une [[truite]]\n</gallery>","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png','Komentarai',"<!--","-->",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/1/11/Button_category.png','Kategorija',"[[Kategorija:","]]",'kategorijos pavadinimas');
addCustomButton('http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png','Nukreipimas',"#REDIRECT [[","]]",'straipsnio pavadinimas');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png','Išnaša',"<ref>","</ref>",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/b/b5/Button_mini_stub.png','Straipsnio šablonas',"'''", "''' - <!-- apibrėžimas -->\n\n[[Category:]]<!-- po dvitaškio įrašykite kategoriją -->\n[[en:]]<!-- po dvitaškio įrašykite angliško straipsnio pavadinimą -->", '{'+'{subst:PAGENAME}'+'}');
//Ressemble à la fonction de /skins-1.5/commons/wikibits.js pour insérer un autre lien que insertTags
function marque_tab()
{
var toolbar = document.getElementById('toolbar');
if (!toolbar) return false;
var textbox = document.getElementById('wpTextbox1');
if (!textbox) return false;
try{
if (!document.selection && textbox.selectionStart == null)
return false;
}
catch (e){
return false;
}
var image = 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 = 'Lentelė';
image.title = 'Lentelė';
image.style.cursor = "pointer";
image.onclick = function() {
popupTableau();
return false;
}
toolbar.appendChild(image);
}
addLoadEvent(marque_tab);
*/