// <nowiki>
//$('.cm-editor').append(window.getComputedStyle(document.querySelector('.cm-editor'), '::after').content.replace( /"/g, '' ));
//$('.cm-editor').removeClass('pseudo');
/*
$.getScript("//en.wiktionary.orghttps://en.wiktionary.org/w/index.php?title=User:Erutuon/scripts/apiWrapper.js&action=raw")
.done(function () {
function xlit(term, callback) {
apiWrapper.callLua('require("Module:peo-translit").tr("' + term + '", nil, "Xpeo")', callback);
}
$.when(mw.loader.using("mediawiki.util"), $.ready).done(function(){
jQuery(document).ready(function() {
var peoElements = document.querySelectorAll('span');
for (var j=0, max=peoElements.length; j < max; j++) {
const elem = peoElements;
xlit(elem.firstChild.innerHTML, function (translit) {
elem.append(" (" + translit + ")");
});
}
});
});
});
*/
/*var gotElements = document.querySelectorAll('span');
var gotLatnElements = document.querySelectorAll('span');
for (var j=0, max=gotElements.length; j < max; j++) {
var gotParent = gotElements.parentElement;
gotElements.prepend(gotParent.getElementsByTagName('a').innerHTML);
}*/
setTimeout(function(){
var pseudoElements = document.querySelectorAll('.cite-meta li');
for (var i=0, max=pseudoElements.length; i < max; i++) {
var before = window.getComputedStyle(pseudoElements, '::before');
var after = window.getComputedStyle(pseudoElements, '::after');
if (before.content != "none") {
pseudoElements.parentElement.prepend(before.content.replace( /(^")|("$)/g, '' ));
pseudoElements.style.display = 'none';
}
if (after.content != "none") {
pseudoElements.parentElement.append(after.content.replace( /(^")|("$)/g, '' ));
pseudoElements.style.display = 'none';
}
}
});
jQuery(document).ready(function() {
jQuery('.cite-meta-2').html(jQuery(".cite-meta").html());
});
var columns = 3;
var rows = 3;
var $rootElement = $("#example4");
var count = $rootElement.find("ul li").length;
var round_split = Math.round(count/columns);
var offset = 0;
if (count < (columns*rows)) { $rootElement.find(".vsToggleElement").hide(); }
if (count - (round_split*columns) == 1) { offset = 1 }
var col2_start = (round_split+1)+offset;
var col3_start = ((round_split*2)+1)+(offset*2);
var links = "ul li:nth-child(-n+" + rows + ")";
if (columns == 2 || columns == 3) { links += ", ul li:nth-child(+n" + col2_start + "):nth-child(-n+" + (col2_start+(rows-1)) + ")"; }
if (columns == 3) { links += ", ul li:nth-child(+n" + col3_start + "):nth-child(-n+" + (col3_start+(rows-1)) + ")"; }
$rootElement.find("ul li").not(links).addClass("vsHide");
($(document).ready(function () {
(new mw.Api()).get({
action: 'parse',
text: '{{reconstructed}}',
title: mw.config.values.wgPageName,
}).done(function (data) {
console.log(data);
const result = data.parse.text;
if (result)
$(result).prependTo('.ns-118.action-view #mw-content-text');
});
}));
//var element = document.querySelectorAll('');
//.forEach.call(element, function(element) {
// var parent = element.parentElement.innerHTML.replace(/ *\(*\) */g, "");
// element.parentElement.innerHTML = parent;
//});*/
var customizeToolbar = function () {
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"references": {
label: 'Add references section',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/3/32/OOjs_UI_icon_ref.svg/22px-OOjs_UI_icon_ref.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "===References===\n<references />",
'ownline': true
}
}
},
"desc": {
label: 'Replace with {{desc}}',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/2/2f/D-shortcode.svg/22px-D-shortcode.svg.png',
action: {
type: 'replace',
options: {
'regex': /\b.*\:\s*\{{l\|(*)\}}/g,
'regexReplace': "{{desc|$1}}",
}
}
},
"subst": {
label: 'Add subst:chars',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/4/43/OOjs_UI_icon_language-ltr.svg/22px-OOjs_UI_icon_language-ltr.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "subst:chars|"
}
}
},
"alter": {
label: 'Add {{alter}}',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "===Alternative forms===\n\* {{alter|lang|term}}",
'ownline': true
}
}
},
"templates": {
label: 'Add Template',
type: 'select',
list: {
'grc-Beekes' : {
label: 'grc:Beekes',
action: {
type: 'encapsulate',
options: {
pre: '<ref>{{R:grc:Beekes|head=|page=}}</ref>'
}
}
},
'ira-ESIJa' : {
label: 'ira:ESIJa',
action: {
type: 'encapsulate',
options: {
pre: '<ref>{{R:ira:ESIJa|vol=I||}}</ref>'
}
}
},
'ira-Cheung-2007' : {
label: 'ira:Cheung:2007',
action: {
type: 'encapsulate',
options: {
pre: '<ref>{{R:ira:EDIV||}}</ref>'
}
}
},
'ira-Novak-2013' : {
label: 'ira:Novák:2013',
action: {
type: 'encapsulate',
options: {
pre: '<ref>{{R:ira:Novak:2013|}}</ref>'
}
}
},
'itc-De-Vaan-2008' : {
label: 'itc:De Vaan:2008',
action: {
type: 'encapsulate',
options: {
pre: '<ref>{{R:itc:EDL||}}</ref>'
}
}
},
'bsl-Derksen-2015' : {
label: 'bsl:Derksen:2015',
action: {
type: 'encapsulate',
options: {
pre: '<ref>{{R:bsl:EDBIL||}}</ref>'
}
}
},
'gem-Kroonen-2013' : {
label: 'gem:Kroonen:2013',
action: {
type: 'encapsulate',
options: {
pre: '<ref>{{R:gem:EDPG||}}</ref>'
}
}
},
'ine:LIV' : {
label: 'ine:LIV',
action: {
type: 'encapsulate',
options: {
pre: '<ref>{{R:ine:LIV||}}</ref>'
}
}
},
'cel-Matasovic-2009' : {
label: 'cel:Matasovic:2009',
action: {
type: 'encapsulate',
options: {
pre: '<ref>{{R:cel:EDPC|head=|}}</ref>'
}
}
},
'TOitPIEatPIEw' : {
label: 'TOitPIEatPIEw',
action: {
type: 'encapsulate',
options: {
pre: '<ref>{{R:TOitPIEatPIEw|head=|}}</ref>'
}
}
},
}
}
}
});
};
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( $.inArray( mw.config.get( 'wgAction' ), ) !== -1 ) {
mw.loader.using( 'user.options' ).then( function () {
// This can be the string "0" if the user disabled the preference (])
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
$.when(
mw.loader.using( 'ext.wikiEditor' ), $.ready
).then( customizeToolbar );
}
} );
}
// </nowiki>