您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Writes incoming attacks into village notes
当前为
// ==UserScript== // @name Save inc in village notes // @description Writes incoming attacks into village notes // @author FunnyPocketBook // @version 0.2.2 // @namespace FunnyPocketBook // @include https://*/game.php?* // ==/UserScript== "use strict"; setInterval(() => { if (document.getElementById("incomings_amount").textContent != localStorage.incomingAttacks) { getAttacks(); } localStorage.incomingAttacks = document.getElementById("incomings_amount").textContent; }, 1000); function getAttacks() { let incUrl = window.location.origin + "/game.php?village=" + game_data.village.id + "&screen=overview_villages&mode=incomings&subtype=attacks"; $.get(incUrl, function (r) { let dom = (new DOMParser()).parseFromString(r, "text/html"); parseAttacks(dom); }); } function parseAttacks(dom) { let incRows = dom.getElementById("incomings_table").rows; let text = []; for (let i = 1; i < incRows.length - 1; i++) { text.push(getAttackInfo(incRows[i].querySelectorAll("td"))); } writeNote(text); } function getAttackInfo(r) { let ret = []; r.forEach((row) => { ret.push(row.innerText.trim()); }); return ret; } function writeNote(text) { let villageNote = ""; $.get(window.location.origin + "/game.php?village=" + game_data.village.id + "&screen=overview&ajax=edit_notes_popup", function (r) { villageNote = (new DOMParser()).parseFromString(r, "text/html").querySelector("#message").textContent + "\n"; }) .done(function () { text.forEach((t) => { villageNote += t.join(", ") + "\n"; }) let noteUrl = window.location.origin + "/game.php?village=" + game_data.village.id + "&screen=api&ajaxaction=village_note_edit"; let data = { village_id: game_data.village.id, note: villageNote, h: game_data.csrf }; $.post(noteUrl, data); }) }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址