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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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]);
}