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

Delete Extra Big space in comments / Blog

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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++;
      }
    }
  });
})();