[HF] Colored thread reply numbers

Color the thread reply number based on the post count.

اعتبارا من 01-05-2016. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         [HF] Colored thread reply numbers
// @namespace    @iNeo19
// @version      0.1
// @description  Color the thread reply number based on the post count.
// @author       You
// @match        http://hackforums.net/search.php?action=results&sid=*
// @grant        none
// ==/UserScript==

function getElementByXpath(path) {
  return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}

(function() {
    'use strict';
    var threadList = getElementByXpath('//*[@id="content"]/div[2]/table[2]/tbody');
    var threads = threadList.getElementsByTagName("tr");
    for(var threadIndex=0;threadIndex<threads.length;threadIndex++) {
        var threadData = threads[threadIndex].getElementsByClassName("forumdisplay_regular");
        var postCountRow = threadData[2];
        if (postCountRow) {
            var postCountRaw = postCountRow.getElementsByTagName("a");
            var postCountElement = postCountRaw[0];
            var postCount = postCountElement.innerHTML;
            if (postCount <= 0) {
                postCountElement.style.color = "#33accc";
                postCountElement.style.fontWeight = "bold";
            }
            else if (postCount <= 10) {
                postCountElement.style.color = "#329C32";
            }
            else if (postCount > 100) {
                postCountElement.style.color = "#ff0000";
             }
            else if (postCount > 10) {
                postCountElement.style.color = "#cc8f33";
             }
            else if (postCount.indexOf(',') >= 0) {
                postCountElement.style.color = "cyan";
            }

        }
    }
})();