// @name Pringles bot
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Skrypt automatyzujący rejestrację i zdobywanie kodów do Xbox game pass w promocji pringles.
// @updateURL http://srv18949.microhost.com.pl/scripts/pringles-bot.user.js
// @downloadURL http://srv18949.microhost.com.pl/scripts/pringles-bot.user.js
// @match https://gaming.pringles.com/*
// @grant none
// ==/UserScript==
var
var
var
var gmail_name="pringlesgamepasscodes"; //mail KONIECZNIE na Gmailu (sam alias, bez części po znaku @), do niego będzie doklejany losowy ciąg znaków i na ten adres przyjdą kody do Game Passa. Przykład: dla adresu [email protected] wpisz tu tylko: jankowalski
var password="TajneHaslo123!"; //hasło do tworzonych kont pringles - minimum 8 znaków, duża i mała litera, cyfra i znak specjalny.
function fillform(){
var tempid=makeid(20);
document.getElementById("KSTL-Registration-FirstName").value="auto";
document.getElementById("KSTL-Registration-LastName").value="auto";
document.getElementById("KSTL-Registration-City").value="auto";
document.getElementById("KSTL-Registration-Password").value=password;
document.getElementById("KSTL-Registration-PasswordConfirm").value=password;
document.getElementById("KSTL-Registration-AddressLine1").value="auto";
document.getElementById("KSTL-Registration-PostalCode").value="1";
document.getElementById("KSTL-Registration-PhoneNumber2").value="1";
document.getElementById("KSTL-Registration-UserNameConfirm").value=gmail_name+"+"+tempid+"@gmail.com";
document.getElementById("KSTL-Registration-UserName").value=gmail_name+"+"+tempid+"@gmail.com";
document.getElementById("KSTL-Registration-Country-0").click();
document.getElementById("KSTL-Registration-TermsConditions1").click();
document.getElementById("KSTL-Registration-PrivacyPolicy").click();
fireChangeEvents(document.getElementById("KSTL-Registration-FirstName"));
fireChangeEvents(document.getElementById("KSTL-Registration-LastName"));
fireChangeEvents(document.getElementById("KSTL-Registration-Password"));
fireChangeEvents(document.getElementById("KSTL-Registration-PasswordConfirm"));
fireChangeEvents(document.getElementById("KSTL-Registration-AddressLine1"));
fireChangeEvents(document.getElementById("KSTL-Registration-PostalCode"));
fireChangeEvents(document.getElementById("KSTL-Registration-PhoneNumber2"));
fireChangeEvents(document.getElementById("KSTL-Registration-City"));
fireChangeEvents(document.getElementById("KSTL-Registration-UserName"));
fireChangeEvents(document.getElementById("KSTL-Registration-UserNameConfirm"));
}
function makeid(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
function fireChangeEvents(element){
var changeEvent = null;
changeEvent = document.createEvent ("HTMLEvents");
changeEvent.initEvent ("input", true, true);
element.dispatchEvent (changeEvent);
console.debug('input event dispatched for element: '+element.id);
changeEvent = document.createEvent ("HTMLEvents");
changeEvent.initEvent ("keyup", true, true);
element.dispatchEvent (changeEvent);
console.debug('keyup event dispatched for element: '+element.id);
changeEvent = document.createEvent ("HTMLEvents");
changeEvent.initEvent ("change", true, true);
element.dispatchEvent (changeEvent);
console.debug('change event dispatched for element: '+element.id);
}
function deleteAllCookies() {
var cookies = document.cookie.split(";");
for (var
if (codes[x].getAttribute("style")=='font-family:Arial,Helvetica,sans-serif;padding-bottom:20px;font-size:20px;line-height:24px;color:#ff0000'){
code[counter]=codes[x].innerText;
counter+=1;
}
}
var
for (var x=0; x
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
}
function auto(){
if (window.location.pathname=="/"+wersjajezykowa+"/Home"){
if (document.getElementsByClassName("spinnerObj")[0]==null){
setTimeout(function(){ document.getElementsByClassName("backtohome")[0].click(); }, firstclicktimeout);
}
} else if (window.location.pathname=="/"+wersjajezykowa+"/entercode"){
if (document.getElementsByClassName("ng-binding")[9].outerHTML.startsWith(''))
document.getElementsByClassName("ng-binding")[9].click();
} else if (window.location.pathname=="/"+wersjajezykowa+"/Login"){
if (document.getElementsByClassName("ng-binding")[10].outerHTML.startsWith(''))
document.getElementsByClassName("ng-binding")[10].click();
} else if (window.location.pathname.startsWith("/"+wersjajezykowa+"/ThankYou")){
sessionStorage.clear();
deleteAllCookies();
window.location.href="https://gaming.pringles.com/"+wersjajezykowa+"/Home";
} else if (window.location.pathname.startsWith("/"+wersjajezykowa+"/Puzzle")){
//układanie puzzli
} else if (window.location.pathname.startsWith("/"+wersjajezykowa+"/Error")){
sessionStorage.clear();
window.location.href="https://gaming.pringles.com/"+wersjajezykowa+"/Home";
} else if (window.location.pathname=="/"+wersjajezykowa+"/Register"){
if (window.localStorage.getItem('registertimeout')==null){
window.localStorage.setItem('registertimeout', '0');
} else {
if (document.getElementsByClassName("ai-white-spin")[0]!=null){
if (document.getElementsByClassName("ai-white-spin")[0].getAnimations()[0]!=null){
var tempregistertimeout=Number(window.localStorage.getItem('registertimeout'))
if (tempregistertimeout>registertimeout){
sessionStorage.clear();
window.localStorage.setItem('registertimeout', 0);
window.location.href="https://gaming.pringles.com/"+wersjajezykowa+"/Home";
} else {
tempregistertimeout++;
window.localStorage.setItem('registertimeout', tempregistertimeout);
}
}
} else {
window.localStorage.setItem('registertimeout', 0);
}
}
if (document.getElementsByClassName("KSTL-Registration-AccountNotCreated").length==1){
sessionStorage.clear();
window.localStorage.setItem('registertimeout', 0);
window.location.href="https://gaming.pringles.com/"+wersjajezykowa+"/Home";
}
if ((document.getElementById("KSTL-Registration-UserName").value=="")&&(document.getElementById("KSTL-Registration-FirstName").value=="")){
fillform();
//window.scrollTo(0,document.body.scrollHeight);
window.scrollBy(0,1400);
}
} else {
sessionStorage.clear();
window.localStorage.setItem('registertimeout', 0);
window.location.href="https://gaming.pringles.com/"+wersjajezykowa+"/Home";
}
}
(function() {
'use strict';
window.onkeyup = function(e) {
var key = e.keyCode ? e.keyCode : e.which;
if (key == 192){
deleteAllCookies();
sessionStorage.clear();
window.location.href="https://gaming.pringles.com/"+wersjajezykowa+"/Home";
} else if (key == 17) {
if ((window.location.href=="https://gaming.pringles.com/"+wersjajezykowa+"/Login")&&(document.getElementById("KSTL-Registration-UserName").value!="")){
document.getElementById("KSTL-Registration-Password").value=password;
fireChangeEvents(document.getElementById("KSTL-Registration-Password"));
}
else if (window.location.href=="https://gaming.pringles.com/"+wersjajezykowa+"/Register") {
if ((document.getElementById("KSTL-Registration-UserName").value!="")&&(document.getElementById("KSTL-Registration-FirstName").value=="")){
fillform();
}
}
}
}
setInterval(auto, 1000);
})();