You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4 lines
1.2 KiB
Plaintext

11 months ago
/*! jquery.swipeButton.js - v1.2.1 - 2012-10-06
* http://andymatthews.net/code/swipebutton/
* Copyright (c) 2012 andy matthews; Licensed MIT, GPL */
(function(a){a.fn.swipeDelete=function(b){return b=a.extend({},a.fn.swipeDelete.defaults,b),this.filter("[data-swipeurl]").each(function(c,d){var e=a(d),f=a(d).parent("ul");e.on(b.direction,function(c){var d=a(this),e=a(".ui-btn",d).length;a("div.ui-btn, ."+b.btnClass,f).animate({width:"toggle"},200,function(b){a(this).remove()});if(!e){var g=a("<a>"+b.btnLabel+"</a>").attr({"data-role":"button","data-mini":!0,"data-inline":"true","class":b.btnClass==="aSwipeBtn"?b.btnClass:b.btnClass+" aSwipeBtn","data-theme":b.btnTheme,href:d.data("swipeurl")}).on("click tap",b.click);g.prependTo(d).button(),d.find(".ui-btn").hide().animate({width:"toggle"},200),a("div a:not("+b.btnClass+")",d).on("click.swipe",function(b){b.stopPropagation(),b.preventDefault(),a(this).unbind("click.swipe"),d.removeClass("ui-btn-active").find("div.ui-btn").remove()})}})})},a.fn.swipeDelete.defaults={direction:"swiperight",btnLabel:"Delete",btnTheme:"e",btnClass:"aSwipeBtn",click:function(b){b.preventDefault(),a(this).parents("li").slideUp()}}})(jQuery);