您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds post links and quote stuff to Dynasty forums
当前为
// ==UserScript== // @name Dynasty Link Thingifier // @namespace Alice Cheshire // @include http://dynasty-scans.com/forum/topics // @version 1.2.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(); tmpurl = pageurl; postids = []; postcount = 0; pageurl = pageurl.replace(/(#.+)/, ""); $('.forum_post').each(function() { postids.push(this.id); }); $('.time').each(function(i, obj) { postcount++; }); if (tmpurl.match(/http:\/\/dynasty-scans.com\/forum\/posts\?user_id=\d+/)) { tmpurl = tmpurl.replace(/\d+/, ""); } for (i = 0; i < postcount; i++){ id = postids[i].toString(); if(tmpurl !== "http://dynasty-scans.com/forum/posts?user_id=") { $(".time").eq(i).replaceWith("<div class=\"span5 time\"><a href=\"" + pageurl + "#" + id + "\">" + $(".time").eq(i).text() + "</a></div>"); } } $('a').click(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(); }