You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Copyright 2013 Matt Solano http://mattsolano.com
176
+
*
177
+
* Date: Mon February 25 2013
178
+
*/(function(e,t,n,r){vari={init:function(t){varn=e.extend({image:null,width:50,height:50,disabled:!1},t);returnthis.each(function(){vart=e(this),r=n.image,i=t.data("sdb-image");i&&(r=i);r||e.error("There is no image assigned for ScrewDefaultButtons");t.wrap("<div >").css({display:"none"});vars=t.attr("class"),o=t.attr("onclick"),u=t.parent("div");u.addClass(s);u.attr("onclick",o);u.css({"background-image":r,width:n.width,height:n.height,cursor:"pointer"});vara=0,f=-n.height;if(t.is(":disabled")){a=-(n.height*2);f=-(n.height*3)}t.on("disableBtn",function(){t.attr("disabled","disabled");a=-(n.height*2);f=-(n.height*3);t.trigger("resetBackground")});t.on("enableBtn",function(){t.removeAttr("disabled");a=0;f=-n.height;t.trigger("resetBackground")});t.on("resetBackground",function(){t.is(":checked")?u.css({backgroundPosition:"0 "+f+"px"}):u.css({backgroundPosition:"0 "+a+"px"})});t.trigger("resetBackground");if(t.is(":checkbox")){u.on("click",function(){t.is(":disabled")||t.change()});u.addClass("styledCheckbox");t.on("change",function(){if(t.prop("checked")){t.prop("checked",!1);u.css({backgroundPosition:"0 "+a+"px"})}else{t.prop("checked",!0);u.css({backgroundPosition:"0 "+f+"px"})}})}elseif(t.is(":radio")){u.addClass("styledRadio");varl=t.attr("name");u.on("click",function(){!t.prop("checked")&&!t.is(":disabled")&&t.change()});t.on("change",function(){if(t.prop("checked")){t.prop("checked",!1);u.css({backgroundPosition:"0 "+a+"px"})}else{t.prop("checked",!0);u.css({backgroundPosition:"0 "+f+"px"});varn=e('input[name="'+l+'"]').not(t);n.trigger("radioSwitch")}});t.on("radioSwitch",function(){u.css({backgroundPosition:"0 "+a+"px"})});varc=e(this).attr("id"),h=e('label[for="'+c+'"]');h.on("click",function(){u.trigger("click")})}if(!e.support.leadingWhitespace){varc=e(this).attr("id"),h=e('label[for="'+c+'"]');h.on("click",function(){u.trigger("click")})}})},check:function(){returnthis.each(function(){vart=e(this);i.isChecked(t)||t.change()})},uncheck:function(){returnthis.each(function(){vart=e(this);i.isChecked(t)&&t.change()})},toggle:function(){returnthis.each(function(){vart=e(this);t.change()})},disable:function(){returnthis.each(function(){vart=e(this);t.trigger("disableBtn")})},enable:function(){returnthis.each(function(){vart=e(this);t.trigger("enableBtn")})},isChecked:function(e){returne.prop("checked")?!0:!1}};e.fn.screwDefaultButtons=function(t,n){if(i[t])returni[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeoft=="object"||!t)returni.init.apply(this,arguments);e.error("Method "+t+" does not exist on jQuery.screwDefaultButtons")};returnthis})(jQuery);
0 commit comments