Poprawki wizualne interfejsu - Skróty 20% poniżej Timerów + Koszty atrybutów PVP + Licznik wartości destylatu
Verze ze dne
// ==UserScript==
// @name MenelGame - Interface Tweaks
// @namespace https://greasyfork.org/en/scripts/575758-menelgame-interface-tweaks
// @version 2.6.3
// @description Poprawki wizualne interfejsu - Skróty 20% poniżej Timerów + Koszty atrybutów PVP + Licznik wartości destylatu
// @author Arctos + Gemini + DeepSeek
// @match *://*.menelgame.online/*
// @grant none
// @run-at document-start
// @license MIT
// ==/UserScript==
(function() {
'use strict';
const css = `
.equipment-tabs { margin-bottom: 0px !important; }
.equipment-presets-section { margin-top: 0px !important; }
.equipment-slot-row.row-hustling {
display: block !important;
text-align: center !important;
width: 100% !important;
overflow: visible !important;
clear: both !important;
margin-top: -65px !important;
position: relative !important;
z-index: 10 !important;
line-height: 0 !important;
pointer-events: none !important;
}
.equipment-slot-row.row-hustling .equipment-slot {
display: inline-block !important;
float: none !important;
position: relative !important;
margin: 0 1% !important;
vertical-align: top !important;
pointer-events: auto !important;
}
.equipment-slot-row.row-hustling .equipment-slot:nth-child(1),
.equipment-slot-row.row-hustling .equipment-slot:nth-child(2) {
left: -14% !important;
}
.equipment-slot-row.row-hustling .equipment-slot:nth-child(3),
.equipment-slot-row.row-hustling .equipment-slot:nth-child(4) {
left: 14% !important;
}
.equipment-slot { z-index: 5 !important; pointer-events: auto !important; }
[title*="buty"], [title*="Buty"], .equipment-slot { pointer-events: auto !important; }
.avatar-jacket-badge { width: 48px !important; height: 48px !important; }
.avatar-jacket-icon { width: 100% !important; height: 100% !important; }
div[style*="background-color: rgba(74, 58, 42, 0.9)"] {
justify-content: flex-start !important;
gap: 10px !important;
}
div[style*="background-color: rgba(74, 58, 42, 0.9)"] > div:nth-child(2) {
margin-left: auto !important;
}
.timers-pull-tab {
width: 35px !important;
transition: none !important;
box-shadow: -3px 0 10px rgba(0,0,0,0.5) !important;
}
.shortcuts-pull-tab {
width: 35px !important;
transition: none !important;
box-shadow: -3px 0 10px rgba(0,0,0,0.5) !important;
top: 50% !important;
bottom: auto !important;
transform: translateY(-50%) !important;
border-radius: 8px 0 0 8px !important;
}
.timers-pull-tab:hover, .shortcuts-pull-tab:hover {
width: 35px !important;
background: linear-gradient(135deg, #a67c52, #8b5a2b) !important;
}
.timers-pull-tab-arrow, .shortcuts-pull-tab-icon {
font-size: 18px !important;
font-weight: bold !important;
}
.pvp-attribute-cost-info {
color: #000000 !important;
font-weight: bold;
font-size: 12px;
padding: 2px 5px;
border-radius: 4px;
display: inline-block;
margin-left: auto !important;
margin-right: 10% !important;
}
.pvp-attribute-row[data-attr-type="str"] .pvp-attribute-cost-info { background: rgba(192, 57, 43, 0.4); }
.pvp-attribute-row[data-attr-type="end"] .pvp-attribute-cost-info { background: rgba(127, 140, 141, 0.4); }
.pvp-attribute-row[data-attr-type="agi"] .pvp-attribute-cost-info { background: rgba(39, 174, 96, 0.4); }
.pvp-attribute-row[data-attr-type="vit"] .pvp-attribute-cost-info { background: rgba(231, 76, 60, 0.4); }
.pvp-attribute-row[data-attr-type="prc"] .pvp-attribute-cost-info { background: rgba(243, 156, 18, 0.4); }
/* Styl dla licznika wartości destylatu */
.destylat-value-box {
background-color: rgb(160, 160, 160);
padding: 8px 16px;
border-radius: 6px;
font-size: 13px;
font-weight: bold;
color: white;
text-align: center;
min-width: 80px;
opacity: 0.8;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
margin-bottom: 4px;
}
.destylat-value-box img {
width: 14px;
height: 14px;
vertical-align: middle;
}
`;
const addStyle = () => {
if (document.getElementById('menel-tweaks-style')) return;
const style = document.createElement('style');
style.id = 'menel-tweaks-style';
style.textContent = css;
(document.head || document.documentElement).appendChild(style);
};
const costTable = { 0: 15, 5: 40, 10: 65, 15: 90, 20: 115, 25: 140, 30: 165, 35: 190, 40: 215, 45: 240 };
function getCostForLevel(level) {
const thresholds = Object.keys(costTable).map(Number).sort((a,b) => a-b);
for (let i = thresholds.length - 1; i >= 0; i--) {
if (level >= thresholds[i]) return costTable[thresholds[i]];
}
return costTable[0];
}
function getAttributeType(row) {
const img = row.querySelector('img[alt]');
if (!img) return 'unknown';
const alt = img.getAttribute('alt');
if (alt === 'STR') return 'str';
if (alt === 'END') return 'end';
if (alt === 'AGI') return 'agi';
if (alt === 'VIT') return 'vit';
if (alt === 'PRC') return 'prc';
return 'unknown';
}
function addCostInfoToAttributeRow(row) {
const valueSpan = row.querySelector('div[style*="flex: 1"] div:first-child span:last-child');
if (!valueSpan) return;
const value = parseInt(valueSpan.textContent);
if (isNaN(value)) return;
const nextCost = getCostForLevel(value);
if (row.querySelector('.pvp-attribute-cost-info')) return;
const originalArrow = row.querySelector('div[style*="color: rgb(160, 144, 128)"]');
if (originalArrow && originalArrow.textContent.includes('›')) {
originalArrow.remove();
}
const attrType = getAttributeType(row);
row.setAttribute('data-attr-type', attrType);
const costContainer = document.createElement('span');
costContainer.className = 'pvp-attribute-cost-info';
costContainer.title = `Koszt podbicia z ${value} na ${value+1}`;
const costValue = document.createTextNode(`${nextCost} `);
costContainer.appendChild(costValue);
const currencyIcon = document.createElement('img');
currencyIcon.src = 'https://menelgame.online/images/icons/premium.png';
currencyIcon.style.width = '12px';
currencyIcon.style.height = '12px';
currencyIcon.style.verticalAlign = 'middle';
currencyIcon.style.marginRight = '2px';
costContainer.appendChild(currencyIcon);
const arrowSpan = document.createTextNode(' ←');
costContainer.appendChild(arrowSpan);
valueSpan.insertAdjacentElement('beforebegin', costContainer);
}
function processPVPPage() {
if (!window.location.href.includes('/pvp') && !document.querySelector('.pvp-attribute-row')) {
return;
}
document.querySelectorAll('.pvp-attribute-row').forEach(row => addCostInfoToAttributeRow(row));
}
function processDestylarnia() {
// Szukaj nagłówka sidebaru tak jak w innych funkcjach
const sidebarTitle = document.querySelector('.sidebar-title');
if (!sidebarTitle) return;
// Sprawdź czy to Melina-Wytwarzanie
if (sidebarTitle.innerText !== 'Melina-Wytwarzanie') return;
// Teraz szukaj kontenera z destylatem w sidebar-content
const sidebarContent = document.querySelector('.sidebar-content');
if (!sidebarContent) return;
// Znajdź div z destylatem - używamy prostszego selektora
const destylatDiv = sidebarContent.querySelector('div[style*="justify-content: space-between"]');
if (!destylatDiv) return;
// Sprawdź czy jest obrazek destylat
const destylatImg = destylatDiv.querySelector('img[alt="destylat"]');
if (!destylatImg) return;
// Pobierz ilość
const iloscSpan = destylatDiv.querySelector('strong');
if (!iloscSpan) return;
const iloscTekst = iloscSpan.innerText;
const ilosc = parseFloat(iloscTekst.replace(' l', '').replace(',', '.'));
if (isNaN(ilosc)) return;
// Oblicz wartość
const wartosc = (ilosc * 1.1).toFixed(2);
// Sprawdź czy już dodaliśmy
if (destylatDiv.querySelector('.destylat-value-box')) return;
// Znajdź kontener z przyciskiem
const przyciskKontener = destylatDiv.querySelector('div[style*="flex-direction: column"]');
if (!przyciskKontener) return;
// Dodaj licznik
const valueBox = document.createElement('div');
valueBox.className = 'destylat-value-box';
valueBox.style.cssText = `
background-color: rgb(160, 160, 160);
padding: 8px 16px;
border-radius: 6px;
font-size: 13px;
font-weight: bold;
color: white;
text-align: center;
min-width: 80px;
opacity: 0.8;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
margin-bottom: 4px;
`;
valueBox.innerHTML = `
<span>${wartosc}</span>
<img src="https://menelgame.online/images/icons/premium.png" style="width: 14px; height: 14px;" alt="premium">
`;
przyciskKontener.insertBefore(valueBox, przyciskKontener.firstChild);
}
addStyle();
const observer = new MutationObserver(() => {
if (!document.getElementById('menel-tweaks-style')) addStyle();
if (window.location.href.includes('/pvp') || document.querySelector('.pvp-attribute-row')) {
processPVPPage();
}
// Dodaj ten warunek
const sidebarTitle = document.querySelector('.sidebar-title');
if (sidebarTitle && sidebarTitle.innerText === 'Melina-Wytwarzanie') {
setTimeout(processDestylarnia, 200);
}
});
observer.observe(document.documentElement, { childList: true, subtree: true });
window.addEventListener('DOMContentLoaded', () => {
addStyle();
processPVPPage();
setTimeout(processDestylarnia, 1000);
});
if (document.readyState !== 'loading') {
processPVPPage();
setTimeout(processDestylarnia, 1000);
}
// NASŁUCHIWANIE NA KLIKNIĘCIE W MENU MELINA
function initDestylarniaWatcher() {
// Szukaj przycisku Melina w menu
const checkForMelina = () => {
const sidebarTitle = document.querySelector('.sidebar-title');
if (sidebarTitle && sidebarTitle.innerText === 'Melina-Wytwarzanie') {
console.log("WYKRYTO MELINĘ! Dodaję licznik...");
setTimeout(addDestylatCounter, 500);
}
};
// Sprawdzaj co sekundę (na wypadek gdyby observer nie działał)
setInterval(checkForMelina, 1000);
// Obserwuj zmiany
const observer = new MutationObserver(checkForMelina);
observer.observe(document.body, { childList: true, subtree: true });
}
function addDestylatCounter() {
console.log("addDestylatCounter - START");
// Znajdź kontener z destylatem
const kontenery = document.querySelectorAll('.sidebar-content div[style*="justify-content: space-between"]');
console.log("Znaleziono kontenery:", kontenery.length);
for (let kontener of kontenery) {
const destylatImg = kontener.querySelector('img[alt="destylat"]');
if (destylatImg) {
console.log("Znaleziono destylat!");
const iloscSpan = kontener.querySelector('strong');
if (iloscSpan) {
const ilosc = parseFloat(iloscSpan.innerText.replace(' l', ''));
const wartosc = (ilosc * 1.1).toFixed(2);
console.log("Ilość:", ilosc, "Wartość:", wartosc);
// Sprawdź czy już jest licznik
if (kontener.querySelector('.destylat-value-box')) return;
const przyciskKontener = kontener.querySelector('div[style*="flex-direction: column"]');
if (przyciskKontener) {
const valueBox = document.createElement('div');
valueBox.className = 'destylat-value-box';
valueBox.style.cssText = `
background-color: rgb(160, 160, 160);
padding: 6px 12px;
border-radius: 6px;
font-size: 12px;
font-weight: bold;
color: white;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
margin-bottom: 4px;
`;
valueBox.innerHTML = `${wartosc}<img src="/images/icons/premium.png" style="width: 12px; height: 12px;">`;
przyciskKontener.insertBefore(valueBox, przyciskKontener.firstChild);
console.log("LICZNIK DODANY!");
}
}
break;
}
}
}
console.log("=== SKRYPT INTERFACE TWEAKS URUCHOMIONY ===");
// Nasłuchuj na kliknięcia w całym dokumencie
document.addEventListener('click', function() {
setTimeout(function() {
const naglowek = document.querySelector('.sidebar-title');
if (naglowek) {
console.log("Po kliknięciu - nagłówek:", naglowek.innerText);
if (naglowek.innerText === 'Melina-Wytwarzanie') {
console.log("!!! WYKRYTO MELINĘ !!!");
// Dodaj licznik
const kontener = document.querySelector('.sidebar-content div[style*="justify-content: space-between"]');
if (kontener && !kontener.querySelector('.mój-licznik')) {
const strong = kontener.querySelector('strong');
if (strong) {
const ilosc = parseFloat(strong.innerText);
const wartosc = (ilosc * 1.1).toFixed(2);
const nowyDiv = document.createElement('div');
nowyDiv.className = 'mój-licznik';
nowyDiv.style.backgroundColor = '#a0a0a0';
nowyDiv.style.padding = '8px 16px';
nowyDiv.style.borderRadius = '6px';
nowyDiv.style.fontSize = '13px';
nowyDiv.style.fontWeight = 'bold';
nowyDiv.style.color = 'white';
nowyDiv.style.textAlign = 'center';
nowyDiv.style.marginBottom = '4px';
nowyDiv.innerHTML = wartosc + ' <img src="/images/icons/premium.png" style="width:12px;height:12px;">';
const przyciskDiv = kontener.querySelector('div[style*="flex-direction: column"]');
if (przyciskDiv) {
przyciskDiv.insertBefore(nowyDiv, przyciskDiv.firstChild);
console.log("LICZNIK DODANY!");
}
}
}
}
}
}, 500);
});
console.log("=== SKRYPT INTERFACE TWEAKS URUCHOMIONY ===");
// Nasłuchuj na kliknięcia
document.addEventListener('click', function() {
setTimeout(function() {
// Sprawdź sub-sidebar (tam jest Melina)
const subSidebarTitle = document.querySelector('.sub-sidebar .sidebar-title');
if (subSidebarTitle) {
console.log("SUB-SIDEBAR nagłówek:", subSidebarTitle.innerText);
if (subSidebarTitle.innerText === 'Melina-Wytwarzanie') {
console.log("!!! WYKRYTO MELINĘ W SUB-SIDEBARZE !!!");
// Szukaj kontenera z destylatem w sub-sidebar
const kontener = document.querySelector('.sub-sidebar .sidebar-content div[style*="justify-content: space-between"]');
if (kontener && !kontener.querySelector('.mój-licznik')) {
const strong = kontener.querySelector('strong');
if (strong) {
const ilosc = parseFloat(strong.innerText);
const wartosc = (ilosc * 1.1).toFixed(2);
const nowyDiv = document.createElement('div');
nowyDiv.className = 'mój-licznik';
nowyDiv.style.backgroundColor = '#a0a0a0';
nowyDiv.style.padding = '8px 16px';
nowyDiv.style.borderRadius = '6px';
nowyDiv.style.fontSize = '13px';
nowyDiv.style.fontWeight = 'bold';
nowyDiv.style.color = 'white';
nowyDiv.style.textAlign = 'center';
nowyDiv.style.marginBottom = '4px';
nowyDiv.innerHTML = wartosc + ' <img src="/images/icons/premium.png" style="width:12px;height:12px;">';
const przyciskDiv = kontener.querySelector('div[style*="flex-direction: column"]');
if (przyciskDiv) {
przyciskDiv.insertBefore(nowyDiv, przyciskDiv.firstChild);
console.log("LICZNIK DODANY!");
}
}
}
}
} else {
console.log("Brak .sub-sidebar .sidebar-title");
}
}, 500);
});
})();