Advertisement
Guest User

Cribbage JD Cheat / Hack TamperMonkey Script

a guest
Nov 21st, 2024
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Show Player2 Cards
  3. // @namespace    http://tampermonkey.net/
  4. // @version      1.0
  5. // @description  Display player2's cards when clicking a button.
  6. // @author       Me
  7. // @match        *://cardsjd.com/cribbage/
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.     'use strict';
  13.  
  14.     // Create a button
  15.     let buttonPlayer2 = document.createElement("button");
  16.     buttonPlayer2.innerHTML = "Read Hand";
  17.     buttonPlayer2.style.position = "fixed";
  18.     buttonPlayer2.style.top = "10px";
  19.     buttonPlayer2.style.right = "110px";
  20.     buttonPlayer2.style.zIndex = 1000;
  21.  
  22.     // Create the second button for Crib's cards
  23.     let buttonCrib = document.createElement("button");
  24.     buttonCrib.innerHTML = "Read Crib";
  25.     buttonCrib.style.position = "fixed";
  26.     buttonCrib.style.top = "10px";
  27.     buttonCrib.style.right = "10px";
  28.     buttonCrib.style.zIndex = 1000;
  29.  
  30.     // Create a container for the card results
  31.     let resultDiv = document.createElement("div");
  32.     resultDiv.style.position = "fixed";
  33.     resultDiv.style.top = "40px";
  34.     resultDiv.style.right = "10px";
  35.     resultDiv.style.width = "40px";
  36.     resultDiv.style.zIndex = 1000;
  37.     resultDiv.style.backgroundColor = "white";
  38.     resultDiv.style.border = "1px solid black";
  39.     resultDiv.style.padding = "10px";
  40.  
  41.     document.body.appendChild(buttonPlayer2);
  42.     document.body.appendChild(buttonCrib);
  43.     document.body.appendChild(resultDiv);
  44.  
  45.     // Add button event listener
  46.     buttonPlayer2.addEventListener("click", function() {
  47.         var iframe = document.getElementById("game-iframe");
  48.         var iframeWindow = iframe.contentWindow;
  49.         var app = iframeWindow.app;
  50.         let oppPosName = (app.controllers.Game.tablePosition == "player2" ? "player1" : "player2");
  51.         // Assuming the function to get player2's cards is accessible globally
  52.         let cards = app.controllers.Game.cribbage.getCardsByOwner(oppPosName);
  53.         resultDiv.innerHTML = ""; // Clear previous results
  54.  
  55.         cards.forEach(card => {
  56.             let cardInfo = document.createElement("div");
  57.             cardInfo.textContent = card.face + card.symbol;
  58.             // Check if suit is "d" (diamonds) or "h" (hearts) to make text red
  59.             if (card.suit === "d" || card.suit === "h") {
  60.                 cardInfo.style.color = "red";
  61.             }
  62.             resultDiv.appendChild(cardInfo);
  63.         });
  64.     });
  65.  
  66.     // Add button event listener
  67.     buttonCrib.addEventListener("click", function() {
  68.         var iframe = document.getElementById("game-iframe");
  69.         var iframeWindow = iframe.contentWindow;
  70.         var app = iframeWindow.app;
  71.         // Assuming the function to get player2's cards is accessible globally
  72.         let cards = app.controllers.Game.cribbage.getCardsByOwner("crib");
  73.         resultDiv.innerHTML = ""; // Clear previous results
  74.  
  75.         cards.forEach(card => {
  76.             let cardInfo = document.createElement("div");
  77.             cardInfo.textContent = card.face + card.symbol;
  78.             // Check if suit is "d" (diamonds) or "h" (hearts) to make text red
  79.             if (card.suit === "d" || card.suit === "h") {
  80.                 cardInfo.style.color = "red";
  81.             }
  82.             resultDiv.appendChild(cardInfo);
  83.         });
  84.     });
  85. })();
  86.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement