您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Character Name title text shows a count of a characters pets that are present
当前为
// ==UserScript== // @name NexusClashPetListonMouseover // @namespace http://userscripts.org/users/125692 // @description Character Name title text shows a count of a characters pets that are present // @include http://www.nexusclash.com/modules.php?name=Game* // @version 1 // @grant none // ==/UserScript== (function() { var characters= document.evaluate("//span[@class='char']", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);//find the form with name=pickup //alert(characters.snapshotLength); if (characters.snapshotLength>=1){//We have one or more candidates var ehighlightpet=function(e) { var charname=e.target.textContent; //either .trim or .slice(0, -1) to remove last character from string. var searchstring="Master: "+charname.trim(); searchstring="//a[@title='"+searchstring+"']" var theirpets= document.evaluate(searchstring, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); var eachpet=0; //alert(theirpets.snapshotLength); if (theirpets.snapshotLength>=1){//We have one or more candidates e.target.title=(theirpets.snapshotLength + " pets present"); var eachpet=0; for (var i=0;eachpet=theirpets.snapshotItem(i);i++){ eachpet.style.color='blue'; } } } var eunhighlightpet=function(e) { var charname=e.target.textContent; var searchstring="Master: "+charname.trim(); searchstring="//a[@title='"+searchstring+"']" var theirpets= document.evaluate(searchstring, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); var eachpet=0; if (theirpets.snapshotLength>=1){//We have one or more candidates var eachpet=0; for (var i=0;eachpet=theirpets.snapshotItem(i);i++){ //eachpet.style.fontStyle='normal'; eachpet.style.color=""; } } } var eachchar=0; for (var i=0;eachchar=characters.snapshotItem(i);i++){ eachchar=eachchar.firstElementChild; eachchar.addEventListener("mouseover", ehighlightpet); eachchar.addEventListener("mouseout", eunhighlightpet); } } //EOF })();