Skip to content

Instantly share code, notes, and snippets.

@tumugin
Created January 17, 2017 06:22
Show Gist options
  • Select an option

  • Save tumugin/d653ecdbdef078d2ef7ada5cb4122643 to your computer and use it in GitHub Desktop.

Select an option

Save tumugin/d653ecdbdef078d2ef7ada5cb4122643 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name pixivで即ブックマークするやつ
// @namespace http://myskng.xyz/
// @version 0.1
// @description モバイル版みたいにすぐにブックマークできるようにするやつ
// @author myskng
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js
// @resource toastr https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css
// @match http://www.pixiv.net/member_illust.php*
// @grant GM_getResourceText
// @grant GM_addStyle
// ==/UserScript==
(function() {
'use strict';
//load style
var style = GM_getResourceText('toastr');
GM_addStyle(style);
//add button to pixiv page
if($(".edit-bookmark").length == 0) $(".bookmark-container").append('<a href="javascript:void(0)" id="us_bookmark" class="_button">即ブックマークする</a>');
//add click event
$('#us_bookmark').on('click',function(){
$.ajax({
type: "POST",
url: "http://www.pixiv.net/bookmark_add.php?id=" + pixiv.context.illustId,
data: {"mode":"add",
"tt":pixiv.context.token,
"id":pixiv.context.illustId,
"type":"illust",
"from_sid":"",
"comment":"",
"tag":"",
"restrict":"0"},
success: function(j_data){
toastr["success"]("ブックマークに追加しました");
$('#us_bookmark').hide();
}
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment