P_Woland / tankiforum posts count

// ==UserScript==
// @name          tankiforum posts count
// @namespace     https://tankirating.org
// @description   Show posts count on ru.tankiforum.com
// @license       GPL-3.0-or-later
// @copyright     2020, Fizzika (https://openuserjs.org/users/Fizzika)
// @include       https://ru.tankiforum.com/topic/*
// @version       1.0.0
// ==/UserScript==

/* jshint esversion: 6 */

(function() {
  const comments = document.getElementsByClassName("cAuthorPane_info");
  for (const comment of comments) {
    let iterator = document.createNodeIterator(comment, NodeFilter.SHOW_COMMENT, () => NodeFilter.FILTER_ACCEPT)
    let totalHtml = iterator.nextNode().data || ""
    let totalElem = document.createElement('div')
    totalElem.style.paddingBottom = '5px'
    totalElem.innerHTML = totalHtml;
    let insertPos = comment.children.length - 2;
    comment.insertBefore(totalElem, comment.children[insertPos])
  }
})();