You can bookmark and follow without going to the related pages. ブックマークとお気に入り登録をページ遷移なく非同期的に行います。
当前为
// ==UserScript==
// @name Pixiv ajax bookmark and follow mod
// @namespace
// @version 1.1
// @description You can bookmark and follow without going to the related pages. ブックマークとお気に入り登録をページ遷移なく非同期的に行います。
// @include http://www.pixiv.net/member_illust.php?*
// @copyright 2014+, qa2
// @author qa2 & SaddestPanda
// ==/UserScript==
//When you add an illustration to bookmarks also give it 10 stars.
//ブックマークしたら10★も同時に。
var tenstars = 1;
//R18 illustrations are added as private bookmarks.
//イラストはR-18であった場合プライベートブックマークにします。
var r18private = 1;
//Remove facebook, twitter sharing and save bandwidth/speed.
//シェア機能を排除します。
var remove_share = 1;
// If set to "1": Always add to private bookmarks list.
// bkm_restrict ブックマークする作品を非公開にするかどうか 0:公開 1:非公開
var bkm_restrict = 0;
// If set to "1": Always add to private follow list.
// follow_restrict フォローしたユーザーを非公開にするかどうか 0:公開 1:非公開
var follow_restrict = 0;
if (remove_share) {
$(".share-button")[0].remove();
}
//作品に登録されているすべてのタグをブックマークタグとして追加
var tags = "";
$(".tag > .text").each(function() {
tags += $(this).text() + " "
});
$(".add-bookmark").click(function(e){
e.preventDefault();
bkm();
});
$(".follow").click(function(e){
e.preventDefault();
follow();
});
//KEYBINDINGS. REMOVE THE COMMENTS (/* and */) TO BRING THEM BACK.
/*
//eキーを押すとブクマする
//press e to bookmark
$(window).keydown(function(e) {
if (!$("input[name=word]").is(":focus") && e.which == 69) {
bkm();
}
});
//press R to private bookmark
$(window).keydown(function(e) {
if (!$("input[name=word]").is(":focus") && e.which == 82) {
bkm_restrict = 1;
bkm();
}
});
//zキーを押したらユーザーをお気に入り登録する
//press z to follow
$(window).keydown(function(e) {
if (!$("input[name=word]").is(":focus") && e.which == 90) {
follow();
}
});
*/
// ajaxでブックマークする関数
function bkm() {
var illustid = $("input[name=illust_id").val();
var url = "http://www.pixiv.net/bookmark_add.php?id=" + illustid
var tt = $("input[name=tt]").val();
var type = $("input[name=type]:eq(1)").val();
if ($(".r-18")[0] != null && r18private) {
bkm_restrict = 1;
}
$.ajax({
url: url,
type: 'POST',
dataType: 'json',
data: {
mode: "add",
tt: tt,
id: illustid,
type: type,
from_id: "",
comment: "",
tag: tags,
restrict: bkm_restrict,
success: function() {
$(".edit-bookmark").unbind('click');
$(".add-bookmark").text("Edit Bookmark");
$(".add-bookmark")[0].classList.add("edit-bookmark");
$(".add-bookmark")[0].classList.add("button-on");
$(".edit-bookmark")[0].classList.remove("add-bookmark");
$(".edit-bookmark")[0].classList.remove("_button");
}
},
})
if (tenstars) {
$.ajax({
url: 'http://www.pixiv.net/rpc_rating.php',
type: 'POST',
dataType: 'json',
data: {
mode: "save",
qr: 0,
i_id: illustid,
tt: tt,
score: 10,
u_id: 7809648,
success: function() {
$(".rating").unbind('mousemove');
$(".rating")[0].classList.add("rated");
$(".rating")[0].classList.add("rate-10");
}
},
})
}
}
// ajaxでお気に入り登録する関数
function follow() {
var usr_id = $(".user-link").attr("href");
var usrid = usr_id.match(/\/member.php\?id=([0-9]+)/);
var id = usrid[1];
var tt = $("input[name=tt]").val();
$.ajax({
url: 'http://www.pixiv.net/bookmark_add.php',
type: 'POST',
dataType: 'json',
data: {
mode: "add",
type: "user",
user_id: id,
tt: tt,
from_sid: "",
restrict: follow_restrict,
left_column: "OK",
success: function() {
$("#favorite-preference")[0].remove();
$("#favorite-button").unbind('click');
$("#favorite-button").attr("data-text-follow", "Following");
$("#favorite-button > .text").text("Following");
$("#favorite-button")[0].classList.add("following");
$("#favorite-button")[0].classList.remove("follow");
$(".sprites-follow")[0].classList.add("sprites-checked");
$(".sprites-follow")[0].classList.remove("sprites-follow");
$("#favorite-button")[0].href = "javascript:location.reload()";
}
},
})
}