BaconCatBug / DakkaDakka Mass Unread Opener

// ==UserScript==
// @name         DakkaDakka Mass Unread Opener
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Adds a button to open all "[First Unread]" links on the page, hides the "[Blog View]" links, and adds a "Subscribed Threads" link to forum pages.
// @author       BaconCatBug
// @match        https://www.dakkadakka.com/dakkaforum/recentTopics/showTopicsByUserSubscription/*
// @match        https://www.dakkadakka.com/dakkaforum/forums/show/*
// @match        https://www.dakkadakka.com/dakkaforum/user/profile/*
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @license      MIT
// ==/UserScript==
// ==OpenUserJS==
// @author BaconCatBug
// ==/OpenUserJS==

(function () {
  var openUnread = function (event) {
    var anchors = document.querySelectorAll('span > a');
    var xx = [];
    var yy = [];
    for (var i = 0; i < anchors.length; i++) {
      var cc = anchors[i].toString();
      if (cc.includes('/posts/skipread/')) {
        yy.push(i);
      }
    }
    if (yy.length > 14) {
      if (confirm('Open ' + yy.length + ' links?')) {
        for (var j = 0; j < yy.length; j++) {
          window.open(anchors[yy[j]].href);
        }
      }
    }
    else {
      for (var k = 0; k < yy.length; k++) {
        window.open(anchors[yy[k]].href);
      }
    }
  }

  'use strict';
  var x = document.getElementsByClassName("thcornerl");
  x[0].innerHTML = "<button id='butten'><b>Open Unread</button>";
  x[0].setAttribute("align", "left");
  document.getElementById("butten").addEventListener("click", openUnread);
  $("#butten").css({
    'font-size': '12px',
    'background': 'none',
    'border': 'none',
    'font-family': 'Arial, Helvetica, sans-serif',
    'margin-left': '0'
  });
  $(".th.thcornerl").css({
    'align': 'left'
  });
  $("span:contains('Blog View')").hide();
  var profile_link_1 = document.querySelectorAll('a[href*="/dakkaforum/user/profile"]');
  var profile_link_2 = profile_link_1[0].toString();
  var profile_link_3 = profile_link_2.split("/");
  var profile_link_4 = profile_link_3[6].toString();
  var profile_link_5 = profile_link_4.split(".");

  $("#dakkamainnav").append("<span><a href='/dakkaforum/recentTopics/showTopicsByUserSubscription/" + profile_link_5[0] + ".page' class='navlink' rel='nofollow'>Subscribed Threads</a></span>");
})();