From 5970703ac761aae06226654595fb199f2d79b8b4 Mon Sep 17 00:00:00 2001 From: Razviar Date: Tue, 26 Sep 2023 11:31:57 +0300 Subject: [PATCH] 1.2.24 --- package-lock.json | 70 ++++++++++--------- package.json | 12 ++-- src/app/game_state.ts | 2 +- src/windows/home/functions/messages.ts | 8 +-- src/windows/home/home.ts | 11 ++- src/windows/overlay/functions/checkbot.ts | 2 +- src/windows/overlay/functions/drawdeck.ts | 6 +- .../overlay/functions/hovereventlistener.ts | 40 +++++++++++ src/windows/overlay/functions/makecard.ts | 2 +- .../overlay/functions/updateoppdeck.ts | 5 +- src/windows/overlay/overlay.css | 16 ++--- src/windows/overlay/overlay.html | 2 + src/windows/overlay/overlay.ts | 3 +- webpack.main.config.js | 1 - 14 files changed, 111 insertions(+), 69 deletions(-) create mode 100644 src/windows/overlay/functions/hovereventlistener.ts diff --git a/package-lock.json b/package-lock.json index ebaa298..2c6e3e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "marvelsnaptracker", - "version": "1.2.19", + "version": "1.2.24", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "marvelsnaptracker", - "version": "1.2.19", + "version": "1.2.24", "license": "MIT", "dependencies": { - "@types/find": "0.2.1", + "@types/find": "0.2.2", "auto-launch": "5.0.6", "axios": "1.5.0", "date-fns": "2.30.0", @@ -17,7 +17,7 @@ "error-stack-parser": "2.1.4", "find-process": "1.4.7", "form-data": "4.0.0", - "jsonrepair": "3.2.0", + "jsonrepair": "3.2.2", "lodash": "4.17.21", "moment": "2.29.4", "node-abi": "3.47.0", @@ -36,13 +36,13 @@ "@electron-forge/plugin-webpack": "6.4.2", "@electron-forge/publisher-github": "6.4.2", "@marshallofsound/webpack-asset-relocator-loader": "0.5.0", - "@types/auto-launch": "5.0.2", - "@types/lodash": "4.14.198", + "@types/auto-launch": "5.0.3", + "@types/lodash": "4.14.199", "copy-webpack-plugin": "11.0.0", "csp-html-webpack-plugin": "5.1.0", "css-loader": "6.8.1", "dotenv-webpack": "8.0.1", - "electron": "26.2.0", + "electron": "26.2.2", "file-loader": "6.2.0", "fork-ts-checker-webpack-plugin": "8.0.0", "node-loader": "2.0.0", @@ -1244,8 +1244,9 @@ } }, "node_modules/@types/auto-launch": { - "version": "5.0.2", - "integrity": "sha512-b03X09+GCM9t6AUECpwA2gUPYs8s5tJHFJw92sK8EiJ7G4QNbsHmXV7nfCfP6G6ivtm230vi4oNfe8AzRgzxMQ==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@types/auto-launch/-/auto-launch-5.0.3.tgz", + "integrity": "sha512-+YEpP9vt+X9BkxdJ+dpKsfmVEX0wrhryR5TERprs0hcnrSpGJTT4gfDayvfyX7RFLLkpe0cvLj8A6WibJjkB0g==", "dev": true }, "node_modules/@types/cacheable-request": { @@ -1282,8 +1283,9 @@ "dev": true }, "node_modules/@types/find": { - "version": "0.2.1", - "integrity": "sha512-qUrCBlWoo9ij6ZEMx8G2WEjkdpofFks37/eZSDce7e0BY8lCYS2u7dVAoBy6AKRGX8z/ukllrUAyQ8h+/zlW9w==" + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@types/find/-/find-0.2.2.tgz", + "integrity": "sha512-Q67LLJvnvyiAu8XP1D2pPkxWh1hXLVOI3X77z4kw2orV4AIEz4I4UgVofabIIfypGoBZ2WAosTuu3gJVKPzlyw==" }, "node_modules/@types/fs-extra": { "version": "9.0.13", @@ -1337,9 +1339,9 @@ } }, "node_modules/@types/lodash": { - "version": "4.14.198", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.198.tgz", - "integrity": "sha512-trNJ/vtMZYMLhfN45uLq4ShQSw0/S7xCTLLVM+WM1rmFpba/VS42jVUgaO3w/NOLiWR/09lnYk0yMaA/atdIsg==", + "version": "4.14.199", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.199.tgz", + "integrity": "sha512-Vrjz5N5Ia4SEzWWgIVwnHNEnb1UE1XMkvY5DGXrAeOGE9imk0hgTHh5GyDjLDJi9OTCn9oo9dXH1uToK1VRfrg==", "dev": true }, "node_modules/@types/minimatch": { @@ -3424,9 +3426,9 @@ "dev": true }, "node_modules/electron": { - "version": "26.2.0", - "resolved": "https://registry.npmjs.org/electron/-/electron-26.2.0.tgz", - "integrity": "sha512-H6Z0sYTtLcybHCQT1yti/8BK+vN5/ZfoekKcdrfZMh5mVf2Z7psFVs6nBhXPzIOyRE/gdb6NcOppnUsGc3NJVQ==", + "version": "26.2.2", + "resolved": "https://registry.npmjs.org/electron/-/electron-26.2.2.tgz", + "integrity": "sha512-Ihb3Zt4XYnHF52DYSq17ySkgFqJV4OT0VnfhUYZASAql7Vembz3VsAq7mB3OALBHXltAW34P8BxTIwTqZaMS3g==", "hasInstallScript": true, "dependencies": { "@electron/get": "^2.0.0", @@ -5831,9 +5833,9 @@ } }, "node_modules/jsonrepair": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonrepair/-/jsonrepair-3.2.0.tgz", - "integrity": "sha512-6eHBc2z5vipym4S8rzTcCXQBLWpkSzi9bk7I3xTdUxRzXyYvfjoVZzJ97N4C/9vcKI9NgNp3slPwHufDr0rFYw==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jsonrepair/-/jsonrepair-3.2.2.tgz", + "integrity": "sha512-IwsEsj59BVjFTO5DJ22Naxk5+AuNjS+1BUqOebpPlcyF8C+n8SAAICFo4Db74ORltzDygAlTAH56Pe1vupsnzA==", "bin": { "jsonrepair": "bin/cli.js" } @@ -10668,8 +10670,9 @@ "dev": true }, "@types/auto-launch": { - "version": "5.0.2", - "integrity": "sha512-b03X09+GCM9t6AUECpwA2gUPYs8s5tJHFJw92sK8EiJ7G4QNbsHmXV7nfCfP6G6ivtm230vi4oNfe8AzRgzxMQ==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@types/auto-launch/-/auto-launch-5.0.3.tgz", + "integrity": "sha512-+YEpP9vt+X9BkxdJ+dpKsfmVEX0wrhryR5TERprs0hcnrSpGJTT4gfDayvfyX7RFLLkpe0cvLj8A6WibJjkB0g==", "dev": true }, "@types/cacheable-request": { @@ -10706,8 +10709,9 @@ "dev": true }, "@types/find": { - "version": "0.2.1", - "integrity": "sha512-qUrCBlWoo9ij6ZEMx8G2WEjkdpofFks37/eZSDce7e0BY8lCYS2u7dVAoBy6AKRGX8z/ukllrUAyQ8h+/zlW9w==" + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@types/find/-/find-0.2.2.tgz", + "integrity": "sha512-Q67LLJvnvyiAu8XP1D2pPkxWh1hXLVOI3X77z4kw2orV4AIEz4I4UgVofabIIfypGoBZ2WAosTuu3gJVKPzlyw==" }, "@types/fs-extra": { "version": "9.0.13", @@ -10760,9 +10764,9 @@ } }, "@types/lodash": { - "version": "4.14.198", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.198.tgz", - "integrity": "sha512-trNJ/vtMZYMLhfN45uLq4ShQSw0/S7xCTLLVM+WM1rmFpba/VS42jVUgaO3w/NOLiWR/09lnYk0yMaA/atdIsg==", + "version": "4.14.199", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.199.tgz", + "integrity": "sha512-Vrjz5N5Ia4SEzWWgIVwnHNEnb1UE1XMkvY5DGXrAeOGE9imk0hgTHh5GyDjLDJi9OTCn9oo9dXH1uToK1VRfrg==", "dev": true }, "@types/minimatch": { @@ -12325,9 +12329,9 @@ "dev": true }, "electron": { - "version": "26.2.0", - "resolved": "https://registry.npmjs.org/electron/-/electron-26.2.0.tgz", - "integrity": "sha512-H6Z0sYTtLcybHCQT1yti/8BK+vN5/ZfoekKcdrfZMh5mVf2Z7psFVs6nBhXPzIOyRE/gdb6NcOppnUsGc3NJVQ==", + "version": "26.2.2", + "resolved": "https://registry.npmjs.org/electron/-/electron-26.2.2.tgz", + "integrity": "sha512-Ihb3Zt4XYnHF52DYSq17ySkgFqJV4OT0VnfhUYZASAql7Vembz3VsAq7mB3OALBHXltAW34P8BxTIwTqZaMS3g==", "requires": { "@electron/get": "^2.0.0", "@types/node": "^18.11.18", @@ -14113,9 +14117,9 @@ } }, "jsonrepair": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonrepair/-/jsonrepair-3.2.0.tgz", - "integrity": "sha512-6eHBc2z5vipym4S8rzTcCXQBLWpkSzi9bk7I3xTdUxRzXyYvfjoVZzJ97N4C/9vcKI9NgNp3slPwHufDr0rFYw==" + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jsonrepair/-/jsonrepair-3.2.2.tgz", + "integrity": "sha512-IwsEsj59BVjFTO5DJ22Naxk5+AuNjS+1BUqOebpPlcyF8C+n8SAAICFo4Db74ORltzDygAlTAH56Pe1vupsnzA==" }, "junk": { "version": "3.1.0", diff --git a/package.json b/package.json index be415f7..fac3f10 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "marvelsnaptracker", "productName": "Marvel Snap Tracker", - "version": "1.2.22", + "version": "1.2.24", "description": "Marvel Snap Tracker", "main": "./.webpack/main", "scripts": { @@ -24,7 +24,7 @@ "forge": "./forge.config.js" }, "dependencies": { - "@types/find": "0.2.1", + "@types/find": "0.2.2", "auto-launch": "5.0.6", "axios": "1.5.0", "date-fns": "2.30.0", @@ -32,7 +32,7 @@ "error-stack-parser": "2.1.4", "find-process": "1.4.7", "form-data": "4.0.0", - "jsonrepair": "3.2.0", + "jsonrepair": "3.2.2", "lodash": "4.17.21", "moment": "2.29.4", "node-abi": "3.47.0", @@ -51,13 +51,13 @@ "@electron-forge/plugin-webpack": "6.4.2", "@electron-forge/publisher-github": "6.4.2", "@marshallofsound/webpack-asset-relocator-loader": "0.5.0", - "@types/auto-launch": "5.0.2", - "@types/lodash": "4.14.198", + "@types/auto-launch": "5.0.3", + "@types/lodash": "4.14.199", "copy-webpack-plugin": "11.0.0", "csp-html-webpack-plugin": "5.1.0", "css-loader": "6.8.1", "dotenv-webpack": "8.0.1", - "electron": "26.2.0", + "electron": "26.2.2", "file-loader": "6.2.0", "fork-ts-checker-webpack-plugin": "8.0.0", "node-loader": "2.0.0", diff --git a/src/app/game_state.ts b/src/app/game_state.ts index 1d12610..4cfd799 100644 --- a/src/app/game_state.ts +++ b/src/app/game_state.ts @@ -2,8 +2,8 @@ import {exec, execFile} from 'child_process'; import {BrowserWindow} from 'electron'; import electronIsDev from 'electron-is-dev'; import psList from 'ps-list'; -import {getBots} from 'root/api/bots'; +import {getBots} from 'root/api/bots'; import {getCards} from 'root/api/cards'; import {registerHotkeys, unRegisterHotkeys} from 'root/app/hotkeys'; import {WindowLocator} from 'root/app/locatewindow'; diff --git a/src/windows/home/functions/messages.ts b/src/windows/home/functions/messages.ts index 49d6299..6d9f6b3 100644 --- a/src/windows/home/functions/messages.ts +++ b/src/windows/home/functions/messages.ts @@ -173,8 +173,8 @@ export function installHomeMessages(): void { onMessageFromIpcMain('sync-process', (res) => { if (res.mode === 'needauth') { - sendMessageToIpcMain('open-link', `https://marvelsnap.pro//sync/?request=${res.request}`); - HomePageElements.directSyncLink.innerHTML = ``; + sendMessageToIpcMain('open-link', `https://marvelsnap.pro/sync/?request=${res.request}`); + HomePageElements.directSyncLink.innerHTML = ``; tokenWaiter(res.request); currentCreds.numberOfSyncAttempts = 0; } else if (res.mode === 'hasauth') { @@ -183,7 +183,7 @@ export function installHomeMessages(): void { }); onMessageFromIpcMain('token-waiter-responce', (response) => { - console.log('token-waiter-responce', response); + //console.log('token-waiter-responce', response); if (response.res && response.res.token && response.res.token !== '') { login(response.res.token, response.res.uid, response.res.nick); } else { @@ -192,7 +192,7 @@ export function installHomeMessages(): void { currentCreds.numberOfSyncAttempts++; setTimeout(() => { tokenWaiter(response.request); - }, 1000); + }, 5000); } } }); diff --git a/src/windows/home/home.ts b/src/windows/home/home.ts index 13ffc34..ed461c9 100644 --- a/src/windows/home/home.ts +++ b/src/windows/home/home.ts @@ -1,22 +1,21 @@ // tslint:disable: no-any no-unsafe-any no-import-side-effect import 'pretty-checkbox/dist/pretty-checkbox.min.css'; - -import {NetworkStatusMessage} from 'root/lib/messages'; import 'root/windows/css.css'; import 'root/windows/fa-brands-400.woff2'; import 'root/windows/fa-regular-400.woff2'; import 'root/windows/fa-solid-900.woff2'; +import 'root/windows/rP2Hp2ywxg089UriCZ2IHSeH.woff2'; +import 'root/windows/rP2Hp2ywxg089UriCZOIHQ.woff2'; import 'root/windows/fontawesome.css'; +import 'root/windows/home/home.css'; +import 'root/windows/home/icons.css'; +import {NetworkStatusMessage} from 'root/lib/messages'; import {controlClick} from 'root/windows/home/functions/controlclick'; import {installHomeMessages} from 'root/windows/home/functions/messages'; import {setHkClick} from 'root/windows/home/functions/setHkClick'; import {settingsChecker} from 'root/windows/home/functions/settingsChecker'; import {tabclick} from 'root/windows/home/functions/tabclick'; -import 'root/windows/home/home.css'; -import 'root/windows/home/icons.css'; import {onMessageFromIpcMain, sendMessageToIpcMain} from 'root/windows/messages'; -import 'root/windows/rP2Hp2ywxg089UriCZ2IHSeH.woff2'; -import 'root/windows/rP2Hp2ywxg089UriCZOIHQ.woff2'; export const HomePageElements = { header: document.getElementById('header') as HTMLElement, diff --git a/src/windows/overlay/functions/checkbot.ts b/src/windows/overlay/functions/checkbot.ts index c228cc2..3587c29 100644 --- a/src/windows/overlay/functions/checkbot.ts +++ b/src/windows/overlay/functions/checkbot.ts @@ -1,7 +1,7 @@ import {currentMatch, overlayConfig} from 'root/windows/overlay/overlay'; export function CheckBottiness(): string { - let nick = currentMatch.opponentNick; + const nick = currentMatch.opponentNick; let botLikness = 0; let LSTM = false; diff --git a/src/windows/overlay/functions/drawdeck.ts b/src/windows/overlay/functions/drawdeck.ts index 168c0e0..4a5c778 100644 --- a/src/windows/overlay/functions/drawdeck.ts +++ b/src/windows/overlay/functions/drawdeck.ts @@ -1,3 +1,4 @@ +import {HoverEventListener} from 'root/windows/overlay/functions/hovereventlistener'; import {makeCard} from 'root/windows/overlay/functions/makecard'; import {sortDeck} from 'root/windows/overlay/functions/sortdeck'; import {currentMatch, overlayConfig, overlayElements} from 'root/windows/overlay/overlay'; @@ -30,10 +31,9 @@ export function drawDeck(): void { overlayElements.MainOut.innerHTML = output; if (!overlayConfig.ovlSettings?.hidemy) { overlayElements.MainDeckFrame.classList.remove('hidden'); - //toggleButtonClass(overlayElements.ToggleMe, overlayElements.MainDeckFrame.classList.contains('hidden')); } - /*const AllCards = document.getElementsByClassName('DcDrow'); + const AllCards = document.getElementsByClassName('DcDrow'); Array.from(AllCards).forEach((theCard) => { HoverEventListener(theCard); - });*/ + }); } diff --git a/src/windows/overlay/functions/hovereventlistener.ts b/src/windows/overlay/functions/hovereventlistener.ts new file mode 100644 index 0000000..6096736 --- /dev/null +++ b/src/windows/overlay/functions/hovereventlistener.ts @@ -0,0 +1,40 @@ +import {overlayConfig, overlayElements} from 'root/windows/overlay/overlay'; + +export const HoverEventListener = (theCard: Element) => { + //console.log(theCard); + if (!overlayConfig.allCards) { + return; + } + const cardsdb = overlayConfig.allCards; + if (theCard.getAttribute('listener') !== 'true') { + theCard.addEventListener('mouseenter', (event: Event) => { + const cl: HTMLElement = event.target as HTMLElement; + const cid = cl.getAttribute('data-cid') as string; + const side = cl.getAttribute('data-side') as string; + const Card = cardsdb[cid.toLowerCase()]; + //console.log(cid); + + if (Card === undefined) { + return; + } + if (side === 'me') { + overlayElements.CardHint.innerHTML = `${Card.name}. ${Card.description}`; + } else { + overlayElements.CardHintOpp.innerHTML = `${Card.name}. ${Card.description}`; + } + }); + + theCard.addEventListener('mouseleave', (event: Event) => { + const cl: HTMLElement = event.target as HTMLElement; + const side = cl.getAttribute('data-side') as string; + + if (side === 'opp') { + overlayElements.CardHint.innerHTML = `Hover over the card to see it's details`; + } else { + overlayElements.CardHintOpp.innerHTML = `Hover over the card to see it's details`; + } + }); + + theCard.setAttribute('listener', 'true'); + } +}; diff --git a/src/windows/overlay/functions/makecard.ts b/src/windows/overlay/functions/makecard.ts index dde2842..c071452 100644 --- a/src/windows/overlay/functions/makecard.ts +++ b/src/windows/overlay/functions/makecard.ts @@ -38,7 +38,7 @@ export function makeCardBack(cardBackDefId: string, side: boolean): string { const cardHeight = cardWidth * 1.3; return ` -
diff --git a/src/windows/overlay/functions/updateoppdeck.ts b/src/windows/overlay/functions/updateoppdeck.ts index 8f4a815..2320eb1 100644 --- a/src/windows/overlay/functions/updateoppdeck.ts +++ b/src/windows/overlay/functions/updateoppdeck.ts @@ -1,5 +1,6 @@ import {SnapCard} from 'root/models/snap_deck'; import {CheckBottiness} from 'root/windows/overlay/functions/checkbot'; +import {HoverEventListener} from 'root/windows/overlay/functions/hovereventlistener'; import {makeCard, makeCardBack} from 'root/windows/overlay/functions/makecard'; import {sortDeck} from 'root/windows/overlay/functions/sortdeck'; import {currentMatch, overlayConfig, overlayElements} from 'root/windows/overlay/overlay'; @@ -110,8 +111,8 @@ export function updateOppDeck(highlight: string[]): void { }); }, overlayConfig.highlightTimeout); - /* const AllCards = document.getElementsByClassName('DcDrow'); + const AllCards = document.getElementsByClassName('DcDrow'); Array.from(AllCards).forEach((theCard) => { HoverEventListener(theCard); - });*/ + }); } diff --git a/src/windows/overlay/overlay.css b/src/windows/overlay/overlay.css index f8cde48..a13067f 100644 --- a/src/windows/overlay/overlay.css +++ b/src/windows/overlay/overlay.css @@ -167,16 +167,6 @@ a[href^="ftp://"] opacity: 0.8; } -#CardHint { - position: absolute; - transform-origin: top left; -} - -#CardHint > img { - border-radius: 4%; - width: 300px; -} - #Scaler { position: absolute; width: 25px; @@ -384,6 +374,12 @@ a[href^="ftp://"] cursor: pointer; } +.CardHint { + color: #e7e7e7 !important; + padding: 10px; + width: 480px; +} + .DeckSummaryEntity { display: flex; gap: 10px; diff --git a/src/windows/overlay/overlay.html b/src/windows/overlay/overlay.html index 8eea92b..814f36f 100644 --- a/src/windows/overlay/overlay.html +++ b/src/windows/overlay/overlay.html @@ -26,6 +26,7 @@
+
Hover over the card to see it's details
@@ -38,6 +39,7 @@
+
Hover over the card to see it's details