tromfCardTracker
+8
| function afkDetection(){ | ||
| let afkCount = 0; | ||
| const tdLog = document.querySelector(".tdLog"); | ||
| tdLog.textContent = "INACTIVITATE DETECTATA!"; | ||
| afkCount++; | ||
| const tdata222 = document.querySelector(".tdata222"); | ||
| tdata222.textContent = `AFK: ${afkCount}`; | ||
| }; |
+159
| function zCards(){ | ||
| const deck = { | ||
| "J♤": "doi verde", | ||
| "J♥": "doi rosu", | ||
| "J♦": "doi duba", | ||
| "J♧": "doi ghinda", | ||
| "Q♤": "trei verde", | ||
| "Q♥": "trei rosu", | ||
| "Q♦": "trei duba", | ||
| "Q♧": "trei ghinda", | ||
| "K♤": "patrar verde", | ||
| "K♥": "patrar rosu", | ||
| "K♦": "patrar duba", | ||
| "K♧": "patrar ghinda", | ||
| "A♤": "as verde", | ||
| "A♥": "as rosu", | ||
| "A♦": "as duba", | ||
| "A♧": "as ghinda", | ||
| "10♤": "zece verde", | ||
| "10♥": "zece rosu", | ||
| "10♦": "zece dube", | ||
| "10♧": "zece ghinda", | ||
| "9♤": "noua verde", | ||
| "9♥": "noua rosu", | ||
| "9♦": "noua duba", | ||
| "9♧": "noua ghinda", | ||
| }; | ||
| const hearts = { | ||
| "J♥": "II", | ||
| "Q♥": "III", | ||
| "K♥": "IV", | ||
| "A♥": "AS", | ||
| "10♥": "X", | ||
| "9♥": "IX", | ||
| }; | ||
| const diamonds = { | ||
| "J♦": "II", | ||
| "Q♦": "III", | ||
| "K♦": "IV", | ||
| "A♦": "AS", | ||
| "10♦": "X", | ||
| "9♦": "IX", | ||
| }; | ||
| const spades = { | ||
| "J♤": "II", | ||
| "Q♤": "III", | ||
| "K♤": "IV", | ||
| "A♤": "AS", | ||
| "10♤": "X", | ||
| "9♤": "IX", | ||
| }; | ||
| const clubs = { | ||
| "J♧": "II", | ||
| "Q♧": "III", | ||
| "K♧": "IV", | ||
| "A♧": "AS", | ||
| "10♧": "X", | ||
| "9♧": "IX", | ||
| }; | ||
| const downcards = document.querySelector(".downcards"); | ||
| let getCards = new MutationObserver((mutation) => { | ||
| const tdLog = document.querySelector(".tdLog"); | ||
| const tdRemaining = document.querySelector('.tdRemaining'); | ||
| const tdRemaining2 = document.querySelector('.tdRemaining2'); | ||
| const tdRemaining3 = document.querySelector('.tdRemaining3'); | ||
| const tdRemaining4 = document.querySelector('.tdRemaining4'); | ||
| const tdCards = document.querySelector('.tdCards'); | ||
| const tdCards2 = document.querySelector('.tdCards2'); | ||
| const tdCards3 = document.querySelector('.tdCards3'); | ||
| const tdCards4 = document.querySelector('.tdCards4'); | ||
| const tdNr = document.querySelector('.tdNr'); | ||
| const tdNr2 = document.querySelector('.tdNr2'); | ||
| const tdNr3 = document.querySelector('.tdNr3'); | ||
| const tdNr4 = document.querySelector('.tdNr4'); | ||
| mutation.forEach((e) => { | ||
| e.addedNodes.forEach((node) => { | ||
| for (let img of node.children) { | ||
| for (let card in deck) { | ||
| if (img.alt == card) { | ||
| playedCards.push(deck[card]); | ||
| const table2Data2PlayedCards = document.querySelector(".table2Data2PlayedCards"); | ||
| table2Data2PlayedCards.textContent = `${playedCards.join(" - ")}`; | ||
| } | ||
| } | ||
| for (let card in hearts) { | ||
| if (img.alt == card) { | ||
| tdLog.textContent = `${last} a jucat ${hearts[card]} de rosu`; | ||
| playedHearts.push(hearts[card]); | ||
| playedHearts.sort(); | ||
| tdNr.textContent = `[ ${playedHearts.length} ]`; | ||
| tdCards.textContent = `[ ${playedHearts.join(" - ")} ]`; //playedHearts | ||
| tdRemaining.textContent = `[ ${6 - playedHearts.length} ]`; | ||
| if (playedHearts.length == 6) { | ||
| playedHearts.length = 0; | ||
| tdCards.textContent = `[ - ]`; | ||
| } | ||
| } | ||
| } | ||
| for (let card in diamonds) { | ||
| if (img.alt == card) { | ||
| tdLog.textContent = `${last} a jucat ${diamonds[card]} de duba`; | ||
| playedDiamonds.push(diamonds[card]); | ||
| playedDiamonds.sort(); | ||
| tdNr2.textContent = `[ ${playedDiamonds.length} ]`; | ||
| tdCards2.textContent = `[ ${playedDiamonds.join(" - ")} ]`; //playedDiamonds | ||
| tdRemaining2.textContent = `[ ${6 - playedDiamonds.length} ]`; | ||
| if (playedDiamonds.length == 6) { | ||
| playedDiamonds.length = 0; | ||
| tdCards2.textContent = `[ - ]`; | ||
| } | ||
| } | ||
| } | ||
| for (let card in spades) { | ||
| if (img.alt == card) { | ||
| tdLog.textContent = `${last} a jucat ${spades[card]} de verde`; | ||
| playedSpades.push(spades[card]); | ||
| playedSpades.sort(); | ||
| tdNr3.textContent = `[ ${playedSpades.length} ]`; | ||
| tdCards3.textContent = `[ ${playedSpades.join(" - ")} ]`; //playedSpades | ||
| tdRemaining3.textContent = `[ ${6 - playedSpades.length} ]`; | ||
| if (playedSpades.length == 6) { | ||
| playedSpades.length = 0; | ||
| tdCards3.textContent = `[ - ]`; | ||
| } | ||
| } | ||
| } | ||
| for (let card in clubs) { | ||
| if (img.alt == card) { | ||
| tdLog.textContent = `${last} a jucat ${clubs[card]} de ghinda`; | ||
| playedClubs.push(clubs[card]); | ||
| playedClubs.sort(); | ||
| tdNr4.textContent = `[ ${playedClubs.length} ]`; | ||
| tdCards4.textContent = `[ ${playedClubs.join(" - ")} ]`; //playedHearts | ||
| tdRemaining4.textContent = `[ ${6 - playedClubs.length} ]`; | ||
| if (playedClubs.length == 6) { | ||
| playedClubs.length = 0; | ||
| tdCards4.textContent = `[ - ]`; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
| getCards.observe(downcards, { | ||
| childList: true, | ||
| subtree: true, | ||
| }); | ||
| } | ||
+194
| function createUI(){ | ||
| const body = document.body; | ||
| const div = document.createElement("div"); | ||
| div.classList = "tableHolder"; | ||
| const table = document.createElement("table"); | ||
| table.className = "t1"; | ||
| const trLog = document.createElement("tr"); | ||
| const tdLog = document.createElement("td"); | ||
| tdLog.className = "tdLog"; | ||
| tdLog.colSpan = 4; | ||
| tdLog.textContent = "tromf Card Tracker - ZEUSDATA.DEV"; | ||
| const tr = document.createElement("tr"); | ||
| const tdNr = document.createElement("td"); | ||
| tdNr.className = "tdNr"; | ||
| const tdSuit = document.createElement("td"); | ||
| tdSuit.className = "tdSuit"; | ||
| tdSuit.textContent = "[ ROSU ]"; | ||
| const tdCards = document.createElement("td"); | ||
| tdCards.className = "tdCards"; | ||
| const tdRemaining = document.createElement("td"); | ||
| tdRemaining.className = "tdRemaining"; | ||
| const tr2 = document.createElement("tr"); | ||
| const tdNr2 = document.createElement("td"); | ||
| tdNr2.className = "tdNr2"; | ||
| const tdSuit2 = document.createElement("td"); | ||
| tdSuit2.className = "tdSuit2"; | ||
| tdSuit2.textContent = "[ DUBA ]"; | ||
| const tdCards2 = document.createElement("td"); | ||
| tdCards2.className = "tdCards2"; | ||
| const tdRemaining2 = document.createElement("td"); | ||
| tdRemaining2.className = "tdRemaining2"; | ||
| const tr3 = document.createElement("tr"); | ||
| const tdNr3 = document.createElement("td"); | ||
| tdNr3.className = "tdNr3"; | ||
| const tdSuit3 = document.createElement("td"); | ||
| tdSuit3.className = "tdSuit3"; | ||
| tdSuit3.textContent = "[ VERDE ]"; | ||
| const tdCards3 = document.createElement("td"); | ||
| tdCards3.className = "tdCards3"; | ||
| const tdRemaining3 = document.createElement("td"); | ||
| tdRemaining3.className = "tdRemaining3"; | ||
| const tr4 = document.createElement("tr"); | ||
| const tdNr4 = document.createElement("td"); | ||
| tdNr4.className = "tdNr4"; | ||
| const tdSuit4 = document.createElement("td"); | ||
| tdSuit4.className = "tdSuit4"; | ||
| tdSuit4.textContent = "[ GHINDA ]"; | ||
| const tdCards4 = document.createElement("td"); | ||
| tdCards4.className = "tdCards4"; | ||
| const tdRemaining4 = document.createElement("td"); | ||
| tdRemaining4.className = "tdRemaining4"; | ||
| body.appendChild(div); | ||
| div.appendChild(table); | ||
| table.appendChild(trLog); | ||
| trLog.appendChild(tdLog); | ||
| table.appendChild(tr); | ||
| table.appendChild(tr2); | ||
| table.appendChild(tr3); | ||
| table.appendChild(tr4); | ||
| tr.appendChild(tdSuit); | ||
| tr.appendChild(tdNr); | ||
| tr.appendChild(tdCards); | ||
| tr.appendChild(tdRemaining); | ||
| tr2.appendChild(tdSuit2); | ||
| tr2.appendChild(tdNr2); | ||
| tr2.appendChild(tdCards2); | ||
| tr2.appendChild(tdRemaining2); | ||
| tr3.appendChild(tdSuit3); | ||
| tr3.appendChild(tdNr3); | ||
| tr3.appendChild(tdCards3); | ||
| tr3.appendChild(tdRemaining3); | ||
| tr4.appendChild(tdSuit4); | ||
| tr4.appendChild(tdNr4); | ||
| tr4.appendChild(tdCards4); | ||
| tr4.appendChild(tdRemaining4); | ||
| const btnHide = document.createElement("button"); | ||
| btnHide.className = "btnHide"; | ||
| btnHide.textContent = "-"; | ||
| body.appendChild(btnHide); | ||
| btnHide.addEventListener("click", () => { | ||
| table.classList.toggle("hidden"); | ||
| table2.classList.toggle("hidden"); | ||
| if (table.classList.contains("hidden")) { | ||
| btnHide.textContent = "+"; | ||
| } else { | ||
| btnHide.textContent = "-"; | ||
| } | ||
| }); | ||
| let startTimer = Date.now(); | ||
| function format(time) { | ||
| const hours = Math.floor(time / 3600); | ||
| const minutes = Math.floor((time % 3600) / 60); | ||
| const seconds = time % 60; | ||
| return `${hours}:${minutes}:${seconds}`; | ||
| } | ||
| const time = () => { | ||
| return setInterval(() => { | ||
| let f = Math.floor((Date.now() - startTimer) / 1000); | ||
| table2Data1Timer.textContent = `${format(f)}`; | ||
| }, 1000); | ||
| }; | ||
| time(); | ||
| const table2 = document.createElement("table"); | ||
| table2.className = "t2"; | ||
| const table2Row = document.createElement("tr"); | ||
| const table2Head = document.createElement("th"); | ||
| table2Head.className = "thead2"; | ||
| table2Head.colSpan = 2; | ||
| table2Head.textContent = "STATISTICI"; | ||
| const table2Data = document.createElement("td"); | ||
| const table2Row2 = document.createElement("tr"); | ||
| const table2Data2GamesPlayed = document.createElement("td"); | ||
| table2Data2GamesPlayed.className = "tdata22"; | ||
| table2Data2GamesPlayed.textContent = `JOCUL NR: 0`; | ||
| const table2Data2Afk = document.createElement("td"); | ||
| table2Data2Afk.className = "tdata222"; | ||
| table2Data2Afk.textContent = `JOCURI INACTIVE: 0`; | ||
| //timer | ||
| const table2Row1Timer = document.createElement("tr"); //tr | ||
| const table2Head1Timer = document.createElement("th"); //th | ||
| table2Head1Timer.className = "thead22"; | ||
| table2Head1Timer.textContent = "TIMPUL PETRECUT PE JOC"; | ||
| table2Head1Timer.colSpan = 2; | ||
| const table2Row1Timer1 = document.createElement("tr"); //tr | ||
| const table2Data1Timer = document.createElement("td"); //td | ||
| table2Data1Timer.colSpan = 2; | ||
| table2Data1Timer.className = "table2Data2Time"; | ||
| table2Data1Timer.textContent = `${time()}`; | ||
| //timer ends | ||
| const table2Row1Cards = document.createElement("tr"); | ||
| const table2Head2 = document.createElement("th"); | ||
| table2Head2.textContent = "CARTI JUCATE"; | ||
| table2Head2.className = "thead22"; | ||
| table2Head2.colSpan = 2; | ||
| const table2Row2Cards = document.createElement("tr"); | ||
| table2Row2Cards.className = "table2Row2Cards"; | ||
| const table2Data2PlayedCards = document.createElement("td"); | ||
| table2Data2PlayedCards.className = "table2Data2PlayedCards"; | ||
| table2Data2PlayedCards.colSpan = 2; | ||
| body.appendChild(div); | ||
| div.appendChild(table2); | ||
| table2.appendChild(table2Row); | ||
| table2Row.appendChild(table2Head); | ||
| table2.appendChild(table2Row2); | ||
| table2Row2.appendChild(table2Data2GamesPlayed); | ||
| table2Row2.appendChild(table2Data2Afk); | ||
| table2.appendChild(table2Row1Timer); | ||
| table2Row1Timer.appendChild(table2Head1Timer); | ||
| table2.appendChild(table2Row1Timer1); | ||
| table2Row1Timer1.appendChild(table2Data1Timer); | ||
| table2.appendChild(table2Row1Cards); | ||
| table2Row1Cards.appendChild(table2Head2); | ||
| table2Head2.appendChild(table2Data2PlayedCards); | ||
| //footer | ||
| const divFooter = document.createElement("div"); | ||
| divFooter.className = "zeusfooter"; | ||
| div.appendChild(divFooter); | ||
| const footerLinkDonate = document.createElement("a"); | ||
| footerLinkDonate.className = "footerLinkDonate"; | ||
| footerLinkDonate.href = "https://buymeacoffee.com/zeusdata"; | ||
| footerLinkDonate.textContent = "[ DONEAZA ]"; | ||
| footerLinkDonate.target = "_blank"; | ||
| divFooter.appendChild(footerLinkDonate); | ||
| const footerLink = document.createElement("a"); | ||
| footerLink.className = "footerLink"; | ||
| footerLink.href = "https://zeusdata.dev/"; | ||
| footerLink.textContent = "ZEUSDATA.DEV"; | ||
| footerLink.target = "_blank"; | ||
| divFooter.appendChild(footerLink); | ||
| } |
| function getPlayerName(){ | ||
| const playersName = document.getElementById("players"); | ||
| const tdLog = document.querySelector(".tdLog"); | ||
| const getNamePlayers = new MutationObserver((mutations) => { | ||
| mutations.forEach((e) => { | ||
| const actual = e.target.dataset.active; | ||
| const old = e.oldValue; | ||
| if (actual === "0" && old === "1") { | ||
| last = e.target.textContent; | ||
| if (playedCards.length == 24) { | ||
| tdLog.textContent = "JOCUL A LUAT SFARSIT!"; | ||
| } | ||
| } | ||
| }); | ||
| }); | ||
| getNamePlayers.observe(playersName, { | ||
| attributes: true, | ||
| attributeOldValue: true, | ||
| attributeFilter: ["data-active"], | ||
| subtree: true, | ||
| }); | ||
| } |
+43
| console.log('https://zeusdata.dev/'); | ||
| let playedHearts = []; | ||
| let playedDiamonds = []; | ||
| let playedSpades = []; | ||
| let playedClubs = []; | ||
| let last = null; | ||
| let playedCards = []; | ||
| const wait = new MutationObserver(() =>{ | ||
| //const down = document.querySelector('.downcards'); | ||
| const dialog = document.querySelector('.p-dialog'); | ||
| if(dialog){ | ||
| wait.disconnect(); | ||
| createUI(); | ||
| myTurnDetection(); | ||
| //afkDetection(); | ||
| getPlayerName(); | ||
| newGame(); | ||
| zCards(); | ||
| } | ||
| }) | ||
| wait.observe(document.body, { | ||
| childList: true, | ||
| subtree: true, | ||
| }); | ||
| const afk = new MutationObserver((mutation) => { | ||
| mutation.forEach((e) => { | ||
| e.addedNodes.forEach((node) => { | ||
| if (node.className == "popup auto") { | ||
| afkDetection(); | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
| afk.observe(document.body, { | ||
| childList: true, | ||
| subtree: true, | ||
| //attributes: true | ||
| }); |
+24
| function myTurnDetection(){ | ||
| const me = document.querySelector(".p-me"); | ||
| const tdLog = document.querySelector(".tdLog"); | ||
| const vhand = document.querySelector(".vhand"); | ||
| const myTurn = new MutationObserver((mutations) => { | ||
| mutations.forEach((e) => { | ||
| if (e.removedNodes && e.removedNodes.length > 0) { | ||
| last = me.textContent; | ||
| if (playedCards.length == 24) { | ||
| tdLog.textContent = "JOCUL A LUAT SFARSIT!"; | ||
| } | ||
| } | ||
| }); | ||
| }); | ||
| myTurn.observe(vhand, { | ||
| childList: true, | ||
| attributes: true, | ||
| attributeFilter: ["data-active"], | ||
| subtree: true, | ||
| }); | ||
| }; |
+68
| function newGame(){ | ||
| const dialog = document.querySelector(".p-dialog"); | ||
| let newGameC = 0; | ||
| let detectNewGame = new MutationObserver((mutation) => { | ||
| const tdLog = document.querySelector(".tdLog"); | ||
| const tdRemaining = document.querySelector('.tdRemaining'); | ||
| const tdRemaining2 = document.querySelector('.tdRemaining2'); | ||
| const tdRemaining3 = document.querySelector('.tdRemaining3'); | ||
| const tdRemaining4 = document.querySelector('.tdRemaining4'); | ||
| const tdata22 = document.querySelector('.tdata22'); | ||
| const tdCards = document.querySelector('.tdCards'); | ||
| const tdCards2 = document.querySelector('.tdCards2'); | ||
| const tdCards3 = document.querySelector('.tdCards3'); | ||
| const tdCards4 = document.querySelector('.tdCards4'); | ||
| const tdNr = document.querySelector('.tdNr'); | ||
| const tdNr2 = document.querySelector('.tdNr2'); | ||
| const tdNr3 = document.querySelector('.tdNr3'); | ||
| const tdNr4 = document.querySelector('.tdNr4'); | ||
| const table2Data2PlayedCards = document.querySelector('.table2Data2PlayedCards'); | ||
| mutation.forEach((e) => { | ||
| if (e.target.style.display == "none") { | ||
| newGameC++; | ||
| tdLog.textContent = `INCEPE RUNDA NOUA. JOCUL NR: ${newGameC}`; | ||
| tdata22.textContent = `JOCUL NR: ${newGameC}`; | ||
| if (newGameC > 1 && playedCards.length !== 24) { | ||
| tdLog.textContent = "NU AU FOST INREGISTRATE TOATE CARTILE!"; | ||
| } | ||
| table2Data2PlayedCards.textContent = ''; | ||
| playedCards.length = 0; | ||
| playedHearts.length = 0; | ||
| playedDiamonds.length = 0; | ||
| playedSpades.length = 0; | ||
| playedClubs.length = 0; | ||
| tdNr.textContent = ""; | ||
| tdNr2.textContent = ""; | ||
| tdNr3.textContent = ""; | ||
| tdNr4.textContent = ""; | ||
| tdCards.textContent = ""; | ||
| tdCards2.textContent = ""; | ||
| tdCards3.textContent = ""; | ||
| tdCards4.textContent = ""; | ||
| tdRemaining.textContent = "[ 0 ]"; | ||
| tdRemaining2.textContent = "[ 0 ]"; | ||
| tdRemaining3.textContent = "[ 0 ]"; | ||
| tdRemaining4.textContent = "[ 0 ]"; | ||
| } | ||
| }); | ||
| }); | ||
| detectNewGame.observe(dialog, { | ||
| subtree: true, | ||
| attributes: true, | ||
| attributeFilter: ["style"], | ||
| }); | ||
| } |
+81
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <link rel="preconnect" href="https://fonts.googleapis.com"> | ||
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
| <link href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,100..900;1,100..900&display=swap" | ||
| rel="stylesheet"> | ||
| <style> | ||
| body{ | ||
| background-color: black; | ||
| color:white; | ||
| width:300px; | ||
| height:400px; | ||
| font-family: "Roboto Condensed", sans-serif; | ||
| font-optical-sizing: auto; | ||
| font-weight: <weight>; | ||
| font-style: normal; | ||
| zborder:1px solid red; | ||
| display:flex; | ||
| zjustify-content:center; | ||
| gap:10px; | ||
| align-items:center; | ||
| flex-direction:column; | ||
| } | ||
| .title-center{ | ||
| text-align: center; | ||
| } | ||
| .donate{ | ||
| width:80%; | ||
| height:40px; | ||
| background-color: #ffdd00; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| color:black; | ||
| text-decoration: none; | ||
| } | ||
| .zeus{ | ||
| width:80%; | ||
| height:40px; | ||
| background-color: black; | ||
| border:2px solid #d73b3b; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| color:white; | ||
| text-decoration: none; | ||
| transition: 0.4s ease-in-out; | ||
| } | ||
| .zeus:hover{ | ||
| width:80%; | ||
| height:40px; | ||
| background-color: #751d1d; | ||
| border:2px solid #d73b3b; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| color:white; | ||
| text-decoration: none; | ||
| } | ||
| .c{ | ||
| color: #d73b3b; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <h3 class="title-center">tromfCardTracker - v0.10.1</h3> | ||
| <a href="https://buymeacoffee.com/zeusdata" target="_blank" class="donate">DONEAZA</a> | ||
| <a href="https://zeusdata.dev" target="_blank" class="zeus">ZEUSDATA<span class='c'>DEV</span></a> | ||
| <a href="https://addons.mozilla.org/addon/tromfcardtracker/" target="_blank" class="zeus">DA-NE UN RATING</span></a> | ||
| <a href="mailto:zeusdata.dev@gmail.com" target="_blank" class="zeus">CONTACT</span></a> | ||
| <script> | ||
| </script> | ||
| </body> | ||
| </html> |
+12
-10
| { | ||
| "manifest_version": 2, | ||
| "name": "tromfCardTracker", | ||
| "version": "0.10.0", | ||
| "version": "0.10.1", | ||
| "description": "card tracker for tromf.ro", | ||
@@ -9,2 +9,5 @@ "icons": { | ||
| }, | ||
| "browser_action": { | ||
| "default_popup": "popup.html" | ||
| }, | ||
| "content_scripts": [ | ||
@@ -16,3 +19,9 @@ { | ||
| "js": [ | ||
| "script.js" | ||
| "createUI.js", | ||
| "newGame.js", | ||
| "myTurn.js", | ||
| "afk.js", | ||
| "getPlayerName.js", | ||
| "cards.js", | ||
| "main.js" | ||
| ], | ||
@@ -27,12 +36,5 @@ "css": [ | ||
| "gecko": { | ||
| "id": "zeusdata.dev@gmail.com", | ||
| "strict_min_version": "91.0", | ||
| "data_collection_permissions": { | ||
| "collects_data": false, | ||
| "required": [ | ||
| "none" | ||
| ] | ||
| } | ||
| "id": "zeusdata.dev@gmail.com" | ||
| } | ||
| } | ||
| } |
+6
-5
@@ -16,7 +16,7 @@ body { | ||
| position: fixed; | ||
| top: 10px; | ||
| top: 50px; | ||
| left: 50px; | ||
| } | ||
| .zeusfooter { | ||
| opacity: 0.8; | ||
| opacity: 0.78; | ||
| zwidth: 540px; | ||
@@ -46,3 +46,3 @@ height: 40px; | ||
| zpadding: 10px; | ||
| opacity: 0.8; | ||
| opacity: 0.78; | ||
| } | ||
@@ -55,3 +55,3 @@ /*table2 css*/ | ||
| zpadding: 10px; | ||
| opacity: 0.8; | ||
| opacity: 0.78; | ||
| } | ||
@@ -140,5 +140,6 @@ .table2Data2PlayedCards { | ||
| position: fixed; | ||
| top: 10px; | ||
| top: 50px; | ||
| left: 590px; | ||
| z-index: 99; | ||
| opacity: 0.78; | ||
| } | ||
@@ -145,0 +146,0 @@ .hidden { |
-439
| console.log("ZEUSDATA.DEV"); | ||
| let playedHearts = []; | ||
| let playedDiamonds = []; | ||
| let playedSpades = []; | ||
| let playedClubs = []; | ||
| let newGameCount = 0; | ||
| let afkCount = 0; | ||
| let playedCards = []; | ||
| const body = document.body; | ||
| const div = document.createElement("div"); | ||
| div.classList = "tableHolder"; | ||
| const table = document.createElement("table"); | ||
| table.className = "t1"; | ||
| const trLog = document.createElement("tr"); | ||
| const tdLog = document.createElement("td"); | ||
| tdLog.className = "tdLog"; | ||
| tdLog.colSpan = 4; | ||
| tdLog.textContent = "tromf Card Tracker - ZEUSDATA.DEV"; | ||
| const tr = document.createElement("tr"); | ||
| const tdNr = document.createElement("td"); | ||
| tdNr.className = "tdNr"; | ||
| const tdSuit = document.createElement("td"); | ||
| tdSuit.className = "tdSuit"; | ||
| tdSuit.textContent = "[ ROSU ]"; | ||
| const tdCards = document.createElement("td"); | ||
| tdCards.className = "tdCards"; | ||
| const tdRemaining = document.createElement("td"); | ||
| tdRemaining.className = "tdRemaining"; | ||
| const tr2 = document.createElement("tr"); | ||
| const tdNr2 = document.createElement("td"); | ||
| tdNr2.className = "tdNr2"; | ||
| const tdSuit2 = document.createElement("td"); | ||
| tdSuit2.className = "tdSuit2"; | ||
| tdSuit2.textContent = "[ DUBA ]"; | ||
| const tdCards2 = document.createElement("td"); | ||
| tdCards2.className = "tdCards2"; | ||
| const tdRemaining2 = document.createElement("td"); | ||
| tdRemaining2.className = "tdRemaining2"; | ||
| const tr3 = document.createElement("tr"); | ||
| const tdNr3 = document.createElement("td"); | ||
| tdNr3.className = "tdNr2"; | ||
| const tdSuit3 = document.createElement("td"); | ||
| tdSuit3.className = "tdSuit3"; | ||
| tdSuit3.textContent = "[ VERDE ]"; | ||
| const tdCards3 = document.createElement("td"); | ||
| tdCards3.className = "tdCards2"; | ||
| const tdRemaining3 = document.createElement("td"); | ||
| tdRemaining3.className = "tdRemaining2"; | ||
| const tr4 = document.createElement("tr"); | ||
| const tdNr4 = document.createElement("td"); | ||
| tdNr4.className = "tdNr2"; | ||
| const tdSuit4 = document.createElement("td"); | ||
| tdSuit4.className = "tdSuit4"; | ||
| tdSuit4.textContent = "[ GHINDA ]"; | ||
| const tdCards4 = document.createElement("td"); | ||
| tdCards4.className = "tdCards2"; | ||
| const tdRemaining4 = document.createElement("td"); | ||
| tdRemaining4.className = "tdRemaining2"; | ||
| body.appendChild(div); | ||
| div.appendChild(table); | ||
| table.appendChild(trLog); | ||
| trLog.appendChild(tdLog); | ||
| table.appendChild(tr); | ||
| table.appendChild(tr2); | ||
| table.appendChild(tr3); | ||
| table.appendChild(tr4); | ||
| tr.appendChild(tdSuit); | ||
| tr.appendChild(tdNr); | ||
| tr.appendChild(tdCards); | ||
| tr.appendChild(tdRemaining); | ||
| tr2.appendChild(tdSuit2); | ||
| tr2.appendChild(tdNr2); | ||
| tr2.appendChild(tdCards2); | ||
| tr2.appendChild(tdRemaining2); | ||
| tr3.appendChild(tdSuit3); | ||
| tr3.appendChild(tdNr3); | ||
| tr3.appendChild(tdCards3); | ||
| tr3.appendChild(tdRemaining3); | ||
| tr4.appendChild(tdSuit4); | ||
| tr4.appendChild(tdNr4); | ||
| tr4.appendChild(tdCards4); | ||
| tr4.appendChild(tdRemaining4); | ||
| const btnHide = document.createElement("button"); | ||
| btnHide.className = "btnHide"; | ||
| btnHide.textContent = "[ x ]"; | ||
| body.appendChild(btnHide); | ||
| btnHide.addEventListener("click", () => { | ||
| table.classList.toggle("hidden"); | ||
| table2.classList.toggle("hidden"); | ||
| }); | ||
| let startTimer = Date.now(); | ||
| function format(time) { | ||
| const hours = Math.floor(time / 3600); | ||
| const minutes = Math.floor((time % 3600) / 60); | ||
| const seconds = time % 60; | ||
| return `${hours}:${minutes}:${seconds}`; | ||
| } | ||
| const time = () => { | ||
| return setInterval(() => { | ||
| let f = Math.floor((Date.now() - startTimer) / 1000); | ||
| table2Data1Timer.textContent = `${format(f)}`; | ||
| }, 1000); | ||
| }; | ||
| time(); | ||
| const table2 = document.createElement("table"); | ||
| table2.className = "t2"; | ||
| const table2Row = document.createElement("tr"); | ||
| const table2Head = document.createElement("th"); | ||
| table2Head.className = "thead2"; | ||
| table2Head.colSpan = 2; | ||
| table2Head.textContent = "STATISTICI"; | ||
| const table2Data = document.createElement("td"); | ||
| const table2Row2 = document.createElement("tr"); | ||
| const table2Data2GamesPlayed = document.createElement("td"); | ||
| table2Data2GamesPlayed.className = "tdata22"; | ||
| table2Data2GamesPlayed.textContent = `JOCUL NR: 0`; | ||
| const table2Data2Afk = document.createElement("td"); | ||
| table2Data2Afk.className = "tdata222"; | ||
| table2Data2Afk.textContent = `JOCURI INACTIVE: 0`; | ||
| //timer | ||
| const table2Row1Timer = document.createElement("tr"); //tr | ||
| const table2Head1Timer = document.createElement("th"); //th | ||
| table2Head1Timer.className = "thead22"; | ||
| table2Head1Timer.textContent = "TIMPUL PETRECUT PE JOC"; | ||
| table2Head1Timer.colSpan = 2; | ||
| const table2Row1Timer1 = document.createElement("tr"); //tr | ||
| const table2Data1Timer = document.createElement("td"); //td | ||
| table2Data1Timer.colSpan = 2; | ||
| table2Data1Timer.className = "table2Data2PlayedCards"; | ||
| table2Data1Timer.textContent = `${time()}`; | ||
| //timer ends | ||
| const table2Row1Cards = document.createElement("tr"); | ||
| const table2Head2 = document.createElement("th"); | ||
| table2Head2.textContent = "CARTI JUCATE"; | ||
| table2Head2.className = "thead22"; | ||
| table2Head2.colSpan = 2; | ||
| const table2Row2Cards = document.createElement("tr"); | ||
| table2Row2Cards.className = "table2Row2Cards"; | ||
| const table2Data2PlayedCards = document.createElement("td"); | ||
| table2Data2PlayedCards.className = "table2Data2PlayedCards"; | ||
| table2Data2PlayedCards.colSpan = 2; | ||
| body.appendChild(div); | ||
| div.appendChild(table2); | ||
| table2.appendChild(table2Row); | ||
| table2Row.appendChild(table2Head); | ||
| table2.appendChild(table2Row2); | ||
| table2Row2.appendChild(table2Data2GamesPlayed); | ||
| table2Row2.appendChild(table2Data2Afk); | ||
| table2.appendChild(table2Row1Timer); | ||
| table2Row1Timer.appendChild(table2Head1Timer); | ||
| table2.appendChild(table2Row1Timer1); | ||
| table2Row1Timer1.appendChild(table2Data1Timer); | ||
| table2.appendChild(table2Row1Cards); | ||
| table2Row1Cards.appendChild(table2Head2); | ||
| table2Head2.appendChild(table2Data2PlayedCards); | ||
| //footer | ||
| const divFooter = document.createElement("div"); | ||
| divFooter.className = "zeusfooter"; | ||
| div.appendChild(divFooter); | ||
| const footerLinkDonate = document.createElement("a"); | ||
| footerLinkDonate.className = "footerLinkDonate"; | ||
| footerLinkDonate.href = "https://buymeacoffee.com/zeusdata"; | ||
| footerLinkDonate.textContent = "[ DONEAZA ]"; | ||
| footerLinkDonate.target = "_blank"; | ||
| divFooter.appendChild(footerLinkDonate); | ||
| const footerLink = document.createElement("a"); | ||
| footerLink.className = "footerLink"; | ||
| footerLink.href = "https://zeusdata.dev/"; | ||
| footerLink.textContent = "ZEUSDATA.DEV"; | ||
| footerLink.target = "_blank"; | ||
| divFooter.appendChild(footerLink); | ||
| const deck = { | ||
| "J♤": "doi verde", | ||
| "J♥": "doi rosu", | ||
| "J♦": "doi duba", | ||
| "J♧": "doi ghinda", | ||
| "Q♤": "trei verde", | ||
| "Q♥": "trei rosu", | ||
| "Q♦": "trei duba", | ||
| "Q♧": "trei ghinda", | ||
| "K♤": "patrar verde", | ||
| "K♥": "patrar rosu", | ||
| "K♦": "patrar duba", | ||
| "K♧": "patrar ghinda", | ||
| "A♤": "as verde", | ||
| "A♥": "as rosu", | ||
| "A♦": "as duba", | ||
| "A♧": "as ghinda", | ||
| "10♤": "zece verde", | ||
| "10♥": "zece rosu", | ||
| "10♦": "zece dube", | ||
| "10♧": "zece ghinda", | ||
| "9♤": "noua verde", | ||
| "9♥": "noua rosu", | ||
| "9♦": "noua duba", | ||
| "9♧": "noua ghinda", | ||
| }; | ||
| const hearts = { | ||
| "J♥": "II", | ||
| "Q♥": "III", | ||
| "K♥": "IV", | ||
| "A♥": "AS", | ||
| "10♥": "X", | ||
| "9♥": "IX", | ||
| }; | ||
| const diamonds = { | ||
| "J♦": "II", | ||
| "Q♦": "III", | ||
| "K♦": "IV", | ||
| "A♦": "AS", | ||
| "10♦": "X", | ||
| "9♦": "IX", | ||
| }; | ||
| const spades = { | ||
| "J♤": "II", | ||
| "Q♤": "III", | ||
| "K♤": "IV", | ||
| "A♤": "AS", | ||
| "10♤": "X", | ||
| "9♤": "IX", | ||
| }; | ||
| const clubs = { | ||
| "J♧": "II", | ||
| "Q♧": "III", | ||
| "K♧": "IV", | ||
| "A♧": "AS", | ||
| "10♧": "X", | ||
| "9♧": "IX", | ||
| }; | ||
| const playersName = document.getElementById("players"); | ||
| let last = null; | ||
| const getNamePlayers = new MutationObserver((mutations) => { | ||
| mutations.forEach((e) => { | ||
| const actual = e.target.dataset.active; | ||
| const old = e.oldValue; | ||
| if (actual === "0" && old === "1") { | ||
| last = e.target.textContent; | ||
| if (playedCards.length == 24) { | ||
| tdLog.textContent = "JOCUL A LUAT SFARSIT!"; | ||
| } | ||
| } | ||
| }); | ||
| }); | ||
| getNamePlayers.observe(playersName, { | ||
| attributes: true, | ||
| attributeOldValue: true, | ||
| attributeFilter: ["data-active"], | ||
| subtree: true, | ||
| }); | ||
| const me = document.querySelector(".p-me"); | ||
| const vhand = document.querySelector(".vhand"); | ||
| const myTurn = new MutationObserver((mutations) => { | ||
| mutations.forEach((e) => { | ||
| if (e.removedNodes && e.removedNodes.length > 0) { | ||
| last = me.textContent; | ||
| if (playedCards.length == 24) { | ||
| tdLog.textContent = "JOCUL A LUAT SFARSIT!"; | ||
| } | ||
| } | ||
| }); | ||
| }); | ||
| myTurn.observe(vhand, { | ||
| childList: true, | ||
| attributes: true, | ||
| attributeFilter: ["data-active"], | ||
| subtree: true, | ||
| }); | ||
| const downcards = document.querySelector(".downcards"); | ||
| let getCards = new MutationObserver((mutation) => { | ||
| mutation.forEach((e) => { | ||
| e.addedNodes.forEach((node) => { | ||
| for (let img of node.children) { | ||
| for (let card in deck) { | ||
| if (img.alt == card) { | ||
| playedCards.push(deck[card]); | ||
| table2Data2PlayedCards.textContent = `${playedCards.join(" - ")}`; | ||
| } | ||
| } | ||
| for (let card in hearts) { | ||
| if (img.alt == card) { | ||
| tdLog.textContent = `${last} a jucat ${hearts[card]} de rosu`; | ||
| playedHearts.push(hearts[card]); | ||
| playedHearts.sort(); | ||
| tdNr.textContent = `[ ${playedHearts.length} ]`; | ||
| tdCards.textContent = `[ ${playedHearts.join(" - ")} ]`; //playedHearts | ||
| tdRemaining.textContent = `[ ${6 - playedHearts.length} ]`; | ||
| if (playedHearts.length == 6) { | ||
| playedHearts.length = 0; | ||
| tdCards.textContent = `[ - ]`; | ||
| } | ||
| } | ||
| } | ||
| for (let card in diamonds) { | ||
| if (img.alt == card) { | ||
| tdLog.textContent = `${last} a jucat ${diamonds[card]} de duba`; | ||
| playedDiamonds.push(diamonds[card]); | ||
| playedDiamonds.sort(); | ||
| tdNr2.textContent = `[ ${playedDiamonds.length} ]`; | ||
| tdCards2.textContent = `[ ${playedDiamonds.join(" - ")} ]`; //playedDiamonds | ||
| tdRemaining2.textContent = `[ ${6 - playedDiamonds.length} ]`; | ||
| if (playedDiamonds.length == 6) { | ||
| playedDiamonds.length = 0; | ||
| tdCards2.textContent = `[ - ]`; | ||
| } | ||
| } | ||
| } | ||
| for (let card in spades) { | ||
| if (img.alt == card) { | ||
| tdLog.textContent = `${last} a jucat ${spades[card]} de verde`; | ||
| playedSpades.push(spades[card]); | ||
| playedSpades.sort(); | ||
| tdNr3.textContent = `[ ${playedSpades.length} ]`; | ||
| tdCards3.textContent = `[ ${playedSpades.join(" - ")} ]`; //playedSpades | ||
| tdRemaining3.textContent = `[ ${6 - playedSpades.length} ]`; | ||
| if (playedSpades.length == 6) { | ||
| playedSpades.length = 0; | ||
| tdCards3.textContent = `[ - ]`; | ||
| } | ||
| } | ||
| } | ||
| for (let card in clubs) { | ||
| if (img.alt == card) { | ||
| tdLog.textContent = `${last} a jucat ${clubs[card]} de ghinda`; | ||
| playedClubs.push(clubs[card]); | ||
| playedClubs.sort(); | ||
| tdNr4.textContent = `[ ${playedClubs.length} ]`; | ||
| tdCards4.textContent = `[ ${playedClubs.join(" - ")} ]`; //playedHearts | ||
| tdRemaining4.textContent = `[ ${6 - playedClubs.length} ]`; | ||
| if (playedClubs.length == 6) { | ||
| playedClubs.length = 0; | ||
| tdCards4.textContent = `[ - ]`; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
| getCards.observe(downcards, { | ||
| childList: true, | ||
| subtree: true, | ||
| }); | ||
| //detect new game | ||
| const dialog = document.querySelector(".p-dialog"); | ||
| let detectNewGame = new MutationObserver((mutation) => { | ||
| mutation.forEach((e) => { | ||
| if (e.target.style.display == "none") { | ||
| newGameCount++; | ||
| tdLog.textContent = `INCEPE RUNDA NOUA. JOCUL NR: ${newGameCount}`; | ||
| table2Data2GamesPlayed.textContent = `JOCUL NR: ${newGameCount}`; | ||
| playedHearts.length = 0; | ||
| playedDiamonds.length = 0; | ||
| playedSpades.length = 0; | ||
| playedClubs.length = 0; | ||
| tdCards.textContent = ""; | ||
| tdCards2.textContent = ""; | ||
| tdCards3.textContent = ""; | ||
| tdCards4.textContent = ""; | ||
| tdRemaining.textContent = "[ 0 ]"; | ||
| tdRemaining2.textContent = "[ 0 ]"; | ||
| tdRemaining3.textContent = "[ 0 ]"; | ||
| tdRemaining4.textContent = "[ 0 ]"; | ||
| if (playedCards.length !== 24) { | ||
| tdLog.textContent = "NU AU FOST INREGISTRATE TOATE CARTILE!"; | ||
| } | ||
| playedCards.length = 0; | ||
| table2Data2PlayedCards.textContent = ``; | ||
| } | ||
| }); | ||
| }); | ||
| detectNewGame.observe(dialog, { | ||
| subtree: true, | ||
| attributes: true, | ||
| attributeFilter: ["style"], | ||
| }); | ||
| const afk = new MutationObserver((mutation) => { | ||
| mutation.forEach((e) => { | ||
| e.addedNodes.forEach((node) => { | ||
| if (node.className == "popup auto") { | ||
| afkCount++; | ||
| table2Data2Afk.textContent = `AFK: ${afkCount}`; | ||
| tdLog.textContent = "INACTIVITATE DETECTATA!"; | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
| afk.observe(document.body, { | ||
| childList: true, | ||
| subtree: true, | ||
| //attributes: true | ||
| }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet