您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
checking all equip before going to tactic guild
当前为
// ==UserScript== // @name checkArtsBeforeTacticGuild // @namespace http://tampermonkey.net/ // @version 0.3 // @description checking all equip before going to tactic guild // @author Salmon // @license MIT // @match /^https{0,1}:\/\/((www|my)\.(heroeswm|lordswm)\.(ru|com)|178\.248\.235\.15)\/(pvp_guild).php*/ // @include /^https{0,1}:\/\/((www|my)\.(heroeswm|lordswm)\.(ru|com)|178\.248\.235\.15)\/(pvp_guild).php*/ // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // ==/UserScript== (function() { 'use strict'; const createEl = (el, style, innerText, className, placeholder) => { let element = document.createElement(el); if (style) element.style = style; if (innerText) element.innerText = innerText; return element; } const h2 = [...document.getElementsByTagName("h2")][0]; const links = ['https://my.lordswm.com', 'https://www.heroeswm.ru']; const link = location.href.slice(0, 22) === 'https://my.lordswm.com' ? links[0] : links[1]; const fetch_xml = () => { const xhr = new XMLHttpRequest(); xhr.open('get', `${link}/home.php`); xhr.setRequestHeader('Content-type', 'text/html; charset=windows-1251'); if (xhr.overrideMimeType) { xhr.overrideMimeType('text/html; charset=windows-1251'); } xhr.addEventListener('load', () => { var parser = new DOMParser(); var doc = parser.parseFromString(xhr.responseText, "text/html"); let equippedArtsCount = 0; const notEquipped = []; const head = {name: 'шлем', check: doc.getElementById("slot1")} const neck = {name: "кулон", check: doc.getElementById("slot2")} const torso = {name: "броню", check: doc.getElementById("slot3")} const back = {name: "спина", check: doc.getElementById("slot4")} const rHand = {name: "правая рука", check: doc.getElementById("slot5")} const lHand = {name: "левая рука", check: doc.getElementById("slot6")} const boots = {name: "сапоги", check: doc.getElementById("slot7")} const hRing = {name: "верхнее кольцо", check: doc.getElementById("slot8")} const lRing = {name: "нижнее кольцо", check: doc.getElementById("slot9")} const bag = {name: "Сумка", check: doc.getElementById("slot10")} const mirror = {name: "Зеркало", check: doc.getElementById("slot11")}; const mirrorText = mirror.check.innerText == "" ? "Зеркало не надето" : "Зеркало надето"; const bagText = bag.check.innerText == "" ? "Сумка не надета" : "Сумка надета"; const mirrorStyle = mirror.check.innerText == "" ? "color: red; font-size: 14px; cursor: pointer" : "color: green;font-size: 14px"; const bagStyle = bag.check.innerText == "" ? "color: red;font-size: 14px; cursor: pointer" : "color: green;font-size: 14px"; const arts = [head, neck, torso, back, rHand, lHand, boots, hRing,lRing]; arts.forEach(art => { if (art.check.innerText !== "") { equippedArtsCount += 1 } else { notEquipped.push(art.name); } }) const wrapper = createEl("div"); const mainArtsBlock = createEl("div", `${equippedArtsCount < 9 ? "color: red; cursor: pointer; font-size: 14px" : "color: green; font-size: 14px"}`, `Надето артов: ${equippedArtsCount}/9`); const notEquippedBlock = createEl("div", "font-size: 12px; color: red; cursor: pointer", `${equippedArtsCount < 9 ? `Не надето: ${notEquipped}` : ""}`) const mirrorBlock = createEl("div", mirrorStyle, mirrorText); const bagBlock = createEl("div", bagStyle, bagText); wrapper.append(mainArtsBlock); wrapper.append(notEquippedBlock); wrapper.append(mirrorBlock); wrapper.append(bagBlock); wrapper.addEventListener("click", () => {location.href = `${link}/inventory.php`}) h2.append(wrapper); }) xhr.send(); } fetch_xml(); })();