Pixiv Easyer

A script that makes pixiv great again

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Pixiv Easyer
// @namespace    http://
// @version      1.0
// @description  A script that makes pixiv great again
// @author       DriftKingTW(Pixiv ID:9934873)
// @match        http://www.pixiv.net/member_illust.php?mode=medium&illust_id=*
// @match        http://www.pixiv.net/member_illust.php?mode=manga&illust_id=*
// @match		 http://www.pixiv.net/member.php?id=*
// @require      http://code.jquery.com/jquery-latest.js
// @grant        none
// ==/UserScript==

//sync test
(function() {
	'use strict';

	var bmBtn = $('.bookmark-container a');
	var favBtn = $('#favorite-button');
	var favSubmit = $('input[name="left_column"]');

	var tt = $('input[name="tt"]').val();
	var user_id = $('input[name="user_id"]').val();

	if(bmBtn.attr('class')=='add-bookmark _button'){
		bmBtn.attr('href', 'javascript: void(0);');
		bmBtn.bind('click', ajaxBookmark);
	}
	if(favBtn.attr('class')=='follow'){
		favSubmit.attr('href', 'javascript: void(0);');
		favSubmit.attr('type', 'button');
		favSubmit.bind('click', ajaxFollowUser);
	}

	function ajaxBookmark() {
		bmBtn.text('  Adding...  ');
		// get data
		var id = $('input[name="illust_id"]').val();
		// sent ajax request
		$.ajax( {
			url: 'http://www.pixiv.net/bookmark_add.php',
			type: 'POST',
			data: {
				'mode': 'add',
				'tt': tt,
				'id': id,
				'type': 'illust',
				'from_sid': '',
				'comment': '',
				'tag': '',
				'restrict': 0
			},
			success: function(response) {
				bmBtn.text('Edit Bookmark').attr({ class: 'edit-bookmark button-on',
												  href: 'http://www.pixiv.net/bookmark_add.php?type=illust&illust_id='+id });
			},
			error: function(xhr) {
				alert('ajax request failed!(((゚Д゚;)))');
			}
		});
		bmBtn.unbind('click', ajaxBookmark);
	}

	function ajaxFollowUser() {
		favSubmit.val('  Adding...  ');
		// sent ajax request
		$.ajax( {
			url: 'http://www.pixiv.net/bookmark_add.php',
			type: 'POST',
			data: {
				'mode': 'add',
				'type': 'user',
				'user_id': user_id,
				'tt': tt,
				'from_sid': '',
				'restrict': 0,
				'left_column': 'OK'
			},
			success: function(response) {
				favSubmit.val('Followed');
			},
			error: function(xhr) {
				alert('ajax request failed!(((゚Д゚;)))');
			}
		});
		favSubmit.unbind('click', ajaxFollowUser);
	}
})();