Dynasty Link Thingifier

Adds post links and quote stuff to Dynasty forums

Stan na 22-08-2015. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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