MediaWiki:Common.js
From Wikizilla, the kaiju encyclopedia
Jump to navigationJump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
// Incluir Gadget-HotCat.js // Para desactivar, agrega "window.noHotCat = true" en tu Monobook.js if (mw.config.get('skin') != 'oasis' && mw.config.get('wgAction') == 'view' && (mw.config.get('wgNamespaceNumber') == 0 || mw.config.get('wgNamespaceNumber') == 6 || mw.config.get('wgNamespaceNumber') == 14) && window.location.toString().indexOf('diff=') == -1) { (typeof(window.safeOnLoadHook)=='function'?safeOnLoadHook:$)(function() { if (!document.getElementById('csAddCategorySwitch') && !window.noHotCat) { if ($('#catlinks').length == 0) { $('#'+(window.bodyContentId||'bodyContent')).children('div.printfooter').after('<div id="catlinks" class="catlinks"></div>'); } if ($('#mw-normal-catlinks').length == 0) { $('#catlinks').prepend('<div id="mw-normal-catlinks"><a title="Special:Categories" href="'+mw.config.get('wgArticlePath', '').replace('$1', 'Special:Categories')+'">Categories</a></div>'); } $('#mw-normal-catlinks').children('a').eq(0).after('<span class="noprint"> <span>(<a style="cursor: pointer;" title="Modify categories"><span>+<sup>+</sup></span></a>)</span></span>').next().find('a').click(function() { $(this).unbind().closest('span.noprint').eq(0).remove(); importScript('MediaWiki:Common.js/Clases/Gadget-HotCat.js'); return false; }); $('#catlinks').removeClass('catlinks-allhidden'); } }); } else if (mw.config.get('wgCanonicalSpecialPageName', '') == 'Upload') { (typeof(window.safeOnLoadHook)=='function'?safeOnLoadHook:$)(function() { importScript('MediaWiki:Common.js/Clases/Gadget-HotCat.js'); }); } /** * Collapsible tables * * @version 2.0.2 (2014-03-14) * @source https://www.mediawiki.org/wiki/MediaWiki:Gadget-collapsibleTables.js * @author [[User:R. Koot]] * @author [[User:Krinkle]] * @deprecated Since MediaWiki 1.20: Use class="mw-collapsible" instead which * is supported in MediaWiki core. */ /*global $, mw */ var autoCollapse = 2; var collapseCaption = 'hide'; var expandCaption = 'show'; function collapseTable( tableIndex ) { var Button = document.getElementById( 'collapseButton' + tableIndex ); var Table = document.getElementById( 'collapsibleTable' + tableIndex ); if ( !Table || !Button ) { return false; } var Rows = Table.rows; var i; if ( Button.firstChild.data === collapseCaption ) { for ( i = 1; i < Rows.length; i++ ) { Rows[i].style.display = 'none'; } Button.firstChild.data = expandCaption; } else { for ( i = 1; i < Rows.length; i++ ) { Rows[i].style.display = Rows[0].style.display; } Button.firstChild.data = collapseCaption; } } function createClickHandler( tableIndex ) { return function ( e ) { e.preventDefault(); collapseTable( tableIndex ); }; } function createCollapseButtons() { var tableIndex = 0; var NavigationBoxes = {}; var Tables = document.getElementsByTagName( 'table' ); var i; for ( i = 0; i < Tables.length; i++ ) { if ( $( Tables[i] ).hasClass( 'collapsible' ) ) { /* only add button and increment count if there is a header row to work with */ var HeaderRow = Tables[i].getElementsByTagName( 'tr' )[0]; if ( !HeaderRow ) { continue; } var Header = HeaderRow.getElementsByTagName( 'th' )[0]; if ( !Header ) { continue; } NavigationBoxes[tableIndex] = Tables[i]; Tables[i].setAttribute( 'id', 'collapsibleTable' + tableIndex ); var Button = document.createElement( 'span' ); var ButtonLink = document.createElement( 'a' ); var ButtonText = document.createTextNode( collapseCaption ); // TODO: Declare styles in [[MediaWiki:Gadget-collapsibleTables.css]] // Button.className = 'collapseButton'; Button.style.styleFloat = 'right'; Button.style.cssFloat = 'right'; Button.style.fontWeight = 'normal'; Button.style.textAlign = 'right'; Button.style.width = '6em'; ButtonLink.style.color = Header.style.color; ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex ); ButtonLink.setAttribute( 'href', '#' ); $( ButtonLink ).on( 'click', createClickHandler( tableIndex ) ); ButtonLink.appendChild( ButtonText ); Button.appendChild( document.createTextNode( '[' ) ); Button.appendChild( ButtonLink ); Button.appendChild( document.createTextNode( ']' ) ); Header.insertBefore( Button, Header.firstChild ); tableIndex++; } } for ( i = 0; i < tableIndex; i++ ) { if ( $( NavigationBoxes[i] ).hasClass( 'collapsed' ) || ( tableIndex >= autoCollapse && $( NavigationBoxes[i] ).hasClass( 'autocollapse' ) ) ) { collapseTable( i ); } } } mw.hook( 'wikipage.content' ).add( createCollapseButtons ); /******************************************************************************************************************************/ /******************************************************************************************************************************/ /******************************************************************************************************************************/ /*********************************************************************** W I K I E D I T O R B U T T O N S *******************/ /************************************************ WikiEditor Buttons/Customization ********************************************/ /******************************************************************************************************************************/ /****************************************************************************************************************************** * Extra buttons in toolbar * @stats [[File:Krinkle_InsertWikiEditorButton.js]] ******************************************************************************************************************************/ $.ajax({ url: 'https://meta.wikimedia.org/w/index.php?title=User:Krinkle/Scripts/InsertWikiEditorButton.js&action=raw&ctype=text/javascript', dataType: 'script', cache: true }).done(function () { // REFERENCE with ID krInsertWikiEditorButton({ id: "mw-customeditbutton-refidbutton", icon: "//vignette3.wikia.nocookie.net/wikizilla-files/images/9/97/Editor_Button_-_Reference.png", label: 'Reference with ID', insertBefore: '<ref name="">[http://', insertAfter: ']</ref>', sampleText: '' }); // BOOK CITATION krInsertWikiEditorButton({ id: "mw-customeditbutton-citebookbutton", icon: "//vignette4.wikia.nocookie.net/wikizilla-files/images/7/73/Editor_Button_-_Reference_Book.png", label: 'Cite book', insertBefore: '<ref name="">{{cite book|title= |author= |date= |publisher= |page=!!OR!!|pages= ', insertAfter: '|isbn=}}</ref>', sampleText: '...not all parameters required.--see Template:Cite_book for documentation...' }); // CORRECT FORMAT GALLERY krInsertWikiEditorButton({ id: "mw-customeditbutton-gallerybutton", icon: "//vignette4.wikia.nocookie.net/wikizilla-files/images/f/f6/Editor_Button_-_Correct_Gallery.png", label: 'Gallery', insertBefore: '<gallery widths="120" position="center" captionalign="center" spacing="small">\r', insertAfter: '\r</gallery>', sampleText: 'Test Image.png' }); // YOUTUBE EMBED krInsertWikiEditorButton({ id: "mw-customeditbutton-youtubebutton", icon: "//vignette3.wikia.nocookie.net/wikizilla-files/images/d/de/Editor_Button_-_YouTube.png", label: 'YouTube embed', insertBefore: '<youtube width="300" height="169">', insertAfter: '</youtube>', sampleText: '...Put YT video ID here; remove _width="300" height="169"_ to make default size ~ 300x169 is specifically for infoboxes...' }); // TABBER krInsertWikiEditorButton({ id: "mw-customeditbutton-infoboxtabberbutton", icon: "//vignette1.wikia.nocookie.net/wikizilla-files/images/0/08/Editor_Button_-_Tabber.png", label: 'Tabber', insertBefore: '<tabs style="color:black; padding: 0px; margin: 0px;">\r<tab name="NAMEHERE">[[File:|300px| in ]]</tab>\r', insertAfter: '\r<tab name="NAMEHERE2">[[File:|300px| in ]]</tab>\r</tabs>', sampleText: '<!---- add multiple tabs by copy pasting and changing the values ---- to replace the infobox image with a tabber, change |image = with |altimage = ---->' }); // DVD INFO krInsertWikiEditorButton({ id: "mw-customeditbutton-dvdbutton", icon: "//vignette2.wikia.nocookie.net/wikizilla-files/images/4/4f/Editor_Button_-_DVD_Info.png", label: 'Insert DVD information', insertBefore: '<b>COMPANY</b> (YEAR)<ref name="">[http:// Amazon.com: ]</ref>\\r*Region: \r*Audio: \r*Special Features: \r*Notes: ', insertAfter: '', sampleText: '' }); // STAFF and CAST Information krInsertWikiEditorButton({ id: "mw-customeditbutton-staffcastbutton", icon: "//vignette2.wikia.nocookie.net/wikizilla-files/images/e/eb/Editor_Button_-_Staff_and_Cast.png", label: 'Insert Staff and Cast information', insertBefore: '==Staff==\r{{Staffs\r|Directed by=[[\r|Written by=\r|Produced by=\r|Executive Producing by=\r|Music by=\r|Cinematography by=\r|Edited by=\r|Production Design by=\r|Assistant Directing by=\r|Special Effects by=\r}}\r==Cast==\r{{Cast\r||\r||\r||\r||\r||\r||\r||\r||\r||\r||\r||\r}}', insertAfter: '', sampleText: '' }); // FILM Tab and Nav krInsertWikiEditorButton({ id: "mw-customeditbutton-filmtabnavbutton", icon: "//vignette1.wikia.nocookie.net/wikizilla-files/images/9/95/Editor_Button_-_Nav.png", label: 'Tab and navigation (film)', insertBefore: '{{Tab}}\r{{Nav\r|type1 =\r|type2 =\r|type =[[:Category:|Category:]]\r|name =\r|prev =\r|prevname =\r|next =\r|nextname =\r}}', insertAfter: '', sampleText: '' }); // INFOBOX KAIJU krInsertWikiEditorButton({ id: "mw-customeditbutton-infoboxkaijubutton", icon: "//vignette4.wikia.nocookie.net/wikizilla-files/images/b/b8/Editor_Button_-_Infobox_Kaiju.png", label: 'Kaiju infobox', insertBefore: '{{Kaiju Infobox\r|type1 =???\r|type2 =???\r|header ={{Toho Kaiju}} \r|copyrighticon =\r|image =\r|caption =\r|name =\r|subtitle =\r|species =\r|nicknames =\r|height =?? meters\r|length =?? meters\r|weight =?? tons\r|forms =\r|allies =\r|enemies =\r|relationships =\r|controlled =\r|created =\r|portrayed =\r|debut =\r|last =\r|suits =\r|roar =[[File:.ogg|180px|center|noicon]]{{More Roars}}\r}}', insertAfter: '', sampleText: '' }); // INFOBOX FILM krInsertWikiEditorButton({ id: "mw-customeditbutton-infoboxfilmbutton", icon: "//vignette3.wikia.nocookie.net/wikizilla-files/images/6/68/Editor_Button_-_Infobox_Film.png", label: 'Film infobox', insertBefore: '{{Infopelicula\r|type1 =\r|type2 =\r|image =\r|caption =The Japanese poster for \r|name =\r|us-title =\r|jp-title =\r|director =[[\r|producer =[[\r|writer =[[\r|composer =[[\r|distributor =[[Toho]]{{sup|[[Japan|JP]]}}<br>[[]]{{sup|[[United States|US]]}}\r|rating =\r|budget =¥\r|gross =¥\r|runtime =?? minutes{{sup|[[Japan|JP]]}}<br>{{Small|(? hour, ?? minutes)}}<br />?? minutes{{sup|[[United States|US]]}}<br>{{Small|(? hour, ?? minutes)}}\r|designs =[[\r}}', insertAfter: '', sampleText: '' }); // INFOBOX CHARACTER krInsertWikiEditorButton({ id: "mw-customeditbutton-infoboxcharacterbutton", icon: "//vignette1.wikia.nocookie.net/wikizilla-files/images/f/f6/Editor_Button_-_Infobox_Character.png", label: 'Character infobox', insertBefore: '{{Infobox Character\r|type1 =\r|type2 =\r|header ={{Character}}\r|image =\r|caption =\r|species =\r|nationality =\r|relationships =\r|occupation =\r|affiliation =\r|firstappearance =\r', insertAfter: '\r|played =\r}}', sampleText: '<!--- use |debut = and |last = if the character has more than 1 appearance --->' }); // INFOBOX TV SHOW krInsertWikiEditorButton({ id: "mw-customeditbutton-infoboxtvshowbutton", icon: "//vignette1.wikia.nocookie.net/wikizilla-files/images/2/22/Editor_Button_-_Infobox_TV.png", label: 'TV show infobox', insertBefore: '{{Infobox Series\r|header ={{Series}}\r|type1 =\r|type2 =\r|name =\r|image =\r|creator =\r|producer =\r|distributor =\r|genre =\r|aired =\r|channel =\r|episodes =\r}}', insertAfter: '', sampleText: '' }); // INFOBOX BOOK krInsertWikiEditorButton({ id: "mw-customeditbutton-infoboxbookbutton", icon: "//vignette3.wikia.nocookie.net/wikizilla-files/images/7/70/Editor_Button_-_Infobox_Book.png", label: 'Book infobox', insertBefore: '{{Infobox Book\r|type1 =\r|type2 =\r|image =\r|name =\r|author =\r|publisher =\r|publishdate =\r|genre =\r|isbn =[[Special:BookSources/|ISBN-10: ]]<br>[[Special:BookSources/|ISBN-13: ]]\r}}', insertAfter: '', sampleText: '' }); // INFOBOX PERSON krInsertWikiEditorButton({ id: "mw-customeditbutton-infoboxpersonbutton", icon: "//vignette2.wikia.nocookie.net/wikizilla-files/images/9/93/Editor_Button_-_Infobox_Real_Person.png", label: 'Real person infobox', insertBefore: '{{Infobox Person\r|type1 =\r|type2 =\r|name =\r|image =\r|caption =\r|occupation =\r|birthday =\r|birthplace =\r|first =\r|notable =\r|imdb =\r|wikipedia =\r}}', insertAfter: '', sampleText: '' }); // INFOBOX VIDEO GAME krInsertWikiEditorButton({ id: "mw-customeditbutton-infoboxvideogamebutton", icon: "//vignette1.wikia.nocookie.net/wikizilla-files/images/f/fb/Editor_Button_-_Infobox_Game.png", label: 'Video game infobox', insertBefore: '{{Infobox Game\r|type1 =\r|type2 =\r|header =\r|image =\r|caption =\r|name =\r|us-title =\r|jp-title =\r|publisher =\r|developer =\r|platforms =\r|languages =\r|genre =\r}}', insertAfter: '', sampleText: '' }); }); /**************************************************/ /*************** END WikiEditor ******************/ /************************************************/