Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Instant Symol Hole with Quick Retry
- // @version 0.1
- // @author Rippy
- // @match *://www.neopets.com/medieval/symolhole.phtml
- // @grant GM_setValue
- // @grant GM_getValue
- // @require http://code.jquery.com/jquery-latest.js
- // ==/UserScript==
- // mostly copying and repurposing the existing functions
- (function() {
- 'use strict';
- let symolForm = "<form method='post' id='process_symolhole' onsubmit='handleSubmit(); return false;'>" + $("#process_symolhole").html() + "<div id='attempts'></div><br /></form>";
- let attempts = 0;
- handleSubmit = () => {
- let goin = $("select#goin").val();
- /*$.ajax({
- type: 'post',
- dataType: 'html',
- url: '/medieval/process_symolhole_h5.phtml',
- data: {type: 'wait', goin: goin},
- success: function(data){
- var msg = JSON.parse(data);
- $('#symolhole-container').html(msg.start + msg.middle + msg.end);
- // insert other ajax call here if this needs to happen first
- }
- });*/
- let count = 0;
- let dots = window.setInterval(function () {
- if (count > 2) {
- count = 0;
- $("#enterhole").text(" ");
- } else if (count == 0) {
- $("#enterhole").text(". ");
- count++;
- } else if (count == 1) {
- $("#enterhole").text(".. ");
- count++;
- } else {
- $("#enterhole").text("...");
- count++;
- }
- }, 300);
- $("#enterhole").attr("disabled", true);
- let symolData = {};
- symolData["type"] = "goin";
- symolData["outfmt"] = "json";
- symolData["goin"] = goin;
- $.ajax({
- type: "POST",
- dataType: 'html',
- url: '/medieval/process_symolhole_h5.phtml',
- data: symolData,
- success: function (data) {
- //console.log(msg);
- clearInterval(dots);
- let msg = JSON.parse(data);
- if (msg.success) {
- attempts++;
- $('#symolhole-container').html(msg.message + symolForm);
- $('#goin').val(goin);
- $('#attempts').html(`Number of Attempts: ${attempts}<br />(Don't spam the button! Click in moderation)`);
- } else {
- console.log(msg.errormsg);
- }
- },
- error: function (e) {
- //console.log(e.responseText);
- alert("error");
- }
- }).done({
- //console.log("I'm done!");
- });
- };
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement