Created
October 20, 2024 21:54
-
-
Save InsiderPhD/0624b15012eb7b68a0f5b9cee7ace7f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Neopets - Search Helper | |
// @version 1.0.27 | |
// @namespace neopets | |
// @description Adds convenient search icons to many places | |
// @author diceroll123 | |
// @match *://*.neopets.com/auctions.phtml* | |
// @match *://*.neopets.com/closet.phtml* | |
// @match *://*.neopets.com/dome/neopets.phtml* | |
// @match *://*.neopets.com/faerieland/darkfaerie.phtml* | |
// @match *://*.neopets.com/faerieland/employ/employment.phtml* | |
// @match *://*.neopets.com/faerieland/hiddentower938.phtml | |
// @match *://*.neopets.com/games/kadoatery/* | |
// @match *://*.neopets.com/games/kadoatery/index.phtml | |
// @match *://*.neopets.com/generalstore.phtml* | |
// @match *://*.neopets.com/genie.phtml* | |
// @match *://*.neopets.com/halloween/esophagor*.phtml* | |
// @match *://*.neopets.com/halloween/witchtower*.phtml* | |
// @match *://*.neopets.com/halloween/garage*.phtml* | |
// @match *://*.neopets.com/hospital.phtml | |
// @match *://*.neopets.com/inventory.phtml* | |
// @match *://*.neopets.com/island/*training.phtml?*type=status* | |
// @match *://*.neopets.com/island/kitchen*.phtml* | |
// @match *://*.neopets.com/island/tradingpost.phtml* | |
// @match *://*.neopets.com/market.phtml* | |
// @match *://*.neopets.com/market_your.phtml* | |
// @match *://*.neopets.com/medieval/earthfaerie.phtml* | |
// @match *://*.neopets.com/objects.phtml* | |
// @match *://*.neopets.com/pirates/academy.phtml?type=status* | |
// @match *://*.neopets.com/process_cash_object.phtml | |
// @match *://*.neopets.com/quests.phtml | |
// @match *://*.neopets.com/quickstock.phtml* | |
// @match *://*.neopets.com/safetydeposit.phtml* | |
// @match *://*.neopets.com/shops/wizard.phtml* | |
// @match *://*.neopets.com/space/coincidence.phtml | |
// @match *://*.neopets.com/winter/igloo2.phtml | |
// @match *://*.neopets.com/winter/snowfaerie*.phtml* | |
// @match *://*.neopets.com/questlog/ | |
// @icon https://www.neopets.com/favicon.ico | |
// @grant none | |
// ==/UserScript== | |
const imgSize = 20; // for the search images | |
$(`<style type='text/css'> | |
.searchimg { cursor: pointer; height: ${imgSize}px !important; width: ${imgSize}px !important; border: none !important; border-radius: 0px !important;} | |
.search-helper { margin-top: 0; margin-bottom: 0; } | |
</style>`).appendTo("head"); | |
jQuery.fn.exists = function () { | |
return this.length > 0; | |
}; | |
// if the active pet dropdown image is there, we're in beta | |
const isBeta = $("[class^='nav-pet-menu-icon']").exists(); | |
const linkmap = { // for urls and images for each search type | |
// if the image is not from images.neopets.com, base64 it | |
ssw: { | |
"img": "http://images.neopets.com/premium/shopwizard/ssw-icon.svg" | |
}, | |
sw: { | |
"url": "https://www.neopets.com/shops/wizard.phtml?string=%s", | |
"img": "http://images.neopets.com/themes/h5/basic/images/shopwizard-icon.png" | |
}, | |
tp: { | |
"url": "https://www.neopets.com/island/tradingpost.phtml?type=browse&criteria=item_exact&search_string=%s", | |
"img": "http://images.neopets.com/themes/h5/basic/images/tradingpost-icon.png" | |
}, | |
au: { | |
"url": "https://www.neopets.com/genie.phtml?type=process_genie&criteria=exact&auctiongenie=%s", | |
"img": "http://images.neopets.com/themes/h5/basic/images/auction-icon.png" | |
}, | |
sdb: { | |
"url": "https://www.neopets.com/safetydeposit.phtml?obj_name=%s&category=0", | |
"img": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAECklEQVRYhe1WS08jRxD+qj2PHQ8gbLB5SgaBQKDkyokDXPIbOOcX5RJFSi45RcovyCESIocoOawQSHhxQDwMEg/j4CEz4/FO90zlwIzXsMbrELTaw35SH2ZUVd/XVdVdDXzGZ3yKIKKPxwUAlmVNFAqFNcMwviwUChfZbPZ8b2/vLTP/PTg4eCuE8E9OTlgpxQDeAmgBYAB6EkcCiADESUzu4NASO5H8l8nitoCZmZmv19f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fz4/P6+/xN3fCwSAbNv+amxs7IvFxcXg4ODgt6urqze+77/IzO0byYv4o3J+EvgX4yIhYBP/dWUAAAAASUVORK5CYII=" | |
}, | |
closet: { | |
"url": "https://www.neopets.com/closet.phtml?obj_name=%s", | |
"img": "http://images.neopets.com/items/ffu_illusen_armoire.gif" | |
}, | |
jni: { | |
"url": "https://items.jellyneo.net/search/?name=%s&name_type=3", | |
"img": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAHsUlEQVRYhe1XWWxU1xn+zrnbbJ4Zz+ZZvNvgBUMKIS3QNBhSCCJqo1ZNq1YqihqE1KoP7WPUB9THRnnpQ6pKrRRFqC9EgpS0aoOSICgtlgx4AUMce4z3ZWzPPnfucs49fXAwdsEFqlZ56ZHu0/3P/33/p/8/5zvA/9cXvMh/LdF6JgIhxP+OQCKRkBobG925XE5MT00Zfp83pbhcHdF4oplzR3ZrWnFmcmLCtOy05vUlJQI/HD6xupqdrRrGQ/nkpyUgyzI91Nt7KD2RjolAeJ9R3/FCpaGrab6pQ4WsAuW8g/Stsjo2MIn2Xcky4/7GGvdoYPDKr0b7rp5ljsP+YwUopUgl4i2Jtu1v30v2HHaOndBoazeEoYMuTEIQApJsBgmGwRdmYFw6D0dSIIWi8M2NZvl7b/84s7R4dmNO6Wkq37Gj54jVufe3S0dff4G8+B1Z3t4NsryAZ6+eRdvQDdQM9KN6qw9m0zbIDc2QYg3Q//QumCcA0brT7Z4bq7DluQuM8wdFPQk4IUSpDYdPruw58q7+k7f2ygdeIkTzQNiA99qH2OkIzGgeOC4/2isO6MfnIRgg1aXg7n4W9sw4zPwqfLv2dUqyXLtJ1ceBU0oVn9//U6v31bfYiTfiUjwFcAdgFsBsiPkF3L67iBV/GJYsQZYV0MwCHMsAKEA8NVD7LzK+MIUlf129y+uLPjEBTVWRamj8gfzKydPaqV/WUH8I4ABxuQHVBUgyqrE4DFNHbHoSMYmjPumCHokDigonl0V1bAptdclxX6QuW4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yAACghUJq24yaz4bp6B96/zeHm9RmszJVht0WhdHpgRloBxhBkleVcZumd/hs3zMcSGBm5ne8OxwWzbThcAKU8lPYegGy+LgilqAkG4TR34h8ZPzA5BlGfAkIV2Ek/Rtw+sJowwBnM2XvlgYGBjPEIJ/QQAYCA2laRLc/DWF2CNDoIbd/RR26SZAX+UBgVWQKLxj/fDWS4A2bba0HMgqdaKBY5s7ZE30jAtCwsTYzdVTNTrFzZKfuauiCotGY2HzFDsqLAH4pAOM4augDK+RyYba05VENHVCELzO3Rq+bWHDZNgUzEoHd8aMGItTSUfX5YLh80txuqpoFKMgjZ7OAIISASBecc1VIJ1XL5/g+gsAK5lE1zISpPpAAAVKrV9F6pdPGjT86+zl85BUOvwKyUQSUZsqpAVlTIigLyeV84DodtmrBNA4wxYP2YI/Bm500nu3Q5Xyj8O/zNfoAxxluSiZEEtYLLNum0o/UyNA+EEOA2g20aMKs6DL2yRk7XwSwLjhAACEApQCWgXEBD/x//nhu89mZF1/UnJsA5RzqdzmkUnzSV5qddK7NRq6qHRDmviGoZ4HytSocDnK19tgXkV0AKy1AyU0JND7Lojb8OxCZuvpEeH7/7uEfKlrZcVVVEw6FIMBLbo1v27ulssT7c3O6NNjTFbc61+3GKJFkaM7Kjw4O5uM81FfK673w6MjJcrVZnNrrfpyawHkAIIAQEALfLRd2a5nYcTu/vpZRySVbMbD7POOcg5OmeZl/4+id9pH+peqqglAAAAABJRU5ErkJggg==" | |
}, | |
battlepedia: { | |
"url": "https://battlepedia.jellyneo.net/index.php?search=%s", | |
"img": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAChklEQVQ4T5XRW0iTARQH8P83Vi7n2CUvm0hroW7aFK1t+nkBe1BYK7KHoCYZXpplPUTkQ0WQQg9FIURiZHRDs8wEK6QNibFhZagT3drmFadJlq3mnM55+cIvIqKmdZ4Pv/M/5xAhigO5LOaGWI975hkGXnzAfxbBSy84oi3Q3vP7/Qv91n6Tw+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ViDhAkbEIYnpmVrkBjgBCngB697TZEpYAGVBFnCEbjgBhSYlNgRGQQRkIAXJlyiAIwIhZihPREsuKEfn+jyP8JwCcc5IReM43ZEsACBGfRBB5HWwTLIQQF0PFvdUeEGMhiwgwsQQAE2KAYpHInviTghBKswwQ1yAIwQAGAE+yy4Q6rQii2sAgBEeEYsnBBxiU8cDk74giLO8Q2pedwnUwgw+clXnpeAAAA7" | |
} | |
}; | |
// user has premium toolbar | |
let premium = false; | |
if (isBeta) { | |
premium = $("[class^='navsub-ssw-icon']").exists(); | |
} else { | |
premium = $("#sswmenu .imgmenu").exists(); | |
} | |
function combiner(item, url, image) { | |
url = url.replace("%s", item); | |
return `<a tabindex='-1' target='_blank' href='${url}'><img src='${image}' class='searchimg'></a>`; | |
} | |
function sswlink(item) { | |
// the only different one because it doesn't use a URL | |
return `<img item='${item}' class='ssw-helper searchimg' src='${linkmap.ssw.img}'>`; | |
} | |
function inURL(substr) { | |
return document.URL.includes(substr); | |
} | |
function cleanItem(item) { | |
return item.replaceAll("!", "%21") | |
.replaceAll("#", "%23") | |
.replaceAll("&", "%26") | |
.replaceAll("(", "%28") | |
.replaceAll(")", "%29") | |
.replaceAll("*", "%2A") | |
.replaceAll("+", "%2B") | |
.replaceAll(",", "%2C") | |
.replaceAll("/", "%2F") | |
.replaceAll(":", "%3A") | |
.replaceAll("?", "%3F") | |
.replaceAll(" ", "+"); | |
} | |
// overall linker thing | |
function makelinks(item, extras) { | |
// extras is an object that can only have boolean of 'cash' and 'wearable' (for now) | and a string/int number 'itemid' (only needed for wearable being true) | |
let links = ""; | |
item = $.trim(item); | |
if (typeof extras === "undefined") { | |
extras = {cash: false, wearable: false, tradeable: true}; | |
} | |
if (typeof extras.tradeable === "undefined") { | |
extras.tradeable = true; | |
} | |
const sswurl = sswlink(item); | |
const name = cleanItem(item); | |
if (extras.cash === false && extras.tradeable === true) { | |
if (inURL("quests.phtml") === false) { // doesn't show either SW if you're on a quest | |
// SSW | |
if (premium) { | |
links += sswurl; | |
} | |
// Regular SW | |
links += combiner(name, linkmap.sw.url, linkmap.sw.img); | |
} | |
// TP | |
links += combiner(name, linkmap.tp.url, linkmap.tp.img); | |
// Auctions | |
links += combiner(name, linkmap.au.url, linkmap.au.img); | |
} | |
// SDB | |
if (inURL("safetydeposit") === false) { | |
links += combiner(name, linkmap.sdb.url, linkmap.sdb.img); | |
} | |
// Closet | |
if (extras.wearable && inURL("closet.phtml") === false) { | |
links += combiner(name, linkmap.closet.url, linkmap.closet.img); | |
} | |
// JN items | |
links += combiner(name, linkmap.jni.url, linkmap.jni.img); | |
// Battlepedia | |
if (inURL("dome")) { | |
links += combiner(name, linkmap.battlepedia.url, linkmap.battlepedia.img); | |
} | |
// DTI | |
if (extras.wearable) { | |
let link = "https://impress.openneo.net/items?q=%s"; | |
if (extras.itemid !== -1 && typeof extras.itemid != "undefined") { | |
link = `https://impress.openneo.net/items/${extras.itemid}`; | |
} | |
links += combiner(name, link, linkmap.dti.img); | |
} | |
// Changed quests to use div, because p makes the text spill out of RE box | |
const element = inURL("quests.phtml") ? "div" : "p"; | |
const helper = $(`<${element} class='search-helper'>${links}</${element}>`); | |
// TODO: remove when TP is converted (hopefully) | |
// because of how ugly this makes the TP, let's inline it | |
const needInline = inURL("/island/tradingpost.phtml") || inURL("/quickstock.phtml"); | |
if (needInline) { | |
helper.css({ | |
"display": "inline-block", | |
"margin-left": "4px" | |
}); | |
} | |
return helper; | |
} | |
jQuery.fn.justtext = function () { | |
return $(this).clone().children().remove().end().text(); | |
}; | |
//////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
// I don't really approve of doing the code this way, but in an effort to save as few headaches as possible | |
// for the countless people who may use this, it's easier to just put beta & non-beta into one file. | |
// As pages are converted, they will be removed from the non-beta half of the following if-statement, as TNT | |
// mentioned in their end-of-flash update that beta pages will be the default when those pages are done. | |
// That said, the point of no return starts here. May Sloth have mercy on us. | |
if (isBeta) { | |
/* | |
Adds the search icons under things in: | |
Main Shops | |
Inventory | |
Kitchen Quest | |
Snow Faerie Quests | |
Illusen/Jhudora | |
*/ | |
// Common functions go here | |
function hasSearchHelper(element) { | |
// this will be used in ajaxSuccess handlers, as to not flood the page after hot-reloads | |
return $(element).parent().find(".search-helper").length !== 0; | |
} | |
function genericQuest() { | |
// so far, we know this works on: | |
// Kitchen Quests | |
// Snow Faerie Quests | |
// due to inconsistencies in the ajax requests, we will attempt to do two different kinds of search helper adds | |
$(".item-img + .item-name").find("b").each(function (index, element) { | |
if (!hasSearchHelper(element)) { | |
$(element).after(makelinks($(element).text())); | |
} | |
}); | |
$("img[src*='/items/'] + br + p > b").each(function (index, element) { | |
if (!hasSearchHelper(element)) { | |
$(element).after(makelinks($(element).text())); | |
} | |
}); | |
} | |
// Main Shops | |
if (inURL("objects.phtml") || inURL("type=shop")) { | |
$(".item-img + .item-name").each(function (index, element) { | |
$(element).after(makelinks($(element).text())); | |
}); | |
} | |
if (inURL("garage.phtml")) { | |
$("#items li b").each(function (index, element) { | |
$(element).after(makelinks($(element).text())); | |
}); | |
} | |
// Inventory | |
if (inURL("inventory")) { | |
// the inventory system is more flexible than it used to be, so we have to do this a little differently | |
$(document).ajaxSuccess( | |
function () { | |
$(".item-img + .item-name").each(function (index, element) { | |
// this will add more and more if you do things like SSW searching, so check first | |
if (!hasSearchHelper(element)) { | |
let extras = { | |
cash: document.getElementById("invDisplay").dataset.type === "nc", | |
wearable: $(element).parent().find(":contains('wearable')").length > 0, | |
tradeable: $(element).parent().find(":contains('(no trade)')").length === 0, | |
itemid: -1 | |
}; | |
$(element).after(makelinks($(element).text(), extras)); | |
} | |
}); | |
} | |
); | |
} | |
// Kitchen Quest | |
if (inURL("island/kitchen")) { | |
genericQuest(); | |
$(document).ajaxSuccess(genericQuest); | |
} | |
// Snow Faerie | |
if (inURL("winter/snowfaerie")) { | |
genericQuest(); | |
$(document).ajaxSuccess(genericQuest); | |
} | |
// Esophagor | |
if (inURL("halloween/esophagor")) { | |
genericQuest(); | |
$(document).ajaxSuccess(genericQuest); | |
} | |
// Edna | |
if (inURL("halloween/witchtower")) { | |
genericQuest(); | |
$(document).ajaxSuccess(genericQuest); | |
} | |
// Illusen & Jhudora | |
if ($(".faerie-img").exists()) { | |
let itemname = $(":contains('Where is my') > b").text(); | |
$(":contains('Where is my')").parent().find("img[src*='/items/']").after(makelinks(itemname)); | |
} | |
// Shop Wiz Auto-Exact | |
if (inURL("wizard.phtml?string=")) { | |
$("#criteria").val("exact"); | |
} | |
// Hospital | |
if (inURL("/hospital.phtml")) { | |
$(".nh-disease-cure > span > b").each(function (k, v) { | |
$(v).parent().after(makelinks($(v).text())); | |
}); | |
} | |
// Quest Log Daily Rewards | |
if (inURL("/questlog")) { | |
// I know this doesn't work when navigating the quest log tabs, | |
// but I really don't want to bog down the userscript with "fetch" monkeypatches etc. | |
$(".ql-reward-item + .ql-reward-label").each(function (k, v) { | |
$(v).append(makelinks($(v).text())); | |
}); | |
$(".ql-bonus-reward > .ql-bonus-item").each(function (k, v) { | |
$(v).after(makelinks($(v).text())); | |
}); | |
} | |
function sswopen(item) { | |
// open this in such a way that if the "__2020" was changed/removed without warning, this will still work | |
// TODO: hardcode the class name better once out of beta | |
$("[class^='ssw-header']").last().parent().show(); | |
// if results are currently up, close them | |
$("#ssw-button-new-search").click(); | |
$("#ssw-criteria").val("exact"); | |
$("#searchstr").val(item); | |
} | |
} else { | |
/* | |
Adds the search icons under things in: | |
Inventory | |
SDB | |
Closet | |
Auction Bidding Page | |
Your Shop Price Page | |
Coincidence | |
MI Training School | |
KI Training School | |
Snow Faerie | |
Esophagor | |
Edna Quest | |
Kitchen Quest | |
Illusen/Jhudora | |
Employment Agency | |
Faerie Quest Page | |
Your Shop's Sales History | |
*/ | |
// Main Shops | |
if (document.URL.includes("objects.phtml?") && document.URL.includes("type=shop")) { | |
$("img[src*='/items/']").parent().parent().find("b").each(function (k, v) { | |
$(v).after(makelinks($(v).text())); | |
}); | |
} | |
// Igloo Garage | |
if (document.URL.includes("/winter/igloo2.phtml")) { | |
$("img[src*='/items/']").parent().parent().find("b").each(function (k, v) { | |
$(v).after(makelinks($(v).text())); | |
}); | |
} | |
// Trading Post | |
if (document.URL.includes("/island/tradingpost.phtml")) { | |
$("img[src*='/items/']").each(function (k, v) { | |
$(this.nextSibling).after(makelinks($(this)[0].nextSibling.nodeValue)); | |
}); | |
} | |
// Redeeming Cash | |
if (document.URL.includes("process_cash_object")) { | |
extras = {cash: true, wearable: true}; | |
$("img[src*='/items/']").parent().find("b").each(function (k, v) { | |
$(v).before("<br>").after(makelinks($(v).text(), extras)); | |
}); | |
} | |
// Auctions | |
if (document.URL.includes("auction_id")) { | |
nameb = $("b:contains('owned by')"); | |
let fixname = nameb.html(); | |
fixname = fixname.substr(0, fixname.indexOf(" (own")); // remove "owned by..." | |
nameb.parent().find("img").after(makelinks(fixname)); | |
} | |
if (document.URL.includes("auctions.phtml") || document.URL.includes("genie.phtml")) { | |
$("a[href*='?type=bids&auction_id=']:not(:has('img'))").each(function (index, element) { | |
const itemname = $(element).text(); | |
$(element).after(makelinks(itemname)); | |
}) | |
} | |
// Inventory | |
if (document.URL.includes("inventory")) { | |
$("img[src*='/items/']").each(function (k, v) { | |
let $nametd = $(v).parent().parent(); | |
let extras = {cash: $(v).hasClass("otherItem"), wearable: $nametd.hasClass("wearable"), itemid: -1}; | |
if ($nametd.find("hr").exists()) { | |
extras.tradeable = !$nametd.find("span:contains('(no trade)')").exists(); | |
$nametd.find("hr").before(makelinks($nametd.justtext(), extras)); | |
} else { | |
$nametd.append(makelinks($nametd.justtext(), extras)); | |
} | |
}); | |
} | |
// SDB & Closet | |
let isSDB = document.URL.includes("safetydeposit"); | |
let isCloset = document.URL.includes("closet"); | |
if (isSDB || isCloset) { | |
$("img[src*='/items/']").each(function (k, v) { | |
let itemInput = $(v).parent().parent().find("td").eq(5).find("input"); | |
let id = itemInput.attr("data-item_id") || itemInput.attr("name").match(/\d+/g)[0]; | |
let isWearable = isCloset || $(v).parent().parent().find("td").eq(1).text().includes("(wearable)"); | |
let isNeoCash = false; | |
if(isSDB) { | |
let category = $(v).parent().parent().find("td").eq(3); | |
isNeoCash = category.text().trim() === "Neocash"; | |
} else if (isCloset) { | |
// this is not 100% accurate, see: https://items.jellyneo.net/item-error-list/rarities/ | |
isNeoCash = $(v).parent().next("td").text().includes("(Artifact - 500)"); | |
} | |
let extras = {cash: isNeoCash, wearable: isWearable, itemid: id}; | |
let nametd = $(v).parent().parent().find("td").eq(1); | |
nametd.find("b").eq(0).after(makelinks(nametd.find("b").eq(0).justtext(), extras)); | |
}); | |
} | |
// Your Shop | |
if (document.URL.includes("type=your") || document.URL.includes("market_your") || $("[name=subbynext]").length === 2) { // because pressing the Previous/Next 30 is a POST and has nothing of value in the URL | |
$("img[src*='/items/']").each(function (k, v) { | |
let nametd = $(v).parent().parent().find("td").eq(0); | |
let itemname = nametd.text(); | |
itemname = itemname.replace(nametd.find(".medText").text(), ""); | |
nametd.find("b").eq(0).after(makelinks(itemname)); | |
}); | |
} | |
// Coincidence | |
if (document.URL.includes("space/coincidence")) { | |
$("img[src*='/items/']").each(function (k, v) { | |
nametd = $(v).parent(); | |
nametd.find("b").eq(0).after(makelinks(nametd.justtext())); | |
}); | |
} | |
// MI Training | |
if (document.URL.includes("/island/training.phtml?type=status")) { | |
$("img[src*='/items/']").each(function (k, v) { | |
$(v).after(makelinks($(v).prev().text())); | |
}); | |
} | |
// Secret Training | |
if (document.URL.includes("/island/fight_training.phtml?type=status")) { | |
$("img[src*='/items/']").each(function (k, v) { | |
$(v).after(makelinks($(v).prev().text())); | |
}); | |
} | |
// KI Training | |
if (document.URL.includes("/pirates/academy.phtml?type=status")) { | |
$("img[src*='/items/']").each(function (k, v) { | |
let nametd = $(v).parent(); | |
let itemname = nametd.parent().find("td > b").eq(0).text(); | |
nametd.parent().find("td > b").eq(0).after(makelinks(itemname)); | |
}); | |
} | |
// Snow Faerie | |
// essentially same as kitchen. woo, lazy! | |
if (document.URL.includes("winter/snowfaerie")) { | |
addhr = (document.URL.includes("snowfaerie2") === false); | |
$("img[src*='/items/']").parent().find("b").each(function (k, v) { | |
$(v).after(makelinks($(v).text())); | |
}); | |
} | |
// Esophagor | |
if (document.URL.includes("halloween/esophagor")) { | |
$("img[src*='/items/']").each(function (k, v) { | |
let itemname = $(v).parent().find("b"); | |
itemname.after(makelinks(itemname.text())); | |
}); | |
} | |
// Edna | |
if (document.URL.includes("halloween/witchtower")) { | |
$("img[src*='/items/']").each(function (k, v) { | |
let itemname = $(v).parent().find("b"); | |
itemname.after(makelinks(itemname.text())); | |
}); | |
} | |
// Kitchen | |
if (document.URL.includes("island/kitchen")) { | |
$("img[src*='/items/']").parent().find("b").each(function (k, v) { | |
$(v).after(makelinks($(v).text())); | |
}); | |
} | |
// illusen & jhudora | |
if ($("img[src*='ef_2.gif']").exists() || $("img[src*='darkfaeriequest2.gif']").exists()) { | |
let itemname = $("center:contains('Where is my') > b").text(); | |
$("center:contains('Where is my')").parent().find("img[src*='/items/']").after(makelinks(itemname)); | |
} | |
// employment agency | |
if (document.URL.includes("employment")) { | |
if (document.URL.includes("type=jobs")) { | |
$("b:contains('Find')").each(function (k, v) { | |
let itemname = $(v).parent().clone().find("b").remove().end().html().split("<br>")[0]; | |
$($(v)[0].nextSibling).after(makelinks(itemname)); | |
}); | |
} | |
if (document.URL.includes("job_id")) { | |
$("b:contains('Find')").eq(0).after(makelinks($("b:contains('Find')").eq(0).justtext())); | |
} | |
} | |
// Faerie Quests | |
if (document.URL.includes("quests.phtml")) { | |
$("img[src*='/items/']").each(function (k, v) { | |
let itemname = $(v).parent().find("b"); | |
itemname.after(makelinks(itemname.text())); | |
}); | |
} | |
// Kadoatery | |
if (document.URL.includes("games/kadoatery")) { | |
$("td:contains('You should give it'):not(:contains('Thanks,'))").each(function (k, v) { | |
let itemname = $(v).find("strong").last(); | |
itemname.after(makelinks(itemname.text())); | |
}); | |
} | |
// General Store | |
if (document.URL.includes("generalstore.phtml")) { | |
$("td:contains('Cost'):not(:has('td'))").find("strong").each(function (index, element) { | |
$(element).after(makelinks($(element).text())); | |
}); | |
} | |
// Hidden Tower | |
if (document.URL.includes("hiddentower938.phtml")) { | |
$(".content table").find("b:not([style*='red;'])").each(function (index, element) { | |
$(element).after(makelinks($(element).text())); | |
}); | |
} | |
// Your Shop's Sales History | |
if (document.URL.includes("market.phtml?type=sales")) { | |
$('[value="Clear Sales History"]').parent().parent().parent().parent().find('tr').each(function (index, element) { | |
// make sure it's not the header or footer of this table | |
let cell = $(element).find("td").eq(1); | |
if (cell.attr('bgcolor') === "#ffffcc") { | |
$(cell).append(makelinks($(cell).text())); | |
} | |
}); | |
} | |
// Quickstock | |
if (document.URL.includes("quickstock.phtml")) { | |
$('form[name="quickstock"] tr').each(function (index, element) { | |
if ($(element).find("td").length > 1) { | |
const cell = $(element).find("td").eq(0); | |
if ($(cell).text() !== "Check All") { | |
$(cell).append(makelinks($(cell).text())); | |
} | |
} | |
}); | |
} | |
// Battledome | |
if (document.URL.includes("/dome/neopets")) { | |
$(".equipFrame").each(function (index, element) { | |
const itemname = $(element).text().trim(); | |
if (itemname) { // ignore if empty slot | |
$(makelinks(itemname)).appendTo($(element)); | |
} | |
}); | |
$(".equipTable").css({"overflow-y": "scroll"}); | |
} | |
if (document.URL.includes("garage.phtml")) { | |
$("#items li b").each(function (index, element) { | |
$(element).after(makelinks($(element).text())); | |
}); | |
} | |
function sswlimited(item) { | |
return (/Nerkmid($|.X+$)/.test(item) || item.endsWith("Paint Brush") || item.endsWith("Transmogrification Potion") || item.endsWith("Laboratory Map")); | |
} | |
function sswopen(item) { | |
if ($(".sswdrop").hasClass("panel_hidden")) { | |
$("#sswmenu .imgmenu").click(); | |
} | |
if ($("#ssw-tabs-1").hasClass("ui-tabs-hide")) { | |
$('#ssw-tabs').tabs('select', 0); | |
} | |
$("#price-limited").prop("checked", sswlimited(item)); | |
$("#ssw-criteria").val("exact"); | |
$("#searchstr").val(item); | |
} | |
} | |
$("body").on("click", ".ssw-helper", function () { | |
sswopen($(this).attr("item")); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment