Skip to content

Instantly share code, notes, and snippets.

@andymadge
Created January 20, 2009 12:57
Show Gist options
  • Save andymadge/49456 to your computer and use it in GitHub Desktop.
Save andymadge/49456 to your computer and use it in GitHub Desktop.
Search GameFAQs
CmdUtils.CreateCommand({
name: "gamefaqs",
icon: "http://www.gamefaqs.com/favicon.ico",
author: {name: "Andy Madge", email: "web@andymadge.com", homepage: "http://blog.andymadge.com/"},
description: "Searches GameFAQs",
homepage: "http://gist.github.com/49456",
takes: {"query": noun_arb_text},
_GameFAQsPlatformCodes: {
all: '0',
arcade: '26',
dreamcast: '1',
ds: '1026',
gameboy: '2',
gameboycolor: '9',
gamecube: '11',
gba: '12',
genesis: '10',
ipod: '1006',
neogeo: '18',
nes: '19',
nintendo64: '4',
pc: '5',
playstation: '6',
ps2: '7',
ps3: '1028',
psp: '1024',
saturn: '8',
snes: '21',
wii: '1031',
xbox360: '1029',
xbox: '13',
},
preview: function( pblock, searchTerm ) {
var platformname = "Saturn";
var platformcode = this._GameFAQsPlatformCodes[platformname.toLowerCase()];
pblock.innerHTML = "Search GameFAQs for <b>" + searchTerm.text + "</b> on platform: <b>" +
platformname + "</b> code: <b>" + platformcode + "</b>";
},
execute: function (searchTerm ) {
var platformname = "Saturn";
var platformcode = this._GameFAQsPlatformCodes[platformname.toLowerCase()];
var url = "http://www.gamefaqs.com/search/index.html?game=" + searchTerm.text + "&platform=" +
platformcode;
Utils.openUrlInBrowser (url);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment