text: var lavaCalendar={init:function(a){var t=this,e=$(a),n=e.data("calendar").options,l=$.fn.lavaCalendar.locales[n.lang];e.addClass("lava-calendar");for(var r=$("<div class='lava-calendar-header' style='background:"+n.color+";'></div>").appendTo(e),d=($("<div class='lava-calendar-prev'>«</div>").appendTo(r),$("<div class='lava-calendar-next'>»</div>").appendTo(r),$("<span></span>").appendTo(r),$("<table class='lava-calendar-table'></table>").appendTo(e)),o=$("<thead class='lava-calendar-thead'></thead>").appendTo(d),i=$("<tbody class='lava-calendar-tbody'></tbody>").appendTo(d),c=["<tr>"],s=0;7>s;s++)c.push("<th style='color:"+n.color+";'>"+l[s]+"</th>");c.push("</tr>");for(var v=[],s=0;6>s;s++){for(var h=["<tr>"],p=0;7>p;p++)h.push("<td></td>");h.push("</tr>"),v.push(h.join(""))}o.html(c.join("")),i.html(v.join("")),t.loadDate(a),t.resize(a)},loadDate:function(a){var t=this,e=$(a),n=e.data("calendar").options,l=n.currentDate;l.setDate(1);var r=n.currentDate.getFullYear(),d=n.currentDate.getMonth();e.find(".lava-calendar-header span").text(r+"-"+t.round(d+1));var o=e.find("td"),i=l.getDay(),c=new Date(l.getTime());c.setMonth(d+1),c.setTime(c.getTime()-864e5);var s=c.getDate();o.text("").removeAttr("data-date").prop("class","");for(var v=0;s>v;v++)o.eq(v+i).text(v+1).attr("data-date",r+"/"+(d+1)+"/"+(v+1));n.data&&t.loadData(a)},loadData:function(a){var t=$(a),e=t.data("calendar").options,n=e.data,l=t.find("td");l.css({background:"transparent"}),l.prop("class","").removeAttr("data-type").removeAttr("data-blackbox").children().remove();for(var r=0;r<l.length;r++){var d=l.eq(r).attr("data-date");if(d)for(var o=d.split("/")[0],i=d.split("/")[1],c=d.split("/")[2],s=0;s<n.length;s++){var v=n[s].date;if(v.getFullYear()==o&&v.getMonth()+1==i&&v.getDate()==c){"normal"==n[s].type?l.eq(r).addClass("lava-calendar-normal").attr("data-type","normal").css({background:e.normalColor}):"alarm"==n[s].type&&l.eq(r).addClass("lava-calendar-alarm").attr("data-type","alarm").css({background:e.alarmColor}),n[s].blackbox&&l.eq(r).append("<div class='lava-calendar-blackbox'></div>").attr("data-blackbox",!0),n[s].device&&l.eq(r).append("<div class='lava-calendar-device'></div>"),n[s].server&&l.eq(r).append("<div class='lava-calendar-server'></div>");break}}}},gotoMonth:function(a,t,e){var n=this,l=$(a),r=l.data("calendar").options;if(t){var d=r.currentDate.getMonth();r.currentDate.setMonth("next"==t?d+1:d-1)}else e&&(r.currentDate=e);if(n.loadDate(a),r.onMonthChange){var o=r.currentDate,i=new Date(o.getFullYear()+"/"+n.round(o.getMonth()+1)+"/"+n.round(o.getDate())+" 00:00:00"),c=new Date(i.getTime());c.setMonth(c.getMonth()+1),c.setTime(c.getTime()-1),r.onMonthChange(i,c)}},resize:function(a){var t=$(a),e=.6*t.width()/6;t.find("td").css({height:e})},round:function(a){return 10>a?"0"+a:a},bindEvent:function(a){var t=this,e=$(a),n=e.data("calendar").options;e.on("selectstart",function(){return!1}),e.find(".lava-calendar-prev").on("click",function(){t.gotoMonth(a,"prev")}),e.find(".lava-calendar-next").on("click",function(){t.gotoMonth(a,"next")}),e.find("td").on("click dblclick",function(a){e.find("td").children(".lava-calendar-active").remove();var t=$(this).width()+2,l=$(this).height()+2;if($(this).append("<div class='lava-calendar-active' style='width:"+t+"px;height:"+l+"px;'></div>"),"click"==a.type&&n.onClick&&$(this).attr("data-date")){var r={date:new Date($(this).attr("data-date")),type:$(this).attr("data-type"),blackbox:$(this).attr("data-blackbox")};n.onClick(r)}if("dblclick"==a.type&&n.onDblclick&&$(this).attr("data-date")){var r={date:new Date($(this).attr("data-date")),type:$(this).attr("data-type"),blackbox:$(this).attr("data-blackbox")};n.onDblclick(r)}})}};$.fn.lavaCalendar=function(a,t){return"string"==typeof a?$.fn.lavaCalendar.methods[a](this,t):void $.each(this,function(){var t={};$.extend(t,$.fn.lavaCalendar.defaults),$(this).data("calendar",{options:t}),$.extend($(this).data("calendar").options,a),$.extend($.fn.lavaCalendar.locales,$(this).data("calendar").options.weekMonth),lavaCalendar.init(this),lavaCalendar.bindEvent(this),a.data&&lavaCalendar.loadData(this)})},$.fn.lavaCalendar.defaults={lang:"zh-CN",color:"#32c5d2",alarmColor:"#e26a6a",normalColor:"#26c281",currentDate:new Date,weekMonth:{},onClick:null,onDblclick:null,onMonthChange:null},$.fn.lavaCalendar.methods={loadData:function(a,t){$(a).data("calendar").options.data=t,lavaCalendar.loadData(a)},getDate:function(a){return $(a).data("calendar").options.currentDate},gotoMonth:function(a,t){lavaCalendar.gotoMonth(a,"",t)}},$.fn.lavaCalendar.locales={"zh-CN":["日","一","二","三","四","五","六"],"zh-TW":["日","一","二","三","四","五","六"],ar:"ح_ن_ث_ر_خ_ج_س".split("_"),bo:"ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),de:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),"en-gb":"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),"en-US":"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),fr:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),it:"D_L_Ma_Me_G_V_S".split("_"),ja:"日_月_火_水_木_金_土".split("_"),ru:"вс_пн_вт_ср_чт_пт_сб".split("_"),"th-TH":"อา_จ_อ_พ_พฤ_ศ_ส".split("_"),"pt-BR":["D","S","T","Q","Q","S","S","Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"]};