Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"env": {
"browser": true,
"es2021": true
},
"globals": {
"$": "readonly",
"jQuery": "readonly"
},
"extends": ["eslint:recommended"],
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"rules": {
"no-unused-vars": "warn",
"no-undef": "warn",
"semi": "off",
"no-empty": "off",
"no-extra-semi": "off",
"no-unsafe-optional-chaining": "off",
"no-redeclare": "off",
"no-constant-condition": "off"
}
}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
.DS_Store

# Build artifacts
/dist/
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"proseWrap": "preserve",
"singleQuote": true
}
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<img width="2200px" src="https://raw.githubusercontent.com/Juzlus/KeydropPlus/main/data/icons/Keydrop%2B_Icon.svg">

<div align="center">
Expand All @@ -12,7 +11,6 @@

KeydropPlus v2 is an unofficial extension for [keydrop.com](https://key-drop.com/) that adds new features and improves the user interface.


## 💡 List of current functions

- Automatic joining of 'Amateur' giveaways [Does not work on reCATCH].
Expand All @@ -27,7 +25,6 @@ KeydropPlus v2 is an unofficial extension for [keydrop.com](https://key-drop.com
- Display of pre-selected user giveaways.
- Automatic clicking on the receive gold code button at the 'direct link' (?code=).


## 📁 How to add an extension

1. Extract the files to a folder
Expand All @@ -36,7 +33,6 @@ KeydropPlus v2 is an unofficial extension for [keydrop.com](https://key-drop.com
4. Click the "Upload unzipped" button
5. Select the folder with the extracted extension


## 🌐 Works on these browsers

- Google Chrome
Expand All @@ -46,7 +42,6 @@ KeydropPlus v2 is an unofficial extension for [keydrop.com](https://key-drop.com
- Brave Browser
- And others based on Chromium


## 🌍 Available languages

- English
Expand All @@ -56,35 +51,50 @@ KeydropPlus v2 is an unofficial extension for [keydrop.com](https://key-drop.com
## 🛠️ Configuration - Correctly setting prices from Steam

To get everything working without a problem, you need to:

- Set the currency on the key-drop page to PLN, EUR or USD
- Log in to Steam in your browser and set the currency to PLN, EUR or USD

_Refreshing prices too often can temporarily block the Steam Market API._


## ✨ Usage

- [Keydrop API](key-drop.com)
- [Steam API](https://steamcommunity.com/market/)
- [Skinport API](https://docs.skinport.com/#introduction)
- [crypto-js](https://github.com/brix/crypto-js)
- [jQuery](https://jquery.com)
- [Chart.js](https://github.com/chartjs/Chart.js)


## 🔥 Screenshots

![Case Stats](https://github.com/Juzlus/KeydropPlus/assets/41649887/5146506d-d09d-4513-ac96-f69cab0f2b46)
![Custom Price - Skin Changer](https://github.com/Juzlus/KeydropPlus/assets/41649887/64fb73df-e158-4802-9b71-cbd67e683c1d)
![Fast Case Battle](https://github.com/Juzlus/KeydropPlus/assets/41649887/45e23d0b-6921-4efd-9731-c9cb62b7c138)
![User Statistics](https://github.com/Juzlus/KeydropPlus/assets/41649887/72eeef42-09a5-44eb-a13d-75f7d42ec80a)

## 🧑‍💻 Development

This project uses Node.js tooling to keep the codebase consistent.

```bash
npm install # install dependencies
npm run lint # check JavaScript style
npm run format # verify formatting
```

## 🤝 Contributing

Issues and feature requests are tracked on the [GitHub issue tracker](https://github.com/Juzlus/KeydropPlus/issues).

Pull requests are welcome! Please fork the repository, create a topic branch for your work and open a pull request. Remember to run the linter and formatter before submitting.

## 📝 Feedback

If you have any Feedback or questions, please contact me at juzlus.biznes@gmail.com or [Discord](https://discordapp.com/users/284780352042434570).


## 💝 Donate

<span>
<a href="https://www.buymeacoffee.com/juzlus" target="_blank" alt="buymeacoffee" style="width: 40%; text-decoration: none; margin-right: 20px;">
<img src="https://www.codehim.com/wp-content/uploads/2022/09/bmc-button-640x180.png" style="height: 60px;">
Expand All @@ -95,10 +105,8 @@ If you have any Feedback or questions, please contact me at juzlus.biznes@gmail.
</a>
</span>


## ⚠️ Disclaimer

_The KeydropPlus v2 is an independent project developed by an individual and is not endorsed or affiliated with [key-drop.com](https://key-drop.com/)._

_The author of the extension is not responsible for any consequences resulting from its use._

12 changes: 11 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,23 @@ tbody .fullTd {
}

.keydorp-plus-change-language {
display: inline-block;
height: 34px;
cursor: pointer;
filter: opacity(0.5);
transition: 0.25s;
}

.keydorp-plus-change-language:hover {
.keydorp-plus-change-language:hover,
.keydorp-plus-change-language.active {
filter: opacity(1) !important;
}

.keydorp-plus-change-language.active {
border: 1px solid gold;
border-radius: 4px;
}

div.hidden.overflow-hidden.md\:block.bg-navy-700 {
height: 76px;
}
Expand Down
2 changes: 2 additions & 0 deletions data/lang/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"autogiveaway_settings_a2": "You can only join up to 20 giveaways per day",
"autogiveaway_settings_p5": "Minimum Amount",
"autogiveaway_settings_a5": "Minimum amount of the giveaway",
"autogiveaway_settings_p6": "Search pages",
"autogiveaway_settings_a6": "Number of pages to scan for giveaways",
"autogiveaway_settings_p3": "Won Giveaways",
"autogiveaway_settings_a3": "Counted won giveaways",
"autogiveaway_settings_p4": "Earnings from Giveaways",
Expand Down
2 changes: 2 additions & 0 deletions data/lang/polish.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"autogiveaway_settings_a2": "Codziennie można dołączyć tylko do 20 konkursów",
"autogiveaway_settings_p5": "Minimalna kwota",
"autogiveaway_settings_a5": "Minimalna kwota konkursu",
"autogiveaway_settings_p6": "Liczba stron",
"autogiveaway_settings_a6": "Ilość stron do przeszukania konkursów",
"autogiveaway_settings_p3": "Wygrane konkursy",
"autogiveaway_settings_a3": "Zliczone wygrane konkursy",
"autogiveaway_settings_p4": "Zarobek z konkursów",
Expand Down
2 changes: 2 additions & 0 deletions data/lang/portuguese.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"autogiveaway_settings_a2": "Você só pode participar de até 20 sorteios por dia",
"autogiveaway_settings_p5": "Quantidade mínima",
"autogiveaway_settings_a5": "Quantidade mínima do sorteio",
"autogiveaway_settings_p6": "Páginas de busca",
"autogiveaway_settings_a6": "Número de páginas para procurar sorteios",
"autogiveaway_settings_p3": "Sorteios Ganhos",
"autogiveaway_settings_a3": "Número de sorteios ganhos",
"autogiveaway_settings_p4": "Ganhos com sorteios",
Expand Down
2 changes: 1 addition & 1 deletion js/caseInfo.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 29 additions & 49 deletions js/caseOdds.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ $( document ).ready(async() => {
const config = await getConfigData();
const casesFetch = await fetchUrl('GET', `${githubUrl}/cases.json`)
if(!casesFetch || !config) return;
const cases = JSON.parse(`{"cases": ${casesFetch}}`)?.cases;
const cases = Array.isArray(casesFetch) ? casesFetch : casesFetch?.cases;
if(!cases?.length) return;

waitForElm('section#gold-area').then(async() => {
Expand All @@ -20,6 +20,22 @@ $( document ).ready(async() => {
addObserverIfDesiredNodeAvailable();
});

const goldProfitThresholds = [
{ max: 11111111, label: '0/5' },
{ max: 13209876, label: '0.5/5' },
{ max: 15308641, label: '1/5' },
{ max: 17407407, label: '1.5/5' },
{ max: 19506172, label: '2/5' },
{ max: 21604937, label: '2.5/5' },
{ max: 23703703, label: '3/5' },
{ max: 25802468, label: '3.5/5' },
{ max: 27901233, label: '4/5' },
{ max: 29999999, label: '4.5/5' },
{ max: Infinity, label: '5/5' },
];

const calculateGoldOdds = (profit) => goldProfitThresholds.find(t => profit <= t.max).label;

const refreshOdds = async(config, cases, init) => {
const index = await getIndexData();
const currencyRates = index?.currencyRates;
Expand Down Expand Up @@ -62,49 +78,23 @@ const createCaseOdds = async(config, currentRate, currency, cases, thisElement,
const caseName = $(thisElement)?.find('div[data-testid=case-card-badge-btn] p')?.last()?.text();
if(!caseName) return;

let odds;
const jokerCase = config?.showJokerOdds ? cases?.filter(el => el?.name == `${caseName} JOKER`) : null;
const thisCase = config?.showJokerOdds && jokerCase && jokerCase?.length ? jokerCase : cases?.filter(el => el?.name == caseName);
if(!thisCase || !thisCase?.length) return;
if (thisCase[0]?.goldProfit !== undefined) {
const profit = thisCase[0]?.goldProfit;
if(profit <= 11111111)
odds = `0/5`;
else if(profit <= 13209876)
odds = `0.5/5`;
else if(profit <= 15308641)
odds = `1/5`;
else if(profit <= 17407407)
odds = `1.5/5`;
else if(profit <= 19506172)
odds = `2/5`;
else if(profit <= 21604937)
odds = `2.5/5`;
else if(profit <= 23703703)
odds = `3/5`;
else if(profit <= 25802468)
odds = `3.5/5`;
else if(profit <= 27901233)
odds = `4/5`;
else if(profit <= 29999999)
odds = `4.5/5`;
else
odds = `5/5`;
} else
odds = `${thisCase[0]?.odds}%`;

const isJoker = thisCase[0]?.name?.endsWith(' JOKER') || false;
const cardEl = $(thisElement)?.find(eventCase ? 'div[data-testid="case-card-price-btn"]' : 'div.absolute.right-3.rounded.bg-navy-900.px-3.text-xs.font-semibold.text-gold-500')
?.eq(0);

const thisCaseArr = config?.showJokerOdds && jokerCase && jokerCase?.length ? jokerCase : cases?.filter(el => el?.name == caseName);
const caseData = thisCaseArr?.[0];
if(!caseData) return;

const odds = caseData?.goldProfit !== undefined ? calculateGoldOdds(caseData.goldProfit) : `${caseData?.odds}%`;
const isJoker = caseData?.name?.endsWith(' JOKER') || false;
const cardEl = $(thisElement)?.find(eventCase ? 'div[data-testid="case-card-price-btn"]' : 'div.absolute.right-3.rounded.bg-navy-900.px-3.text-xs.font-semibold.text-gold-500')?.eq(0);

if (init)
$(cardEl).after($(document?.createElement('div'))
?.addClass(eventCase ? 'cardOdds absolute right-3 top-3 rounded bg-navy-900 px-3 py-1.5 text-xs font-semibold text-white' : 'cardOdds absolute right-3 rounded bg-navy-900 px-3 py-1.5 text-xs font-semibold text-gold-500')
?.css({ 'margin-top': eventCase ? '35px' : '45px', 'background': isJoker ? 'rgb(129 72 234)' : 'rgb(23 23 28)' })
?.text($(thisElement)?.attr('case-orginal') ? odds : (thisCase[0]?.lang || odds))
?.text($(thisElement)?.attr('case-orginal') ? odds : (caseData?.lang || odds))
);

$(thisElement)?.find('.cardOdds')?.text($(thisElement)?.attr('case-orginal') ? odds : (thisCase[0]?.lang || odds))
$(thisElement)?.find('.cardOdds')?.text($(thisElement)?.attr('case-orginal') ? odds : (caseData?.lang || odds))
$(thisElement)?.find('.cardOdds')?.css({ 'background': isJoker ? 'rgb(129 72 234)' : 'rgb(23 23 28)' })

$(thisElement)?.find('div[data-testid=case-card-badge-btn] p')
Expand All @@ -121,12 +111,7 @@ const createCaseOdds = async(config, currentRate, currency, cases, thisElement,
$(thisElement)?.find('div.css-hmmmg1')
?.css({ 'background': isJoker ? 'rgb(129 72 234)' : 'rgb(23 23 28)' })

const formattedPrice = new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(thisCase[0]?.price_USD * currentRate);

const priceText = `${formattedPrice} ${currency}`;
const priceText = formatCurrency(caseData?.price_USD * currentRate, currency);
if (isJoker || !init)
$(thisElement)?.find('[data-testid="case-card-price-btn"]')
?.text(priceText);
Expand All @@ -138,12 +123,7 @@ const createYTcases = async(currentRate, currency, cases) => {
if(!YTcases || !YTcases?.length) return;

YTcases?.forEach(el => {
const formattedPrice = new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(el?.price_USD * currentRate);

const priceText = `${formattedPrice} ${currency}`;
const priceText = formatCurrency(el?.price_USD * currentRate, currency);
$('section#youtubers-cases div.grid.gap-6')?.eq(0)?.append($(document.createElement('div'))
?.addClass("keydrop-plus-ytcases group relative transition-all duration-200 will-change-transform hover:-translate-y-0.5 aspect-[270/375] col-span-2")
?.html(`<div data-testid="case-card-container" class="grid h-full w-full transform grid-cols-1 grid-rows-1 rounded-[6px] hover:shadow-case-hover shadow-case"><a href="${el?.url}" class="z-20 col-start-1 row-start-1 row-end-3 h-full w-full"><div class="group"><img alt="" class="absolute right-0 top-0 w-full h-full object-cover rounded-[6px]" loading="lazy" src="${el?.img}"></div><div class="z-10 flex w-full flex-col" style="height: 100%;"><div data-testid="case-card-price-btn" class="absolute right-3 top-3 rounded bg-navy-800 px-3 py-1.5 text-sm font-semibold text-gold-500">${priceText}</div><div class="absolute right-3 top-3 rounded bg-navy-900 px-3 py-1.5 text-xs font-semibold text-white" style="margin-top: 35px;">${el?.odds}%</div><div data-testid="case-card-badge-btn" class="z-10 mx-auto mb-4 mt-auto flex min-w-[8rem] max-w-full items-center rounded bg-navy-800 text-sm font-semibold uppercase text-white justify-between p-0 pl-3 text-left css-lh0t43"><div><p class="rounded-lg min-w-[8rem] max-w-full p-2 text-center text-sm font-normal uppercase leading-none text-white" style="margin-top: -4px;">${el?.name}</p></div><div><button class="button button-primary flex h-[36px] w-[36px] items-center justify-center rounded-md p-0 text-white transition-all duration-300 hover:text-gold group border-none bg-transparent hover:bg-transparent" data-testid="favorite-button"><img src="https://key-drop.com/web/KD/static/images/favorite-off.svg?v=159" alt="favorite icon not checked" class="object-contain transition-all group-hover:brightness-75 h-4 w-4"></button></div></div></div></a></div>`)
Expand Down
2 changes: 1 addition & 1 deletion js/dailyCaseTimer.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const createSkinsValueDiv = async() => {

const fetch = await fetchUrl("GET", "https://key-drop.com/en/panel/profil/eq_value");
if(!fetch) return;
const data = JSON.parse(fetch);
const data = fetch;
const skinsValue = `${(data?.fullPrice).toFixed(2).toString().replace('.',',')} ${data?.currency}`;

$('div[data-testid="balance"]')
Expand Down
Loading