Skip to content

Commit

Permalink
Version 1.4
Browse files Browse the repository at this point in the history
Fix extension to work for new keydrop layout,
Note: extension sometimes joins to 100,1000 ticket battles for now i leave it, maybe in future update to join only for 1 ticket battles
  • Loading branch information
Shkyyl committed Sep 9, 2023
1 parent 0cae3e0 commit 6a98fd8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
1 change: 0 additions & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@
"open_in_tab": true,
"page": "options.html"
}


}
5 changes: 3 additions & 2 deletions extension/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
<div class="text">
Use code tutek
</div>

<div class="btn" id="join-button">
<span>Join Battle</span>
<span id="txtbtl" data-after="Join Battle" isActive="false"></span>
</div>
</div>
<div class="bar">
Expand All @@ -41,7 +42,7 @@
</div>
</div>
<div class="madeby">
<span>Version 1.3 - By Shkyyl / UI-UX by Walison Martins</span>
<span>Version 1.3 - By Shkyyl / UI-UX by walyin#2365 on DC</span>
</div>
</div>
</body>
Expand Down
30 changes: 15 additions & 15 deletions extension/popup.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
function joinCaseBattle(){

chrome.storage.local.get(["TARGETS"], function(result){
function joinCaseBattle() {
chrome.storage.local.get(["TARGETS"], function(result) {
const targets = result.TARGETS || ['TOXIC', 'DIABLO', 'SPARK', 'ICE BLAST', 'TEETH', 'BEAST', 'SERENITY', 'JOY', 'PROGRESS', 'KITTY', 'ONYX'];
(async () => {
while (true) {
await new Promise(r => setTimeout(r, 100));
try {
const caseNames = (([...document.querySelectorAll('p.max-w-full.px-1.overflow-hidden')]).splice(0, 10)).map(e => e.textContent);
const casePrices = (([...document.querySelectorAll('div.flex.items-center.justify-center.rounded-tl-lg')]).splice(0, 10)).map(e => e.textContent);
if (casePrices[caseNames.indexOf(caseNames.find(name => targets.includes(name)))] === 'FREE' && caseNames.some(str => targets.includes(str))) {
const caseNames = [...document.querySelectorAll('p.max-w-full.px-1.overflow-hidden')].splice(0, 5).map(e => e.textContent);
const casePrices = [...document.querySelectorAll('div.w-fit p.text-center.font-semibold.leading-none')].splice(0, 5).map(e => e.textContent);
const targetIndex = caseNames.findIndex(name => targets.includes(name));
if (casePrices[targetIndex] === 'x1' && targetIndex !== -1) {
const btns = [...document.querySelectorAll('a.button.mr-5')];
const btn = btns[caseNames.indexOf(caseNames.find(name => targets.includes(name)))];
const btn = btns[targetIndex];
btn.click();
}
}
} catch {null;}
}
})();
})
});
}

document.addEventListener("DOMContentLoaded", function(){
document.getElementById("join-button").addEventListener('click', function(){
document.addEventListener("DOMContentLoaded", function() {
document.getElementById("join-button").addEventListener('click', function() {
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
if (tabs.length > 0) {
var tabId = tabs[0].id;
Expand All @@ -32,8 +32,8 @@ document.addEventListener("DOMContentLoaded", function(){
console.error("No active tab found.");
}
});
})
document.getElementById("options-button").addEventListener('click', function(){
});
document.getElementById("options-button").addEventListener('click', function() {
chrome.runtime.openOptionsPage();
})
})
});
});
3 changes: 3 additions & 0 deletions extension/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ body{
background-color: #ffcc00;
box-shadow: 5px 5px 12px #ffcc004d;
}
.btn span::after{
content: attr(data-after);
}
.bar{
display: flex;
flex-direction: row;
Expand Down

0 comments on commit 6a98fd8

Please sign in to comment.