Dynasty Link Thingifier

Adds post links and quote stuff to Dynasty forums

Versione datata 22/08/2015. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

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