/* MARKUP */ $.fn.uaImg = function(options) {//used for showing images from drive, such as UA Logo, etc. options = $.extend({ bInform: false //inform when done },options); this. on(EV_SET,function(ev) { ev.stopImmediatePropagation(); $(this).data("src",ev.uaData.data.src); $(this).trigger($.Event(EV_NEXT,{uaData:{info:EV_SET}})); }). on(EV_CLEAR,function(ev) { ev.stopImmediatePropagation(); $(this).removeAttr('src').css({display:'none',opacity:OPACITY_MIN}); $(this).trigger($.Event(EV_NEXT,{uaData:{info:EV_CLEAR}})); }). on(EV_SHOW,function(ev) { ev.stopImmediatePropagation(); switch(ev.uaData.data.bShow) { case false: switch($(this).css('display')) { case 'none': $(this).trigger($.Event(EV_NEXT,{uaData:{info:EV_SHOW,data:{bShow:false}}})); break; default: $(this).animate({ opacity:OPACITY_MIN },'fast',function() { $(this).css({display:'none'}); $(this).trigger($.Event(EV_NEXT,{uaData:{info:EV_SHOW,data:{bShow:false}}})); }); break; }; break; default://show switch($(this).css('display')) { case 'none': $(this).css({display:'block'}).animate({ opacity:OPACITY_MAX },'fast',function() { $(this).trigger($.Event(EV_NEXT,{uaData:{info:EV_SHOW,data:{bShow:true}}})); }); break; default: $(this).trigger($.Event(EV_NEXT,{uaData:{info:EV_SHOW,data:{bShow:true}}})); break; }; break; };//switch(ev.uaData.data.bShow) }). on(EV_LOAD,function(ev) { ev.stopImmediatePropagation(); $(this).attr({src:$(this).data('src')}); }). on('load',function(ev) {//image loaded ev.stopImmediatePropagation(); $(this).trigger($.Event(EV_NEXT,{uaData:{info:EV_LOAD}})); }). on(EV_NEXT,function(ev) { ev.stopImmediatePropagation(); switch(ev.uaData.info) { case EV_SET: $(this).trigger($.Event(EV_SHOW,{uaData:{data:{bShow:false}}})); break; case EV_SHOW: switch(ev.uaData.data.bShow) { case false: $(this).trigger($.Event(EV_CLEAR)); break; default: if(options.bInform) { $(this).trigger($.Event(EV_EXTERN,{uaData:{info:EV_DONE}})); };//if break; }; break; case EV_CLEAR: $(this).trigger($.Event(EV_LOAD)); break; case EV_LOAD: $(this).trigger($.Event(EV_SHOW,{uaData:{data:{bShow:true}}})); break; default: break; } }); return this; };