Advertisement
Guest User

MSN Shopping Game Script

a guest
Jan 16th, 2023
22,701
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.28 KB | Source Code | 1 0
  1. (function()
  2. {
  3.     if(!document.location.href.startsWith("https://www.msn.com/en-us/shopping")){
  4.         alert("Invalid page!");
  5.         return;
  6.     }
  7.    
  8.     var shoppingPageChildren = null;
  9.     try
  10.     {
  11.         shoppingPageChildren = document.getElementsByTagName("shopping-page-base")[0].shadowRoot.children[0]
  12.             .getElementsByTagName("shopping-homepage")[0].shadowRoot.children[0]
  13.             .getElementsByTagName("msft-feed-layout")[0].shadowRoot.children;
  14.     }
  15.     catch(e)
  16.     {
  17.         alert("Script error...\nMake sure the page is fully loaded.");
  18.         return;
  19.     }
  20.    
  21.     var msnShoppingGamePane = null;
  22.     for(i = 0; i <= shoppingPageChildren.length - 1; i++){
  23.         if(shoppingPageChildren[i].getAttribute("gamestate") == "active")
  24.             msnShoppingGamePane = shoppingPageChildren[i];
  25.     }
  26.     var answerSelectorInterval = (msnShoppingGamePane == null ? 0 : setInterval(() =>
  27.     {
  28.         if(msnShoppingGamePane.gameState == "active" && msnShoppingGamePane.selectedCardIndex != msnShoppingGamePane._correctAnswerIndex)
  29.             msnShoppingGamePane.selectedCardIndex = msnShoppingGamePane._correctAnswerIndex;
  30.        
  31.         if(msnShoppingGamePane._dailyLimitReached){
  32.             clearInterval(answerSelectorInterval);
  33.         }
  34.     }, 500));
  35.     alert(answerSelectorInterval == 0 ? "Unable to locate shopping game...\nTry scrolling down to it." : "Shopping game located!\nEnjoy :)")
  36. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement