Untitled
unknown
plain_text
10 months ago
6.6 kB
6
Indexable
<script type="text/javascript">
// CSS stillerini oluşturma ve ekleme
(function() {
const css = `
.product-banner-container-bc {
position: relative;
}
.product-banner-container-bc.col-1.product-banner-without-titles .product-banner-info-bc {
display:block!important;
}
.c_slot-game{
border: solid 1px rgba(255, 255, 255, 0.1);
background-color: #1d202e;
border-radius: 16px;
width: 100%;
align-items: center;
justify-content: space-between;
height: 32px;
padding-left: 12px;
padding-right: 12px;
bottom: -3px;
float: left;
line-height: 29px;
display: block;
z-index: 1000;
position: relative;
}
.c_slot-game-label{
color: rgba(255, 255, 255, 0.6);
font-size: 9px;
margin: 0;
float: left;
}
.c_slot-game-count{
color: rgba(255, 255, 255, 0.6);
font-size: 9px;
display: flex;
align-items: center;
gap: 5px;
float: right;
}
.count-indicator {
width: 6px;
height: 6px;
background: #00ff00;
border-radius: 50%;
box-shadow: 0 0 5px #00ff00, 0 0 10px #00ff00, 0 0 15px #00ff00;
opacity: 0;
transition: opacity 0.3s ease;
position: absolute;
right: 39px;
}
.count-indicator.blink {
animation: blinkIndicator 0.5s ease-in-out;
}
@keyframes blinkIndicator {
0% { opacity: 0; }
50% { opacity: 1; }
100% { opacity: 0; }
}
`;
const style = document.createElement('style');
style.textContent = css;
document.head.appendChild(style);
})();
// JavaScript fonksiyonları
(function() {
let currentOnlineUsers = 0;
function distributeUsersToBanners(totalUsers) {
const percentages = [0.25, 0.2, 0.15, 0.12, 0.10, 0.05, 0.03];
const bannerContainers = document.querySelectorAll(".product-banner-container-bc.col-1.product-banner-without-titles");
const totalDistributedUsers = Math.floor(totalUsers * 0.7);
let remainingUsers = totalDistributedUsers;
bannerContainers.forEach((container) => {
const bannerElements = container.querySelectorAll(".product-banner-info-bc.product-banner-bc");
bannerElements.forEach((bannerElement, index) => {
if (index >= percentages.length) return;
let count = Math.floor(totalDistributedUsers * percentages[index]);
if (index === percentages.length - 1 || index === bannerElements.length - 1) {
count = remainingUsers;
}
if (bannerElement) {
let slotGame = bannerElement.querySelector(".c_slot-game");
if (!slotGame) {
slotGame = document.createElement("div");
slotGame.className = "c_slot-game";
slotGame.innerHTML = `
<p class="c_slot-game-label">Oynuyor</p>
<span class="c_slot-game-count">
<div class="count-indicator"></div>
<span class="count-value">0</span>
</span>
`;
bannerElement.appendChild(slotGame);
}
const countElement = slotGame.querySelector(".c_slot-game-count");
const indicator = slotGame.querySelector(".count-indicator");
const oldValue = parseInt(countElement.textContent.replace(/\./g, '')) || 0;
const newValue = count;
if (oldValue !== newValue) {
const countValue = slotGame.querySelector(".count-value");
countValue.textContent = count.toLocaleString('tr-TR');
indicator.classList.remove("blink");
void indicator.offsetWidth;
indicator.classList.add("blink");
}
}
remainingUsers -= count;
});
});
}
function calculateTargetOnlineUsers() {
const now = new Date();
const day = now.getDay();
const hour = now.getHours();
let minUsers = 2500;
let maxUsers = 3500;
if (day === 0) {
minUsers = 3500;
maxUsers = 4500;
} else if (day === 5 || day === 6) {
minUsers = 6500;
maxUsers = 7500;
}
if (hour >= 6 && hour < 9) {
minUsers = Math.floor(minUsers * 0.5);
maxUsers = Math.floor(maxUsers * 0.7);
} else if (hour >= 12 && hour < 14) {
minUsers = Math.floor(minUsers * 0.8);
maxUsers = Math.floor(maxUsers * 0.9);
} else if (hour >= 18 && hour < 23) {
minUsers = Math.floor(minUsers * 1.2);
maxUsers = Math.floor(maxUsers * 1.5);
} else {
minUsers = Math.floor(minUsers * 0.3);
maxUsers = Math.floor(maxUsers * 0.5);
}
return { minUsers, maxUsers };
}
function getRandomNumber(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function updateOnlineCount() {
const { minUsers, maxUsers } = calculateTargetOnlineUsers();
const targetUsers = getRandomNumber(minUsers, maxUsers);
const difference = targetUsers - currentOnlineUsers;
const changeAmount = getRandomNumber(1, 120);
const adjustment = Math.sign(difference) * changeAmount;
currentOnlineUsers += adjustment;
if (currentOnlineUsers > maxUsers) currentOnlineUsers = maxUsers;
if (currentOnlineUsers < minUsers) currentOnlineUsers = minUsers;
distributeUsersToBanners(currentOnlineUsers);
if (currentOnlineUsers !== targetUsers) {
setTimeout(updateOnlineCount, 1500);
} else {
setTimeout(updateOnlineCount, 15000);
}
}
const { minUsers, maxUsers } = calculateTargetOnlineUsers();
currentOnlineUsers = getRandomNumber(minUsers, maxUsers);
distributeUsersToBanners(currentOnlineUsers);
updateOnlineCount();
})();
</script>Editor is loading...
Leave a Comment