Better pornolab.net posts

Make download link easier to find and click, add a textarea with the torrent title to easily edit a copy, torrent title removes common annoyances like forward slashes (not allowed in file names) and the Russian shorthand for "year", add a link you can tab into from the textarea to quickly download the torrent. 2020-06-20 20:22:57

// ==UserScript==
// @name        Better pornolab.net posts
// @namespace   Violentmonkey Scripts
// @match       http://pornolab.net/forum/viewtopic.php
// @grant       none
// @version     1.0
// @author      -
// @description Make download link easier to find and click, add a textarea with the torrent title to easily edit a copy, torrent title removes common annoyances like forward slashes (not allowed in file names) and the Russian shorthand for "year", add a link you can tab into from the textarea to quickly download the torrent. 2020-06-20 20:22:57
// @run-at document-idle
// @inject-into page
// ==/UserScript==

this.$ = this.jQuery = jQuery.noConflict(true);
$("div#tor-reged").ready(function () {
  
  // make download link easier to find and click
  $("div#tor-reged a.dl-stub.dl-link").prepend("Download | ");
  $("div#tor-reged p").has("a.dl-stub").has("img").css("width", "100%").css("display", "block");
  $("div#tor-reged a.dl-stub").has("img").css("width", "100%").css("display", "block");
  
  var title = $("h1.maintitle a").text();
  // $("h1.maintitle a").remove();
  
  var s = function(text, regex, replacement) {
    return text.replace(regex, replacement);
  }
  
  title = s(title, / \/ /g, ', '); // Remove slashes, not allowed in file names. Replace with commas
  title = s(title, / г./g, ''); // Russian cyrillic shorthand for the word "year"
  
  // Get download link
  var dl = $("div#tor-reged a.dl-stub.dl-link").attr("href");
  
  // Add title near download link to edit and copy conveniently, and a download link to tab into
  $("div#tor-reged").prepend("<div id='better-plab-dl'><p><form><textarea style='font-size: 130%; width: calc(100% - 1em); padding: 0.5em' autocorrect='off' autocomplete='off' autocapitalize='off' spellcheck='false'>" + title + "</textarea></form></p><p><a href='" + dl + "' class='dl-stub dl-link'>Download Torrent File</a></p></br></div>");
});