/* See license.txt for terms of usage */ define("tabs/homeTab",["domplate/domplate","domplate/tabView","core/lib","core/cookies","core/trace","i18n!nls/homeTab","text!tabs/homeTab.html","preview/harModel"],function(Domplate,TabView,Lib,Cookies,Trace,Strings,HomeTabHtml,HarModel){with(Domplate){function HomeTab(){}return HomeTab.prototype=Lib.extend(TabView.Tab.prototype,{id:"Home",label:Strings.homeTabLabel,bodyTag:DIV({"class":"homeBody"}),onUpdateBody:function(e,t){t=this.bodyTag.replace({},t),t.innerHTML=HomeTabHtml.replace("@HAR_SPEC_URL@",e.harSpecURL,"g"),$("#appendPreview").click(Lib.bindFixed(this.onAppendPreview,this)),$(".linkAbout").click(Lib.bind(this.onAbout,this));var n=$("#content");n.bind("dragenter",Lib.bind(Lib.cancelEvent,Lib)),n.bind("dragover",Lib.bind(Lib.cancelEvent,Lib)),n.bind("drop",Lib.bind(this.onDrop,this)),this.validateNode=$("#validate");var r=Cookies.getCookie("validate");r&&this.validateNode.prop("checked",r=="false"?!1:!0),this.validateNode.change(Lib.bind(this.onValidationChange,this)),$(".example").click(Lib.bind(this.onLoadExample,this))},onAppendPreview:function(e){e||(e=$("#sourceEditor").val()),e&&this.tabView.appendPreview(e)},onAbout:function(){this.tabView.selectTabByName("About")},onValidationChange:function(){var e=this.validateNode.prop("checked");Cookies.setCookie("validate",e)},onLoadExample:function(e){var t=Lib.fixEvent(e),n=t.target.getAttribute("path"),r=document.location.href,i=r.indexOf("?");document.location=r.substr(0,i)+"?path="+n,Cookies.setCookie("timeline",!0),Cookies.setCookie("stats",!0)},onDrop:function(e){var t=Lib.fixEvent(e);Lib.cancelEvent(t);try{this.handleDrop(e.originalEvent.dataTransfer)}catch(n){Trace.exception("HomeTab.onDrop EXCEPTION",n)}},handleDrop:function(e){if(!e)return!1;var t=e.files;if(!t)return;for(var n=0;n