Dynasty Link Thingifier

Adds post links and quote stuff to Dynasty forums

Verze ze dne 22. 08. 2015. Zobrazit nejnovější verzi.

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

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

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        Dynasty Link Thingifier
// @namespace   Alice Cheshire
// @include     http://dynasty-scans.com/*
// @version     1
// @require     http://code.jquery.com/jquery-2.1.4.min.js
// @description Adds post links and quote stuff to Dynasty forums
// @author
// @run-at document-end
// ==/UserScript==

pageurl = document.location.toString();
postids = [];
postcount = 0;
pageurl = pageurl.replace(/(#.+)/, "");
$('.forum_post').each(function() {
  postids.push(this.id);
});
$('.time').each(function(i, obj) {
  postcount++;
});

for (i = 0; i < postcount; i++){
  id = postids[i].toString();
  $(".time").eq(i).replaceWith("<div class=\"span5 time\"><a href=\"" + pageurl + "#" + id + "\">" + $(".time").eq(i).text() + "</a></div>");
}
$('a').hover(function(e) {
  if ($(e.target).text() == "Quote") {
    postid = $(e.target).parents();
    postid = postid[4];
    postid = $(postid).attr('id');
    postid = "#" + postid;
    postid = postid.toString();
    document.cookie = "quote=" + pageurl + postid + ";path=/";
    quotename = $(postid).find(".user").text();
    quotename = $.trim(quotename);
    document.cookie = "username=" + quotename + ";path=/";
  } else {
    console.log("No match!");
  }
});
quoting = pageurl.replace(/http:\/\/dynasty-scans.com\/forum\//, "");
quoting = quoting.replace(/\?.+/, "");
if (quoting === "posts/new") {
  post = getCookie("quote");
  username = getCookie("username");
  console.log(post + "\n" + username);
  quote = "[" + username + "](" + post + ")";
  message = "\n" + document.getElementById('forum_post_message').value;
  document.getElementById('forum_post_message').value = quote + message;

}
function getCookie(name) {
  var value = "; " + document.cookie;
  var parts = value.split("; " + name + "=");
  if (parts.length == 2) return parts.pop().split(";").shift();
}