Xhamster - Delete Extra Big space in comments / Blogs v.1

Delete Extra Big space in comments / Blog

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 or Violentmonkey 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.

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

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

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

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

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

// ==UserScript==
// @name            Xhamster - Delete Extra Big space in comments / Blogs v.1
// @version         v.1.00
// @description	    Delete Extra Big space in comments / Blog
// @icon            https://external-content.duckduckgo.com/ip3/fr.xhamster.com.ico
// @namespace       https://greasyfork.org/fr/users/7434-janvier56
// @homepage        https://greasyfork.org/fr/users/7434-janvier56
// @match           https://*.xhamster.com/*
// @grant           none
// ==/UserScript==

(function() {
  'use strict';
  var comments = document.querySelectorAll('.video-page .width-wrap .comments-section.comments-container #commentBox [class^="commentsList-"] [class^="commentItem-"] [class^="text-"]  [class^="commentText-"]');
  comments.forEach(function(comment) {
    var brs = comment.getElementsByTagName('br');
    var i = 0;
    while (i < brs.length - 1) {
      if (brs[i].nextSibling === brs[i + 1]) {
        brs[i + 1].remove();
      } else {
        i++;
      }
    }
  });

  var storyTexts = document.querySelectorAll('.story-section .story-item .story-text:not(.xh-editor)');
  storyTexts.forEach(function(storyText) {
    var brs = storyText.getElementsByTagName('br');
    var i = 0;
    while (i < brs.length - 1) {
      if (brs[i].nextSibling === brs[i + 1]) {
        brs[i + 1].remove();
      } else {
        i++;
      }
    }
  });
})();