Pamaké:Uchup19/editor2.js
Catet: Sanggeus nyimpen, anjeun kudu narabas singgahan panyungsi anjeun pikeun nempo parobahanana.
- Firefox/Safari: Tahan Shift bari ngaklik Reload, atawa pencét boh Ctrl-F5 atawa Ctrl-R (⌘-R dina Mac)
- Google Chrome: Pencét Ctrl-Shift-R (⌘-Shift-R dina Mac)
- Internet Explorer: Tahan Ctrl bari ngaklik Refresh, atawa pencét Ctrl-F5
- Opera: Indit ka Menu → Settings (Opera → Preferences di Mac) tuluy ka Privacy & security → Clear browsing data → Cached images and files.
// Newer version of User:Yair rand/editor.js
window.makedefsidebox = function (q) {
function clickiconfunction() {
var moreoptions, originalHeight, buttons;
function uncollapse() {
$(moreoptions).slideUp();
$("body").unbind("click", uncollapse);
}
editdefinition(q);
if( $('>.addusexbutton', q).length === 0 ) {
buttons = q.insertBefore(newNode('div', {
'class': 'addusexbutton',
'style': 'padding-left:15px;margin-top:-4px;overflow:hidden;-webkit-transition:all 0.5s;-moz-transition:all 0.5s;-ms-transition:all 0.5s;-o-transition:all 0.5s;transition:all 0.5s;'
}, newNode('a', '+Tambahkan contoh kalimat', {
'style': 'vertical-align:top;cursor:pointer;font-size:10px;',
'click': function () {
setupusexadder(q)
}
}), newNode('a', '+Tambahkan kutipan', {
'style': 'vertical-align:top;cursor:pointer;font-size:10px;margin-left:15px;',
'click': function () {
setupquoteadder(q)
}
}), newNode('a', 'Lanjut ►', {
'style': 'vertical-align:top;cursor:pointer;font-size:10px;margin-left:15px;',
'click': function () {
$(moreoptions).slideDown();
setTimeout(function () {
$("body").click(uncollapse)
}, 16);
}
}), newNode('span', {
'style': 'display:inline-block;'
}, moreoptions = newNode('ul', {
'style': 'display:none;position:absolute;background-color:#FFFFFF;border:1px solid #AAA;list-style:none;padding:1px 10px;'
}, newNode('li', q.className ? newNode('a', 'Sunting gloss', {
'style': 'cursor:pointer',
'click': function () {
editgloss(q)
}
}) : newNode('a', 'Tambah gloss', {
'style': 'cursor:pointer',
'click': function () {
addgloss(q)
}
})), newNode('li', newNode('a', q.className ? {
'style': 'cursor:pointer;'
} : {
'style': 'color:#AAAAAA;',
'title': 'Tambahkan gloss sebelum menambahkan sinonim.'
}, {
'click': function () {
setupnymadder(q, "Sinonim")
}
}, 'Tambahkan sinonim')), newNode('li', newNode('a', q.className ? {
'style': 'cursor:pointer;'
} : {
'style': 'color:#AAAAAA;',
'title': 'Tambahkan gloss sebelum menambahkan antonyms.'
}, {
'click': function () {
setupnymadder(q, "Antonim")
}
}, 'Tambahkan antonim')), newNode('li', newNode('a', {
'href': wgScript + '?title=User_talk:Bennylin/editor2.js&action=edit§ion=new'
}, 'Give feedback on this tool')), newNode('li', newNode('a', {
'style': 'cursor:pointer',
click: function () {
$.cookie("DisableYREdit", 1, {
path: '/'
});
location.href = location.href
}
}, 'Disable this tool'))))), $('>dl,>ul,>ol', q)[0] || null);
originalHeight = buttons.style.height = buttons.offsetHeight + 'px';
$(q).mouseenter(function(){$(buttons).css({height:originalHeight,marginTop:'-4px'})}).mouseleave(function(){$(buttons, q).css({height:'0px',marginTop:'0px'})})
}
}
q.insertBefore(
newNode('span', {
'style': 'position:absolute;width:0px;height:0px;'
}, newNode('img', {
'style': 'position:relative;display:block;left:-35px;top:3px;cursor:pointer;',
'src': '//upload.wikimedia.org/wikipedia/commons/d/d3/InterlanguageLinks-Asset-Pencil.gif',
'mouseover': function () {
this.src = '//upload.wikimedia.org/wikipedia/commons/d/d1/InterlanguageLinks-Asset-Pencil-Hover.gif'
},
'mouseout': function () {
this.src = '//upload.wikimedia.org/wikipedia/commons/d/d3/InterlanguageLinks-Asset-Pencil.gif'
},
'click': clickiconfunction,
'title': 'Sunting'
})), q.firstChild)
return clickiconfunction;
}
function setupusexadder(qq) {
var x, y;
var usexform;
var findsubdef = (qq.parentNode.parentNode.nodeName.toLowerCase() == "li" ? "#" : "") + (qq.parentNode.parentNode.parentNode.parentNode.nodeName.toLowerCase() == "li" ? "#" : "")
editor = new Editor()
findlang(qq.parentNode, function (findlang_) {
var findscript = (new LangMetadata()).getScripts(findlang_),
selectedscript = findscript[0] || "Latn";
if (qq.getElementsByTagName('dl')[0] && qq.getElementsByTagName('dl')[0].parentNode == qq) x = qq.getElementsByTagName('dl')[0];
else if ($(">ul", qq).length > 0) x = qq.insertBefore(newNode('dl'), $(">ul", qq)[0]);
else x = qq.appendChild(newNode('dl'));
x.appendChild(y = newNode('dd'))
new AdderWrapper(new Editor(), {
'createForm': function () {
var x, i = 0,
y = function () {
selectedscript = this.value;
usexform.getElementsByTagName('dd')[0].style.display = this.value == 'Latn' ? 'none' : 'block'
}
if (findscript.length > 1) {
for (x = newNode('select', {
'name': 'script',
'change': y
}); i < findscript.length; i++) {
x.appendChild(newNode('option', {
'value': findscript[i]
}, findscript[i]))
}
} else {
x = newNode('input', {
'name': 'script',
'value': findscript[0] || "Latn",
'style': "width:50px;",
'change': y
})
}
return usexform = newNode('form', {
'style': 'display:inline;'
}, newNode('input', {
'size': 100,
'placeholder': 'Example sentence',
'name': 'examplesentence'
}), newNode('span', {
'style': 'display:' + (findscript.length == 1 ? "none" : "inline") + ";"
}, 'Script: ', x), newNode('div', {
'style': "display:inline-block;padding:0px;border-radius:5px;border:#9D9D9D solid 1px;margin-right:5px;margin-left:3px;",
click: function () {
usexform.style.display = 'none'
}
}, newNode('div', {
'style': defeditoptions.styles[0]
}, 'Cancel')), newNode('div', {
'style': "display:inline-block;padding:0px;border-radius:5px;border:#9D9D9D solid 1px;",
'click': function () {
usexform.onsubmit()
}
}, newNode('div', {
'style': defeditoptions.styles[1]
}, "Pratayang ►")), newNode('input', {
'type': 'submit',
'style': 'visibility:hidden;width:0px;'
}), newNode('dl', (findlang_ == "en" ? {
'style': 'display:none;'
} : ''), newNode('dd', 'Transliteration: ', ((findscript[0] == 'Latn' || !findscript[0]) ? {
'style': 'display:none;'
} : ''), newNode('input', {
'size': '100px',
name: 'transliteration'
})), newNode('dd', 'Translation: ', newNode('input', {
'size': '100px',
name: 'translation'
}))))
},
'fields': {
'examplesentence': function (txt, error) {
return util.validateNoWikisyntax('example sentence', true)(txt, error)
},
'transliteration': function (txt, error) {
if (findlang_ != "en" && selectedscript != 'Latn') {
return util.validateNoWikisyntax('transliteration', true)(txt, error)
};
return ''
},
'translation': function (txt, error) {
if (findlang_ != "en") {
return util.validateNoWikisyntax('translation', true)(txt, error)
};
return ''
},
'script': util.validateNoWikisyntax('script', true)
},
'onsubmit': function (values, render) {
render(
(values.script == "Latn" ? "''" + values.examplesentence + "''" : "{{" + values.script + "|lang=" + findlang_ + "|''" + values.examplesentence + "''}}\n:''" + values.transliteration + "''") + (findlang_ != "en" ? "\n:''" + values.translation + "''" : ''), function (newhtml) {
var findnumberofheaders = findnumberofheaders_(qq)
var findnumberofdefs = findnumberofdefs_(qq)
var usextobeadded = newNode('span')
usextobeadded.innerHTML = newhtml.replace(/<p>|<\/p>/g, '')
editor.addEdit({
edit: function (wikitext) {
wikitext = wikitext.replace(RegExp("(^[\\s\\S]*?((^|\n)=[\\s\\S]*?){" + findnumberofheaders + "}" + findnumberofdefs + "[\\s\\S]*?)\n(?!#" + findsubdef + ":)|$"), "$1\n#" + findsubdef + ":" + (values.script == "Latn" ? "''" + values.examplesentence + "''" : "{{" + values.script + "|lang=" + findlang_ + "|''" + values.examplesentence + "''}}\n#" + findsubdef + "::''" + values.transliteration + "''") + (findlang_ != "en" ? "\n#" + findsubdef + "::''" + values.translation + "''" : '') + "\n");
ccc = wikitext;
return wikitext;
},
redo: function () {
usexform.parentNode.appendChild(usextobeadded);
usextobeadded.style.display = 'block';
usexform.style.display = "none";
y.style.display = 'block'
},
undo: function () {
usexform.parentNode.removeChild(usextobeadded);
usexform.style.display = "inline";
},
summary: "+usex: " + values.examplesentence
}, usextobeadded)
})
}
}, y)
usexform.firstChild.focus()
})
}
window.editdefinition = function (qq) {
(new Editor).withCurrentText(function (wikitext) {
if (qq.YREditing) {
return
}
qq.YREditing = true;
var findnumberofheaders = findnumberofheaders_(qq),
findnumberofdefs = findnumberofdefs_(qq)
var temporarydefholder = qq.insertBefore(newNode('span', {
'style': 'display:none;'
}), qq.childNodes[1].nodeName.toLowerCase() != "form" ? qq.childNodes[1] : qq.childNodes[2])
while (qq.childNodes[3] && qq.childNodes[3].nodeName != "DL" && qq.childNodes[3].nodeName != "UL" && qq.childNodes[3].nodeName != "OL" && qq.childNodes[3].className != "HQToggle" && qq.childNodes[3].className != "addusexbutton")
temporarydefholder.appendChild(qq.childNodes[3]);
if (qq.childNodes[2] != temporarydefholder) temporarydefholder.insertBefore(qq.childNodes[2], temporarydefholder.firstChild);
var defform
var olddef = wikitext.replace(RegExp("(^[\\s\\S]*?((^|\n)=[\\s\\S]*?){" + findnumberofheaders + "}" + findnumberofdefs + "\\s?)"), '').match(/^(\{\{senseid\|[^\}]*\}\})?\s?(.*)/)[2]
new AdderWrapper(new Editor(), {
'createForm': function () {
return defform = newNode('form', {
'style': 'width:100%;display:inline-block;margin-bottom:-6px;'
}, newNode('table', {
'style': 'width:100%;'
}, newNode('tr', newNode('td', newNode('input', {
'style': 'height:17px;width:100%;',
'name': 'definition',
'size': 80,
'value': olddef
})
// newNode('input',{type:'submit',value:'Preview'}),
// newNode('input',{type:'button',value:'Cancel',click:function(){temporarydefholder.style.display='inline';defform.style.display='none';qq.YREditing = false}})
), newNode('td', {
'style': 'white-space:nowrap;'
}, newNode('div', {
'style': "display:inline-block;padding:0px;border-radius:5px;border:#9D9D9D solid 1px;margin-right:5px;margin-left:3px;"
}, newNode('div', {
'style': defeditoptions.styles[0],
click: function () {
temporarydefholder.style.display = 'inline';
defform.style.display = 'none';
qq.YREditing = false
}
}, "Batalkan Perubahan")), newNode('div', {
'style': "display:inline-block;padding:0px;border-radius:5px;border:#9D9D9D solid 1px;"
}, newNode('div', {
'style': defeditoptions.styles[1],
click: function () {
defform.onsubmit()
}
}, "Pratayang Perubahan ►"))))))
},
'fields': {
'definition': function (txt, error) {
return txt || error("Please specify a definition.")
}
},
'onsubmit': function (values, render) {
render(values.definition, function (newhtml) {
editor = new Editor()
var findnumberofdefs = findnumberofdefs_(qq) // apparently this is sometimes necessary
var addedspan = newNode('span')
addedspan.innerHTML = newhtml
var updatecatscallback;
editor.addEdit({
edit: function (wikitext) {
wikitext = wikitext.replace(RegExp("(^[\\s\\S]*?((^|\n)=[\\s\\S]*?){" + findnumberofheaders + "}" + findnumberofdefs + "\\s?(\{\{senseid\\|[^\}]*\}\})*?)(?!{{senseid\\|).*"), "$1" + values.definition);
ccc = wikitext;
return wikitext
},
redo: function () {
defform.parentNode.insertBefore(addedspan, defform);
defform.style.display = temporarydefholder.style.display = 'none';
updatecatscallback = window.tabbedLanguages && updateCategories(findtopli(defform.parentNode).parentNode.parentNode, values.definition, olddef)
qq.YREditing = false;
},
undo: function () {
defform.parentNode.removeChild(addedspan);
defform.style.display = "inline";
defform.firstChild.firstChild.firstChild.firstChild.value = olddef;
updatecatscallback && updatecatscallback();
qq.YREditing = true;
},
summary: "def: " + values.definition
}, addedspan)
})
}
}, qq, qq.childNodes[1].nodeName.toLowerCase() != "form" ? qq.childNodes[1] : qq.childNodes[2])
})
}
function findtopli(li) {
for (; li.parentNode.parentNode.nodeName.toLowerCase() == "li";) {
li = li.parentNode.parentNode;
}
return li;
}
function findnumberofheaders_(tosearchfrom) {
tosearchfrom = findtopli(tosearchfrom).parentNode;
while (!tosearchfrom.nodeName.match(/^h\d$/i))
tosearchfrom = tosearchfrom.previousSibling;
return Number(tosearchfrom.firstChild.getElementsByTagName('a')[0].href.match(/\d*$/))
}
function findnumberofdefs_(tosearchfrom) {
var findnumberofdefs = [],
tosearchfrom_, findnumberofpredefs = 0,
result;
// subdefinitions
while (tosearchfrom.nodeName.toLowerCase() == "li") {
tosearchfrom_ = tosearchfrom;
findnumberofdefs.splice(0, 0, 0);
while (tosearchfrom) {
if (tosearchfrom.nodeName.toLowerCase() == "li") findnumberofdefs[0]++;
tosearchfrom = tosearchfrom.previousSibling;
}
tosearchfrom = tosearchfrom_.parentNode.parentNode;
}
// in case of any def lists before the current def list under the same header
for (tosearchfrom_ = tosearchfrom_.parentNode.previousSibling; !tosearchfrom_.nodeName.match(/^h\d$/i); tosearchfrom_ = tosearchfrom_.previousSibling) {
if (tosearchfrom_.nodeName.toLowerCase() == "ol") findnumberofpredefs += 1;
}
result = "([\\s\\S]*?\n#[\\s\\S]*?\n(?!#)){" + findnumberofpredefs + "}";
for (var i = 0; i < findnumberofdefs.length; i++) {
result += "([\\s\\S]*?\n" + Array(i + 2).join("#") + "(?![:*#])){" + findnumberofdefs[i] + "}";
}
return result;
}
function findlang(tosearchfrom, callback) {
var tosearchfrom_, findlang__
if (tosearchfrom.parentNode.nodeName.toLowerCase() == "li") tosearchfrom = findtopli(tosearchfrom.parentNode).parentNode;
if (tosearchfrom.parentNode.className == "languageContainer") {
if (tosearchfrom.parentNode.id == "Englishcontainer") return callback("en");
} else {
tosearchfrom_ = tosearchfrom;
while (tosearchfrom_.nodeName.toLowerCase() != "h2")
tosearchfrom_ = tosearchfrom_.previousSibling;
if (tosearchfrom_.lastChild.innerHTML == "English") return callback("en");
}
tosearchfrom_ = tosearchfrom;
while (tosearchfrom_ && !/^h\d$/i.test(tosearchfrom_.nodeName) && tosearchfrom_.className != "fakeheader")
tosearchfrom_ = tosearchfrom_.previousSibling;
while (tosearchfrom_ && tosearchfrom_.nodeName.toLowerCase() != "p" && tosearchfrom_.className != "fakeheader")
tosearchfrom_ = tosearchfrom_.nextSibling;
if (tosearchfrom_ && tosearchfrom_.className != "fakeheader" && tosearchfrom_.firstChild && (tosearchfrom_.firstChild.lang || (tosearchfrom_.firstChild.firstChild && tosearchfrom_.firstChild.firstChild.lang) || (tosearchfrom_.firstChild.firstChild && tosearchfrom_.firstChild.firstChild.firstChild && tosearchfrom_.firstChild.firstChild.firstChild.lang))) {
return callback(tosearchfrom_.firstChild.lang || tosearchfrom_.firstChild.firstChild.lang || tosearchfrom_.firstChild.firstChild.firstChild.lang)
}
if (tosearchfrom.parentNode.className == "languageContainer") findlang__ = tosearchfrom.parentNode.id.split("container")[0];
else {
while (tosearchfrom.nodeName.toLowerCase() != "h2")
tosearchfrom = tosearchfrom.previousSibling;
findlang__ = (findlang__ = tosearchfrom.getElementsByTagName("span")[1]).innerText || findlang__.textContent
}
window.languagenametocode && languagenametocode[findlang__] && callback(languagenametocode[findlang__]);
}
function setupquoteadder(q) {
findlang(q.parentNode, function (findlang_) {
var z;
if (!$(".HQToggle a", q)[0]) {
z = q.appendChild(document.createElement("ul"))
setupHiddenQuotes(q);
} else {
z = $(">ul", q)[0];
}
if (z.style.display == 'none') {
$(".HQToggle a", q).click();
}
var zz = z.appendChild(document.createElement("li")),
quoteform;
var findsubdef = q.parentNode.parentNode.nodeName.toLowerCase() == "li" ? "#" : "",
editor = new Editor();
new AdderWrapper(editor, {
'createForm': function () {
return quoteform = newNode('form', {
'style': 'display:inline;'
}, 'Year: ', newNode('input', {
'name': 'year',
'size': 4
}), ' Author: ', newNode('input', {
'name': 'author',
'size': 20
}), ' Source title: ', newNode('input', {
'name': 'source',
'size': 20
}), ' Publisher: ', newNode('input', {
'name': 'publisher',
'size': 20
}), ' Page(s): ', newNode('input', {
'name': 'page',
'size': 5
}), newNode('dl', newNode('dd', 'Quotation: ', newNode('input', {
'name': 'quotation',
'size': 40
}), newNode('div', {
'style': "display:inline-block;padding:0px;border-radius:5px;border:#9D9D9D solid 1px;margin-right:5px;margin-left:3px;",
click: function () {
z.removeChild(zz)
}
}, newNode('div', {
'style': defeditoptions.styles[0]
}, 'Cancel')), newNode('div', {
'style': "display:inline-block;padding:0px;border-radius:5px;border:#9D9D9D solid 1px;",
'click': function () {
quoteform.onsubmit()
}
}, newNode('div', {
'style': defeditoptions.styles[1]
}, "Preview ►")), newNode('input', {
'type': 'submit',
'style': 'visibility:hidden;width:0px;'
}), newNode('dl', {
'style': 'display:' + (findlang_ == "en" ? "none" : "block")
}, newNode('dd', 'Translation: ', newNode('input', {
'size': 40,
'name': 'translation'
}))))))
},
'fields': {
'quotation': util.validateNoWikisyntax('quotation', true),
'year': util.validateNoWikisyntax('year', true),
'author': function (t) {
return t
},
'source': function (t) {
return t ? ", ''" + t + "''" : ''
},
'publisher': function (t) {
return t ? ", " + t : ''
},
'page': function (t) {
return t ? (/\-/.test(t) ? "pages " + t : "page " + t) : t
},
'translation': function (t) {
return t
}
},
'onsubmit': function (values, render) {
var topline = "'''" + values.year + "'''" + (values.author ? ", " + values.author : '') + values.source + values.publisher + (values.page ? ", " + values.page : '')
render(topline + "\n:" + values.quotation + (values.translation ? "\n:" + values.translation : ""), function (newhtml) {
var findnumberofheaders = findnumberofheaders_(q),
findnumberofdefs = findnumberofdefs_(q),
quotetobeadded = newNode('span', {
'style': 'display:block;'
});
quotetobeadded.innerHTML = newhtml.replace(/\<p\>|\<\/p\>/g, '');
editor.addEdit({
'edit': function (wikitext) {
return ccc = wikitext.replace(RegExp("(^[\\s\\S]*?((^|\n)=[\\s\\S]*?){" + findnumberofheaders + "}" + findnumberofdefs + "[\\s\\S]*?)\n(?!#" + findsubdef + "[:\*])|$"), "$1\n#" + findsubdef + "*" + topline + "\n#" + findsubdef + "*:" + values.quotation + (values.translation ? "\n#" + findsubdef + "*:" + values.translation : '') + '\n')
},
'redo': function () {
quoteform.style.display = 'none';
quotetobeadded.style.display = 'block';
zz.appendChild(quotetobeadded)
},
'undo': function () {
quoteform.style.display = 'inline';
zz.removeChild(quotetobeadded)
},
'summary': '+quote: "' + values.quotation + '"- ' + values.source
}, quotetobeadded)
})
}
}, zz)
})
}
window.addPOSHeader = function (cancelhover) {
var bodyContent = $(".mw-content-ltr")[0];
if (!defeditoptions.addingPOS) {
defeditoptions.addingPOS = true;
editor = new Editor()
var headerLevel = (window.languageContainers && languageContainers[currentLanguageTab] && languageContainers[currentLanguageTab].firstChild) || bodyContent.firstChild;
var ii;
var temp, temp_;
var theform;
var findnumberofheaders;
var addedwikitext;
var prefakeheaders;
var currentFocus;
var langNames = [], docLink, docExists = {};
if(window.loadedTabs){
langNames=tabbedLanguages;
} else {
mw.util.$content.find("h2>.mw-headline").each(function(){langNames.push($(this).text())})
}
var langNameCodes;
JsMwApi()({action:'query',prop:'revisions',rvprop:'content',titles:"Template:langrev/"+langNames.join("|Template:langrev/")},function(r){
if(r&&r.query&&r.query.pages){langNameCodes={};for(var i in (r=r.query.pages)){langNameCodes[r[i].title.split("langrev/")[1]] = r[i].revisions[0]['*']}}})
function updateDocLink(){
var pos = theform.getElementsByTagName("input")[0].value;
pos = (({Adjektiva:"adj", Adverbia:"adv", Interjeksi:"inter", Preposisi:"prep", Pronomina:"pron", Konjungsi:"kon", Kontraksi:"kont", Penentu:"pen"})[pos]||pos.toLowerCase());
if(!langNameCodes || !pos || !theform.getElementsByTagName("input")[0].value){
return;
}
var currentLang = window.loadedTabs?theform.parentNode.id.split("container")[0]:(function(){
for(var s=theform;s&&s.nodeName!="H2";s=s.previousSibling);return s && s.lastChild && (s.lastChild.innerText || s.lastChild.textContent)})();
var docName = langNameCodes[currentLang] + "-" + pos;
if(docExists[docName] === false){
return docLink.style.display = 'none';
}
if(docExists[docName] === true){
docLink.style.display = 'inline'; docLink.href = mw.config.get("wgArticlePath").replace("$1", "Template:"+docName+"/doc"); return;
}
if(docExists[docName] === 'l'){
docLink.style.display = 'none'; return;
}
docExists[docName] = 'l';
JsMwApi()({action:'query',prop:'info',titles:'Template:'+ docName + '/doc'},function(r){docExists[docName] = !r.query.pages[-1];updateDocLink();})
}
var poslist = '\nNomina\nVerba\nAdjektiva\nAdverbia\nPronomina\nKonjungsi\nInterjeksi\nPreposisi\nNama diri\nArtikel\nFrasa preposisional\nAkronim\nSingkatan\nInisialisme\nKontraksi\nPrefiks\nSufiks\nSimbol\nHuruf\nLigatur\nIdiom\nFrasa\nAngka\nNumeral\nAngka kardinal\nAngka ordinal\nNumeral kardinal\nNumeral ordinal\nPronomina personal\nPenentu\nPenentu demonstratif\nKlitika\nInfiks\nInterfiks\nAffiks\nSirkumfiks\nSirkumposisi\nPenghitung\nPinyin\nHanzi\nHanja\nKanji\nPerumpamaan\nEkspresi\nPartikel\nPartikel infinit\nAdjektiva posesif\nPascaposisi\nVerba majemuk\nPartisip\nAdverbia pronominal\nAdnominal\nPronomina abstrak\nPartikel konjungsi\nAkar\nSuku kata\nPengklasifikasi\nPredikatif\nKata penghitung\nKorelatif\nPreverba\nPrenomina\nAkar nomina\nKelas nomina\n';
while (headerLevel.nextSibling) {
if (/^h[34]$/i.test(headerLevel.nodeName) && !/Etymology|Pronunciation|Alternative\sforms/.test(headerLevel.innerHTML)) {
headerLevel = headerLevel.nodeName.toLowerCase();
break;
}
headerLevel = headerLevel.nextSibling
}
currentBoxToBeAdded = newNode('div', {
'style': 'position:fixed;top:500px;'
})
new AdderWrapper(editor, {
createForm: function () {
return theform = newNode('form', currentFocus = newNode('input', {
'style': 'font-size: 0.8em;font-size: ' + ((headerLevel == 'h3') ? '132%' : '116%') + ';font-weight: bold;font-family: sans-serif;width:auto;',
'placeholder': 'Part of speech',
'rows': 1,
'name': 'pos',
focus: function () {
currentFocus = this
}
}), newNode('input', {
'type': 'submit',
'value': 'Pratayang'
}), newNode('input', {
'type': 'button',
'value': 'Batal',
click: function () {
theform.style.display = 'none';
hoverNewPOS(null);
defeditoptions.addingPOS = false;
document.onmousemove = null;
document.body.style.cursor = '';
}
}), newNode('br'), newNode('input', {
'style': 'width:300px;font-family:monospace;',
'placeholder': '{\{infl}}',
'name': 'inflline',
focus: function () {
currentFocus = this
}
}), docLink = newNode('a',{style:"margin-left:5px;display:none;",'target':'_blank'},"Help?"), newNode('ol', newNode('li', newNode('input', {
'size': 100,
'disabled': 'disabled'
}))))
},
fields: {
'pos': function (txt, error) {
return poslist.indexOf('\n' + txt + '\n') > -1 ? txt : error('Please select a valid part of speech.')
},
'inflline': function (txt, error) {
return txt || "{" + "{infl}}"
}
},
onsubmit: function (values, render) {
addedwikitext = '{' + '{subst:=}}==' + (headerLevel == 'h4' ? '=' : '') + values.pos + (headerLevel == 'h4' ? '=' : '') + '===\n' + values.inflline
hoverNewPOS(null);
document.onmousemove = null;
defeditoptions.addingPOS = false;
document.body.style.cursor = '';
render(addedwikitext, function (res) {
theform.style.display = 'none'
temp = document.createDocumentFragment();
temp.appendChild(temp_ = newNode('div', {
'class': 'fakeheader'
}));
temp_.innerHTML = res;
temp.appendChild(newNode('ol', newNode('li', ' ', newNode('span'))));
theform.parentNode.insertBefore(temp, theform);
prefakeheaders = 0
findnumberofheaders = theform.previousSibling.previousSibling;
while (true) {
if (findnumberofheaders.previousSibling) {
findnumberofheaders = findnumberofheaders.previousSibling;
if (/h[2-6]/i.test(findnumberofheaders.nodeName)) {
findnumberofheaders = Number(findnumberofheaders.firstChild.getElementsByTagName('a')[0].href.split("section=")[1]);
break;
}
findnumberofheaders.className == 'fakeheader' && prefakeheaders++;
} else {
findnumberofheaders.parentNode.insertBefore(newNode('h2', languageHeaderEditButtons[currentLanguageTab].cloneNode(true), {
'style': 'display:none;'
}), findnumberofheaders);
}
}
var updatecatscallback;
editor.addEdit({
'edit': function (wikitext) {
return ccc = wikitext.replace(RegExp("(^[\\s\\S]*?((^|\n)=[\\s\\S]*?){" + findnumberofheaders + "}([\\s\\S]*?\n\\{\\{subst:\\=\\}\\}==" + (headerLevel == 'h4' ? '=' : '') + "[^=]){" + prefakeheaders + "}[\\s\\S]*?(?=(\n=|\n----|\n\\{\\{subst:\\=\\}\\}==" + (headerLevel == 'h4' ? '=' : '') + "[^=]|$)))"), "$1\n" + addedwikitext + "\n\n# {{rfdef}}\n")
},
'redo': function () {
theform.style.display = 'none';
theform.parentNode.insertBefore(temp, theform);
updatecatscallback = window.tabbedLanguages && updateCategories(theform.parentNode, addedwikitext)
},
'undo': function () {
theform.style.display = 'block';
temp.appendChild(temp_);
temp.appendChild(theform.previousSibling);
updatecatscallback && updatecatscallback()
},
'summary': '+pos ' + values.pos
}, temp_)
makedefsidebox(theform.previousSibling.firstChild)();
editor.withCurrentText(function () {
theform.previousSibling.getElementsByTagName('input')[0].value = '';
theform.previousSibling.getElementsByTagName('input')[0].focus()
})
})
}
}, currentBoxToBeAdded)
cancelhover || setUpBoxToBeAdded();
theform.firstChild.focus()
function hoverNewPOS(thefunction) {
for (var ii = bodyContent.getElementsByTagName(headerLevel), i = 0; i < ii.length; i++) {
if (!/^Etymology|Pronunciation|Alternative\sforms$/.test(ii[i].lastChild.innerHTML))(ii[i].parentNode.className == 'fakeheader' ? ii[i].parentNode : ii[i]).onmouseover = thefunction;
}
if (window.tabbedLanguages) {
for (var i = 0; i < languageContainers.length; i++)
languageContainers[i].lastChild.onmouseover = thefunction;
} else {
ii = bodyContent.getElementsByTagName('hr');
for (var i = 0; i < ii.length; i++)
ii[i].onmouseover = thefunction;
}
}
function hoverNewPOS_() {
currentBoxToBeAdded.style.display = 'none';
this.parentNode.insertBefore(theform, this);
currentFocus.focus();
updateDocLink()
}
cancelhover || hoverNewPOS(hoverNewPOS_);
// autocomplete pos field
theform.firstChild.onkeydown = function (e) {
if ((e || event).keyCode == 9) {
theform.getElementsByTagName("input")[3].focus();
return false
}
}
theform.firstChild.onkeyup = function (e) {
if (this.value.charAt(0) != this.value.charAt(0).toUpperCase()) this.value = this.value.charAt(0).toUpperCase() + this.value.substr(1);
e = (e || event).keyCode;
if (!(e >= 33 && e <= 40) && e != 8 && e != 46 && e != 27 && e != 16 && this.value) {
if (poslist.indexOf('\n' + this.value) > -1) {
if (this.setSelectionRange) this.setSelectionRange([this.value.length, this.value = poslist.match(RegExp(this.value + "[^\n]*"))][0], this.value.length);
else if (this.createTextRange) {
var z = this.createTextRange();
z.moveEnd('character', 0 - z.move('character', [this.value.length, this.value = poslist.match(RegExp(this.value + "[^\n]*"))][0]) + this.value.length);
z.select()
}
}
updateDocLink()
}
}
}
}
window.updateCategories = function (container, newvalue, oldvalue) {
var addedCategories = [],
removedCategories = []
JsMwApi()({
action: "parse",
prop: "categorieshtml",
title: wgPageName,
text: newvalue
}, function (r) {
var e = r.parse.categorieshtml['*'].match(/\<span.*?\/span\>/g)
var d = container.lastChild;
var f = document.createElement('div');
for (var i = 0; e && i < e.length; i++) {
f.innerHTML = e[i];
if (d.innerHTML.indexOf(f.firstChild.innerHTML) == -1) {
addedCategories.push(d.insertBefore(f.lastChild, d.lastChild))
d.insertBefore(document.createTextNode(' | '), d.lastChild)
}
}
oldvalue && JsMwApi()({
action: "parse",
prop: "categorieshtml",
title: wgPageName,
text: oldvalue
}, function (o) {
e = o.parse.categorieshtml['*'].match(/\<span.*?\/span\>/g)
for (var i = 0; e && i < e.length; i++) {
f.innerHTML = e[i];
if (r.parse.categorieshtml['*'].indexOf(f.firstChild.innerHTML) == -1 && d.innerHTML.indexOf(f.firstChild.innerHTML) != -1) {
var spans = d.getElementsByTagName('span')
for (var ii = 0; ii < spans.length; ii++) {
if (spans[ii].firstChild.innerHTML == f.firstChild.firstChild.innerHTML) {
removedCategories.push(spans[ii]);
spans[ii].style.display = 'none';
d.removeChild(spans[ii].nextSibling)
break;
}
}
}
}
})
})
return function () {
for (var i = 0; i < addedCategories.length; i++) {
container.lastChild.removeChild(addedCategories[i].nextSibling);
container.lastChild.removeChild(addedCategories[i])
}
for (var i = 0; i < removedCategories.length; i++) {
removedCategories[i].style.display = 'inline';
container.lastChild.insertBefore(document.createTextNode(' | '), removedCategories[i].nextSibling)
}
}
}
function addgloss(qq) {
var senseidform;
findlang(qq.parentNode, function (findlang_) {
if (qq.addinggloss) {
return
}
qq.addinggloss = true;
editor = new Editor();
new AdderWrapper(editor, {
'createForm': function () {
return senseidform = newNode('form', {
'style': 'display:inline; padding-right:20px;'
}, newNode('input', {
'size': 30,
'name': 'senseid'
}), newNode('input', {
'type': 'submit',
'value': 'Add'
}), newNode('input', {
'type': 'button',
'value': 'Cancel',
'click': function () {
qq.removeChild(senseidform);
qq.addinggloss = false
}
}), newNode('a', {
href: '/wiki/Help:Glosses'
}, 'Help?!'))
},
'fields': {
'senseid': util.validateNoWikisyntax('gloss', true)
},
'onsubmit': function (values) {
var findnumberofheaders = findnumberofheaders_(qq)
var findnumberofdefs = findnumberofdefs_(qq)
senseidform.lastChild.innerHTML = '';
var nymB = qq.getElementsByTagName('li')[1]
editor.addEdit({
edit: function (wikitext) {
wikitext = wikitext.replace(RegExp("(^[\\s\\S]*?((^|\n)=[\\s\\S]*?){" + findnumberofheaders + "}" + findnumberofdefs + ")"), "$1{{senseid|" + findlang_ + "|" + values.senseid + "}}");
return ccc = wikitext;
},
redo: function () {
senseidform.style.display = "none";
nymB.firstChild.style.color = nymB.nextSibling.firstChild.style.color = "#0645AD";
nymB.firstChild.style.cursor = nymB.nextSibling.firstChild.style.cursor = "pointer";
nymB.firstChild.title = nymB.nextSibling.firstChild.title = ''
},
undo: function () {
senseidform.style.display = "inline";
nymB.firstChild.style.color = nymB.nextSibling.firstChild.style.color = "#AAAAAA";
nymB.firstChild.title = 'Please add a gloss before adding synonyms.';
nymB.nextSibling.firstChild.title = 'Please add a gloss before adding antonyms.'
},
summary: "+senseid: " + values.senseid
})
}
}, qq, qq.childNodes[1])
senseidform.firstChild.focus()
editor.withCurrentText(function (wikitext) {
wikitext = wikitext.match("==" + (window.loadedTabs ? tabbedLanguages[currentLanguageTab] : $(findtopli(qq).parentNode).prevUntil("h2").eq(-1).prev().find(".mw-headline").text()) + "==\n[\\s\\S]+?(----|$)")[0];
if (!wikitext) return;
var senses = '',
matches = wikitext.match(/(\{\{sense\||\{\{trans-top\|)[^\}]+(?=\}\})/g)
if (!matches) return;
for (var ms = 0; ms < matches.length; ms++) {
senses += "\n" + matches[ms].split("|")[1]
}
if (!senses) return;
senseidform.firstChild.onkeyup = function (e) {
e = (e || event).keyCode;
if (!(e >= 33 && e <= 40) && e != 8 && e != 46 && e != 27 && e != 16 && this.value) {
if (senses.indexOf('\n' + this.value) > -1) {
if (this.setSelectionRange) this.setSelectionRange([this.value.length, this.value = senses.match(RegExp("\n" + this.value + "[^\n]*")).toString().substr(1)][0], this.value.length);
else if (this.createTextRange) {
var z = this.createTextRange();
z.moveEnd('character', 0 - z.move('character', [this.value.length, this.value = senses.match(RegExp("\n" + this.value + "[^\n]*")).toString().substr(1)][0]) + this.value.length);
z.select()
}
}
}
}
})
})
}
function editgloss(qq) {
editor = new Editor()
editor.withCurrentText(function (wikitext) {
if (qq.editinggloss) {
return
}
qq.editinggloss = true;
var findnumberofheaders = findnumberofheaders_(qq)
var findnumberofdefs = findnumberofdefs_(qq)
var senseidform;
var oldsenseid;
new AdderWrapper(editor, {
'createForm': function () {
var thisId = "a" + String(Math.random()).replace(".", "")
oldsenseid = wikitext.replace(RegExp("(^[\\s\\S]*?((^|\n)=[\\s\\S]*?){" + findnumberofheaders + "}" + findnumberofdefs + "\\s?)"), '').match(/^\{\{senseid\|[^\\|]*\|([^\}]*)/)[1]
return senseidform = newNode('form', {
'style': 'display:inline; padding-right:20px; '
}, newNode('input', {
'size': 30,
'name': 'senseid',
'value': oldsenseid
}), newNode('input', {
'type': 'checkbox',
'id': thisId,
'name': 'changematching',
style: 'display:' + (window.tabbedLanguages ? 'inline' : 'none')
}), newNode('label', {
'for': thisId,
style: 'display:' + (window.tabbedLanguages ? 'inline' : 'none')
}, 'Edit matching glosses'), newNode('input', {
'type': 'submit',
'value': 'Change'
}), newNode('input', {
'type': 'button',
'value': 'Cancel',
'click': function () {
qq.editinggloss = false;
qq.removeChild(senseidform);
}
}), newNode('a', {
href: '/wiki/Help:Glosses'
}, 'Help?!'))
},
'fields': {
'senseid': util.validateNoWikisyntax('gloss', true),
'changematching': 'checkbox'
},
'onsubmit': function (values) {
var ttables = [],
sensetemps = [],
backups = [];
if (values.changematching) {
ttables = jQuery(".NavHead", languageContainers[currentLanguageTab]).filter(function () {
if (this.parentNode.getElementsByTagName("table")[0].className != "translations") return false;
for (var i = 0; i < this.childNodes.length; i++) {
if (this.childNodes[i].nodeType == 3 || this.childNodes[i].className == 'wt-edit-recurse') {
return (this.childNodes[i].nodeValue || this.childNodes[i].innerHTML) == oldsenseid;
}
}
})
sensetemps = jQuery(".qualifier-content", languageContainers[currentLanguageTab]).filter(function () {
return this.parentNode.nextSibling.nextSibling.className == "ib-colon" && this.innerHTML == oldsenseid;
})
}
editor.addEdit({
edit: function (wikitext) {
wikitext = wikitext.replace(RegExp("(^[\\s\\S]*?((^|\n)=[\\s\\S]*?){" + findnumberofheaders + "}" + findnumberofdefs + "\\s?(\{\{senseid\\|[^\\|]*\\|))[^\}]*"), "$1" + values.senseid);
if (values.changematching) {
var asd = wikitext.match('==' + tabbedLanguages[currentLanguageTab] + '==\n[\\s\\S]+?(\n==[^=]|$)');
wikitext = wikitext.replace(asd[0], asd[0].replace(RegExp("\\{\\{(sense|trans-top)\\|" + oldsenseid + "\\}\\}", "g"), "{\{$1\|" + values.senseid + "}}"))
}
return ccc = wikitext
},
redo: function () {
senseidform.style.display = "none";
for (var i = 0; i < ttables.length; i++) {
backups.push(document.createDocumentFragment());
while (ttables[i].childNodes[1]) {
backups[backups.length - 1].appendChild(ttables[i].childNodes[1]);
}
ttables[i].appendChild(document.createTextNode(values.senseid))
}
for (var i = 0; i < sensetemps.length; i++) {
backups.push(document.createDocumentFragment());
backups[backups.length - 1].appendChild(sensetemps[i].firstChild);
sensetemps[i].appendChild(document.createTextNode(values.senseid))
}
},
undo: function () {
senseidform.style.display = "inline";
for (var i = 0; i < ttables.length; i++) {
ttables[i].removeChild(ttables[i].childNodes[1]);
ttables[i].appendChild(backups.shift())
}
for (var i = 0; i < sensetemps.length; i++) {
sensetemps[i].removeChild(sensetemps[i].firstChild)
sensetemps[i].appendChild(backups.shift())
}
},
summary: "senseid: " + values.senseid
})
}
}, qq, qq.childNodes[1])
senseidform.firstChild.focus()
})
}
function setupnymadder(qq, nymtype) {
var passtheseheaders = "Usage notes|Inflection|Conjugation|Declension|Quotations",
nymtypelist = ["Synonyms", "Antonyms", "Hypernyms", "Hyponyms", "Meronyms", "Holonyms"]
for (var x = 0; nymtypelist[x] != nymtype; x++)
passtheseheaders += "|" + nymtypelist[x];
if (qq.parentNode.parentNode.nodeName.toLowerCase() == "li") qq = qq.parentNode.parentNode;
var findnumberofheaders = findnumberofheaders_(qq)
var findnumberofdefs = findnumberofdefs_(qq.parentNode.getElementsByTagName('li')[0])
for (var findheaderlevel = qq.parentNode; !/^h\d$/i.test(findheaderlevel.nodeName); findheaderlevel = findheaderlevel.previousSibling);
findheaderlevel = Number(findheaderlevel.nodeName.match(/\d/));
var senseidencoded = []
editor = new Editor()
editor.withCurrentText(function (wikitext) {
// Find nym header, or add it if it doesn't exist
var qqq = qq.parentNode;
while (!((qqq.className == "fakesubheader" || /h\d/i.test(qqq.nodeName)) && !qqq.innerHTML.match(passtheseheaders) || qqq.className == "printfooter" || qqq.className == "fakeheader" || qqq.className == "catlinks")) {
qqq = qqq.nextSibling
}
if (!qqq.innerHTML.match(nymtype)) {
qqq = qqq.parentNode.insertBefore(newNode('div', {
'class': 'fakesubheader'
}, newNode('h' + (findheaderlevel + 1), nymtype)), qqq);
}
// relevant vars:
// findheaderlevel is the the headerlevel of the most recent header above the ol
// qq is still the li itself
// qqq is the (possibly newly added) nym header
// find all relevant senseids, make an array of them, the whole template in each
var senseid = wikitext.replace(
RegExp("(^[\\s\\S]*?((^|\n)=[\\s\\S]*?){" + findnumberofheaders + "}" + findnumberofdefs + ")"), '').replace(/\n\n[\s\S]*$/, '').match(/\{\{senseid\|[^\\|]*\|[^\}]*/g)
if (!senseid) {
alert("No glosses were found. Click \"Add gloss\" to attach a gloss to the definition before adding " + nymtype.toLowerCase() + ".");
return
}
// run through senseids, checking for a corresponding span id'd nymtype-langcode-id, adding them encased in an li in a soon-to-be-parsed temp variable if not found, otherwise suppressing new form creation
temp = ""
var nymformexists = []
for (var i = 0; i < senseid.length; i++) {
if (document.getElementById(senseidencoded[i] = nymtype + "-" + encodeURIComponent(senseid[i].split("|")[1] + "-" + senseid[i].split("|")[2]).replace(/%20/g, '_').replace(/%3A/g, ':').replace(/%/g, '.'))) {
nymformexists[i] = true
} else {
temp += "* {" + "{sense|" + senseid[i].split("|")[2] + "}} <span id='" + nymtype + "-" + senseid[i].split("|")[1] + "-" + senseid[i].split("|")[2] + "'></span>\n"
}
}
JsMwApi().page(mw.config.get('wgPageName')).parseFragment(temp, function (res) {
var qqqq = newNode('span')
qqqq.innerHTML = res
qqqq = qqq.parentNode.insertBefore(qqqq.firstChild, qqq.nextSibling) // the ul containing the form-holder spans, right below the nym header
for (var i = 0; i < senseid.length; i++) {
if (!nymformexists[i]) {
setupnymadder2(i, senseid, wikitext)
}
}
if (qqqq.getElementsByTagName && qqqq.getElementsByTagName('li').length == 0) {
qqqq.parentNode.removeChild(qqqq)
}
scroll(0, jQuery(qqq).offset().top)
})
})
function setupnymadder2(i, senseid, wikitext) {
var nymtype2 = nymtype.slice(0, -1).toLowerCase()
var x = document.getElementById(senseidencoded[i]);
var theform
new AdderWrapper(editor, {
'createForm': function () {
return theform = newNode('form', {
'style': 'display:inline;'
}, newNode('input', {
'name': 'nym'
}), newNode('input', {
'value': 'Add',
'type': 'submit'
}))
},
'fields': {
'nym': util.validateNoWikisyntax(nymtype2, true)
},
'onsubmit': function (values, render) {
theform.getElementsByTagName('input')[0].value = ""
var firstnym = !theform.parentNode.parentNode.getElementsByTagName('a')[0]
var addedwikitext = (firstnym ? '' : ', ') + "{" + "{l|" + senseid[i].split("|")[1] + "|" + values.nym + "}}"
render(addedwikitext, function (res2) {
var nodeToInsert = newNode('span')
nodeToInsert.innerHTML = res2
editor.addEdit({
edit: function (wikitext) {
// unindent
findnumberofdefs = findnumberofdefs_(qq.parentNode.getElementsByTagName('li')[0])
if (wikitext.substr(wikitext.length - 1, 1) != "\n") {
wikitext += "\n"
}
if (!wikitext.replace(RegExp("(^[\\s\\S]*?((^|\n)=[\\s\\S]*?){" + findnumberofheaders + "}" + findnumberofdefs + ")"), '').replace(RegExp("(\n(=|\\{\\{subst:=\\}\\})={" + (findheaderlevel - 1) + "}[^=][\\s\\S]*$)"), '').match(RegExp(nymtype + "={" + findheaderlevel + "}"))) {
wikitext = wikitext.replace(RegExp("(^[\\s\\S]*?((^|\n)=[\\s\\S]*?){" + findnumberofheaders + "}" + findnumberofdefs + "[\\s\\S]*?(\n(?=(\\{\\{subst:=\\}\\}|=)=+(?=[^=])(?!(" + passtheseheaders + ")))|$))"), "$1{" + "{subst:=}}===" + (findheaderlevel == 4 ? "=" : "") + nymtype + (findheaderlevel == 4 ? "=" : "") + "====\n\n")
}
if (firstnym) {
var passthesesenseids = [];
for (var ii = 0; ii < i; ii++) {
passthesesenseids.push("\\* \\{\\{sense\\|" + senseid[ii].split("|")[2] + "\\}\\}")
}
wikitext = wikitext.replace(RegExp("(^[\\s\\S]*?((^|\n)=[\\s\\S]*?){" + findnumberofheaders + "}" + findnumberofdefs + "[\\s\\S]*?=" + nymtype + "=+[\\s\\S]*?\n" + (passthesesenseids.length > 0 ? "(?!(" + passthesesenseids.join("|") + ")))" : ")")), "$1* {" + "{sense|" + senseid[i].split("|")[2] + "}} " + addedwikitext + "\n")
} else {
wikitext = wikitext.replace(RegExp("(^[\\s\\S]*?((^|\n)=[\\s\\S]*?){" + findnumberofheaders + "}[\\s\\S]*?=" + nymtype + "=+[\\s\\S]*?\\{\\{sense\\|" + senseid[i].split("|")[2] + "\\}\\}.*)"), "$1" + addedwikitext)
}
return ccc = wikitext;
},
redo: function () {
theform.parentNode.parentNode.insertBefore(nodeToInsert, theform.parentNode)
},
undo: function () {
theform.parentNode.parentNode.removeChild(nodeToInsert)
},
summary: "+" + nymtype2 + " [[" + values.nym + "]]"
}, nodeToInsert)
})
}
}, x)
// sort the lis
var passthesesenseids = [];
for (var ii = 0; ii < i; ii++) {
passthesesenseids.push(senseid[ii].split("|")[2])
}
for (var xx = x.parentNode.parentNode.nextSibling; xx.nextSibling && !/h\d/i.test(xx.nodeName) && xx.className != "fakesubheader" && xx.nodeName.toUpperCase() != "UL"; xx = xx.nextSibling);
if (xx.nodeName.toUpperCase() == "UL") {
var xxx = xx.getElementsByTagName('li')
for (var xxxx = xxx.length; xxxx--;) {
var xxxxx = xxx[xxxx].getElementsByTagName("span")[3]
if (xxxxx && xxxxx.innerHTML == senseid[i].split("|")[2]) {
x.parentNode.parentNode.removeChild(x.parentNode);
xxx[xxxx].appendChild(x);
break;
}
if (xxxxx && passthesesenseids.length && RegExp(passthesesenseids.join("|")).test(xxxxx.innerHTML)) {
xxx[xxxx + 1] ? xx.insertBefore(x.parentNode, xxx[xxxx]) : xx.appendChild(x.parentNode);
break;
}
}
if (xxxx == -1) {
xx.insertBefore(x.parentNode, xx.firstChild)
}
}
}
}
$.when($.ready, mw.loader.using('mediawiki.util')).then(function () {
var disablebutton = document.getElementById('YRDefsideboxes-disable-button');
if (disablebutton) {
disablebutton.innerHTML = "";
var toggle = newNode('span', {
click: function () {
if ($.cookie("DisableYREdit")) {
$.cookie("DisableYREdit", null, {
path: "/"
})
toggle.innerHTML = "Disable definition editing options."
} else {
$.cookie("DisableYREdit", 1, {
expires: 30,
path: "/"
})
toggle.innerHTML = "Enable definition editing options."
}
}
}, ($.cookie("DisableYREdit") ? "Enable" : "Disable") + " definition editing options.")
disablebutton.appendChild(toggle);
}
if (mw.config.get('wgAction') == 'view' && (mw.config.get('wgNamespaceNumber') == 0 || mw.config.get('wgPageName') == "Wiktionary:Sandbox") && !/&printable=yes|&diff=|&oldid=/.test(window.location.search) && !$.cookie("DisableYREdit") && !window.DisableYREdit && !window.loadedYREdit) {
window.loadedYREdit = true;
for (var ols = document.getElementsByTagName('ol'), ii = 0; ii < ols.length; ii++) {
if (ols[ii].className != "references") {
for (var lis = ols[ii].getElementsByTagName('li'), i = 0; i < lis.length; i++) {
if (lis[i].parentNode == ols[ii] && ols[ii].parentNode.parentNode.nodeName != "UL") makedefsidebox(lis[i]);
}
}
}
mw.util.addPortletLink('p-tb', 'javascript:addPOSHeader()', 'Add part of speech');
defsidebuttons = [0]
defeditoptions = {
addingPOS: false,
styles: ["padding:1px 5px;display:inline-block;border-left:1px solid #CA0000;border-top:1px solid #CA0000;font-size:14px;color:white;font-weight:bold;background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #C70000),color-stop(1, #7A0000));background: -moz-linear-gradient(top, #C70000, #7A0000);background: -o-linear-gradient(top, #C70000, #7A0000);filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#C70000', endColorstr='#7A0000');-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#C70000', endColorstr='#7A0000');background-color:#C70000;border-radius:5px;cursor:pointer;", "padding:1px 5px;display:inline-block;border-left:1px solid #3BB677;border-top:1px solid #3BB677;font-size:14px;color:white;font-weight:bold;background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #3BB475),color-stop(1, #246E48));background:-moz-linear-gradient(top, #3BB475, #246E48);background:-o-linear-gradient(top, #3BB475, #246E48);filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3BB475', endColorstr='#246E48');-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3BB475', endColorstr='#246E48');background-color:#3BB475;border-radius:5px;cursor:pointer;"]
}
}
})