MediaWiki:Common.js: verschil tussen versies
Uit Auditpedia
Regel 17: | Regel 17: | ||
if ( vetextarea ) { | if ( vetextarea ) { | ||
//load veforall | //load veforall | ||
− | mw.loader.using('ext.veforall.main').then(function(data){ | + | mw.loader.using( ['ext.veforall.main','ext.cite.visualEditor'] ).then(function(data){ |
vetextarea.forEach(function(el){ | vetextarea.forEach(function(el){ | ||
Regel 27: | Regel 27: | ||
//$(el).applyVisualEditor(); | //$(el).applyVisualEditor(); | ||
}) | }) | ||
− | |||
}); | }); | ||
− | |||
} | } |
Versie van 17 mrt 2022 11:16
/* Any JavaScript here will be loaded for all users on every page load. <script>*/
// take every link-captioned image and change the link to the link in the caption, if present
$( document ).ready(function() {
$('#mw-content-text div.thumb a.image').each(function() {
var link = $(this).closest('.thumb').find('div.thumbcaption a');
if (link.length ) {
var url = link[link.length-1].href;
this.href = url;
};
});
});
//check for visualeditor textareas
var vetextarea = document.querySelectorAll('.ve-area-wrapper textarea');
if ( vetextarea ) {
//load veforall
mw.loader.using( ['ext.veforall.main','ext.cite.visualEditor'] ).then(function(data){
vetextarea.forEach(function(el){
//un-escape pipes
var text = $(el).val();
var esc = text.replace(/{{!}}/gmi, "|");
$(el).val(esc);
//apply visualeditor(s)
//$(el).applyVisualEditor();
})
});
}