Notandi:Snævar/common.js
(Endurbeint frá Notandi:Snaevar/common.js)
Athugaðu: Eftir útgáfu kann að vera að þú þurfir að komast hjá skyndiminni vafrans þíns til að sjá breytingarnar.
- Firefox / Safari: Haltu Shift samtímis og þú smellir á Endurhlaða (Reload), eða ýttu á annaðhvort Ctrl-F5 eða Ctrl-R (⌘-R á Mac)
- Google Chrome: Ýttu á Ctrl-Shift-R (⌘-Shift-R á Mac)
- Internet Explorer / Edge: Haltu Ctrl samtímis og þú smellir á Endurnýja (Refresh), eða ýttu á Ctrl-F5
- Opera: Farðu í Verkfæri (Tools) → Stillingar (Preferences) og svo Friðhelgi og öryggi (Privacy & security) → Hreinsa vafragögn (Clear browsing data) → Myndir og skrár í skyndiminni (Chached images and files)
/**
* Description: Modify parts of the toolbar to better suit this projects needs
* Maintainer:
*/
if (mw.config.get("skin") != "minerva") {
(function (mw, $, undefined) {
// function to build complete labels, just to get rid of some pesky errors
var label = function (msg, txt, before, after) {
var str = '';
if (before === undefined ? true : before) str += "{" + "{";
str += msg;
if (after === undefined ? true : after) str += "}" + "}";
if (txt) str += " – " + txt;
return str;
};
// function to build pre-parts of the templates, just to get rid of some pesky errors
var pre = function (msg, txt, before) {
var str = '';
if (before === undefined ? true : before) str += "{" + "{";
str += msg;
if (txt) str += txt;
return str;
};
// function to build peri-parts of the templates, just to get rid of some pesky errors
var peri = function (msg, txt, before, after) {
var str = '';
if (before === undefined ? true : before) str += "{" + "{";
str += msg;
if (txt) str += txt;
if (after === undefined ? true : after) str += "}" + "}";
return str;
};
// customization for the beta toolbar
var customizeBetaToolbar = function () {
// Bætir við takka til þess að setja inn íslenskar gæsalappir
$('#wpTextbox1').wikiEditor('addToToolbar', {
'section': 'main',
'group': 'format',
'tools': {
'quote': {
label: 'Gæsalappir',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/b/b7/Ghilimele_rom%C3%A2ne%C8%99ti.png',
action: {
type: 'encapsulate',
options: {
pre: "„",
//peri: "„”",
post: "”"
}
}
}
}
});
// Add button for inserting double curly brackets
$('#wpTextbox1').wikiEditor('addToToolbar', {
'section': 'main',
'group': 'format',
'tools': {
'link': {
label: 'Snið',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/4/4a/Norwegian_template_sign.png',
action: {
type: 'encapsulate',
options: {
pre: "{{",
//peri: "{{}}",
post: "}}"
}
}
}
}
});
// add a titles menu in the advanced section
$('#wpTextbox1').wikiEditor('addToToolbar', {
'section': 'advanced',
groups: {
'heading': {
tools: {
'heading': {
label: 'Kaflar',
type: 'select',
list: {
'titles-see-also' : {
label: '== Tengt efni == – innri tenglar á önnur verkefni',
action: {
type: 'encapsulate',
options: {
pre: '== Tengt efni ==',
ownline: true
}
}
},
'titles-source' : {
label: '== Heimildir == – heimildaskrá',
action: {
type: 'encapsulate',
options: {
pre: '== Heimildir ==\n<references/>\n',
ownline: true
}
}
},
'titles-links' : {
label: '== Tenglar == – tenglar á vefsíður',
action: {
type: 'encapsulate',
options: {
pre: '== Tenglar ==',
ownline: true
}
}
}
}
}
}
}
}
});
};
/* Check if we are in edit mode and the required modules are available and then customize the toolbar */
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
mw.loader.using('user.options', function () {
if (mw.user.options.get('usebetatoolbar')) {
mw.loader.using( 'ext.wikiEditor', function () {
$(customizeBetaToolbar);
});
}
else {
$(customizeOrigToolbar);
}
});
}
})(mediaWiki, jQuery);
}
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Contributions' || mw.config.get( 'wgNamespaceNumber' ) == 2) {
mw.util.addPortletLink(
"p-tb",
"https://intersect-contribs.toolforge.org/index.php?project=iswiki",
"Compare multiple users",
"t-multicompare",
"Bera saman valda notendur"
);
}