МедиаУики:Gadget-entry-wizard.js
Көрініс
Ескерту: жариялаудан кейін өзгертістерді көру үшін браузеріңіздің кэшін тазарту керек болуы мүмкін.
- Firefox / Safari: Reload басқанда Shift ұстап тұрыңыз немесе Ctrl-F5 не Ctrl-R басыңыз (Mac-та ⌘-R)
- Google Chrome: Ctrl-Shift-R басыңыз (Mac-та ⌘-Shift-R)
- Internet Explorer / Edge: Жаңарту дегенді басқанда Ctrl ұстап тұрыңыз немесе Ctrl-F5 басыңыз
- Opera: Ctrl-F5 басыңыз.
/*
See also:
*[[MediaWiki:Monobook.js]]
*[[MediaWiki:Translit.js]]
<pre>
*/
/*</pre>
<pre>*/
/*</pre>
/*
</pre>
=== generate_entry() ===
<pre>*/
function generate_entry(srclang,def,pos,ex,syn,ant,lang1,trans1,lang2,trans2,lang3,trans3,cat)
{
code="";
if (srclang)
{
if (srclang=="other") code +='== (тіл аты) ==';
else code +='{{'+srclang+'}}\n';
}
switch(pos)
{
case 0: break;
case 1: code += '{{Зат есім|'+srclang+'}}\n';break;
case 2: code += '{{Етістік|'+srclang+'}}\n';break;
case 3: code += '{{Сын есім|'+srclang+'}}\n';break;
case 4: code += '{{Сан есім|'+srclang+'}}\n';break;
case 5: code += '{{Есімдік|'+srclang+'}}\n';break;
case 6: code += '{{Үстеу|'+srclang+'}}\n';break;
case 7: code += '{{Шылау|'+srclang+'}}\n';break;
case 8: code += '{{Одағай|'+srclang+'}}\n';break;
case 9: code += '{{Еліктеу сөз|'+srclang+'}}\n';break;
case 10: code += '{{Сөз тіркесі|'+srclang+'}}\n';break;
default: break;
}
if (srclang=='srckk')
{
if (def) code += '#{{definition|'+def+'}}\n';
else code += '#{{Анықтамасы қажет|'+srclang+'}}\n';
if (ex) code +='#*{{Үлгі|[['+ ex +']]}}\n';
if (syn) code +='#*{{Syn|[['+ syn +']]}}\n';
if (ant) code +='#*{{Ant|[['+ ant +']]}}\n';
code+='#*\'\'\'Аудармалары:\'\'\'\n';
if (lang1 && trans1)
{
if (lang1=="other") code +='\'\'\' (тіл аты) \'\'\'';
else code +='#**{{'+lang1+'|[['+trans1+']]}}\n';
}
if (lang2 && trans2)
{
if (lang2=="other") code +='\'\'\' (тіл аты) \'\'\'';
else code +='#**{{'+lang2+'|[['+trans2+']]}}\n';
}
if (lang3 && trans3)
{
if (lang3=="other") code +='\'\'\' (тіл аты) \'\'\'';
else code +='#**{{'+lang3+'|[['+trans3+']]}}\n';
}
}
else
{
if (!trans1 && !trans2 && !trans3) code += '#{{Анықтамасы қажет|srckk}}\n';
if (trans1) code +='#[['+trans1+']]';
if (trans2) code +=', [['+trans2+']]';
if (trans3) code +=', [['+trans3+']]';
if (trans1 || trans2 || trans3) code += '\n';
if (ex) code +='#*{{Үлгі|[['+ ex +']]}}\n';
if (syn) code +='#*{{Syn|[['+ syn +']]}}\n';
if (ant) code +='#*{{Ant|[['+ ant +']]}}\n';
}
if (cat) code +='\n[[Category:'+cat+']]\n';
insertTags('','', code);
}
/*</pre>
=== add_word() ===
<pre>*/
function add_word()
{
var popup = window.open('','name','height=500,width=450');
javaCode = '<script type="text\/javascript" src="http:\/\/kk.wiktionary.org\/w\/index.php?title=MediaWiki:Gadjet-translit.js&action=raw&ctype=text\/javascript"><\/script>';
//function insertCode()
javaCode += '<script type="text\/javascript">function insertCode(){';
javaCode += 'var srclang = document.paramForm.srclang.options[document.paramForm.srclang.selectedIndex].value; '
javaCode += 'var def = document.paramForm.def.value; '
javaCode += 'var pos = document.paramForm.partofspeech.selectedIndex; '
javaCode += 'var ex = document.paramForm.example.value; '
javaCode += 'var syn = document.paramForm.synonyms.value; '
javaCode += 'var ant = document.paramForm.antonyms.value; '
javaCode += 'var lang1 = document.paramForm.lang1.options[document.paramForm.lang1.selectedIndex].value; '
javaCode += 'var trans1 = document.paramForm.trans1.value; '
javaCode += 'var lang2 = document.paramForm.lang2.options[document.paramForm.lang2.selectedIndex].value; '
javaCode += 'var trans2 = document.paramForm.trans2.value; '
javaCode += 'var lang3 = document.paramForm.lang3.options[document.paramForm.lang3.selectedIndex].value; '
javaCode += 'var trans3 = document.paramForm.trans3.value; '
javaCode += 'var cat = document.paramForm.cat.value; '
javaCode += 'window.opener.generate_entry(srclang,def,pos,ex,syn,ant,lang1,trans1,lang2,trans2,lang3,trans3,cat); '
javaCode += '}'
//other fun-s:
javaCode += 'var language=0; function changeLanguage(){if (language==1) {language=0; document.paramForm.lang.value="Ctrl+Alt Cyr";return;}if (language==0){language=1;document.paramForm.lang.value="Ctrl+Alt Lat";return;}}';
javaCode += 'function ConvertWithCheck(){ if (!language && navigator.appName == "Microsoft Internet Explorer") ConvertInRealTime(); return;}'
javaCode += 'function AkeyisDown() { if (event.ctrlKey && event.altKey) {changeLanguage();event.returnValue=false;} }'
javaCode += 'function HideOthers() { if (document.paramForm.srclang.options[document.paramForm.srclang.selectedIndex].value!="srckk") {document.paramForm.def.readOnly=true; document.paramForm.def.style.backgroundColor="#C0C0C0";document.paramForm.lang1.style.display="none";document.paramForm.lang2.style.display="none";document.paramForm.lang3.style.display="none";} else{document.paramForm.def.readOnly=false; document.paramForm.def.style.backgroundColor="#FFFFFF";document.paramForm.lang1.style.display="block";document.paramForm.lang2.style.display="block";document.paramForm.lang3.style.display="block";}}'
javaCode += '<\/script>';
popup.document.write('<html><head><title>Сөз қосу</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">');
popup.document.write(javaCode);
popup.document.write('</head><body onkeydown="javascript:AkeyisDown()">');
popup.document.write('<p>Сөзге тиісті мағлұматты енгізіп соңында "Дайын!" түймесін шертіңіз:</p>');
popup.document.write('<table>');
popup.document.write('<tr><td><form name="paramForm">');
//the translit button:
if (navigator.appName == "Microsoft Internet Explorer" )
popup.document.write('<input type=button style="background: white; font-size: 13px; font-family: Century; letter-spacing: -0.02em; font-weight: normal; color: blue; padding:0 0.1em 0.1em 0.1em; margin-left: 6px; margin-right: 0px;" name="lang" onclick="changeLanguage();"><br><small>транслитерация жұмыс істейді<small><script laguage=JavaScript>changeLanguage();<\/script>');
popup.document.write('<tr><td><td><select name="srclang" onchange="HideOthers();"><option value="" selected>тілі<option value="srckk">Қазақша<option value="srcen">Ағылшынша<option value="srcru">Орысша<option value="srcja">Жапонша<option value="srctr">Түрікше<option value="srcde">Немісше<option value="srcfr">Французша<option value="other">басқа тіл</select>');
popup.document.write('<tr><td><td><select name="partofspeech"><option value="0" selected>Сөз табы<option value="1">Зат есім<option value="2">Етістік<option value="3">Сын есім<option value="4">Сан есім<option value="5">Есімдік<option value="6">Үстеу<option value="7">Шылау<option value="8">Одағай<option value="9">Еліктеу сөз<option value="10">Сөз тіркесі</select>');
popup.document.write('<tr><td>Мағынасы:<td> <input type="text" name="def" value="" onkeypress="ConvertWithCheck();">');
popup.document.write('<tr><td>Мысал сөйлем:<td> <input type="text" name="example" value="" onkeypress="ConvertWithCheck();">');
popup.document.write('<tr><td>Синонимдері:<td> <input type="text" name="synonyms" value="" onkeypress="ConvertWithCheck();">');
popup.document.write('<tr><td>Антонимдері:<td> <input type="text" name="antonyms" value="" onkeypress="ConvertWithCheck();">');
popup.document.write('<tr><td>Аудармалары:<tr><td><select name="lang1"><option value="" selected>тіл таңдаңыз<option value="en">Ағылшынша<option value="ru">Орысша<option value="ja">Жапонша<option value="tr">Түрікше<option value="de">Немісше<option value="fr">Французша<option value="other">басқа тіл</select>');
popup.document.write('<td><input type="text" name="trans1" value="" onkeypress="ConvertWithCheck();">');
popup.document.write('<tr><td><select name="lang2"><option value="" selected>тіл таңдаңыз<option value="en">Ағылшынша<option value="ru">Орысша<option value="ja">Жапонша<option value="tr">Түрікше<option value="de">Немісше<option value="fr">Французша<option value="other">басқа тіл</select>');
popup.document.write('<td><input type="text" name="trans2" value="" onkeypress="ConvertWithCheck();">');
popup.document.write('<tr><td><select name="lang3"><option value="0" selected>тіл таңдаңыз<option value="en">Ағылшынша<option value="ru">Орысша<option value="ja">Жапонша<option value="tr">Түрікше<option value="de">Немісше<option value="fr">Французша<option value="other">басқа тіл</select>');
popup.document.write('<td><input type="text" name="trans3" value="" onkeypress="ConvertWithCheck();">');
popup.document.write('<tr><td>Категориясы:<td><input type="text" name="cat" value="" onkeypress="ConvertWithCheck();">');
popup.document.write('</form>');
popup.document.write('<tr><td><input type="button" value="Дайын!" onclick="javascript:insertCode()">');
popup.document.write('<td><a href="javascript:self.close()"> Жабу</a>');
popup.document.write('</table></body></html>');
popup.document.close();
}
/*
</pre>
=== addword_but() ===
<pre>*/
function addword_but()
{
var toolbar = document.getElementById("toolbar");
if (!toolbar) return false;
var editform = document.getElementById('editform');
if (!editform) return false;
var textbox = document.getElementById('wpTextbox1');
if (!textbox) return false;
// Don't generate buttons for browsers which don't fully
// support it.
if (!document.selection && textbox.selectionStart == null)
return false;
var addword = document.createElement("input");
addword.value='AddWord';
addword.type = 'button';
addword.name = 'addword';
addword.id = 'addword';
addword.title = 'Жаңа сөз қосу';
//addword.className = 'addwordbutton';
addword.onclick = function() { add_word(); return false; };
editform.parentNode.insertBefore(addword, editform);
//document.write('<style type="text\/css">.addwordbutton {color:black; font-size:0.90em; font-variant:small-caps; text-decoration:none; border:thin outset; padding: 0 0.2em 0 0; float:right;}<\/style>');
}
$(addword_but);
/*</pre>
*/