Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Shop Wizard Beta Refresh
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description make beta sw less bad i guess
- // @author Rippy
- // @match *://www.neopets.com/shops/wizard.phtml*
- // @grant none
- // @require http://code.jquery.com/jquery-latest.js
- // ==/UserScript==
- (function() {
- 'use strict';
- let shopwizard, table, criteria, min_price, max_price;
- function submitSearch() {
- if (!shopwizard)
- return;
- $("#refreshresults").css({ opacity: 0 }); // simple visual indicator of loading without actually removing the element so the form results don't keep jumping up and down
- document.getElementById("refreshresults").removeEventListener("click", submitSearch);
- $.ajax({
- type: "POST",
- url: "/np-templates/ajax/wizard.php",
- dataType: "html",
- data: {
- "type": "process_wizard",
- "feedset":0,
- "shopwizard": shopwizard,
- "table": table,
- "criteria": criteria,
- "min_price": min_price,
- "max_price": max_price
- },
- success: function(response) {
- $("#shopWizardFormResults").html(response);
- $("#refreshresults").css({ opacity: 1 });
- document.getElementById("refreshresults").addEventListener("click", submitSearch);
- },
- error: function() {
- alert("Error");
- }
- });
- };
- const div = document.createElement("div");
- div.setAttribute("id", "divRefresh");
- div.innerHTML = '<br /><input id="refreshresults" class="button-default__2020 button-blue__2020 wizard-button__2020" type="submit" value="Resubmit" data-ajaxgenerated="yes">';
- $("#pageDesc").append(div);
- $("#divRefresh").hide();
- document.getElementById("refreshresults").addEventListener("click", submitSearch);
- $("#submit_wizard").click(() => {
- $("#divRefresh").show();
- shopwizard = $("#shopwizard").val(),
- table = $("#wizard-area option:selected").val(),
- criteria = $("#criteria option:selected").val(),
- min_price = $("#min_price").val(),
- max_price = $("#max_price").val();
- });
- $("#criteria").val("exact");
- })();
Advertisement
Add Comment
Please, Sign In to add comment