MediaWiki:Mobile.js: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
No edit summary
(old school)
Line 1: Line 1:
/* All JavaScript here will be loaded for users of the mobile site */
/* All JavaScript here will be loaded for users of the mobile site */
 
importScript("MediaWiki:Gadget-introedit.js");
mw.loader.load("https://tardis.wiki/w/index.php?title=MediaWiki:Gadget-introedit.js&action=raw&ctype=text/js");
 
console.log("Running1");
console.log("Running1");


mw.loader.load("https://tardis.wiki/w/index.php?title=MediaWiki:Gadget-PreloadTemplates.js&action=raw&ctype=text/js");
importScript("MediaWiki:Gadget-PreloadTemplates.js");
 
console.log("Running2");
console.log("Running2");



Revision as of 00:12, 6 April 2024

/* All JavaScript here will be loaded for users of the mobile site */
importScript("MediaWiki:Gadget-introedit.js");
console.log("Running1");

importScript("MediaWiki:Gadget-PreloadTemplates.js");
console.log("Running2");

//var parentElement = document.querySelector('.mf-section-0');
//var elementToMove1, siblingElement1

//console.log("Running3");

/*
$(function() {
  $(window).trigger('resize');
  $(window).on('resize', function() {  
	 if($(window).width() > 1119) {
        var elementToMove1 = parentElement.querySelector('p + .portable-infobox');
        var siblingElement1 = parentElement.querySelector('p:first-of-type');
  
	 } else {
        var elementToMove1 = parentElement.querySelector('.dabtag + .portable-infobox');
        var siblingElement1 = parentElement.querySelector('.dabtag');
    	parentElement.insertBefore(elementToMove1, siblingElement1);
	
	 }
      parentElement.insertBefore(elementToMove1, siblingElement1);
  });
});
*/

console.log("Running");


/* TABLET OPTIMISATION:
   
   Causes navbar buttons to bring the
   user to the top of the page (NOT the
   top of the edit box) while editing.
            */

(function ($) {
$('.action-edit .citizen-header__item').click(function(){
  
   if($(window).width() > 1119) {
    
      $('html, body').animate({scrollTop : 0},600);
      return false;
    
   }

});
})