GameFAQs system list recombobulator

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

当前为 2014-05-15 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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);
	}

}