Wikipedysta:Kaligula/common.js
// license CC-BY-SA 3.0
/*
* IF NOT MOBILE /BEGIN
**/
if (!(/Android/).test(navigator.userAgent)) {
/* 1. VIEWING
-------------------------------------------------------------------------------------------*/
/* GENERAL INTERFACE
--------------------*/
/* UPPER MENU */
// my changes to upper menu [[Wikipedysta:Kaligula/js/menu.js]]
importScript('Wikipedysta:Kaligula/js/menu.js');
/* TABS */
// Ulubione
importScript('Wikipedysta:Kaligula/js/Gadget-favorites.js');
// duplicate upper tabs to bottom tabs
//importScript('Wikipedysta:Kaligula/js/Gadget-btm-actions.js');
/* SIDEBAR */
// showing link (in sidebar) for viewing all subpages [[Wikipedysta:Mikołka/SubPages.js]]
importScript('Wikipedysta:Mikołka/SubPages.js');
// link ["Upload file"] in sidebar leads to commons-upload-page ([[Wikipedysta:Kaligula/js/Gadget-CommonsUploadLink.js]])
importScript('Wikipedysta:Kaligula/js/Gadget-CommonsUploadLink.js');
/* OTHER */
// (un)collapse navbox by clicking on its head
if (mw.config.get('wgAction')=='view'){
$(document).ready(function(){
if ($('table.collapsible th').length > 0) {
for (i=0;i<$('table.collapsible').length;i++) {
var t=$($('table.collapsible')[i]);
var l=t.find('th span a')[0];
eval('var f=function(){'+l.href.replace(/javascript:/g,'')+'};');
l.removeAttribute('href');
var r=t.find('th')[0].parentElement;
r.addEventListener('click',f,false);
var a=$(r).find('a:not(#collapseButton'+i+')');
a.each(function(){
this.addEventListener('click',function(e){e.stopPropagation();},false);
});
}
}
});
}
/* ON HISTORY TAB
--------------------*/
if (mw.config.get('wgAction')=='history') {
// hiding bot edits in History Tab [[:Wikipedysta:Matma Rex/hideBotsInHistory v2.js]]
importScript('Wikipedysta:Matma Rex/hideBotsInHistory v2.js')
// coloring my nick on history tab ([[Wikipedia:Narzędzia/Kolorowanie i zamiana nicków]])
var cn$class = {'Kaligula': 'nick_self'};
}
/* ON CATEGORY PAGE
--------------------*/
// obserwowane strony oznaczane na stronie kategorii [[Wikipedysta:Kaligula/js/watchCat.js]]
if ( ((mw.config.get('wgNamespaceNumber')==14)&&(mw.config.get('wgAction')=='view')) || (mw.config.get('wgPageName')=='Specjalna:GadgetPrefs') ) {
importScript('Wikipedysta:Kaligula/js/watchCat.js');
}
/* ON USER PAGE
--------------------*/
// showing last edit of a user below his name on his page [[:Wikipedysta:Beau/skrypty/seen.js]]
((mw.config.get('wgNamespaceNumber')==2||mw.config.get('wgNamespaceNumber')==3)&&mw.config.get('wgAction')=='view')?importScript('Wikipedysta:Beau/skrypty/seen.js'):{};
/* REVIEWING
--------------------*/
// 'review' tab over an article; [[Wikipedysta:Matma Rex/przejrzyj.js]]
(mw.config.get('wgNamespaceNumber')==0&&mw.config.get('wgAction')=='view')?importScript('Wikipedysta:Matma Rex/przejrzyj.js'):{};
// Otwieracz nieprzejrzanych edycji [[:Wikipedysta:Harry lp/oldRevUserContrib]]
if(mw.config.get('wgPageName')=='Specjalna:Wkład'){
var oldRevUnReviewed = true;
importScript('Wikipedysta:Harry lp/oldRevUserContrib.js');
}
/* OTHER TOOLS
--------------------*/
// myNotepad – [[Wikipedysta:Vinne2/scripts/myNotepad]]
importScript('Wikipedysta:Vinne2/scripts/myNotepad.js');
// automatyczna obsługa zgłoszeń dot. wyróżnień [[Wikipedysta:Kaligula/js/Gadget-NominateReport.js]]
importScript('Wikipedysta:Kaligula/js/Gadget-NominateReport.js');
//oznaczanie stron mniejszych niż X bajtów, na stronie indeksu haseł
importScript('Wikipedysta:Kaligula/js/Gadget-LittlePages.js');
/* 2. EDITING
-------------------------------------------------------------------------------------------*/
// simple managing categories of the article [gadget: HotCat, preferences]
var hotcat_no_autocommit = 0;
if($.inArray(mw.config.get('wgAction'),['edit','submit'])>-1){
/* TOOLBAR
--------------------*/
// my changes to (new) toolbar ([[Wikipedysta:Kaligula/js/toolbar.js]])
importScript('Wikipedysta:Kaligula/js/toolbar.js');
// przenoszenie refów na koniec kodu [[:Wikipedysta:Matma Rex/prettyref.js]]
importScript("Wikipedysta:Matma Rex/prettyref.js");
// ręczne: prettyref_run()
// zamiana danych BibTeX/RIS na {{cytuj pismo}} // [[user:Kaligula/js/citejournal.js]]
importScript("Wikipedysta:Kaligula/js/citejournal.js");
// Zamiana [link opis] na {{cytuj stronę}}
importScript("Wikipedysta:Matma Rex/cytuj stronę.js");
// Citation templates generator in editor [[Wikipedysta:Holek/cite-gen.js]]
importScript('Wikipedysta:Holek/cite-gen.js');
// [[WP:SK]] (NIE WŁĄCZAĆ W GADŻETACH BO BĘDZIE KONFLIKT!!!)
var wp_sk_show_as_button = true; // pokazuj przycisk
var wp_sk_redir_enabled = true; // ajaksowe redirecty
mw.loader.using( 'ext.gadget.wp_sk', function() {
importScript( 'Wikipedysta:Beno/wp_sk.js' )
});
/* OTHER
--------------------*/
// Zaznacza kolorem poprawnie sformatowane linki wewn. i zewn., szablony, tabelki, nagłówki i listy.
// [[Wikipedysta:Matma Rex/highlight.js]], autor: [[pl:user:Matma Rex]]
//importScript("Wikipedysta:Matma Rex/highlight.js");
//syntax highlighter
mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
$(document).ready(function() {
// when using dynamic preview&diff (→ Preferences) add regular buttons again
if ( mw.user.options.values.uselivepreview=="1") {
$('<input id="wpPreview2" name="wpPreview" type="submit" tabindex="" value="Zwykły podgląd" title="Przeładuj stronę i wyświetl podgląd. [alt-shift-P]">').insertAfter('#wpPreview');
$('<input id="wpDiff2" name="wpDiff" type="submit" tabindex="" value="Zwykły podgląd zmian" title="Przeładuj i pokaż zmiany. [alt-shift-V]">').insertAfter('#wpDiff');
}
// uncheck the "Watch it" textbox while editing a User_talk and a few other pages
if ( mw.config.get('wgNamespaceNumber')==3 || $.inArray(mw.config.get('wgTitle'),['Czy wiesz/propozycje','Zgłoś błąd w artykule'])==1 ) {
document.getElementById('wpWatchthis').checked = false;
} else if (mw.config.get('wgNamespaceNumber')==0) { // ask if the edit is outside the mainspace
document.getElementById('wpWatchthis').checked = confirm('Czy dodać tę stronę do obserwowanych?');
}
});
}
// switch VisualEditor → SourceEditor
$(document).ready(function(){
$('#ca-edit a').bind('click', function(){
importScript('en:User:John Vandenberg/switch editor 2.js');
});
});
// WikiLikesMonuments editor by Yarl
((mw.config.get('wgAction')=='view'&&mw.config.get('wgNamespaceNumber')===4&&(/^Wiki Lubi Zabytki\/.*?\/.+/).test(mw.config.get('wgTitle'))))?importScript('Wikipedysta:Yarl/wlm.js'):'';
/* 3. KALIGULA OBJECT
-------------------------------------------------------------------------------------------*/
// oznaczanie sekcji jako {{Załatwione}} ([[user:Kaligula/js/markAsDone.js]])
importScript('Wikipedysta:Kaligula/js/markAsDone.js');
// narzędzia różne ([[user:Kaligula/js/tools.js]])
importScript('Wikipedysta:Kaligula/js/tools.js');
/* 4. TESTS
-------------------------------------------------------------------------------------------*/
// testowanie skryptu zgłaszania czywiesza [[Wikipedysta:Kaligula/js/CzyWiesz.js]]
//importScript('Wikipedysta:Kaligula/js/CzyWiesz.js');
// info o konieczności archiwizacji strony dyskusji, autor: [[user:Kaligula]]
if (mw.config.get('wgTitle') == 'Kaligula' && mw.config.get('wgNamespaceNumber') == 3 && mw.config.get('wgAction') == 'view') {
$.ajax('/w/api.php?action=query&prop=info&format=json&indexpageids=&titles=Dyskusja%20wikipedysty%3AKaligula').done(function(a){
var b = a.query.pages[a.query.pageids[0]].length/1000;
// author: [[user:Kaligula]]
if (b > 90) {
// var c = document.getElementById('pt-mytalk');
// c.innerHTML = '<span title="Zarchiwizuj mnie! Ważę już: ' + b + ' KB… :(" style="font-weight: bold">! </span>' + c.innerHTML;
alert('Zarchiwizuj mnie! Ważę już: ' + b + ' KB… :(');
}
else {
console.log('Cześć! To ja, Twoja strona dyskusji. Ważę już: ' + b + ' KB. Rosnę w siłę! ;)');
}
});
}
}
/*
* IF NOT MOBILE /END
**/
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.