Site update changes
This commit is contained in:
parent
4dc49f6e43
commit
48a40b8058
@ -1,12 +1,12 @@
|
||||
// ==UserScript==
|
||||
// @name Mann Co. Store Giveaway Autojoiner
|
||||
// @namespace https://pube.tk
|
||||
// @version 2025-02-15
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 2026-08-16
|
||||
// @description Tries to join giveaways on page load
|
||||
// @author Abhorrent_Anger
|
||||
// @include /^https?:\/\/mannco\.store\/giveaways.?$/
|
||||
// @icon https://www.google.com/s2/favicons?sz=64&domain=mannco.store
|
||||
// @grant none
|
||||
// @grant GM_xmlhttpRequest
|
||||
// @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
|
||||
@ -14,22 +14,39 @@
|
||||
|
||||
setTimeout(function () { location.reload(); }, 90 * 60 * 1000);
|
||||
|
||||
waitForKeyElements('a.raffle-list__item.list-group-item.list-group-item-action.raffleitem.isv.first', () => {
|
||||
waitForKeyElements('.giveaways__content', () => {
|
||||
setTimeout(function () {
|
||||
$('span[data-bs-title="Joined"][style*="display: none"]').each(function () {
|
||||
let raffle = $(this).attr('url');
|
||||
let raffleJoinURL = 'https://mannco.store/requests/raffle.php?mode=join&url=' + raffle;
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
xhrFields: {
|
||||
withCredentials: true
|
||||
},
|
||||
url: raffleJoinURL,
|
||||
success: function (data) {
|
||||
console.log('Tried to join ' + raffle + ' raffle, output: ' + data);
|
||||
$('.giveaways-list-item:not(.giveaways-list-item--joined)').each(function () {
|
||||
let giveawayURL = $(this).attr('href');
|
||||
let giveaway = /[^/]*$/.exec(giveawayURL)[0];
|
||||
let giveawayJoinURL = 'https://api.mannco.store/giveaways/join/' + giveaway;
|
||||
|
||||
let bearerToken = getToken('auth');
|
||||
let csrfToken = getToken('csrf');
|
||||
|
||||
let xJoin = new GM_xmlhttpRequest({
|
||||
method: 'POST',
|
||||
url: giveawayJoinURL,
|
||||
headers: { 'Authorization': 'Bearer ' + bearerToken, 'X-Csrf-Token': csrfToken },
|
||||
onreadystatechange: function (response) {
|
||||
if (response.readyState == 4 && response.status == 200) {
|
||||
console.log('Successfully joined ' + giveaway, response.response);
|
||||
} else {
|
||||
console.log("Couldn't join " + giveaway, response);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
console.log('Done with raffle join attempts');
|
||||
console.log('Done with giveaway join attempts');
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
const getCookieValue = (name) => (
|
||||
document.cookie.match('(^|;)\\s*' + name + '\\s*=\\s*([^;]+)')?.pop() || ''
|
||||
)
|
||||
|
||||
function getToken(tokenName) {
|
||||
let authArray = getCookieValue(tokenName);
|
||||
let decodedAuthArray = decodeURIComponent(authArray);
|
||||
return JSON.parse(decodedAuthArray)['token'];
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user