Wikipedista:Jvs/common.js
Vzhled
Poznámka: Po uložení musíte vyprázdnit mezipaměť vašeho prohlížeče, jinak změny neuvidíte.
/** Tlačítka */
mw.loader.using('mediawiki.action.edit', function () {
var button;
/*button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/d/d1/Button_mysignature.png',
speedTip: 'Alternativní podpis |',
tagOpen: '--[[Wikipedista:Jvs|Jvs]] <sub>[[Wikipedista diskuse:Jvs|slova]]</sub><sup>[[Speciální:Contributions/Jvs|činy]]</sup> \x7E\x7E\x7E\x7E\x7E',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);*/
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/a/a0/Button_keep.png',
speedTip: 'Vyřešeno',
tagOpen: '\x7b\x7bNástěnka správců/Vyřešeno}} ',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/1/13/Button_delete.png',
speedTip: 'Nevyřešeno',
tagOpen: '\x7b\x7bNástěnka správců/Nevyřešeno}} ',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
/*button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/3/38/Button_comment_vote.png',
speedTip: 'Komentář',
tagOpen: '\x7b\x7bKomentář}} ',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);*/
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/c/cd/Exp0.png',
speedTip: 'Experimenty0',
tagOpen: '\x7b\x7bsubst:experimenty0}} --\x7E\x7E\x7E\x7E',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/a/a5/Buttonexperimenty.png',
speedTip: 'Experimenty',
tagOpen: '\x7b\x7bsubst:experimenty}} --\x7E\x7E\x7E\x7E',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/1/16/Buttonexperimenty2.png',
speedTip: 'Experimenty2',
tagOpen: '\x7b\x7bsubst:experimenty2}} --\x7E\x7E\x7E\x7E',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
/*button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/5/5b/Button_STFW.png',
speedTip: 'ExperimentySTFW',
tagOpen: '\x7b\x7bExperimentySTFW}} --\x7E\x7E\x7E\x7E',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);*/
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/2/2e/Button_broom.png',
speedTip: 'Smazaný článek',
tagOpen: '\x7b\x7bsubst:nevýznamné',
tagClose: '}} ',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/1/13/Stub_class_button.png',
speedTip: 'Subpahýl',
tagOpen: '\x7b\x7bsubst:subpahýl}}',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/2/22/Button_radio_activite.png',
speedTip: 'Urgentně upravit',
tagOpen: '\x7b\x7bsubst:Urgentně upravit}}',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/e/e5/Button_copyvio.png',
speedTip: 'Copyvio',
tagOpen: '\x7b\x7bCopyvio|zdroj=',
tagClose: '}}',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/3/33/Button_unreferenced.png',
speedTip: 'Chybí zdroj',
tagOpen: '\x7b\x7bsubst:Fakt',
tagClose: '}}',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/4/4a/Button_welcome.png',
speedTip: 'Vítejte',
tagOpen: '\x7b\x7bsubst:vítejte}} --\x7E\x7E\x7E\x7E',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/e/e9/Button_preview.png',
speedTip: 'Náhled',
tagOpen: '== Prosím používejte tlačítko „Ukázat náhled“ ==\n\x7b\x7bsubst:Náhled}} --\x7E\x7E\x7E\x7E',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/6/6c/Button_commons.png',
speedTip: 'Commonscat',
tagOpen: '\x7b\x7bCommonscat|',
tagClose: '}}',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/9/91/Button_cite_web.png',
speedTip: 'Citace elektronické monografie (webu)',
tagOpen: '<ref>\x7b\x7bCitace elektronické monografie\n | příjmení = \n | jméno = \n | odkaz na autora = \n | vydavatel = \n | titul = \n | url = \n | datum vydání = \n | datum přístupu = ' + (y = new Date().getFullYear ()) + '-' + (m = new Date ().getMonth () + 1) + '-' + (d = new Date ().getDate ()) + '\n | jazyk = \n}}</ref>',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/e/ef/Button_cite_book.png',
speedTip: 'Citace monografie',
tagOpen: '<ref>\x7b\x7bCitace monografie\n | příjmení = \n | jméno = \n | odkaz na autora = \n | titul = \n | vydavatel = \n | místo = \n | rok = \n | isbn = \n | strany = \n | počet stran = \n | url = \n | jazyk = \n}}</ref>',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/4/49/Button_cite_journal.png',
speedTip: 'Citace periodika',
tagOpen: '<ref>\x7b\x7bCitace periodika\n | příjmení = \n | jméno = \n | autor = \n | titul = \n | periodikum = \n | rok = \n | měsíc = \n | ročník = volume \n | číslo = issue \n | doi = \n | issn = \n | url = \n | strany = \n | jazyk = \n}}</ref>',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/1/17/Button_small_2.png',
speedTip: 'Small',
tagOpen: '\x7b\x7bmalé|',
tagClose: '}}',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/0/05/Button_Anf%C3%BChrung.png',
speedTip: 'Uvozovky',
tagOpen: '\„',
tagClose: '\“',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/6/64/Button_nbsp_bold.png',
speedTip: 'Pevná mezera',
tagOpen: ' ',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/d/d2/Button_flagicon.png',
speedTip: 'Flagicon',
tagOpen: '\x7b\x7bflagicon|',
tagClose: '}}',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/3/3a/Button_av-img.png',
speedTip: 'Požadavek na obrázek',
tagOpen: '\x7b\x7bPožadavek na obrázek}}',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/a/a5/Button_STUB.png',
speedTip: 'Pahýl',
tagOpen: '\x7b\x7bpahýl}}',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/4/41/Button_hr_halfwidth.png',
speedTip: 'Pomlčka',
tagOpen: '–',
tagClose: '',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
button = { id: 'button-comment',
imageFile: '/media/wikipedia/commons/4/4f/Button_sig_(zh).png',
speedTip: 'Překlad',
tagOpen: '\x7b\x7bPřeklad|en|',
tagClose: '|}}',
sampleText: ''
};
mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
});
// --------- přemapování klávesov. kombinací Ctrl+L, Ctrl+B a Ctrl+I, testováno ve Firefoxu 3.0.8). ---------
var myAccessKeys = {
addEvent : function(obj, type, fn) {
if (obj.addEventListener) {
obj.addEventListener(type, fn, false);
}
else if (obj.attachEvent) { // IE
obj.attachEvent('on' + type, function() {return fn.apply(obj, new Array(window.event));});
}
},
filterKey : function(evt) {
if (!evt) evt = event;
var keyCode = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode;
/*
if (evt.altKey && evt.shiftKey)
if (evt.ctrlKey)
if (evt.shiftKey)
if (evt.altKey)
*/
if (evt.ctrlKey)
{
if (false);
else if (keyCode == 66 || keyCode == 98) {
// alert("Ctrl+B/b pressed");
insertTags("\'\'\'","\'\'\'","Tučný text");
evt.preventDefault();
return false;
}
else if (keyCode == 73 || keyCode == 105) {
// alert("Ctrl+I/i pressed");
insertTags("\'\'","\'\'","Kurzíva");
evt.preventDefault();
return false;
}
else if (keyCode == 76 || keyCode == 108) {
// alert("Ctrl+L/l pressed");
insertTags("[[","]]","Název odkazu");
evt.preventDefault();
return false;
}
}
return true;
},
init : function() {
if (document.getElementById('wpTextbox1')) {
myAccessKeys.addEvent(document.getElementById('wpTextbox1'), 'keypress', myAccessKeys.filterKey);
}
}
};
addOnloadHook(function() { myAccessKeys.init(); });
// --- Vypnout automatické uložení stránky pomocí klávesy Enter ---
if (1) {
var disableEnter = function(e) {
var key = (window.event ? window.event.keyCode /*IE*/ : e.which /*FF*/);
return (key != 13);
};
addOnloadHook(function() {
if (document.getElementById('wpMinoredit')) {
document.getElementById('wpMinoredit').onkeypress = disableEnter;
}
if (document.getElementById('wpSummary')) {
document.getElementById('wpSummary').onkeypress = disableEnter;
// ve shrnuti editace vysunout razeni v kategoriich az za hranate zavorky
document.getElementById('wpSummary').onchange = function() {
var f = this;
f.value = f.value.replace(/\[\[(Kategorie:.*?)\|(.*?)]]/, "[[$1]] ($2)");
};
}
});
}
/**
* Direct imagelinks to Commons
*
* @source: http://www.mediawiki.org/wiki/Snippets/Direct_imagelinks_to_Commons
* @author: [[commons:User:Krinkle]]
* @rev: 5
*/
if ( mw.config.get( 'wgNamespaceNumber', 0 ) >= 0 ) {
$(document).ready( function() {
// Must be relative without "https://secure.wikimedia.org."
// to avoid triggering 'div#content a[href ^="https://"]' lock-icons
var commonsBase = mw.config.get( 'wgServer' ) === "https://secure.wikimedia.org"
? '/wikipedia/commons/wiki/File:'
: '//commons.wikimedia.org/wiki/File:',
localBase = mw.util.wikiGetlink( mw.config.get( 'wgFormattedNamespaces' )['6'] + ':' ),
uploadBaseRe = new RegExp( '^' + $.escapeRE( '/media/wikipedia/commons/' ) );
$( 'a.image' ).attr( 'href', function( i, currVal ) {
if ( uploadBaseRe.test( $(this).find( 'img' ).attr( 'src' ) ) ) {
return currVal.replace( localBase, commonsBase );
}
});
});
}
// --- Wire ---
importScriptURI("//cs.wikipedia.org/w/index.php?title=Wikipedista:Jvs/wire_CURRENT.js&action=raw&ctype=text/javascript&dontcountme=s");
// [[d:User:Yair rand/WikidataInfo.js]]
importScriptURI("//www.wikidata.org/w/index.php?title=User:Yair rand/WikidataInfo.js&action=raw&ctype=text/javascript");
// Nukování
function addNuke() {
addPortletLink("p-tb","https://cs.wikipedia.org/w/index.php?title=Speciální:Nuke&action=submit&target="+wgTitle ,"Hromadné mazání","tb-Nuke","Hromadně smazat založené stránky");
}
if (wgNamespaceNumber == 2 || wgNamespaceNumber == 3) {
addOnloadHook(addNuke);
}