{"size": 18303, "ext": "js", "max_stars_repo_path": "thunder-1.1.0.min.js", "max_stars_repo_name": "mnieves076/thunder", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "thunder-1.1.0.min.js", "max_issues_repo_name": "mnieves076/thunder", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "thunder-1.1.0.min.js", "max_forks_repo_name": "mnieves076/thunder", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 18303.0, "max_line_length": 18303, "alphanum_fraction": 0.7299349833}
var Thunder={};Thunder.VERSION="1.0.9";Thunder.DEBUG=false;Thunder.ID=0;Thunder.VERTICAL=0;Thunder.HORIZONTAL=1;var scripts=document.getElementsByTagName("script");var i=scripts.length;while(i--){var match=scripts[i].src.match(/(^|.*\/)thunder-(.*)\.js$/);if(match){Thunder.ROOT=match[1]}}(function(){var a=false,b=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.BaseObject=function(){};BaseObject.extend=function(g){var f=this.prototype;a=true;var e=new this();a=false;for(var d in g){e[d]=typeof g[d]==="function"&&typeof f[d]==="function"&&b.test(g[d])?(function(h,j){return function(){var l=this._super;this._super=f[h];var k=j.apply(this,arguments);this._super=l;return k}})(d,g[d]):g[d]}function c(){if(!a&&this.init){this.init.apply(this,arguments)}}c.prototype=e;c.prototype.constructor=c;c.extend=arguments.callee;return c}})();(function(){Thunder.Object=BaseObject.extend({init:function(){this.listeners=[];this.responders={};this.eventQueue=new Thunder.EventQueue(this,this.handleEvents,0)},handleEvents:function(c){for(var b=0,d=c.length;b<d;b++){var a=this.responders[c[b].name];if(typeof a!="undefined"){a.apply(this,[c[b]])}}},addListener:function(a){this.listeners.push(a)},removeListener:function(a){for(var b=0,c=this.listeners.length;b<c;b++){if(this.listeners[b]===a){this.listeners.splice(b,1);return true}}return false},removeListeners:function(){for(var a=0,b=this.listeners.length;a<b;a++){this.listeners[a]=null}this.listeners=[]},addResponder:function(b,a){this.responders[b]=a},removeResponder:function(a){delete this.responders[a]},removeResponders:function(){this.responders={}},broadcastEvent:function(e,a,d){if(typeof d=="undefined"){d=0}for(var b=0,c=this.listeners.length;b<c;b++){this.listeners[b].addEvent(e,d,this,a)}},broadcastUniqueEvent:function(e,a,d){if(typeof d=="undefined"){d=0}for(var b=0,c=this.listeners.length;b<c;b++){this.listeners[b].addUniqueEvent(e,d,this,a)}},trace:function(a){if(window.console&&Thunder.DEBUG){console.log(a)}}})})();(function(){Thunder.DisplayObject=Thunder.Object.extend({init:function(a){this._super();this.container=a;this.position=new Thunder.Point(0,0);this.isVisible=true;this.alpha=1;this.width=0;this.height=0;this.eventMap=null},move:function(a,c){if(this.container!==null){var b=this.container.position();this.container.css("top",b.top+c);this.container.css("left",b.left+a)}this.position.addValues(a,c)},setPosition:function(b,a){if(this.container!==null){this.container.css("top",a);this.container.css("left",b)}this.position.setValues(b,a)},getPosition:function(){if(this.container!==null){var a=this.container.position();this.position.setValues(a.left,a.top)}return this.position},getX:function(){return this.position.x},setX:function(a){if(this.container!==null){this.container.css({left:a})}this.position.x=a},getY:function(){return this.position.y},setY:function(a){if(this.container!==null){this.container.css({top:a})}this.position.y=a},setVisible:function(a){this.isVisible=a;if(this.container!==null){if(this.isVisible){this.container.css("display","")}else{this.container.css("display","none")}}},getVisible:function(){return this.isVisible},setWidth:function(a){if(!isNaN(a)){if(this.container!==null){this.container.width(a)}this.width=a}},getWidth:function(){return this.width},setHeight:function(a){if(!isNaN(a)){if(this.container!==null){this.container.height(a)}this.height=a}},getHeight:function(){return this.height},setMask:function(d,b,a,c){if(this.container!==null){if(!isNaN(d)&&!isNaN(b)&&!isNaN(a)&&!isNaN(c)){this.container.css("clip","rect("+d+"px,"+b+"px,"+a+"px,"+c+"px)")}}},setAlpha:function(a){if(this.container!==null){this.container.css("opacity",a)}this.alpha=a},getAlpha:function(){return this.alpha},setContainer:function(a){this.container=a},getContainer:function(){return this.container},rotate:function(a){this.container.css("rotate",a+"deg");this.container.css("-webkit-transform","rotate("+a+"deg)");this.container.css("-moz-transform","rotate("+a+"deg)")},setZIndex:function(a){this.container.css("z-index",a)},mapEvents:function(a){if(this.eventMap!=null){this.unMapEvents()}this.eventMap=new Thunder.EventMap(this.container,this,a);return this},unMapEvents:function(){if(this.eventMap!=null){this.eventMap.unMapEvents();return true}else{return false}},getEventMap:function(){return this.eventMap}})})();(function(){Thunder.Component=Thunder.DisplayObject.extend({init:function(a){this._super(a);this.customizers={};this.assetManager=new Thunder.AssetManager();this.layerManager=new Thunder.LayerManager(this.container,this.handleCustomization,this)},handleCustomization:function(a){for(var b=0,d=a.length;b<d;b++){var c=this.customizers[a[b].type];if(typeof c!="undefined"){c.apply(this,[a[b]])}}},addCustomizer:function(a,b){this.customizers[a]=b},removeCustomizer:function(a){delete this.customizers[a]},setContainer:function(a){this.container=a;this.layerManager.setContainer(this.container)}})})();(function(){Thunder.Event=function(b,c,d,a){this.name=b;this.delay=(new Date()).getTime()+c;this.owner=d;this.eventObject=a};Thunder.Event.prototype={getName:function(){return this.name},getLocalEventPosition:function(){var b=this.eventObject;if(typeof this.eventObject.originalEvent.touches!="undefined"||typeof this.eventObject.originalEvent.changedTouches!="undefined"){b=this.eventObject.originalEvent.touches[0]||this.eventObject.originalEvent.changedTouches[0]}var a=b.pageX-this.owner.container.offset().left;var c=b.pageY-this.owner.container.offset().top;return new Thunder.Point(a,c)}}})();(function(){Thunder.EventMap=function(c,a,b){this.container=c;this.owner=a;this.eventQueue=b;this.mapEvents();if(!Thunder.DEBUG){$(document).on("contextmenu",function(d){return false})}};Thunder.EventMap.prototype={mapEvents:function(){var a=this;this.container.on("mouseup",function(b){a.eventQueue.addEvent("MOUSEUP",0,a.owner,b);return false});this.container.on("mousedown",function(b){a.eventQueue.addEvent("MOUSEDOWN",0,a.owner,b);return false});this.container.on("mouseenter",function(b){a.eventQueue.addEvent("MOUSEENTER",0,a.owner,b);return false});this.container.on("mouseleave",function(b){a.eventQueue.addEvent("MOUSELEAVE",0,a.owner,b);return false});this.container.on("dblclick",function(b){a.eventQueue.addEvent("DOUBLECLICK",0,a.owner,b);return false});this.container.on("touchstart",function(b){b.preventDefault();a.eventQueue.addEvent("MOUSEDOWN",0,a.owner,b);return false});this.container.on("touchend",function(b){b.preventDefault();a.eventQueue.addEvent("MOUSEUP",0,a.owner,b);return false});this.container.on("tap",function(b){b.preventDefault();a.eventQueue.addEvent("MOUSEUP",0,a.owner,b);return false})},unMapEvents:function(){this.container.off("mouseup");this.container.off("mousedown");this.container.off("mouseenter");this.container.off("mouseleave");this.container.off("dblclick");this.container.off("touchstart");this.container.off("touchend");this.container.off("tap")},mapMouseMoveEvent:function(){var a=this;this.container.on("mousemove",function(b){a.eventQueue.addUniqueEvent("MOUSEMOVE",10,a.owner,b);return false});this.container.on("touchmove",function(b){b.preventDefault();a.eventQueue.addUniqueEvent("MOUSEMOVE",10,a.owner,b);return false})},unMapMouseMoveEvent:function(){this.container.off("mousemove");this.container.off("touchmove")}}})();(function(){Thunder.KeyEventMap=function(b,a){this.container=b;this.eventQueue=a;this.keyMap=[];this.mapKeyEvents()};Thunder.KeyEventMap.prototype={mapKeyEvents:function(){var a=this;this.container.keypress(function(c){if(c.keyCode){var b=c.keyCode}else{if(c.which){var b=c.which}else{return}}a.onKeyDown(b)})},unMapKeyEvents:function(){this.container.off("keypress")},mapKey:function(b,a){this.keyMap[b]=a},onKeyDown:function(b){var a=this.keyMap[b];if(typeof a!="undefined"){this.eventQueue.addEvent(a,0,{keyCode:b})}else{this.eventQueue.addEvent("KEYUP",0,{keyCode:b})}}}})();(function(){Thunder.EventQueue=function(a,b){this.callBackObject=a;this.callBackFunction=b;this.eventList=[];this.eventTimer=null};Thunder.EventQueue.prototype={addEvent:function(c,d,a,b){if(!d){d=0}if(c!==null&&c!==""){this.eventList.push(new Thunder.Event(c,d,a,b));this.exitIdleState()}},addUniqueEvent:function(c,d,a,b){this.removeEvent(c);this.addEvent(c,d,a,b)},eventInQueue:function(a){for(var b=0,c=this.eventList.length;b<c;b++){if(this.eventList[b].name===a){return true}}return false},removeEvent:function(a){for(var b=0,c=this.eventList.length;b<c;b++){if(this.eventList[b].name===a){this.eventList.splice(b,1);this.removeEvent(a);return true}}this.enterIdleState();return false},removeAllEvents:function(){this.eventList=[];this.enterIdleState()},getNextEvent:function(){if(this.eventList.length>0){var a=this.eventList.shift();if((new Date()).getTime()>=a.delay){return a}else{this.eventList.push(a)}}else{this.enterIdleState()}return null},getEvents:function(){var a=[];var d=[];var e=(new Date()).getTime();for(var b=0,c=this.eventList.length;b<c;b++){if(e>=this.eventList[b].delay){d.push(this.eventList[b])}else{a.push(this.eventList[b])}}this.eventList=a.concat();this.enterIdleState();return d},enterIdleState:function(){if(this.eventList.length===0){if(this.eventTimer!==null){clearInterval(this.eventTimer);this.eventTimer=null}return true}return false},exitIdleState:function(){if(this.eventList.length>0&&this.eventTimer==null){var a=this;this.eventTimer=setInterval(function(){a.callBackFunction.apply(a.callBackObject,[a.getEvents()])},10)}}}})();(function(){Thunder.Layer=Thunder.DisplayObject.extend({init:function(d,a,c,b){this._super(d);this.surface=a;this.layerSetName=c;this.layerId=b},clear:function(){this.surface.empty()},addAssets:function(a){for(var c=0,d=a.length;c<d;c++){var b="THUNDER_ASSET_"+Thunder.ID++;var e=$("<div>",{id:b,"class":"THUNDER_ASSET",css:{position:"absolute",top:a[c].getY()+"px",left:a[c].getX()+"px",width:(typeof a[c].width!="undefined")?a[c].width+"px":"auto",height:(typeof a[c].height!="undefined")?a[c].height+"px":"auto"}}).appendTo(this.surface);a[c].setContainer(e)}},setMask:function(d,b,a,c){if(this.container!==null){if(!isNaN(d)&&!isNaN(b)&&!isNaN(a)&&!isNaN(c)){this.container.css({width:b,height:a,overflow:"hidden"})}}}})})();(function(){Thunder.LayerManager=function(c,b,a){this.container=c;this.callBackFunction=b;this.callBackObject=a;this.layers={sets:{},layer:null};this.index=0};Thunder.LayerManager.prototype={layOut:function(a,b){var c=this.get(b).layer;if(c!=null){c.clear();c.addAssets(a);this.callBackFunction.apply(this.callBackObject,[a])}return c},addToLayOut:function(a,b){var c=this.get(b).layer;if(c!=null){c.addAssets(a);this.callBackFunction.apply(this.callBackObject,[a])}return c},getLayerObject:function(a){return this.get(a).layer},getLayerObjects:function(c){var a=this.get(c);if(a!=null){var b=(a.layer==null)?[]:[a.layer];b=b.concat(this.getChildLayers(a.sets));return b}else{return[]}},getChildLayers:function(a){var b=[];for(r in a){b.push(a[r].layer);b=b.concat(this.getChildLayers(a[r].sets))}return b},addLayer:function(e){var a="THUNDER_LAYER_"+Thunder.ID++;var b="THUNDER_LAYER_SURFACE_"+Thunder.ID++;var d=$("<div>",{id:b,"class":"THUNDER_LAYER_SURFACE",css:{position:"absolute",top:"0px",left:"0px"}});var c=$("<div>",{id:a,"class":"THUNDER_LAYER",name:e,css:{position:"absolute",top:"0px",left:"0px"}});d.appendTo(c.appendTo(this.container));this.get(e).layer=new Thunder.Layer(c,d,e,a)},get:function(d){if(d=="/"){return this.layers}var b=d.replace(/^\/|\/$/g,"").split("/");var a=this.layers.sets;var c=null;for(s in b){if(!a.hasOwnProperty(b[s])){a[b[s]]={sets:{},layer:null}}c=a[b[s]];a=c.sets}return c},clearSet:function(d){var c=this.getLayerObjects(d);for(var a=0,b=c.length;a<b;a++){c[a].clear()}},clearLayer:function(a){var b=this.get(a);if(b!=null){b.layer.clear()}},clearAll:function(){var c=this.getChildLayers(this.layers.sets);for(var a=0,b=c.length;a<b;a++){c[a].clear()}},setLayerSetPosition:function(e,b){var d=this.getLayerObjects(e);for(var a=0,c=d.length;a<c;a++){d[a].setPosition(b.x,b.y)}},moveLayerSet:function(e,f){var d=this.getLayerObjects(e);for(var b=0,c=d.length;b<c;b++){var a=d[b].getPosition().addPoint(f);d[b].move(a.x,a.y)}},setVisible:function(a,c){var b=this.get(a).layer;if(b!=null){b.setVisible(c)}},setLayerMask:function(e,d,b,a,c){var f=this.get(e).layer;if(f!=null){f.setMask(d,b,a,c)}},setContainer:function(a){this.container.children().appendTo(a);this.container=a},moveToLayer:function(c,a,b){var d=this.get(c).layer;if(d!=null){if(b){a.appendTo(d.surface).insertBefore(d.surface.find(".THUNDER_ASSET").first())}else{a.appendTo(d.surface)}return true}return false}}})();(function(){Thunder.Cookie=function(){};Thunder.Cookie.prototype={create:function(c,d,e){if(e){var b=new Date();b.setTime(b.getTime()+(e*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}document.cookie=c+"="+d+a+"; path=/"},read:function(b){var f=b+"=";var a=document.cookie.split(";");for(var d=0,e=a.length;d<e;d++){var g=a[d];while(g.charAt(0)===" "){g=g.substring(1,g.length)}if(g.indexOf(f)===0){return g.substring(f.length,g.length)}}return null},erase:function(a){this.create(a,"",-1)}}})();(function(){Thunder.Point=function(b,a){this.x=b;this.y=a};Thunder.Point.prototype={addPoint:function(a){this.x+=a.x;this.y+=a.y;return this},addValues:function(b,a){this.x+=b;this.y+=a;return this},setValues:function(b,a){this.x=b;this.y=a;return this},equals:function(a){if(this.x===a.x&&this.y===a.y){return true}return false},getDistance:function(a){return Math.sqrt((this.x-a.x)*(this.x-a.x)+(this.y-a.y)*(this.y-a.y))},getAngle:function(c){var b=270+(Math.atan2(this.y-c.y,this.x-c.x)*(180/Math.PI));if(b>360){return b-360}return b},getCopy:function(){return new Thunder.Point(this.x,this.y)},toString:function(){return"("+this.x+","+this.y+")"}}})();(function(){Thunder.Asset=Thunder.DisplayObject.extend({init:function(c,d,a,b){this._super(null);this.group=null;this.type=null;this.groupArray=[];this.typeArray=[];this.setGroups(c);this.setTypes(d);this.src=a;this.tag=b;this.width=null;this.height=null;this.param=null},attach:function(a){if(this.container!==null){this.container.append(a)}},getName:function(){return this.name},setSize:function(b,a){this.width=b;this.height=a},getWidth:function(){return this.width},getHeight:function(){return this.height},setParam:function(a){this.param=a},setGroups:function(a){if(typeof a=="string"){this.group=a;this.groupArray=this.group.split("|")}},getGroup:function(){return this.group},getGroupArray:function(){return this.groupArray},setTypes:function(a){if(typeof a=="string"){this.type=a;this.typeArray=this.type.split("|")}},getType:function(){return this.type},getTypeArray:function(){return this.typeArray}})})();(function(){Thunder.AssetManager=function(c,d,a,b){this.assetList={};this.assetTagList=[]};Thunder.AssetManager.prototype={addAsset:function(m,b,e,d,o,n,a,l,c){var f=new Thunder.Asset(m,b,e,d);if(typeof o!="undefined"&&typeof n!="undefined"){f.setPosition(o,n)}f.setSize(a,l);f.setParam(c);for(var h=0,k=f.groupArray.length;h<k;h++){if(typeof this.assetList[f.groupArray[h]]=="undefined"){this.assetList[f.groupArray[h]]={}}for(var p=0,j=f.typeArray.length;p<j;p++){if(typeof this.assetList[f.groupArray[h]][f.typeArray[p]]=="undefined"){this.assetList[f.groupArray[h]][f.typeArray[p]]=[]}this.assetList[f.groupArray[h]][f.typeArray[p]].push(f)}}this.assetTagList[f.tag]=f;return f},removeAssets:function(k,h){var d=[];var a=[];if(typeof k!="undefined"){d=k.split("|")}if(typeof h!="undefined"){a=h.split("|")}for(var e=0,j=d.length;e<j;e++){if(typeof this.assetList[d[e]]!="undefined"){if(a.length==0){for(var m in this.assetList[d[e]]){if(typeof m!="undefined"){for(var c=0;c<this.assetList[d[e]][m].length;c++){delete this.assetTagList[this.assetList[d[e]][m][c].tag]}}}delete this.assetList[d[e]]}else{for(var m=0,f=a.length;m<f;m++){var b=this.assetList[d[e]][a[m]];if(typeof b!="undefined"){for(var c=0,l=b.length;c<l;c++){delete this.assetTagList[b[c].tag]}}delete this.assetList[d[e]][a[m]]}}}}},removeAsset:function(j){var c=this.assetTagList[j];var k=0;if(typeof c!="undefined"){var a=c.getGroupArray();for(var e=0,f=a.length;e<f;e++){for(var h in this.assetList[a[e]]){var b=this.assetList[a[e]][h];for(var d=0;d<b.length;d++){if(b[d].tag===j){b.splice(d--,1)}}}}delete this.assetTagList[j];k=1}return k},getAssets:function(j,f){var l=[];var c=[];var a=[];if(typeof j!="undefined"){c=j.split("|")}if(typeof f!="undefined"){a=f.split("|")}for(var d=0,h=c.length;d<h;d++){if(typeof this.assetList[c[d]]!="undefined"){if(a.length==0){for(var k in this.assetList[c[d]]){if(typeof k!="undefined"){l=l.concat(this.assetList[c[d]][k])}}}else{for(var k=0,e=a.length;k<e;k++){var b=this.assetList[c[d]][a[k]];if(typeof b!="undefined"){l=l.concat(b)}}}}}return l},getAsset:function(a){var b=this.assetTagList[a];if(typeof b!="undefined"){return b}return null},stack:function(b,f,a,g,e){for(var c=0,d=b.length;c<d;c++){b[c].setX(a);b[c].setY(g);if(f===Thunder.VERTICAL){a=a;g=g+b[c].height+e}else{if(f===Thunder.HORIZONTAL){a=a+b[c].width+e;g=g}}}return b},getStackedSize:function(a,f,e){var g=0;for(var b=0,c=a.length;b<c;b++){if(f===Thunder.VERTICAL){g+=a[b].height+e}else{if(f===Thunder.HORIZONTAL){g+=a[b].width+e}}}return g}}})();(function(){Thunder.XMLDataManager=Thunder.Object.extend({init:function(a){this._super();this.xml=null;this.data=[];if(a==null){this.readyEvent="XML_DATA_READY"}else{this.readyEvent=a}},load:function(b){var a=this;$.get(b,function(c){a.xml=c;a.process(a.xml,a.data);a.broadcastEvent(a.readyEvent)})},parse:function(b){try{this.xml=$.parseXML(b)}catch(a){this.xml=null}},process:function(g,h){for(var e=0,f=g.childNodes.length;e<f;e++){switch(g.childNodes[e].nodeName){default:if(g.childNodes[e].nodeType===3||g.childNodes[e].nodeType==4){var c=$.trim(g.childNodes[e].nodeValue);if(c.length>0){h.TEXT=c}}else{if(g.childNodes[e].nodeType==1){if(h[g.childNodes[e].nodeName]==null){h[g.childNodes[e].nodeName]=[]}h[g.childNodes[e].nodeName].push([]);var d=h[g.childNodes[e].nodeName].length-1;if(g.childNodes[e].hasChildNodes()){this.process(g.childNodes[e],h[g.childNodes[e].nodeName][d])}for(var b=0,j=g.childNodes[e].attributes.length;b<j;b++){h[g.childNodes[e].nodeName][d][g.childNodes[e].attributes[b].name]=g.childNodes[e].attributes[b].value}}}}}}})})();