Skip to content

Instantly share code, notes, and snippets.

@sphvn
Last active April 19, 2023 19:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sphvn/1262e240602750889808295a64e48b49 to your computer and use it in GitHub Desktop.
Save sphvn/1262e240602750889808295a64e48b49 to your computer and use it in GitHub Desktop.
Pulling item ID's from wowhead.com / icyveins best in slot lists into the atlasloot import format
var qs = x => document.querySelector(x);
var qsa = (x, y) => x.querySelectorAll(y)
var toArr = x => Array.prototype.slice.call(x);
var elemId = ".bis_table";
var itemSlot = "span a";
toArr(qsa(qs(elemId), itemSlot))
.map(x => x.href)
.map(x => x.split('=')[1])
.filter(x => x != undefined)
.map(x => "i:"+x)
.join();
var qs = x => document.querySelector(x);
var qsa = (x, y) => x.querySelectorAll(y)
var toArr = x => Array.prototype.slice.call(x);
// pick the element ID you want everything from (non-crafted, worldboss etc)
// could also change this to just be the entire document if you wanted
var elemId = "#markup-gear-planner-calc-0";
var itemSlot = ".gear-planner-slots-group-slot";
toArr(qsa(qs(elemId), itemSlot))
.map(x => x.dataset.itemId)
.filter(x => x != undefined)
.map(x => "i:"+x)
.join();
@sphvn
Copy link
Author

sphvn commented Sep 15, 2022

Array.prototype.slice.call(document.querySelectorAll('[data-type="item"]'))
    .map(x => x.href)
    .filter(x => x != undefined)
    .map(x => x.split('=')[1].split('/')[0])
    .map(x => "i:"+x)
    .join();

@sphvn
Copy link
Author

sphvn commented Apr 19, 2023

Array.prototype.slice.call(document.querySelectorAll('a.q4'))
    .map(x => x.href)
    .filter(x => x != undefined)
    .map(x => x.split('=')[1].split('/')[0])
    .map(x => "i:"+x)
    .join();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment