Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name stop volunteer page refresh
- // @namespace http://tampermonkey.net/
- // @version 2025-08-22
- // @description ugh
- // @author rippy
- // @match *://*.neopets.com/hospital/volunteer.phtml*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=neopets.com
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- startShift = function(e) {
- let fight = e.dataset.fight;
- let pet = e.dataset.pet;
- if (document.getElementById("VolunteerJoinButton").hasAttribute("disabled") || fight == "" || pet == "") {
- let errMsg = fight == "" ? "You have not selected a Battle! You must first select a Battle to volunteer!" : "You must select which pet you want to volunteer!";
- document.getElementById("VolunteerErrMsg").innerHTML = errMsg;
- togglePopup__2020(document.getElementById("VolunteerErrorPopup"));
- return;
- }
- e.setAttribute("disabled", '');
- let formData = new FormData();
- formData.append("_ref_ck", getCK());
- formData.append("fight_id", fight);
- formData.append("pet_name", pet);
- document.getElementById("VolunteerErrMsg").innerHTML = "";
- fetch("/np-templates/ajax/plots/hospital/volunteer-join.php", {
- method: "POST",
- headers: {"x-requested-with": "XMLHttpRequest"},
- body: formData,
- })
- .then(
- function (response) {
- if (response.status !== 200) {
- console.log("Error setting state!");
- }
- response.json().then(function (data) {
- if (data.success) {
- //window.location.reload();
- togglePopup__2020(document.getElementById("VolunteerJoinedPopup"));
- setFightInService(fight, data);
- showFights();
- let clock = new vcClock((data.time / 3600), 0, 0);
- intervals["fight"+fight+"Clock"] = setInterval(function() {
- clock.tick("fight",fight);
- }, 1000);
- }
- if (data.error) {
- document.getElementById("VolunteerErrMsg").innerHTML = data.errMsg;
- togglePopup__2020(document.getElementById("VolunteerErrorPopup"));
- }
- e.removeAttribute("disabled");
- });
- }
- )
- .catch(function (err) {
- console.log("Fetch Error :-S", err);
- });
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment