UNPKG

jqt

Version:

Create powerful mobile apps with just HTML, CSS, and Zepto.js (or jQuery).

1 lines 2.15 kB
!function(a){function b(b){var c=a(this),d=a("#jqt");return c.addClass("transition").removeClass("shown").one("webkitTransitionEnd",function(a){a.target===this&&(c.removeClass("transition"),!b||b.apply(this,arguments))}),d.addClass("transition").removeClass("modal").find(".current").one("webkitTransitionEnd watchdog",function(a){a.target===this&&d.removeClass("transition")}).each(function(){var b=a(this);setTimeout(function(){b.trigger("watchdog")},500)}),c}function c(b){var c=a(this),d=a("#jqt");return c.addClass("transition").one("webkitTransitionEnd",function(a){a.target===this&&(c.removeClass("transition"),!b||b.apply(this,arguments))}),d.addClass("transition").find(".current").one("webkitTransitionEnd",function(a){a.target===this&&d.removeClass("transition")}),setTimeout(function(){c.addClass("shown"),d.addClass("modal")},25),c}var d=a("head script").last().attr("src")||"",e=d.split("?")[0].split("/").slice(0,-1).join("/")+"/",f=e+"jqt.actionsheet.css",g=a('<link href="'+f+'" rel="stylesheet">');a("head").append(a(g));var h={init:function(){a(this).addClass("actionsheet")},show:c,hide:b};a.fn.actionsheet=function(b){if(h[b]){if(a(this).is(".actionsheet"))return h[b].apply(this,Array.prototype.slice.call(arguments,1));var c="Target is not a `actionsheet`. Action `"+b+"` is ignored.";console.warn(c)}else{if("object"==typeof b||!b)return h.init.apply(this,arguments);a.error('Method "'+b+'" does not exist on jqt.actionsheet')}},a.jQT?(a.jQT.addTapHandler({name:"open-actionsheet",isSupported:function(a,b){return b.$el.is(".action")},fn:function(b,c){c.$el.closest(".active").removeClass("active");var d=a(c.hash);return d.actionsheet("show"),!1}}),a.jQT.addTapHandler({name:"follow-actionlink",isSupported:function(b,c){return a("#jqt > .actionsheet.shown").length>0?c.$el.is(".actionsheet a"):!1},fn:function(a,b){b.$el.closest(".active").removeClass("active");var c=b.$el.closest(".actionsheet");return c.actionsheet("hide",function(){b.$el.is(".dismiss")||(b.$el.trigger("tap"),setTimeout(function(){b.$el.removeClass("active")},100))}),!1}})):console.error("Extension `jqt.actionsheet` failed to load. jQT not found")}($);