From 290625c8e99b5e12d89b87e371bec4497a973332 Mon Sep 17 00:00:00 2001 From: khjde1207 Date: Mon, 27 Mar 2017 10:43:41 +0900 Subject: [PATCH] Update wide.min.js --- static/js/wide.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/wide.min.js b/static/js/wide.min.js index d950f21..b940869 100644 --- a/static/js/wide.min.js +++ b/static/js/wide.min.js @@ -5,7 +5,7 @@ var notification={init:function(){$(".notification-count").click(function(){bott var tree={fileTree:void 0,getCurrentNodeLastNode:function(e){var t=e.children[e.children.length-1];return t.open?tree.getCurrentNodeLastNode(t):t},getNextShowNode:function(e){return 0!==e.level?e.getParentNode().getNextNode()?e.getParentNode().getNextNode():tree.getNextShowNode(e.getParentNode()):e.getNextNode()},isBottomNode:function(e){return e.open?!1:e.getParentNode()?e.getParentNode().isLastNode?tree.isBottomNode(e.getParentNode()):!1:e.isLastNode?!0:!1},getTIdByPath:function(e){for(var t=tree.fileTree.transformToArray(tree.fileTree.getNodes()),i=0,o=t.length;o>i;i++)if(t[i].path===e)return t[i].tId},getOpenPaths:function(){for(var e=tree.fileTree.transformToArray(tree.fileTree.getNodes()),t=[],i=0,o=e.length;o>i;i++)e[i].open&&t.push(e[i].path);return t},getAllParents:function(e,t){return t||(t=[]),e&&e.parentTId?(t.push(e.getParentNode()),tree.getAllParents(e.getParentNode(),t)):t},isParents:function(e,t){var i=tree.fileTree.getNodeByTId(e);if(i&&i.parentTId){var o=tree.fileTree.getNodeByTId(i.parentTId);return i.path===t?!0:tree.isParents(o.tId,t)}return!1},isDir:function(){return 0===wide.curNode.iconSkin.indexOf("ico-ztree-dir")?!0:!1},newFile:function(e){return $(e).hasClass("disabled")?!1:void $("#dialogNewFilePrompt").dialog("open")},newDir:function(e){return $(e).hasClass("disabled")?!1:void $("#dialogNewDirPrompt").dialog("open")},removeIt:function(e){if(e){if($(e).hasClass("disabled"))return!1}else if(!wide.curNode.removable)return!1;$("#dialogRemoveConfirm").dialog("open")},rename:function(e){return e&&$(e).hasClass("disabled")?!1:void $("#dialogRenamePrompt").dialog("open")},"export":function(){var e=newWideRequest(),t=!1;e.path=wide.curNode.path,$.ajax({async:!1,type:"POST",url:config.context+"/file/zip/new",data:JSON.stringify(e),dataType:"json",success:function(e){return e.succ?void(t=!0):($("#dialogAlert").dialog("open",e.msg),!1)}}),t&&window.open(config.context+"/file/zip?path="+wide.curNode.path+".zip")},crossCompile:function(e){var t=newWideRequest();t.path=wide.curNode.path,t.platform=e,$.ajax({async:!1,type:"POST",url:config.context+"/cross",data:JSON.stringify(t),dataType:"json",success:function(e){return e.succ?void 0:($("#dialogAlert").dialog("open",e.msg),!1)}})},decompress:function(){var e=newWideRequest();e.path=wide.curNode.path,$.ajax({async:!1,type:"POST",url:config.context+"/file/decompress",data:JSON.stringify(e),dataType:"json",success:function(e){if(!e.succ)return $("#dialogAlert").dialog("open",e.msg),!1;var t=wide.curNode.getParentNode();tree.fileTree.reAsyncChildNodes(t,"refresh")}})},refresh:function(e){return e&&$(e).hasClass("disabled")?!1:void tree.fileTree.reAsyncChildNodes(wide.curNode,"refresh",!0)},gitClone:function(e){return e&&$(e).hasClass("disabled")?!1:void $("#dialogGitClonePrompt").dialog("open")},"import":function(){var e=newWideRequest();e.path=wide.curNode.path,$("#importFileupload").fileupload({url:"/file/upload?path="+e.path,dataType:"json",formData:e,done:function(e,t){tree.fileTree.reAsyncChildNodes(wide.curNode,"refresh")},fail:function(){console.log(arguments)}})},init:function(){$("#file").click(function(){$(this).focus()});var e=newWideRequest();$.ajax({type:"POST",url:config.context+"/files",data:JSON.stringify(e),dataType:"json",success:function(e){if(e.succ){var t=$("#dirRMenu"),i=$("#fileRMenu"),o={data:{key:{title:"path"}},view:{showTitle:!0,selectedMulti:!1},async:{enable:!0,url:config.context+"/file/refresh",autoParam:["path"]},callback:{onDblClick:function(e,t,i){i&&tree.openFile(i)},onRightClick:function(e,o,r){if(r&&!r.isGOAPI){if(menu.undisabled(["import","export","git-clone"]),wide.curNode=r,tree.fileTree.selectNode(r),tree.isDir()){wide.curNode.removable?t.find(".remove").removeClass("disabled"):t.find(".remove").addClass("disabled"),wide.curNode.creatable?t.find(".create").removeClass("disabled"):t.find(".create").addClass("disabled");var n=e.clientY-10;t.height()+n>$(".content").height()&&(n=n-t.height()-25),t.css({top:n+"px",left:e.clientX+"px",display:"block"}).show(),i.hide()}else{wide.curNode.removable?i.find(".remove").removeClass("disabled"):i.find(".remove").addClass("disabled"),-1===wide.curNode.path.indexOf("zip",wide.curNode.path.length-"zip".length)?i.find(".decompress").hide():i.find(".decompress").show(),-1===wide.curNode.path.indexOf("go",wide.curNode.path.length-"go".length)?i.find(".linux64").hide():i.find(".linux64").show();var n=e.clientY-10;i.height()+n>$(".content").height()&&(n=n-i.height()-25),i.css({top:n+"px",left:e.clientX+"px",display:"block"}).show(),t.hide(),menu.disabled(["import","git-clone"])}$("#files").focus()}},onClick:function(e,t,i,o){i&&(wide.curNode=i,tree.fileTree.selectNode(i),menu.undisabled(["import","export","git-clone"]),tree.isDir()||menu.disabled(["import","git-clone"]),$("#files").focus())}}};tree.fileTree=$.fn.zTree.init($("#files"),o,e.data.children),session.restore()}}}),this._initSearch(),this._initRename()},openFile:function(e,t){wide.curNode=e;for(var i=t,o=0,r=editors.data.length;r>o;o++)if(editors.data[o].id===e.path){editors.tabs.setCurrent(e.path),wide.curEditor=editors.data[o].editor,i||(i=wide.curEditor.getCursor()),$(".footer .cursor").text("| "+(i.line+1)+":"+(i.ch+1)+" |"),wide.curEditor.setCursor(i);var n=Math.floor(wide.curEditor.getScrollInfo().clientHeight/wide.curEditor.defaultTextHeight()/2),a=wide.curEditor.cursorCoords({line:i.line-n,ch:0},"local");return wide.curEditor.scrollTo(0,a.top),wide.curEditor.focus(),wide.refreshOutline(),!1}if(!tree.isDir()){var d=newWideRequest();d.path=e.path,$.ajax({async:!1,type:"POST",url:config.context+"/file",data:JSON.stringify(d),dataType:"json",success:function(t){if(!t.succ)return $("#dialogAlert").dialog("open",t.msg),!1;var o=t.data;if(!o.mode){var r=CodeMirror.findModeByFileName(e.path);r?o.mode=r.mime:o.mode="text/plain"}if(o.mode||console.error("Can't find mode by file name ["+e.path+"]"),"img"===o.mode){window.open(config.context+o.path);return!1}i||(i=CodeMirror.Pos(0,0)),editors.newEditor(o,i),wide.refreshOutline()}})}},_initSearch:function(){$("#dialogSearchForm > input:eq(0)").keyup(function(e){var t=$(this).closest(".dialog-main").find(".dialog-footer > button:eq(0)");13!==e.which||t.prop("disabled")||t.click(),""===$.trim($(this).val())?t.prop("disabled",!0):t.prop("disabled",!1)}),$("#dialogSearchForm > input:eq(1)").keyup(function(e){var t=$(this).closest(".dialog-main").find(".dialog-footer > button:eq(0)");13!==e.which||t.prop("disabled")||t.click()}),$("#dialogSearchForm").dialog({modal:!0,height:80,width:260,title:config.label.search,okText:config.label.search,cancelText:config.label.cancel,afterOpen:function(){$("#dialogSearchForm > input:eq(0)").val("").focus(),$("#dialogSearchForm > input:eq(1)").val(""),$("#dialogSearchForm").closest(".dialog-main").find(".dialog-footer > button:eq(0)").prop("disabled",!0)},ok:function(){var e=newWideRequest();wide.curNode?e.dir=wide.curNode.path:e.dir="",e.text=$("#dialogSearchForm > input:eq(0)").val(),e.extension=$("#dialogSearchForm > input:eq(1)").val(),$.ajax({type:"POST",url:config.context+"/file/search/text",data:JSON.stringify(e),dataType:"json",success:function(t){t.succ&&($("#dialogSearchForm").dialog("close"),editors.appendSearch(t.data,"founds",e.text))}})}})},_initRename:function(){$("#dialogRenamePrompt").dialog({modal:!0,height:52,width:260,title:config.label.rename,okText:config.label.rename,cancelText:config.label.cancel,afterOpen:function(){$("#dialogRenamePrompt").closest(".dialog-main").find(".dialog-footer > button:eq(0)").prop("disabled",!0),$("#dialogRenamePrompt > input").val(wide.curNode.name).select().focus()},ok:function(){var e=$("#dialogRenamePrompt > input").val(),t=newWideRequest();t.oldPath=wide.curNode.path,t.newPath=wide.curNode.path.substring(0,wide.curNode.path.lastIndexOf("/")+1)+e,$.ajax({type:"POST",url:config.context+"/file/rename",data:JSON.stringify(t),dataType:"json",success:function(e){return e.succ?void $("#dialogRenamePrompt").dialog("close"):($("#dialogRenamePrompt").dialog("close"),bottomGroup.tabs.setCurrent("notification"),windows.flowBottom(),$(".bottom-window-group .notification").focus(),!1)}})}})}}; var wide={curNode:void 0,curEditor:void 0,curProcessId:void 0,refreshOutline:function(){if(!wide.curEditor||wide.curEditor&&"go"!==wide.curEditor.doc.getMode().name)return $("#outline").html(""),!1;var e=newWideRequest();e.code=wide.curEditor.getValue(),$.ajax({type:"POST",async:!1,url:config.context+"/outline",data:JSON.stringify(e),dataType:"json",success:function(e){if(e.succ){for(var t=e.data,o='"),$("#outline li").dblclick(function(){var e=$(this),t=CodeMirror.Pos(e.data("line"),e.data("ch")),o=wide.curEditor;o.setCursor(t);var i=Math.floor(o.getScrollInfo().clientHeight/o.defaultTextHeight()/2),a=o.cursorCoords({line:t.line-i,ch:0},"local");o.scrollTo(0,a.top),o.focus()})}}})},_initDialog:function(){$(".dialog-prompt > input").keyup(function(e){var t=$(this).closest(".dialog-main").find(".dialog-footer > button:eq(0)");13!==e.which||t.prop("disabled")||t.click(),""===$.trim($(this).val())?t.prop("disabled",!0):t.prop("disabled",!1)}),$("#dialogAlert").dialog({modal:!0,height:40,width:350,title:config.label.tip,hiddenOk:!0,cancelText:config.label.confirm,afterOpen:function(e){$("#dialogAlert").html(e)}}),$("#dialogRemoveConfirm").dialog({modal:!0,height:36,width:260,title:config.label["delete"],okText:config.label["delete"],cancelText:config.label.cancel,afterOpen:function(){$("#dialogRemoveConfirm > b").html('"'+wide.curNode.name+'"')},ok:function(){var e=newWideRequest();e.path=wide.curNode.path,$.ajax({type:"POST",url:config.context+"/file/remove",data:JSON.stringify(e),dataType:"json",success:function(e){return e.succ?void $("#dialogRemoveConfirm").dialog("close"):($("#dialogRemoveConfirm").dialog("close"),bottomGroup.tabs.setCurrent("notification"),windows.flowBottom(),$(".bottom-window-group .notification").focus(),!1)}})}}),$("#dialogNewFilePrompt").dialog({modal:!0,height:52,width:260,title:config.label.create_file,okText:config.label.create,cancelText:config.label.cancel,afterOpen:function(){$("#dialogNewFilePrompt > input").val("").focus(),$("#dialogNewFilePrompt").closest(".dialog-main").find(".dialog-footer > button:eq(0)").prop("disabled",!0)},ok:function(){var e=newWideRequest(),t=$("#dialogNewFilePrompt > input").val();e.path=wide.curNode.path+"/"+t,e.fileType="f",$.ajax({type:"POST",url:config.context+"/file/new",data:JSON.stringify(e),dataType:"json",success:function(t){return t.succ?($("#dialogNewFilePrompt").dialog("close"),void setTimeout(function(){var t=tree.getTIdByPath(e.path);tree.openFile(tree.fileTree.getNodeByTId(t)),tree.fileTree.selectNode(wide.curNode)},100)):($("#dialogNewFilePrompt").dialog("close"),bottomGroup.tabs.setCurrent("notification"),windows.flowBottom(),$(".bottom-window-group .notification").focus(),!1)}})}}),$("#dialogNewDirPrompt").dialog({modal:!0,height:52,width:260,title:config.label.create_dir,okText:config.label.create,cancelText:config.label.cancel,afterOpen:function(){$("#dialogNewDirPrompt > input").val("").focus(),$("#dialogNewDirPrompt").closest(".dialog-main").find(".dialog-footer > button:eq(0)").prop("disabled",!0)},ok:function(){var e=$("#dialogNewDirPrompt > input").val(),t=newWideRequest();t.path=wide.curNode.path+"/"+e,t.fileType="d",$.ajax({type:"POST",url:config.context+"/file/new",data:JSON.stringify(t),dataType:"json",success:function(e){return e.succ?void $("#dialogNewDirPrompt").dialog("close"):($("#dialogNewDirPrompt").dialog("close"),bottomGroup.tabs.setCurrent("notification"),windows.flowBottom(),$(".bottom-window-group .notification").focus(),!1)}})}}),$("#dialogGoFilePrompt").dialog({modal:!0,height:320,width:660,title:config.label.goto_file,okText:config.label.go,cancelText:config.label.cancel,afterInit:function(){$("#dialogGoFilePrompt").on("dblclick","li",function(){var e=tree.getTIdByPath($(this).find(".ft-small").text());tree.openFile(tree.fileTree.getNodeByTId(e)),tree.fileTree.selectNode(wide.curNode),$("#dialogGoFilePrompt").dialog("close"),wide.curEditor.focus()}),$("#dialogGoFilePrompt").on("click","li",function(){var e=$("#dialogGoFilePrompt > .list");e.find("li").removeClass("selected"),e.data("index",$(this).data("index")),$(this).addClass("selected")}),hotkeys.bindList($("#dialogGoFilePrompt > input"),$("#dialogGoFilePrompt > .list"),function(e){var t=tree.getTIdByPath(e.find(".ft-small").text());tree.openFile(tree.fileTree.getNodeByTId(t)),tree.fileTree.selectNode(wide.curNode),$("#dialogGoFilePrompt").dialog("close"),wide.curEditor.focus()}),$("#dialogGoFilePrompt > input").bind("input",function(){var e=$("#dialogGoFilePrompt > input").val(),t=newWideRequest();t.path="",t.name="*"+e+"*",wide.curNode&&(t.path=wide.curNode.path),$.ajax({type:"POST",url:config.context+"/file/find/name",data:JSON.stringify(t),dataType:"json",success:function(e){if(e.succ){for(var t=e.data,o="",i=0,a=t.length;a>i;i++){var n=t[i].path,l=n.substr(n.lastIndexOf("/")+1),r=wide.getClassBySuffix(l.split(".")[1]);o+=0===i?'
  • '+l+'    '+n+"
  • ":'
  • '+l+'    '+n+"
  • "}$("#dialogGoFilePrompt > ul").html(o)}}})})},afterOpen:function(){$("#dialogGoFilePrompt > input").val("").focus(),$("#dialogGoFilePrompt").closest(".dialog-main").find(".dialog-footer > button:eq(0)").prop("disabled",!0),$("#dialogGoFilePrompt .list").html("").data("index",0)},ok:function(){var e=tree.getTIdByPath($("#dialogGoFilePrompt .selected .ft-small").text());tree.openFile(tree.fileTree.getNodeByTId(e)),tree.fileTree.selectNode(wide.curNode),$("#dialogGoFilePrompt").dialog("close"),wide.curEditor.focus()}}),$("#dialogGoLinePrompt").dialog({modal:!0,height:52,width:260,title:config.label.goto_line,okText:config.label.go,cancelText:config.label.cancel,afterOpen:function(){$("#dialogGoLinePrompt > input").val("").focus(),$("#dialogGoLinePrompt").closest(".dialog-main").find(".dialog-footer > button:eq(0)").prop("disabled",!0)},ok:function(){var e=parseInt($("#dialogGoLinePrompt > input").val())-1;$("#dialogGoLinePrompt").dialog("close");var t=wide.curEditor,o=t.getCursor();t.setCursor(CodeMirror.Pos(e,o.ch));var i=Math.floor(t.getScrollInfo().clientHeight/t.defaultTextHeight()/2),a=t.cursorCoords({line:e-i,ch:o.ch},"local");t.scrollTo(0,a.top),t.focus()}}),$("#dialogGitClonePrompt").dialog({modal:!0,height:52,width:360,title:config.label.git_clone,okText:config.label.confirm,cancelText:config.label.cancel,afterOpen:function(){$("#dialogGitClonePrompt > input").val("").focus(),$("#dialogGitClonePrompt").closest(".dialog-main").find(".dialog-footer > button:eq(0)").prop("disabled",!0)},ok:function(){$("#dialogGitClonePrompt").dialog("close");var e=newWideRequest();e.path=wide.curNode.path,e.repository=$("#dialogGitClonePrompt > input").val(),$.ajax({type:"POST",url:config.context+"/git/clone",data:JSON.stringify(e),dataType:"json",success:function(e){}})}})},_initWS:function(){var e=new ReconnectingWebSocket(config.channel+"/output/ws?sid="+config.wideSessionId);e.onopen=function(){console.log("[output onopen] connected")},e.onmessage=function(e){console.log("[output onmessage]"+e.data);var t=JSON.parse(e.data);if(goLintFound&&(goLintFound=[]),"run"===t.nextCmd){var o=newWideRequest();o.executable=t.executable,$.ajax({type:"POST",url:config.context+"/run",data:JSON.stringify(o),dataType:"json"})}switch(t.cmd){case"run":var i=$(".bottom-window-group .output > div").html();wide.curProcessId&&""!==i?bottomGroup.fillOutput(i.replace(/<\/pre>$/g,t.output+"")):bottomGroup.fillOutput(i+"
    "+t.output+"
    "),wide.curProcessId=t.pid;break;case"run-done":bottomGroup.fillOutput($(".bottom-window-group .output > div").html().replace(/<\/pre>$/g,t.output+"")),wide.curProcessId=void 0,$("#buildRun").removeClass("ico-stop").addClass("ico-buildrun").attr("title",config.label.build_n_run);break;case"start-build":case"start-test":case"start-vet":case"start-install":case"start-get":case"start-git_clone":bottomGroup.fillOutput(t.output);break;case"go test":case"go vet":case"go install":case"go get":bottomGroup.fillOutput($(".bottom-window-group .output > div").html()+t.output);break;case"git clone":bottomGroup.fillOutput($(".bottom-window-group .output > div").html()+t.output),tree.fileTree.reAsyncChildNodes(wide.curNode,"refresh",!1);break;case"build":case"cross-build":if(bottomGroup.fillOutput($(".bottom-window-group .output > div").html()+t.output),t.lints){for(var a={},n=0;n ul > li").unbind().removeClass("selected"),menu.subMenu())))}),window.onbeforeunload=function(){return editors.data.length>0?config.label.confirm_save:void 0},document.oncontextmenu=function(){return!1},this._initDialog()},_save:function(e,t){if(!e)return!1;var o=newWideRequest();o.file=e,o.code=t.getValue(),$.ajax({type:"POST",url:config.context+"/file/save",data:JSON.stringify(o),dataType:"json",success:function(o){t.doc.markClean(),$(".edit-panel .tabs > div").each(function(){var t=$(this).find("span:eq(0)");t.attr("title")===e&&t.removeClass("changed")})}})},saveFile:function(){var e=editors.getCurrentPath();if(!e)return!1;var t=wide.curEditor;if(t.doc.isClean())return!1;if("text/x-go"===t.getOption("mode")){wide.gofmt(e,wide.curEditor);var o=newWideRequest();return o.file=e,o.code=t.getValue(),o.nextCmd="",$.ajax({type:"POST",url:config.context+"/build",data:JSON.stringify(o),dataType:"json",beforeSend:function(){bottomGroup.resetOutput()},success:function(e){}}),void wide.refreshOutline()}wide._save(e,wide.curEditor)},stop:function(){if($("#buildRun").hasClass("ico-buildrun"))return menu.run(),!1;if(!wide.curProcessId)return!1;var e=newWideRequest();e.pid=wide.curProcessId,$.ajax({type:"POST",url:config.context+"/stop",data:JSON.stringify(e),dataType:"json",success:function(e){$("#buildRun").removeClass("ico-stop").addClass("ico-buildrun").attr("title",config.label.build_n_run)}})},gofmt:function(e,t){var o=t.getCursor(),i=t.getScrollInfo(),a=newWideRequest();a.file=e,a.code=t.getValue(),a.cursorLine=o.line,a.cursorCh=o.ch,$.ajax({async:!1,type:"POST",url:config.context+"/go/fmt",data:JSON.stringify(a),dataType:"json",success:function(a){a.succ&&(t.setValue(a.data.code),t.setCursor(o),t.scrollTo(null,i.top),wide._save(e,t))}})},fmt:function(e,t){var o=t.getOption("mode"),i=t.getCursor(),a=t.getScrollInfo(),n=newWideRequest();n.file=e,n.code=t.getValue(),n.cursorLine=i.line,n.cursorCh=i.ch;var l=null;switch(o){case"text/x-go":$.ajax({async:!1,type:"POST",url:config.context+"/go/fmt",data:JSON.stringify(n),dataType:"json",success:function(e){e.succ&&(l=e.data.code)}});break;case"text/html":l=html_beautify(t.getValue());break;case"text/javascript":case"application/json":l=js_beautify(t.getValue());break;case"text/css":l=css_beautify(t.getValue())}l&&(t.setValue(l),t.setCursor(i),t.scrollTo(null,a.top),wide._save(e,t))},getClassBySuffix:function(e){var t="ico-ztree-other ";switch(e){case"html":case"htm":t="ico-ztree-html ";break;case"go":t="ico-ztree-go ";break;case"css":t="ico-ztree-css ";break;case"txt":t="ico-ztree-text ";break;case"sql":t="ico-ztree-sql ";break;case"properties":t="ico-ztree-pro ";break;case"md":t="ico-ztree-md ";break;case"json":t="ico-ztree-js ";break;case"xml":t="ico-ztree-xml ";break;case"jpg":case"jpeg":case"bmp":case"gif":case"png":case"svg":case"ico":t="ico-ztree-img "}return t}};$(document).ready(function(){wide.init(),tree.init(),menu.init(),hotkeys.init(),session.init(),notification.init(),editors.init(),windows.init(),bottomGroup.init()}); var session={init:function(){this._initWS();var e=function(e){var t="normal";return e.isClosed?t="min":e.size>=$("body").width()&&(t="max"),t};setInterval(function(){var t=newWideRequest(),s=[],o=[],n=editors.getCurrentId(),r=n?editors.getCurrentPath():"";editors.tabs.obj._$tabs.find("div").each(function(){var e=$(this);e.find("span:eq(0)").attr("title")!==config.label.start_page&&s.push(e.find("span:eq(0)").attr("title"))}),o=tree.getOpenPaths(),t.currentFile=r,t.fileTree=o,t.files=s,t.layout={side:{size:windows.outerLayout.west.state.size,state:e(windows.outerLayout.west.state)},sideRight:{size:windows.innerLayout.east.state.size,state:e(windows.innerLayout.east.state)},bottom:{size:windows.innerLayout.south.state.size,state:e(windows.innerLayout.south.state)}},$.ajax({type:"POST",url:config.context+"/session/save",data:JSON.stringify(t),dataType:"json",success:function(e){}})},3e4)},restore:function(){if(config.latestSessionContent){for(var e=config.latestSessionContent.fileTree,t=config.latestSessionContent.files,s=config.latestSessionContent.currentFile,o="",n=[],r=tree.fileTree.transformToArray(tree.fileTree.getNodes()),i=0,a=r.length;a>i;i++){for(var d=0,l=e.length;l>d;d++)if(r[i].path===e[d]){for(var c=tree.getAllParents(tree.fileTree.getNodeByTId(r[i].tId)),f=!0,g=0,p=c.length;p>g;g++)c[g].open===!1&&(f=!1);f?tree.fileTree.expandNode(r[i],!0,!1,!0):r[i].open=!0;break}for(var h=0,u=t.length;u>h;h++)if(r[i].path===t[h]){n.push(r[i]);break}r[i].path===s&&(o=r[i].path,tree.fileTree.selectNode(r[i]),wide.curNode=r[i])}for(var y=0,v=t.length;v>y;y++)for(var w=0,m=n.length;m>w;w++)if(n[w].path===t[y]){tree.openFile(n[w]);break}editors.tabs.setCurrent(o);for(var b=0,p=editors.data.length;p>b;b++)if(o===editors.data[b].id){wide.curEditor=editors.data[b].editor;break}}},_initWS:function(){var e=new ReconnectingWebSocket(config.channel+"/session/ws?sid="+config.wideSessionId);e.onopen=function(){console.log("[session onopen] connected");var e=function(e,t){var s=new Date(e),o={"M+":s.getMonth()+1,"d+":s.getDate(),"h+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(var n in o)new RegExp("("+n+")").test(t)&&(t=t.replace(RegExp.$1,1===RegExp.$1.length?o[n]:("00"+o[n]).substr((""+o[n]).length)));return t},t={type:"Network",severity:"INFO",message:"Connected to server [sid="+config.wideSessionId+"], "+e((new Date).getTime(),"yyyy-MM-dd hh:mm:ss")},s=$(".bottom-window-group .notification > table"),o="";o+=''+t.severity+''+t.message+''+t.type+"",s.append(o)},e.onmessage=function(e){var t=JSON.parse(e.data);switch(t.cmd){case"create-file":var s=tree.fileTree.getNodeByTId(tree.getTIdByPath(t.dir)),o=t.path.replace(t.dir+"/",""),n=CodeMirror.findModeByFileName(o),r=wide.getClassBySuffix(o.split(".")[1]);t.type&&"f"===t.type?tree.fileTree.addNodes(s,[{id:t.path,name:o,iconSkin:r,path:t.path,mode:n,removable:!0,creatable:!0}]):tree.fileTree.addNodes(s,[{id:t.path,name:o,iconSkin:"ico-ztree-dir ",path:t.path,removable:!0,creatable:!0,isParent:!0}]);break;case"remove-file":case"rename-file":var s=tree.fileTree.getNodeByTId(tree.getTIdByPath(t.path));tree.fileTree.removeNode(s);for(var i=tree.fileTree.transformToArray(s),a=0,d=i.length;d>a;a++)editors.tabs.del(i[a].path)}},e.onclose=function(e){console.log("[session onclose] disconnected ("+e.code+")");var t={type:"Network",severity:"ERROR",message:"Disconnected from server, trying to reconnect it [sid="+config.wideSessionId+"]"},s=$(".bottom-window-group .notification > table"),o="";o+=''+t.severity+''+t.message+''+t.type+"",s.append(o),$(".notification-count").show()},e.onerror=function(e){console.log("[session onerror]")}}}; -var menu={init:function(){this.subMenu(),this._initPreference(),this._initAbout(),this._initShare(),$(".menu .frame li").click(function(){$(".menu > ul > li").unbind().removeClass("selected"),menu.subMenu()})},_initShare:function(){$(".menu .ico-share").hover(function(){$(".menu .share-panel").show()}),$(".share-panel .font-ico").click(function(){var e=$(this).attr("class").split("-")[2],t="https://wide.b3log.org",a="https://wide.b3log.org/static/images/wide-logo.png",n={};n.email="mailto:?subject="+$("title").text()+"&body="+$("meta[name=description]").attr("content")+" "+t;var i=encodeURIComponent($("meta[name=description]").attr("content")+" "+t+" #golang");n.twitter="https://twitter.com/intent/tweet?status="+i,n.facebook="https://www.facebook.com/sharer/sharer.php?u="+t,n.googleplus="https://plus.google.com/share?url="+t;var o=encodeURIComponent($("title").text()+". \n"+$("meta[name=description]").attr("content")+" #golang#");n.weibo="http://v.t.sina.com.cn/share/share.php?title="+o+"&url="+t+"&pic="+a,n.tencent="http://share.v.t.qq.com/index.php?c=share&a=index&title="+o+"&url="+t+"&pic="+a,window.open(n[e],"_blank","top=100,left=200,width=648,height=618")})},_initAbout:function(){$("#dialogAbout").load(config.context+"/about",function(){$("#dialogAbout").dialog({modal:!0,title:config.label.about,hideFooter:!0,afterOpen:function(){$.ajax({url:"https://rhythm.b3log.org/version/wide/latest",type:"GET",dataType:"jsonp",jsonp:"callback",success:function(e,t){$("#dialogAbout .version").text()===e.wideVersion?$(".upgrade").text(config.label.uptodate):$(".upgrade").html(config.label.new_version_available+config.label.colon+""+e.wideVersion+"")}})}})})},disabled:function(e){for(var t=0,a=e.length;a>t;t++)$(".menu li."+e[t]).addClass("disabled")},undisabled:function(e){for(var t=0,a=e.length;a>t;t++)$(".menu li."+e[t]).removeClass("disabled")},subMenu:function(){$(".menu > ul > li").click(function(e){if(1!==$(e.target).closest(".frame").length){var t=$(this);t.find(".frame").show(),$(".menu > ul > li").removeClass("selected"),$(this).addClass("selected"),$(".menu > ul > li").unbind(),$(".menu > ul > li").mouseover(function(){1!==$(e.target).closest(".frame").length&&($(".menu .frame").hide(),$(this).find(".frame").show(),$(".menu > ul > li").removeClass("selected"),$(this).addClass("selected"))})}})},openPreference:function(){$("#dialogPreference").dialog("open")},saveAllFiles:function(){if($(".menu li.save-all").hasClass("disabled"))return!1;for(var e=0,t=editors.data.length;t>e;e++){var a=editors.data[e].id,n=editors.data[e].editor;"text/x-go"===n.getOption("mode")?wide.fmt(a,n):wide._save(a,n)}},closeAllFiles:function(){if($(".menu li.close-all").hasClass("disabled"))return!1;var e=[];$(".edit-panel .tabs > div").each(function(t){0!==t&&e.push($(this).data("index"))}),$("#dialogCloseEditor").data("removeData",e),$(".edit-panel .tabs .ico-close:eq(0)").click()},exit:function(){var e=newWideRequest();$.ajax({type:"POST",url:config.context+"/logout",data:JSON.stringify(e),dataType:"json",success:function(e){e.succ&&(window.location.href=config.context+"/login")}})},openAbout:function(){$("#dialogAbout").dialog("open")},goget:function(){menu.saveAllFiles();var e=editors.getCurrentPath();if(!e)return!1;if($(".menu li.go-get").hasClass("disabled"))return!1;var t=newWideRequest();t.file=e,$.ajax({type:"POST",url:config.context+"/go/get",data:JSON.stringify(t),dataType:"json",beforeSend:function(){bottomGroup.resetOutput()},success:function(e){}})},goinstall:function(){menu.saveAllFiles();var e=editors.getCurrentPath();if(!e)return!1;if($(".menu li.go-install").hasClass("disabled"))return!1;var t=newWideRequest();t.file=e,$.ajax({type:"POST",url:config.context+"/go/install",data:JSON.stringify(t),dataType:"json",beforeSend:function(){bottomGroup.resetOutput()},success:function(e){}})},test:function(){menu.saveAllFiles();var e=editors.getCurrentPath();if(!e)return!1;if($(".menu li.go-test").hasClass("disabled"))return!1;var t=newWideRequest();t.file=e,$.ajax({type:"POST",url:config.context+"/go/test",data:JSON.stringify(t),dataType:"json",beforeSend:function(){bottomGroup.resetOutput()},success:function(e){}})},govet:function(){menu.saveAllFiles();var e=editors.getCurrentPath();if(!e)return!1;if($(".menu li.go-vet").hasClass("disabled"))return!1;var t=newWideRequest();t.file=e,$.ajax({type:"POST",url:config.context+"/go/vet",data:JSON.stringify(t),dataType:"json",beforeSend:function(){bottomGroup.resetOutput()},success:function(e){}})},run:function(){if(menu.saveAllFiles(),$("#buildRun").hasClass("ico-stop"))return wide.stop(),!1;var e=editors.getCurrentPath();if(!e)return!1;if($(".menu li.run").hasClass("disabled"))return!1;var t=newWideRequest();t.file=e,t.code=wide.curEditor.getValue(),t.nextCmd="run",$.ajax({type:"POST",url:config.context+"/build",data:JSON.stringify(t),dataType:"json",beforeSend:function(){bottomGroup.resetOutput(),$("#buildRun").addClass("ico-stop").removeClass("ico-buildrun").attr("title",config.label.stop)},success:function(e){}})},build:function(){menu.saveAllFiles();var e=editors.getCurrentPath();if(!e)return!1;if($(".menu li.build").hasClass("disabled"))return!1;var t=newWideRequest();t.file=e,t.code=wide.curEditor.getValue(),t.nextCmd="",$.ajax({type:"POST",url:config.context+"/build",data:JSON.stringify(t),dataType:"json",beforeSend:function(){bottomGroup.resetOutput()},success:function(e){}})},_initPreference:function(){$("#dialogPreference").load(config.context+"/preference",function(){$("#dialogPreference input").keyup(function(){var e=!1,t=[],a="";$("#dialogPreference input").each(function(){var a=$(this);a.val()!=a.data("value")&&(e=!0),""===$.trim(a.val())&&t.push(a)});var n=$("#dialogPreference").closest(".dialog-main").find(".dialog-footer > button:eq(0)");if(e?n.prop("disabled",!1):n.prop("disabled",!0),0===t.length)$("#dialogPreference").find(".tip").html(""),n.prop("disabled",!1);else{for(var i=0,o=t.length;o>i;i++){var l=t[i].closest("div").data("index"),r=$.trim(t[i].parent().text());a+="["+$('#dialogPreference .tabs > div[data-index="'+l+'"]').text()+"] -> ["+r.substr(0,r.length-1)+"]: "+config.label.no_empty+"
    "}$("#dialogPreference").find(".tip").html(a),n.prop("disabled",!0)}}),$("#dialogPreference select").on("change",function(){var e=!1;$("#dialogPreference select").each(function(){$(this).val()!==$(this).data("value")&&(e=!0)});var t=$("#dialogPreference").closest(".dialog-main").find(".dialog-footer > button:eq(0)");e?t.prop("disabled",!1):t.prop("disabled",!0)}),$("#dialogPreference").dialog({modal:!0,height:280,width:800,title:config.label.preference,okText:config.label.apply,cancelText:config.label.cancel,afterOpen:function(){var e=$("#dialogPreference").closest(".dialog-main").find(".dialog-footer > button:eq(0)");e.prop("disabled",!0)},ok:function(){var e=newWideRequest(),t=$("#dialogPreference"),a=t.find("input[name=fontFamily]"),n=t.find("input[name=fontSize]"),i=t.find("select[name=goFmt]"),o=t.find("input[name=goBuildArgs]"),l=t.find("input[name=workspace]"),r=t.find("input[name=password]"),s=t.find("input[name=email]"),d=t.find("select[name=locale]"),u=t.find("select[name=theme]"),c=t.find("input[name=editorFontFamily]"),f=t.find("input[name=editorFontSize]"),g=t.find("input[name=editorLineHeight]"),p=t.find("select[name=editorTheme]"),v=t.find("input[name=editorTabSize]"),m=t.find("select[name=keymap]");$.extend(e,{fontFamily:a.val(),fontSize:n.val(),goFmt:i.val(),goBuildArgs:o.val(),workspace:l.val(),password:r.val(),email:s.val(),locale:d.val(),theme:u.val(),editorFontFamily:c.val(),editorFontSize:f.val(),editorLineHeight:g.val(),editorTheme:p.val(),editorTabSize:v.val(),keymap:m.val()}),config.keymap!==m.val()&&window.location.reload(),$.ajax({type:"POST",url:config.context+"/preference",data:JSON.stringify(e),success:function(e,t,h){if(!e.succ)return!1;a.data("value",a.val()),n.data("value",n.val()),i.data("value",i.val()),o.data("value",o.val()),l.data("value",l.val()),r.data("value",r.val()),s.data("value",s.val()),d.data("value",d.val()),u.data("value",u.val()),c.data("value",c.val()),f.data("value",f.val()),g.data("value",g.val()),p.data("value",p.val()),v.data("value",v.val()),m.data("value",m.val()),config.keymap=m.val();var b=$("#dialogPreference").closest(".dialog-main").find(".dialog-footer > button:eq(0)");b.prop("disabled",!0),$("#themesLink").attr("href",config.staticServer+"/static/css/themes/"+u.val()+".css"),config.editorTheme=p.val();for(var w=0,x=editors.data.length;x>w;w++)editors.data[w].editor.setOption("theme",p.val())}})}}),new Tabs({id:".preference"})})}}; +var menu={init:function(){this.subMenu(),this._initPreference(),this._initAbout(),this._initShare(),$(".menu .frame li").click(function(){$(".menu > ul > li").unbind().removeClass("selected"),menu.subMenu()})},_initShare:function(){$(".menu .ico-share").hover(function(){$(".menu .share-panel").show()}),$(".share-panel .font-ico").click(function(){var e=$(this).attr("class").split("-")[2],t="https://wide.b3log.org",a="https://wide.b3log.org/static/images/wide-logo.png",n={};n.email="mailto:?subject="+$("title").text()+"&body="+$("meta[name=description]").attr("content")+" "+t;var i=encodeURIComponent($("meta[name=description]").attr("content")+" "+t+" #golang");n.twitter="https://twitter.com/intent/tweet?status="+i,n.facebook="https://www.facebook.com/sharer/sharer.php?u="+t,n.googleplus="https://plus.google.com/share?url="+t;var o=encodeURIComponent($("title").text()+". \n"+$("meta[name=description]").attr("content")+" #golang#");n.weibo="http://v.t.sina.com.cn/share/share.php?title="+o+"&url="+t+"&pic="+a,n.tencent="http://share.v.t.qq.com/index.php?c=share&a=index&title="+o+"&url="+t+"&pic="+a,window.open(n[e],"_blank","top=100,left=200,width=648,height=618")})},_initAbout:function(){$("#dialogAbout").load(config.context+"/about",function(){$("#dialogAbout").dialog({modal:!0,title:config.label.about,hideFooter:!0,afterOpen:function(){$.ajax({url:"https://rhythm.b3log.org/version/wide/latest",type:"GET",dataType:"jsonp",jsonp:"callback",success:function(e,t){$("#dialogAbout .version").text()===e.wideVersion?$(".upgrade").text(config.label.uptodate):$(".upgrade").html(config.label.new_version_available+config.label.colon+""+e.wideVersion+"")}})}})})},disabled:function(e){for(var t=0,a=e.length;a>t;t++)$(".menu li."+e[t]).addClass("disabled")},undisabled:function(e){for(var t=0,a=e.length;a>t;t++)$(".menu li."+e[t]).removeClass("disabled")},subMenu:function(){$(".menu > ul > li").click(function(e){if(1!==$(e.target).closest(".frame").length){var t=$(this);t.find(".frame").show(),$(".menu > ul > li").removeClass("selected"),$(this).addClass("selected"),$(".menu > ul > li").unbind(),$(".menu > ul > li").mouseover(function(){1!==$(e.target).closest(".frame").length&&($(".menu .frame").hide(),$(this).find(".frame").show(),$(".menu > ul > li").removeClass("selected"),$(this).addClass("selected"))})}})},openPreference:function(){$("#dialogPreference").dialog("open")},saveAllFiles:function(){if($(".menu li.save-all").hasClass("disabled"))return!1;for(var e=0,t=editors.data.length;t>e;e++){var a=editors.data[e].id,n=editors.data[e].editor;"text/x-go"===n.getOption("mode")?wide.fmt(a,n):wide._save(a,n)}},closeAllFiles:function(){if($(".menu li.close-all").hasClass("disabled"))return!1;var e=[];$(".edit-panel .tabs > div").each(function(t){0!==t&&e.push($(this).data("index"))}),$("#dialogCloseEditor").data("removeData",e),$(".edit-panel .tabs .ico-close:eq(0)").click()},exit:function(){var e=newWideRequest();$.ajax({type:"POST",url:config.context+"/logout",data:JSON.stringify(e),dataType:"json",success:function(e){e.succ&&(window.location.href=config.context+"/login")}})},openAbout:function(){$("#dialogAbout").dialog("open")},goget:function(){menu.saveAllFiles();var e=editors.getCurrentPath();if(!e)return!1;if($(".menu li.go-get").hasClass("disabled"))return!1;var t=newWideRequest();t.file=e,$.ajax({type:"POST",url:config.context+"/go/get",data:JSON.stringify(t),dataType:"json",beforeSend:function(){bottomGroup.resetOutput()},success:function(e){}})},goinstall:function(){menu.saveAllFiles();var e=editors.getCurrentPath();if(!e)return!1;if($(".menu li.go-install").hasClass("disabled"))return!1;var t=newWideRequest();t.file=e,$.ajax({type:"POST",url:config.context+"/go/install",data:JSON.stringify(t),dataType:"json",beforeSend:function(){bottomGroup.resetOutput()},success:function(e){}})},test:function(){menu.saveAllFiles();var e=editors.getCurrentPath();if(!e)return!1;if($(".menu li.go-test").hasClass("disabled"))return!1;var t=newWideRequest();t.file=e,$.ajax({type:"POST",url:config.context+"/go/test",data:JSON.stringify(t),dataType:"json",beforeSend:function(){bottomGroup.resetOutput()},success:function(e){}})},govet:function(){menu.saveAllFiles();var e=editors.getCurrentPath();if(!e)return!1;if($(".menu li.go-vet").hasClass("disabled"))return!1;var t=newWideRequest();t.file=e,$.ajax({type:"POST",url:config.context+"/go/vet",data:JSON.stringify(t),dataType:"json",beforeSend:function(){bottomGroup.resetOutput()},success:function(e){}})},run:function(){if(menu.saveAllFiles(),$("#buildRun").hasClass("ico-stop"))return wide.stop(),!1;var e=editors.getCurrentPath();if(!e)return!1;if($(".menu li.run").hasClass("disabled"))return!1;var t=newWideRequest();t.file=e,t.code=wide.curEditor.getValue(),t.nextCmd="run",$.ajax({type:"POST",url:config.context+"/build",data:JSON.stringify(t),dataType:"json",beforeSend:function(){bottomGroup.resetOutput(),$("#buildRun").addClass("ico-stop").removeClass("ico-buildrun").attr("title",config.label.stop)},success:function(e){}})},build:function(){menu.saveAllFiles();var e=editors.getCurrentPath();if(!e)return!1;if($(".menu li.build").hasClass("disabled"))return!1;var t=newWideRequest();t.file=e,t.code=wide.curEditor.getValue(),t.nextCmd="",$.ajax({type:"POST",url:config.context+"/build",data:JSON.stringify(t),dataType:"json",beforeSend:function(){bottomGroup.resetOutput()},success:function(e){}})},_initPreference:function(){$("#dialogPreference").load(config.context+"/preference",function(){$("#dialogPreference input").keyup(function(){var e=!1,t=[],a="";$("#dialogPreference input").each(function(){var a=$(this);a.val()!=a.data("value")&&(e=!0),""===$.trim(a.val())&&t.push(a)});var n=$("#dialogPreference").closest(".dialog-main").find(".dialog-footer > button:eq(0)");if(e?n.prop("disabled",!1):n.prop("disabled",!0),0===t.length)$("#dialogPreference").find(".tip").html(""),n.prop("disabled",!1);else{for(var i=0,o=t.length;o>i;i++){var l=t[i].closest("div").data("index"),r=$.trim(t[i].parent().text());a+="["+$('#dialogPreference .tabs > div[data-index="'+l+'"]').text()+"] -> ["+r.substr(0,r.length-1)+"]: "+config.label.no_empty+"
    "}$("#dialogPreference").find(".tip").html(a),n.prop("disabled",!0)}}),$("#dialogPreference select").on("change",function(){var e=!1;$("#dialogPreference select").each(function(){$(this).val()!==$(this).data("value")&&(e=!0)});var t=$("#dialogPreference").closest(".dialog-main").find(".dialog-footer > button:eq(0)");e?t.prop("disabled",!1):t.prop("disabled",!0)}),$("#dialogPreference").dialog({modal:!0,height:280,width:800,title:config.label.preference,okText:config.label.apply,cancelText:config.label.cancel,afterOpen:function(){var e=$("#dialogPreference").closest(".dialog-main").find(".dialog-footer > button:eq(0)");e.prop("disabled",!0)},ok:function(){var e=newWideRequest(),t=$("#dialogPreference"),a=t.find("input[name=fontFamily]"),n=t.find("input[name=fontSize]"),i=t.find("select[name=goFmt]"),o = t.find("input[name=GoBuildArgsforLinux]"),q = t.find("input[name=GoBuildArgsforWindows]"),w = t.find("input[name=GoBuildArgsforDarwin]"),l=t.find("input[name=workspace]"),r=t.find("input[name=password]"),s=t.find("input[name=email]"),d=t.find("select[name=locale]"),u=t.find("select[name=theme]"),c=t.find("input[name=editorFontFamily]"),f=t.find("input[name=editorFontSize]"),g=t.find("input[name=editorLineHeight]"),p=t.find("select[name=editorTheme]"),v=t.find("input[name=editorTabSize]"),m=t.find("select[name=keymap]");$.extend(e,{fontFamily:a.val(),fontSize:n.val(),goFmt:i.val(),GoBuildArgsforLinux: o.val(),GoBuildArgsforWindows: q.val(),GoBuildArgsforDarwin: w.val(),,workspace:l.val(),password:r.val(),email:s.val(),locale:d.val(),theme:u.val(),editorFontFamily:c.val(),editorFontSize:f.val(),editorLineHeight:g.val(),editorTheme:p.val(),editorTabSize:v.val(),keymap:m.val()}),config.keymap!==m.val()&&window.location.reload(),$.ajax({type:"POST",url:config.context+"/preference",data:JSON.stringify(e),success:function(e,t,h){if(!e.succ)return!1;a.data("value",a.val()),n.data("value",n.val()),i.data("value",i.val()),o.data("value",o.val()),l.data("value",l.val()),r.data("value",r.val()),s.data("value",s.val()),d.data("value",d.val()),u.data("value",u.val()),c.data("value",c.val()),f.data("value",f.val()),g.data("value",g.val()),p.data("value",p.val()),v.data("value",v.val()),m.data("value",m.val()),config.keymap=m.val();var b=$("#dialogPreference").closest(".dialog-main").find(".dialog-footer > button:eq(0)");b.prop("disabled",!0),$("#themesLink").attr("href",config.staticServer+"/static/css/themes/"+u.val()+".css"),config.editorTheme=p.val();for(var w=0,x=editors.data.length;x>w;w++)editors.data[w].editor.setOption("theme",p.val())}})}}),new Tabs({id:".preference"})})}}; var windows={isMaxEditor:!1,outerLayout:{},innerLayout:{},init:function(){config.latestSessionContent||(config.latestSessionContent={fileTree:[],files:[],currentFile:""}),config.latestSessionContent.layout||(config.latestSessionContent.layout={side:{size:200,state:"normal"},sideRight:{size:200,state:"normal"},bottom:{size:100,state:"normal"}});var o=config.latestSessionContent.layout;this.outerLayout=$("body").layout({north__paneSelector:".menu",center__paneSelector:".content",south__paneSelector:".footer",north__size:22,south__size:19,spacing_open:2,north__spacing_open:0,south__spacing_open:0,defaults:{fxSpeed_open:300,fxSpeed_close:100,fxSettings_close:{easing:"easeOutQuint"},fxSettings_open:{easing:"easeInQuint"}},west:{size:o.side.size,paneSelector:".side",togglerLength_open:0,togglerLength_closed:15,togglerAlign_closed:"top",slideTrigger_open:"mouseover",spacing_closed:15,minSize:100,togglerClass:"ico-restore",togglerTip_open:config.label.min,togglerTip_closed:config.label.restore_side,resizerTip:config.label.resize,initClosed:"min"===o.side.state}}),this.innerLayout=$("div.content").layout({spacing_open:2,defaults:{fxSpeed_open:300,fxSpeed_close:100,fxSettings_close:{easing:"easeOutQuint"},fxSettings_open:{easing:"easeInQuint"}},center:{paneSelector:".edit-panel"},east:{size:o.sideRight.size,paneSelector:".side-right",togglerLength_open:0,togglerLength_closed:15,togglerAlign_closed:"top",slideTrigger_open:"mouseover",spacing_closed:15,minSize:100,togglerClass:"ico-restore",togglerTip_open:config.label.min,togglerTip_closed:config.label.restore_outline,resizerTip:config.label.resize,initClosed:"min"===o.sideRight.state},south:{size:o.bottom.size,paneSelector:".bottom-window-group",togglerLength_open:0,togglerLength_closed:15,togglerAlign_closed:"top",slideTrigger_open:"mouseover",spacing_closed:16,minSize:100,togglerClass:"ico-restore",togglerTip_open:config.label.min,togglerTip_closed:config.label.restore_bottom,resizerTip:config.label.resize,initClosed:"min"===o.bottom.state,ondrag_end:function(o,e){windows.refreshEditor(e,"drag")},onresize_end:function(o,e){windows.refreshEditor(e,"resize")},onclose_end:function(o,e){windows.refreshEditor(e,"close")},onopen_end:function(o,e){windows.refreshEditor(e,"open")},onshow_end:function(o,e){windows.refreshEditor(e,"show")}}}),this.outerLayout.addCloseBtn(".side .ico-min","west"),this.innerLayout.addCloseBtn(".side-right .ico-min","east"),this.innerLayout.addCloseBtn(".bottom-window-group .ico-min","south"),"max"===o.side.state&&windows.maxSide(),"max"===o.sideRight.state&&windows.maxSideRight(),"max"===o.bottom.state&&windows.maxBottom(),$(".toolbars .ico-max").click(function(){windows.toggleEditor()}),$(".edit-panel .tabs").on("dblclick",function(){windows.toggleEditor()}),$(".bottom-window-group .tabs").dblclick(function(){var o=$(".bottom-window-group");o.hasClass("bottom-window-group-max")?windows.restoreBottom():windows.maxBottom(o)}),$(".side .tabs").dblclick(function(){var o=$(".side");o.hasClass("side-max")?windows.restoreSide():windows.restoreSide(o)}),$(".side-right .tabs").dblclick(function(){var o=$(".side-right");o.hasClass("side-right-max")?windows.restoreSideRight():windows.maxSideRight(o)}),$(".bottom-window-group .search").height($(".bottom-window-group .tabs-panel").height()),$(window).resize(function(){windows.refreshEditor($(".bottom-window-group"))})},maxEditor:function(){var o=$(".toolbars .font-ico");windows.outerLayout.close("west"),windows.innerLayout.close("south"),windows.innerLayout.close("east"),o.removeClass("ico-max").addClass("ico-restore").attr("title",config.label.min),windows.isMaxEditor=!0},maxBottom:function(o){o.data("height",o.height()).addClass("bottom-window-group-max").find(".ico-min").hide(),windows.outerLayout.hide("west"),windows.innerLayout.hide("east"),windows.innerLayout.sizePane("south",$(".content").height())},maxSide:function(o){o.data("width",o.width()).addClass("side-max").find(".ico-min").hide(),$(".content").hide(),windows.outerLayout.sizePane("west",$("body").width())},maxSideRight:function(o){o.addClass("side-right-max").data("width",o.width()).find(".ico-min").hide(),windows.outerLayout.hide("west"),windows.innerLayout.hide("south"),windows.innerLayout.sizePane("east",$("body").width())},toggleEditor:function(){var o=$(".toolbars .font-ico");o.hasClass("ico-restore")?windows.restoreEditor():windows.maxEditor()},restoreBottom:function(){var o=$(".bottom-window-group");o.removeClass("bottom-window-group-max").find(".ico-min").show(),windows.outerLayout.show("west"),windows.innerLayout.show("east"),windows.innerLayout.sizePane("south",o.data("height"))},restoreSide:function(){var o=$(".side");o.removeClass("side-max").find(".ico-min").show(),$(".content").show(),windows.outerLayout.sizePane("west",o.data("width"))},restoreSideRight:function(){var o=$(".side-right");o.removeClass("side-right-max").find(".ico-min").show(),windows.outerLayout.show("west"),windows.innerLayout.show("south"),windows.innerLayout.sizePane("east",o.data("width"))},restoreEditor:function(){windows.outerLayout.open("west"),windows.innerLayout.open("south"),windows.innerLayout.open("east"),windows.isMaxEditor=!1,$(".toolbars .font-ico").addClass("ico-max").removeClass("ico-restore").attr("title",config.label.max_editor)},refreshEditor:function(o,e){var t=editors.data,i=$(".content").height()-o.height()-24;switch(e){case"close":i=$(".content").height()-40}for(var n=0,s=t.length;s>n;n++)t[n].editor.setSize("100%",i);$(".bottom-window-group .search").height($(".bottom-window-group .tabs-panel").height())},flowBottom:function(){windows.innerLayout.south.state.isClosed&&windows.innerLayout.slideOpen("south")}}; var hotkeys={defaultKeyMap:{goEditor:{ctrlKey:!0,altKey:!1,shiftKey:!1,which:48,fun:function(){wide.curEditor&&wide.curEditor.focus()}},goFileTree:{ctrlKey:!0,altKey:!1,shiftKey:!1,which:49,fun:function(){windows.outerLayout.west.state.isClosed&&windows.outerLayout.slideOpen("west"),$("#files").focus()}},goOutline:{ctrlKey:!0,altKey:!1,shiftKey:!1,which:50,fun:function(){windows.innerLayout.east.state.isClosed&&windows.innerLayout.slideOpen("east"),$("#outline").focus()}},goOutput:{ctrlKey:!0,altKey:!1,shiftKey:!1,which:52,fun:function(){bottomGroup.tabs.setCurrent("output"),windows.flowBottom(),$(".bottom-window-group .output").focus()}},goSearch:{ctrlKey:!0,altKey:!1,shiftKey:!1,which:53,fun:function(){bottomGroup.tabs.setCurrent("search"),windows.flowBottom(),$(".bottom-window-group .search").focus()}},goNotification:{ctrlKey:!0,altKey:!1,shiftKey:!1,which:54,fun:function(){bottomGroup.tabs.setCurrent("notification"),windows.flowBottom(),$(".bottom-window-group .notification").focus()}},clearWindow:{ctrlKey:!1,altKey:!0,shiftKey:!1,which:67},changeEditor:{ctrlKey:!0,altKey:!1,shiftKey:!1,which:68},search:{ctrlKey:!0,altKey:!1,shiftKey:!1,which:70},closeCurEditor:{ctrlKey:!0,altKey:!1,shiftKey:!1,which:81},rename:{ctrlKey:!0,altKey:!1,shiftKey:!1,which:82},goFile:{ctrlKey:!1,altKey:!0,shiftKey:!0,which:79},build:{ctrlKey:!1,altKey:!1,shiftKey:!1,which:116},buildRun:{ctrlKey:!1,altKey:!1,shiftKey:!1,which:117}},bindList:function(e,t,i){t.data("index",0),e.keydown(function(e){var r=t.data("index"),o=t.find("li").length;if(0===o)return!0;38===e.which&&(r--,0>r&&(r=o-1)),40===e.which&&(r++,r>o-1&&(r=0));var d=t.find("li:eq("+r+")");return 13===e.which&&i(d),t.find("li").removeClass("selected"),t.data("index",r),d.addClass("selected"),0===r?t.scrollTop(0):d[0].offsetTop+t.scrollTop()>t.height()?40===e.which?t.scrollTop(t.scrollTop()+d.height()):t.scrollTop(d[0].offsetTop):t.scrollTop(0),38===e.which||40===e.which||13===e.which?!1:void 0})},_bindOutput:function(){$(".bottom-window-group .output").keydown(function(e){var t=hotkeys.defaultKeyMap;return e.altKey===t.clearWindow.altKey&&e.which===t.clearWindow.which?(bottomGroup.clear("output"),void e.preventDefault()):void 0})},_bindFileTree:function(){$("#files").keydown(function(e){e.preventDefault();var t=hotkeys.defaultKeyMap;if(e.ctrlKey===t.search.ctrlKey&&e.which===t.search.which)return void $("#dialogSearchForm").dialog("open");if(e.ctrlKey===t.rename.ctrlKey&&e.which===t.rename.which)return void(wide.curNode.removable&&$("#dialogRenamePrompt").dialog("open"));switch(e.which){case 46:tree.removeIt();break;case 13:if(!wide.curNode)return!1;if(tree.isDir()){if(wide.curNode.open)return!1;tree.fileTree.expandNode(wide.curNode,!0,!1,!0),$("#files").focus();break}tree.openFile(wide.curNode);break;case 38:var i={};if(wide.curNode){if(wide.curNode&&wide.curNode.isFirstNode&&0===wide.curNode.level)return!1;i=wide.curNode.getPreNode(),wide.curNode.isFirstNode&&wide.curNode.getParentNode()&&(i=wide.curNode.getParentNode());var r=wide.curNode.getPreNode();r&&tree.isDir()&&r.open&&(i=tree.getCurrentNodeLastNode(r))}else i=tree.fileTree.getNodeByTId("files_1");wide.curNode=i,tree.fileTree.selectNode(i),$("#files").focus();break;case 40:var i={};if(wide.curNode){if(wide.curNode&&tree.isBottomNode(wide.curNode))return!1;i=wide.curNode.getNextNode(),tree.isDir()&&wide.curNode.open&&(i=wide.curNode.children[0]);var o=tree.getNextShowNode(wide.curNode);wide.curNode.isLastNode&&0!==wide.curNode.level&&!wide.curNode.open&&o&&(i=o)}else i=tree.fileTree.getNodeByTId("files_1");i&&(wide.curNode=i,tree.fileTree.selectNode(i)),$("#files").focus();break;case 37:if(!wide.curNode)return wide.curNode=tree.fileTree.getNodeByTId("files_1"),tree.fileTree.selectNode(wide.curNode),$("#files").focus(),!1;if(!tree.isDir()||!wide.curNode.open)return!1;tree.fileTree.expandNode(wide.curNode,!1,!1,!0),$("#files").focus();break;case 39:if(!wide.curNode)return wide.curNode=tree.fileTree.getNodeByTId("files_1"),tree.fileTree.selectNode(wide.curNode),$("#files").focus(),!1;if(!tree.isDir()||wide.curNode.open)return!1;tree.fileTree.expandNode(wide.curNode,!0,!1,!0),$("#files").focus();break;case 116:if(!wide.curNode||!tree.isDir())return!1;tree.refresh(wide.curNode)}})},_bindDocument:function(){var e=this.defaultKeyMap;$(document).keydown(function(t){if(t.ctrlKey===e.goEditor.ctrlKey&&t.which===e.goEditor.which)return e.goEditor.fun(),void t.preventDefault();if(t.ctrlKey===e.goFileTree.ctrlKey&&t.which===e.goFileTree.which)return e.goFileTree.fun(),void t.preventDefault();if(t.ctrlKey===e.goOutline.ctrlKey&&t.which===e.goOutline.which)return e.goOutline.fun(),void t.preventDefault();if(t.ctrlKey===e.goOutput.ctrlKey&&t.which===e.goOutput.which)return e.goOutput.fun(),void t.preventDefault();if(t.ctrlKey===e.goSearch.ctrlKey&&t.which===e.goSearch.which)return e.goSearch.fun(),void t.preventDefault();if(t.ctrlKey===e.goNotification.ctrlKey&&t.which===e.goNotification.which)return e.goNotification.fun(),void t.preventDefault();if(t.ctrlKey===e.closeCurEditor.ctrlKey&&t.which===e.closeCurEditor.which)return $(".edit-panel .tabs > div.current").find(".ico-close").click(),void t.preventDefault();if(t.ctrlKey===e.changeEditor.ctrlKey&&t.which===e.changeEditor.which){if("notification"===document.activeElement.className||"output"===document.activeElement.className||"search"===document.activeElement.className){for(var i=["output","search","notification"],r="",o=0,d=i.length;d>o;o++)if(bottomGroup.tabs.getCurrentId()===i[o]){r=d-1>o?i[o+1]:i[0];break}return bottomGroup.tabs.setCurrent(r),$(".bottom-window-group ."+r).focus(),t.preventDefault(),!1}if(editors.data.length>1){for(var r="",o=0,d=editors.data.length;d>o;o++){var c=editors.getCurrentId();if(c&&c===editors.data[o].id){d-1>o?(r=editors.data[o+1].id,wide.curEditor=editors.data[o+1].editor):(r=editors.data[0].id,wide.curEditor=editors.data[0].editor);break}}editors.tabs.setCurrent(r);var u=tree.getTIdByPath(r);wide.curNode=tree.fileTree.getNodeByTId(u),tree.fileTree.selectNode(wide.curNode),wide.refreshOutline();var n=wide.curEditor.getCursor();$(".footer .cursor").text("| "+(n.line+1)+":"+(n.ch+1)+" |"),wide.curEditor.focus()}return t.preventDefault(),!1}return t.which===e.build.which?(menu.build(),void t.preventDefault()):t.which===e.buildRun.which?(menu.run(),void t.preventDefault()):void(t.ctrlKey===e.goFile.ctrlKey&&t.altKey===e.goFile.altKey&&t.shiftKey===e.goFile.shiftKey&&t.which===e.goFile.which&&$("#dialogGoFilePrompt").dialog("open"))})},init:function(){this._bindFileTree(),this._bindOutput(),this._bindDocument()}}; var bottomGroup={tabs:void 0,searchTab:void 0,init:function(){this._initTabs(),this._initFrame(),$(".bottom-window-group .output").click(function(){$(this).focus()}),$(".bottom-window-group .output").on("click",".path",function(t){var o=$(this),i=tree.getTIdByPath(o.data("path"));return tree.openFile(tree.fileTree.getNodeByTId(i),CodeMirror.Pos(o.data("line")-1,o.data("column")-1)),t.preventDefault(),!1})},_initFrame:function(){$(".bottom-window-group .output").parent().mouseup(function(t){if(t.stopPropagation(),0===t.button)return void $(".bottom-window-group .frame").hide();var o=t.screenX,i=$(this);("auto"===$(".side").css("left")||"0px"===$(".side").css("left"))&&(o=t.screenX-$(".side").width()),$(".bottom-window-group .frame").show().css({left:o+"px",top:t.offsetY+t.target.offsetTop-i.scrollTop()-10+"px"})})},clear:function(t){$(".bottom-window-group ."+t+" > div").text("")},resetOutput:function(){this.clear("output"),bottomGroup.tabs.setCurrent("output"),windows.flowBottom()},_initTabs:function(){this.tabs=new Tabs({id:".bottom-window-group",clickAfter:function(t){this._$tabsPanel.find("."+t).focus()}})},fillOutput:function(t){var o=$(".bottom-window-group .output");t=t.replace(/\r/g,""),t=t.replace(/\n/g,"
    "),-1!==t.indexOf("
    ")&&(t=Autolinker.link(t)),o.find("div").html(t),o.parent().scrollTop(o[0].scrollHeight)}};