您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
当前为
// ==UserScript== // @name HWM-UI-UX-MOD // @namespace https://greasyfork.org/ru/scripts/421913-hwm-ui-ux-mod // @version 0.1 // @description try to take over the world! // @author achepta // @include /^https{0,1}:\/\/((www|qrator)(\.heroeswm\.ru|\.lordswm\.com)|178\.248\.235\.15)\/.+/ // @grant unsafeWindow // @grant GM_xmlhttpRequest // @grant GM_log // @run-at document-start // ==/UserScript== (function (window, undefined) { let w; if (typeof unsafeWindow !== undefined) { w = unsafeWindow; } else { w = window; } if (w.self !== w.top) { return; } if (/cgame/.test(location.href)) { return } let allTexts = getAllTexts() let defaultSettings = getDefaultSettings() let language = /lordswm/.test(location.href) ? "eng" : "rus" let settings = {} let headerInfo = {} let timersInfo = {} loadSettings(); loadTimersInfo(); if (settings['isDarkTheme'] && !/war\.php/.test(location.href)) { applyDarkTheme() } document.addEventListener("DOMContentLoaded", () => { if (!/war\.php/.test(location.href)) { processPage() addStyle(); getHeaderInfo() drawNewHeader() processSettings(); addMenu(); } else { processBattle() } }); function addStyle() { document.body.insertAdjacentHTML("beforeend", getStyles()) } function addMenu() { $('hwm_header_settings_button').addEventListener('click', handleOnSettingsButtonClick); } // logic function processSettings() { if (settings.isTimeWithSeconds) { showTimeWithSeconds() } if (settings.isShowTimers) { showTimers() } } function getHeaderInfo() { headerInfo['logo'] = getHeaderLogo() headerInfo['notifications'] = getHeaderNotifications() headerInfo['homeColor'] = getHomeButtonColor() headerInfo['battleColor'] = getBattleButtonColor() headerInfo['resources'] = getHeaderResources() headerInfo['online'] = getHwmOnline() } function getHeaderLogo() { return document.querySelector("div.sh_logo > img").src } function getHeaderNotifications() { return Array.from(document.getElementsByClassName("NotificationIcon")) } function getHomeButtonColor() { return document.querySelector("#MenuHome").offsetParent.classList.value.split("_").slice(-1)[0] } function getBattleButtonColor() { return document.querySelector("#MenuBattles").offsetParent.classList.value.split("_").slice(-1)[0] } function getHeaderResources() { let resources = {} let resourceDivs = document.querySelectorAll("div.sh_ResourcesItem") Array.from(resourceDivs).forEach(item => { let resName = getResNameFromImage(item.firstChild.src) resources[resName] = item.lastChild.textContent }) return resources } function getResNameFromImage(src) { return src.match(/(\w+)\.png/)[1] } function getHwmOnline() { return document.querySelector("div.sh_extra.sh_extra_right > div.mm_extra_separator").nextElementSibling.textContent } function drawNewHeader() { removeElement($('hwm_header')) document.body.insertAdjacentHTML('afterbegin', getNewHeaderTemplate()) unsafeWindow.top_line_draw_canvas_heart(100, 100, 900) unsafeWindow.top_line_add_events_listeners() } function showTimeWithSeconds() { let hwmDate = hwmDateToHuman(getHwmDate()); let timePlace = $('hwm_time'); timePlace.innerHTML = hwmDate setTimeout(showTimeWithSeconds, 1000) } function showTimers() { $('timers_container').innerHTML = getTimersTemplate() setTimeout(showTimers, 1000) } function applyDarkTheme() { document.head.insertAdjacentHTML("beforeend", getDarkStyles()) } function showEmptyBackground() { document.body.insertAdjacentHTML('beforeend', getEmptyBackgroundTemplate()); $('empty_background').addEventListener('click', handleOnBackgroundClick); } function hideEmptyBackground() { removeElement($('empty_background')) } function showSettings() { document.body.insertAdjacentHTML('beforeend', getSettingsTemplate()) fillSettings() } function fillSettings() { let settingsField = $('hwm_header_settings'); for (const [key, value] of Object.entries(settings)) { settingsField.insertAdjacentHTML("beforeend", `<div id="${key}"> <input id="${key}_checkbox" type="checkbox" ${value ? ' checked' : ''}> <label for="${key}_checkbox">${getTranslation(key)}</label> </div> `) $(`${key}`).addEventListener('click', () => { handleSettingsChange(key) }) } } function hideSettings() { removeElement($('hwm_header_settings')) } function processButtonDropDown(buttonInfo) { if (buttonInfo.id === "MenuInventory" || buttonInfo.id === "MenuTavern") { return } let target = $(buttonInfo.id+"_expandable") if (buttonInfo.id === "MenuBattles") { Array.from(target.getElementsByTagName('a')).slice(8).forEach(item => { buttonInfo.dropDown.push([item.textContent, item.href, true]) }) } target.innerHTML = '' buttonInfo.dropDown.forEach(item => { if (item.length > 2) { target.insertAdjacentHTML('beforeend', `<a href="${item[1]}" style="text-decoration:none;"><div class="sh_dd_container_red">${item[0]}</div></a>`) } else { target.insertAdjacentHTML('beforeend', `<a href="${item[1]}" style="text-decoration:none;"><div>${getTranslation(item[0])}</div></a>`) } }) target.insertAdjacentHTML("beforeend", `<img src="https://dcdn.heroeswm.ru/i/new_top/mm_dd_decorM.png" class="mm_decor2">`) target.insertAdjacentHTML("beforeend", `<img src="https://dcdn.heroeswm.ru/i/new_top/mm_dd_decorT.png" class="mm_decor3">`) } function processPage() { if (/home/.test(location.href)) { let isPremium = document.body.innerHTML.match(/star.gif/) timersInfo.isPremium = !!isPremium } if (/object_do/.test(location.href)) { if (document.body.textContent.match(/(successfully|устроены)/)) { timersInfo.labor_guild_timer_data = getHwmDate() } } let battleId = new URLSearchParams(new URL(document.referrer).search).get("warid") if (timersInfo.leader_guild_timer_data && !timersInfo.leader_guild_timer_data.timeSet && battleId === timersInfo.leader_guild_timer_data.battleId) { timersInfo.leader_guild_timer_data.timeSet = getHwmDate() } else if (timersInfo.thief_guild_timer_data && !timersInfo.thief_guild_timer_data.timeSet && battleId === timersInfo.thief_guild_timer_data.battleId) { timersInfo.thief_guild_timer_data.timeSet = getHwmDate() } else if (timersInfo.hunt_guild_timer_data && !timersInfo.hunt_guild_timer_data.timeSet && battleId === timersInfo.hunt_guild_timer_data.battleId) { timersInfo.hunt_guild_timer_data.timeSet = getHwmDate() } set("timers_data", timersInfo) } function processBattle() { let battleData = unsafeWindow.run_all.toString() let battleType = battleData.match(/btype\|(\d{1,10})/)[1] let battlePlayer = battleData.match(/plid1\|(\d{1,10})/)[1] let battleId = new URLSearchParams(window.location.search).get("warid") if (battlePlayer === getCookie("pl_id")) { if (battleType === "127") { if ("leader_guild_timer_data" in timersInfo) { if (timersInfo.leader_guild_timer_data.battleId < battleId) { timersInfo.leader_guild_timer_data = {"battleId": battleId} } } else { timersInfo.leader_guild_timer_data = {"battleId": battleId} } } else if (battleType === "66") { if ("thief_guild_timer_data" in timersInfo) { if (timersInfo.thief_guild_timer_data.battleId < battleId) { timersInfo.thief_guild_timer_data = {"battleId": battleId} } } else { timersInfo.thief_guild_timer_data = {"battleId": battleId} } } else if (battleType === "0") { if ("hunt_guild_timer_data" in timersInfo) { if (timersInfo.hunt_guild_timer_data.battleId < battleId) { timersInfo.hunt_guild_timer_data = {"battleId": battleId} } } else { timersInfo.hunt_guild_timer_data = {"battleId": battleId} } } set("timers_data", timersInfo) } } // listeners function handleOnSettingsButtonClick() { showEmptyBackground(); showSettings(); } function handleOnBackgroundClick() { hideEmptyBackground(); hideSettings(); } function handleSettingsChange(key) { settings[key] = $(`${key}_checkbox`).checked set('hwm_header_settings', settings) } // templates function getSettingsButtonTemplate() { return ` <img id="hwm_header_settings_button" src="https://dcdn3.heroeswm.ru/i/combat/btn_settings.png?v=8" height="18" alt="Header settings" style="position: relative; filter: drop-shadow(0.01rem 0.01rem 0 black) drop-shadow(-0.01rem -0.01rem 0 black); transform: rotate(22.5deg)" title="Header settings" >` } function getEmptyBackgroundTemplate() { return ` <div id="empty_background" style=" position: absolute; left: 0; top: 0; width: 100%; height: ${getScrollHeight()}; background: #000000; opacity: 0.5; z-index: 1100; "></div> ` } function getSettingsTemplate() { return ` <div id="hwm_header_settings" style=" position: absolute; left: ${(getClientWidth() - 600) / 2}px; top: ${window.pageYOffset + 155}px; width: 600px; background: #F6F3EA; z-index: 1101; "> </div> ` } function getNewHeaderTemplate() { return ` <div id="new_header"> <div class="top_line"> <div class="top_left_container"> <!-- <div class="top_left_left">--> <!-- </div>--> <div class="top_wing_middle"> <div id="notifications"> ${getNotificationsTemplate()} </div> </div> <div class="top_left_right"> <div id="heart_container"> <div class="sh_HMResIconBlock"> <canvas width="64px" height="64px" id="heart"></canvas> </div> <div style="display: none;" id="health_amount">100</div> </div> </div> </div> <div class="top_resource_container" id="top_resource_container"> <div id="ResourcesPanel" class="sh_ResourcesPanel"> ${getResourcesTemplate()} </div> </div> <div class="top_right_container"> <div class="top_right_left"> <div id="mana_container"> <div class="sh_HMResIconBlock mana"></div> <div class="mana_animation"></div> <div style="display: none" id="mana_amount">50</div> </div> </div> <div class="top_wing_middle"> <div class="time_online_radio_container"> <div id="hwm_time"></div> <div class="mm_extra_separator"></div> <div id="hwm_online">${headerInfo['online']} online</div> <div class="mm_extra_separator"></div> <div class="mm_extra_radio" onclick="hwm_top_line_open_radio(620, 400);return false;"></div> <div class="mm_extra_separator"></div> <div id="">${getSettingsButtonTemplate()}</div> </div> </div> <!-- <div class="top_right_right">--> <!-- </div>--> </div> </div> <div class="new_header_menu"> <!-- <img src="https://dcdn.heroeswm.ru/i/new_top/mm_decor1.png" class="mm_decor1">--> <div class="left_dragon"> <img height="70px" src="https://i.pinimg.com/originals/6c/2e/0b/6c2e0be6ebdad0e7f4bc86bc1f10e451.png"> </div> <div class="middle_menus"> <div class="timers_container" id="timers_container"></div> <div class="common_menu_container"> ${getMenuButtonsTemplate()} </div> </div> <div class="right_dragon"> <img height="70px" src="https://i.imgur.com/oqyVp7G.png"> </div> </div> </div> ` } function getNotificationsTemplate() { return headerInfo['notifications'].reduce((result, current) => { // #говнокод if (current.src.includes("pismo")) { return result + `<a href="sms.php">${current.outerHTML.toString()}</a>`; } else { return result + current.outerHTML.toString() }}, "") } function getResourcesTemplate() { let newResources = [] let resourceLinks = getResourceLinks() for (const [key, value] of Object.entries(headerInfo['resources'])) { let template = ` <div class="sh_ResourcesItem"> <a href="${resourceLinks[key]}"> <img class="sh_ResourcesItem_icon" src="https://dcdn.heroeswm.ru/i/r/48/${key}.png?v=3.23de65" alt="${key}" title="${key}"> </a> <span class="select_auto_enabled">${value}</span></div> ` newResources.push(template) } return newResources.join(`<div class="mm_rp_separator"></div>`) } function getMenuButtonsTemplate() { let buttonsToShow = getAvailableButtons() return buttonsToShow.reduce((result, current) => result + getMenuButtonHTML(current), "") } function getAvailableButtons() { let buttons = [] for (const [key, value] of Object.entries(getButtonInfos())) { if (settings[key]) { buttons.push(value) } } return buttons } function getMenuButtonHTML(buttonInfo) { processButtonDropDown(buttonInfo) let buttonInside = `` if (settings['isTextButtons']) { buttonInside = `<div class="menu_button_text">${getTranslation(buttonInfo.id)}</div>` } else { buttonInside = `<img class="mm_item_icon" src="${buttonInfo.image}">` } let buttonColor = `` if (headerInfo['homeColor'] === 'red') { buttonColor = 'red' } else if (headerInfo['battleColor'] === 'orange' && buttonInfo.id === "MenuBattles") { buttonColor = 'orange' } else if (headerInfo['battleColor'] === 'red' && buttonInfo.id === "MenuBattles") { buttonColor = 'red' } else { buttonColor = 'blue' } return ` <div class="mm_item mm_item_${buttonColor}"> <a href="${buttonInfo.href}"> <div class="mm_item_inside" id="${buttonInfo.id}" hwm_label=""> ${buttonInside} </div> </a> </div> ` } function getTimersTemplate() { let isPremium = timersInfo.isPremium ? timersInfo.isPremium : false let result = '' if (timersInfo.labor_guild_timer_data) { let timeCount = isPremium ? 60 : 60 result += ` <div class="mm_item mm_item_blue"> <div class="menu_button_text">${getTranslation("labor_guild")} ${getRemainingTime(timersInfo.labor_guild_timer_data, timeCount)}</div> </div>` } else { result += ` <div class="mm_item mm_item_blue"> <div class="menu_button_text">${getTranslation("labor_guild")} 00:00</div> </div>` } if (timersInfo.hunt_guild_timer_data && timersInfo.hunt_guild_timer_data.timeSet) { let timeCount = isPremium ? 28 : 40 result += ` <div class="mm_item mm_item_blue"> <div class="menu_button_text">${getTranslation("hunt_guild")} ${getRemainingTime(timersInfo.hunt_guild_timer_data.timeSet, timeCount)}</div> </div>` } else { result += ` <div class="mm_item mm_item_blue"> <div class="menu_button_text">${getTranslation("hunt_guild")} 00:00</div> </div>` } if (timersInfo.thief_guild_timer_data && timersInfo.thief_guild_timer_data.timeSet) { let timeCount = isPremium ? 42 : 60 result += ` <div class="mm_item mm_item_blue"> <div class="menu_button_text">${getTranslation("thief_guild")} ${getRemainingTime(timersInfo.thief_guild_timer_data.timeSet, timeCount)}</div> </div>` } else { result += ` <div class="mm_item mm_item_blue"> <div class="menu_button_text">${getTranslation("thief_guild")} 00:00</div> </div>` } if (timersInfo.leader_guild_timer_data && timersInfo.leader_guild_timer_data.timeSet) { let timeCount = isPremium ? 180 : 180 result += ` <div class="mm_item mm_item_blue"> <div class="menu_button_text">${getTranslation("leader_guild")} ${getRemainingTime(timersInfo.leader_guild_timer_data.timeSet, timeCount)}</div> </div>` } else { result += ` <div class="mm_item mm_item_blue"> <div class="menu_button_text">${getTranslation("leader_guild")} 00:00</div> </div>` } return result } function getRemainingTime(timeSet, timeCount) { let hwmDate = getHwmDate() let timeSetHwm = new Date(timeSet) return secondsToHumanDate(diffDateInSeconds(timeSetHwm, hwmDate) + timeCount * 60) } function diffDateInSeconds(dt1, dt2) { return Math.round((dt1.getTime() - dt2.getTime()) / 1000); } // helpers function getCookie(name) { const value = `; ${document.cookie}`; const parts = value.split(`; ${name}=`); if (parts.length === 2) return parts.pop().split(';').shift(); } function doGet(url, callback) { GM_xmlhttpRequest({ method: "GET", url: url, overrideMimeType: "text/xml; charset=windows-1251", onload: function (res) { callback(new DOMParser().parseFromString(res.responseText, "text/html")) } }); } function doPost(url, params, callback) { GM_xmlhttpRequest({ method: "POST", url: url, data: params, onload: callback, }); } function removeElement(element) { element.parentNode.removeChild(element) } function $(id, where = document) { return where.querySelector(`#${id}`); } function get(key, def) { let result = JSON.parse(localStorage[key] === undefined ? null : localStorage[key]); return result == null ? def : result; } function set(key, val) { localStorage[key] = JSON.stringify(val); } function getScrollHeight() { return Math.max(document.documentElement.scrollHeight, document.body.scrollHeight); } function getClientWidth() { return document.compatMode === 'CSS1Compat' && document.documentElement ? document.documentElement.clientWidth : document.body.clientWidth; } function findAll(regexPattern, sourceString) { let output = [] let match let regexPatternWithGlobal = RegExp(regexPattern, [...new Set("g" + regexPattern.flags)].join("")) while (match = regexPatternWithGlobal.exec(sourceString)) { delete match.input output.push(match) } return output } function sortByKey(array, key) { return array.sort((a, b) => { let x = a[key]; let y = b[key]; return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }); } function getHwmDate() { let today = new Date(); let localOffset = -(today.getTimezoneOffset() / 60); let destinationOffset = +3; let offset = destinationOffset - localOffset; return new Date(new Date().getTime() + offset * 3600 * 1000) } function hwmDateToHuman(hwmDate) { let hours = hwmDate.getHours().toString().length === 1 ? "0" + hwmDate.getHours().toString() : hwmDate.getHours().toString() let minutes = hwmDate.getMinutes().toString().length === 1 ? "0" + hwmDate.getMinutes().toString() : hwmDate.getMinutes().toString() let seconds = hwmDate.getSeconds().toString().length === 1 ? "0" + hwmDate.getSeconds().toString() : hwmDate.getSeconds().toString() return hours + ":" + minutes + ":" + seconds } function secondsToHumanDate(seconds) { // Hours, minutes and seconds var hrs = ~~(seconds / 3600); var mins = ~~((seconds % 3600) / 60); var secs = ~~seconds % 60; // Output like "1:01" or "4:03:59" or "123:03:59" var ret = ""; if (hrs > 0) { ret += "" + hrs + ":" + (mins < 10 ? "0" : ""); } ret += "" + mins + ":" + (secs < 10 ? "0" : ""); ret += "" + secs; return ret; } function getTranslation(textId) { return allTexts[textId][language] } function loadSettings() { settings = get('hwm_header_settings', defaultSettings) for (const [key, value] of Object.entries(defaultSettings)) { if (settings[key] === undefined) { settings[key] = value } } } function loadTimersInfo() { timersInfo = get('timers_data', {}) } function getAllTexts() { return { 'isTimeWithSeconds': { "rus": "Показывать время с секундами", "eng": "Show time with seconds", }, 'isShowTimers': { "rus": "Показывать таймеры гильдий", "eng": "Show guilds' timers", }, 'isDarkTheme': { "rus": "Темная тема", "eng": "Dark theme" }, 'isTextButtons': { "rus": "Старые текстовые кнопки", "eng": "Show old text buttons" }, 'isHomeButton': { "rus": "Персонаж", "eng": "Home" }, 'isInventoryButton': { "rus": "Инвентарь", "eng": "Inventory" }, 'isMapButton': { "rus": "Карта", "eng": "Map" }, 'isBattleButton': { "rus": "Битвы", "eng": "Battles" }, 'isTavernButton': { "rus": "Таверна", "eng": "Tavern" }, 'isRouletteButton': { "rus": "Рулетка", "eng": "Roulette" }, 'isLeaderboardButton': { "rus": "Рейтинг", "eng": "Leaderboards" }, 'isForumButton': { "rus": "Форум", "eng": "Forum" }, 'isChatButton': { "rus": "Чат", "eng": "Chat" }, 'MenuHome': { "rus": "Персонаж", "eng": "Home" }, 'MenuInventory': { "rus": "Инвентарь", "eng": "Inventory" }, 'MenuMap': { "rus": "Карта", "eng": "Map" }, 'MenuBattles': { "rus": "Битвы", "eng": "Battles" }, 'MenuTavern': { "rus": "Таверна", "eng": "Tavern" }, 'MenuRoulette': { "rus": "Рулетка", "eng": "Roulette" }, 'MenuStat': { "rus": "Рейтинг", "eng": "Leaderboards" }, 'MenuForum': { "rus": "Форум", "eng": "Forum" }, 'MenuChat': { "rus": "Чат", "eng": "Chat" }, 'myself': { "rus": "Я", "eng": "Myself" }, 'inventory': { "rus": "Инвентарь", "eng": "Inventory" }, 'shop': { "rus": "Магазин", "eng": "Artifact shop" }, 'auction': { "rus": "Рынок", "eng": "Market" }, 'choose_army': { "rus": "Набор армии", "eng": "Recruiting" }, 'castle': { "rus": "Замок", "eng": "Castle" }, 'skills': { "rus": "Навыки", "eng": "Talents" }, 'mailbox': { "rus": "Почта", "eng": "Mailbox" }, 'transfer': { "rus": "Передача ресурсов", "eng": "Transfer" }, 'facility1': { "rus": "Добыча", "eng": "Mining" }, 'facility2': { "rus": "Обработка", "eng": "Machining" }, 'facility3': { "rus": "Производство", "eng": "Production" }, 'houses': { "rus": "Дома", "eng": "Public services" }, 'one_to_one': { "rus": "Дуэли", "eng": "Duels" }, 'many_to_many': { "rus": "Групповые бои", "eng": "Group battles" }, 'guild_pvp': { "rus": "Гильдия тактиков", "eng": "Commanders' guild" }, 'guild_task': { "rus": "Гильдия стражей", "eng": "Watchers' guild" }, 'guild_leader': { "rus": "Гильдия лидеров", "eng": "Leaders guild" }, 'clanwars': { "rus": "Бои за территории", "eng": "Clan wars" }, 'tournaments': { "rus": "Турниры", "eng": "Tounaments" }, 'spin_history': { "rus": "История игр", "eng": "Spin history" }, 'lucky_boxes': { "rus": "Редкие ларцы", "eng": "Chests of abundance" }, 'top_heroes': { "rus": "Рейтинг воинов", "eng": "Top warriors" }, 'top_clans': { "rus": "Рейтинг кланов", "eng": "Top clans" }, 'top_hunters': { "rus": "Рейтинг охотников", "eng": "Top hunters" }, 'top_mercenaries': { "rus": "Рейтинг наемников", "eng": "Top mercenaries" }, 'top_shareholders': { "rus": "Рейтинг акционеров", "eng": "Top shareholders" }, 'personal_records': { "rus": "Мои охоты", "eng": "My hunt records" }, 'general_forum': { "rus": "Общий форум", "eng": "General forum" }, 'help_forum': { "rus": "Помощь по игре", "eng": "Q&A forum" }, 'trade_forum': { "rus": "Торговый форум", "eng": "Trade forums" }, 'reference': { "rus": "Об игре", "eng": "About the game" }, 'hwm_newspaper': { "rus": "Новостная лента", "eng": "Daily news" }, 'chat_1': { "rus": "Комната вопросов", "eng": "Inquiry" }, 'chat_2': { "rus": "Общая комната", "eng": "Common" }, 'chat_3': { "rus": "Торговая палата", "eng": "Merchant" }, 'chat_4': { "rus": "Рулетка", "eng": "Roulette" }, 'chat_5': { "rus": "Карты", "eng": "Tavern" }, 'labor_guild': { "rus": "ГР", "eng": "LG" }, 'leader_guild': { "rus": "ГЛ", "eng": "LeG" }, 'hunt_guild': { "rus": "ГО", "eng": "HG" }, 'thief_guild': { "rus": "ГВ", "eng": "TG" }, '': { "rus": "", "eng": "" }, } } function getDefaultSettings() { return { "isTimeWithSeconds": true, "isShowTimers": true, "isDarkTheme": true, "isTextButtons": false, "isHomeButton": true, "isInventoryButton": false, "isMapButton": true, "isBattleButton": true, "isTavernButton": true, "isRouletteButton": true, "isLeaderboardButton": true, "isForumButton": true, "isChatButton": true, } } function getButtonInfos() { return { "isHomeButton": { "image": "https://dcdn.heroeswm.ru/i/new_top/_panelCharacter.png", "id": "MenuHome", "href": "home.php", "dropDown": [ ["myself", `pl_info.php?id=${getCookie("pl_id")}`], ["inventory", "inventory.php"], ["shop", "shop.php"], ["auction", "auction.php"], ["choose_army", "army.php"], ["castle", "castle.php"], ["skills", "skillwheel.php"], ["mailbox", "sms.php"], ["transfer", "transfer.php"], ] }, "isInventoryButton": { "image": "https://dcdn.heroeswm.ru/i/mobile_view/icons/_panelInventory.png", "id": "MenuInventory", "href": "inventory.php", "dropDown": [] }, "isMapButton": { "image": "https://dcdn.heroeswm.ru/i/new_top/_panelMap.png", "id": "MenuMap", "href": "map.php", "dropDown": [ ["facility1", "map.php?st=mn"], ["facility2", "map.php?st=fc"], ["facility3", "map.php?st=sh"], ["houses", "map.php?st=hs"], ] }, "isBattleButton": { "image": "https://dcdn.heroeswm.ru/i/new_top/_panelBattles.png", "id": "MenuBattles", "href": "bselect.php", "dropDown": [ ["one_to_one", "one_to_one.php"], ["many_to_many", "group_wars.php"], ["guild_pvp", "pvp_guild.php"], ["guild_task", "task_guild.php"], ["guild_leader", "leader_guild.php"], ["clanwars", "mapwars.php"], ["tournaments", "tournaments.php"], ] }, "isTavernButton": { "image": "https://dcdn.heroeswm.ru/i/new_top/_panelTavern.png", "id": "MenuTavern", "href": "tavern.php", "dropDown": [] }, "isRouletteButton": { "image": "https://dcdn.heroeswm.ru/i/new_top/_panelRoulette.png", "id": "MenuRoulette", "href": "roulette.php", "dropDown": [ ["spin_history", "allroul.php"], ["lucky_boxes", "gift_box_log.php"], ] }, "isLeaderboardButton": { "image": "https://dcdn.heroeswm.ru/i/new_top/_panelRate.png", "id": "MenuStat", "href": "plstats.php", "dropDown": [ ["top_heroes", "plstats.php"], ["top_clans", "clanstat.php"], ["top_hunters", "plstats_hunters.php"], ["top_mercenaries", "plstats_merc.php"], ["top_shareholders", "sholders_stat.php"], ["personal_records", `pl_hunter_stat.php?id=${getCookie("pl_id")}`], ] }, "isForumButton": { "image": "https://dcdn.heroeswm.ru/i/new_top/_panelForum.png", "id": "MenuForum", "href": "forum.php", "dropDown": [ ["general_forum", "forum_thread.php?id=2"], ["help_forum", "forum_thread.php?id=10"], ["trade_forum", "forum.php#t1"], ["reference", "help.php"], ["hwm_newspaper", "https://daily.heroeswm.ru/"], ] }, "isChatButton": { "image": "https://dcdn.heroeswm.ru/i/new_top/_panelChat.png", "id": "MenuChat", "href": "frames.php", "dropDown": [ ["chat_1", "frames.php?room=0"], ["chat_2", "frames.php?room=1"], ["chat_3", "frames.php?room=2"], ["chat_4", "frames.php?room=3"], ["chat_5", "frames.php?room=4"], ] }, } } function getResourceLinks() { return { "gold": "roulette.php", "wood": "auction.php?cat=res&sort=0&type=1", "ore": "auction.php?cat=res&sort=0&type=2", "mercury": "auction.php?cat=res&sort=0&type=3", "sulfur": "auction.php?cat=res&sort=0&type=4", "crystals": "auction.php?cat=res&sort=0&type=5", "gems": "auction.php?cat=res&sort=0&type=6", "diamonds": "hwm_donate_page_new.php", } } function getStyles() { return ` <style> ${settings.isTextButtons ? ".mm_item, .mm_item_inside {height:24px}; .mm_item_inside {display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center;} .menu_button_text{height:100%}" : ""}; body { margin: 0; padding: 0; } #new_header { display: flex; flex-direction: column; align-items: center; } .top_line { width: 100%; height: 32px; display: flex; flex-direction: row; flex-wrap: nowrap; } .top_left_container, .top_right_container { height: 100%; display: flex; flex-direction: row; flex-wrap: nowrap; flex-grow: 1; } .top_left_left { height: 100%; width: 52px; background-image: url("https://dcdn.heroeswm.ru/i/new_top/extra_bg_side2.png"); background-size: 256px 32px; background-repeat: no-repeat; } .top_left_right { min-width: 100px; background: url("https://dcdn.heroeswm.ru/i/new_top/extra_bg_side1.png") no-repeat top right; background-size: 256px 32px; } /*#logo_container {*/ /* position: relative;*/ /*}*/ /*.logo {*/ /* max-width: 128px;*/ /* max-height: 64px;*/ /*}*/ #notifications { height: 32px; float: right; display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; margin-right: 10%; } #heart_container { background-image: url("https://dcdn.heroeswm.ru/i/new_top/mm_rp_health.png"); background-size: contain; width: 32px; height: 32px; margin: auto; } #heart_container:hover #health_amount { display: initial !important; position: absolute; color: white; transform: translate(10%, -100%); text-shadow: 1px 0 0 #000, 0 -1px 0 #000, 0 1px 0 #000, -1px 0 0 #000; } .sh_HMResIconBlock { position: relative; left: 15px; top: 15px; } .health_animation { position: relative; } #heart { width: 27px; height: 27px; } #mana_container { background-image: url("https://dcdn.heroeswm.ru/i/new_top/mm_rp_mana.png"); background-size: contain; width: 32px; height: 32px; margin: auto; display: grid; grid-template-columns: 1fr; grid-template-rows: 1fr; overflow: hidden; } .mana_animation { position: relative; grid-column-start: 1; grid-row-start: 1; z-index: 4; } .mana { grid-column-start: 1; grid-row-start: 1; z-index: 3; } #mana_amount { grid-column-start: 1; grid-row-start: 1; z-index: 5; margin: auto; color: white; } #mana_container:hover #mana_amount { display: initial !important; color: white; text-shadow: 1px 0 0 #000, 0 -1px 0 #000, 0 1px 0 #000, -1px 0 0 #000; } .top_right_right { width: 52px; background: url("https://dcdn.heroeswm.ru/i/new_top/extra_bg_side2.png") no-repeat top right; background-size: 256px 32px; } .top_right_left { min-width: 100px; background: url("https://dcdn.heroeswm.ru/i/new_top/extra_bg_side1.png") no-repeat top left; background-size: 256px 32px; } .top_wing_middle { min-width: 175px; width: 100%; background: url("https://dcdn.heroeswm.ru/i/new_top/extra_bg_mid.png") repeat-x top left; background-size: 32px; } .time_online_radio_container { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; margin-left: 10%; } #hwm_time, #hwm_online { color: #b12424; } .top_resource_container { background: url("https://dcdn.heroeswm.ru/i/new_top/rp_bg_mid.png"); background-size: contain; } .new_header_menu { background: url("https://dcdn.heroeswm.ru/i/new_top/mm_dd_tile.jpg"); min-height: 70px; padding: 0; width: 100%; display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: space-between; } .common_menu_container { margin-top: 5px; display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: center; align-items: center; overflow: hidden; } .timers_container { display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: center; align-items: center; overflow: hidden; } .mm_item { margin: 0; } .mm_item + .mm_item { margin-left: 5px; } .left_dragon, .right_dragon { } .left_dragon { transform: scaleX(-1); } .middle_menus { display: flex; flex-direction: column; justify-content: center; } .menu_button_text { display: flex; justify-content: center; align-items: center; color: #fad49f; font-weight: bold; } </style> ` } function getDarkStyles() { let mainTextColor = `#d0d0d0` return ` <style> body { background: #1f2023 !important; } td, .forum > td { color: ${mainTextColor} !important; background-image: none !important; } font { color: ${mainTextColor} !important; opacity: 0.65; } a, .forum > a { color: ${mainTextColor} !important; /*opacity: 0.87;*/ } div { color: #121212; } .txt { color: ${mainTextColor}; /*opacity: 0.87;*/ } .pi { color: ${mainTextColor}; /*opacity: 0.87;*/ } .wblight, .wb2, .wb td{ background-color: #2d2f34; } .wbwhite { background-color: #383b40; } table.table3, table.table3 th { background-color: #383b40; } .forum tr:not(.second) > td { background-color: #383b40 !important; } table.forum tr.message_footer td { background-color: #27292d !important; } .forum span, .second { background-color: #2d2f34 !important; } #home_2 { color: ${mainTextColor}; } #hwm_for_zoom { background-color: #27292d !important; } #hwm_for_zoom * { color: ${mainTextColor}; } .dark_seconds { color: #a50909; } * { border-color: #55565d !important; } table td.tlight { background-color: #2d2f34 !important; background-image: none; } table td.twhite { background-color: #383b40 !important; background-image: none; } #pa,#pd, #pp, #pk, #pl, #pm, #pi, #ap, #sc { color: ${mainTextColor} !important; } </style> ` } })(window);