Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name TargetPS5AddToSavedForLaterDisc
- // @namespace http://example.tld
- // @version 0.3
- // @description TargetPS5AddToSavedForLaterDisc
- // @author You
- // @match https://www.target.com/p/playstation-5-console/-/A-81114595*
- // @grant none
- // ==/UserScript==
- var preOrderButtonLoop = setInterval(function(){
- var preOrderButton = document.querySelectorAll("[data-test='preorderButton']");
- if (preOrderButton.length) {
- clearInterval(preOrderButtonLoop);
- clearInterval(preOrderRefreshLoop);
- var spamPreorderButton = setInterval(function(){
- var closeModalButton = document.querySelectorAll("[aria-label='close']");
- if (closeModalButton.length) {
- closeModalButton[0].click();
- var protectionPlan = document.querySelectorAll("input#warranty-service");
- if (protectionPlan.length) {
- // protectionPlan[0].checked = true;
- }
- }
- preOrderButton[0].click();
- var ps5saved = document.querySelectorAll("[data-test='moveSFLToCartBtn']");
- if (ps5saved.length) {
- clearInterval(spamPreorderButton);
- window.location = "https://www.target.com/co-cart";
- }
- }, 1000);
- }
- }, 1000);
- var preOrderRefreshLoop = setInterval(function(){
- var content = document.body.textContent || document.body.innerText;
- var hasText = content.indexOf("Preorders have sold out")!==-1;
- var needRefresh = content.indexOf("Due to a temporary issue")!==-1;
- var need2 = content.indexOf("Something went wrong")!==-1;
- if(hasText || needRefresh || need2){
- window.location = "https://www.target.com/p/playstation-5-console/-/A-81114595";
- }
- }, 3400);
Add Comment
Please, Sign In to add comment