Pixiv ajax bookmark and follow mod

You can bookmark without going to the related pages. ブックマークとお気に入り登録をページ遷移なく非同期的に行います。

目前為 2017-08-30 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Pixiv ajax bookmark and follow mod
  3. // @namespace
  4. // @version 1.7.0
  5. // @description You can bookmark without going to the related pages. ブックマークとお気に入り登録をページ遷移なく非同期的に行います。
  6. // @include http://www.pixiv.net/member_illust.php*
  7. // @include https://www.pixiv.net/member_illust.php*
  8. // @exclude http://www.pixiv.net/member*mode=manga*
  9. // @exclude https://www.pixiv.net/member*mode=manga*
  10. // @copyright 2014+, qa2
  11. // @author qa2 & SaddestPanda
  12. // @grant none
  13. // @namespace
  14. // ==/UserScript==
  15.  
  16. //When you add an illustration to bookmarks also give it a like.
  17. // 1 でしたらブックマークした時、同時に「いいね!」もします。
  18. var givelike = 1;
  19.  
  20. //R18 illustrations are added as private bookmarks.
  21. // 1 でしたらイラストはR-18であった場合プライベートブックマークにします。
  22. var r18private = 1;
  23.  
  24. // If set to "1": Always add to private bookmarks list.
  25. //ブックマークする作品をいつも非公開にするかどうか 0:公開 1:非公開
  26. var bkm_restrict = 0;
  27.  
  28. //Add all tags to the bookmark.
  29. //作品に登録されているすべてのタグをブックマークタグとして追加
  30. var tags = "";
  31. $(".tag > .text").each(function() {
  32. tags += $(this).text() + " ";
  33. });
  34.  
  35.  
  36. $(".add-bookmark").click(function(e){
  37. //e.preventDefault();
  38. bkm();
  39. return false;
  40. });
  41.  
  42.  
  43. //Keybindings from the old script. Maybe you want these.
  44. /*
  45.  
  46. //eキーを押すとブクマする
  47. //press e to bookmark
  48. $(window).keydown(function(e) {
  49. if (!$("input[name=word]").is(":focus") && e.which == 69) {
  50. bkm();
  51. }
  52. });
  53.  
  54. //press R to private bookmark
  55. $(window).keydown(function(e) {
  56. if (!$("input[name=word]").is(":focus") && e.which == 82) {
  57. bkm_restrict = 1;
  58. bkm();
  59. }
  60. });
  61.  
  62. */
  63.  
  64. // ajaxでブックマークする関数
  65. function bkm() {
  66.  
  67. var illustid = $("input[name=illust_id").val();
  68. var url = "https://www.pixiv.net/bookmark_add.php?id=" + illustid;
  69. var tt = $("input[name=tt]").val();
  70. //var type = $("input[name=type]:eq(1)").val();
  71. var type = "illust";
  72.  
  73. if ($(".r-18")[0] != null && r18private) {
  74. bkm_restrict = 1;
  75. }
  76.  
  77. $.ajax({
  78. url: url,
  79. type: 'POST',
  80. dataType: 'json',
  81. data: {
  82. mode: "add",
  83. tt: tt,
  84. id: illustid,
  85. type: type,
  86. from_sid: "",
  87. comment: "",
  88. tag: tags,
  89. restrict: bkm_restrict,
  90. success: function() {
  91. $(".edit-bookmark").unbind('click');
  92. if ($(".add-bookmark").text() == "ブックマークに追加") {
  93. $(".add-bookmark").text("ブックマークを編集");
  94. } else {
  95. $(".add-bookmark").text("Edit Bookmark");
  96. }
  97. $(".add-bookmark")[0].classList.add("bookmarked");
  98. $(".add-bookmark")[0].classList.add("edit-bookmark");
  99. $(".edit-bookmark")[0].classList.remove("add-bookmark");
  100. }
  101. },
  102. });
  103.  
  104. if (givelike) {
  105. $("._nice-button").click();
  106. }
  107. }
  108.