// ==UserScript== // @name Neopets - Superer Shop Wizard // @version 1.0.0 // @description Improve SSW to search for restricted items such as paint brushes, transmogrification potions, map pieces and more. // @author Scriptneo.com // @match *://*.neopets.com/* // @icon https://www.google.com/s2/favicons?domain=neopets.com // @grant none // @downloadURL https://www.scriptneo.com/scripts/download.php?id=30 // @updateURL https://www.scriptneo.com/scripts/download.php?id=30 // ==/UserScript== (function() { 'use strict'; let buildRow = function (owner, stock, price, index=1) { let dark = !(index % 2); // default 1 => dark = false let tr = dark ? '' : ''; return `${tr}${owner}${stock}${price}`; }; let buildNewRow = function (owner, stock, price) { return '
  • ' + `
    ${owner}
    ` + `
    ${stock}
    ` + `
    ${price}
    ` + '
  • '; } $( document ).ajaxSuccess(function( event, xhr, settings ) { let SSWDATA = {}; let SSWVERSION = 0; // OLD SSW if ( settings.url.startsWith('/shops/ssw/ssw_query.php') ) { SSWVERSION = 1; //console.log(settings); SSWDATA = JSON.parse(xhr.responseText); //console.log(SSWDATA); if ( SSWDATA.req.type == '0' && SSWDATA.html && !SSWDATA.html.startsWith(' 0 ) { //console.log('price only'); let html = ''; html += ''; for (let i = 0; i < 10 && i < SSWDATA.data.rowcount; i++) { html += buildRow('???', SSWDATA.data.amounts[i], SSWDATA.data.price_str[i], i); } html += '
    OwnerStockPrice
    '; $('#results').html(html); } } // NEW SSW else if ( settings.url.includes('/shops/ssw/ssw_query.php') ) { //console.log('used new ssw'); SSWVERSION = 2; SSWDATA = JSON.parse(xhr.responseText); //console.log(SSWDATA); if ( SSWDATA.req.type == '0' && SSWDATA.html && SSWDATA.html.includes('ssw-result-priceonly') && SSWDATA.data.rowcount > 0 ) { //console.log('price only'); let html = '
    '; $('#sswresults').html(html); } } if (SSWVERSION != 0 && SSWDATA.req.oii != '0') { let search_for = $('div#search_for').text(); switch (SSWVERSION) { case 1: $('div#search_for').html(`

    ${search_for} (${SSWDATA.req.oii})

    `); break; case 2: default: $('div#search_for').html(`

    ${search_for} (${SSWDATA.req.oii})

    `); break; } } }); })();