MediaWiki:Common.js
Jump to navigation
Jump 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.
/* Any JavaScript here will be loaded for all users on every page load. */
// Imports
mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&action=raw&ctype=text/javascript');
// Ajax auto-refresh
ajaxPages = ['Special:RecentChanges', 'Special:WikiActivity', 'Special:Watchlist', 'Special:Log', 'Special:Contributions', 'Special:NewFiles', 'Special:AbuseLog'];
AjaxRCRefreshText = 'Refresh';
AjaxRCRefreshHoverText = 'Automatically refresh the page';
// BEGINNING: JavaScript for placing the fair use rationale template inside the summary box on [[Special:Upload]]. Code by "[[wikipedia:User:Pinky49]]", created and coded specifically for [[wikia:c:cdnmilitary|Duty & Valour]].
/*function FairUseRationale() {
if((wgPageName == 'Special:Upload' || wgPageName == 'Special:MultipleUpload') && document.getElementById('wpDestFile').value == '') {
document.getElementById('wpUploadDescription').value = '==Source==\n\n==Licensing==\n{{Fairuse}}';
}
}
jQuery(document).ready(FairUseRationale);*/
// Spoilers - Adds Spoiler Alert to pages with category tag
SpoilerAlert = {
categories: "Spoiler",
}
/****************************************/
/* sliders using jquery by User:Tierrie */
/****************************************/
mw.loader.using( ['jquery.cookie']);
/****************************************/
/* sliders using jquery by User:Tierrie */
/****************************************/
//wsl.loadScript("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js");
//wsl.loadScript("http://dragonage.wikia.com/index.php?title=MediaWiki:Jquery-ui.min.js&action=raw&ctype=text/javascript");
mw.loader.using( ['jquery.ui.tabs'], function() {
$( "[class^=portal_vtab]" ).tabs().addClass( "ui-tabs-vertical ui-helper-clearfix" );
$( "[class^=portal_vtab] li" ).removeClass( "ui-corner-top" ).addClass( "ui-corner-left" );
var $tabs = $("#portal_slider").tabs({ fx: {opacity:'toggle', duration:100} } );
$("[class*=portal_sliderlink]").click(function() { // bind click event to link
$tabs.tabs('select', this.className.match(/portal_sliderlink-(\d+)/)[1]);
console.log("Sliding to " + this.className.match(/portal_sliderlink-(\d+)/)[1]);
return false;
});
$('#portal_next').click(function() {
$tabs.tabs('select', ($tabs.tabs('option', 'selected') == ($tabs.tabs('length'))-1) ? 0 : $tabs.tabs('option', 'selected') + 1 ); // switch to next tab
return false;
});
$('#portal_prev').click(function() { // bind click event to link
$tabs.tabs('select', ($tabs.tabs('option', 'selected') == 0) ? ($tabs.tabs('length')-1) : $tabs.tabs('option', 'selected') - 1 ); // switch to previous tab
return false;
});
});
//<tabber> extension req
//v2.0, 2017, user:fngplg.
//set active tab: https://jojo.fandom.com/page#activeTab
(function ($){
var nstarget = window.location.hash.replace('#', '');
if (nstarget === '') return;
//convert wiki-utf 2 ansi
nstarget = nstarget.replace(/\./g, '%');
nstarget = decodeURIComponent(nstarget).replace(/_/g, ' ');
//console.log('trgt:'+nstarget);
$(function(){
setTimeout(function() {
var $nt2a = $('.tabberlive>.tabbernav>Li>a[title="' + nstarget + '"]');
$nt2a.click();
$nt2a.get(0).scrollIntoView({inline: "nearest"});
}, 100);//settimeout
});//doc.rdy
})(jQuery);
/* Sidebar
$(document).ready( function() {
var tree = $('#wikitext-sidebar');
$('#p-Content_Navigation').after( tree.html() );
tree.remove();
});
$(document).ready( function() {
$('#tree').bind('fancytreeinit', function(event, data) {
data.tree.makeTitleVisible();
});
});
*/
$(function() {
// ------------------------------------------------------- //
// Multi Level dropdowns
// ------------------------------------------------------ //
$("ul.dropdown-menu [data-toggle='dropdown']").on("click", function(event) {
event.preventDefault();
event.stopPropagation();
$(this).siblings().toggleClass("show");
if (!$(this).next().hasClass('show')) {
$(this).parents('.dropdown-menu').first().find('.show').removeClass("show");
}
$(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) {
$('.dropdown-submenu .show').removeClass("show");
});
});
});