我想添加一个类似于这些的新链接:
<a href="/profile/viewallthread/2323">More Threads by Username</a>
添加 :
<div class="author vcard" itemscope="" itemtype="http://schema.org/Person" itemprop="author">
<div class="user-details open" itemprop="name">
<a href="/profile/2323" class="nickname url tools"> Username </a>
<div class="user-info">
<a href="/profile/2323">View Public Profile</a>
<a href="/profile/beafriend/2323">Add Friend</a>
<a href="/pm/compose/2323">Send a private message</a>
<a href="/profile/viewallposts/2323">More Posts by Username</a>\
//add link here
</div>
</div>
</div>
userscript.js(参考:更新页面以使用 Greasemonkey 添加新链接)
// ==UserScript==
// @name My Fancy New Userscript
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @include *.domain.com/*
// @copyright 2012+, You
// ==/UserScript==
var adduserinfo = $("div.author vcard div.user-info > a");
adduserinfo.each (function () {
var jThis = $(this);
var UserID = jThis.attr ('href').replace (/\D+(\d+)$/, '$1');
jThis.parent ().append ('<a href="/profile/viewallthreads/' + UserID + ' ">More Threads by ' + Username +'</a>');
} );
但不工作..任何解决方案?谢谢