Nexopia Modpage Beheader!

By keesc Last update Jun 10, 2009 — Installed 33 times.

There are 2 previous versions of this script.

// ==UserScript==
// @name           Nexopia Modpage Beheader!
// @namespace      http://www.nexopia.com/users/kees/
// @description    Replace the floating header with a fixed header on Nexopia's pic mod pages
// @author         Kees Couprie 
// @include        http://www.nexopia.com/moderate/queue/*
// @include        https://www.nexopia.com/moderate/queue/*
// ==/UserScript==

    menu_public = document.getElementById('menu_public');
    menu_public.className = "menu_public.fixed";
    menu_personal = document.getElementById('menu_personal');
    menu_personal.className = "menu_personal.fixed";
    
// Now we're going to override the "official" solution of jumping to the next picture
// and then scrolling back a bit. Don't try this at home.
// This is what the official solution looks like
//	function jump(i) 
//	{ 
//		location.href='#item' + i; 
//		
//		// scroll the page down to the next queue item
//		window.scrollBy(0, -65);
//
//		return true;
//	}
// I hate that scrolling effect, so let's rip it out. 
 
    var scriptCode = new Array();   // this is where we are going to build our new script
    
    // here's the build of the new script, one line at a time
    scriptCode.push('function jump(i){');
    scriptCode.push("  location.href='#item' + i");
    scriptCode.push('  return true;');
    scriptCode.push('}');
    
    // now, we put the script in a new script element in the DOM
    var script = document.createElement('script');    // create the script element
    script.innerHTML = scriptCode.join('\n');         // add the script code to it
    scriptCode.length = 0;                            // recover the memory we used to build the script
    
    // this is sort of hard to read, because it's doing 2 things:
    // 1. finds the first <head> tag on the page
    // 2. adds the new script just before the </head> tag
    document.getElementsByTagName('head')[0].appendChild(script);