Skip to content

Instantly share code, notes, and snippets.

@t-ashula
Created November 22, 2009 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t-ashula/240378 to your computer and use it in GitHub Desktop.
Save t-ashula/240378 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name - Twitter List Delete
// @include http://twitter.com/*
// @author - t.ashula
// ==/UserScript==
(function(){
if ( $("#admin_list a.destroy-list") ) {
$("#admin_list a.destroy-list").unbind('click');
$.fn.isDestroyListLink=function(){
return this.click(function(D){
var C=$(this);
var A=C.next("form");
var B=A.attr("action");
if(confirm(_("Are sure you want to delete this list? There is NO undo!"))){
$.ajax({
url:B, type:"POST",
dataType:"json",
data:{
_method:'delete',
authenticity_token:twttr.form_authenticity_token,
twttr:true
},
beforeSend:function(){C.disable()},
success:function(){document.location="/"},
error:function(){alert('delete error');C.enable()}
})
}
return false})
}
$("#admin_list a.destroy-list").isDestroyListLink();
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment