MediaWiki:Mobile.js

From Zelda Wiki, the Zelda encyclopedia
Revision as of 11:35, 3 July 2017 by KokoroSenshi (talk | contribs) (Replaced the Tabs.js with the Gadget Tabs set to run for mobile in addition to desktop)
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 users using the mobile site */


// -----------------------------------------------------------------------------
// copy of the needed parts of `mediawiki.legacy.wikibits` – begin
// -----------------------------------------------------------------------------

var loadedScripts = {};
function importScript(page) {
	var uri = mw.config.get('wgScript') + '?title=' + mw.util.wikiUrlencode(page) + '&action=raw&ctype=text/javascript';
	return importScriptURI(uri);
}
function importScriptURI(url) {
	if (loadedScripts[url]) {
		return null ;
	}
	loadedScripts[url] = true;
	var s = document.createElement('script');
	s.setAttribute('src', url);
	s.setAttribute('type', 'text/javascript');
	document.getElementsByTagName('head')[0].appendChild(s);
	return s;
}
function importStylesheet(page) {
	var uri = mw.config.get('wgScript') + '?title=' + mw.util.wikiUrlencode(page) + '&action=raw&ctype=text/css';
	return importStylesheetURI(uri);
}
function importStylesheetURI(url, media) {
	var l = document.createElement('link');
	l.rel = 'stylesheet';
	l.href = url;
	if (media) {
		l.media = media;
	}
	document.getElementsByTagName('head')[0].appendChild(l);
	return l;
}
// -----------------------------------------------------------------------------
// copy of the needed parts of `mediawiki.legacy.wikibits` – end 
// -----------------------------------------------------------------------------