User:Archimedes5000/vector.js

From Deceive Inc. Wiki
Revision as of 15:55, 23 March 2024 by Archimedes5000 (talk | contribs) (Undo revision 680 by Archimedes5000 (talk))
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.
/*Forces responsive content*/
function mobilefix(){
	var m = document.querySelector('meta[name="viewport"]');
	m.content = "width=device-width, initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=5.0";
};
window.addEventListener("load", mobilefix());

/*Restores search on narrow screens by moving it above navigation*/
function searchfix(){
	var s = document.querySelector("#p-search");
	var p = document.querySelector("#right-navigation");
	var a = document.querySelector("div.vector-menu-content");
	if(window.innerWidth <= 700){
		a.prepend(s);
	}else if(window.innerWidth > 700){
		p.append(s);
	};
};
searchfix();
window.addEventListener("resize", searchfix());