Nexus Clash: Bold Shadows

Helps to see hunting targets at a glance: if shadows can be seen from outside a building it makes that part of the description bold

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Nexus Clash: Bold Shadows
// @namespace    http://nexusclash.com/wiki/index.php/user:xensyria
// @version      1.1
// @description  Helps to see hunting targets at a glance: if shadows can be seen from outside a building it makes that part of the description bold
// @match        http://nexusclash.com/modules.php?name=Game*
// @match        http://www.nexusclash.com/modules.php?name=Game*
// @exclude      http://nexusclash.com/modules.php?name=Game&op=disconnect
// @exclude      http://www.nexusclash.com/modules.php?name=Game&op=disconnect
// @grant        none
// @copyright    PD
// ==/UserScript==

    // If writing box is available then the message description is two elements later
var childNumber = 18;
if (document.getElementsByName('writing').length > 0){
  childNumber=20;
}
    // Check if any "shadow"s moving in "windows" are in the tile description
if (document.getElementById('Messages').parentNode.childNodes[childNumber].textContent.match(/shadow[^\.]+windows\./)){

    // Get the tile description split up into parts
  var tileDesc = document.getElementById('Messages').parentNode.childNodes[childNumber].textContent.match(/(.*)\.([^\.]+shadow[^\.]+windows\.)(.*)/);
    // Since this node can't include HTML directly, set it as the first part of the description, before the bold tags begin
  document.getElementById('Messages').parentNode.childNodes[childNumber].textContent = tileDesc[1] + ". ";
    // Use the next element to insert the HTML bold tags and the rest of the description
  document.getElementById('Messages').parentNode.childNodes[childNumber].nextSibling.insertAdjacentHTML('beforebegin', '<b>' + tileDesc[2] + '</b>' + tileDesc[3]);
}