Gertykhon / Coub Scroll Arrows

// ==UserScript==
// @name         Coub Scroll Arrows
// @version      0.1.1
// @license      MIT
// @description  Adds up and down arrow buttons for scrolling by clicks
// @author       Gertykhon
// @match        https://coub.com
// @match        https://coub.com/*
// @exclude      https://coub.com/view/*
// @exclude      https://coub.com/embed/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=coub.com
// @grant        none
// ==/UserScript==

(function () {
  'use strict';
  var b = "auto"; //scroll behavior smooth/auto
  var adown = document.createElement("div");
  var aup = document.createElement("div");
  var style = "position:fixed;z-index:9900;right:20px;opacity:50%;background-color:#555;color:#fff;font-weight:900;display:table-cell;" +
    "width:50px;height:50px;border-radius:25px;font-size:20pt;padding:8px 0 0 0;margin:0px;text-align:center;cursor:pointer;";
  adown.style = style + "bottom:20px;";
  adown.innerHTML = '<span style="line-height:0;">↓</span>';
  aup.style = style + "bottom:90px;";
  aup.innerHTML = '<span style="line-height:0;">↑</span>';
  adown.onclick = function () {
    var active = document.querySelector("div.coub.active");
    var next = active.nextSibling;
    if (!next) next = active.parentElement.nextSibling.firstChild;
    if (!next.classList.contains("coub")) next = next.nextSibling;
    next.scrollIntoView({
      behavior: b,
      block: "end"
    });
  };
  aup.onclick = function () {
    var active = document.querySelector("div.coub.active");
    var prev = active.previousSibling;
    if (!prev) prev = active.parentElement.previousSibling.lastChild;
    if (!prev.classList.contains("coub")) prev = prev.previousSibling;
    prev.scrollIntoView({
      behavior: b,
      block: "end"
    });
  };
  document.body.append(adown);
  document.body.append(aup);
})();