Pixiv ajax bookmark mod

You can bookmark without going to the related pages. ページ遷移なく非同期的にブックマークします。

Versión del día 20/03/2018. Echa un vistazo a la versión más reciente.

// ==UserScript==
// @name             Pixiv ajax bookmark mod
// @namespace 
// @version          1.9.3
// @description      You can bookmark without going to the related pages. ページ遷移なく非同期的にブックマークします。
// @include          http://www.pixiv.net/member_illust.php*
// @include          https://www.pixiv.net/member_illust.php*
// @exclude          http://www.pixiv.net/member*mode=manga*
// @exclude          https://www.pixiv.net/member*mode=manga*
// @homepage https://greasyfork.dpdns.org/en/scripts/22767-pixiv-ajax-bookmark-mod
// @supportURL https://greasyfork.dpdns.org/en/scripts/22767-pixiv-ajax-bookmark-mod/feedback
// @author           qa2 & SaddestPanda
// @grant            none
// ==/UserScript==

//When you add an illustration to bookmarks also give it a like.
// 1 でしたらブックマークした時、同時に「いいね!」もします。
var givelike = 1;

//R18 illustrations are added as private bookmarks.
// 1 でしたらイラストはR-18であった場合プライベートブックマークにします。
var r18private = 1;

// If set to "1": Always add to private bookmarks list.
//ブックマークする作品をいつも非公開にするかどうか 0:公開 1:非公開
var bkm_restrict = 0;

//Add all tags to the bookmark.
//作品に登録されているすべてのタグをブックマークタグとして追加
var tags = "";
$(".tag > .text").contents().not($('span')).each(function() {
  tags +=  $(this).text() + " ";
});


$(".add-bookmark").on("click", function(){
	//e.preventDefault();
  bkm();
  return false;
});


//Keybindings from the old script. Maybe you want these.
/*

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

*/

// ajaxでブックマークする関数
function bkm() {

  //var illustid = $("input[name=illust_id").val();
  //var tt = $("input[name=tt]").val();
  //var type = $("input[name=type]:eq(1)").val();
  var illustid = pixiv.context.illustId;
  var url = "https://www.pixiv.net/bookmark_add.php?id=" + illustid;
  var tt = pixiv.context.token;
  var type = pixiv.context.type;

  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_sid: "",
      comment: "",
      tag: tags,
      restrict: bkm_restrict,
      success: function() {
        if ($(".add-bookmark").text() == "ブックマークに追加") {
          $(".add-bookmark").html($('<span>', { class: 'description', html: "ブックマークを編集" }));
        } else if ($(".add-bookmark").text() == "添加收藏") {
          $(".add-bookmark").html($('<span>', { class: 'description', html: "编辑收藏" }));
        } else {
          $(".add-bookmark").html($('<span>', { class: 'description', html: "Edit Bookmark" }));
        }
        $(".add-bookmark")[0].classList.add("edit-bookmark");
        $(".add-bookmark")[0].classList.add("bookmarked");
        $(".edit-bookmark")[0].classList.remove("add-bookmark");
      }
    },
  });

  if (givelike) {
    $("._nice-button").trigger("click");
  }
}

长期地址
遇到问题?请前往 GitHub 提 Issues,或加Q群1031348184

赞助商

Fishcpy

广告

Rainyun

注册一下就行

Rainyun

一年攒够 12 元