MediaWiki:Mobile.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.
//<tabber> extension req
//v2.0, 2017, user:fngplg.
//set active tab: https://jojowiki.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();
}, 100);//settimeout
});//doc.rdy
})(jQuery);
/**
* @source https://www.mediawiki.org/wiki/Snippets/Open_specific_links_in_new_window
* @version 2018-09-15
*/
$( function () {
$( '#mw-content-text' ).on( 'click', '.newwin > a', function () {
var otherWindow = window.open();
otherWindow.opener = null;
otherWindow.location = this;
return false;
} );
} );
// Expand
var state =1;
$(function() {
$('#collapse-global').html($('<a>', {
'class': 'mw-ui-button',
text: 'Expand/Collapse All'
})).click(function() {
if(state ===0){
$('.mw-collapsible-toggle-expanded').click();
state = 1;
}
else {
$('.mw-collapsible-toggle-collapsed').click();
state = 0;
}
}
)});
// Refresh Button
$(function() {
$('#mw-refreshButton').html($('<a>', {
'class': 'mw-ui-button',
text: 'Refresh'
})).click(function() {
location.reload();
}
)});
// English Cast Button
var castState = 0;
$(function() {
$('#mw-englishButton').html($('<a>', {
'class': 'mw-ui-button',
text: 'Switch Cast Language'
})).click(function() {
if(state ===0){
window.location = (""+window.location).replace(/#[A-Za-z0-9_]*$/,'')+"#Japanese";
state = 1;
}
else {
window.location = (""+window.location).replace(/#[A-Za-z0-9_]*$/,'')+"#English";
state = 0;
}
}
)});
/* Tooltip */
$(".popup").click(function () {
var $title = $(this).find(".title");
if (!$title.length) {
$(this).append('<span class="title">' + $(this).attr("title") + '</span>');
} else {
$title.remove();
}
});
/* Menu */
$(document).ready( function() {
var topnav = $('#mw-topnavigation');
$('.menu.view-border-box').after( topnav.html() );
topnav.remove();
});