GameFAQs system list recombobulator

Takes the console list in the header and remakes it with your own chosen list of consoles.

Από την 15/05/2014. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name           GameFAQs system list recombobulator
// @description    Takes the console list in the header and remakes it with your own chosen list of consoles.
// @version        1
// @author         King of Cats
// @namespace      Cats
// @grant          none
// @include        http://www.gamefaqs.com/*
// ==/UserScript==

// Feel free to make changes and redistribute as long as you make it known you're distributing an edited version of this script.

var mainNav = document.evaluate('//nav[@class="masthead_systems"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;

if  (mainNav !== null) {

	var moreSystems = document.evaluate('//span[@class="masthead_platform_drop"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
	
	var links = mainNav.getElementsByTagName("a");
	for (var i = links.length-1; i >= 0; i--) {
		if (links[i].parentNode == mainNav) {
			links[i].parentNode.removeChild(links[i]);
		}
	}
	
	/* Default values as an example */
	//var newNames = ["3DS","DS","iPhone","PC","PS3","PS4","PSP","Vita","Wii U","Xbox 360","Xbox One"];
	//var newLinks = ["3ds","ds","iphone","pc","ps3","ps4","psp","vita","wii-u","xbox360","xboxone"];
	
	/* Custom entries */
	var newNames = ["","",""];
	var newLinks = ["","",""];
	
	var newAnchors = new Array();
	
	for (var i = 0; i < newNames.length; i++) {
		newAnchors[i] = document.createElement('a');
		newAnchors[i].setAttribute('href', '/'+newLinks[i]);
		newAnchors[i].textContent = newNames[i];
		mainNav.insertBefore(newAnchors[i],moreSystems);
	}

}