Gebruiker:MarcoSwart/common.js
Let op! Nadat u de veranderingen heeft opgeslagen, moet u de cache van uw browser nog legen om ze daadwerkelijk te zien.
Mozilla (incl. Firefox) | Ctrl+Shift+R |
Internet Explorer | Ctrl+F5 |
Opera | F5 |
Safari | Cmd+R |
Konqueror | F5 |
/* Ontleend aan https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization#Basic_setup */
var customizeToolbar = function () {
/* Your code goes here */
var heden = new Date();
var datum = heden.toISOString().slice(0,10);
/* Ontleend aan: https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization/Library */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"comment": {
label: 'Commentaar',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png',
action: {
type: 'encapsulate',
options: {
pre: "<!-- ",
post: " -->"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"ref-dat": {
label: 'Gedateerd citaat nrc',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/b/bb/Button_ébauche.png',
action: {
type: 'encapsulate',
options: { //<nowiki>
pre: "{{citeer|web|citaat=",
post: " |website=nrc.nl |taal=nl |bezochtdatum=" + datum + "}}"
} //</nowiki>
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"ipa-nl": {
label: 'IPA-nld',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/a/ad/Button_l_nl.png',
action: {
type: 'encapsulate',
options: { //<nowiki>
pre: "*{{WikiW|IPA}}: {{IPA-nl-standaard|",
post: "}}"
} //</nowiki>
}
}
}
} );
};
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
mw.loader.using( 'user.options' ).then( function () {
// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
$.when(
mw.loader.using( 'ext.wikiEditor' ), $.ready
).then( customizeToolbar );
}
} );
}
/*lintHint zie: https://en.wikipedia.org/wiki/User:PerfektesChaos/js/lintHint */
// create a user defined object
var myLintHints = { };
// specify some object component
myLintHints.rooms = "*";
// myLintHints.later = true;
// myLintHints.lazy = true;
// communicate user defined object
mw.hook( "lintHint.config" ).fire( myLintHints );
// finally, load gadget
mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/lintHint/r.js&action=raw&ctype=text/javascript" );
$(document).ready(function(){
$(".flipcont").has(":not('.panel'):not(:empty)").has(".panel:not(:empty)").wrap( "<div class='flip'></div>" )
$(".flip").click(function(){
var thisFlip = $(this);
thisFlip.children(".flipcont").children(".panel").slideToggle("slow", function(){
if (thisFlip.children(".flipcont").children(".panel").is(":visible"))
{
thisFlip.attr("title", "Klik hier voor minder tekst");
thisFlip.children(".indicator").html("▲");
} else {
thisFlip.attr("title", "Klik hier voor meer tekst");
thisFlip.children(".indicator").html("▼");
};
});
});
$(".flip").mouseover(function(){
$(this).css('cursor', 'pointer');
});
$(".flipcont").mouseover(function(event){
event.stopPropagation();
$(this).css('cursor', 'default');
});
$(".flipcont").click(function(event){
event.stopPropagation();
});
$(".flipcont").hover(
function(event) {
var parentFlip = $(this).parent();
var aTitle = parentFlip.attr("title");
parentFlip.attr("temp_title", aTitle);
parentFlip.attr("title","");
}, function(event) {
var parentFlip = $(this).parent();
var aTitle = parentFlip.attr("temp_title");
parentFlip.attr("title", aTitle);
}
);
$(".flip").attr("title", "Klik hier voor meer tekst");
$(".flip").append('<div class="indicator">▼</div>');
});