Jump to content

Map hunter helper


ChaoticFission

Recommended Posts

Hey guys,

 

I haven't been to this forum in quite some time, so as my coming back present, I decided to contribute a little piece of Javascript that I just wrote. The purpose of this little script is to show you the number of the map pieces, since they are all identically named.

 

To use it, search for a Bookmarklet creator and paste the code in exactly as shown below. Once done, you can save that link, and use it on any page that has a map piece on it. This is particularly helpful when trying to track down the last map piece of a particular set.

 

(function ($) {
var filter = [];
for (var i = 1; i <= 9; i++) {
filter.push("[src$='" + i + ".gif']");
}
filter = filter.join(", ");
$("img[src^='https://images.neopets.com/items/']").filter(filter).each(function () {
var $this = $(this);
var num = this.src.match(/(\d)\.gif$/)[1];
var side = $this.height();
console.log(num);
$this.parent().find(".map-num").remove().end().append("<div class='map-num' style='width: " + side + "px; height: " + side + "px; margin-top: -" + (side === 80 ? 81 : 43) + "px; text-align: center; line-height: " + side + "px; font-size: " + (side === 80 ? 36 : 24) + "px; color: #000; background: rgba(255, 255, 255, .5); position: relative;'>" + num + "</div>");
})
}(jQuery))

 

PS: If anyone is interested, I can investigate on turning this into a GreaseMonkey script.

 

 

Hope this helps someone; it has sure helped me :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...