Refactor page await

This commit is contained in:
Abhorrent_Anger 2025-01-29 22:19:03 +02:00
parent 2a1d13fc52
commit 356f4f9a98
1 changed files with 18 additions and 19 deletions

View File

@ -1,32 +1,31 @@
// ==UserScript== // ==UserScript==
// @name Mann Co. Store Giveaway Autojoiner // @name Mann Co. Store Giveaway Autojoiner
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 2024-11-14 // @version 2025-01-29
// @description Tries to join giveaways on page load // @description Tries to join giveaways on page load
// @author Abhorrent_Anger // @author Abhorrent_Anger
// @include /^https?:\/\/mannco\.store\/giveaways.?$/ // @include /^https?:\/\/mannco\.store\/giveaways.?$/
// @icon https://www.google.com/s2/favicons?sz=64&domain=mannco.store // @icon https://www.google.com/s2/favicons?sz=64&domain=mannco.store
// @grant none // @grant none
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// @require https://cdn.jsdelivr.net/gh/CoeJoder/waitForKeyElements.js@v1.3/waitForKeyElements.js
// @run-at document-end // @run-at document-end
// ==/UserScript== // ==/UserScript==
window.onload = function(){ waitForKeyElements('a.raffle-list__item.list-group-item.list-group-item-action.raffleitem.isv.first', () => {
setTimeout(function() { $('span[data-bs-title="Joined"][style*="display: none"]').each(function() {
$('span[data-bs-title="Joined"][style*="display: none"]').each(function() { let raffle = $(this).attr('url');
let raffle = $(this).attr('url'); let raffleJoinURL = 'https://mannco.store/requests/raffle.php?mode=join&url=' + raffle;
let raffleJoinURL = 'https://mannco.store/requests/raffle.php?mode=join&url=' + raffle; $.ajax({
$.ajax({ method: "GET",
method: "GET", xhrFields: {
xhrFields: { withCredentials: true
withCredentials: true },
}, url:raffleJoinURL,
url:raffleJoinURL, success: function(data){
success: function(data){ console.log('Tried to join '+raffle+' raffle, output: ' + data);
console.log('Tried to join '+raffle+' raffle, output: ' + data); }
}
});
}); });
console.log('Done with raffle join attempts'); });
}, 2000); console.log('Done with raffle join attempts');
}; });