Dynasty Link Thingifier

Adds post links and quote stuff to Dynasty forums

ของเมื่อวันที่ 22-08-2015 ดู เวอร์ชันล่าสุด

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

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