// ==UserScript== // @name Compact Mode Many More Links // @namespace http://www.panix.com/~eli/ // @description Adds a bunch of extra Function and Go To links to compact mode. // @include *kingdomofloathing.com/compactmenu.php* // @include *kingdomofloathing.com/topmenu.php* // ==/UserScript== var func_sel = document.getElementsByTagName("select")[0]; var func_opts = func_sel.getElementsByTagName('option'); var goto_sel = document.getElementsByTagName("select")[1]; var goto_opts = goto_sel.getElementsByTagName('option'); var addopt=null; var marker="::"; // originally "➤" but it changed line height var logpre="CompactModeGM: "; console.log(logpre + "Original sizes funct: " + func_opts.length + " and goto: " + goto_opts.length); // non-infinite loop safety: adding 18 items to goto menu var gcnt=goto_opts.length + 20; // and adding 15 items to functions var fcnt=func_opts.length + 17; // FUNCTION menu for (i=0;i<fcnt;i++) { // the .add method puts something before the current item, so // we save for the next pass through the list. if(addopt) { // console.log(logpre + "adding: " + addopt.text); func_sel.add(addopt,func_opts[i]); addopt = null; } if(func_opts[i] == undefined) { console.log(logpre + "At " + i + " reached end of function menu"); break; } if(func_opts[i].innerHTML.match('Inventory')) { // 1 addopt = document.createElement('option'); addopt.text = marker + "Consumables"; addopt.value = "inventory.php?which=1"; } else if(func_opts[i].innerHTML.match('Consumables')) { // 2 addopt = document.createElement('option'); addopt.value = "inventory.php?which=2"; addopt.text = marker + "Equipment"; } else if(func_opts[i].innerHTML.match('Equipment')) { // 3 addopt = document.createElement('option'); addopt.value = "inventory.php?which=3"; addopt.text = marker + "Miscellaneous"; } if(func_opts[i].innerHTML.match('Miscellaneous')) { // 4 addopt = document.createElement('option'); addopt.value = "sellstuff.php"; addopt.text = marker + "Sell Stuff"; } if(func_opts[i].innerHTML.match('Character')) { // 5 addopt = document.createElement('option'); addopt.value = "managecollection.php"; addopt.text = "Display Case"; } if(func_opts[i].innerHTML.match('Crafting')) { // 6 addopt = document.createElement('option'); addopt.value = "craft.php?mode=combine"; addopt.text = marker + "Paste"; } else if(func_opts[i].innerHTML.match('Paste')) { // 7 addopt = document.createElement('option'); addopt.value = "craft.php?mode=cook"; addopt.text = marker + "Cook"; } else if(func_opts[i].innerHTML.match('Cook')) { // 8 addopt = document.createElement('option'); addopt.value = "craft.php?mode=smith"; addopt.text = marker + "Smith"; } else if(func_opts[i].innerHTML.match('Smith')) { // 9 addopt = document.createElement('option'); addopt.value = "craft.php?mode=cocktail"; addopt.text = marker + "Mix"; } else if(func_opts[i].innerHTML.match('Mix')) { // 10 addopt = document.createElement('option'); addopt.value = "craft.php?mode=jewelry"; addopt.text = marker + "Ply"; } else if(func_opts[i].innerHTML.match('Ply')) { // 11 addopt = document.createElement('option'); addopt.value = "multiuse.php?from=craft"; addopt.text = marker + "Multiuse"; } else if(func_opts[i].innerHTML.match('Combat Tab')) { // 12 addopt = document.createElement('option'); addopt.value = "clan_viplounge.php"; addopt.text = marker + "Clan VIP Lounge"; } else if(func_opts[i].innerHTML.match('Clan VIP')) { // 13 addopt = document.createElement('option'); addopt.value = "clan_office.php"; addopt.text = marker + "Clan Admin Office"; } else if(func_opts[i].innerHTML.match('Options')) { // 14 addopt = document.createElement('option'); addopt.value = "account.php?tab=combat"; addopt.text = marker + "Combat Tab"; } else if(func_opts[i].innerHTML.match('Messages')) { // 15 addopt = document.createElement('option'); addopt.value = "makeoffer.php"; addopt.text = marker + "Trades"; } } // FUNCTION menu // GO TO menu addopt=null; for (i=0;i<gcnt;i++) { // the .add method puts something before the current item, so // we save for the next pass through the list. if(addopt) { // console.log(logpre + "adding: " + addopt.text); goto_sel.add(addopt,goto_opts[i]); addopt = null; } if(goto_opts[i] == undefined) { console.log(logpre + "At " + i + " reached end of goto menu"); break; } if(goto_opts[i].innerHTML.match('Seaside')) { // 1 addopt = document.createElement('option'); addopt.value = "town_wrong.php"; addopt.text = marker + "Wrong Side"; } else if(goto_opts[i].innerHTML.match('Wrong')) { // 2 addopt = document.createElement('option'); addopt.value = "town_right.php"; addopt.text = marker + "Right Side"; } else if(goto_opts[i].innerHTML.match('Mountains')) { // 3 addopt = document.createElement('option'); addopt.value = "da.php"; addopt.text = marker + "Dungeons"; } else if(goto_opts[i].innerHTML.match('Dungeons')) { // 4 addopt = document.createElement('option'); addopt.value = "place.php?whichplace=mclargehuge"; addopt.text = marker + "McLargeHuge"; } else if(goto_opts[i].innerHTML.match('Right')) { // 5 addopt = document.createElement('option'); addopt.value = "town_market.php"; addopt.text = marker + "Market"; } else if(goto_opts[i].innerHTML.match('Market')) { // 6 addopt = document.createElement('option'); addopt.value = "manor.php"; addopt.text = marker + "Manor"; } else if(goto_opts[i].innerHTML.match('Mall')) { // 7 addopt = document.createElement('option'); addopt.value = "managestore.php"; addopt.text = marker + "Manage Store"; } else if(goto_opts[i].innerHTML.match('Manage')) { // 8 addopt = document.createElement('option'); addopt.value = "storelog.php"; addopt.text = marker + "Store Log"; } else if(goto_opts[i].innerHTML.match('Clan')) { // 9 addopt = document.createElement('option'); addopt.value = "clan_basement.php?fromabove=1"; addopt.text = marker + "Basement"; } else if(goto_opts[i].innerHTML.match('Basement')) { // 10 addopt = document.createElement('option'); addopt.value = "clan_hobopolis.php?place=2"; addopt.text = marker + "Hobo Town Square"; } else if(goto_opts[i].innerHTML.match('Mountains')) { // 11 addopt = document.createElement('option'); addopt.value = "mclargehuge.php"; addopt.text = marker + "Mt. McLargeHuge"; } else if(goto_opts[i].innerHTML.match('The Sea')) { // 12 addopt = document.createElement('option'); addopt.value = "seafloor.php"; addopt.text = marker + "Sea Floor"; } else if(goto_opts[i].innerHTML.match('Sea Floor')) { // 13 addopt = document.createElement('option'); addopt.value = "deepcity.php"; addopt.text = marker + "Mer-kin Deepcity"; } else if(goto_opts[i].innerHTML.match('Plains')) { // 14 addopt = document.createElement('option'); addopt.value = "cobbsknob.php"; addopt.text = marker + "Inside Knob"; } else if(goto_opts[i].innerHTML.match('Knob')) { // 15 addopt = document.createElement('option'); addopt.value = "bathole.php"; addopt.text = marker + "Bat Hole"; } else if(goto_opts[i].innerHTML.match('Distant')) { // 16 addopt = document.createElement('option'); addopt.value = "forestvillage.php"; addopt.text = marker + "Forest Village"; } else if(goto_opts[i].innerHTML.match('Desert')) { // 17 addopt = document.createElement('option'); addopt.value = "bordertown.php"; addopt.text = marker + "Bordertown"; } else if(goto_opts[i].innerHTML.match('Bat')) { // 18 addopt = document.createElement('option'); addopt.value = "beanstalk.php"; addopt.text = marker + "Over the Beanstalk"; } } // GO TO menu