Skip to content

Instantly share code, notes, and snippets.

@solar
Last active August 29, 2015 14:14
Show Gist options
  • Save solar/e15e35e61f6d8acf5d87 to your computer and use it in GitHub Desktop.
Save solar/e15e35e61f6d8acf5d87 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name unset_card_from_deck
// @namespace sazabi.org
// @include http://*.3gokushi.jp/card/deck.php*
// @version 1.0
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// @grant none
// ==/UserScript==
(function() {
jQuery.noConflict();
var j$ = jQuery;
var data = {
mode: 'unset',
ssid: j$('#ssid').val(),
p: j$('#p').val(),
l: j$('#l').val()
};
j$('div.cardColmn > div.control > div.clearfix').each(function() {
var v = j$(this);
j$(this).find('a:first > img').removeAttr('onclick').click(function() {
var cid = v.find('dl.set_status > dd:last > a')
.attr('href').match(/card_id%3D(\d+)/)[1];
data['target_card'] = v.find('dl.set_status > dd:last > a')
.attr('href').match(/card_id%3D(\d+)/)[1];
if (confirm(j$(this).attr('title'))) {
var now = j$(this).parent().css('display', 'none')
.after('<div>').next().css('display', 'inline')
.css('height', '33px')
.addClass('btn_deck_set').addClass('unsetting_now')
.text('解除中');
j$.post('/card/deck.php', data, function(r) {
var notice = j$(r).find('.notice').text();
if (notice.replace(/\s+/, '') == '') {
now.removeClass('unsetting_now').text('解除完了')
.css('color', 'blue').css('cursor', 'pointer')
.click(function() {
j$(this).text('ページ更新中');
location.reload();
});
} else {
alert(notice);
}
});
}
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment