From 699ba5e0c5d2af3432e66f9d3f5dd17ae9e20944 Mon Sep 17 00:00:00 2001 From: khjde1207 Date: Mon, 27 Mar 2017 10:37:28 +0900 Subject: [PATCH 01/13] Update preference.html --- views/preference.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/views/preference.html b/views/preference.html index 8f24297..1e2209f 100644 --- a/views/preference.html +++ b/views/preference.html @@ -71,8 +71,16 @@ + +
@@ -115,4 +123,4 @@
-
\ No newline at end of file +
From 2f4ead473108814d71a0118d5803235f599f58e0 Mon Sep 17 00:00:00 2001 From: khjde1207 Date: Mon, 27 Mar 2017 10:38:59 +0900 Subject: [PATCH 02/13] Update users.go --- session/users.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/session/users.go b/session/users.go index 1add20a..3656478 100644 --- a/session/users.go +++ b/session/users.go @@ -95,7 +95,9 @@ func PreferenceHandler(w http.ResponseWriter, r *http.Request) { FontFamily string FontSize string GoFmt string - GoBuildArgs string + GoBuildArgsforLinux string + GoBuildArgsforWindows string + GoBuildArgsforDarwin string Keymap string Workspace string Username string @@ -120,7 +122,9 @@ func PreferenceHandler(w http.ResponseWriter, r *http.Request) { user.FontFamily = args.FontFamily user.FontSize = args.FontSize user.GoFormat = args.GoFmt - user.GoBuildArgs = args.GoBuildArgs + user.GoBuildArgsforLinux = args.GoBuildArgsforLinux + user.GoBuildArgsforWindows = args.GoBuildArgsforWindows + user.GoBuildArgsforDarwin = args.GoBuildArgsforDarwin user.Keymap = args.Keymap // XXX: disallow change workspace at present // user.Workspace = args.Workspace From 290625c8e99b5e12d89b87e371bec4497a973332 Mon Sep 17 00:00:00 2001 From: khjde1207 Date: Mon, 27 Mar 2017 10:43:41 +0900 Subject: [PATCH 03/13] 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='
    ',i=["constDecls","varDecls","funcDecls","structDecls","interfaceDecls","typeDecls"],a=0,n=i.length;n>a;a++)for(var l=i[a],r=0,c=t[l].length;c>r;r++){var s=t[l][r];o+='
  • '+s.Name+"
  • "}$("#outline").html(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)}}; From 9314f2b7219684daa3bf5cb08c77acebf78fd84d Mon Sep 17 00:00:00 2001 From: khjde1207 Date: Mon, 27 Mar 2017 10:46:50 +0900 Subject: [PATCH 04/13] Update wide.min.js.map --- static/js/wide.min.js.map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/wide.min.js.map b/static/js/wide.min.js.map index 5040005..d773e94 100644 --- a/static/js/wide.min.js.map +++ b/static/js/wide.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["tabs.js","dialog.js","editors.js","notification.js","tree.js","wide.js","session.js","menu.js","windows.js","hotkeys.js","bottomGroup.js"],"names":["Tabs","obj","_$tabsPanel","$","id","_$tabs","_stack","this","STACKSIZE","_init","_it","each","data","length","splice","push","extend","prototype","_that","on","event","hasClass","setCurrent","clickAfter","parent","isRemove","removeBefore","del","stopPropagation","_hasId","$tabs","find","add","getCurrentId","$tabsPanel","append","title","content","after","stack","prevId","children","remove","i","removeAfter","path","$currentTab","removeClass","hide","addClass","show","setAfter","tId","tree","getTIdByPath","node","fileTree","getNodeByTId","selectNode","wide","curNode","ii","editors","curEditor","editor","cursor","getCursor","setCursor","focus","refreshOutline","text","line","ch","fn","dialog","version","author","dpuuid","Date","getTime","PROP_NAME","Dialog","_defaults","styleClass","background","panel","main","footer","headerMiddle","headerBg","closeIcon","closeIconHover","_attach","target","settings","uuid","inst","_newInst","replace","_getInst","err","_destroyDialog","removeData","prependTo","unwrap","removeAttr","_getDefaults","windowH","window","height","windowW","width","dialogH","parseInt","dialogW","okText","cancelText","footerHTML","headerHTML","hideFooter","hiddenOk","dialogHTML","bgHTML","modal","bgHeight","document","documentElement","scrollHeight","wrap","cloneObj","clone","get","bind","_close","$buttons","undefined","ok","_bindMove","keyup","keyCode","resize","afterInit","className","mousedown","_document","getElementById","x","clientX","style","left","y","clientY","top","ondragstart","onselectstart","onselect","setCapture","captureEvents","Event","MOUSEMOVE","MOUSEUP","onmousemove","positionX","positionY","onmouseup","releaseCapture","css","close","_closeDialog","_openDialog","msg","$dialog","position","afterOpen","_updateDialog","html","defaults","key","theme","styleName","options","otherArgs","Array","slice","call","arguments","shift","apply","concat","jQuery","autocompleteMutex","tabs","getEditorByPath","click","closeOther","currentIndex","firstIndex","_removeAllMarker","removeIndex","_initClose","ZeroClipboard","button","screenX","attr","init","config","label","tip","fileName","file","confirm_save","fmt","doc","isClean","nextId","menu","disabled","cancelSelectedNode","_initCodeMirrorHotKeys","openStartPage","dateFormat","time","date","dateObj","M+","getMonth","d+","getDate","h+","getHours","m+","getMinutes","s+","getSeconds","q+","Math","floor","S","getMilliseconds","test","RegExp","$1","getFullYear","substr","k","start_page","load","context","wideSessionId","ajax","url","type","dataType","jsonp","success","textStatus","articles","listHTML","community","article","articlePermalink","articleTitle","articleCreateTime","ret","getCurrentPath","currentPath","CodeMirror","registerHelper","word","cur","curLine","getLine","start","end","charAt","request","newWideRequest","code","getValue","cursorLine","cursorCh","autocompleteHints","state","completionActive","async","JSON","stringify","autocompleteArray","displayText","name","substring","console","warn","markClean","setTimeout","list","from","Pos","to","commands","autocompleteAfterDot","cm","mode","getMode","Pass","token","getTokenAt","showHint","hint","go","completeSingle","autocompleteAnyWord","auto","gotoLine","doNothing","exprInfo","result","succ","cursorCoords","copyLinesDown","selectoion","listSelections","anchor","head","max","replaceToLine","replaceRange","offset","setSelection","copyLinesUp","moveLinesUp","moveLinesDown","lastLine","jumpToDecl","openFile","findUsages","appendSearch","selectIdentifier","findWordAt","extendSelection","searcHTML","toLowerCase","contents","lowerCaseContents","matches","split","startIndex","endIndex","j","keyWord","search_no_match","$search","find_usages","search_text","bottomGroup","searchTab","$it","half","getScrollInfo","clientHeight","defaultTextHeight","scrollTo","windows","flowBottom","newEditor","iconSkin","undisabled","textArea","value","fromTextArea","lineNumbers","autofocus","autoCloseBrackets","matchBrackets","highlightSelectionMatches","showToken","rulers","color","column","lineStyle","styleActiveLine","editorTheme","tabSize","editorTabSize","indentUnit","indentWithTabs","foldGutter","cursorHeight","readOnly","isGOAPI","profile","extraKeys","Ctrl-\\",".","Ctrl-/","Ctrl-I","Ctrl-L","Ctrl-E","Ctrl-D","Ctrl-B","Ctrl-S","saveFile","Shift-Ctrl-S","saveAllFiles","Shift-Alt-F","Alt-F7","Shift-Alt-Enter","isMaxEditor","restoreEditor","maxEditor","Shift-Ctrl-Up","Shift-Ctrl-Down","Shift-Alt-Up","Shift-Alt-Down","Shift-Alt-J","emmetCodeMirror","$span","evt","altKey","ctrlKey","shiftKey","which","autocomplete","random","setSize","setOption","keymap","notification","_initWS","notificationWS","ReconnectingWebSocket","channel","onopen","log","onmessage","e","parse","$notification","notificationHTML","cmd","severity","message","onclose","onerror","getCurrentNodeLastNode","returnNode","open","getNextShowNode","level","getParentNode","getNextNode","isBottomNode","isLastNode","nodes","transformToArray","getNodes","getOpenPaths","paths","getAllParents","parents","parentTId","isParents","parentPath","parentNode","isDir","indexOf","newFile","it","newDir","removeIt","removable","rename","export","isSucc","crossCompile","platform","decompress","dir","reAsyncChildNodes","refresh","gitClone","import","fileupload","formData","done","fail","$dirRMenu","$fileRMenu","setting","view","showTitle","selectedMulti","enable","autoParam","callback","onDblClick","treeId","treeNode","onRightClick","creatable","display","onClick","clickFlag","zTree","session","restore","_initSearch","_initRename","tempCursor","findModeByFileName","mime","error","$okBtn","closest","prop","trim","val","search","cancel","extension","select","oldPath","newPath","lastIndexOf","curProcessId","outlineHTML","decls","maxj","Ch","Line","Name","dblclick","_initDialog","confirm","create_file","create","fileType","create_dir","goto_file","$list","hotkeys","bindList","$selected","goFileHTML","icoSkin","getClassBySuffix","goto_line","git_clone","repository","outputWS","goLintFound","nextCmd","executable","fillOutput","output","pid","build_n_run","lints","files","lint","lineNo","signal","_initFooter","unbind","subMenu","onbeforeunload","oncontextmenu","_save","getOption","gofmt","beforeSend","resetOutput","stop","run","scrollInfo","setValue","formatted","html_beautify","js_beautify","css_beautify","suffix","ready","getLayoutState","paneState","isClosed","size","setInterval","filse","currentId","currentFile","layout","side","outerLayout","west","sideRight","innerLayout","east","bottom","south","latestSessionContent","nodesToOpen","jj","isOpen","l","expandNode","kk","m","mm","n","nn","c","sessionWS","addNodes","isParent","removeNode","_initPreference","_initAbout","_initShare","hover","pic","urls","email","twitterShare","encodeURIComponent","twitter","facebook","googleplus","weibo","tencent","about","wideVersion","uptodate","new_version_available","colon","wideDownload","mouseover","openPreference","closeAllFiles","exit","location","href","openAbout","goget","goinstall","govet","build","isChange","emptys","emptysTip","tabIndex","no_empty","preference","$dialogPreference","$fontFamily","$fontSize","$goFmt","$goBuildArgs","$workspace","$password","$email","$locale","$theme","$editorFontFamily","$editorFontSize","$editorLineHeight","$editorTheme","$editorTabSize","$keymap","fontFamily","fontSize","goFmt","goBuildArgs","workspace","password","locale","editorFontFamily","editorFontSize","editorLineHeight","reload","jqXHR","staticServer","north__paneSelector","center__paneSelector","south__paneSelector","north__size","south__size","spacing_open","north__spacing_open","south__spacing_open","fxSpeed_open","fxSpeed_close","fxSettings_close","easing","fxSettings_open","paneSelector","togglerLength_open","togglerLength_closed","togglerAlign_closed","slideTrigger_open","spacing_closed","minSize","togglerClass","togglerTip_open","min","togglerTip_closed","restore_side","resizerTip","initClosed","center","restore_outline","restore_bottom","ondrag_end","pane","refreshEditor","onresize_end","onclose_end","onopen_end","onshow_end","addCloseBtn","maxSide","maxSideRight","maxBottom","toggleEditor","restoreBottom","restoreSide","restoreSideRight","sizePane","max_editor","editorDatas","slideOpen","defaultKeyMap","goEditor","fun","goFileTree","goOutline","goOutput","goSearch","goNotification","clearWindow","changeEditor","closeCurEditor","goFile","buildRun","$source","enterFun","keydown","index","count","scrollTop","offsetTop","_bindOutput","hotKeys","clear","preventDefault","_bindFileTree","isFirstNode","getPreNode","preNode","nextShowNode","_bindDocument","activeElement","nextPath","nextTId","_initTabs","_initFrame","$path","mouseup","offsetY","$output","Autolinker","link"],"mappings":"AAsBA,GAAIA,MAAO,SAAUC,GACjBA,EAAIC,YAAcC,EAAEF,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EAAMyE,OAAOgpB,UAAYzY,EAAIwY,YAAc,GAAM,UAKrFI,MAAO,SAAU5uB,GACbD,EAAE,yBAA2BC,EAAK,UAAUkE,KAAK,KAErDqf,YAAa,WACTpjB,KAAKyuB,MAAM,UACX9Y,YAAYnK,KAAKzK,WAAW,UAC5BoV,QAAQC,cAEZgZ,UAAW,WACPpvB,KAAKwL,KAAO,GAAI/L,OACZI,GAAI,uBACJmB,WAAY,SAAUnB,GAClBG,KAAKL,YAAY6B,KAAK,IAAM3B,GAAIgE,YAI5Cqe,WAAY,SAAU7hB,GAClB,GAAIovB,GAAU7vB,EAAE,+BAEhBS,GAAOA,EAAKsF,QAAQ,MAAO,IAC3BtF,EAAOA,EAAKsF,QAAQ,MAAO,SAEvB,KAAOtF,EAAKqc,QAAQ,WACpBrc,EAAOqvB,WAAWC,KAAKtvB,IAG3BovB,EAAQjuB,KAAK,OAAOgJ,KAAKnK,GACzBovB,EAAQxuB,SAASotB,UAAUoB,EAAQ,GAAGjoB","file":"wide.min.js","sourcesContent":["/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file tabs.js\r\n *\r\n * @author Liyuan Li\r\n * @version 1.0.0.1, Dec 8, 2015\r\n */\r\nvar Tabs = function (obj) {\r\n obj._$tabsPanel = $(obj.id + \" > .tabs-panel\");\r\n obj._$tabs = $(obj.id + \" > .tabs\");\r\n obj._stack = [];\r\n\r\n this.obj = obj;\r\n this.obj.STACKSIZE = 64;\r\n\r\n this._init(obj);\r\n\r\n // DOM 元素存在时,应顺序入栈\r\n var _it = this;\r\n $(obj.id + \" > .tabs > div\").each(function () {\r\n var id = $(this).data(\"index\");\r\n if (obj._stack.length === _it.obj.STACKSIZE) {\r\n obj._stack.splice(0, 1);\r\n }\r\n if (obj._stack[obj._stack.length - 1] !== id) {\r\n _it.obj._stack.push(id);\r\n }\r\n });\r\n\r\n};\r\n\r\n$.extend(Tabs.prototype, {\r\n _init: function (obj) {\r\n var _that = this;\r\n\r\n obj._$tabs.on(\"click\", \"div\", function (event) {\r\n if ($(this).hasClass('current')) {\r\n return false;\r\n }\r\n\r\n var id = $(this).data(\"index\");\r\n _that.setCurrent(id);\r\n if (typeof (obj.clickAfter) === \"function\") {\r\n obj.clickAfter(id);\r\n }\r\n });\r\n\r\n obj._$tabs.on(\"click\", \".ico-close\", function (event) {\r\n var id = $(this).parent().data(\"index\"),\r\n isRemove = true;\r\n\r\n if (typeof obj.removeBefore === 'function') {\r\n isRemove = obj.removeBefore(id);\r\n }\r\n\r\n if (isRemove) {\r\n _that.del(id);\r\n }\r\n event.stopPropagation();\r\n });\r\n },\r\n _hasId: function (id) {\r\n var $tabs = this.obj._$tabs;\r\n if ($tabs.find('div[data-index=\"' + id + '\"]').length === 0) {\r\n return false;\r\n }\r\n return true;\r\n },\r\n add: function (data) {\r\n // 添加当前 tab\r\n if (this.getCurrentId() === data.id) {\r\n return false;\r\n }\r\n\r\n // 当前 tab 已经存在\r\n if (this._hasId(data.id)) {\r\n this.setCurrent(data.id);\r\n return false;\r\n }\r\n\r\n var $tabsPanel = this.obj._$tabsPanel,\r\n $tabs = this.obj._$tabs;\r\n\r\n $tabs.append('
    '\r\n + data.title + '
    ');\r\n $tabsPanel.append('
    ' + data.content\r\n + '
    ');\r\n\r\n this.setCurrent(data.id);\r\n\r\n if (typeof data.after === 'function') {\r\n data.after();\r\n }\r\n },\r\n del: function (id) {\r\n var $tabsPanel = this.obj._$tabsPanel,\r\n $tabs = this.obj._$tabs,\r\n stack = this.obj._stack,\r\n prevId = null;\r\n\r\n $tabs.children(\"div[data-index='\" + id + \"']\").remove();\r\n $tabsPanel.children(\"div[data-index='\" + id + \"']\").remove();\r\n\r\n // 移除堆栈中该 id\r\n for (var i = 0; i < stack.length; i++) {\r\n if (id === stack[i]) {\r\n stack.splice(i, 1);\r\n i--;\r\n }\r\n }\r\n\r\n prevId = stack[stack.length - 1];\r\n\r\n if (typeof this.obj.removeAfter === 'function') {\r\n this.obj.removeAfter(id, prevId);\r\n }\r\n\r\n this.setCurrent(prevId);\r\n },\r\n getCurrentId: function () {\r\n var $tabs = this.obj._$tabs;\r\n return $tabs.children(\".current\").data(\"index\");\r\n },\r\n setCurrent: function (path) {\r\n if (!path) {\r\n return false;\r\n }\r\n\r\n var $tabsPanel = this.obj._$tabsPanel,\r\n $tabs = this.obj._$tabs;\r\n\r\n var $currentTab = $tabs.children(\".current\");\r\n if ($currentTab.data(\"index\") === path) {\r\n return false;\r\n }\r\n\r\n // tab 顺序入栈,如栈满则清除\r\n var stack = this.obj._stack;\r\n if (stack.length === this.obj.STACKSIZE) {\r\n stack.splice(0, 1);\r\n }\r\n if (stack[stack.length - 1] !== path) {\r\n this.obj._stack.push(path);\r\n }\r\n\r\n $tabs.children(\"div\").removeClass(\"current\");\r\n $tabsPanel.children(\"div\").hide();\r\n\r\n $tabs.children('div[data-index=\"' + path + '\"]').addClass(\"current\");\r\n $tabsPanel.children('div[data-index=\"' + path + '\"]').show();\r\n\r\n if (typeof this.obj.setAfter === 'function') {\r\n this.obj.setAfter();\r\n }\r\n\r\n var id = this.getCurrentId();\r\n if (\"startPage\" === id) {\r\n return;\r\n }\r\n\r\n // set tree node selected\r\n var tId = tree.getTIdByPath(id);\r\n var node = tree.fileTree.getNodeByTId(tId);\r\n tree.fileTree.selectNode(node);\r\n wide.curNode = node;\r\n\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n if (editors.data[i].id === id) {\r\n wide.curEditor = editors.data[i].editor;\r\n break;\r\n }\r\n }\r\n\r\n if (wide.curEditor) {\r\n var cursor = wide.curEditor.getCursor();\r\n wide.curEditor.setCursor(cursor);\r\n wide.curEditor.focus();\r\n wide.refreshOutline();\r\n\r\n $(\".footer .cursor\").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |');\r\n }\r\n }\r\n});","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file dialog.js\r\n *\r\n * @author Liyuan Li\r\n * @version 1.0.0.1, Dec 8, 2015\r\n */\r\n(function ($) {\r\n $.fn.extend({\r\n dialog: {\r\n version: \"0.0.1.7\",\r\n author: \"lly219@gmail.com\"\r\n }\r\n });\r\n\r\n var dpuuid = new Date().getTime();\r\n var PROP_NAME = 'dialog';\r\n\r\n var Dialog = function () {\r\n this._defaults = {\r\n \"styleClass\": {\r\n \"background\": \"dialog-background\",\r\n \"panel\": \"dialog-panel\",\r\n \"main\": \"dialog-main\",\r\n \"footer\": \"dialog-footer\",\r\n \"headerMiddle\": \"dialog-header-middle\",\r\n \"headerBg\": \"dialog-header-bg\",\r\n \"closeIcon\": \"dialog-close-icon\",\r\n \"closeIconHover\": \"dialog-close-icon-hover\",\r\n \"title\": \"dialog-title\"\r\n }\r\n };\r\n };\r\n\r\n $.extend(Dialog.prototype, {\r\n _attach: function (target, settings) {\r\n if (!target.id) {\r\n this.uuid++;\r\n target.id = 'dp' + this.uuid;\r\n }\r\n var inst = this._newInst($(target));\r\n\r\n inst.settings = $.extend({}, settings || {});\r\n $.data(target, PROP_NAME, inst);\r\n this._init(target);\r\n },\r\n /* Create a new instance object. */\r\n _newInst: function (target) {\r\n // escape jQuery meta chars\r\n var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\\\\\$1');\r\n return {\r\n id: id\r\n };\r\n },\r\n _getInst: function (target) {\r\n try {\r\n return $.data(target, PROP_NAME);\r\n } catch (err) {\r\n throw 'Missing instance data for this dialog';\r\n }\r\n },\r\n _destroyDialog: function (target) {\r\n var inst = $.dialog._getInst(target);\r\n var id = inst.id;\r\n $.removeData(target, PROP_NAME);\r\n\r\n $(target).prependTo(\"#\" + id + \"Wrap\").unwrap();\r\n $(target).removeAttr(\"style\");\r\n\r\n var styleClass = this._getDefaults($.dialog._defaults, inst.settings, \"styleClass\");\r\n $(\".\" + styleClass.background).remove();\r\n $(\"#\" + id + \"Dialog\").remove();\r\n },\r\n _init: function (target) {\r\n var inst = this._getInst(target);\r\n var id = inst.id,\r\n settings = inst.settings;\r\n var windowH = $(window).height(),\r\n windowW = $(window).width();\r\n var styleClass = this._getDefaults($.dialog._defaults, settings, \"styleClass\"),\r\n dialogH = settings.height ? settings.height : parseInt(windowH * 0.6),\r\n dialogW = settings.width ? settings.width : parseInt(windowW * 0.6);\r\n\r\n // get settings or default value.\r\n settings.title = settings.title ? settings.title : \"\";\r\n settings.okText = settings.okText ? settings.okText : \"Ok\";\r\n settings.cancelText = settings.cancelText ? settings.cancelText : \"Cancel\";\r\n\r\n // build HTML.\r\n var footerHTML = \"\",\r\n headerHTML = \"
    \"\r\n + settings.title + \"
    \";\r\n\r\n // Sets footerHTML.\r\n if (!settings.hideFooter) {\r\n if (!settings.hiddenOk) {\r\n footerHTML = \"\";\r\n }\r\n footerHTML += \"\";\r\n }\r\n\r\n var dialogHTML = \"
    \" + headerHTML\r\n + \"
    \"\r\n + footerHTML + \"
    \";\r\n\r\n var bgHTML = \"\";\r\n if (settings.modal && $(\".\" + styleClass.background).length === 0) {\r\n var bgHeight = windowH < document.documentElement.scrollHeight\r\n ? document.documentElement.scrollHeight : windowH;\r\n bgHTML = \"
    \";\r\n }\r\n\r\n // Package dialog.\r\n $(\"#\" + id).wrap(\"
    \");\r\n var cloneObj = $(target).clone(true);\r\n $(target).remove();\r\n $('body').append(bgHTML + dialogHTML);\r\n $($(\"#\" + id + \"Dialog .\" + styleClass.main + \" div\").get(0)).append(cloneObj);\r\n $(cloneObj).show();\r\n\r\n // Bind event.\r\n $(\"#\" + id + \"Dialog .\" + styleClass.closeIcon).bind(\"click\", function () {\r\n $.dialog._close(id, settings);\r\n });\r\n\r\n var $buttons = $(\"#\" + id + \"Dialog .\" + styleClass.footer + \" button\");\r\n $($buttons.get(1)).bind(\"click\", function () {\r\n $.dialog._close(id, settings);\r\n });\r\n\r\n $($buttons.get(0)).bind(\"click\", function () {\r\n if (settings.ok === undefined || settings.ok()) {\r\n $.dialog._close(id, settings);\r\n }\r\n });\r\n\r\n this._bindMove(id, styleClass.headerBg, dialogH, dialogW);\r\n\r\n // esc exit\r\n $(window).keyup(function (event) {\r\n if (event.keyCode === 27) {\r\n $.dialog._close(id, settings);\r\n }\r\n });\r\n\r\n $(window).resize(function () {\r\n var height = $(\"body\").height() > $(window).height() ? $(\"body\").height() : $(window).height();\r\n $(\".dialog-background\").height(height);\r\n });\r\n\r\n if (typeof settings.afterInit === \"function\") {\r\n settings.afterInit();\r\n }\r\n },\r\n _bindMove: function (id, className) {\r\n $(\"#\" + id + \"Dialog .\" + className).mousedown(function (event) {\r\n var _document = document;\r\n if (!event) {\r\n event = window.event;\r\n }\r\n var dialog = document.getElementById(id + \"Dialog\");\r\n var x = event.clientX - parseInt(dialog.style.left),\r\n y = event.clientY - parseInt(dialog.style.top);\r\n _document.ondragstart = \"return false;\";\r\n _document.onselectstart = \"return false;\";\r\n _document.onselect = \"document.selection.empty();\";\r\n\r\n if (this.setCapture) {\r\n this.setCapture();\r\n } else if (window.captureEvents) {\r\n window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);\r\n }\r\n\r\n _document.onmousemove = function (event) {\r\n if (!event) {\r\n event = window.event;\r\n }\r\n var positionX = event.clientX - x,\r\n positionY = event.clientY - y;\r\n if (positionX < 0) {\r\n positionX = 0;\r\n }\r\n if (positionX > $(window).width() - $(dialog).width()) {\r\n positionX = $(window).width() - $(dialog).width();\r\n }\r\n if (positionY > $(window).height() - $(dialog).height()) {\r\n positionY = $(window).height() - $(dialog).height();\r\n }\r\n if (positionY < 0) {\r\n positionY = 0;\r\n }\r\n dialog.style.left = positionX + \"px\";\r\n dialog.style.top = positionY + \"px\";\r\n };\r\n\r\n _document.onmouseup = function () {\r\n if (this.releaseCapture) {\r\n this.releaseCapture();\r\n } else if (window.captureEvents) {\r\n window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);\r\n }\r\n _document.onmousemove = null;\r\n _document.onmouseup = null;\r\n _document.ondragstart = null;\r\n _document.onselectstart = null;\r\n _document.onselect = null;\r\n };\r\n });\r\n },\r\n _close: function (id, settings) {\r\n if ($(\"#\" + id + \"Dialog\").css(\"display\") === \"none\") {\r\n return;\r\n }\r\n if (settings.close === undefined || settings.close()) {\r\n $(\"#\" + id + \"Dialog\").hide();\r\n if (settings.modal) {\r\n var styleClass = this._getDefaults($.dialog._defaults, settings, \"styleClass\");\r\n $(\".\" + styleClass.background).hide();\r\n }\r\n }\r\n },\r\n _closeDialog: function (target) {\r\n var inst = this._getInst(target);\r\n var id = inst.id,\r\n settings = inst.settings;\r\n $.dialog._close(id, settings);\r\n },\r\n _openDialog: function (target, msg) {\r\n var inst = this._getInst(target);\r\n var id = inst.id,\r\n settings = inst.settings,\r\n top = \"\", left = \"\",\r\n $dialog = $(\"#\" + id + \"Dialog\"),\r\n windowH = $(window).height(),\r\n windowW = $(window).width(),\r\n dialogH = settings.height ? settings.height : parseInt(windowH * 0.6),\r\n dialogW = settings.width ? settings.width : parseInt(windowW * 0.6);\r\n\r\n // Sets position.\r\n if (settings.position) {\r\n top = settings.position.top;\r\n left = settings.position.left;\r\n } else {\r\n // 20(footer) + 23(header)\r\n top = parseInt((windowH - dialogH - 43) / 2);\r\n if (top < 0) {\r\n top = 0;\r\n }\r\n left = parseInt((windowW - dialogW) / 2);\r\n }\r\n $dialog.css({\r\n \"top\": top + \"px\",\r\n \"left\": left + \"px\"\r\n }).show();\r\n\r\n if (settings.modal) {\r\n var styleClass = this._getDefaults($.dialog._defaults, settings, \"styleClass\");\r\n $(\".\" + styleClass.background).show();\r\n }\r\n\r\n if (typeof settings.afterOpen === \"function\") {\r\n settings.afterOpen(msg);\r\n }\r\n\r\n $(\"#\" + id + \"Dialog .dialog-footer button:eq(0)\").focus();\r\n },\r\n _updateDialog: function (target, data) {\r\n var inst = this._getInst(target);\r\n var id = inst.id,\r\n settings = inst.settings;\r\n var styleClass = this._getDefaults($.dialog._defaults, settings, \"styleClass\");\r\n $.extend(settings, data);\r\n var $dialog = $(\"#\" + id + \"Dialog\");\r\n if (data.position) {\r\n $dialog.css({\r\n \"top\": data.position.top,\r\n \"left\": data.position.left\r\n });\r\n }\r\n\r\n if (data.width) {\r\n $dialog.width(data.width + 26);\r\n $dialog.find(\".\" + styleClass.main + \" div\")[0].style.width = data.width + \"px\";\r\n $dialog.find(\".\" + styleClass.headerBg).width(data.width + 18);\r\n }\r\n\r\n if (data.height) {\r\n $dialog.find(\".\" + styleClass.main + \" div\")[0].style.height = data.height + \"px\";\r\n }\r\n\r\n if (data.title) {\r\n $dialog.find(\".\" + styleClass.title).html(data.title);\r\n }\r\n\r\n if (data.modal !== undefined) {\r\n if (data.modal) {\r\n $(\".\" + styleClass.background).show();\r\n } else {\r\n $(\".\" + styleClass.background).hide();\r\n }\r\n }\r\n\r\n if (data.hideFooter !== undefined) {\r\n if (data.hideFooter) {\r\n $dialog.find(\".\" + styleClass.footer).hide();\r\n } else {\r\n $dialog.find(\".\" + styleClass.footer).show();\r\n }\r\n }\r\n\r\n },\r\n _getDefaults: function (defaults, settings, key) {\r\n if (key === \"styleClass\") {\r\n if (settings.theme === \"default\" || settings.theme === undefined) {\r\n return defaults.styleClass;\r\n }\r\n settings.styleClass = {};\r\n for (var styleName in defaults[key]) {\r\n settings.styleClass[styleName] = settings.theme + \"-\" + defaults.styleClass[styleName];\r\n }\r\n } else if (key === \"height\" || key === \"width\") {\r\n if (settings[key] === null || settings[key] === undefined) {\r\n return \"auto\";\r\n } else {\r\n return settings[key] + \"px\";\r\n }\r\n } else {\r\n if (settings[key] === null || settings[key] === undefined) {\r\n return defaults[key];\r\n }\r\n }\r\n return settings[key];\r\n }\r\n });\r\n\r\n $.fn.dialog = function (options) {\r\n var otherArgs = Array.prototype.slice.call(arguments);\r\n\r\n if (typeof options === 'string') {\r\n otherArgs.shift();\r\n return $.dialog['_' + options + 'Dialog'].apply($.dialog, [this[0]].concat(otherArgs));\r\n }\r\n return this.each(function () {\r\n $.dialog._attach(this, options);\r\n });\r\n };\r\n\r\n $.dialog = new Dialog();\r\n\r\n // Add another global to avoid noConflict issues with inline event handlers\r\n window['DP_jQuery_' + dpuuid] = $;\r\n})(jQuery);","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file editor.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.1.1.0, Jan 12, 2016\r\n */\r\nvar editors = {\r\n autocompleteMutex: false,\r\n data: [],\r\n tabs: {},\r\n getEditorByPath: function (path) {\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n if (editors.data[i].editor.options.path === path) {\r\n return editors.data[i].editor;\r\n }\r\n }\r\n },\r\n close: function () {\r\n $('.edit-panel .tabs > div[data-index=\"' + $('.edit-panel .frame').data('index') + ']').find('.ico-close').click();\r\n },\r\n closeOther: function () {\r\n var currentIndex = $(\".edit-panel .frame\").data(\"index\");\r\n\r\n // 设置全部关闭标识\r\n var removeData = [];\r\n $(\".edit-panel .tabs > div\").each(function (i) {\r\n if (currentIndex !== $(this).data(\"index\")) {\r\n removeData.push($(this).data(\"index\"));\r\n }\r\n });\r\n if (removeData.length === 0) {\r\n return false;\r\n }\r\n var firstIndex = removeData.splice(0, 1);\r\n $(\"#dialogCloseEditor\").data(\"removeData\", removeData);\r\n // 开始关闭\r\n $('.edit-panel .tabs > div[data-index=\"' + firstIndex + '\"]').find(\".ico-close\").click();\r\n },\r\n _removeAllMarker: function () {\r\n var removeData = $(\"#dialogCloseEditor\").data(\"removeData\");\r\n if (removeData && removeData.length > 0) {\r\n var removeIndex = removeData.splice(0, 1);\r\n $(\"#dialogCloseEditor\").data(\"removeData\", removeData);\r\n $('.edit-panel .tabs > div[data-index=\"' + removeIndex + '\"] .ico-close').click();\r\n }\r\n if (wide.curEditor) {\r\n wide.curEditor.focus();\r\n }\r\n },\r\n _initClose: function () {\r\n new ZeroClipboard($(\"#copyFilePath\"));\r\n\r\n // 关闭、关闭其他、关闭所有\r\n $(\".edit-panel\").on(\"mouseup\", '.tabs > div', function (event) {\r\n event.stopPropagation();\r\n\r\n if (event.button === 0) { // 左键\r\n $(\".edit-panel .frame\").hide();\r\n return false;\r\n }\r\n\r\n // event.button === 2 右键\r\n var left = event.screenX;\r\n if ($(\".side\").css(\"left\") === \"auto\" || $(\".side\").css(\"left\") === \"0px\") {\r\n left = event.screenX - $(\".side\").width();\r\n }\r\n $(\".edit-panel .frame\").show().css({\r\n \"left\": left + \"px\",\r\n \"top\": \"21px\"\r\n }).data('index', $(this).data(\"index\"));\r\n\r\n $(\"#copyFilePath\").attr('data-clipboard-text', $(this).find(\"span:eq(0)\").attr(\"title\"));\r\n return false;\r\n });\r\n },\r\n init: function () {\r\n $(\"#dialogCloseEditor\").dialog({\r\n \"modal\": true,\r\n \"height\": 90,\r\n \"width\": 260,\r\n \"title\": config.label.tip,\r\n \"hideFooter\": true,\r\n \"afterOpen\": function (fileName) {\r\n $(\"#dialogCloseEditor > div:eq(0)\").html(config.label.file\r\n + ' ' + fileName + '. ' + config.label.confirm_save + '?');\r\n $(\"#dialogCloseEditor button:eq(0)\").focus();\r\n },\r\n \"afterInit\": function () {\r\n $(\"#dialogCloseEditor button.save\").click(function () {\r\n var i = $(\"#dialogCloseEditor\").data(\"index\");\r\n wide.fmt(editors.data[i].id, editors.data[i].editor);\r\n editors.tabs.del(editors.data[i].id);\r\n $(\"#dialogCloseEditor\").dialog(\"close\");\r\n editors._removeAllMarker();\r\n });\r\n\r\n $(\"#dialogCloseEditor button.discard\").click(function () {\r\n var i = $(\"#dialogCloseEditor\").data(\"index\");\r\n editors.tabs.del(editors.data[i].id);\r\n $(\"#dialogCloseEditor\").dialog(\"close\");\r\n editors._removeAllMarker();\r\n });\r\n\r\n $(\"#dialogCloseEditor button.cancel\").click(function (event) {\r\n $(\"#dialogCloseEditor\").dialog(\"close\");\r\n editors._removeAllMarker();\r\n });\r\n }\r\n });\r\n\r\n editors.tabs = new Tabs({\r\n id: \".edit-panel\",\r\n setAfter: function () {\r\n if (wide.curEditor) {\r\n wide.curEditor.focus();\r\n }\r\n },\r\n clickAfter: function (id) {\r\n if (id === 'startPage') {\r\n wide.curEditor = undefined;\r\n $(\".footer .cursor\").text('');\r\n wide.refreshOutline();\r\n \r\n return false;\r\n }\r\n },\r\n removeBefore: function (id) {\r\n if (id === 'startPage') { // 当前关闭的 tab 是起始页\r\n editors._removeAllMarker();\r\n return true;\r\n }\r\n\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n if (editors.data[i].id === id) {\r\n if (editors.data[i].editor.doc.isClean()) {\r\n editors._removeAllMarker();\r\n return true;\r\n } else {\r\n $(\"#dialogCloseEditor\").dialog(\"open\", $('.edit-panel .tabs > div[data-index=\"'\r\n + editors.data[i].id + '\"] > span:eq(0)').text());\r\n $(\"#dialogCloseEditor\").data(\"index\", i);\r\n return false;\r\n }\r\n\r\n break;\r\n }\r\n }\r\n },\r\n removeAfter: function (id, nextId) {\r\n if ($(\".edit-panel .tabs > div\").length === 0) {\r\n // 全部 tab 都关闭时才 disables 菜单中“全部关闭”的按钮\r\n menu.disabled(['close-all']);\r\n }\r\n\r\n // 移除编辑器\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n if (editors.data[i].id === id) {\r\n editors.data.splice(i, 1);\r\n break;\r\n }\r\n }\r\n\r\n if (editors.data.length === 0) { // 起始页可能存在,所以用编辑器数据判断\r\n menu.disabled(['save-all', 'build', 'run', 'go-test', 'go-vet', 'go-get', 'go-install',\r\n 'find', 'find-next', 'find-previous', 'replace', 'replace-all',\r\n 'format', 'autocomplete', 'jump-to-decl', 'expr-info', 'find-usages', 'toggle-comment',\r\n 'edit']);\r\n\r\n // remove selected tree node\r\n tree.fileTree.cancelSelectedNode();\r\n wide.curNode = undefined;\r\n wide.curEditor = undefined;\r\n wide.refreshOutline();\r\n $(\".footer .cursor\").text('');\r\n return false;\r\n }\r\n\r\n if (!nextId) {\r\n // 编辑器区域不存在打开的 Tab\r\n // remove selected tree node\r\n tree.fileTree.cancelSelectedNode();\r\n wide.curNode = undefined;\r\n wide.curEditor = undefined;\r\n wide.refreshOutline();\r\n $(\".footer .cursor\").text('');\r\n return false;\r\n }\r\n\r\n if (nextId === editors.tabs.getCurrentId()) {\r\n // 关闭的不是当前编辑器\r\n return false;\r\n }\r\n }\r\n });\r\n\r\n this._initCodeMirrorHotKeys();\r\n this.openStartPage();\r\n this._initClose();\r\n },\r\n openStartPage: function () {\r\n wide.curEditor = undefined;\r\n wide.refreshOutline();\r\n $(\".footer .cursor\").text('');\r\n\r\n var dateFormat = function (time, fmt) {\r\n var date = new Date(time);\r\n var dateObj = {\r\n \"M+\": date.getMonth() + 1, //月份 \r\n \"d+\": date.getDate(), //日 \r\n \"h+\": date.getHours(), //小时 \r\n \"m+\": date.getMinutes(), //分 \r\n \"s+\": date.getSeconds(), //秒 \r\n \"q+\": Math.floor((date.getMonth() + 3) / 3), //季度 \r\n \"S\": date.getMilliseconds() //毫秒 \r\n };\r\n if (/(y+)/.test(fmt))\r\n fmt = fmt.replace(RegExp.$1, (date.getFullYear() + \"\").substr(4 - RegExp.$1.length));\r\n for (var k in dateObj)\r\n if (new RegExp(\"(\" + k + \")\").test(fmt)) {\r\n fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1)\r\n ? (dateObj[k]) : ((\"00\" + dateObj[k]).substr((\"\" + dateObj[k]).length)));\r\n }\r\n return fmt;\r\n };\r\n\r\n editors.tabs.add({\r\n id: \"startPage\",\r\n title: ' ' + config.label.start_page + '',\r\n content: '
    ',\r\n after: function () {\r\n $(\"#startPage\").load(config.context + '/start?sid=' + config.wideSessionId);\r\n $.ajax({\r\n url: \"https://hacpai.com/apis/articles?tags=wide,golang&p=1&size=20\",\r\n type: \"GET\",\r\n dataType: \"jsonp\",\r\n jsonp: \"callback\",\r\n success: function (data, textStatus) {\r\n var articles = data.articles;\r\n if (0 === articles.length) {\r\n return;\r\n }\r\n\r\n // 按 size = 20 取,但只保留最多 9 篇\r\n var length = articles.length;\r\n if (length > 9) {\r\n length = 9;\r\n }\r\n\r\n var listHTML = \"
    • \" + config.label.community + \"
    • \";\r\n for (var i = 0; i < length; i++) {\r\n var article = articles[i];\r\n listHTML += \"
    • \"\r\n + \"\"\r\n + article.articleTitle + \"  \"\r\n + dateFormat(article.articleCreateTime, 'yyyy-MM-dd');\r\n +\"
    • \";\r\n }\r\n\r\n $(\"#startPage .news\").html(listHTML + \"
    \");\r\n }\r\n });\r\n }\r\n });\r\n },\r\n getCurrentId: function () {\r\n var ret = editors.tabs.getCurrentId();\r\n if (ret === 'startPage') {\r\n ret = null;\r\n }\r\n \r\n return ret;\r\n },\r\n getCurrentPath: function () {\r\n var currentPath = $(\".edit-panel .tabs .current span:eq(0)\").attr(\"title\");\r\n if (currentPath === config.label.start_page) {\r\n currentPath = null;\r\n }\r\n return currentPath;\r\n },\r\n _initCodeMirrorHotKeys: function () {\r\n CodeMirror.registerHelper(\"hint\", \"go\", function (editor) {\r\n editor = wide.curEditor; // 使用当前编辑器覆盖实参,因为异步调用的原因,实参不一定正确\r\n var word = /[\\w$]+/;\r\n\r\n var cur = editor.getCursor(), curLine = editor.getLine(cur.line);\r\n\r\n var start = cur.ch, end = start;\r\n while (end < curLine.length && word.test(curLine.charAt(end))) {\r\n ++end;\r\n }\r\n while (start && word.test(curLine.charAt(start - 1))) {\r\n --start;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.path = $(\".edit-panel .tabs .current > span:eq(0)\").attr(\"title\");\r\n request.code = editor.getValue();\r\n request.cursorLine = cur.line;\r\n request.cursorCh = cur.ch;\r\n\r\n var autocompleteHints = [];\r\n\r\n if (editors.autocompleteMutex && editor.state.completionActive) {\r\n return;\r\n }\r\n\r\n editors.autocompleteMutex = true;\r\n\r\n $.ajax({\r\n async: false, // 同步执行\r\n type: 'POST',\r\n url: config.context + '/autocomplete',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (data) {\r\n var autocompleteArray = data[1];\r\n\r\n if (autocompleteArray) {\r\n for (var i = 0; i < autocompleteArray.length; i++) {\r\n var displayText = '',\r\n text = autocompleteArray[i].name;\r\n\r\n switch (autocompleteArray[i].class) {\r\n case \"type\":\r\n displayText = ''// + autocompleteArray[i].class \r\n + '' + autocompleteArray[i].name + ' '\r\n + autocompleteArray[i].type + '';\r\n break;\r\n case \"const\":\r\n displayText = ''// + autocompleteArray[i].class \r\n + '' + autocompleteArray[i].name + ' '\r\n + autocompleteArray[i].type + '';\r\n break;\r\n case \"var\":\r\n displayText = ''// + autocompleteArray[i].class \r\n + '' + autocompleteArray[i].name + ' '\r\n + autocompleteArray[i].type + '';\r\n break;\r\n case \"package\":\r\n displayText = ''// + autocompleteArray[i].class \r\n + '' + autocompleteArray[i].name + ' '\r\n + autocompleteArray[i].type + '';\r\n break;\r\n case \"func\":\r\n displayText = ''// + autocompleteArray[i].class \r\n + '' + autocompleteArray[i].name + ''\r\n + autocompleteArray[i].type.substring(4) + '';\r\n text += '()';\r\n break;\r\n default:\r\n console.warn(\"Can't handle autocomplete [\" + autocompleteArray[i].class + \"]\");\r\n break;\r\n }\r\n\r\n autocompleteHints[i] = {\r\n displayText: displayText,\r\n text: text\r\n };\r\n }\r\n }\r\n\r\n editor.doc.markClean();\r\n $(\".edit-panel .tabs .current > span:eq(0)\").removeClass(\"changed\");\r\n }\r\n });\r\n\r\n setTimeout(function () {\r\n editors.autocompleteMutex = false;\r\n }, 20);\r\n\r\n return {list: autocompleteHints, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)};\r\n });\r\n\r\n CodeMirror.commands.autocompleteAfterDot = function (cm) {\r\n var mode = cm.getMode();\r\n if (mode && \"go\" !== mode.name) {\r\n return CodeMirror.Pass;\r\n }\r\n\r\n var token = cm.getTokenAt(cm.getCursor());\r\n\r\n if (\"comment\" === token.type || \"string\" === token.type) {\r\n return CodeMirror.Pass;\r\n }\r\n\r\n setTimeout(function () {\r\n if (!cm.state.completionActive) {\r\n cm.showHint({hint: CodeMirror.hint.go, completeSingle: false});\r\n }\r\n }, 50);\r\n\r\n return CodeMirror.Pass;\r\n };\r\n\r\n CodeMirror.commands.autocompleteAnyWord = function (cm) {\r\n cm.showHint({hint: CodeMirror.hint.auto});\r\n };\r\n\r\n CodeMirror.commands.gotoLine = function (cm) {\r\n $(\"#dialogGoLinePrompt\").dialog(\"open\");\r\n };\r\n\r\n // 用于覆盖 cm 默认绑定的某些快捷键功能.\r\n CodeMirror.commands.doNothing = function (cm) {\r\n };\r\n\r\n CodeMirror.commands.exprInfo = function (cm) {\r\n var cur = wide.curEditor.getCursor();\r\n\r\n var request = newWideRequest();\r\n request.path = $(\".edit-panel .tabs .current > span:eq(0)\").attr(\"title\");\r\n request.code = wide.curEditor.getValue();\r\n request.cursorLine = cur.line;\r\n request.cursorCh = cur.ch;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/exprinfo',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n return;\r\n }\r\n \r\n var position = wide.curEditor.cursorCoords();\r\n $(\"body\").append('
    ' + result.data + '
    ');\r\n }\r\n });\r\n };\r\n\r\n CodeMirror.commands.copyLinesDown = function (cm) {\r\n var content = '',\r\n selectoion = cm.listSelections()[0];\r\n\r\n var from = selectoion.anchor,\r\n to = selectoion.head;\r\n if (from.line > to.line) {\r\n from = selectoion.head;\r\n to = selectoion.anchor;\r\n }\r\n\r\n for (var i = from.line, max = to.line; i <= max; i++) {\r\n if (to.ch !== 0 || i !== max) { // 下一行选中为0时,不应添加内容\r\n content += '\\n' + cm.getLine(i);\r\n }\r\n }\r\n // 下一行选中为0时,应添加到上一行末\r\n var replaceToLine = to.line;\r\n if (to.ch === 0) {\r\n replaceToLine = to.line - 1;\r\n }\r\n cm.replaceRange(content, CodeMirror.Pos(replaceToLine));\r\n\r\n var offset = replaceToLine - from.line + 1;\r\n cm.setSelection(CodeMirror.Pos(from.line + offset, from.ch),\r\n CodeMirror.Pos(to.line + offset, to.ch));\r\n };\r\n\r\n CodeMirror.commands.copyLinesUp = function (cm) {\r\n var content = '',\r\n selectoion = cm.listSelections()[0];\r\n\r\n var from = selectoion.anchor,\r\n to = selectoion.head;\r\n if (from.line > to.line) {\r\n from = selectoion.head;\r\n to = selectoion.anchor;\r\n }\r\n\r\n for (var i = from.line, max = to.line; i <= max; i++) {\r\n if (to.ch !== 0 || i !== max) { // 下一行选中为0时,不应添加内容\r\n content += '\\n' + cm.getLine(i);\r\n }\r\n }\r\n\r\n // 下一行选中为0时,应添加到上一行末\r\n var replaceToLine = to.line;\r\n if (to.ch === 0) {\r\n replaceToLine = to.line - 1;\r\n }\r\n cm.replaceRange(content, CodeMirror.Pos(replaceToLine));\r\n\r\n cm.setSelection(CodeMirror.Pos(from.line, from.ch),\r\n CodeMirror.Pos(to.line, to.ch));\r\n };\r\n\r\n CodeMirror.commands.moveLinesUp = function (cm) {\r\n var selectoion = cm.listSelections()[0];\r\n\r\n var from = selectoion.anchor,\r\n to = selectoion.head;\r\n if (from.line > to.line) {\r\n from = selectoion.head;\r\n to = selectoion.anchor;\r\n }\r\n\r\n if (from.line === 0) {\r\n return false;\r\n }\r\n // 下一行选中为0时,应添加到上一行末\r\n var replaceToLine = to.line;\r\n if (to.ch === 0) {\r\n replaceToLine = to.line - 1;\r\n }\r\n cm.replaceRange('\\n' + cm.getLine(from.line - 1), CodeMirror.Pos(replaceToLine));\r\n if (from.line === 1) {\r\n // 移除第一行的换行\r\n cm.replaceRange('', CodeMirror.Pos(0, 0),\r\n CodeMirror.Pos(1, 0));\r\n } else {\r\n cm.replaceRange('', CodeMirror.Pos(from.line - 2, cm.getLine(from.line - 2).length),\r\n CodeMirror.Pos(from.line - 1, cm.getLine(from.line - 1).length));\r\n }\r\n\r\n cm.setSelection(CodeMirror.Pos(from.line - 1, from.ch),\r\n CodeMirror.Pos(to.line - 1, to.ch));\r\n };\r\n\r\n CodeMirror.commands.moveLinesDown = function (cm) {\r\n var selectoion = cm.listSelections()[0];\r\n\r\n var from = selectoion.anchor,\r\n to = selectoion.head;\r\n if (from.line > to.line) {\r\n from = selectoion.head;\r\n to = selectoion.anchor;\r\n }\r\n\r\n if (to.line === cm.lastLine()) {\r\n return false;\r\n }\r\n\r\n // 下一行选中为0时,应添加到上一行末\r\n var replaceToLine = to.line;\r\n if (to.ch === 0) {\r\n replaceToLine = to.line - 1;\r\n }\r\n // 把选中的下一行添加到选中区域的上一行\r\n if (from.line === 0) {\r\n cm.replaceRange(cm.getLine(replaceToLine + 1) + '\\n', CodeMirror.Pos(0, 0));\r\n } else {\r\n cm.replaceRange('\\n' + cm.getLine(replaceToLine + 1), CodeMirror.Pos(from.line - 1));\r\n }\r\n // 删除选中的下一行\r\n cm.replaceRange('', CodeMirror.Pos(replaceToLine + 1, cm.getLine(replaceToLine + 1).length),\r\n CodeMirror.Pos(replaceToLine + 2, cm.getLine(replaceToLine + 2).length));\r\n\r\n cm.setSelection(CodeMirror.Pos(from.line + 1, from.ch),\r\n CodeMirror.Pos(to.line + 1, to.ch));\r\n };\r\n\r\n CodeMirror.commands.jumpToDecl = function (cm) {\r\n var cur = wide.curEditor.getCursor();\r\n\r\n var request = newWideRequest();\r\n request.path = $(\".edit-panel .tabs .current > span:eq(0)\").attr(\"title\");\r\n request.code = wide.curEditor.getValue();\r\n request.cursorLine = cur.line;\r\n request.cursorCh = cur.ch;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/find/decl',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n return;\r\n }\r\n \r\n var data = result.data;\r\n\r\n var tId = tree.getTIdByPath(data.path);\r\n wide.curNode = tree.fileTree.getNodeByTId(tId);\r\n tree.fileTree.selectNode(wide.curNode);\r\n\r\n tree.openFile(wide.curNode, CodeMirror.Pos(data.cursorLine - 1, data.cursorCh - 1));\r\n }\r\n });\r\n };\r\n\r\n CodeMirror.commands.findUsages = function (cm) {\r\n var cur = wide.curEditor.getCursor();\r\n\r\n var request = newWideRequest();\r\n request.path = $(\".edit-panel .tabs .current > span:eq(0)\").attr(\"title\");\r\n request.code = wide.curEditor.getValue();\r\n request.cursorLine = cur.line;\r\n request.cursorCh = cur.ch;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/find/usages',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n return;\r\n }\r\n\r\n editors.appendSearch(result.data, 'usages', '');\r\n }\r\n });\r\n };\r\n\r\n CodeMirror.commands.selectIdentifier = function (cm) {\r\n var cur = cm.getCursor();\r\n var word = cm.findWordAt(cur);\r\n cm.extendSelection(word.anchor, word.head);\r\n };\r\n },\r\n appendSearch: function (data, type, key) {\r\n var searcHTML = '
      ',\r\n key = key.toLowerCase();\r\n\r\n for (var i = 0, ii = data.length; i < ii; i++) {\r\n var contents = '',\r\n lowerCaseContents = data[i].contents[0].toLowerCase(),\r\n matches = lowerCaseContents.split(key),\r\n startIndex = 0,\r\n endIndex = 0;\r\n for (var j = 0, max = matches.length; j < max; j++) {\r\n startIndex = endIndex + matches[j].length;\r\n endIndex = startIndex + key.length;\r\n var keyWord = data[i].contents[0].substring(startIndex, endIndex);\r\n if (keyWord !== '') {\r\n keyWord = '' + keyWord + '';\r\n }\r\n contents += data[i].contents[0].substring(startIndex - matches[j].length, startIndex) + keyWord;\r\n }\r\n\r\n searcHTML += '
    • '\r\n + contents + \"    \" + data[i].path\r\n + ' (' + data[i].line + ':'\r\n + data[i].ch + ')
    • ';\r\n }\r\n\r\n if (data.length === 0) {\r\n searcHTML += '
    • ' + config.label.search_no_match + '
    • ';\r\n }\r\n searcHTML += '
    ';\r\n\r\n var $search = $('.bottom-window-group .search'),\r\n title = config.label.find_usages;\r\n if (type === \"founds\") {\r\n title = config.label.search_text;\r\n }\r\n if ($search.find(\"ul\").length === 0) {\r\n bottomGroup.searchTab = new Tabs({\r\n id: \".bottom-window-group .search\",\r\n removeAfter: function (id, prevId) {\r\n if ($search.find(\"ul\").length === 1) {\r\n $search.find(\".tabs\").hide();\r\n }\r\n }\r\n });\r\n\r\n $search.on(\"click\", \"li\", function () {\r\n $search.find(\"li\").removeClass(\"selected\");\r\n $(this).addClass(\"selected\");\r\n });\r\n\r\n $search.on(\"dblclick\", \"li\", function () {\r\n var $it = $(this),\r\n tId = tree.getTIdByPath($it.attr(\"title\"));\r\n tree.openFile(tree.fileTree.getNodeByTId(tId));\r\n tree.fileTree.selectNode(wide.curNode);\r\n\r\n var line = $it.find(\".position\").data(\"line\") - 1;\r\n var cursor = CodeMirror.Pos(line, $it.find(\".position\").data(\"ch\") - 1);\r\n\r\n\r\n var editor = wide.curEditor;\r\n editor.setCursor(cursor);\r\n\r\n var half = Math.floor(editor.getScrollInfo().clientHeight / editor.defaultTextHeight() / 2);\r\n var cursorCoords = editor.cursorCoords({line: cursor.line - half, ch: 0}, \"local\");\r\n editor.scrollTo(0, cursorCoords.top);\r\n\r\n wide.curEditor.focus();\r\n });\r\n\r\n $search.find(\".tabs-panel > div\").append(searcHTML);\r\n\r\n $search.find(\".tabs .first\").text(title);\r\n } else {\r\n $search.find(\".tabs\").show();\r\n bottomGroup.searchTab.add({\r\n \"id\": \"search\" + (new Date()).getTime(),\r\n \"title\": title,\r\n \"content\": searcHTML\r\n });\r\n }\r\n\r\n // focus\r\n bottomGroup.tabs.setCurrent(\"search\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .search\").focus();\r\n },\r\n // 新建一个编辑器 Tab,如果已经存在 Tab 则切换到该 Tab.\r\n newEditor: function (data, cursor) {\r\n var id = wide.curNode.id;\r\n\r\n editors.tabs.add({\r\n id: id,\r\n title: '' + wide.curNode.name + '',\r\n content: ''\r\n });\r\n\r\n menu.undisabled(['save-all', 'close-all', 'build', 'run', 'go-test', 'go-vet', 'go-get', 'go-install',\r\n 'find', 'find-next', 'find-previous', 'replace', 'replace-all',\r\n 'format', 'autocomplete', 'jump-to-decl', 'expr-info', 'find-usages', 'toggle-comment',\r\n 'edit']);\r\n\r\n var textArea = document.getElementById(\"editor\" + id);\r\n textArea.value = data.content;\r\n\r\n var editor = CodeMirror.fromTextArea(textArea, {\r\n lineNumbers: true,\r\n autofocus: true,\r\n autoCloseBrackets: true,\r\n matchBrackets: true,\r\n highlightSelectionMatches: {showToken: /\\w/},\r\n rulers: [{color: \"#ccc\", column: 120, lineStyle: \"dashed\"}],\r\n styleActiveLine: true,\r\n theme: config.editorTheme,\r\n tabSize: config.editorTabSize,\r\n indentUnit: 4,\r\n indentWithTabs: true,\r\n foldGutter: true,\r\n cursorHeight: 1,\r\n path: data.path,\r\n readOnly: wide.curNode.isGOAPI,\r\n profile: 'xhtml', // define Emmet output profile\r\n extraKeys: {\r\n \"Ctrl-\\\\\": \"autocompleteAnyWord\",\r\n \".\": \"autocompleteAfterDot\",\r\n \"Ctrl-/\": 'toggleComment',\r\n \"Ctrl-I\": \"exprInfo\",\r\n \"Ctrl-L\": \"gotoLine\",\r\n \"Ctrl-E\": \"deleteLine\",\r\n \"Ctrl-D\": \"doNothing\", // 取消默认的 deleteLine\r\n \"Ctrl-B\": \"jumpToDecl\",\r\n \"Ctrl-S\": function () {\r\n wide.saveFile();\r\n },\r\n \"Shift-Ctrl-S\": function () {\r\n menu.saveAllFiles();\r\n },\r\n \"Shift-Alt-F\": function () {\r\n var currentPath = editors.getCurrentPath();\r\n if (!currentPath) {\r\n return false;\r\n }\r\n wide.fmt(currentPath, wide.curEditor);\r\n },\r\n \"Alt-F7\": \"findUsages\",\r\n \"Shift-Alt-Enter\": function () {\r\n if (windows.isMaxEditor) {\r\n windows.restoreEditor();\r\n } else {\r\n windows.maxEditor();\r\n }\r\n },\r\n \"Shift-Ctrl-Up\": \"copyLinesUp\",\r\n \"Shift-Ctrl-Down\": \"copyLinesDown\",\r\n \"Shift-Alt-Up\": \"moveLinesUp\",\r\n \"Shift-Alt-Down\": \"moveLinesDown\",\r\n \"Shift-Alt-J\": \"selectIdentifier\"\r\n }\r\n });\r\n\r\n if (\"text/html\" === data.mode) {\r\n emmetCodeMirror(editor);\r\n }\r\n\r\n editor.on('cursorActivity', function (cm) {\r\n $(\".edit-exprinfo\").remove();\r\n var cursor = cm.getCursor();\r\n\r\n $(\".footer .cursor\").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |');\r\n });\r\n\r\n editor.on('blur', function (cm) {\r\n $(\".edit-exprinfo\").remove();\r\n });\r\n\r\n editor.on('changes', function (cm) {\r\n if (cm.doc.isClean()) { // no modification\r\n $(\".edit-panel .tabs > div\").each(function () {\r\n var $span = $(this).find(\"span:eq(0)\");\r\n if ($span.attr(\"title\") === cm.options.path) {\r\n $span.removeClass(\"changed\");\r\n }\r\n });\r\n\r\n return;\r\n }\r\n\r\n // changed\r\n\r\n $(\".edit-panel .tabs > div\").each(function () {\r\n var $span = $(this).find(\"span:eq(0)\");\r\n if ($span.attr(\"title\") === cm.options.path) {\r\n $span.addClass(\"changed\");\r\n }\r\n });\r\n });\r\n\r\n editor.on('keydown', function (cm, evt) {\r\n if (evt.altKey || evt.ctrlKey || evt.shiftKey) {\r\n return;\r\n }\r\n\r\n var k = evt.which;\r\n\r\n if (k < 48) {\r\n return;\r\n }\r\n\r\n // hit [0-9]\r\n\r\n if (k > 57 && k < 65) {\r\n return;\r\n }\r\n\r\n // hit [a-z]\r\n\r\n if (k > 90) {\r\n return;\r\n }\r\n\r\n if (config.autocomplete) {\r\n if (0.5 <= Math.random()) {\r\n CodeMirror.commands.autocompleteAfterDot(cm);\r\n }\r\n }\r\n });\r\n\r\n editor.setSize('100%', $(\".edit-panel\").height() - $(\".edit-panel .tabs\").height());\r\n editor.setOption(\"mode\", data.mode);\r\n editor.setOption(\"gutters\", [\"CodeMirror-lint-markers\", \"CodeMirror-foldgutter\"]);\r\n\r\n if (\"wide\" !== config.keymap) {\r\n editor.setOption(\"keyMap\", config.keymap);\r\n }\r\n\r\n if (\"text/x-go\" === data.mode || \"application/json\" === data.mode) {\r\n editor.setOption(\"lint\", true);\r\n }\r\n\r\n if (\"application/xml\" === data.mode || \"text/html\" === data.mode) {\r\n editor.setOption(\"autoCloseTags\", true);\r\n }\r\n\r\n wide.curEditor = editor;\r\n editors.data.push({\r\n \"editor\": editor,\r\n \"id\": id\r\n });\r\n\r\n $(\".footer .cursor\").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |');\r\n\r\n var half = Math.floor(wide.curEditor.getScrollInfo().clientHeight / wide.curEditor.defaultTextHeight() / 2);\r\n var cursorCoords = wide.curEditor.cursorCoords({line: cursor.line - half, ch: 0}, \"local\");\r\n wide.curEditor.scrollTo(0, cursorCoords.top);\r\n\r\n editor.setCursor(cursor);\r\n editor.focus();\r\n }\r\n};","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file notification.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.0.0.1, Dec 8, 2015\r\n */\r\nvar notification = {\r\n init: function () {\r\n $(\".notification-count\").click(function () {\r\n bottomGroup.tabs.setCurrent(\"notification\");\r\n $(\".bottom-window-group .notification\").focus();\r\n $(this).hide();\r\n });\r\n\r\n this._initWS();\r\n },\r\n _initWS: function () {\r\n var notificationWS = new ReconnectingWebSocket(config.channel + '/notification/ws?sid=' + config.wideSessionId);\r\n\r\n notificationWS.onopen = function () {\r\n console.log('[notification onopen] connected');\r\n };\r\n\r\n notificationWS.onmessage = function (e) {\r\n var data = JSON.parse(e.data),\r\n $notification = $('.bottom-window-group .notification > table'),\r\n notificationHTML = '';\r\n \r\n if (data.cmd && \"init-notification\" === data.cmd) {\r\n console.log('[notification onmessage]' + e.data);\r\n \r\n return;\r\n }\r\n\r\n notificationHTML += '' + data.severity\r\n + '' + data.message\r\n + '' + data.type + '';\r\n $notification.append(notificationHTML);\r\n\r\n $(\".notification-count\").show();\r\n };\r\n\r\n notificationWS.onclose = function (e) {\r\n console.log('[notification onclose] disconnected (' + e.code + ')');\r\n };\r\n\r\n notificationWS.onerror = function (e) {\r\n console.log('[notification onerror]');\r\n };\r\n }\r\n};","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file tree.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.0.1.1, Dec 15, 2015\r\n */\r\nvar tree = {\r\n fileTree: undefined,\r\n // 递归获取当前节点展开中的最后一个节点\r\n getCurrentNodeLastNode: function (node) {\r\n var returnNode = node.children[node.children.length - 1];\r\n if (returnNode.open) {\r\n return tree.getCurrentNodeLastNode(returnNode);\r\n } else {\r\n return returnNode;\r\n }\r\n },\r\n // 按照树展现获取下一个节点\r\n getNextShowNode: function (node) {\r\n if (node.level !== 0) {\r\n if (node.getParentNode().getNextNode()) {\r\n return node.getParentNode().getNextNode();\r\n } else {\r\n return tree.getNextShowNode(node.getParentNode());\r\n }\r\n } else {\r\n return node.getNextNode();\r\n }\r\n },\r\n isBottomNode: function (node) {\r\n if (node.open) {\r\n return false;\r\n }\r\n\r\n if (node.getParentNode()) {\r\n if (node.getParentNode().isLastNode) {\r\n return tree.isBottomNode(node.getParentNode());\r\n } else {\r\n return false;\r\n }\r\n } else {\r\n if (node.isLastNode) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n },\r\n getTIdByPath: function (path) {\r\n var nodes = tree.fileTree.transformToArray(tree.fileTree.getNodes());\r\n for (var i = 0, ii = nodes.length; i < ii; i++) {\r\n if (nodes[i].path === path) {\r\n return nodes[i].tId;\r\n }\r\n }\r\n\r\n return undefined;\r\n },\r\n getOpenPaths: function () {\r\n var nodes = tree.fileTree.transformToArray(tree.fileTree.getNodes()),\r\n paths = [];\r\n for (var i = 0, ii = nodes.length; i < ii; i++) {\r\n if (nodes[i].open) {\r\n paths.push(nodes[i].path);\r\n }\r\n }\r\n\r\n return paths;\r\n },\r\n getAllParents: function (node, parents) {\r\n if (!parents) {\r\n parents = [];\r\n }\r\n\r\n if (!node || !node.parentTId) {\r\n return parents;\r\n } else {\r\n parents.push(node.getParentNode());\r\n return tree.getAllParents(node.getParentNode(), parents);\r\n }\r\n },\r\n isParents: function (tId, parentPath) {\r\n var node = tree.fileTree.getNodeByTId(tId);\r\n if (!node || !node.parentTId) {\r\n return false;\r\n } else {\r\n var parentNode = tree.fileTree.getNodeByTId(node.parentTId);\r\n if (node.path === parentPath) {\r\n return true;\r\n } else {\r\n return tree.isParents(parentNode.tId, parentPath);\r\n }\r\n }\r\n },\r\n isDir: function () {\r\n if (wide.curNode.iconSkin.indexOf(\"ico-ztree-dir\") === 0) {\r\n return true;\r\n }\r\n\r\n return false;\r\n },\r\n newFile: function (it) {\r\n if ($(it).hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n $(\"#dialogNewFilePrompt\").dialog(\"open\");\r\n },\r\n newDir: function (it) {\r\n if ($(it).hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n $(\"#dialogNewDirPrompt\").dialog(\"open\");\r\n },\r\n removeIt: function (it) {\r\n if (it) {\r\n if ($(it).hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n } else {\r\n if (!wide.curNode.removable) {\r\n return false;\r\n }\r\n }\r\n\r\n $(\"#dialogRemoveConfirm\").dialog(\"open\");\r\n },\r\n rename: function (it) {\r\n if (it) {\r\n if ($(it).hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n }\r\n\r\n $(\"#dialogRenamePrompt\").dialog(\"open\");\r\n },\r\n export: function () {\r\n var request = newWideRequest(),\r\n isSucc = false;\r\n request.path = wide.curNode.path;\r\n\r\n $.ajax({\r\n async: false,\r\n type: 'POST',\r\n url: config.context + '/file/zip/new',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogAlert\").dialog(\"open\", result.msg);\r\n\r\n return false;\r\n }\r\n\r\n isSucc = true;\r\n }\r\n });\r\n\r\n if (isSucc) {\r\n window.open(config.context + '/file/zip?path=' + wide.curNode.path + \".zip\");\r\n }\r\n },\r\n crossCompile: function (platform) {\r\n var request = newWideRequest();\r\n request.path = wide.curNode.path;\r\n request.platform = platform;\r\n\r\n $.ajax({\r\n async: false,\r\n type: 'POST',\r\n url: config.context + '/cross',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogAlert\").dialog(\"open\", result.msg);\r\n\r\n return false;\r\n }\r\n }\r\n });\r\n },\r\n decompress: function () {\r\n var request = newWideRequest();\r\n request.path = wide.curNode.path;\r\n\r\n $.ajax({\r\n async: false,\r\n type: 'POST',\r\n url: config.context + '/file/decompress',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogAlert\").dialog(\"open\", result.msg);\r\n\r\n return false;\r\n }\r\n\r\n var dir = wide.curNode.getParentNode();\r\n tree.fileTree.reAsyncChildNodes(dir, \"refresh\");\r\n }\r\n });\r\n },\r\n refresh: function (it) {\r\n if (it) {\r\n if ($(it).hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n }\r\n\r\n tree.fileTree.reAsyncChildNodes(wide.curNode, \"refresh\", true);\r\n },\r\n gitClone: function (it) {\r\n if (it) {\r\n if ($(it).hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n }\r\n\r\n $(\"#dialogGitClonePrompt\").dialog('open');\r\n },\r\n import: function () {\r\n var request = newWideRequest();\r\n request.path = wide.curNode.path;\r\n\r\n $('#importFileupload').fileupload({\r\n url: \"/file/upload?path=\" + request.path,\r\n dataType: 'json',\r\n formData: request,\r\n done: function (e, result) {\r\n tree.fileTree.reAsyncChildNodes(wide.curNode, \"refresh\");\r\n },\r\n fail: function () {\r\n console.log(arguments);\r\n }\r\n });\r\n },\r\n init: function () {\r\n $(\"#file\").click(function () {\r\n $(this).focus();\r\n });\r\n\r\n var request = newWideRequest();\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/files',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (result.succ) {\r\n var $dirRMenu = $(\"#dirRMenu\");\r\n var $fileRMenu = $(\"#fileRMenu\");\r\n var setting = {\r\n data: {\r\n key: {\r\n title: \"path\"\r\n }\r\n },\r\n view: {\r\n showTitle: true,\r\n selectedMulti: false\r\n },\r\n async: {\r\n enable: true,\r\n url: config.context + \"/file/refresh\",\r\n autoParam: [\"path\"]\r\n },\r\n callback: {\r\n onDblClick: function (event, treeId, treeNode) {\r\n if (treeNode) {\r\n tree.openFile(treeNode);\r\n }\r\n },\r\n onRightClick: function (event, treeId, treeNode) {\r\n if (treeNode && !treeNode.isGOAPI) {\r\n menu.undisabled(['import', 'export', 'git-clone']);\r\n\r\n wide.curNode = treeNode;\r\n tree.fileTree.selectNode(treeNode);\r\n\r\n if (!tree.isDir()) { // if right click on a file\r\n if (wide.curNode.removable) {\r\n $fileRMenu.find(\".remove\").removeClass(\"disabled\");\r\n } else {\r\n $fileRMenu.find(\".remove\").addClass(\"disabled\");\r\n }\r\n\r\n if (-1 === wide.curNode.path.indexOf(\"zip\", wide.curNode.path.length - \"zip\".length)) { // !path.endsWith(\"zip\")\r\n $fileRMenu.find(\".decompress\").hide();\r\n } else {\r\n $fileRMenu.find(\".decompress\").show();\r\n }\r\n\r\n if (-1 === wide.curNode.path.indexOf(\"go\", wide.curNode.path.length - \"go\".length)) { // !path.endsWith(\"go\")\r\n $fileRMenu.find(\".linux64\").hide();\r\n } else {\r\n $fileRMenu.find(\".linux64\").show();\r\n }\r\n\r\n var top = event.clientY - 10;\r\n if ($fileRMenu.height() + top > $('.content').height()) {\r\n top = top - $fileRMenu.height() - 25;\r\n }\r\n $fileRMenu.css({\r\n \"top\": top + \"px\",\r\n \"left\": event.clientX + \"px\",\r\n \"display\": \"block\"\r\n }).show();\r\n\r\n $dirRMenu.hide();\r\n\r\n menu.disabled(['import', 'git-clone']);\r\n } else { // 右击了目录\r\n if (wide.curNode.removable) {\r\n $dirRMenu.find(\".remove\").removeClass(\"disabled\");\r\n } else {\r\n $dirRMenu.find(\".remove\").addClass(\"disabled\");\r\n }\r\n\r\n if (wide.curNode.creatable) {\r\n $dirRMenu.find(\".create\").removeClass(\"disabled\");\r\n } else {\r\n $dirRMenu.find(\".create\").addClass(\"disabled\");\r\n }\r\n\r\n var top = event.clientY - 10;\r\n if ($dirRMenu.height() + top > $('.content').height()) {\r\n top = top - $dirRMenu.height() - 25;\r\n }\r\n\r\n $dirRMenu.css({\r\n \"top\": top + \"px\",\r\n \"left\": event.clientX + \"px\",\r\n \"display\": \"block\"\r\n }).show();\r\n\r\n $fileRMenu.hide();\r\n }\r\n $(\"#files\").focus();\r\n }\r\n },\r\n onClick: function (event, treeId, treeNode, clickFlag) {\r\n if (treeNode) {\r\n wide.curNode = treeNode;\r\n tree.fileTree.selectNode(treeNode);\r\n\r\n menu.undisabled(['import', 'export', 'git-clone']);\r\n if (!tree.isDir()) {\r\n menu.disabled(['import', 'git-clone']);\r\n }\r\n\r\n $(\"#files\").focus();\r\n }\r\n }\r\n }\r\n };\r\n tree.fileTree = $.fn.zTree.init($(\"#files\"), setting, result.data.children);\r\n\r\n session.restore();\r\n }\r\n }\r\n });\r\n\r\n this._initSearch();\r\n this._initRename();\r\n },\r\n openFile: function (treeNode, cursor) {\r\n wide.curNode = treeNode;\r\n var tempCursor = cursor;\r\n\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n // 该节点文件已经打开\r\n if (editors.data[i].id === treeNode.path) {\r\n editors.tabs.setCurrent(treeNode.path);\r\n wide.curEditor = editors.data[i].editor;\r\n\r\n if (!tempCursor) {\r\n tempCursor = wide.curEditor.getCursor();\r\n }\r\n $(\".footer .cursor\").text('| ' + (tempCursor.line + 1) + ':' + (tempCursor.ch + 1) + ' |');\r\n\r\n wide.curEditor.setCursor(tempCursor);\r\n var half = Math.floor(wide.curEditor.getScrollInfo().clientHeight / wide.curEditor.defaultTextHeight() / 2);\r\n var cursorCoords = wide.curEditor.cursorCoords({line: tempCursor.line - half, ch: 0}, \"local\");\r\n wide.curEditor.scrollTo(0, cursorCoords.top);\r\n wide.curEditor.focus();\r\n\r\n wide.refreshOutline();\r\n return false;\r\n }\r\n }\r\n\r\n if (!tree.isDir()) {\r\n var request = newWideRequest();\r\n request.path = treeNode.path;\r\n\r\n $.ajax({\r\n async: false,\r\n type: 'POST',\r\n url: config.context + '/file',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogAlert\").dialog(\"open\", result.msg);\r\n\r\n return false;\r\n }\r\n\r\n var data = result.data;\r\n\r\n if (!data.mode) {\r\n var mode = CodeMirror.findModeByFileName(treeNode.path);\r\n if (mode) {\r\n data.mode = mode.mime;\r\n } else {\r\n data.mode = 'text/plain';\r\n }\r\n }\r\n\r\n if (!data.mode) {\r\n console.error(\"Can't find mode by file name [\" + treeNode.path + \"]\");\r\n }\r\n\r\n if (\"img\" === data.mode) { // 是图片文件的话新建 tab 打开\r\n // 最好是开 tab,但这个最终取决于浏览器设置\r\n var w = window.open(config.context + data.path);\r\n return false;\r\n }\r\n\r\n if (!tempCursor) {\r\n tempCursor = CodeMirror.Pos(0, 0);\r\n }\r\n\r\n editors.newEditor(data, tempCursor);\r\n\r\n wide.refreshOutline();\r\n }\r\n });\r\n }\r\n },\r\n _initSearch: function () {\r\n $(\"#dialogSearchForm > input:eq(0)\").keyup(function (event) {\r\n var $okBtn = $(this).closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\");\r\n if (event.which === 13 && !$okBtn.prop(\"disabled\")) {\r\n $okBtn.click();\r\n }\r\n\r\n if ($.trim($(this).val()) === \"\") {\r\n $okBtn.prop(\"disabled\", true);\r\n } else {\r\n $okBtn.prop(\"disabled\", false);\r\n }\r\n });\r\n\r\n $(\"#dialogSearchForm > input:eq(1)\").keyup(function (event) {\r\n var $okBtn = $(this).closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\");\r\n if (event.which === 13 && !$okBtn.prop(\"disabled\")) {\r\n $okBtn.click();\r\n }\r\n });\r\n\r\n $(\"#dialogSearchForm\").dialog({\r\n \"modal\": true,\r\n \"height\": 80,\r\n \"width\": 260,\r\n \"title\": config.label.search,\r\n \"okText\": config.label.search,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n $(\"#dialogSearchForm > input:eq(0)\").val('').focus();\r\n $(\"#dialogSearchForm > input:eq(1)\").val('');\r\n $(\"#dialogSearchForm\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\").prop(\"disabled\", true);\r\n },\r\n \"ok\": function () {\r\n var request = newWideRequest();\r\n\r\n if (!wide.curNode) {\r\n request.dir = \"\";\r\n } else {\r\n request.dir = wide.curNode.path;\r\n }\r\n\r\n request.text = $(\"#dialogSearchForm > input:eq(0)\").val();\r\n request.extension = $(\"#dialogSearchForm > input:eq(1)\").val();\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/file/search/text',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n return;\r\n }\r\n\r\n $(\"#dialogSearchForm\").dialog(\"close\");\r\n editors.appendSearch(result.data, 'founds', request.text);\r\n }\r\n });\r\n }\r\n });\r\n },\r\n _initRename: function () {\r\n $(\"#dialogRenamePrompt\").dialog({\r\n \"modal\": true,\r\n \"height\": 52,\r\n \"width\": 260,\r\n \"title\": config.label.rename,\r\n \"okText\": config.label.rename,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n $(\"#dialogRenamePrompt\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\").prop(\"disabled\", true);\r\n $(\"#dialogRenamePrompt > input\").val(wide.curNode.name).select().focus();\r\n },\r\n \"ok\": function () {\r\n var name = $(\"#dialogRenamePrompt > input\").val(),\r\n request = newWideRequest();\r\n\r\n request.oldPath = wide.curNode.path;\r\n request.newPath = wide.curNode.path.substring(0, wide.curNode.path.lastIndexOf(\"/\") + 1) + name;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/file/rename',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogRenamePrompt\").dialog(\"close\");\r\n bottomGroup.tabs.setCurrent(\"notification\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .notification\").focus();\r\n return false;\r\n }\r\n\r\n $(\"#dialogRenamePrompt\").dialog(\"close\");\r\n }\r\n });\r\n }\r\n });\r\n }\r\n};","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file wide.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.0.0.1, Dec 8, 2015\r\n */\r\nvar wide = {\r\n curNode: undefined,\r\n curEditor: undefined,\r\n curProcessId: undefined, // curent running process id (pid)\r\n refreshOutline: function () {\r\n if (!wide.curEditor ||\r\n (wide.curEditor && wide.curEditor.doc.getMode().name !== \"go\")) {\r\n $(\"#outline\").html('');\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.code = wide.curEditor.getValue();\r\n\r\n $.ajax({\r\n type: 'POST',\r\n async: false,\r\n url: config.context + '/outline',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n return;\r\n }\r\n\r\n var data = result.data;\r\n\r\n var outlineHTML = '
      ',\r\n decls = ['constDecls', 'varDecls', 'funcDecls',\r\n 'structDecls', 'interfaceDecls', 'typeDecls'];\r\n\r\n for (var i = 0, max = decls.length; i < max; i++) {\r\n var key = decls[i];\r\n for (var j = 0, maxj = data[key].length; j < maxj; j++) {\r\n var obj = data[key][j];\r\n outlineHTML += '
    • ' + obj.Name + '
    • ';\r\n }\r\n }\r\n $(\"#outline\").html(outlineHTML + '
    ');\r\n\r\n $(\"#outline li\").dblclick(function () {\r\n var $it = $(this),\r\n cursor = CodeMirror.Pos($it.data('line'), $it.data(\"ch\"));\r\n\r\n var editor = wide.curEditor;\r\n editor.setCursor(cursor);\r\n\r\n var half = Math.floor(editor.getScrollInfo().clientHeight / editor.defaultTextHeight() / 2);\r\n var cursorCoords = editor.cursorCoords({line: cursor.line - half, ch: 0}, \"local\");\r\n editor.scrollTo(0, cursorCoords.top);\r\n\r\n editor.focus();\r\n });\r\n }\r\n });\r\n },\r\n _initDialog: function () {\r\n $(\".dialog-prompt > input\").keyup(function (event) {\r\n var $okBtn = $(this).closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\");\r\n if (event.which === 13 && !$okBtn.prop(\"disabled\")) {\r\n $okBtn.click();\r\n }\r\n\r\n if ($.trim($(this).val()) === \"\") {\r\n $okBtn.prop(\"disabled\", true);\r\n } else {\r\n $okBtn.prop(\"disabled\", false);\r\n }\r\n });\r\n\r\n $(\"#dialogAlert\").dialog({\r\n \"modal\": true,\r\n \"height\": 40,\r\n \"width\": 350,\r\n \"title\": config.label.tip,\r\n \"hiddenOk\": true,\r\n \"cancelText\": config.label.confirm,\r\n \"afterOpen\": function (msg) {\r\n $(\"#dialogAlert\").html(msg);\r\n }\r\n });\r\n\r\n $(\"#dialogRemoveConfirm\").dialog({\r\n \"modal\": true,\r\n \"height\": 36,\r\n \"width\": 260,\r\n \"title\": config.label.delete,\r\n \"okText\": config.label.delete,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n $(\"#dialogRemoveConfirm > b\").html('\"' + wide.curNode.name + '\"');\r\n },\r\n \"ok\": function () {\r\n var request = newWideRequest();\r\n request.path = wide.curNode.path;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/file/remove',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogRemoveConfirm\").dialog(\"close\");\r\n bottomGroup.tabs.setCurrent(\"notification\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .notification\").focus();\r\n return false;\r\n }\r\n\r\n $(\"#dialogRemoveConfirm\").dialog(\"close\");\r\n }\r\n });\r\n }\r\n });\r\n\r\n $(\"#dialogNewFilePrompt\").dialog({\r\n \"modal\": true,\r\n \"height\": 52,\r\n \"width\": 260,\r\n \"title\": config.label.create_file,\r\n \"okText\": config.label.create,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n $(\"#dialogNewFilePrompt > input\").val('').focus();\r\n $(\"#dialogNewFilePrompt\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\").prop(\"disabled\", true);\r\n },\r\n \"ok\": function () {\r\n var request = newWideRequest(),\r\n name = $(\"#dialogNewFilePrompt > input\").val();\r\n\r\n request.path = wide.curNode.path + \"/\" + name;\r\n request.fileType = \"f\";\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/file/new',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogNewFilePrompt\").dialog(\"close\");\r\n bottomGroup.tabs.setCurrent(\"notification\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .notification\").focus();\r\n return false;\r\n }\r\n\r\n $(\"#dialogNewFilePrompt\").dialog(\"close\");\r\n\r\n setTimeout(function () { // Delay, waiting the file change notified and then open it\r\n var tId = tree.getTIdByPath(request.path);\r\n tree.openFile(tree.fileTree.getNodeByTId(tId));\r\n tree.fileTree.selectNode(wide.curNode);\r\n }, 100);\r\n }\r\n });\r\n }\r\n });\r\n\r\n $(\"#dialogNewDirPrompt\").dialog({\r\n \"modal\": true,\r\n \"height\": 52,\r\n \"width\": 260,\r\n \"title\": config.label.create_dir,\r\n \"okText\": config.label.create,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n $(\"#dialogNewDirPrompt > input\").val('').focus();\r\n $(\"#dialogNewDirPrompt\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\").prop(\"disabled\", true);\r\n },\r\n \"ok\": function () {\r\n var name = $(\"#dialogNewDirPrompt > input\").val(),\r\n request = newWideRequest();\r\n\r\n request.path = wide.curNode.path + \"/\" + name;\r\n request.fileType = \"d\";\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/file/new',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogNewDirPrompt\").dialog(\"close\");\r\n bottomGroup.tabs.setCurrent(\"notification\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .notification\").focus();\r\n return false;\r\n }\r\n\r\n $(\"#dialogNewDirPrompt\").dialog(\"close\");\r\n }\r\n });\r\n }\r\n });\r\n\r\n $(\"#dialogGoFilePrompt\").dialog({\r\n \"modal\": true,\r\n \"height\": 320,\r\n \"width\": 660,\r\n \"title\": config.label.goto_file,\r\n \"okText\": config.label.go,\r\n \"cancelText\": config.label.cancel,\r\n \"afterInit\": function () {\r\n $(\"#dialogGoFilePrompt\").on(\"dblclick\", \"li\", function () {\r\n var tId = tree.getTIdByPath($(this).find(\".ft-small\").text());\r\n tree.openFile(tree.fileTree.getNodeByTId(tId));\r\n tree.fileTree.selectNode(wide.curNode);\r\n $(\"#dialogGoFilePrompt\").dialog(\"close\");\r\n wide.curEditor.focus();\r\n });\r\n\r\n $(\"#dialogGoFilePrompt\").on(\"click\", \"li\", function () {\r\n var $list = $(\"#dialogGoFilePrompt > .list\");\r\n $list.find(\"li\").removeClass(\"selected\");\r\n $list.data(\"index\", $(this).data(\"index\"));\r\n $(this).addClass(\"selected\");\r\n });\r\n\r\n hotkeys.bindList($(\"#dialogGoFilePrompt > input\"), $(\"#dialogGoFilePrompt > .list\"), function ($selected) {\r\n var tId = tree.getTIdByPath($selected.find(\".ft-small\").text());\r\n tree.openFile(tree.fileTree.getNodeByTId(tId));\r\n tree.fileTree.selectNode(wide.curNode);\r\n $(\"#dialogGoFilePrompt\").dialog(\"close\");\r\n wide.curEditor.focus();\r\n });\r\n\r\n $(\"#dialogGoFilePrompt > input\").bind(\"input\", function () {\r\n var name = $(\"#dialogGoFilePrompt > input\").val();\r\n\r\n var request = newWideRequest();\r\n request.path = '';\r\n request.name = '*' + name + '*';\r\n if (wide.curNode) {\r\n request.path = wide.curNode.path;\r\n }\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/file/find/name',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n return;\r\n }\r\n\r\n var data = result.data;\r\n\r\n var goFileHTML = '';\r\n for (var i = 0, max = data.length; i < max; i++) {\r\n var path = data[i].path,\r\n name = path.substr(path.lastIndexOf(\"/\") + 1),\r\n icoSkin = wide.getClassBySuffix(name.split(\".\")[1]);\r\n if (i === 0) {\r\n goFileHTML += '
  • '\r\n + name + '    '\r\n + path + '
  • ';\r\n } else {\r\n goFileHTML += '
  • '\r\n + name + '    '\r\n + path + '
  • ';\r\n }\r\n }\r\n\r\n $(\"#dialogGoFilePrompt > ul\").html(goFileHTML);\r\n }\r\n });\r\n });\r\n },\r\n \"afterOpen\": function () {\r\n $(\"#dialogGoFilePrompt > input\").val('').focus();\r\n $(\"#dialogGoFilePrompt\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\").prop(\"disabled\", true);\r\n $(\"#dialogGoFilePrompt .list\").html('').data(\"index\", 0);\r\n },\r\n \"ok\": function () {\r\n var tId = tree.getTIdByPath($(\"#dialogGoFilePrompt .selected .ft-small\").text());\r\n tree.openFile(tree.fileTree.getNodeByTId(tId));\r\n tree.fileTree.selectNode(wide.curNode);\r\n $(\"#dialogGoFilePrompt\").dialog(\"close\");\r\n wide.curEditor.focus();\r\n }\r\n });\r\n\r\n $(\"#dialogGoLinePrompt\").dialog({\r\n \"modal\": true,\r\n \"height\": 52,\r\n \"width\": 260,\r\n \"title\": config.label.goto_line,\r\n \"okText\": config.label.go,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n $(\"#dialogGoLinePrompt > input\").val('').focus();\r\n $(\"#dialogGoLinePrompt\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\").prop(\"disabled\", true);\r\n },\r\n \"ok\": function () {\r\n var line = parseInt($(\"#dialogGoLinePrompt > input\").val()) - 1;\r\n $(\"#dialogGoLinePrompt\").dialog(\"close\");\r\n\r\n var editor = wide.curEditor;\r\n var cursor = editor.getCursor();\r\n\r\n editor.setCursor(CodeMirror.Pos(line, cursor.ch));\r\n\r\n var half = Math.floor(editor.getScrollInfo().clientHeight / editor.defaultTextHeight() / 2);\r\n var cursorCoords = editor.cursorCoords({line: line - half, ch: cursor.ch}, \"local\");\r\n editor.scrollTo(0, cursorCoords.top);\r\n\r\n editor.focus();\r\n }\r\n });\r\n\r\n $(\"#dialogGitClonePrompt\").dialog({\r\n \"modal\": true,\r\n \"height\": 52,\r\n \"width\": 360,\r\n \"title\": config.label.git_clone,\r\n \"okText\": config.label.confirm,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n $(\"#dialogGitClonePrompt > input\").val('').focus();\r\n $(\"#dialogGitClonePrompt\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\").prop(\"disabled\", true);\r\n },\r\n \"ok\": function () {\r\n $(\"#dialogGitClonePrompt\").dialog(\"close\");\r\n\r\n var request = newWideRequest();\r\n request.path = wide.curNode.path;\r\n request.repository = $(\"#dialogGitClonePrompt > input\").val();\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/git/clone',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n }\r\n });\r\n }\r\n });\r\n },\r\n _initWS: function () {\r\n var outputWS = new ReconnectingWebSocket(config.channel + '/output/ws?sid=' + config.wideSessionId);\r\n outputWS.onopen = function () {\r\n console.log('[output onopen] connected');\r\n };\r\n\r\n outputWS.onmessage = function (e) {\r\n console.log('[output onmessage]' + e.data);\r\n var data = JSON.parse(e.data);\r\n\r\n if (goLintFound) {\r\n goLintFound = [];\r\n }\r\n\r\n if ('run' === data.nextCmd) {\r\n var request = newWideRequest();\r\n request.executable = data.executable;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/run',\r\n data: JSON.stringify(request),\r\n dataType: \"json\"\r\n });\r\n }\r\n\r\n switch (data.cmd) {\r\n case 'run':\r\n var content = $('.bottom-window-group .output > div').html();\r\n if (!wide.curProcessId || '' === content) {\r\n bottomGroup.fillOutput(content + '
    ' + data.output + '
    ');\r\n } else {\r\n bottomGroup.fillOutput(content.replace(/<\\/pre>$/g, data.output + ''));\r\n }\r\n\r\n wide.curProcessId = data.pid;\r\n\r\n break;\r\n case 'run-done':\r\n bottomGroup.fillOutput($('.bottom-window-group .output > div').html().replace(/<\\/pre>$/g, data.output + ''));\r\n\r\n wide.curProcessId = undefined;\r\n $(\"#buildRun\").removeClass(\"ico-stop\")\r\n .addClass(\"ico-buildrun\").attr(\"title\", config.label.build_n_run);\r\n\r\n break;\r\n case 'start-build':\r\n case 'start-test':\r\n case 'start-vet':\r\n case 'start-install':\r\n case 'start-get':\r\n case 'start-git_clone':\r\n bottomGroup.fillOutput(data.output);\r\n\r\n break;\r\n case 'go test':\r\n case 'go vet':\r\n case 'go install':\r\n case 'go get':\r\n bottomGroup.fillOutput($('.bottom-window-group .output > div').html() + data.output);\r\n\r\n break;\r\n case 'git clone':\r\n bottomGroup.fillOutput($('.bottom-window-group .output > div').html() + data.output);\r\n tree.fileTree.reAsyncChildNodes(wide.curNode, \"refresh\", false);\r\n\r\n break;\r\n case 'build':\r\n case 'cross-build':\r\n bottomGroup.fillOutput($('.bottom-window-group .output > div').html() + data.output);\r\n\r\n if (data.lints) { // has build error\r\n var files = {};\r\n\r\n for (var i = 0; i < data.lints.length; i++) {\r\n var lint = data.lints[i];\r\n\r\n goLintFound.push({from: CodeMirror.Pos(lint.lineNo, 0),\r\n to: CodeMirror.Pos(lint.lineNo, 0),\r\n message: lint.msg, severity: lint.severity});\r\n\r\n files[lint.file] = lint.file;\r\n }\r\n\r\n $(\"#buildRun\").removeClass(\"ico-stop\")\r\n .addClass(\"ico-buildrun\").attr(\"title\", config.label.build_n_run);\r\n\r\n // trigger gutter lint\r\n for (var path in files) {\r\n var editor = editors.getEditorByPath(path);\r\n CodeMirror.signal(editor, \"change\", editor);\r\n }\r\n } else {\r\n if ('cross-build' === data.cmd) {\r\n var request = newWideRequest(),\r\n path = null;\r\n request.path = data.executable;\r\n request.name = data.name;\r\n\r\n $.ajax({\r\n async: false,\r\n type: 'POST',\r\n url: config.context + '/file/zip/new',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogAlert\").dialog(\"open\", result.msg);\r\n\r\n return false;\r\n }\r\n\r\n path = result.data;\r\n }\r\n });\r\n\r\n if (path) {\r\n window.open(config.context + '/file/zip?path=' + path + \".zip\");\r\n }\r\n }\r\n }\r\n\r\n break;\r\n }\r\n };\r\n outputWS.onclose = function (e) {\r\n console.log('[output onclose] disconnected (' + e.code + ')');\r\n };\r\n outputWS.onerror = function (e) {\r\n console.log('[output onerror]');\r\n };\r\n },\r\n _initFooter: function () {\r\n $(\".footer .cursor\").dblclick(function () {\r\n $(\"#dialogGoLinePrompt\").dialog(\"open\");\r\n });\r\n },\r\n init: function () {\r\n this._initFooter();\r\n\r\n this._initWS();\r\n\r\n // 点击隐藏弹出层\r\n $(\"body\").bind(\"mouseup\", function (event) {\r\n // MAC 右键文件树失效\r\n if (event.which === 3) {\r\n return false;\r\n }\r\n\r\n $(\".frame\").hide();\r\n\r\n if (!($(event.target).closest(\".frame\").length === 1 || event.target.className === \"frame\")) {\r\n $(\".menu > ul > li\").unbind().removeClass(\"selected\");\r\n menu.subMenu();\r\n }\r\n });\r\n\r\n // 刷新提示\r\n window.onbeforeunload = function () {\r\n if (editors.data.length > 0) {\r\n return config.label.confirm_save;\r\n }\r\n };\r\n\r\n // 禁止鼠标右键菜单\r\n document.oncontextmenu = function () {\r\n return false;\r\n };\r\n\r\n this._initDialog();\r\n },\r\n _save: function (path, editor) {\r\n if (!path) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.file = path;\r\n request.code = editor.getValue();\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/file/save',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n // reset the save state\r\n editor.doc.markClean();\r\n $(\".edit-panel .tabs > div\").each(function () {\r\n var $span = $(this).find(\"span:eq(0)\");\r\n if ($span.attr(\"title\") === path) {\r\n $span.removeClass(\"changed\");\r\n }\r\n });\r\n }\r\n });\r\n },\r\n saveFile: function () {\r\n var path = editors.getCurrentPath();\r\n if (!path) {\r\n return false;\r\n }\r\n\r\n var editor = wide.curEditor;\r\n if (editor.doc.isClean()) { // no modification\r\n return false;\r\n }\r\n\r\n if (\"text/x-go\" === editor.getOption(\"mode\")) {\r\n wide.gofmt(path, wide.curEditor); // go fmt will save\r\n\r\n // build the file at once\r\n var request = newWideRequest();\r\n request.file = path;\r\n request.code = editor.getValue();\r\n request.nextCmd = \"\"; // build only, no following operation\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/build',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n beforeSend: function () {\r\n bottomGroup.resetOutput();\r\n },\r\n success: function (result) {\r\n }\r\n });\r\n\r\n // refresh outline\r\n wide.refreshOutline();\r\n\r\n return;\r\n }\r\n\r\n wide._save(path, wide.curEditor);\r\n },\r\n stop: function () {\r\n if ($(\"#buildRun\").hasClass(\"ico-buildrun\")) {\r\n menu.run();\r\n return false;\r\n }\r\n\r\n if (!wide.curProcessId) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.pid = wide.curProcessId;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/stop',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n $(\"#buildRun\").removeClass(\"ico-stop\")\r\n .addClass(\"ico-buildrun\").attr(\"title\", config.label.build_n_run);\r\n }\r\n });\r\n },\r\n gofmt: function (path, editor) {\r\n var cursor = editor.getCursor();\r\n var scrollInfo = editor.getScrollInfo();\r\n\r\n var request = newWideRequest();\r\n request.file = path;\r\n request.code = editor.getValue();\r\n request.cursorLine = cursor.line;\r\n request.cursorCh = cursor.ch;\r\n\r\n $.ajax({\r\n async: false, // sync\r\n type: 'POST',\r\n url: config.context + '/go/fmt',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (result.succ) {\r\n editor.setValue(result.data.code);\r\n editor.setCursor(cursor);\r\n editor.scrollTo(null, scrollInfo.top);\r\n\r\n wide._save(path, editor);\r\n }\r\n }\r\n });\r\n },\r\n fmt: function (path, editor) {\r\n var mode = editor.getOption(\"mode\");\r\n\r\n var cursor = editor.getCursor();\r\n var scrollInfo = editor.getScrollInfo();\r\n\r\n var request = newWideRequest();\r\n request.file = path;\r\n request.code = editor.getValue();\r\n request.cursorLine = cursor.line;\r\n request.cursorCh = cursor.ch;\r\n\r\n var formatted = null;\r\n\r\n switch (mode) {\r\n case \"text/x-go\":\r\n $.ajax({\r\n async: false, // sync\r\n type: 'POST',\r\n url: config.context + '/go/fmt',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (result.succ) {\r\n formatted = result.data.code;\r\n }\r\n }\r\n });\r\n\r\n break;\r\n case \"text/html\":\r\n formatted = html_beautify(editor.getValue());\r\n break;\r\n case \"text/javascript\":\r\n case \"application/json\":\r\n formatted = js_beautify(editor.getValue());\r\n break;\r\n case \"text/css\":\r\n formatted = css_beautify(editor.getValue());\r\n break;\r\n default :\r\n break;\r\n }\r\n\r\n if (formatted) {\r\n editor.setValue(formatted);\r\n editor.setCursor(cursor);\r\n editor.scrollTo(null, scrollInfo.top);\r\n\r\n wide._save(path, editor);\r\n }\r\n },\r\n getClassBySuffix: function (suffix) {\r\n var iconSkin = \"ico-ztree-other \";\r\n switch (suffix) {\r\n case \"html\":\r\n case \"htm\":\r\n iconSkin = \"ico-ztree-html \";\r\n break;\r\n case \"go\":\r\n iconSkin = \"ico-ztree-go \";\r\n break;\r\n case \"css\":\r\n iconSkin = \"ico-ztree-css \";\r\n break;\r\n case \"txt\":\r\n iconSkin = \"ico-ztree-text \";\r\n break;\r\n case \"sql\":\r\n iconSkin = \"ico-ztree-sql \";\r\n break;\r\n case \"properties\":\r\n iconSkin = \"ico-ztree-pro \";\r\n break;\r\n case \"md\":\r\n iconSkin = \"ico-ztree-md \";\r\n break;\r\n case \"js\", \"json\":\r\n iconSkin = \"ico-ztree-js \";\r\n break;\r\n case \"xml\":\r\n iconSkin = \"ico-ztree-xml \";\r\n break;\r\n case \"jpg\":\r\n case \"jpeg\":\r\n case \"bmp\":\r\n case \"gif\":\r\n case \"png\":\r\n case \"svg\":\r\n case \"ico\":\r\n iconSkin = \"ico-ztree-img \";\r\n break;\r\n }\r\n\r\n return iconSkin;\r\n }\r\n};\r\n\r\n$(document).ready(function () {\r\n wide.init();\r\n tree.init();\r\n menu.init();\r\n hotkeys.init();\r\n session.init();\r\n notification.init();\r\n editors.init();\r\n windows.init();\r\n bottomGroup.init();\r\n});\r\n","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file session.js\r\n *\r\n * @author Liyuan Li\r\n * @version 1.1.0.1, Dec 8, 2015\r\n */\r\nvar session = {\r\n init: function () {\r\n this._initWS();\r\n\r\n var getLayoutState = function (paneState) {\r\n var state = 'normal';\r\n if (paneState.isClosed) {\r\n state = 'min';\r\n } else if (paneState.size >= $('body').width()) {\r\n state = 'max';\r\n }\r\n\r\n return state;\r\n };\r\n\r\n // save session content every 30 seconds\r\n setInterval(function () {\r\n var request = newWideRequest(),\r\n filse = [],\r\n fileTree = [],\r\n currentId = editors.getCurrentId(),\r\n currentFile = currentId ? editors.getCurrentPath() : \"\";\r\n\r\n editors.tabs.obj._$tabs.find(\"div\").each(function () {\r\n var $it = $(this);\r\n if ($it.find(\"span:eq(0)\").attr(\"title\") !== config.label.start_page) {\r\n filse.push($it.find(\"span:eq(0)\").attr(\"title\"));\r\n }\r\n });\r\n\r\n fileTree = tree.getOpenPaths();\r\n\r\n request.currentFile = currentFile; // current editor file\r\n request.fileTree = fileTree; // file tree expansion state\r\n request.files = filse; // editor tabs\r\n\r\n\r\n request.layout = {\r\n \"side\": {\r\n \"size\": windows.outerLayout.west.state.size,\r\n \"state\": getLayoutState(windows.outerLayout.west.state)\r\n },\r\n \"sideRight\": {\r\n \"size\": windows.innerLayout.east.state.size,\r\n \"state\": getLayoutState(windows.innerLayout.east.state)\r\n },\r\n \"bottom\": {\r\n \"size\": windows.innerLayout.south.state.size,\r\n \"state\": getLayoutState(windows.innerLayout.south.state)\r\n }\r\n };\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/session/save',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n }\r\n });\r\n }, 30000);\r\n },\r\n restore: function () {\r\n if (!config.latestSessionContent) {\r\n return;\r\n }\r\n\r\n var fileTree = config.latestSessionContent.fileTree,\r\n files = config.latestSessionContent.files,\r\n currentFile = config.latestSessionContent.currentFile,\r\n id = \"\",\r\n nodesToOpen = [];\r\n\r\n var nodes = tree.fileTree.transformToArray(tree.fileTree.getNodes());\r\n\r\n for (var i = 0, ii = nodes.length; i < ii; i++) {\r\n // expand tree\r\n for (var j = 0, jj = fileTree.length; j < jj; j++) {\r\n if (nodes[i].path === fileTree[j]) {\r\n // expand this node only if its parents are open\r\n var parents = tree.getAllParents(tree.fileTree.getNodeByTId(nodes[i].tId)),\r\n isOpen = true;\r\n for (var l = 0, max = parents.length; l < max; l++) {\r\n if (parents[l].open === false) {\r\n isOpen = false;\r\n }\r\n }\r\n if (isOpen) {\r\n tree.fileTree.expandNode(nodes[i], true, false, true);\r\n } else {\r\n // flag it is open\r\n nodes[i].open = true;\r\n }\r\n break;\r\n }\r\n }\r\n\r\n // open editors\r\n for (var k = 0, kk = files.length; k < kk; k++) {\r\n if (nodes[i].path === files[k]) {\r\n nodesToOpen.push(nodes[i]);\r\n break;\r\n }\r\n }\r\n\r\n if (nodes[i].path === currentFile) {\r\n id = nodes[i].path;\r\n\r\n // FIXME: 上面的展开是异步进行的,所以执行到这里的时候可能还没有展开完,导致定位不了可视区域\r\n tree.fileTree.selectNode(nodes[i]);\r\n wide.curNode = nodes[i];\r\n }\r\n }\r\n\r\n // handle the open sequence of editors\r\n for (var m = 0, mm = files.length; m < mm; m++) {\r\n for (var n = 0, nn = nodesToOpen.length; n < nn; n++) {\r\n if (nodesToOpen[n].path === files[m]) {\r\n tree.openFile(nodesToOpen[n]);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // set the current editor\r\n editors.tabs.setCurrent(id);\r\n for (var c = 0, max = editors.data.length; c < max; c++) {\r\n if (id === editors.data[c].id) {\r\n wide.curEditor = editors.data[c].editor;\r\n break;\r\n }\r\n } \r\n },\r\n _initWS: function () {\r\n // Used for session retention, server will release all resources of the session if this channel closed\r\n var sessionWS = new ReconnectingWebSocket(config.channel + '/session/ws?sid=' + config.wideSessionId);\r\n\r\n sessionWS.onopen = function () {\r\n console.log('[session onopen] connected');\r\n\r\n var dateFormat = function (time, fmt) {\r\n var date = new Date(time);\r\n var dateObj = {\r\n \"M+\": date.getMonth() + 1,\r\n \"d+\": date.getDate(),\r\n \"h+\": date.getHours(),\r\n \"m+\": date.getMinutes(),\r\n \"s+\": date.getSeconds(),\r\n \"q+\": Math.floor((date.getMonth() + 3) / 3),\r\n \"S\": date.getMilliseconds()\r\n };\r\n if (/(y+)/.test(fmt))\r\n fmt = fmt.replace(RegExp.$1, (date.getFullYear() + \"\").substr(4 - RegExp.$1.length));\r\n for (var k in dateObj)\r\n if (new RegExp(\"(\" + k + \")\").test(fmt)) {\r\n fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1)\r\n ? (dateObj[k]) : ((\"00\" + dateObj[k]).substr((\"\" + dateObj[k]).length)));\r\n }\r\n return fmt;\r\n };\r\n\r\n var data = {type: \"Network\", severity: \"INFO\",\r\n message: \"Connected to server [sid=\" + config.wideSessionId + \"], \" + dateFormat(new Date().getTime(), 'yyyy-MM-dd hh:mm:ss')},\r\n $notification = $('.bottom-window-group .notification > table'),\r\n notificationHTML = '';\r\n\r\n notificationHTML += '' + data.severity\r\n + '' + data.message\r\n + '' + data.type + '';\r\n $notification.append(notificationHTML);\r\n };\r\n\r\n sessionWS.onmessage = function (e) {\r\n var data = JSON.parse(e.data);\r\n switch (data.cmd) {\r\n case 'create-file':\r\n var node = tree.fileTree.getNodeByTId(tree.getTIdByPath(data.dir)),\r\n name = data.path.replace(data.dir + '/', ''),\r\n mode = CodeMirror.findModeByFileName(name),\r\n iconSkin = wide.getClassBySuffix(name.split(\".\")[1]);\r\n\r\n if (data.type && data.type === 'f') {\r\n tree.fileTree.addNodes(node, [{\r\n \"id\": data.path,\r\n \"name\": name,\r\n \"iconSkin\": iconSkin,\r\n \"path\": data.path,\r\n \"mode\": mode,\r\n \"removable\": true,\r\n \"creatable\": true\r\n }]);\r\n\r\n } else {\r\n tree.fileTree.addNodes(node, [{\r\n \"id\": data.path,\r\n \"name\": name,\r\n \"iconSkin\": \"ico-ztree-dir \",\r\n \"path\": data.path,\r\n \"removable\": true,\r\n \"creatable\": true,\r\n \"isParent\": true\r\n }]);\r\n }\r\n break;\r\n case 'remove-file':\r\n case 'rename-file':\r\n var node = tree.fileTree.getNodeByTId(tree.getTIdByPath(data.path));\r\n tree.fileTree.removeNode(node);\r\n\r\n var nodes = tree.fileTree.transformToArray(node);\r\n for (var i = 0, ii = nodes.length; i < ii; i++) {\r\n editors.tabs.del(nodes[i].path);\r\n }\r\n\r\n break;\r\n }\r\n };\r\n sessionWS.onclose = function (e) {\r\n console.log('[session onclose] disconnected (' + e.code + ')');\r\n\r\n var data = {type: \"Network\", severity: \"ERROR\",\r\n message: \"Disconnected from server, trying to reconnect it [sid=\" + config.wideSessionId + \"]\"},\r\n $notification = $('.bottom-window-group .notification > table'),\r\n notificationHTML = '';\r\n\r\n notificationHTML += '' + data.severity\r\n + '' + data.message\r\n + '' + data.type + '';\r\n $notification.append(notificationHTML);\r\n\r\n $(\".notification-count\").show();\r\n };\r\n sessionWS.onerror = function (e) {\r\n console.log('[session onerror]');\r\n };\r\n }\r\n};","/*\r\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/*\r\n * @file menu.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.0.1.1, Mar 15, 2017\r\n */\r\nvar menu = {\r\n init: function () {\r\n this.subMenu();\r\n this._initPreference();\r\n this._initAbout();\r\n this._initShare();\r\n\r\n // 点击子菜单后消失\r\n $(\".menu .frame li\").click(function () {\r\n $(\".menu > ul > li\").unbind().removeClass(\"selected\");\r\n menu.subMenu();\r\n });\r\n },\r\n _initShare: function () {\r\n $(\".menu .ico-share\").hover(function () {\r\n $(\".menu .share-panel\").show();\r\n });\r\n\r\n $(\".share-panel .font-ico\").click(function () {\r\n var key = $(this).attr('class').split('-')[2];\r\n var url = \"https://wide.b3log.org\", pic = 'https://wide.b3log.org/static/images/wide-logo.png';\r\n var urls = {};\r\n urls.email = \"mailto:?subject=\" + $('title').text()\r\n + \"&body=\" + $('meta[name=description]').attr('content') + ' ' + url;\r\n\r\n var twitterShare = encodeURIComponent($('meta[name=description]').attr('content') + \" \" + url + \" #golang\");\r\n urls.twitter = \"https://twitter.com/intent/tweet?status=\" + twitterShare;\r\n\r\n urls.facebook = \"https://www.facebook.com/sharer/sharer.php?u=\" + url;\r\n urls.googleplus = \"https://plus.google.com/share?url=\" + url;\r\n\r\n var title = encodeURIComponent($('title').text() + '. \\n' + $('meta[name=description]').attr('content')\r\n + \" #golang#\");\r\n urls.weibo = \"http://v.t.sina.com.cn/share/share.php?title=\" + title + \"&url=\" + url + \"&pic=\" + pic;\r\n urls.tencent = \"http://share.v.t.qq.com/index.php?c=share&a=index&title=\" + title +\r\n \"&url=\" + url + \"&pic=\" + pic;\r\n\r\n window.open(urls[key], \"_blank\", \"top=100,left=200,width=648,height=618\");\r\n });\r\n },\r\n _initAbout: function () {\r\n $(\"#dialogAbout\").load(config.context + '/about', function () {\r\n $(\"#dialogAbout\").dialog({\r\n \"modal\": true,\r\n \"title\": config.label.about,\r\n \"hideFooter\": true,\r\n \"afterOpen\": function () {\r\n $.ajax({\r\n url: \"https://rhythm.b3log.org/version/wide/latest\",\r\n type: \"GET\",\r\n dataType: \"jsonp\",\r\n jsonp: \"callback\",\r\n success: function (data, textStatus) {\r\n if ($(\"#dialogAbout .version\").text() === data.wideVersion) {\r\n $(\".upgrade\").text(config.label.uptodate);\r\n } else {\r\n $(\".upgrade\").html(config.label.new_version_available + config.label.colon\r\n + \"\" + data.wideVersion + \"\");\r\n }\r\n }\r\n });\r\n }\r\n });\r\n });\r\n },\r\n disabled: function (list) {\r\n for (var i = 0, max = list.length; i < max; i++) {\r\n $(\".menu li.\" + list[i]).addClass(\"disabled\");\r\n }\r\n },\r\n undisabled: function (list) {\r\n for (var i = 0, max = list.length; i < max; i++) {\r\n $(\".menu li.\" + list[i]).removeClass(\"disabled\");\r\n }\r\n },\r\n // 焦点不在菜单上时需点击展开子菜单,否则为鼠标移动展开\r\n subMenu: function () {\r\n $(\".menu > ul > li\").click(function (event) {\r\n if ($(event.target).closest(\".frame\").length === 1) {\r\n return;\r\n }\r\n var $it = $(this);\r\n $it.find('.frame').show();\r\n $(\".menu > ul > li\").removeClass(\"selected\");\r\n $(this).addClass(\"selected\");\r\n\r\n $(\".menu > ul > li\").unbind();\r\n\r\n $(\".menu > ul > li\").mouseover(function () {\r\n if ($(event.target).closest(\".frame\").length === 1) {\r\n return;\r\n }\r\n $(\".menu .frame\").hide();\r\n $(this).find('.frame').show();\r\n $(\".menu > ul > li\").removeClass(\"selected\");\r\n $(this).addClass(\"selected\");\r\n });\r\n });\r\n },\r\n openPreference: function () {\r\n $(\"#dialogPreference\").dialog(\"open\");\r\n },\r\n saveAllFiles: function () {\r\n if ($(\".menu li.save-all\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n var path = editors.data[i].id;\r\n var editor = editors.data[i].editor;\r\n\r\n if (\"text/x-go\" === editor.getOption(\"mode\")) {\r\n wide.fmt(path, editor);\r\n } else {\r\n wide._save(path, editor);\r\n }\r\n }\r\n },\r\n closeAllFiles: function () {\r\n if ($(\".menu li.close-all\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n // 设置全部关闭标识\r\n var removeData = [];\r\n $(\".edit-panel .tabs > div\").each(function (i) {\r\n if (i !== 0) {\r\n removeData.push($(this).data(\"index\"));\r\n }\r\n });\r\n $(\"#dialogCloseEditor\").data(\"removeData\", removeData);\r\n // 开始关闭\r\n $(\".edit-panel .tabs .ico-close:eq(0)\").click();\r\n },\r\n exit: function () {\r\n var request = newWideRequest();\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/logout',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (result.succ) {\r\n window.location.href = config.context + \"/login\";\r\n }\r\n }\r\n });\r\n },\r\n openAbout: function () {\r\n $(\"#dialogAbout\").dialog(\"open\");\r\n },\r\n goget: function () {\r\n menu.saveAllFiles();\r\n\r\n var currentPath = editors.getCurrentPath();\r\n if (!currentPath) {\r\n return false;\r\n }\r\n\r\n if ($(\".menu li.go-get\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.file = currentPath;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/go/get',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n beforeSend: function () {\r\n bottomGroup.resetOutput();\r\n },\r\n success: function (result) {\r\n }\r\n });\r\n },\r\n goinstall: function () {\r\n menu.saveAllFiles();\r\n\r\n var currentPath = editors.getCurrentPath();\r\n if (!currentPath) {\r\n return false;\r\n }\r\n\r\n if ($(\".menu li.go-install\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.file = currentPath;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/go/install',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n beforeSend: function () {\r\n bottomGroup.resetOutput();\r\n },\r\n success: function (result) {\r\n }\r\n });\r\n },\r\n // go test.\r\n test: function () {\r\n menu.saveAllFiles();\r\n\r\n var currentPath = editors.getCurrentPath();\r\n if (!currentPath) {\r\n return false;\r\n }\r\n\r\n if ($(\".menu li.go-test\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.file = currentPath;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/go/test',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n beforeSend: function () {\r\n bottomGroup.resetOutput();\r\n },\r\n success: function (result) {\r\n }\r\n });\r\n },\r\n // go vet.\r\n govet: function () {\r\n menu.saveAllFiles();\r\n\r\n var currentPath = editors.getCurrentPath();\r\n if (!currentPath) {\r\n return false;\r\n }\r\n\r\n if ($(\".menu li.go-vet\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.file = currentPath;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/go/vet',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n beforeSend: function () {\r\n bottomGroup.resetOutput();\r\n },\r\n success: function (result) {\r\n }\r\n });\r\n },\r\n // Build & Run.\r\n run: function () {\r\n menu.saveAllFiles();\r\n\r\n if ($(\"#buildRun\").hasClass(\"ico-stop\")) {\r\n wide.stop();\r\n return false;\r\n }\r\n\r\n var currentPath = editors.getCurrentPath();\r\n if (!currentPath) {\r\n return false;\r\n }\r\n\r\n if ($(\".menu li.run\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.file = currentPath;\r\n request.code = wide.curEditor.getValue();\r\n request.nextCmd = \"run\";\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/build',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n beforeSend: function () {\r\n bottomGroup.resetOutput();\r\n \r\n $(\"#buildRun\").addClass(\"ico-stop\")\r\n .removeClass(\"ico-buildrun\").attr(\"title\", config.label.stop);\r\n },\r\n success: function (result) {\r\n }\r\n });\r\n },\r\n // Build.\r\n build: function () {\r\n menu.saveAllFiles();\r\n\r\n var currentPath = editors.getCurrentPath();\r\n if (!currentPath) {\r\n return false;\r\n }\r\n\r\n if ($(\".menu li.build\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.file = currentPath;\r\n request.code = wide.curEditor.getValue();\r\n request.nextCmd = \"\"; // build only, no following operation\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/build',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n beforeSend: function () {\r\n bottomGroup.resetOutput();\r\n },\r\n success: function (result) {\r\n }\r\n });\r\n },\r\n _initPreference: function () {\r\n $(\"#dialogPreference\").load(config.context + '/preference', function () {\r\n $(\"#dialogPreference input\").keyup(function () {\r\n var isChange = false,\r\n emptys = [],\r\n emptysTip = '';\r\n $(\"#dialogPreference input\").each(function () {\r\n var $it = $(this);\r\n // data-value 如为数字,则不会和 value 一样转换为 String,再次不使用全等\r\n if ($it.val() != $it.data(\"value\")) {\r\n isChange = true;\r\n }\r\n\r\n if ($.trim($it.val()) === '') {\r\n emptys.push($it);\r\n }\r\n });\r\n\r\n var $okBtn = $(\"#dialogPreference\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\");\r\n if (isChange) {\r\n $okBtn.prop(\"disabled\", false);\r\n } else {\r\n $okBtn.prop(\"disabled\", true);\r\n }\r\n\r\n if (emptys.length === 0) {\r\n $(\"#dialogPreference\").find(\".tip\").html(\"\");\r\n $okBtn.prop(\"disabled\", false);\r\n } else {\r\n for (var i = 0, max = emptys.length; i < max; i++) {\r\n var tabIndex = emptys[i].closest('div').data(\"index\"),\r\n text = $.trim(emptys[i].parent().text());\r\n emptysTip += '[' + $('#dialogPreference .tabs > div[data-index=\"' + tabIndex + '\"]').text()\r\n + '] -> [' + text.substr(0, text.length - 1)\r\n + ']: ' + config.label.no_empty + \"
    \";\r\n }\r\n $(\"#dialogPreference\").find(\".tip\").html(emptysTip);\r\n $okBtn.prop(\"disabled\", true);\r\n }\r\n });\r\n\r\n $(\"#dialogPreference select\").on(\"change\", function () {\r\n var isChange = false;\r\n $(\"#dialogPreference select\").each(function () {\r\n if ($(this).val() !== $(this).data(\"value\")) {\r\n isChange = true;\r\n }\r\n });\r\n\r\n var $okBtn = $(\"#dialogPreference\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\");\r\n if (isChange) {\r\n $okBtn.prop(\"disabled\", false);\r\n } else {\r\n $okBtn.prop(\"disabled\", true);\r\n }\r\n });\r\n\r\n $(\"#dialogPreference\").dialog({\r\n \"modal\": true,\r\n \"height\": 280,\r\n \"width\": 800,\r\n \"title\": config.label.preference,\r\n \"okText\": config.label.apply,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n var $okBtn = $(\"#dialogPreference\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\");\r\n $okBtn.prop(\"disabled\", true);\r\n },\r\n \"ok\": function () {\r\n var request = newWideRequest(),\r\n $dialogPreference = $(\"#dialogPreference\"),\r\n $fontFamily = $dialogPreference.find(\"input[name=fontFamily]\"),\r\n $fontSize = $dialogPreference.find(\"input[name=fontSize]\"),\r\n $goFmt = $dialogPreference.find(\"select[name=goFmt]\"),\r\n $goBuildArgs = $dialogPreference.find(\"input[name=goBuildArgs]\"),\r\n $workspace = $dialogPreference.find(\"input[name=workspace]\"),\r\n $password = $dialogPreference.find(\"input[name=password]\"),\r\n $email = $dialogPreference.find(\"input[name=email]\"),\r\n $locale = $dialogPreference.find(\"select[name=locale]\"),\r\n $theme = $dialogPreference.find(\"select[name=theme]\"),\r\n $editorFontFamily = $dialogPreference.find(\"input[name=editorFontFamily]\"),\r\n $editorFontSize = $dialogPreference.find(\"input[name=editorFontSize]\"),\r\n $editorLineHeight = $dialogPreference.find(\"input[name=editorLineHeight]\"),\r\n $editorTheme = $dialogPreference.find(\"select[name=editorTheme]\"),\r\n $editorTabSize = $dialogPreference.find(\"input[name=editorTabSize]\"),\r\n $keymap = $dialogPreference.find(\"select[name=keymap]\");\r\n\r\n $.extend(request, {\r\n \"fontFamily\": $fontFamily.val(),\r\n \"fontSize\": $fontSize.val(),\r\n \"goFmt\": $goFmt.val(),\r\n \"goBuildArgs\": $goBuildArgs.val(),\r\n \"workspace\": $workspace.val(),\r\n \"password\": $password.val(),\r\n \"email\": $email.val(),\r\n \"locale\": $locale.val(),\r\n \"theme\": $theme.val(),\r\n \"editorFontFamily\": $editorFontFamily.val(),\r\n \"editorFontSize\": $editorFontSize.val(),\r\n \"editorLineHeight\": $editorLineHeight.val(),\r\n \"editorTheme\": $editorTheme.val(),\r\n \"editorTabSize\": $editorTabSize.val(),\r\n \"keymap\": $keymap.val()\r\n });\r\n\r\n if (config.keymap !== $keymap.val()) {\r\n window.location.reload();\r\n }\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/preference',\r\n data: JSON.stringify(request),\r\n success: function (result, textStatus, jqXHR) {\r\n if (!result.succ) {\r\n return false;\r\n }\r\n\r\n $fontFamily.data(\"value\", $fontFamily.val());\r\n $fontSize.data(\"value\", $fontSize.val());\r\n $goFmt.data(\"value\", $goFmt.val());\r\n $goBuildArgs.data(\"value\", $goBuildArgs.val());\r\n $workspace.data(\"value\", $workspace.val());\r\n $password.data(\"value\", $password.val());\r\n $email.data(\"value\", $email.val());\r\n $locale.data(\"value\", $locale.val());\r\n $theme.data(\"value\", $theme.val());\r\n $editorFontFamily.data(\"value\", $editorFontFamily.val());\r\n $editorFontSize.data(\"value\", $editorFontSize.val());\r\n $editorLineHeight.data(\"value\", $editorLineHeight.val());\r\n $editorTheme.data(\"value\", $editorTheme.val());\r\n $editorTabSize.data(\"value\", $editorTabSize.val());\r\n $keymap.data(\"value\", $keymap.val());\r\n\r\n // update the config\r\n config.keymap = $keymap.val();\r\n\r\n var $okBtn = $(\"#dialogPreference\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\");\r\n $okBtn.prop(\"disabled\", true);\r\n\r\n $(\"#themesLink\").attr(\"href\", config.staticServer + '/static/css/themes/' + $theme.val() + '.css');\r\n\r\n config.editorTheme = $editorTheme.val();\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n editors.data[i].editor.setOption(\"theme\", $editorTheme.val());\r\n }\r\n }\r\n });\r\n }\r\n });\r\n\r\n new Tabs({\r\n id: \".preference\"\r\n });\r\n });\r\n }\r\n};","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file windows.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.1.2.2, Feb 16, 2016\r\n */\r\nvar windows = {\r\n isMaxEditor: false,\r\n outerLayout: {},\r\n innerLayout: {},\r\n init: function () {\r\n if (!config.latestSessionContent) {\r\n config.latestSessionContent = {\r\n \"fileTree\": [],\r\n \"files\": [],\r\n \"currentFile\": \"\",\r\n };\r\n }\r\n \r\n if (!config.latestSessionContent.layout) {\r\n config.latestSessionContent.layout = {\r\n \"side\": {\r\n \"size\": 200,\r\n \"state\": 'normal'\r\n },\r\n \"sideRight\": {\r\n \"size\": 200,\r\n \"state\": 'normal'\r\n },\r\n \"bottom\": {\r\n \"size\": 100,\r\n \"state\": 'normal'\r\n }\r\n };\r\n }\r\n\r\n var layout = config.latestSessionContent.layout;\r\n\r\n this.outerLayout = $('body').layout({\r\n north__paneSelector: \".menu\",\r\n center__paneSelector: \".content\",\r\n south__paneSelector: \".footer\",\r\n north__size: 22,\r\n south__size: 19,\r\n spacing_open: 2,\r\n north__spacing_open: 0,\r\n south__spacing_open: 0,\r\n defaults: {\r\n fxSpeed_open: 300,\r\n fxSpeed_close: 100,\r\n fxSettings_close: {\r\n easing: \"easeOutQuint\"\r\n },\r\n fxSettings_open: {\r\n easing: \"easeInQuint\"\r\n }\r\n },\r\n west: {\r\n size: layout.side.size,\r\n paneSelector: \".side\",\r\n togglerLength_open: 0,\r\n togglerLength_closed: 15,\r\n togglerAlign_closed: \"top\",\r\n slideTrigger_open: \"mouseover\",\r\n spacing_closed: 15,\r\n minSize: 100,\r\n togglerClass: \"ico-restore\",\r\n togglerTip_open: config.label.min,\r\n togglerTip_closed: config.label.restore_side,\r\n resizerTip: config.label.resize,\r\n initClosed: (layout.side.state === 'min')\r\n }\r\n });\r\n\r\n this.innerLayout = $('div.content').layout({\r\n spacing_open: 2,\r\n defaults: {\r\n fxSpeed_open: 300,\r\n fxSpeed_close: 100,\r\n fxSettings_close: {\r\n easing: \"easeOutQuint\"\r\n },\r\n fxSettings_open: {\r\n easing: \"easeInQuint\"\r\n }\r\n },\r\n center: {\r\n paneSelector: \".edit-panel\"\r\n },\r\n east: {\r\n size: layout.sideRight.size,\r\n paneSelector: \".side-right\",\r\n togglerLength_open: 0,\r\n togglerLength_closed: 15,\r\n togglerAlign_closed: \"top\",\r\n slideTrigger_open: \"mouseover\",\r\n spacing_closed: 15,\r\n minSize: 100,\r\n togglerClass: \"ico-restore\",\r\n togglerTip_open: config.label.min,\r\n togglerTip_closed: config.label.restore_outline,\r\n resizerTip: config.label.resize,\r\n initClosed: (layout.sideRight.state === 'min')\r\n },\r\n south: {\r\n size: layout.bottom.size,\r\n paneSelector: \".bottom-window-group\",\r\n togglerLength_open: 0,\r\n togglerLength_closed: 15,\r\n togglerAlign_closed: \"top\",\r\n slideTrigger_open: \"mouseover\",\r\n spacing_closed: 16,\r\n minSize: 100,\r\n togglerClass: \"ico-restore\",\r\n togglerTip_open: config.label.min,\r\n togglerTip_closed: config.label.restore_bottom,\r\n resizerTip: config.label.resize,\r\n initClosed: (layout.bottom.state === 'min'),\r\n ondrag_end: function (type, pane) {\r\n windows.refreshEditor(pane, 'drag');\r\n },\r\n onresize_end: function (type, pane) {\r\n windows.refreshEditor(pane, 'resize');\r\n },\r\n onclose_end: function (type, pane) {\r\n windows.refreshEditor(pane, 'close');\r\n },\r\n onopen_end: function (type, pane) {\r\n windows.refreshEditor(pane, 'open');\r\n },\r\n onshow_end: function (type, pane) {\r\n windows.refreshEditor(pane, 'show');\r\n }\r\n }\r\n });\r\n\r\n this.outerLayout.addCloseBtn(\".side .ico-min\", \"west\");\r\n this.innerLayout.addCloseBtn(\".side-right .ico-min\", \"east\");\r\n this.innerLayout.addCloseBtn(\".bottom-window-group .ico-min\", \"south\");\r\n\r\n if (layout.side.state === 'max') {\r\n windows.maxSide();\r\n }\r\n if (layout.sideRight.state === 'max') {\r\n windows.maxSideRight();\r\n }\r\n if (layout.bottom.state === 'max') {\r\n windows.maxBottom();\r\n }\r\n\r\n $(\".toolbars .ico-max\").click(function () {\r\n windows.toggleEditor();\r\n });\r\n\r\n $(\".edit-panel .tabs\").on(\"dblclick\", function () {\r\n windows.toggleEditor();\r\n });\r\n\r\n $(\".bottom-window-group .tabs\").dblclick(function () {\r\n var $it = $(\".bottom-window-group\");\r\n if ($it.hasClass(\"bottom-window-group-max\")) {\r\n windows.restoreBottom();\r\n } else {\r\n windows.maxBottom($it);\r\n }\r\n });\r\n\r\n $(\".side .tabs\").dblclick(function () {\r\n var $it = $(\".side\");\r\n if ($it.hasClass(\"side-max\")) {\r\n windows.restoreSide();\r\n } else {\r\n windows.restoreSide($it);\r\n }\r\n });\r\n\r\n $(\".side-right .tabs\").dblclick(function () {\r\n var $it = $(\".side-right\");\r\n if ($it.hasClass(\"side-right-max\")) {\r\n windows.restoreSideRight();\r\n } else {\r\n windows.maxSideRight($it);\r\n }\r\n });\r\n\r\n $('.bottom-window-group .search').height($('.bottom-window-group .tabs-panel').height());\r\n $(window).resize(function () {\r\n windows.refreshEditor($('.bottom-window-group'));\r\n });\r\n\r\n },\r\n maxEditor: function () {\r\n var $it = $(\".toolbars .font-ico\");\r\n windows.outerLayout.close('west');\r\n windows.innerLayout.close('south');\r\n windows.innerLayout.close('east');\r\n $it.removeClass('ico-max').addClass('ico-restore').attr('title', config.label.min);\r\n windows.isMaxEditor = true;\r\n },\r\n maxBottom: function ($it) {\r\n $it.data('height', $it.height()).addClass(\"bottom-window-group-max\").find('.ico-min').hide();\r\n windows.outerLayout.hide('west');\r\n windows.innerLayout.hide('east');\r\n windows.innerLayout.sizePane('south', $('.content').height());\r\n },\r\n maxSide: function ($it) {\r\n $it.data('width', $it.width()).addClass(\"side-max\").find('.ico-min').hide();\r\n $('.content').hide();\r\n windows.outerLayout.sizePane('west', $('body').width());\r\n },\r\n maxSideRight: function ($it) {\r\n $it.addClass(\"side-right-max\").data('width', $it.width()).find('.ico-min').hide();\r\n windows.outerLayout.hide('west');\r\n windows.innerLayout.hide('south');\r\n windows.innerLayout.sizePane('east', $('body').width());\r\n },\r\n toggleEditor: function () {\r\n var $it = $(\".toolbars .font-ico\");\r\n if ($it.hasClass('ico-restore')) {\r\n windows.restoreEditor();\r\n } else {\r\n windows.maxEditor();\r\n }\r\n },\r\n restoreBottom: function () {\r\n var $it = $(\".bottom-window-group\");\r\n $it.removeClass(\"bottom-window-group-max\").find('.ico-min').show();\r\n windows.outerLayout.show('west');\r\n windows.innerLayout.show('east');\r\n windows.innerLayout.sizePane('south', $it.data('height'));\r\n },\r\n restoreSide: function () {\r\n var $it = $(\".side\");\r\n $it.removeClass(\"side-max\").find('.ico-min').show();\r\n $('.content').show();\r\n windows.outerLayout.sizePane('west', $it.data('width'));\r\n },\r\n restoreSideRight: function () {\r\n var $it = $(\".side-right\");\r\n $it.removeClass(\"side-right-max\").find('.ico-min').show();\r\n windows.outerLayout.show('west');\r\n windows.innerLayout.show('south');\r\n windows.innerLayout.sizePane('east', $it.data('width'));\r\n },\r\n restoreEditor: function () {\r\n windows.outerLayout.open('west');\r\n windows.innerLayout.open('south');\r\n windows.innerLayout.open('east');\r\n windows.isMaxEditor = false;\r\n $(\".toolbars .font-ico\").addClass('ico-max').removeClass('ico-restore').attr('title', config.label.max_editor);\r\n },\r\n refreshEditor: function (pane, type) {\r\n var editorDatas = editors.data,\r\n height = $('.content').height() - pane.height() - 24;\r\n switch (type) {\r\n case 'close':\r\n height = $('.content').height() - 40;\r\n break;\r\n default:\r\n break;\r\n }\r\n for (var i = 0, ii = editorDatas.length; i < ii; i++) {\r\n editorDatas[i].editor.setSize(\"100%\", height);\r\n }\r\n\r\n $('.bottom-window-group .search').height($('.bottom-window-group .tabs-panel').height());\r\n },\r\n flowBottom: function () {\r\n if (windows.innerLayout.south.state.isClosed) {\r\n windows.innerLayout.slideOpen('south');\r\n }\r\n }\r\n};","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file hotkeys.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.0.0.2, Dec 15, 2015\r\n */\r\nvar hotkeys = {\r\n defaultKeyMap: {\r\n // Ctrl-0\r\n goEditor: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 48,\r\n fun: function () {\r\n if (wide.curEditor) {\r\n wide.curEditor.focus();\r\n }\r\n }\r\n },\r\n // Ctrl-1\r\n goFileTree: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 49,\r\n fun: function () {\r\n // 有些元素需设置 tabindex 为 -1 时才可以 focus\r\n if (windows.outerLayout.west.state.isClosed) {\r\n windows.outerLayout.slideOpen('west');\r\n }\r\n $(\"#files\").focus();\r\n }\r\n },\r\n // Ctrl-2\r\n goOutline: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 50,\r\n fun: function () {\r\n if (windows.innerLayout.east.state.isClosed) {\r\n windows.innerLayout.slideOpen('east');\r\n }\r\n\r\n $(\"#outline\").focus();\r\n }\r\n },\r\n // Ctrl-4\r\n goOutput: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 52,\r\n fun: function () {\r\n bottomGroup.tabs.setCurrent(\"output\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .output\").focus();\r\n }\r\n },\r\n // Ctrl-5\r\n goSearch: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 53,\r\n fun: function () {\r\n bottomGroup.tabs.setCurrent(\"search\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .search\").focus();\r\n }\r\n },\r\n // Ctrl-6\r\n goNotification: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 54,\r\n fun: function () {\r\n bottomGroup.tabs.setCurrent(\"notification\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .notification\").focus();\r\n }\r\n },\r\n // Alt-C\r\n clearWindow: {\r\n ctrlKey: false,\r\n altKey: true,\r\n shiftKey: false,\r\n which: 67\r\n },\r\n // Ctrl-D 窗口组切换 \r\n changeEditor: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 68\r\n },\r\n // Ctrl-F search \r\n search: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 70\r\n },\r\n // Ctrl-Q close current editor \r\n closeCurEditor: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 81\r\n },\r\n // Ctrl-R\r\n rename: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 82\r\n },\r\n // Shift-Alt-O 跳转到文件\r\n goFile: {\r\n ctrlKey: false,\r\n altKey: true,\r\n shiftKey: true,\r\n which: 79\r\n },\r\n // F5 Build\r\n build: {\r\n ctrlKey: false,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 116\r\n },\r\n // F6 Build & Run\r\n buildRun: {\r\n ctrlKey: false,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 117\r\n }\r\n },\r\n bindList: function ($source, $list, enterFun) {\r\n $list.data(\"index\", 0);\r\n $source.keydown(function (event) {\r\n var index = $list.data(\"index\"),\r\n count = $list.find(\"li\").length;\r\n\r\n if (count === 0) {\r\n return true;\r\n }\r\n\r\n if (event.which === 38) { // up\r\n index--;\r\n if (index < 0) {\r\n index = count - 1;\r\n }\r\n }\r\n\r\n if (event.which === 40) { // down\r\n index++;\r\n if (index > count - 1) {\r\n index = 0;\r\n }\r\n }\r\n\r\n var $selected = $list.find(\"li:eq(\" + index + \")\");\r\n\r\n if (event.which === 13) { // enter\r\n enterFun($selected);\r\n }\r\n\r\n $list.find(\"li\").removeClass(\"selected\");\r\n $list.data(\"index\", index);\r\n $selected.addClass(\"selected\");\r\n\r\n if (index === 0) {\r\n $list.scrollTop(0);\r\n } else {\r\n if ($selected[0].offsetTop + $list.scrollTop() > $list.height()) {\r\n if (event.which === 40) {\r\n $list.scrollTop($list.scrollTop() + $selected.height());\r\n } else {\r\n $list.scrollTop($selected[0].offsetTop);\r\n }\r\n } else {\r\n $list.scrollTop(0);\r\n }\r\n }\r\n\r\n // 阻止上下键改变光标位置\r\n if (event.which === 38 || event.which === 40 || event.which === 13) {\r\n return false;\r\n }\r\n });\r\n },\r\n _bindOutput: function () {\r\n $(\".bottom-window-group .output\").keydown(function (event) {\r\n var hotKeys = hotkeys.defaultKeyMap;\r\n if (event.altKey === hotKeys.clearWindow.altKey\r\n && event.which === hotKeys.clearWindow.which) { // Alt-C clear output\r\n bottomGroup.clear('output');\r\n\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n });\r\n },\r\n _bindFileTree: function () {\r\n $(\"#files\").keydown(function (event) {\r\n event.preventDefault();\r\n\r\n var hotKeys = hotkeys.defaultKeyMap;\r\n if (event.ctrlKey === hotKeys.search.ctrlKey\r\n && event.which === hotKeys.search.which) { // Ctrl-F 搜索\r\n $(\"#dialogSearchForm\").dialog(\"open\");\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.rename.ctrlKey\r\n && event.which === hotKeys.rename.which) { // Ctrl-R 重命名\r\n if (wide.curNode.removable) {\r\n $(\"#dialogRenamePrompt\").dialog(\"open\");\r\n }\r\n return;\r\n }\r\n\r\n switch (event.which) {\r\n case 46: // delete\r\n tree.removeIt();\r\n break;\r\n case 13: // enter\r\n if (!wide.curNode) {\r\n return false;\r\n }\r\n\r\n if (tree.isDir()) {\r\n if (wide.curNode.open) {\r\n return false;\r\n }\r\n\r\n tree.fileTree.expandNode(wide.curNode, true, false, true);\r\n $(\"#files\").focus();\r\n\r\n break;\r\n }\r\n\r\n tree.openFile(wide.curNode);\r\n\r\n break;\r\n case 38: // up\r\n var node = {};\r\n\r\n if (!wide.curNode) { // select the first one if no node been selected\r\n node = tree.fileTree.getNodeByTId(\"files_1\");\r\n } else {\r\n if (wide.curNode && wide.curNode.isFirstNode && wide.curNode.level === 0) {\r\n return false;\r\n }\r\n\r\n node = wide.curNode.getPreNode();\r\n if (wide.curNode.isFirstNode && wide.curNode.getParentNode()) {\r\n node = wide.curNode.getParentNode();\r\n }\r\n\r\n var preNode = wide.curNode.getPreNode();\r\n if (preNode && tree.isDir() && preNode.open) {\r\n node = tree.getCurrentNodeLastNode(preNode);\r\n }\r\n }\r\n\r\n wide.curNode = node;\r\n tree.fileTree.selectNode(node);\r\n $(\"#files\").focus();\r\n break;\r\n case 40: // down\r\n var node = {};\r\n\r\n if (!wide.curNode) { // select the first one if no node been selected \r\n node = tree.fileTree.getNodeByTId(\"files_1\");\r\n } else {\r\n if (wide.curNode && tree.isBottomNode(wide.curNode)) {\r\n return false;\r\n }\r\n\r\n node = wide.curNode.getNextNode();\r\n if (tree.isDir() && wide.curNode.open) {\r\n node = wide.curNode.children[0];\r\n }\r\n\r\n var nextShowNode = tree.getNextShowNode(wide.curNode);\r\n if (wide.curNode.isLastNode && wide.curNode.level !== 0 && !wide.curNode.open && nextShowNode) {\r\n node = nextShowNode;\r\n }\r\n }\r\n\r\n if (node) {\r\n wide.curNode = node;\r\n tree.fileTree.selectNode(node);\r\n }\r\n\r\n $(\"#files\").focus();\r\n break;\r\n case 37: // left\r\n if (!wide.curNode) {\r\n wide.curNode = tree.fileTree.getNodeByTId(\"files_1\");\r\n tree.fileTree.selectNode(wide.curNode);\r\n $(\"#files\").focus();\r\n return false;\r\n }\r\n\r\n if (!tree.isDir() || !wide.curNode.open) {\r\n return false;\r\n }\r\n\r\n tree.fileTree.expandNode(wide.curNode, false, false, true);\r\n $(\"#files\").focus();\r\n break;\r\n case 39: // right\r\n if (!wide.curNode) {\r\n wide.curNode = tree.fileTree.getNodeByTId(\"files_1\");\r\n tree.fileTree.selectNode(wide.curNode);\r\n $(\"#files\").focus();\r\n return false;\r\n }\r\n\r\n if (!tree.isDir() || wide.curNode.open) {\r\n return false;\r\n }\r\n\r\n tree.fileTree.expandNode(wide.curNode, true, false, true);\r\n $(\"#files\").focus();\r\n\r\n break;\r\n case 116: // F5\r\n if (!wide.curNode || !tree.isDir()) {\r\n return false;\r\n }\r\n\r\n tree.refresh(wide.curNode);\r\n\r\n break;\r\n }\r\n });\r\n },\r\n _bindDocument: function () {\r\n var hotKeys = this.defaultKeyMap;\r\n $(document).keydown(function (event) {\r\n if (event.ctrlKey === hotKeys.goEditor.ctrlKey\r\n && event.which === hotKeys.goEditor.which) { // Ctrl-0 焦点切换到当前编辑器\r\n hotKeys.goEditor.fun();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.goFileTree.ctrlKey\r\n && event.which === hotKeys.goFileTree.which) { // Ctrl-1 焦点切换到文件树\r\n hotKeys.goFileTree.fun();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.goOutline.ctrlKey\r\n && event.which === hotKeys.goOutline.which) { // Ctrl-2 焦点切换到大纲\r\n hotKeys.goOutline.fun();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.goOutput.ctrlKey\r\n && event.which === hotKeys.goOutput.which) { // Ctrl-4 焦点切换到输出窗口 \r\n hotKeys.goOutput.fun();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.goSearch.ctrlKey\r\n && event.which === hotKeys.goSearch.which) { // Ctrl-5 焦点切换到搜索窗口 \r\n hotKeys.goSearch.fun();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.goNotification.ctrlKey\r\n && event.which === hotKeys.goNotification.which) { // Ctrl-6 焦点切换到通知窗口 \r\n hotKeys.goNotification.fun();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.closeCurEditor.ctrlKey\r\n && event.which === hotKeys.closeCurEditor.which) { // Ctrl-Q 关闭当前编辑器 \r\n $(\".edit-panel .tabs > div.current\").find(\".ico-close\").click();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.changeEditor.ctrlKey\r\n && event.which === hotKeys.changeEditor.which) { // Ctrl-D 窗口组切换\r\n if (document.activeElement.className === \"notification\"\r\n || document.activeElement.className === \"output\"\r\n || document.activeElement.className === \"search\") {\r\n // 焦点在底部窗口组时,对底部进行切换\r\n var tabs = [\"output\", \"search\", \"notification\"],\r\n nextPath = \"\";\r\n for (var i = 0, ii = tabs.length; i < ii; i++) {\r\n if (bottomGroup.tabs.getCurrentId() === tabs[i]) {\r\n if (i < ii - 1) {\r\n nextPath = tabs[i + 1];\r\n } else {\r\n nextPath = tabs[0];\r\n }\r\n break;\r\n }\r\n }\r\n bottomGroup.tabs.setCurrent(nextPath);\r\n $(\".bottom-window-group .\" + nextPath).focus();\r\n\r\n event.preventDefault();\r\n\r\n return false;\r\n }\r\n\r\n if (editors.data.length > 1) {\r\n var nextPath = \"\";\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n var currentId = editors.getCurrentId();\r\n if (currentId) {\r\n if (currentId === editors.data[i].id) {\r\n if (i < ii - 1) {\r\n nextPath = editors.data[i + 1].id;\r\n wide.curEditor = editors.data[i + 1].editor;\r\n } else {\r\n nextPath = editors.data[0].id;\r\n wide.curEditor = editors.data[0].editor;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n editors.tabs.setCurrent(nextPath);\r\n var nextTId = tree.getTIdByPath(nextPath);\r\n wide.curNode = tree.fileTree.getNodeByTId(nextTId);\r\n\r\n tree.fileTree.selectNode(wide.curNode);\r\n wide.refreshOutline();\r\n var cursor = wide.curEditor.getCursor();\r\n $(\".footer .cursor\").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |');\r\n wide.curEditor.focus();\r\n }\r\n\r\n event.preventDefault();\r\n\r\n return false;\r\n }\r\n\r\n if (event.which === hotKeys.build.which) { // F5 Build\r\n menu.build();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.which === hotKeys.buildRun.which) { // F6 Build & Run\r\n menu.run();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.goFile.ctrlKey\r\n && event.altKey === hotKeys.goFile.altKey\r\n && event.shiftKey === hotKeys.goFile.shiftKey\r\n && event.which === hotKeys.goFile.which) { // Shift-Alt-O 跳转到文件\r\n $(\"#dialogGoFilePrompt\").dialog(\"open\");\r\n }\r\n });\r\n },\r\n init: function () {\r\n this._bindFileTree();\r\n this._bindOutput();\r\n this._bindDocument();\r\n }\r\n};","/*\r\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/*\r\n * @file bottomGroup.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.1.1.1, Mar 15, 2017\r\n */\r\nvar bottomGroup = {\r\n tabs: undefined,\r\n searchTab: undefined,\r\n init: function () {\r\n this._initTabs();\r\n this._initFrame();\r\n\r\n $('.bottom-window-group .output').click(function () {\r\n $(this).focus();\r\n });\r\n\r\n $('.bottom-window-group .output').on('click', '.path', function (event) {\r\n var $path = $(this),\r\n tId = tree.getTIdByPath($path.data(\"path\"));\r\n tree.openFile(tree.fileTree.getNodeByTId(tId),\r\n CodeMirror.Pos($path.data(\"line\") - 1, $path.data(\"column\") - 1));\r\n event.preventDefault();\r\n return false;\r\n });\r\n },\r\n _initFrame: function () {\r\n $(\".bottom-window-group .output\").parent().mouseup(function (event) {\r\n event.stopPropagation();\r\n\r\n if (event.button === 0) { // 左键\r\n $(\".bottom-window-group .frame\").hide();\r\n return;\r\n }\r\n\r\n // event.button === 2 右键\r\n var left = event.screenX,\r\n $it = $(this);\r\n if ($(\".side\").css(\"left\") === \"auto\" || $(\".side\").css(\"left\") === \"0px\") {\r\n left = event.screenX - $(\".side\").width();\r\n }\r\n $(\".bottom-window-group .frame\").show().css({\r\n \"left\": left + \"px\",\r\n \"top\": (event.offsetY + event.target.offsetTop - $it.scrollTop() - 10) + \"px\"\r\n });\r\n return;\r\n });\r\n },\r\n clear: function (id) {\r\n $('.bottom-window-group .' + id + ' > div').text('');\r\n },\r\n resetOutput: function () {\r\n this.clear('output');\r\n bottomGroup.tabs.setCurrent(\"output\");\r\n windows.flowBottom();\r\n },\r\n _initTabs: function () {\r\n this.tabs = new Tabs({\r\n id: \".bottom-window-group\",\r\n clickAfter: function (id) {\r\n this._$tabsPanel.find(\".\" + id).focus();\r\n }\r\n });\r\n },\r\n fillOutput: function (data) {\r\n var $output = $('.bottom-window-group .output');\r\n\r\n data = data.replace(/\\r/g, '');\r\n data = data.replace(/\\n/g, '
    ');\r\n\r\n if (-1 !== data.indexOf(\"
    \")) {\r\n data = Autolinker.link(data);\r\n }\r\n\r\n $output.find(\"div\").html(data);\r\n $output.parent().scrollTop($output[0].scrollHeight);\r\n }\r\n};\r\n"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["tabs.js","dialog.js","editors.js","notification.js","tree.js","wide.js","session.js","menu.js","windows.js","hotkeys.js","bottomGroup.js"],"names":["Tabs","obj","_$tabsPanel","$","id","_$tabs","_stack","this","STACKSIZE","_init","_it","each","data","length","splice","push","extend","prototype","_that","on","event","hasClass","setCurrent","clickAfter","parent","isRemove","removeBefore","del","stopPropagation","_hasId","$tabs","find","add","getCurrentId","$tabsPanel","append","title","content","after","stack","prevId","children","remove","i","removeAfter","path","$currentTab","removeClass","hide","addClass","show","setAfter","tId","tree","getTIdByPath","node","fileTree","getNodeByTId","selectNode","wide","curNode","ii","editors","curEditor","editor","cursor","getCursor","setCursor","focus","refreshOutline","text","line","ch","fn","dialog","version","author","dpuuid","Date","getTime","PROP_NAME","Dialog","_defaults","styleClass","background","panel","main","footer","headerMiddle","headerBg","closeIcon","closeIconHover","_attach","target","settings","uuid","inst","_newInst","replace","_getInst","err","_destroyDialog","removeData","prependTo","unwrap","removeAttr","_getDefaults","windowH","window","height","windowW","width","dialogH","parseInt","dialogW","okText","cancelText","footerHTML","headerHTML","hideFooter","hiddenOk","dialogHTML","bgHTML","modal","bgHeight","document","documentElement","scrollHeight","wrap","cloneObj","clone","get","bind","_close","$buttons","undefined","ok","_bindMove","keyup","keyCode","resize","afterInit","className","mousedown","_document","getElementById","x","clientX","style","left","y","clientY","top","ondragstart","onselectstart","onselect","setCapture","captureEvents","Event","MOUSEMOVE","MOUSEUP","onmousemove","positionX","positionY","onmouseup","releaseCapture","css","close","_closeDialog","_openDialog","msg","$dialog","position","afterOpen","_updateDialog","html","defaults","key","theme","styleName","options","otherArgs","Array","slice","call","arguments","shift","apply","concat","jQuery","autocompleteMutex","tabs","getEditorByPath","click","closeOther","currentIndex","firstIndex","_removeAllMarker","removeIndex","_initClose","ZeroClipboard","button","screenX","attr","init","config","label","tip","fileName","file","confirm_save","fmt","doc","isClean","nextId","menu","disabled","cancelSelectedNode","_initCodeMirrorHotKeys","openStartPage","dateFormat","time","date","dateObj","M+","getMonth","d+","getDate","h+","getHours","m+","getMinutes","s+","getSeconds","q+","Math","floor","S","getMilliseconds","test","RegExp","$1","getFullYear","substr","k","start_page","load","context","wideSessionId","ajax","url","type","dataType","jsonp","success","textStatus","articles","listHTML","community","article","articlePermalink","articleTitle","articleCreateTime","ret","getCurrentPath","currentPath","CodeMirror","registerHelper","word","cur","curLine","getLine","start","end","charAt","request","newWideRequest","code","getValue","cursorLine","cursorCh","autocompleteHints","state","completionActive","async","JSON","stringify","autocompleteArray","displayText","name","substring","console","warn","markClean","setTimeout","list","from","Pos","to","commands","autocompleteAfterDot","cm","mode","getMode","Pass","token","getTokenAt","showHint","hint","go","completeSingle","autocompleteAnyWord","auto","gotoLine","doNothing","exprInfo","result","succ","cursorCoords","copyLinesDown","selectoion","listSelections","anchor","head","max","replaceToLine","replaceRange","offset","setSelection","copyLinesUp","moveLinesUp","moveLinesDown","lastLine","jumpToDecl","openFile","findUsages","appendSearch","selectIdentifier","findWordAt","extendSelection","searcHTML","toLowerCase","contents","lowerCaseContents","matches","split","startIndex","endIndex","j","keyWord","search_no_match","$search","find_usages","search_text","bottomGroup","searchTab","$it","half","getScrollInfo","clientHeight","defaultTextHeight","scrollTo","windows","flowBottom","newEditor","iconSkin","undisabled","textArea","value","fromTextArea","lineNumbers","autofocus","autoCloseBrackets","matchBrackets","highlightSelectionMatches","showToken","rulers","color","column","lineStyle","styleActiveLine","editorTheme","tabSize","editorTabSize","indentUnit","indentWithTabs","foldGutter","cursorHeight","readOnly","isGOAPI","profile","extraKeys","Ctrl-\\",".","Ctrl-/","Ctrl-I","Ctrl-L","Ctrl-E","Ctrl-D","Ctrl-B","Ctrl-S","saveFile","Shift-Ctrl-S","saveAllFiles","Shift-Alt-F","Alt-F7","Shift-Alt-Enter","isMaxEditor","restoreEditor","maxEditor","Shift-Ctrl-Up","Shift-Ctrl-Down","Shift-Alt-Up","Shift-Alt-Down","Shift-Alt-J","emmetCodeMirror","$span","evt","altKey","ctrlKey","shiftKey","which","autocomplete","random","setSize","setOption","keymap","notification","_initWS","notificationWS","ReconnectingWebSocket","channel","onopen","log","onmessage","e","parse","$notification","notificationHTML","cmd","severity","message","onclose","onerror","getCurrentNodeLastNode","returnNode","open","getNextShowNode","level","getParentNode","getNextNode","isBottomNode","isLastNode","nodes","transformToArray","getNodes","getOpenPaths","paths","getAllParents","parents","parentTId","isParents","parentPath","parentNode","isDir","indexOf","newFile","it","newDir","removeIt","removable","rename","export","isSucc","crossCompile","platform","decompress","dir","reAsyncChildNodes","refresh","gitClone","import","fileupload","formData","done","fail","$dirRMenu","$fileRMenu","setting","view","showTitle","selectedMulti","enable","autoParam","callback","onDblClick","treeId","treeNode","onRightClick","creatable","display","onClick","clickFlag","zTree","session","restore","_initSearch","_initRename","tempCursor","findModeByFileName","mime","error","$okBtn","closest","prop","trim","val","search","cancel","extension","select","oldPath","newPath","lastIndexOf","curProcessId","outlineHTML","decls","maxj","Ch","Line","Name","dblclick","_initDialog","confirm","create_file","create","fileType","create_dir","goto_file","$list","hotkeys","bindList","$selected","goFileHTML","icoSkin","getClassBySuffix","goto_line","git_clone","repository","outputWS","goLintFound","nextCmd","executable","fillOutput","output","pid","build_n_run","lints","files","lint","lineNo","signal","_initFooter","unbind","subMenu","onbeforeunload","oncontextmenu","_save","getOption","gofmt","beforeSend","resetOutput","stop","run","scrollInfo","setValue","formatted","html_beautify","js_beautify","css_beautify","suffix","ready","getLayoutState","paneState","isClosed","size","setInterval","filse","currentId","currentFile","layout","side","outerLayout","west","sideRight","innerLayout","east","bottom","south","latestSessionContent","nodesToOpen","jj","isOpen","l","expandNode","kk","m","mm","n","nn","c","sessionWS","addNodes","isParent","removeNode","_initPreference","_initAbout","_initShare","hover","pic","urls","email","twitterShare","encodeURIComponent","twitter","facebook","googleplus","weibo","tencent","about","wideVersion","uptodate","new_version_available","colon","wideDownload","mouseover","openPreference","closeAllFiles","exit","location","href","openAbout","goget","goinstall","govet","build","isChange","emptys","emptysTip","tabIndex","no_empty","preference","$dialogPreference","$fontFamily","$fontSize","$goFmt","$goBuildArgsforDarwin","$goBuildArgsforWindows","$GoBuildArgsforLinux","$workspace","$password","$email","$locale","$theme","$editorFontFamily","$editorFontSize","$editorLineHeight","$editorTheme","$editorTabSize","$keymap","fontFamily","fontSize","goFmt","goBuildArgs","workspace","password","locale","editorFontFamily","editorFontSize","editorLineHeight","reload","jqXHR","staticServer","north__paneSelector","center__paneSelector","south__paneSelector","north__size","south__size","spacing_open","north__spacing_open","south__spacing_open","fxSpeed_open","fxSpeed_close","fxSettings_close","easing","fxSettings_open","paneSelector","togglerLength_open","togglerLength_closed","togglerAlign_closed","slideTrigger_open","spacing_closed","minSize","togglerClass","togglerTip_open","min","togglerTip_closed","restore_side","resizerTip","initClosed","center","restore_outline","restore_bottom","ondrag_end","pane","refreshEditor","onresize_end","onclose_end","onopen_end","onshow_end","addCloseBtn","maxSide","maxSideRight","maxBottom","toggleEditor","restoreBottom","restoreSide","restoreSideRight","sizePane","max_editor","editorDatas","slideOpen","defaultKeyMap","goEditor","fun","goFileTree","goOutline","goOutput","goSearch","goNotification","clearWindow","changeEditor","closeCurEditor","goFile","buildRun","$source","enterFun","keydown","index","count","scrollTop","offsetTop","_bindOutput","hotKeys","clear","preventDefault","_bindFileTree","isFirstNode","getPreNode","preNode","nextShowNode","_bindDocument","activeElement","nextPath","nextTId","_initTabs","_initFrame","$path","mouseup","offsetY","$output","Autolinker","link"],"mappings":"AAsBA,GAAIA,MAAO,SAAUC,GACjBA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pI,EAAM2uB,QAAU3uB,EAAMyE,OAAOgpB,UAAYzY,EAAIwY,YAAc,GAAM,UAKrFI,MAAO,SAAU5uB,GACbD,EAAE,yBAA2BC,EAAK,UAAUkE,KAAK,KAErDqf,YAAa,WACTpjB,KAAKyuB,MAAM,UACX9Y,YAAYnK,KAAKzK,WAAW,UAC5BoV,QAAQC,cAEZgZ,UAAW,WACPpvB,KAAKwL,KAAO,GAAI/L,OACZI,GAAI,uBACJmB,WAAY,SAAUnB,GAClBG,KAAKL,YAAY6B,KAAK,IAAM3B,GAAIgE,YAI5Cqe,WAAY,SAAU7hB,GAClB,GAAIovB,GAAU7vB,EAAE,+BAEhBS,GAAOA,EAAKsF,QAAQ,MAAO,IAC3BtF,EAAOA,EAAKsF,QAAQ,MAAO,SAEvB,KAAOtF,EAAKqc,QAAQ,WACpBrc,EAAOqvB,WAAWC,KAAKtvB,IAG3BovB,EAAQjuB,KAAK,OAAOgJ,KAAKnK,GACzBovB,EAAQxuB,SAASotB,UAAUoB,EAAQ,GAAGjoB","file":"wide.min.js","sourcesContent":["/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file tabs.js\r\n *\r\n * @author Liyuan Li\r\n * @version 1.0.0.1, Dec 8, 2015\r\n */\r\nvar Tabs = function (obj) {\r\n obj._$tabsPanel = $(obj.id + \" > .tabs-panel\");\r\n obj._$tabs = $(obj.id + \" > .tabs\");\r\n obj._stack = [];\r\n\r\n this.obj = obj;\r\n this.obj.STACKSIZE = 64;\r\n\r\n this._init(obj);\r\n\r\n // DOM 元素存在时,应顺序入栈\r\n var _it = this;\r\n $(obj.id + \" > .tabs > div\").each(function () {\r\n var id = $(this).data(\"index\");\r\n if (obj._stack.length === _it.obj.STACKSIZE) {\r\n obj._stack.splice(0, 1);\r\n }\r\n if (obj._stack[obj._stack.length - 1] !== id) {\r\n _it.obj._stack.push(id);\r\n }\r\n });\r\n\r\n};\r\n\r\n$.extend(Tabs.prototype, {\r\n _init: function (obj) {\r\n var _that = this;\r\n\r\n obj._$tabs.on(\"click\", \"div\", function (event) {\r\n if ($(this).hasClass('current')) {\r\n return false;\r\n }\r\n\r\n var id = $(this).data(\"index\");\r\n _that.setCurrent(id);\r\n if (typeof (obj.clickAfter) === \"function\") {\r\n obj.clickAfter(id);\r\n }\r\n });\r\n\r\n obj._$tabs.on(\"click\", \".ico-close\", function (event) {\r\n var id = $(this).parent().data(\"index\"),\r\n isRemove = true;\r\n\r\n if (typeof obj.removeBefore === 'function') {\r\n isRemove = obj.removeBefore(id);\r\n }\r\n\r\n if (isRemove) {\r\n _that.del(id);\r\n }\r\n event.stopPropagation();\r\n });\r\n },\r\n _hasId: function (id) {\r\n var $tabs = this.obj._$tabs;\r\n if ($tabs.find('div[data-index=\"' + id + '\"]').length === 0) {\r\n return false;\r\n }\r\n return true;\r\n },\r\n add: function (data) {\r\n // 添加当前 tab\r\n if (this.getCurrentId() === data.id) {\r\n return false;\r\n }\r\n\r\n // 当前 tab 已经存在\r\n if (this._hasId(data.id)) {\r\n this.setCurrent(data.id);\r\n return false;\r\n }\r\n\r\n var $tabsPanel = this.obj._$tabsPanel,\r\n $tabs = this.obj._$tabs;\r\n\r\n $tabs.append('
    '\r\n + data.title + '
    ');\r\n $tabsPanel.append('
    ' + data.content\r\n + '
    ');\r\n\r\n this.setCurrent(data.id);\r\n\r\n if (typeof data.after === 'function') {\r\n data.after();\r\n }\r\n },\r\n del: function (id) {\r\n var $tabsPanel = this.obj._$tabsPanel,\r\n $tabs = this.obj._$tabs,\r\n stack = this.obj._stack,\r\n prevId = null;\r\n\r\n $tabs.children(\"div[data-index='\" + id + \"']\").remove();\r\n $tabsPanel.children(\"div[data-index='\" + id + \"']\").remove();\r\n\r\n // 移除堆栈中该 id\r\n for (var i = 0; i < stack.length; i++) {\r\n if (id === stack[i]) {\r\n stack.splice(i, 1);\r\n i--;\r\n }\r\n }\r\n\r\n prevId = stack[stack.length - 1];\r\n\r\n if (typeof this.obj.removeAfter === 'function') {\r\n this.obj.removeAfter(id, prevId);\r\n }\r\n\r\n this.setCurrent(prevId);\r\n },\r\n getCurrentId: function () {\r\n var $tabs = this.obj._$tabs;\r\n return $tabs.children(\".current\").data(\"index\");\r\n },\r\n setCurrent: function (path) {\r\n if (!path) {\r\n return false;\r\n }\r\n\r\n var $tabsPanel = this.obj._$tabsPanel,\r\n $tabs = this.obj._$tabs;\r\n\r\n var $currentTab = $tabs.children(\".current\");\r\n if ($currentTab.data(\"index\") === path) {\r\n return false;\r\n }\r\n\r\n // tab 顺序入栈,如栈满则清除\r\n var stack = this.obj._stack;\r\n if (stack.length === this.obj.STACKSIZE) {\r\n stack.splice(0, 1);\r\n }\r\n if (stack[stack.length - 1] !== path) {\r\n this.obj._stack.push(path);\r\n }\r\n\r\n $tabs.children(\"div\").removeClass(\"current\");\r\n $tabsPanel.children(\"div\").hide();\r\n\r\n $tabs.children('div[data-index=\"' + path + '\"]').addClass(\"current\");\r\n $tabsPanel.children('div[data-index=\"' + path + '\"]').show();\r\n\r\n if (typeof this.obj.setAfter === 'function') {\r\n this.obj.setAfter();\r\n }\r\n\r\n var id = this.getCurrentId();\r\n if (\"startPage\" === id) {\r\n return;\r\n }\r\n\r\n // set tree node selected\r\n var tId = tree.getTIdByPath(id);\r\n var node = tree.fileTree.getNodeByTId(tId);\r\n tree.fileTree.selectNode(node);\r\n wide.curNode = node;\r\n\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n if (editors.data[i].id === id) {\r\n wide.curEditor = editors.data[i].editor;\r\n break;\r\n }\r\n }\r\n\r\n if (wide.curEditor) {\r\n var cursor = wide.curEditor.getCursor();\r\n wide.curEditor.setCursor(cursor);\r\n wide.curEditor.focus();\r\n wide.refreshOutline();\r\n\r\n $(\".footer .cursor\").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |');\r\n }\r\n }\r\n});","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file dialog.js\r\n *\r\n * @author Liyuan Li\r\n * @version 1.0.0.1, Dec 8, 2015\r\n */\r\n(function ($) {\r\n $.fn.extend({\r\n dialog: {\r\n version: \"0.0.1.7\",\r\n author: \"lly219@gmail.com\"\r\n }\r\n });\r\n\r\n var dpuuid = new Date().getTime();\r\n var PROP_NAME = 'dialog';\r\n\r\n var Dialog = function () {\r\n this._defaults = {\r\n \"styleClass\": {\r\n \"background\": \"dialog-background\",\r\n \"panel\": \"dialog-panel\",\r\n \"main\": \"dialog-main\",\r\n \"footer\": \"dialog-footer\",\r\n \"headerMiddle\": \"dialog-header-middle\",\r\n \"headerBg\": \"dialog-header-bg\",\r\n \"closeIcon\": \"dialog-close-icon\",\r\n \"closeIconHover\": \"dialog-close-icon-hover\",\r\n \"title\": \"dialog-title\"\r\n }\r\n };\r\n };\r\n\r\n $.extend(Dialog.prototype, {\r\n _attach: function (target, settings) {\r\n if (!target.id) {\r\n this.uuid++;\r\n target.id = 'dp' + this.uuid;\r\n }\r\n var inst = this._newInst($(target));\r\n\r\n inst.settings = $.extend({}, settings || {});\r\n $.data(target, PROP_NAME, inst);\r\n this._init(target);\r\n },\r\n /* Create a new instance object. */\r\n _newInst: function (target) {\r\n // escape jQuery meta chars\r\n var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\\\\\$1');\r\n return {\r\n id: id\r\n };\r\n },\r\n _getInst: function (target) {\r\n try {\r\n return $.data(target, PROP_NAME);\r\n } catch (err) {\r\n throw 'Missing instance data for this dialog';\r\n }\r\n },\r\n _destroyDialog: function (target) {\r\n var inst = $.dialog._getInst(target);\r\n var id = inst.id;\r\n $.removeData(target, PROP_NAME);\r\n\r\n $(target).prependTo(\"#\" + id + \"Wrap\").unwrap();\r\n $(target).removeAttr(\"style\");\r\n\r\n var styleClass = this._getDefaults($.dialog._defaults, inst.settings, \"styleClass\");\r\n $(\".\" + styleClass.background).remove();\r\n $(\"#\" + id + \"Dialog\").remove();\r\n },\r\n _init: function (target) {\r\n var inst = this._getInst(target);\r\n var id = inst.id,\r\n settings = inst.settings;\r\n var windowH = $(window).height(),\r\n windowW = $(window).width();\r\n var styleClass = this._getDefaults($.dialog._defaults, settings, \"styleClass\"),\r\n dialogH = settings.height ? settings.height : parseInt(windowH * 0.6),\r\n dialogW = settings.width ? settings.width : parseInt(windowW * 0.6);\r\n\r\n // get settings or default value.\r\n settings.title = settings.title ? settings.title : \"\";\r\n settings.okText = settings.okText ? settings.okText : \"Ok\";\r\n settings.cancelText = settings.cancelText ? settings.cancelText : \"Cancel\";\r\n\r\n // build HTML.\r\n var footerHTML = \"\",\r\n headerHTML = \"
    \"\r\n + settings.title + \"
    \";\r\n\r\n // Sets footerHTML.\r\n if (!settings.hideFooter) {\r\n if (!settings.hiddenOk) {\r\n footerHTML = \"\";\r\n }\r\n footerHTML += \"\";\r\n }\r\n\r\n var dialogHTML = \"
    \" + headerHTML\r\n + \"
    \"\r\n + footerHTML + \"
    \";\r\n\r\n var bgHTML = \"\";\r\n if (settings.modal && $(\".\" + styleClass.background).length === 0) {\r\n var bgHeight = windowH < document.documentElement.scrollHeight\r\n ? document.documentElement.scrollHeight : windowH;\r\n bgHTML = \"
    \";\r\n }\r\n\r\n // Package dialog.\r\n $(\"#\" + id).wrap(\"
    \");\r\n var cloneObj = $(target).clone(true);\r\n $(target).remove();\r\n $('body').append(bgHTML + dialogHTML);\r\n $($(\"#\" + id + \"Dialog .\" + styleClass.main + \" div\").get(0)).append(cloneObj);\r\n $(cloneObj).show();\r\n\r\n // Bind event.\r\n $(\"#\" + id + \"Dialog .\" + styleClass.closeIcon).bind(\"click\", function () {\r\n $.dialog._close(id, settings);\r\n });\r\n\r\n var $buttons = $(\"#\" + id + \"Dialog .\" + styleClass.footer + \" button\");\r\n $($buttons.get(1)).bind(\"click\", function () {\r\n $.dialog._close(id, settings);\r\n });\r\n\r\n $($buttons.get(0)).bind(\"click\", function () {\r\n if (settings.ok === undefined || settings.ok()) {\r\n $.dialog._close(id, settings);\r\n }\r\n });\r\n\r\n this._bindMove(id, styleClass.headerBg, dialogH, dialogW);\r\n\r\n // esc exit\r\n $(window).keyup(function (event) {\r\n if (event.keyCode === 27) {\r\n $.dialog._close(id, settings);\r\n }\r\n });\r\n\r\n $(window).resize(function () {\r\n var height = $(\"body\").height() > $(window).height() ? $(\"body\").height() : $(window).height();\r\n $(\".dialog-background\").height(height);\r\n });\r\n\r\n if (typeof settings.afterInit === \"function\") {\r\n settings.afterInit();\r\n }\r\n },\r\n _bindMove: function (id, className) {\r\n $(\"#\" + id + \"Dialog .\" + className).mousedown(function (event) {\r\n var _document = document;\r\n if (!event) {\r\n event = window.event;\r\n }\r\n var dialog = document.getElementById(id + \"Dialog\");\r\n var x = event.clientX - parseInt(dialog.style.left),\r\n y = event.clientY - parseInt(dialog.style.top);\r\n _document.ondragstart = \"return false;\";\r\n _document.onselectstart = \"return false;\";\r\n _document.onselect = \"document.selection.empty();\";\r\n\r\n if (this.setCapture) {\r\n this.setCapture();\r\n } else if (window.captureEvents) {\r\n window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);\r\n }\r\n\r\n _document.onmousemove = function (event) {\r\n if (!event) {\r\n event = window.event;\r\n }\r\n var positionX = event.clientX - x,\r\n positionY = event.clientY - y;\r\n if (positionX < 0) {\r\n positionX = 0;\r\n }\r\n if (positionX > $(window).width() - $(dialog).width()) {\r\n positionX = $(window).width() - $(dialog).width();\r\n }\r\n if (positionY > $(window).height() - $(dialog).height()) {\r\n positionY = $(window).height() - $(dialog).height();\r\n }\r\n if (positionY < 0) {\r\n positionY = 0;\r\n }\r\n dialog.style.left = positionX + \"px\";\r\n dialog.style.top = positionY + \"px\";\r\n };\r\n\r\n _document.onmouseup = function () {\r\n if (this.releaseCapture) {\r\n this.releaseCapture();\r\n } else if (window.captureEvents) {\r\n window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);\r\n }\r\n _document.onmousemove = null;\r\n _document.onmouseup = null;\r\n _document.ondragstart = null;\r\n _document.onselectstart = null;\r\n _document.onselect = null;\r\n };\r\n });\r\n },\r\n _close: function (id, settings) {\r\n if ($(\"#\" + id + \"Dialog\").css(\"display\") === \"none\") {\r\n return;\r\n }\r\n if (settings.close === undefined || settings.close()) {\r\n $(\"#\" + id + \"Dialog\").hide();\r\n if (settings.modal) {\r\n var styleClass = this._getDefaults($.dialog._defaults, settings, \"styleClass\");\r\n $(\".\" + styleClass.background).hide();\r\n }\r\n }\r\n },\r\n _closeDialog: function (target) {\r\n var inst = this._getInst(target);\r\n var id = inst.id,\r\n settings = inst.settings;\r\n $.dialog._close(id, settings);\r\n },\r\n _openDialog: function (target, msg) {\r\n var inst = this._getInst(target);\r\n var id = inst.id,\r\n settings = inst.settings,\r\n top = \"\", left = \"\",\r\n $dialog = $(\"#\" + id + \"Dialog\"),\r\n windowH = $(window).height(),\r\n windowW = $(window).width(),\r\n dialogH = settings.height ? settings.height : parseInt(windowH * 0.6),\r\n dialogW = settings.width ? settings.width : parseInt(windowW * 0.6);\r\n\r\n // Sets position.\r\n if (settings.position) {\r\n top = settings.position.top;\r\n left = settings.position.left;\r\n } else {\r\n // 20(footer) + 23(header)\r\n top = parseInt((windowH - dialogH - 43) / 2);\r\n if (top < 0) {\r\n top = 0;\r\n }\r\n left = parseInt((windowW - dialogW) / 2);\r\n }\r\n $dialog.css({\r\n \"top\": top + \"px\",\r\n \"left\": left + \"px\"\r\n }).show();\r\n\r\n if (settings.modal) {\r\n var styleClass = this._getDefaults($.dialog._defaults, settings, \"styleClass\");\r\n $(\".\" + styleClass.background).show();\r\n }\r\n\r\n if (typeof settings.afterOpen === \"function\") {\r\n settings.afterOpen(msg);\r\n }\r\n\r\n $(\"#\" + id + \"Dialog .dialog-footer button:eq(0)\").focus();\r\n },\r\n _updateDialog: function (target, data) {\r\n var inst = this._getInst(target);\r\n var id = inst.id,\r\n settings = inst.settings;\r\n var styleClass = this._getDefaults($.dialog._defaults, settings, \"styleClass\");\r\n $.extend(settings, data);\r\n var $dialog = $(\"#\" + id + \"Dialog\");\r\n if (data.position) {\r\n $dialog.css({\r\n \"top\": data.position.top,\r\n \"left\": data.position.left\r\n });\r\n }\r\n\r\n if (data.width) {\r\n $dialog.width(data.width + 26);\r\n $dialog.find(\".\" + styleClass.main + \" div\")[0].style.width = data.width + \"px\";\r\n $dialog.find(\".\" + styleClass.headerBg).width(data.width + 18);\r\n }\r\n\r\n if (data.height) {\r\n $dialog.find(\".\" + styleClass.main + \" div\")[0].style.height = data.height + \"px\";\r\n }\r\n\r\n if (data.title) {\r\n $dialog.find(\".\" + styleClass.title).html(data.title);\r\n }\r\n\r\n if (data.modal !== undefined) {\r\n if (data.modal) {\r\n $(\".\" + styleClass.background).show();\r\n } else {\r\n $(\".\" + styleClass.background).hide();\r\n }\r\n }\r\n\r\n if (data.hideFooter !== undefined) {\r\n if (data.hideFooter) {\r\n $dialog.find(\".\" + styleClass.footer).hide();\r\n } else {\r\n $dialog.find(\".\" + styleClass.footer).show();\r\n }\r\n }\r\n\r\n },\r\n _getDefaults: function (defaults, settings, key) {\r\n if (key === \"styleClass\") {\r\n if (settings.theme === \"default\" || settings.theme === undefined) {\r\n return defaults.styleClass;\r\n }\r\n settings.styleClass = {};\r\n for (var styleName in defaults[key]) {\r\n settings.styleClass[styleName] = settings.theme + \"-\" + defaults.styleClass[styleName];\r\n }\r\n } else if (key === \"height\" || key === \"width\") {\r\n if (settings[key] === null || settings[key] === undefined) {\r\n return \"auto\";\r\n } else {\r\n return settings[key] + \"px\";\r\n }\r\n } else {\r\n if (settings[key] === null || settings[key] === undefined) {\r\n return defaults[key];\r\n }\r\n }\r\n return settings[key];\r\n }\r\n });\r\n\r\n $.fn.dialog = function (options) {\r\n var otherArgs = Array.prototype.slice.call(arguments);\r\n\r\n if (typeof options === 'string') {\r\n otherArgs.shift();\r\n return $.dialog['_' + options + 'Dialog'].apply($.dialog, [this[0]].concat(otherArgs));\r\n }\r\n return this.each(function () {\r\n $.dialog._attach(this, options);\r\n });\r\n };\r\n\r\n $.dialog = new Dialog();\r\n\r\n // Add another global to avoid noConflict issues with inline event handlers\r\n window['DP_jQuery_' + dpuuid] = $;\r\n})(jQuery);","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file editor.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.1.1.0, Jan 12, 2016\r\n */\r\nvar editors = {\r\n autocompleteMutex: false,\r\n data: [],\r\n tabs: {},\r\n getEditorByPath: function (path) {\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n if (editors.data[i].editor.options.path === path) {\r\n return editors.data[i].editor;\r\n }\r\n }\r\n },\r\n close: function () {\r\n $('.edit-panel .tabs > div[data-index=\"' + $('.edit-panel .frame').data('index') + ']').find('.ico-close').click();\r\n },\r\n closeOther: function () {\r\n var currentIndex = $(\".edit-panel .frame\").data(\"index\");\r\n\r\n // 设置全部关闭标识\r\n var removeData = [];\r\n $(\".edit-panel .tabs > div\").each(function (i) {\r\n if (currentIndex !== $(this).data(\"index\")) {\r\n removeData.push($(this).data(\"index\"));\r\n }\r\n });\r\n if (removeData.length === 0) {\r\n return false;\r\n }\r\n var firstIndex = removeData.splice(0, 1);\r\n $(\"#dialogCloseEditor\").data(\"removeData\", removeData);\r\n // 开始关闭\r\n $('.edit-panel .tabs > div[data-index=\"' + firstIndex + '\"]').find(\".ico-close\").click();\r\n },\r\n _removeAllMarker: function () {\r\n var removeData = $(\"#dialogCloseEditor\").data(\"removeData\");\r\n if (removeData && removeData.length > 0) {\r\n var removeIndex = removeData.splice(0, 1);\r\n $(\"#dialogCloseEditor\").data(\"removeData\", removeData);\r\n $('.edit-panel .tabs > div[data-index=\"' + removeIndex + '\"] .ico-close').click();\r\n }\r\n if (wide.curEditor) {\r\n wide.curEditor.focus();\r\n }\r\n },\r\n _initClose: function () {\r\n new ZeroClipboard($(\"#copyFilePath\"));\r\n\r\n // 关闭、关闭其他、关闭所有\r\n $(\".edit-panel\").on(\"mouseup\", '.tabs > div', function (event) {\r\n event.stopPropagation();\r\n\r\n if (event.button === 0) { // 左键\r\n $(\".edit-panel .frame\").hide();\r\n return false;\r\n }\r\n\r\n // event.button === 2 右键\r\n var left = event.screenX;\r\n if ($(\".side\").css(\"left\") === \"auto\" || $(\".side\").css(\"left\") === \"0px\") {\r\n left = event.screenX - $(\".side\").width();\r\n }\r\n $(\".edit-panel .frame\").show().css({\r\n \"left\": left + \"px\",\r\n \"top\": \"21px\"\r\n }).data('index', $(this).data(\"index\"));\r\n\r\n $(\"#copyFilePath\").attr('data-clipboard-text', $(this).find(\"span:eq(0)\").attr(\"title\"));\r\n return false;\r\n });\r\n },\r\n init: function () {\r\n $(\"#dialogCloseEditor\").dialog({\r\n \"modal\": true,\r\n \"height\": 90,\r\n \"width\": 260,\r\n \"title\": config.label.tip,\r\n \"hideFooter\": true,\r\n \"afterOpen\": function (fileName) {\r\n $(\"#dialogCloseEditor > div:eq(0)\").html(config.label.file\r\n + ' ' + fileName + '. ' + config.label.confirm_save + '?');\r\n $(\"#dialogCloseEditor button:eq(0)\").focus();\r\n },\r\n \"afterInit\": function () {\r\n $(\"#dialogCloseEditor button.save\").click(function () {\r\n var i = $(\"#dialogCloseEditor\").data(\"index\");\r\n wide.fmt(editors.data[i].id, editors.data[i].editor);\r\n editors.tabs.del(editors.data[i].id);\r\n $(\"#dialogCloseEditor\").dialog(\"close\");\r\n editors._removeAllMarker();\r\n });\r\n\r\n $(\"#dialogCloseEditor button.discard\").click(function () {\r\n var i = $(\"#dialogCloseEditor\").data(\"index\");\r\n editors.tabs.del(editors.data[i].id);\r\n $(\"#dialogCloseEditor\").dialog(\"close\");\r\n editors._removeAllMarker();\r\n });\r\n\r\n $(\"#dialogCloseEditor button.cancel\").click(function (event) {\r\n $(\"#dialogCloseEditor\").dialog(\"close\");\r\n editors._removeAllMarker();\r\n });\r\n }\r\n });\r\n\r\n editors.tabs = new Tabs({\r\n id: \".edit-panel\",\r\n setAfter: function () {\r\n if (wide.curEditor) {\r\n wide.curEditor.focus();\r\n }\r\n },\r\n clickAfter: function (id) {\r\n if (id === 'startPage') {\r\n wide.curEditor = undefined;\r\n $(\".footer .cursor\").text('');\r\n wide.refreshOutline();\r\n \r\n return false;\r\n }\r\n },\r\n removeBefore: function (id) {\r\n if (id === 'startPage') { // 当前关闭的 tab 是起始页\r\n editors._removeAllMarker();\r\n return true;\r\n }\r\n\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n if (editors.data[i].id === id) {\r\n if (editors.data[i].editor.doc.isClean()) {\r\n editors._removeAllMarker();\r\n return true;\r\n } else {\r\n $(\"#dialogCloseEditor\").dialog(\"open\", $('.edit-panel .tabs > div[data-index=\"'\r\n + editors.data[i].id + '\"] > span:eq(0)').text());\r\n $(\"#dialogCloseEditor\").data(\"index\", i);\r\n return false;\r\n }\r\n\r\n break;\r\n }\r\n }\r\n },\r\n removeAfter: function (id, nextId) {\r\n if ($(\".edit-panel .tabs > div\").length === 0) {\r\n // 全部 tab 都关闭时才 disables 菜单中“全部关闭”的按钮\r\n menu.disabled(['close-all']);\r\n }\r\n\r\n // 移除编辑器\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n if (editors.data[i].id === id) {\r\n editors.data.splice(i, 1);\r\n break;\r\n }\r\n }\r\n\r\n if (editors.data.length === 0) { // 起始页可能存在,所以用编辑器数据判断\r\n menu.disabled(['save-all', 'build', 'run', 'go-test', 'go-vet', 'go-get', 'go-install',\r\n 'find', 'find-next', 'find-previous', 'replace', 'replace-all',\r\n 'format', 'autocomplete', 'jump-to-decl', 'expr-info', 'find-usages', 'toggle-comment',\r\n 'edit']);\r\n\r\n // remove selected tree node\r\n tree.fileTree.cancelSelectedNode();\r\n wide.curNode = undefined;\r\n wide.curEditor = undefined;\r\n wide.refreshOutline();\r\n $(\".footer .cursor\").text('');\r\n return false;\r\n }\r\n\r\n if (!nextId) {\r\n // 编辑器区域不存在打开的 Tab\r\n // remove selected tree node\r\n tree.fileTree.cancelSelectedNode();\r\n wide.curNode = undefined;\r\n wide.curEditor = undefined;\r\n wide.refreshOutline();\r\n $(\".footer .cursor\").text('');\r\n return false;\r\n }\r\n\r\n if (nextId === editors.tabs.getCurrentId()) {\r\n // 关闭的不是当前编辑器\r\n return false;\r\n }\r\n }\r\n });\r\n\r\n this._initCodeMirrorHotKeys();\r\n this.openStartPage();\r\n this._initClose();\r\n },\r\n openStartPage: function () {\r\n wide.curEditor = undefined;\r\n wide.refreshOutline();\r\n $(\".footer .cursor\").text('');\r\n\r\n var dateFormat = function (time, fmt) {\r\n var date = new Date(time);\r\n var dateObj = {\r\n \"M+\": date.getMonth() + 1, //月份 \r\n \"d+\": date.getDate(), //日 \r\n \"h+\": date.getHours(), //小时 \r\n \"m+\": date.getMinutes(), //分 \r\n \"s+\": date.getSeconds(), //秒 \r\n \"q+\": Math.floor((date.getMonth() + 3) / 3), //季度 \r\n \"S\": date.getMilliseconds() //毫秒 \r\n };\r\n if (/(y+)/.test(fmt))\r\n fmt = fmt.replace(RegExp.$1, (date.getFullYear() + \"\").substr(4 - RegExp.$1.length));\r\n for (var k in dateObj)\r\n if (new RegExp(\"(\" + k + \")\").test(fmt)) {\r\n fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1)\r\n ? (dateObj[k]) : ((\"00\" + dateObj[k]).substr((\"\" + dateObj[k]).length)));\r\n }\r\n return fmt;\r\n };\r\n\r\n editors.tabs.add({\r\n id: \"startPage\",\r\n title: ' ' + config.label.start_page + '',\r\n content: '
    ',\r\n after: function () {\r\n $(\"#startPage\").load(config.context + '/start?sid=' + config.wideSessionId);\r\n $.ajax({\r\n url: \"https://hacpai.com/apis/articles?tags=wide,golang&p=1&size=20\",\r\n type: \"GET\",\r\n dataType: \"jsonp\",\r\n jsonp: \"callback\",\r\n success: function (data, textStatus) {\r\n var articles = data.articles;\r\n if (0 === articles.length) {\r\n return;\r\n }\r\n\r\n // 按 size = 20 取,但只保留最多 9 篇\r\n var length = articles.length;\r\n if (length > 9) {\r\n length = 9;\r\n }\r\n\r\n var listHTML = \"
    • \" + config.label.community + \"
    • \";\r\n for (var i = 0; i < length; i++) {\r\n var article = articles[i];\r\n listHTML += \"
    • \"\r\n + \"\"\r\n + article.articleTitle + \"  \"\r\n + dateFormat(article.articleCreateTime, 'yyyy-MM-dd');\r\n +\"
    • \";\r\n }\r\n\r\n $(\"#startPage .news\").html(listHTML + \"
    \");\r\n }\r\n });\r\n }\r\n });\r\n },\r\n getCurrentId: function () {\r\n var ret = editors.tabs.getCurrentId();\r\n if (ret === 'startPage') {\r\n ret = null;\r\n }\r\n \r\n return ret;\r\n },\r\n getCurrentPath: function () {\r\n var currentPath = $(\".edit-panel .tabs .current span:eq(0)\").attr(\"title\");\r\n if (currentPath === config.label.start_page) {\r\n currentPath = null;\r\n }\r\n return currentPath;\r\n },\r\n _initCodeMirrorHotKeys: function () {\r\n CodeMirror.registerHelper(\"hint\", \"go\", function (editor) {\r\n editor = wide.curEditor; // 使用当前编辑器覆盖实参,因为异步调用的原因,实参不一定正确\r\n var word = /[\\w$]+/;\r\n\r\n var cur = editor.getCursor(), curLine = editor.getLine(cur.line);\r\n\r\n var start = cur.ch, end = start;\r\n while (end < curLine.length && word.test(curLine.charAt(end))) {\r\n ++end;\r\n }\r\n while (start && word.test(curLine.charAt(start - 1))) {\r\n --start;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.path = $(\".edit-panel .tabs .current > span:eq(0)\").attr(\"title\");\r\n request.code = editor.getValue();\r\n request.cursorLine = cur.line;\r\n request.cursorCh = cur.ch;\r\n\r\n var autocompleteHints = [];\r\n\r\n if (editors.autocompleteMutex && editor.state.completionActive) {\r\n return;\r\n }\r\n\r\n editors.autocompleteMutex = true;\r\n\r\n $.ajax({\r\n async: false, // 同步执行\r\n type: 'POST',\r\n url: config.context + '/autocomplete',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (data) {\r\n var autocompleteArray = data[1];\r\n\r\n if (autocompleteArray) {\r\n for (var i = 0; i < autocompleteArray.length; i++) {\r\n var displayText = '',\r\n text = autocompleteArray[i].name;\r\n\r\n switch (autocompleteArray[i].class) {\r\n case \"type\":\r\n displayText = ''// + autocompleteArray[i].class \r\n + '' + autocompleteArray[i].name + ' '\r\n + autocompleteArray[i].type + '';\r\n break;\r\n case \"const\":\r\n displayText = ''// + autocompleteArray[i].class \r\n + '' + autocompleteArray[i].name + ' '\r\n + autocompleteArray[i].type + '';\r\n break;\r\n case \"var\":\r\n displayText = ''// + autocompleteArray[i].class \r\n + '' + autocompleteArray[i].name + ' '\r\n + autocompleteArray[i].type + '';\r\n break;\r\n case \"package\":\r\n displayText = ''// + autocompleteArray[i].class \r\n + '' + autocompleteArray[i].name + ' '\r\n + autocompleteArray[i].type + '';\r\n break;\r\n case \"func\":\r\n displayText = ''// + autocompleteArray[i].class \r\n + '' + autocompleteArray[i].name + ''\r\n + autocompleteArray[i].type.substring(4) + '';\r\n text += '()';\r\n break;\r\n default:\r\n console.warn(\"Can't handle autocomplete [\" + autocompleteArray[i].class + \"]\");\r\n break;\r\n }\r\n\r\n autocompleteHints[i] = {\r\n displayText: displayText,\r\n text: text\r\n };\r\n }\r\n }\r\n\r\n editor.doc.markClean();\r\n $(\".edit-panel .tabs .current > span:eq(0)\").removeClass(\"changed\");\r\n }\r\n });\r\n\r\n setTimeout(function () {\r\n editors.autocompleteMutex = false;\r\n }, 20);\r\n\r\n return {list: autocompleteHints, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)};\r\n });\r\n\r\n CodeMirror.commands.autocompleteAfterDot = function (cm) {\r\n var mode = cm.getMode();\r\n if (mode && \"go\" !== mode.name) {\r\n return CodeMirror.Pass;\r\n }\r\n\r\n var token = cm.getTokenAt(cm.getCursor());\r\n\r\n if (\"comment\" === token.type || \"string\" === token.type) {\r\n return CodeMirror.Pass;\r\n }\r\n\r\n setTimeout(function () {\r\n if (!cm.state.completionActive) {\r\n cm.showHint({hint: CodeMirror.hint.go, completeSingle: false});\r\n }\r\n }, 50);\r\n\r\n return CodeMirror.Pass;\r\n };\r\n\r\n CodeMirror.commands.autocompleteAnyWord = function (cm) {\r\n cm.showHint({hint: CodeMirror.hint.auto});\r\n };\r\n\r\n CodeMirror.commands.gotoLine = function (cm) {\r\n $(\"#dialogGoLinePrompt\").dialog(\"open\");\r\n };\r\n\r\n // 用于覆盖 cm 默认绑定的某些快捷键功能.\r\n CodeMirror.commands.doNothing = function (cm) {\r\n };\r\n\r\n CodeMirror.commands.exprInfo = function (cm) {\r\n var cur = wide.curEditor.getCursor();\r\n\r\n var request = newWideRequest();\r\n request.path = $(\".edit-panel .tabs .current > span:eq(0)\").attr(\"title\");\r\n request.code = wide.curEditor.getValue();\r\n request.cursorLine = cur.line;\r\n request.cursorCh = cur.ch;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/exprinfo',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n return;\r\n }\r\n \r\n var position = wide.curEditor.cursorCoords();\r\n $(\"body\").append('
    ' + result.data + '
    ');\r\n }\r\n });\r\n };\r\n\r\n CodeMirror.commands.copyLinesDown = function (cm) {\r\n var content = '',\r\n selectoion = cm.listSelections()[0];\r\n\r\n var from = selectoion.anchor,\r\n to = selectoion.head;\r\n if (from.line > to.line) {\r\n from = selectoion.head;\r\n to = selectoion.anchor;\r\n }\r\n\r\n for (var i = from.line, max = to.line; i <= max; i++) {\r\n if (to.ch !== 0 || i !== max) { // 下一行选中为0时,不应添加内容\r\n content += '\\n' + cm.getLine(i);\r\n }\r\n }\r\n // 下一行选中为0时,应添加到上一行末\r\n var replaceToLine = to.line;\r\n if (to.ch === 0) {\r\n replaceToLine = to.line - 1;\r\n }\r\n cm.replaceRange(content, CodeMirror.Pos(replaceToLine));\r\n\r\n var offset = replaceToLine - from.line + 1;\r\n cm.setSelection(CodeMirror.Pos(from.line + offset, from.ch),\r\n CodeMirror.Pos(to.line + offset, to.ch));\r\n };\r\n\r\n CodeMirror.commands.copyLinesUp = function (cm) {\r\n var content = '',\r\n selectoion = cm.listSelections()[0];\r\n\r\n var from = selectoion.anchor,\r\n to = selectoion.head;\r\n if (from.line > to.line) {\r\n from = selectoion.head;\r\n to = selectoion.anchor;\r\n }\r\n\r\n for (var i = from.line, max = to.line; i <= max; i++) {\r\n if (to.ch !== 0 || i !== max) { // 下一行选中为0时,不应添加内容\r\n content += '\\n' + cm.getLine(i);\r\n }\r\n }\r\n\r\n // 下一行选中为0时,应添加到上一行末\r\n var replaceToLine = to.line;\r\n if (to.ch === 0) {\r\n replaceToLine = to.line - 1;\r\n }\r\n cm.replaceRange(content, CodeMirror.Pos(replaceToLine));\r\n\r\n cm.setSelection(CodeMirror.Pos(from.line, from.ch),\r\n CodeMirror.Pos(to.line, to.ch));\r\n };\r\n\r\n CodeMirror.commands.moveLinesUp = function (cm) {\r\n var selectoion = cm.listSelections()[0];\r\n\r\n var from = selectoion.anchor,\r\n to = selectoion.head;\r\n if (from.line > to.line) {\r\n from = selectoion.head;\r\n to = selectoion.anchor;\r\n }\r\n\r\n if (from.line === 0) {\r\n return false;\r\n }\r\n // 下一行选中为0时,应添加到上一行末\r\n var replaceToLine = to.line;\r\n if (to.ch === 0) {\r\n replaceToLine = to.line - 1;\r\n }\r\n cm.replaceRange('\\n' + cm.getLine(from.line - 1), CodeMirror.Pos(replaceToLine));\r\n if (from.line === 1) {\r\n // 移除第一行的换行\r\n cm.replaceRange('', CodeMirror.Pos(0, 0),\r\n CodeMirror.Pos(1, 0));\r\n } else {\r\n cm.replaceRange('', CodeMirror.Pos(from.line - 2, cm.getLine(from.line - 2).length),\r\n CodeMirror.Pos(from.line - 1, cm.getLine(from.line - 1).length));\r\n }\r\n\r\n cm.setSelection(CodeMirror.Pos(from.line - 1, from.ch),\r\n CodeMirror.Pos(to.line - 1, to.ch));\r\n };\r\n\r\n CodeMirror.commands.moveLinesDown = function (cm) {\r\n var selectoion = cm.listSelections()[0];\r\n\r\n var from = selectoion.anchor,\r\n to = selectoion.head;\r\n if (from.line > to.line) {\r\n from = selectoion.head;\r\n to = selectoion.anchor;\r\n }\r\n\r\n if (to.line === cm.lastLine()) {\r\n return false;\r\n }\r\n\r\n // 下一行选中为0时,应添加到上一行末\r\n var replaceToLine = to.line;\r\n if (to.ch === 0) {\r\n replaceToLine = to.line - 1;\r\n }\r\n // 把选中的下一行添加到选中区域的上一行\r\n if (from.line === 0) {\r\n cm.replaceRange(cm.getLine(replaceToLine + 1) + '\\n', CodeMirror.Pos(0, 0));\r\n } else {\r\n cm.replaceRange('\\n' + cm.getLine(replaceToLine + 1), CodeMirror.Pos(from.line - 1));\r\n }\r\n // 删除选中的下一行\r\n cm.replaceRange('', CodeMirror.Pos(replaceToLine + 1, cm.getLine(replaceToLine + 1).length),\r\n CodeMirror.Pos(replaceToLine + 2, cm.getLine(replaceToLine + 2).length));\r\n\r\n cm.setSelection(CodeMirror.Pos(from.line + 1, from.ch),\r\n CodeMirror.Pos(to.line + 1, to.ch));\r\n };\r\n\r\n CodeMirror.commands.jumpToDecl = function (cm) {\r\n var cur = wide.curEditor.getCursor();\r\n\r\n var request = newWideRequest();\r\n request.path = $(\".edit-panel .tabs .current > span:eq(0)\").attr(\"title\");\r\n request.code = wide.curEditor.getValue();\r\n request.cursorLine = cur.line;\r\n request.cursorCh = cur.ch;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/find/decl',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n return;\r\n }\r\n \r\n var data = result.data;\r\n\r\n var tId = tree.getTIdByPath(data.path);\r\n wide.curNode = tree.fileTree.getNodeByTId(tId);\r\n tree.fileTree.selectNode(wide.curNode);\r\n\r\n tree.openFile(wide.curNode, CodeMirror.Pos(data.cursorLine - 1, data.cursorCh - 1));\r\n }\r\n });\r\n };\r\n\r\n CodeMirror.commands.findUsages = function (cm) {\r\n var cur = wide.curEditor.getCursor();\r\n\r\n var request = newWideRequest();\r\n request.path = $(\".edit-panel .tabs .current > span:eq(0)\").attr(\"title\");\r\n request.code = wide.curEditor.getValue();\r\n request.cursorLine = cur.line;\r\n request.cursorCh = cur.ch;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/find/usages',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n return;\r\n }\r\n\r\n editors.appendSearch(result.data, 'usages', '');\r\n }\r\n });\r\n };\r\n\r\n CodeMirror.commands.selectIdentifier = function (cm) {\r\n var cur = cm.getCursor();\r\n var word = cm.findWordAt(cur);\r\n cm.extendSelection(word.anchor, word.head);\r\n };\r\n },\r\n appendSearch: function (data, type, key) {\r\n var searcHTML = '
      ',\r\n key = key.toLowerCase();\r\n\r\n for (var i = 0, ii = data.length; i < ii; i++) {\r\n var contents = '',\r\n lowerCaseContents = data[i].contents[0].toLowerCase(),\r\n matches = lowerCaseContents.split(key),\r\n startIndex = 0,\r\n endIndex = 0;\r\n for (var j = 0, max = matches.length; j < max; j++) {\r\n startIndex = endIndex + matches[j].length;\r\n endIndex = startIndex + key.length;\r\n var keyWord = data[i].contents[0].substring(startIndex, endIndex);\r\n if (keyWord !== '') {\r\n keyWord = '' + keyWord + '';\r\n }\r\n contents += data[i].contents[0].substring(startIndex - matches[j].length, startIndex) + keyWord;\r\n }\r\n\r\n searcHTML += '
    • '\r\n + contents + \"    \" + data[i].path\r\n + ' (' + data[i].line + ':'\r\n + data[i].ch + ')
    • ';\r\n }\r\n\r\n if (data.length === 0) {\r\n searcHTML += '
    • ' + config.label.search_no_match + '
    • ';\r\n }\r\n searcHTML += '
    ';\r\n\r\n var $search = $('.bottom-window-group .search'),\r\n title = config.label.find_usages;\r\n if (type === \"founds\") {\r\n title = config.label.search_text;\r\n }\r\n if ($search.find(\"ul\").length === 0) {\r\n bottomGroup.searchTab = new Tabs({\r\n id: \".bottom-window-group .search\",\r\n removeAfter: function (id, prevId) {\r\n if ($search.find(\"ul\").length === 1) {\r\n $search.find(\".tabs\").hide();\r\n }\r\n }\r\n });\r\n\r\n $search.on(\"click\", \"li\", function () {\r\n $search.find(\"li\").removeClass(\"selected\");\r\n $(this).addClass(\"selected\");\r\n });\r\n\r\n $search.on(\"dblclick\", \"li\", function () {\r\n var $it = $(this),\r\n tId = tree.getTIdByPath($it.attr(\"title\"));\r\n tree.openFile(tree.fileTree.getNodeByTId(tId));\r\n tree.fileTree.selectNode(wide.curNode);\r\n\r\n var line = $it.find(\".position\").data(\"line\") - 1;\r\n var cursor = CodeMirror.Pos(line, $it.find(\".position\").data(\"ch\") - 1);\r\n\r\n\r\n var editor = wide.curEditor;\r\n editor.setCursor(cursor);\r\n\r\n var half = Math.floor(editor.getScrollInfo().clientHeight / editor.defaultTextHeight() / 2);\r\n var cursorCoords = editor.cursorCoords({line: cursor.line - half, ch: 0}, \"local\");\r\n editor.scrollTo(0, cursorCoords.top);\r\n\r\n wide.curEditor.focus();\r\n });\r\n\r\n $search.find(\".tabs-panel > div\").append(searcHTML);\r\n\r\n $search.find(\".tabs .first\").text(title);\r\n } else {\r\n $search.find(\".tabs\").show();\r\n bottomGroup.searchTab.add({\r\n \"id\": \"search\" + (new Date()).getTime(),\r\n \"title\": title,\r\n \"content\": searcHTML\r\n });\r\n }\r\n\r\n // focus\r\n bottomGroup.tabs.setCurrent(\"search\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .search\").focus();\r\n },\r\n // 新建一个编辑器 Tab,如果已经存在 Tab 则切换到该 Tab.\r\n newEditor: function (data, cursor) {\r\n var id = wide.curNode.id;\r\n\r\n editors.tabs.add({\r\n id: id,\r\n title: '' + wide.curNode.name + '',\r\n content: ''\r\n });\r\n\r\n menu.undisabled(['save-all', 'close-all', 'build', 'run', 'go-test', 'go-vet', 'go-get', 'go-install',\r\n 'find', 'find-next', 'find-previous', 'replace', 'replace-all',\r\n 'format', 'autocomplete', 'jump-to-decl', 'expr-info', 'find-usages', 'toggle-comment',\r\n 'edit']);\r\n\r\n var textArea = document.getElementById(\"editor\" + id);\r\n textArea.value = data.content;\r\n\r\n var editor = CodeMirror.fromTextArea(textArea, {\r\n lineNumbers: true,\r\n autofocus: true,\r\n autoCloseBrackets: true,\r\n matchBrackets: true,\r\n highlightSelectionMatches: {showToken: /\\w/},\r\n rulers: [{color: \"#ccc\", column: 120, lineStyle: \"dashed\"}],\r\n styleActiveLine: true,\r\n theme: config.editorTheme,\r\n tabSize: config.editorTabSize,\r\n indentUnit: 4,\r\n indentWithTabs: true,\r\n foldGutter: true,\r\n cursorHeight: 1,\r\n path: data.path,\r\n readOnly: wide.curNode.isGOAPI,\r\n profile: 'xhtml', // define Emmet output profile\r\n extraKeys: {\r\n \"Ctrl-\\\\\": \"autocompleteAnyWord\",\r\n \".\": \"autocompleteAfterDot\",\r\n \"Ctrl-/\": 'toggleComment',\r\n \"Ctrl-I\": \"exprInfo\",\r\n \"Ctrl-L\": \"gotoLine\",\r\n \"Ctrl-E\": \"deleteLine\",\r\n \"Ctrl-D\": \"doNothing\", // 取消默认的 deleteLine\r\n \"Ctrl-B\": \"jumpToDecl\",\r\n \"Ctrl-S\": function () {\r\n wide.saveFile();\r\n },\r\n \"Shift-Ctrl-S\": function () {\r\n menu.saveAllFiles();\r\n },\r\n \"Shift-Alt-F\": function () {\r\n var currentPath = editors.getCurrentPath();\r\n if (!currentPath) {\r\n return false;\r\n }\r\n wide.fmt(currentPath, wide.curEditor);\r\n },\r\n \"Alt-F7\": \"findUsages\",\r\n \"Shift-Alt-Enter\": function () {\r\n if (windows.isMaxEditor) {\r\n windows.restoreEditor();\r\n } else {\r\n windows.maxEditor();\r\n }\r\n },\r\n \"Shift-Ctrl-Up\": \"copyLinesUp\",\r\n \"Shift-Ctrl-Down\": \"copyLinesDown\",\r\n \"Shift-Alt-Up\": \"moveLinesUp\",\r\n \"Shift-Alt-Down\": \"moveLinesDown\",\r\n \"Shift-Alt-J\": \"selectIdentifier\"\r\n }\r\n });\r\n\r\n if (\"text/html\" === data.mode) {\r\n emmetCodeMirror(editor);\r\n }\r\n\r\n editor.on('cursorActivity', function (cm) {\r\n $(\".edit-exprinfo\").remove();\r\n var cursor = cm.getCursor();\r\n\r\n $(\".footer .cursor\").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |');\r\n });\r\n\r\n editor.on('blur', function (cm) {\r\n $(\".edit-exprinfo\").remove();\r\n });\r\n\r\n editor.on('changes', function (cm) {\r\n if (cm.doc.isClean()) { // no modification\r\n $(\".edit-panel .tabs > div\").each(function () {\r\n var $span = $(this).find(\"span:eq(0)\");\r\n if ($span.attr(\"title\") === cm.options.path) {\r\n $span.removeClass(\"changed\");\r\n }\r\n });\r\n\r\n return;\r\n }\r\n\r\n // changed\r\n\r\n $(\".edit-panel .tabs > div\").each(function () {\r\n var $span = $(this).find(\"span:eq(0)\");\r\n if ($span.attr(\"title\") === cm.options.path) {\r\n $span.addClass(\"changed\");\r\n }\r\n });\r\n });\r\n\r\n editor.on('keydown', function (cm, evt) {\r\n if (evt.altKey || evt.ctrlKey || evt.shiftKey) {\r\n return;\r\n }\r\n\r\n var k = evt.which;\r\n\r\n if (k < 48) {\r\n return;\r\n }\r\n\r\n // hit [0-9]\r\n\r\n if (k > 57 && k < 65) {\r\n return;\r\n }\r\n\r\n // hit [a-z]\r\n\r\n if (k > 90) {\r\n return;\r\n }\r\n\r\n if (config.autocomplete) {\r\n if (0.5 <= Math.random()) {\r\n CodeMirror.commands.autocompleteAfterDot(cm);\r\n }\r\n }\r\n });\r\n\r\n editor.setSize('100%', $(\".edit-panel\").height() - $(\".edit-panel .tabs\").height());\r\n editor.setOption(\"mode\", data.mode);\r\n editor.setOption(\"gutters\", [\"CodeMirror-lint-markers\", \"CodeMirror-foldgutter\"]);\r\n\r\n if (\"wide\" !== config.keymap) {\r\n editor.setOption(\"keyMap\", config.keymap);\r\n }\r\n\r\n if (\"text/x-go\" === data.mode || \"application/json\" === data.mode) {\r\n editor.setOption(\"lint\", true);\r\n }\r\n\r\n if (\"application/xml\" === data.mode || \"text/html\" === data.mode) {\r\n editor.setOption(\"autoCloseTags\", true);\r\n }\r\n\r\n wide.curEditor = editor;\r\n editors.data.push({\r\n \"editor\": editor,\r\n \"id\": id\r\n });\r\n\r\n $(\".footer .cursor\").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |');\r\n\r\n var half = Math.floor(wide.curEditor.getScrollInfo().clientHeight / wide.curEditor.defaultTextHeight() / 2);\r\n var cursorCoords = wide.curEditor.cursorCoords({line: cursor.line - half, ch: 0}, \"local\");\r\n wide.curEditor.scrollTo(0, cursorCoords.top);\r\n\r\n editor.setCursor(cursor);\r\n editor.focus();\r\n }\r\n};","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file notification.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.0.0.1, Dec 8, 2015\r\n */\r\nvar notification = {\r\n init: function () {\r\n $(\".notification-count\").click(function () {\r\n bottomGroup.tabs.setCurrent(\"notification\");\r\n $(\".bottom-window-group .notification\").focus();\r\n $(this).hide();\r\n });\r\n\r\n this._initWS();\r\n },\r\n _initWS: function () {\r\n var notificationWS = new ReconnectingWebSocket(config.channel + '/notification/ws?sid=' + config.wideSessionId);\r\n\r\n notificationWS.onopen = function () {\r\n console.log('[notification onopen] connected');\r\n };\r\n\r\n notificationWS.onmessage = function (e) {\r\n var data = JSON.parse(e.data),\r\n $notification = $('.bottom-window-group .notification > table'),\r\n notificationHTML = '';\r\n \r\n if (data.cmd && \"init-notification\" === data.cmd) {\r\n console.log('[notification onmessage]' + e.data);\r\n \r\n return;\r\n }\r\n\r\n notificationHTML += '' + data.severity\r\n + '' + data.message\r\n + '' + data.type + '';\r\n $notification.append(notificationHTML);\r\n\r\n $(\".notification-count\").show();\r\n };\r\n\r\n notificationWS.onclose = function (e) {\r\n console.log('[notification onclose] disconnected (' + e.code + ')');\r\n };\r\n\r\n notificationWS.onerror = function (e) {\r\n console.log('[notification onerror]');\r\n };\r\n }\r\n};","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file tree.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.0.1.1, Dec 15, 2015\r\n */\r\nvar tree = {\r\n fileTree: undefined,\r\n // 递归获取当前节点展开中的最后一个节点\r\n getCurrentNodeLastNode: function (node) {\r\n var returnNode = node.children[node.children.length - 1];\r\n if (returnNode.open) {\r\n return tree.getCurrentNodeLastNode(returnNode);\r\n } else {\r\n return returnNode;\r\n }\r\n },\r\n // 按照树展现获取下一个节点\r\n getNextShowNode: function (node) {\r\n if (node.level !== 0) {\r\n if (node.getParentNode().getNextNode()) {\r\n return node.getParentNode().getNextNode();\r\n } else {\r\n return tree.getNextShowNode(node.getParentNode());\r\n }\r\n } else {\r\n return node.getNextNode();\r\n }\r\n },\r\n isBottomNode: function (node) {\r\n if (node.open) {\r\n return false;\r\n }\r\n\r\n if (node.getParentNode()) {\r\n if (node.getParentNode().isLastNode) {\r\n return tree.isBottomNode(node.getParentNode());\r\n } else {\r\n return false;\r\n }\r\n } else {\r\n if (node.isLastNode) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n },\r\n getTIdByPath: function (path) {\r\n var nodes = tree.fileTree.transformToArray(tree.fileTree.getNodes());\r\n for (var i = 0, ii = nodes.length; i < ii; i++) {\r\n if (nodes[i].path === path) {\r\n return nodes[i].tId;\r\n }\r\n }\r\n\r\n return undefined;\r\n },\r\n getOpenPaths: function () {\r\n var nodes = tree.fileTree.transformToArray(tree.fileTree.getNodes()),\r\n paths = [];\r\n for (var i = 0, ii = nodes.length; i < ii; i++) {\r\n if (nodes[i].open) {\r\n paths.push(nodes[i].path);\r\n }\r\n }\r\n\r\n return paths;\r\n },\r\n getAllParents: function (node, parents) {\r\n if (!parents) {\r\n parents = [];\r\n }\r\n\r\n if (!node || !node.parentTId) {\r\n return parents;\r\n } else {\r\n parents.push(node.getParentNode());\r\n return tree.getAllParents(node.getParentNode(), parents);\r\n }\r\n },\r\n isParents: function (tId, parentPath) {\r\n var node = tree.fileTree.getNodeByTId(tId);\r\n if (!node || !node.parentTId) {\r\n return false;\r\n } else {\r\n var parentNode = tree.fileTree.getNodeByTId(node.parentTId);\r\n if (node.path === parentPath) {\r\n return true;\r\n } else {\r\n return tree.isParents(parentNode.tId, parentPath);\r\n }\r\n }\r\n },\r\n isDir: function () {\r\n if (wide.curNode.iconSkin.indexOf(\"ico-ztree-dir\") === 0) {\r\n return true;\r\n }\r\n\r\n return false;\r\n },\r\n newFile: function (it) {\r\n if ($(it).hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n $(\"#dialogNewFilePrompt\").dialog(\"open\");\r\n },\r\n newDir: function (it) {\r\n if ($(it).hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n $(\"#dialogNewDirPrompt\").dialog(\"open\");\r\n },\r\n removeIt: function (it) {\r\n if (it) {\r\n if ($(it).hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n } else {\r\n if (!wide.curNode.removable) {\r\n return false;\r\n }\r\n }\r\n\r\n $(\"#dialogRemoveConfirm\").dialog(\"open\");\r\n },\r\n rename: function (it) {\r\n if (it) {\r\n if ($(it).hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n }\r\n\r\n $(\"#dialogRenamePrompt\").dialog(\"open\");\r\n },\r\n export: function () {\r\n var request = newWideRequest(),\r\n isSucc = false;\r\n request.path = wide.curNode.path;\r\n\r\n $.ajax({\r\n async: false,\r\n type: 'POST',\r\n url: config.context + '/file/zip/new',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogAlert\").dialog(\"open\", result.msg);\r\n\r\n return false;\r\n }\r\n\r\n isSucc = true;\r\n }\r\n });\r\n\r\n if (isSucc) {\r\n window.open(config.context + '/file/zip?path=' + wide.curNode.path + \".zip\");\r\n }\r\n },\r\n crossCompile: function (platform) {\r\n var request = newWideRequest();\r\n request.path = wide.curNode.path;\r\n request.platform = platform;\r\n\r\n $.ajax({\r\n async: false,\r\n type: 'POST',\r\n url: config.context + '/cross',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogAlert\").dialog(\"open\", result.msg);\r\n\r\n return false;\r\n }\r\n }\r\n });\r\n },\r\n decompress: function () {\r\n var request = newWideRequest();\r\n request.path = wide.curNode.path;\r\n\r\n $.ajax({\r\n async: false,\r\n type: 'POST',\r\n url: config.context + '/file/decompress',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogAlert\").dialog(\"open\", result.msg);\r\n\r\n return false;\r\n }\r\n\r\n var dir = wide.curNode.getParentNode();\r\n tree.fileTree.reAsyncChildNodes(dir, \"refresh\");\r\n }\r\n });\r\n },\r\n refresh: function (it) {\r\n if (it) {\r\n if ($(it).hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n }\r\n\r\n tree.fileTree.reAsyncChildNodes(wide.curNode, \"refresh\", true);\r\n },\r\n gitClone: function (it) {\r\n if (it) {\r\n if ($(it).hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n }\r\n\r\n $(\"#dialogGitClonePrompt\").dialog('open');\r\n },\r\n import: function () {\r\n var request = newWideRequest();\r\n request.path = wide.curNode.path;\r\n\r\n $('#importFileupload').fileupload({\r\n url: \"/file/upload?path=\" + request.path,\r\n dataType: 'json',\r\n formData: request,\r\n done: function (e, result) {\r\n tree.fileTree.reAsyncChildNodes(wide.curNode, \"refresh\");\r\n },\r\n fail: function () {\r\n console.log(arguments);\r\n }\r\n });\r\n },\r\n init: function () {\r\n $(\"#file\").click(function () {\r\n $(this).focus();\r\n });\r\n\r\n var request = newWideRequest();\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/files',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (result.succ) {\r\n var $dirRMenu = $(\"#dirRMenu\");\r\n var $fileRMenu = $(\"#fileRMenu\");\r\n var setting = {\r\n data: {\r\n key: {\r\n title: \"path\"\r\n }\r\n },\r\n view: {\r\n showTitle: true,\r\n selectedMulti: false\r\n },\r\n async: {\r\n enable: true,\r\n url: config.context + \"/file/refresh\",\r\n autoParam: [\"path\"]\r\n },\r\n callback: {\r\n onDblClick: function (event, treeId, treeNode) {\r\n if (treeNode) {\r\n tree.openFile(treeNode);\r\n }\r\n },\r\n onRightClick: function (event, treeId, treeNode) {\r\n if (treeNode && !treeNode.isGOAPI) {\r\n menu.undisabled(['import', 'export', 'git-clone']);\r\n\r\n wide.curNode = treeNode;\r\n tree.fileTree.selectNode(treeNode);\r\n\r\n if (!tree.isDir()) { // if right click on a file\r\n if (wide.curNode.removable) {\r\n $fileRMenu.find(\".remove\").removeClass(\"disabled\");\r\n } else {\r\n $fileRMenu.find(\".remove\").addClass(\"disabled\");\r\n }\r\n\r\n if (-1 === wide.curNode.path.indexOf(\"zip\", wide.curNode.path.length - \"zip\".length)) { // !path.endsWith(\"zip\")\r\n $fileRMenu.find(\".decompress\").hide();\r\n } else {\r\n $fileRMenu.find(\".decompress\").show();\r\n }\r\n\r\n if (-1 === wide.curNode.path.indexOf(\"go\", wide.curNode.path.length - \"go\".length)) { // !path.endsWith(\"go\")\r\n $fileRMenu.find(\".linux64\").hide();\r\n } else {\r\n $fileRMenu.find(\".linux64\").show();\r\n }\r\n\r\n var top = event.clientY - 10;\r\n if ($fileRMenu.height() + top > $('.content').height()) {\r\n top = top - $fileRMenu.height() - 25;\r\n }\r\n $fileRMenu.css({\r\n \"top\": top + \"px\",\r\n \"left\": event.clientX + \"px\",\r\n \"display\": \"block\"\r\n }).show();\r\n\r\n $dirRMenu.hide();\r\n\r\n menu.disabled(['import', 'git-clone']);\r\n } else { // 右击了目录\r\n if (wide.curNode.removable) {\r\n $dirRMenu.find(\".remove\").removeClass(\"disabled\");\r\n } else {\r\n $dirRMenu.find(\".remove\").addClass(\"disabled\");\r\n }\r\n\r\n if (wide.curNode.creatable) {\r\n $dirRMenu.find(\".create\").removeClass(\"disabled\");\r\n } else {\r\n $dirRMenu.find(\".create\").addClass(\"disabled\");\r\n }\r\n\r\n var top = event.clientY - 10;\r\n if ($dirRMenu.height() + top > $('.content').height()) {\r\n top = top - $dirRMenu.height() - 25;\r\n }\r\n\r\n $dirRMenu.css({\r\n \"top\": top + \"px\",\r\n \"left\": event.clientX + \"px\",\r\n \"display\": \"block\"\r\n }).show();\r\n\r\n $fileRMenu.hide();\r\n }\r\n $(\"#files\").focus();\r\n }\r\n },\r\n onClick: function (event, treeId, treeNode, clickFlag) {\r\n if (treeNode) {\r\n wide.curNode = treeNode;\r\n tree.fileTree.selectNode(treeNode);\r\n\r\n menu.undisabled(['import', 'export', 'git-clone']);\r\n if (!tree.isDir()) {\r\n menu.disabled(['import', 'git-clone']);\r\n }\r\n\r\n $(\"#files\").focus();\r\n }\r\n }\r\n }\r\n };\r\n tree.fileTree = $.fn.zTree.init($(\"#files\"), setting, result.data.children);\r\n\r\n session.restore();\r\n }\r\n }\r\n });\r\n\r\n this._initSearch();\r\n this._initRename();\r\n },\r\n openFile: function (treeNode, cursor) {\r\n wide.curNode = treeNode;\r\n var tempCursor = cursor;\r\n\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n // 该节点文件已经打开\r\n if (editors.data[i].id === treeNode.path) {\r\n editors.tabs.setCurrent(treeNode.path);\r\n wide.curEditor = editors.data[i].editor;\r\n\r\n if (!tempCursor) {\r\n tempCursor = wide.curEditor.getCursor();\r\n }\r\n $(\".footer .cursor\").text('| ' + (tempCursor.line + 1) + ':' + (tempCursor.ch + 1) + ' |');\r\n\r\n wide.curEditor.setCursor(tempCursor);\r\n var half = Math.floor(wide.curEditor.getScrollInfo().clientHeight / wide.curEditor.defaultTextHeight() / 2);\r\n var cursorCoords = wide.curEditor.cursorCoords({line: tempCursor.line - half, ch: 0}, \"local\");\r\n wide.curEditor.scrollTo(0, cursorCoords.top);\r\n wide.curEditor.focus();\r\n\r\n wide.refreshOutline();\r\n return false;\r\n }\r\n }\r\n\r\n if (!tree.isDir()) {\r\n var request = newWideRequest();\r\n request.path = treeNode.path;\r\n\r\n $.ajax({\r\n async: false,\r\n type: 'POST',\r\n url: config.context + '/file',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogAlert\").dialog(\"open\", result.msg);\r\n\r\n return false;\r\n }\r\n\r\n var data = result.data;\r\n\r\n if (!data.mode) {\r\n var mode = CodeMirror.findModeByFileName(treeNode.path);\r\n if (mode) {\r\n data.mode = mode.mime;\r\n } else {\r\n data.mode = 'text/plain';\r\n }\r\n }\r\n\r\n if (!data.mode) {\r\n console.error(\"Can't find mode by file name [\" + treeNode.path + \"]\");\r\n }\r\n\r\n if (\"img\" === data.mode) { // 是图片文件的话新建 tab 打开\r\n // 最好是开 tab,但这个最终取决于浏览器设置\r\n var w = window.open(config.context + data.path);\r\n return false;\r\n }\r\n\r\n if (!tempCursor) {\r\n tempCursor = CodeMirror.Pos(0, 0);\r\n }\r\n\r\n editors.newEditor(data, tempCursor);\r\n\r\n wide.refreshOutline();\r\n }\r\n });\r\n }\r\n },\r\n _initSearch: function () {\r\n $(\"#dialogSearchForm > input:eq(0)\").keyup(function (event) {\r\n var $okBtn = $(this).closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\");\r\n if (event.which === 13 && !$okBtn.prop(\"disabled\")) {\r\n $okBtn.click();\r\n }\r\n\r\n if ($.trim($(this).val()) === \"\") {\r\n $okBtn.prop(\"disabled\", true);\r\n } else {\r\n $okBtn.prop(\"disabled\", false);\r\n }\r\n });\r\n\r\n $(\"#dialogSearchForm > input:eq(1)\").keyup(function (event) {\r\n var $okBtn = $(this).closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\");\r\n if (event.which === 13 && !$okBtn.prop(\"disabled\")) {\r\n $okBtn.click();\r\n }\r\n });\r\n\r\n $(\"#dialogSearchForm\").dialog({\r\n \"modal\": true,\r\n \"height\": 80,\r\n \"width\": 260,\r\n \"title\": config.label.search,\r\n \"okText\": config.label.search,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n $(\"#dialogSearchForm > input:eq(0)\").val('').focus();\r\n $(\"#dialogSearchForm > input:eq(1)\").val('');\r\n $(\"#dialogSearchForm\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\").prop(\"disabled\", true);\r\n },\r\n \"ok\": function () {\r\n var request = newWideRequest();\r\n\r\n if (!wide.curNode) {\r\n request.dir = \"\";\r\n } else {\r\n request.dir = wide.curNode.path;\r\n }\r\n\r\n request.text = $(\"#dialogSearchForm > input:eq(0)\").val();\r\n request.extension = $(\"#dialogSearchForm > input:eq(1)\").val();\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/file/search/text',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n return;\r\n }\r\n\r\n $(\"#dialogSearchForm\").dialog(\"close\");\r\n editors.appendSearch(result.data, 'founds', request.text);\r\n }\r\n });\r\n }\r\n });\r\n },\r\n _initRename: function () {\r\n $(\"#dialogRenamePrompt\").dialog({\r\n \"modal\": true,\r\n \"height\": 52,\r\n \"width\": 260,\r\n \"title\": config.label.rename,\r\n \"okText\": config.label.rename,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n $(\"#dialogRenamePrompt\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\").prop(\"disabled\", true);\r\n $(\"#dialogRenamePrompt > input\").val(wide.curNode.name).select().focus();\r\n },\r\n \"ok\": function () {\r\n var name = $(\"#dialogRenamePrompt > input\").val(),\r\n request = newWideRequest();\r\n\r\n request.oldPath = wide.curNode.path;\r\n request.newPath = wide.curNode.path.substring(0, wide.curNode.path.lastIndexOf(\"/\") + 1) + name;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/file/rename',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogRenamePrompt\").dialog(\"close\");\r\n bottomGroup.tabs.setCurrent(\"notification\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .notification\").focus();\r\n return false;\r\n }\r\n\r\n $(\"#dialogRenamePrompt\").dialog(\"close\");\r\n }\r\n });\r\n }\r\n });\r\n }\r\n};","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file wide.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.0.0.1, Dec 8, 2015\r\n */\r\nvar wide = {\r\n curNode: undefined,\r\n curEditor: undefined,\r\n curProcessId: undefined, // curent running process id (pid)\r\n refreshOutline: function () {\r\n if (!wide.curEditor ||\r\n (wide.curEditor && wide.curEditor.doc.getMode().name !== \"go\")) {\r\n $(\"#outline\").html('');\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.code = wide.curEditor.getValue();\r\n\r\n $.ajax({\r\n type: 'POST',\r\n async: false,\r\n url: config.context + '/outline',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n return;\r\n }\r\n\r\n var data = result.data;\r\n\r\n var outlineHTML = '
      ',\r\n decls = ['constDecls', 'varDecls', 'funcDecls',\r\n 'structDecls', 'interfaceDecls', 'typeDecls'];\r\n\r\n for (var i = 0, max = decls.length; i < max; i++) {\r\n var key = decls[i];\r\n for (var j = 0, maxj = data[key].length; j < maxj; j++) {\r\n var obj = data[key][j];\r\n outlineHTML += '
    • ' + obj.Name + '
    • ';\r\n }\r\n }\r\n $(\"#outline\").html(outlineHTML + '
    ');\r\n\r\n $(\"#outline li\").dblclick(function () {\r\n var $it = $(this),\r\n cursor = CodeMirror.Pos($it.data('line'), $it.data(\"ch\"));\r\n\r\n var editor = wide.curEditor;\r\n editor.setCursor(cursor);\r\n\r\n var half = Math.floor(editor.getScrollInfo().clientHeight / editor.defaultTextHeight() / 2);\r\n var cursorCoords = editor.cursorCoords({line: cursor.line - half, ch: 0}, \"local\");\r\n editor.scrollTo(0, cursorCoords.top);\r\n\r\n editor.focus();\r\n });\r\n }\r\n });\r\n },\r\n _initDialog: function () {\r\n $(\".dialog-prompt > input\").keyup(function (event) {\r\n var $okBtn = $(this).closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\");\r\n if (event.which === 13 && !$okBtn.prop(\"disabled\")) {\r\n $okBtn.click();\r\n }\r\n\r\n if ($.trim($(this).val()) === \"\") {\r\n $okBtn.prop(\"disabled\", true);\r\n } else {\r\n $okBtn.prop(\"disabled\", false);\r\n }\r\n });\r\n\r\n $(\"#dialogAlert\").dialog({\r\n \"modal\": true,\r\n \"height\": 40,\r\n \"width\": 350,\r\n \"title\": config.label.tip,\r\n \"hiddenOk\": true,\r\n \"cancelText\": config.label.confirm,\r\n \"afterOpen\": function (msg) {\r\n $(\"#dialogAlert\").html(msg);\r\n }\r\n });\r\n\r\n $(\"#dialogRemoveConfirm\").dialog({\r\n \"modal\": true,\r\n \"height\": 36,\r\n \"width\": 260,\r\n \"title\": config.label.delete,\r\n \"okText\": config.label.delete,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n $(\"#dialogRemoveConfirm > b\").html('\"' + wide.curNode.name + '\"');\r\n },\r\n \"ok\": function () {\r\n var request = newWideRequest();\r\n request.path = wide.curNode.path;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/file/remove',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogRemoveConfirm\").dialog(\"close\");\r\n bottomGroup.tabs.setCurrent(\"notification\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .notification\").focus();\r\n return false;\r\n }\r\n\r\n $(\"#dialogRemoveConfirm\").dialog(\"close\");\r\n }\r\n });\r\n }\r\n });\r\n\r\n $(\"#dialogNewFilePrompt\").dialog({\r\n \"modal\": true,\r\n \"height\": 52,\r\n \"width\": 260,\r\n \"title\": config.label.create_file,\r\n \"okText\": config.label.create,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n $(\"#dialogNewFilePrompt > input\").val('').focus();\r\n $(\"#dialogNewFilePrompt\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\").prop(\"disabled\", true);\r\n },\r\n \"ok\": function () {\r\n var request = newWideRequest(),\r\n name = $(\"#dialogNewFilePrompt > input\").val();\r\n\r\n request.path = wide.curNode.path + \"/\" + name;\r\n request.fileType = \"f\";\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/file/new',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogNewFilePrompt\").dialog(\"close\");\r\n bottomGroup.tabs.setCurrent(\"notification\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .notification\").focus();\r\n return false;\r\n }\r\n\r\n $(\"#dialogNewFilePrompt\").dialog(\"close\");\r\n\r\n setTimeout(function () { // Delay, waiting the file change notified and then open it\r\n var tId = tree.getTIdByPath(request.path);\r\n tree.openFile(tree.fileTree.getNodeByTId(tId));\r\n tree.fileTree.selectNode(wide.curNode);\r\n }, 100);\r\n }\r\n });\r\n }\r\n });\r\n\r\n $(\"#dialogNewDirPrompt\").dialog({\r\n \"modal\": true,\r\n \"height\": 52,\r\n \"width\": 260,\r\n \"title\": config.label.create_dir,\r\n \"okText\": config.label.create,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n $(\"#dialogNewDirPrompt > input\").val('').focus();\r\n $(\"#dialogNewDirPrompt\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\").prop(\"disabled\", true);\r\n },\r\n \"ok\": function () {\r\n var name = $(\"#dialogNewDirPrompt > input\").val(),\r\n request = newWideRequest();\r\n\r\n request.path = wide.curNode.path + \"/\" + name;\r\n request.fileType = \"d\";\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/file/new',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogNewDirPrompt\").dialog(\"close\");\r\n bottomGroup.tabs.setCurrent(\"notification\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .notification\").focus();\r\n return false;\r\n }\r\n\r\n $(\"#dialogNewDirPrompt\").dialog(\"close\");\r\n }\r\n });\r\n }\r\n });\r\n\r\n $(\"#dialogGoFilePrompt\").dialog({\r\n \"modal\": true,\r\n \"height\": 320,\r\n \"width\": 660,\r\n \"title\": config.label.goto_file,\r\n \"okText\": config.label.go,\r\n \"cancelText\": config.label.cancel,\r\n \"afterInit\": function () {\r\n $(\"#dialogGoFilePrompt\").on(\"dblclick\", \"li\", function () {\r\n var tId = tree.getTIdByPath($(this).find(\".ft-small\").text());\r\n tree.openFile(tree.fileTree.getNodeByTId(tId));\r\n tree.fileTree.selectNode(wide.curNode);\r\n $(\"#dialogGoFilePrompt\").dialog(\"close\");\r\n wide.curEditor.focus();\r\n });\r\n\r\n $(\"#dialogGoFilePrompt\").on(\"click\", \"li\", function () {\r\n var $list = $(\"#dialogGoFilePrompt > .list\");\r\n $list.find(\"li\").removeClass(\"selected\");\r\n $list.data(\"index\", $(this).data(\"index\"));\r\n $(this).addClass(\"selected\");\r\n });\r\n\r\n hotkeys.bindList($(\"#dialogGoFilePrompt > input\"), $(\"#dialogGoFilePrompt > .list\"), function ($selected) {\r\n var tId = tree.getTIdByPath($selected.find(\".ft-small\").text());\r\n tree.openFile(tree.fileTree.getNodeByTId(tId));\r\n tree.fileTree.selectNode(wide.curNode);\r\n $(\"#dialogGoFilePrompt\").dialog(\"close\");\r\n wide.curEditor.focus();\r\n });\r\n\r\n $(\"#dialogGoFilePrompt > input\").bind(\"input\", function () {\r\n var name = $(\"#dialogGoFilePrompt > input\").val();\r\n\r\n var request = newWideRequest();\r\n request.path = '';\r\n request.name = '*' + name + '*';\r\n if (wide.curNode) {\r\n request.path = wide.curNode.path;\r\n }\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/file/find/name',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n return;\r\n }\r\n\r\n var data = result.data;\r\n\r\n var goFileHTML = '';\r\n for (var i = 0, max = data.length; i < max; i++) {\r\n var path = data[i].path,\r\n name = path.substr(path.lastIndexOf(\"/\") + 1),\r\n icoSkin = wide.getClassBySuffix(name.split(\".\")[1]);\r\n if (i === 0) {\r\n goFileHTML += '
  • '\r\n + name + '    '\r\n + path + '
  • ';\r\n } else {\r\n goFileHTML += '
  • '\r\n + name + '    '\r\n + path + '
  • ';\r\n }\r\n }\r\n\r\n $(\"#dialogGoFilePrompt > ul\").html(goFileHTML);\r\n }\r\n });\r\n });\r\n },\r\n \"afterOpen\": function () {\r\n $(\"#dialogGoFilePrompt > input\").val('').focus();\r\n $(\"#dialogGoFilePrompt\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\").prop(\"disabled\", true);\r\n $(\"#dialogGoFilePrompt .list\").html('').data(\"index\", 0);\r\n },\r\n \"ok\": function () {\r\n var tId = tree.getTIdByPath($(\"#dialogGoFilePrompt .selected .ft-small\").text());\r\n tree.openFile(tree.fileTree.getNodeByTId(tId));\r\n tree.fileTree.selectNode(wide.curNode);\r\n $(\"#dialogGoFilePrompt\").dialog(\"close\");\r\n wide.curEditor.focus();\r\n }\r\n });\r\n\r\n $(\"#dialogGoLinePrompt\").dialog({\r\n \"modal\": true,\r\n \"height\": 52,\r\n \"width\": 260,\r\n \"title\": config.label.goto_line,\r\n \"okText\": config.label.go,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n $(\"#dialogGoLinePrompt > input\").val('').focus();\r\n $(\"#dialogGoLinePrompt\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\").prop(\"disabled\", true);\r\n },\r\n \"ok\": function () {\r\n var line = parseInt($(\"#dialogGoLinePrompt > input\").val()) - 1;\r\n $(\"#dialogGoLinePrompt\").dialog(\"close\");\r\n\r\n var editor = wide.curEditor;\r\n var cursor = editor.getCursor();\r\n\r\n editor.setCursor(CodeMirror.Pos(line, cursor.ch));\r\n\r\n var half = Math.floor(editor.getScrollInfo().clientHeight / editor.defaultTextHeight() / 2);\r\n var cursorCoords = editor.cursorCoords({line: line - half, ch: cursor.ch}, \"local\");\r\n editor.scrollTo(0, cursorCoords.top);\r\n\r\n editor.focus();\r\n }\r\n });\r\n\r\n $(\"#dialogGitClonePrompt\").dialog({\r\n \"modal\": true,\r\n \"height\": 52,\r\n \"width\": 360,\r\n \"title\": config.label.git_clone,\r\n \"okText\": config.label.confirm,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n $(\"#dialogGitClonePrompt > input\").val('').focus();\r\n $(\"#dialogGitClonePrompt\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\").prop(\"disabled\", true);\r\n },\r\n \"ok\": function () {\r\n $(\"#dialogGitClonePrompt\").dialog(\"close\");\r\n\r\n var request = newWideRequest();\r\n request.path = wide.curNode.path;\r\n request.repository = $(\"#dialogGitClonePrompt > input\").val();\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/git/clone',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n }\r\n });\r\n }\r\n });\r\n },\r\n _initWS: function () {\r\n var outputWS = new ReconnectingWebSocket(config.channel + '/output/ws?sid=' + config.wideSessionId);\r\n outputWS.onopen = function () {\r\n console.log('[output onopen] connected');\r\n };\r\n\r\n outputWS.onmessage = function (e) {\r\n console.log('[output onmessage]' + e.data);\r\n var data = JSON.parse(e.data);\r\n\r\n if (goLintFound) {\r\n goLintFound = [];\r\n }\r\n\r\n if ('run' === data.nextCmd) {\r\n var request = newWideRequest();\r\n request.executable = data.executable;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/run',\r\n data: JSON.stringify(request),\r\n dataType: \"json\"\r\n });\r\n }\r\n\r\n switch (data.cmd) {\r\n case 'run':\r\n var content = $('.bottom-window-group .output > div').html();\r\n if (!wide.curProcessId || '' === content) {\r\n bottomGroup.fillOutput(content + '
    ' + data.output + '
    ');\r\n } else {\r\n bottomGroup.fillOutput(content.replace(/<\\/pre>$/g, data.output + ''));\r\n }\r\n\r\n wide.curProcessId = data.pid;\r\n\r\n break;\r\n case 'run-done':\r\n bottomGroup.fillOutput($('.bottom-window-group .output > div').html().replace(/<\\/pre>$/g, data.output + ''));\r\n\r\n wide.curProcessId = undefined;\r\n $(\"#buildRun\").removeClass(\"ico-stop\")\r\n .addClass(\"ico-buildrun\").attr(\"title\", config.label.build_n_run);\r\n\r\n break;\r\n case 'start-build':\r\n case 'start-test':\r\n case 'start-vet':\r\n case 'start-install':\r\n case 'start-get':\r\n case 'start-git_clone':\r\n bottomGroup.fillOutput(data.output);\r\n\r\n break;\r\n case 'go test':\r\n case 'go vet':\r\n case 'go install':\r\n case 'go get':\r\n bottomGroup.fillOutput($('.bottom-window-group .output > div').html() + data.output);\r\n\r\n break;\r\n case 'git clone':\r\n bottomGroup.fillOutput($('.bottom-window-group .output > div').html() + data.output);\r\n tree.fileTree.reAsyncChildNodes(wide.curNode, \"refresh\", false);\r\n\r\n break;\r\n case 'build':\r\n case 'cross-build':\r\n bottomGroup.fillOutput($('.bottom-window-group .output > div').html() + data.output);\r\n\r\n if (data.lints) { // has build error\r\n var files = {};\r\n\r\n for (var i = 0; i < data.lints.length; i++) {\r\n var lint = data.lints[i];\r\n\r\n goLintFound.push({from: CodeMirror.Pos(lint.lineNo, 0),\r\n to: CodeMirror.Pos(lint.lineNo, 0),\r\n message: lint.msg, severity: lint.severity});\r\n\r\n files[lint.file] = lint.file;\r\n }\r\n\r\n $(\"#buildRun\").removeClass(\"ico-stop\")\r\n .addClass(\"ico-buildrun\").attr(\"title\", config.label.build_n_run);\r\n\r\n // trigger gutter lint\r\n for (var path in files) {\r\n var editor = editors.getEditorByPath(path);\r\n CodeMirror.signal(editor, \"change\", editor);\r\n }\r\n } else {\r\n if ('cross-build' === data.cmd) {\r\n var request = newWideRequest(),\r\n path = null;\r\n request.path = data.executable;\r\n request.name = data.name;\r\n\r\n $.ajax({\r\n async: false,\r\n type: 'POST',\r\n url: config.context + '/file/zip/new',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (!result.succ) {\r\n $(\"#dialogAlert\").dialog(\"open\", result.msg);\r\n\r\n return false;\r\n }\r\n\r\n path = result.data;\r\n }\r\n });\r\n\r\n if (path) {\r\n window.open(config.context + '/file/zip?path=' + path + \".zip\");\r\n }\r\n }\r\n }\r\n\r\n break;\r\n }\r\n };\r\n outputWS.onclose = function (e) {\r\n console.log('[output onclose] disconnected (' + e.code + ')');\r\n };\r\n outputWS.onerror = function (e) {\r\n console.log('[output onerror]');\r\n };\r\n },\r\n _initFooter: function () {\r\n $(\".footer .cursor\").dblclick(function () {\r\n $(\"#dialogGoLinePrompt\").dialog(\"open\");\r\n });\r\n },\r\n init: function () {\r\n this._initFooter();\r\n\r\n this._initWS();\r\n\r\n // 点击隐藏弹出层\r\n $(\"body\").bind(\"mouseup\", function (event) {\r\n // MAC 右键文件树失效\r\n if (event.which === 3) {\r\n return false;\r\n }\r\n\r\n $(\".frame\").hide();\r\n\r\n if (!($(event.target).closest(\".frame\").length === 1 || event.target.className === \"frame\")) {\r\n $(\".menu > ul > li\").unbind().removeClass(\"selected\");\r\n menu.subMenu();\r\n }\r\n });\r\n\r\n // 刷新提示\r\n window.onbeforeunload = function () {\r\n if (editors.data.length > 0) {\r\n return config.label.confirm_save;\r\n }\r\n };\r\n\r\n // 禁止鼠标右键菜单\r\n document.oncontextmenu = function () {\r\n return false;\r\n };\r\n\r\n this._initDialog();\r\n },\r\n _save: function (path, editor) {\r\n if (!path) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.file = path;\r\n request.code = editor.getValue();\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/file/save',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n // reset the save state\r\n editor.doc.markClean();\r\n $(\".edit-panel .tabs > div\").each(function () {\r\n var $span = $(this).find(\"span:eq(0)\");\r\n if ($span.attr(\"title\") === path) {\r\n $span.removeClass(\"changed\");\r\n }\r\n });\r\n }\r\n });\r\n },\r\n saveFile: function () {\r\n var path = editors.getCurrentPath();\r\n if (!path) {\r\n return false;\r\n }\r\n\r\n var editor = wide.curEditor;\r\n if (editor.doc.isClean()) { // no modification\r\n return false;\r\n }\r\n\r\n if (\"text/x-go\" === editor.getOption(\"mode\")) {\r\n wide.gofmt(path, wide.curEditor); // go fmt will save\r\n\r\n // build the file at once\r\n var request = newWideRequest();\r\n request.file = path;\r\n request.code = editor.getValue();\r\n request.nextCmd = \"\"; // build only, no following operation\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/build',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n beforeSend: function () {\r\n bottomGroup.resetOutput();\r\n },\r\n success: function (result) {\r\n }\r\n });\r\n\r\n // refresh outline\r\n wide.refreshOutline();\r\n\r\n return;\r\n }\r\n\r\n wide._save(path, wide.curEditor);\r\n },\r\n stop: function () {\r\n if ($(\"#buildRun\").hasClass(\"ico-buildrun\")) {\r\n menu.run();\r\n return false;\r\n }\r\n\r\n if (!wide.curProcessId) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.pid = wide.curProcessId;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/stop',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n $(\"#buildRun\").removeClass(\"ico-stop\")\r\n .addClass(\"ico-buildrun\").attr(\"title\", config.label.build_n_run);\r\n }\r\n });\r\n },\r\n gofmt: function (path, editor) {\r\n var cursor = editor.getCursor();\r\n var scrollInfo = editor.getScrollInfo();\r\n\r\n var request = newWideRequest();\r\n request.file = path;\r\n request.code = editor.getValue();\r\n request.cursorLine = cursor.line;\r\n request.cursorCh = cursor.ch;\r\n\r\n $.ajax({\r\n async: false, // sync\r\n type: 'POST',\r\n url: config.context + '/go/fmt',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (result.succ) {\r\n editor.setValue(result.data.code);\r\n editor.setCursor(cursor);\r\n editor.scrollTo(null, scrollInfo.top);\r\n\r\n wide._save(path, editor);\r\n }\r\n }\r\n });\r\n },\r\n fmt: function (path, editor) {\r\n var mode = editor.getOption(\"mode\");\r\n\r\n var cursor = editor.getCursor();\r\n var scrollInfo = editor.getScrollInfo();\r\n\r\n var request = newWideRequest();\r\n request.file = path;\r\n request.code = editor.getValue();\r\n request.cursorLine = cursor.line;\r\n request.cursorCh = cursor.ch;\r\n\r\n var formatted = null;\r\n\r\n switch (mode) {\r\n case \"text/x-go\":\r\n $.ajax({\r\n async: false, // sync\r\n type: 'POST',\r\n url: config.context + '/go/fmt',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (result.succ) {\r\n formatted = result.data.code;\r\n }\r\n }\r\n });\r\n\r\n break;\r\n case \"text/html\":\r\n formatted = html_beautify(editor.getValue());\r\n break;\r\n case \"text/javascript\":\r\n case \"application/json\":\r\n formatted = js_beautify(editor.getValue());\r\n break;\r\n case \"text/css\":\r\n formatted = css_beautify(editor.getValue());\r\n break;\r\n default :\r\n break;\r\n }\r\n\r\n if (formatted) {\r\n editor.setValue(formatted);\r\n editor.setCursor(cursor);\r\n editor.scrollTo(null, scrollInfo.top);\r\n\r\n wide._save(path, editor);\r\n }\r\n },\r\n getClassBySuffix: function (suffix) {\r\n var iconSkin = \"ico-ztree-other \";\r\n switch (suffix) {\r\n case \"html\":\r\n case \"htm\":\r\n iconSkin = \"ico-ztree-html \";\r\n break;\r\n case \"go\":\r\n iconSkin = \"ico-ztree-go \";\r\n break;\r\n case \"css\":\r\n iconSkin = \"ico-ztree-css \";\r\n break;\r\n case \"txt\":\r\n iconSkin = \"ico-ztree-text \";\r\n break;\r\n case \"sql\":\r\n iconSkin = \"ico-ztree-sql \";\r\n break;\r\n case \"properties\":\r\n iconSkin = \"ico-ztree-pro \";\r\n break;\r\n case \"md\":\r\n iconSkin = \"ico-ztree-md \";\r\n break;\r\n case \"js\", \"json\":\r\n iconSkin = \"ico-ztree-js \";\r\n break;\r\n case \"xml\":\r\n iconSkin = \"ico-ztree-xml \";\r\n break;\r\n case \"jpg\":\r\n case \"jpeg\":\r\n case \"bmp\":\r\n case \"gif\":\r\n case \"png\":\r\n case \"svg\":\r\n case \"ico\":\r\n iconSkin = \"ico-ztree-img \";\r\n break;\r\n }\r\n\r\n return iconSkin;\r\n }\r\n};\r\n\r\n$(document).ready(function () {\r\n wide.init();\r\n tree.init();\r\n menu.init();\r\n hotkeys.init();\r\n session.init();\r\n notification.init();\r\n editors.init();\r\n windows.init();\r\n bottomGroup.init();\r\n});\r\n","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file session.js\r\n *\r\n * @author Liyuan Li\r\n * @version 1.1.0.1, Dec 8, 2015\r\n */\r\nvar session = {\r\n init: function () {\r\n this._initWS();\r\n\r\n var getLayoutState = function (paneState) {\r\n var state = 'normal';\r\n if (paneState.isClosed) {\r\n state = 'min';\r\n } else if (paneState.size >= $('body').width()) {\r\n state = 'max';\r\n }\r\n\r\n return state;\r\n };\r\n\r\n // save session content every 30 seconds\r\n setInterval(function () {\r\n var request = newWideRequest(),\r\n filse = [],\r\n fileTree = [],\r\n currentId = editors.getCurrentId(),\r\n currentFile = currentId ? editors.getCurrentPath() : \"\";\r\n\r\n editors.tabs.obj._$tabs.find(\"div\").each(function () {\r\n var $it = $(this);\r\n if ($it.find(\"span:eq(0)\").attr(\"title\") !== config.label.start_page) {\r\n filse.push($it.find(\"span:eq(0)\").attr(\"title\"));\r\n }\r\n });\r\n\r\n fileTree = tree.getOpenPaths();\r\n\r\n request.currentFile = currentFile; // current editor file\r\n request.fileTree = fileTree; // file tree expansion state\r\n request.files = filse; // editor tabs\r\n\r\n\r\n request.layout = {\r\n \"side\": {\r\n \"size\": windows.outerLayout.west.state.size,\r\n \"state\": getLayoutState(windows.outerLayout.west.state)\r\n },\r\n \"sideRight\": {\r\n \"size\": windows.innerLayout.east.state.size,\r\n \"state\": getLayoutState(windows.innerLayout.east.state)\r\n },\r\n \"bottom\": {\r\n \"size\": windows.innerLayout.south.state.size,\r\n \"state\": getLayoutState(windows.innerLayout.south.state)\r\n }\r\n };\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/session/save',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n }\r\n });\r\n }, 30000);\r\n },\r\n restore: function () {\r\n if (!config.latestSessionContent) {\r\n return;\r\n }\r\n\r\n var fileTree = config.latestSessionContent.fileTree,\r\n files = config.latestSessionContent.files,\r\n currentFile = config.latestSessionContent.currentFile,\r\n id = \"\",\r\n nodesToOpen = [];\r\n\r\n var nodes = tree.fileTree.transformToArray(tree.fileTree.getNodes());\r\n\r\n for (var i = 0, ii = nodes.length; i < ii; i++) {\r\n // expand tree\r\n for (var j = 0, jj = fileTree.length; j < jj; j++) {\r\n if (nodes[i].path === fileTree[j]) {\r\n // expand this node only if its parents are open\r\n var parents = tree.getAllParents(tree.fileTree.getNodeByTId(nodes[i].tId)),\r\n isOpen = true;\r\n for (var l = 0, max = parents.length; l < max; l++) {\r\n if (parents[l].open === false) {\r\n isOpen = false;\r\n }\r\n }\r\n if (isOpen) {\r\n tree.fileTree.expandNode(nodes[i], true, false, true);\r\n } else {\r\n // flag it is open\r\n nodes[i].open = true;\r\n }\r\n break;\r\n }\r\n }\r\n\r\n // open editors\r\n for (var k = 0, kk = files.length; k < kk; k++) {\r\n if (nodes[i].path === files[k]) {\r\n nodesToOpen.push(nodes[i]);\r\n break;\r\n }\r\n }\r\n\r\n if (nodes[i].path === currentFile) {\r\n id = nodes[i].path;\r\n\r\n // FIXME: 上面的展开是异步进行的,所以执行到这里的时候可能还没有展开完,导致定位不了可视区域\r\n tree.fileTree.selectNode(nodes[i]);\r\n wide.curNode = nodes[i];\r\n }\r\n }\r\n\r\n // handle the open sequence of editors\r\n for (var m = 0, mm = files.length; m < mm; m++) {\r\n for (var n = 0, nn = nodesToOpen.length; n < nn; n++) {\r\n if (nodesToOpen[n].path === files[m]) {\r\n tree.openFile(nodesToOpen[n]);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // set the current editor\r\n editors.tabs.setCurrent(id);\r\n for (var c = 0, max = editors.data.length; c < max; c++) {\r\n if (id === editors.data[c].id) {\r\n wide.curEditor = editors.data[c].editor;\r\n break;\r\n }\r\n } \r\n },\r\n _initWS: function () {\r\n // Used for session retention, server will release all resources of the session if this channel closed\r\n var sessionWS = new ReconnectingWebSocket(config.channel + '/session/ws?sid=' + config.wideSessionId);\r\n\r\n sessionWS.onopen = function () {\r\n console.log('[session onopen] connected');\r\n\r\n var dateFormat = function (time, fmt) {\r\n var date = new Date(time);\r\n var dateObj = {\r\n \"M+\": date.getMonth() + 1,\r\n \"d+\": date.getDate(),\r\n \"h+\": date.getHours(),\r\n \"m+\": date.getMinutes(),\r\n \"s+\": date.getSeconds(),\r\n \"q+\": Math.floor((date.getMonth() + 3) / 3),\r\n \"S\": date.getMilliseconds()\r\n };\r\n if (/(y+)/.test(fmt))\r\n fmt = fmt.replace(RegExp.$1, (date.getFullYear() + \"\").substr(4 - RegExp.$1.length));\r\n for (var k in dateObj)\r\n if (new RegExp(\"(\" + k + \")\").test(fmt)) {\r\n fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1)\r\n ? (dateObj[k]) : ((\"00\" + dateObj[k]).substr((\"\" + dateObj[k]).length)));\r\n }\r\n return fmt;\r\n };\r\n\r\n var data = {type: \"Network\", severity: \"INFO\",\r\n message: \"Connected to server [sid=\" + config.wideSessionId + \"], \" + dateFormat(new Date().getTime(), 'yyyy-MM-dd hh:mm:ss')},\r\n $notification = $('.bottom-window-group .notification > table'),\r\n notificationHTML = '';\r\n\r\n notificationHTML += '' + data.severity\r\n + '' + data.message\r\n + '' + data.type + '';\r\n $notification.append(notificationHTML);\r\n };\r\n\r\n sessionWS.onmessage = function (e) {\r\n var data = JSON.parse(e.data);\r\n switch (data.cmd) {\r\n case 'create-file':\r\n var node = tree.fileTree.getNodeByTId(tree.getTIdByPath(data.dir)),\r\n name = data.path.replace(data.dir + '/', ''),\r\n mode = CodeMirror.findModeByFileName(name),\r\n iconSkin = wide.getClassBySuffix(name.split(\".\")[1]);\r\n\r\n if (data.type && data.type === 'f') {\r\n tree.fileTree.addNodes(node, [{\r\n \"id\": data.path,\r\n \"name\": name,\r\n \"iconSkin\": iconSkin,\r\n \"path\": data.path,\r\n \"mode\": mode,\r\n \"removable\": true,\r\n \"creatable\": true\r\n }]);\r\n\r\n } else {\r\n tree.fileTree.addNodes(node, [{\r\n \"id\": data.path,\r\n \"name\": name,\r\n \"iconSkin\": \"ico-ztree-dir \",\r\n \"path\": data.path,\r\n \"removable\": true,\r\n \"creatable\": true,\r\n \"isParent\": true\r\n }]);\r\n }\r\n break;\r\n case 'remove-file':\r\n case 'rename-file':\r\n var node = tree.fileTree.getNodeByTId(tree.getTIdByPath(data.path));\r\n tree.fileTree.removeNode(node);\r\n\r\n var nodes = tree.fileTree.transformToArray(node);\r\n for (var i = 0, ii = nodes.length; i < ii; i++) {\r\n editors.tabs.del(nodes[i].path);\r\n }\r\n\r\n break;\r\n }\r\n };\r\n sessionWS.onclose = function (e) {\r\n console.log('[session onclose] disconnected (' + e.code + ')');\r\n\r\n var data = {type: \"Network\", severity: \"ERROR\",\r\n message: \"Disconnected from server, trying to reconnect it [sid=\" + config.wideSessionId + \"]\"},\r\n $notification = $('.bottom-window-group .notification > table'),\r\n notificationHTML = '';\r\n\r\n notificationHTML += '' + data.severity\r\n + '' + data.message\r\n + '' + data.type + '';\r\n $notification.append(notificationHTML);\r\n\r\n $(\".notification-count\").show();\r\n };\r\n sessionWS.onerror = function (e) {\r\n console.log('[session onerror]');\r\n };\r\n }\r\n};","/*\r\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/*\r\n * @file menu.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.0.1.1, Mar 15, 2017\r\n */\r\nvar menu = {\r\n init: function () {\r\n this.subMenu();\r\n this._initPreference();\r\n this._initAbout();\r\n this._initShare();\r\n\r\n // 点击子菜单后消失\r\n $(\".menu .frame li\").click(function () {\r\n $(\".menu > ul > li\").unbind().removeClass(\"selected\");\r\n menu.subMenu();\r\n });\r\n },\r\n _initShare: function () {\r\n $(\".menu .ico-share\").hover(function () {\r\n $(\".menu .share-panel\").show();\r\n });\r\n\r\n $(\".share-panel .font-ico\").click(function () {\r\n var key = $(this).attr('class').split('-')[2];\r\n var url = \"https://wide.b3log.org\", pic = 'https://wide.b3log.org/static/images/wide-logo.png';\r\n var urls = {};\r\n urls.email = \"mailto:?subject=\" + $('title').text()\r\n + \"&body=\" + $('meta[name=description]').attr('content') + ' ' + url;\r\n\r\n var twitterShare = encodeURIComponent($('meta[name=description]').attr('content') + \" \" + url + \" #golang\");\r\n urls.twitter = \"https://twitter.com/intent/tweet?status=\" + twitterShare;\r\n\r\n urls.facebook = \"https://www.facebook.com/sharer/sharer.php?u=\" + url;\r\n urls.googleplus = \"https://plus.google.com/share?url=\" + url;\r\n\r\n var title = encodeURIComponent($('title').text() + '. \\n' + $('meta[name=description]').attr('content')\r\n + \" #golang#\");\r\n urls.weibo = \"http://v.t.sina.com.cn/share/share.php?title=\" + title + \"&url=\" + url + \"&pic=\" + pic;\r\n urls.tencent = \"http://share.v.t.qq.com/index.php?c=share&a=index&title=\" + title +\r\n \"&url=\" + url + \"&pic=\" + pic;\r\n\r\n window.open(urls[key], \"_blank\", \"top=100,left=200,width=648,height=618\");\r\n });\r\n },\r\n _initAbout: function () {\r\n $(\"#dialogAbout\").load(config.context + '/about', function () {\r\n $(\"#dialogAbout\").dialog({\r\n \"modal\": true,\r\n \"title\": config.label.about,\r\n \"hideFooter\": true,\r\n \"afterOpen\": function () {\r\n $.ajax({\r\n url: \"https://rhythm.b3log.org/version/wide/latest\",\r\n type: \"GET\",\r\n dataType: \"jsonp\",\r\n jsonp: \"callback\",\r\n success: function (data, textStatus) {\r\n if ($(\"#dialogAbout .version\").text() === data.wideVersion) {\r\n $(\".upgrade\").text(config.label.uptodate);\r\n } else {\r\n $(\".upgrade\").html(config.label.new_version_available + config.label.colon\r\n + \"\" + data.wideVersion + \"\");\r\n }\r\n }\r\n });\r\n }\r\n });\r\n });\r\n },\r\n disabled: function (list) {\r\n for (var i = 0, max = list.length; i < max; i++) {\r\n $(\".menu li.\" + list[i]).addClass(\"disabled\");\r\n }\r\n },\r\n undisabled: function (list) {\r\n for (var i = 0, max = list.length; i < max; i++) {\r\n $(\".menu li.\" + list[i]).removeClass(\"disabled\");\r\n }\r\n },\r\n // 焦点不在菜单上时需点击展开子菜单,否则为鼠标移动展开\r\n subMenu: function () {\r\n $(\".menu > ul > li\").click(function (event) {\r\n if ($(event.target).closest(\".frame\").length === 1) {\r\n return;\r\n }\r\n var $it = $(this);\r\n $it.find('.frame').show();\r\n $(\".menu > ul > li\").removeClass(\"selected\");\r\n $(this).addClass(\"selected\");\r\n\r\n $(\".menu > ul > li\").unbind();\r\n\r\n $(\".menu > ul > li\").mouseover(function () {\r\n if ($(event.target).closest(\".frame\").length === 1) {\r\n return;\r\n }\r\n $(\".menu .frame\").hide();\r\n $(this).find('.frame').show();\r\n $(\".menu > ul > li\").removeClass(\"selected\");\r\n $(this).addClass(\"selected\");\r\n });\r\n });\r\n },\r\n openPreference: function () {\r\n $(\"#dialogPreference\").dialog(\"open\");\r\n },\r\n saveAllFiles: function () {\r\n if ($(\".menu li.save-all\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n var path = editors.data[i].id;\r\n var editor = editors.data[i].editor;\r\n\r\n if (\"text/x-go\" === editor.getOption(\"mode\")) {\r\n wide.fmt(path, editor);\r\n } else {\r\n wide._save(path, editor);\r\n }\r\n }\r\n },\r\n closeAllFiles: function () {\r\n if ($(\".menu li.close-all\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n // 设置全部关闭标识\r\n var removeData = [];\r\n $(\".edit-panel .tabs > div\").each(function (i) {\r\n if (i !== 0) {\r\n removeData.push($(this).data(\"index\"));\r\n }\r\n });\r\n $(\"#dialogCloseEditor\").data(\"removeData\", removeData);\r\n // 开始关闭\r\n $(\".edit-panel .tabs .ico-close:eq(0)\").click();\r\n },\r\n exit: function () {\r\n var request = newWideRequest();\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/logout',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n success: function (result) {\r\n if (result.succ) {\r\n window.location.href = config.context + \"/login\";\r\n }\r\n }\r\n });\r\n },\r\n openAbout: function () {\r\n $(\"#dialogAbout\").dialog(\"open\");\r\n },\r\n goget: function () {\r\n menu.saveAllFiles();\r\n\r\n var currentPath = editors.getCurrentPath();\r\n if (!currentPath) {\r\n return false;\r\n }\r\n\r\n if ($(\".menu li.go-get\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.file = currentPath;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/go/get',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n beforeSend: function () {\r\n bottomGroup.resetOutput();\r\n },\r\n success: function (result) {\r\n }\r\n });\r\n },\r\n goinstall: function () {\r\n menu.saveAllFiles();\r\n\r\n var currentPath = editors.getCurrentPath();\r\n if (!currentPath) {\r\n return false;\r\n }\r\n\r\n if ($(\".menu li.go-install\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.file = currentPath;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/go/install',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n beforeSend: function () {\r\n bottomGroup.resetOutput();\r\n },\r\n success: function (result) {\r\n }\r\n });\r\n },\r\n // go test.\r\n test: function () {\r\n menu.saveAllFiles();\r\n\r\n var currentPath = editors.getCurrentPath();\r\n if (!currentPath) {\r\n return false;\r\n }\r\n\r\n if ($(\".menu li.go-test\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.file = currentPath;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/go/test',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n beforeSend: function () {\r\n bottomGroup.resetOutput();\r\n },\r\n success: function (result) {\r\n }\r\n });\r\n },\r\n // go vet.\r\n govet: function () {\r\n menu.saveAllFiles();\r\n\r\n var currentPath = editors.getCurrentPath();\r\n if (!currentPath) {\r\n return false;\r\n }\r\n\r\n if ($(\".menu li.go-vet\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.file = currentPath;\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/go/vet',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n beforeSend: function () {\r\n bottomGroup.resetOutput();\r\n },\r\n success: function (result) {\r\n }\r\n });\r\n },\r\n // Build & Run.\r\n run: function () {\r\n menu.saveAllFiles();\r\n\r\n if ($(\"#buildRun\").hasClass(\"ico-stop\")) {\r\n wide.stop();\r\n return false;\r\n }\r\n\r\n var currentPath = editors.getCurrentPath();\r\n if (!currentPath) {\r\n return false;\r\n }\r\n\r\n if ($(\".menu li.run\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.file = currentPath;\r\n request.code = wide.curEditor.getValue();\r\n request.nextCmd = \"run\";\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/build',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n beforeSend: function () {\r\n bottomGroup.resetOutput();\r\n \r\n $(\"#buildRun\").addClass(\"ico-stop\")\r\n .removeClass(\"ico-buildrun\").attr(\"title\", config.label.stop);\r\n },\r\n success: function (result) {\r\n }\r\n });\r\n },\r\n // Build.\r\n build: function () {\r\n menu.saveAllFiles();\r\n\r\n var currentPath = editors.getCurrentPath();\r\n if (!currentPath) {\r\n return false;\r\n }\r\n\r\n if ($(\".menu li.build\").hasClass(\"disabled\")) {\r\n return false;\r\n }\r\n\r\n var request = newWideRequest();\r\n request.file = currentPath;\r\n request.code = wide.curEditor.getValue();\r\n request.nextCmd = \"\"; // build only, no following operation\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/build',\r\n data: JSON.stringify(request),\r\n dataType: \"json\",\r\n beforeSend: function () {\r\n bottomGroup.resetOutput();\r\n },\r\n success: function (result) {\r\n }\r\n });\r\n },\r\n _initPreference: function () {\r\n $(\"#dialogPreference\").load(config.context + '/preference', function () {\r\n $(\"#dialogPreference input\").keyup(function () {\r\n var isChange = false,\r\n emptys = [],\r\n emptysTip = '';\r\n $(\"#dialogPreference input\").each(function () {\r\n var $it = $(this);\r\n // data-value 如为数字,则不会和 value 一样转换为 String,再次不使用全等\r\n if ($it.val() != $it.data(\"value\")) {\r\n isChange = true;\r\n }\r\n\r\n if ($.trim($it.val()) === '') {\r\n emptys.push($it);\r\n }\r\n });\r\n\r\n var $okBtn = $(\"#dialogPreference\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\");\r\n if (isChange) {\r\n $okBtn.prop(\"disabled\", false);\r\n } else {\r\n $okBtn.prop(\"disabled\", true);\r\n }\r\n\r\n if (emptys.length === 0) {\r\n $(\"#dialogPreference\").find(\".tip\").html(\"\");\r\n $okBtn.prop(\"disabled\", false);\r\n } else {\r\n for (var i = 0, max = emptys.length; i < max; i++) {\r\n var tabIndex = emptys[i].closest('div').data(\"index\"),\r\n text = $.trim(emptys[i].parent().text());\r\n emptysTip += '[' + $('#dialogPreference .tabs > div[data-index=\"' + tabIndex + '\"]').text()\r\n + '] -> [' + text.substr(0, text.length - 1)\r\n + ']: ' + config.label.no_empty + \"
    \";\r\n }\r\n $(\"#dialogPreference\").find(\".tip\").html(emptysTip);\r\n $okBtn.prop(\"disabled\", true);\r\n }\r\n });\r\n\r\n $(\"#dialogPreference select\").on(\"change\", function () {\r\n var isChange = false;\r\n $(\"#dialogPreference select\").each(function () {\r\n if ($(this).val() !== $(this).data(\"value\")) {\r\n isChange = true;\r\n }\r\n });\r\n\r\n var $okBtn = $(\"#dialogPreference\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\");\r\n if (isChange) {\r\n $okBtn.prop(\"disabled\", false);\r\n } else {\r\n $okBtn.prop(\"disabled\", true);\r\n }\r\n });\r\n\r\n $(\"#dialogPreference\").dialog({\r\n \"modal\": true,\r\n \"height\": 280,\r\n \"width\": 800,\r\n \"title\": config.label.preference,\r\n \"okText\": config.label.apply,\r\n \"cancelText\": config.label.cancel,\r\n \"afterOpen\": function () {\r\n var $okBtn = $(\"#dialogPreference\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\");\r\n $okBtn.prop(\"disabled\", true);\r\n },\r\n \"ok\": function () {\r\n var request = newWideRequest(),\r\n $dialogPreference = $(\"#dialogPreference\"),\r\n $fontFamily = $dialogPreference.find(\"input[name=fontFamily]\"),\r\n $fontSize = $dialogPreference.find(\"input[name=fontSize]\"),\r\n $goFmt = $dialogPreference.find(\"select[name=goFmt]\"),\r\n $goBuildArgs = $dialogPreference.find(\"input[name=goBuildArgs]\"),\r\n $workspace = $dialogPreference.find(\"input[name=workspace]\"),\r\n $password = $dialogPreference.find(\"input[name=password]\"),\r\n $email = $dialogPreference.find(\"input[name=email]\"),\r\n $locale = $dialogPreference.find(\"select[name=locale]\"),\r\n $theme = $dialogPreference.find(\"select[name=theme]\"),\r\n $editorFontFamily = $dialogPreference.find(\"input[name=editorFontFamily]\"),\r\n $editorFontSize = $dialogPreference.find(\"input[name=editorFontSize]\"),\r\n $editorLineHeight = $dialogPreference.find(\"input[name=editorLineHeight]\"),\r\n $editorTheme = $dialogPreference.find(\"select[name=editorTheme]\"),\r\n $editorTabSize = $dialogPreference.find(\"input[name=editorTabSize]\"),\r\n $keymap = $dialogPreference.find(\"select[name=keymap]\");\r\n\r\n $.extend(request, {\r\n \"fontFamily\": $fontFamily.val(),\r\n \"fontSize\": $fontSize.val(),\r\n \"goFmt\": $goFmt.val(),\r\n \"goBuildArgs\": $goBuildArgs.val(),\r\n \"workspace\": $workspace.val(),\r\n \"password\": $password.val(),\r\n \"email\": $email.val(),\r\n \"locale\": $locale.val(),\r\n \"theme\": $theme.val(),\r\n \"editorFontFamily\": $editorFontFamily.val(),\r\n \"editorFontSize\": $editorFontSize.val(),\r\n \"editorLineHeight\": $editorLineHeight.val(),\r\n \"editorTheme\": $editorTheme.val(),\r\n \"editorTabSize\": $editorTabSize.val(),\r\n \"keymap\": $keymap.val()\r\n });\r\n\r\n if (config.keymap !== $keymap.val()) {\r\n window.location.reload();\r\n }\r\n\r\n $.ajax({\r\n type: 'POST',\r\n url: config.context + '/preference',\r\n data: JSON.stringify(request),\r\n success: function (result, textStatus, jqXHR) {\r\n if (!result.succ) {\r\n return false;\r\n }\r\n\r\n $fontFamily.data(\"value\", $fontFamily.val());\r\n $fontSize.data(\"value\", $fontSize.val());\r\n $goFmt.data(\"value\", $goFmt.val());\r\n $goBuildArgs.data(\"value\", $goBuildArgs.val());\r\n $workspace.data(\"value\", $workspace.val());\r\n $password.data(\"value\", $password.val());\r\n $email.data(\"value\", $email.val());\r\n $locale.data(\"value\", $locale.val());\r\n $theme.data(\"value\", $theme.val());\r\n $editorFontFamily.data(\"value\", $editorFontFamily.val());\r\n $editorFontSize.data(\"value\", $editorFontSize.val());\r\n $editorLineHeight.data(\"value\", $editorLineHeight.val());\r\n $editorTheme.data(\"value\", $editorTheme.val());\r\n $editorTabSize.data(\"value\", $editorTabSize.val());\r\n $keymap.data(\"value\", $keymap.val());\r\n\r\n // update the config\r\n config.keymap = $keymap.val();\r\n\r\n var $okBtn = $(\"#dialogPreference\").closest(\".dialog-main\").find(\".dialog-footer > button:eq(0)\");\r\n $okBtn.prop(\"disabled\", true);\r\n\r\n $(\"#themesLink\").attr(\"href\", config.staticServer + '/static/css/themes/' + $theme.val() + '.css');\r\n\r\n config.editorTheme = $editorTheme.val();\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n editors.data[i].editor.setOption(\"theme\", $editorTheme.val());\r\n }\r\n }\r\n });\r\n }\r\n });\r\n\r\n new Tabs({\r\n id: \".preference\"\r\n });\r\n });\r\n }\r\n};","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file windows.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.1.2.2, Feb 16, 2016\r\n */\r\nvar windows = {\r\n isMaxEditor: false,\r\n outerLayout: {},\r\n innerLayout: {},\r\n init: function () {\r\n if (!config.latestSessionContent) {\r\n config.latestSessionContent = {\r\n \"fileTree\": [],\r\n \"files\": [],\r\n \"currentFile\": \"\",\r\n };\r\n }\r\n \r\n if (!config.latestSessionContent.layout) {\r\n config.latestSessionContent.layout = {\r\n \"side\": {\r\n \"size\": 200,\r\n \"state\": 'normal'\r\n },\r\n \"sideRight\": {\r\n \"size\": 200,\r\n \"state\": 'normal'\r\n },\r\n \"bottom\": {\r\n \"size\": 100,\r\n \"state\": 'normal'\r\n }\r\n };\r\n }\r\n\r\n var layout = config.latestSessionContent.layout;\r\n\r\n this.outerLayout = $('body').layout({\r\n north__paneSelector: \".menu\",\r\n center__paneSelector: \".content\",\r\n south__paneSelector: \".footer\",\r\n north__size: 22,\r\n south__size: 19,\r\n spacing_open: 2,\r\n north__spacing_open: 0,\r\n south__spacing_open: 0,\r\n defaults: {\r\n fxSpeed_open: 300,\r\n fxSpeed_close: 100,\r\n fxSettings_close: {\r\n easing: \"easeOutQuint\"\r\n },\r\n fxSettings_open: {\r\n easing: \"easeInQuint\"\r\n }\r\n },\r\n west: {\r\n size: layout.side.size,\r\n paneSelector: \".side\",\r\n togglerLength_open: 0,\r\n togglerLength_closed: 15,\r\n togglerAlign_closed: \"top\",\r\n slideTrigger_open: \"mouseover\",\r\n spacing_closed: 15,\r\n minSize: 100,\r\n togglerClass: \"ico-restore\",\r\n togglerTip_open: config.label.min,\r\n togglerTip_closed: config.label.restore_side,\r\n resizerTip: config.label.resize,\r\n initClosed: (layout.side.state === 'min')\r\n }\r\n });\r\n\r\n this.innerLayout = $('div.content').layout({\r\n spacing_open: 2,\r\n defaults: {\r\n fxSpeed_open: 300,\r\n fxSpeed_close: 100,\r\n fxSettings_close: {\r\n easing: \"easeOutQuint\"\r\n },\r\n fxSettings_open: {\r\n easing: \"easeInQuint\"\r\n }\r\n },\r\n center: {\r\n paneSelector: \".edit-panel\"\r\n },\r\n east: {\r\n size: layout.sideRight.size,\r\n paneSelector: \".side-right\",\r\n togglerLength_open: 0,\r\n togglerLength_closed: 15,\r\n togglerAlign_closed: \"top\",\r\n slideTrigger_open: \"mouseover\",\r\n spacing_closed: 15,\r\n minSize: 100,\r\n togglerClass: \"ico-restore\",\r\n togglerTip_open: config.label.min,\r\n togglerTip_closed: config.label.restore_outline,\r\n resizerTip: config.label.resize,\r\n initClosed: (layout.sideRight.state === 'min')\r\n },\r\n south: {\r\n size: layout.bottom.size,\r\n paneSelector: \".bottom-window-group\",\r\n togglerLength_open: 0,\r\n togglerLength_closed: 15,\r\n togglerAlign_closed: \"top\",\r\n slideTrigger_open: \"mouseover\",\r\n spacing_closed: 16,\r\n minSize: 100,\r\n togglerClass: \"ico-restore\",\r\n togglerTip_open: config.label.min,\r\n togglerTip_closed: config.label.restore_bottom,\r\n resizerTip: config.label.resize,\r\n initClosed: (layout.bottom.state === 'min'),\r\n ondrag_end: function (type, pane) {\r\n windows.refreshEditor(pane, 'drag');\r\n },\r\n onresize_end: function (type, pane) {\r\n windows.refreshEditor(pane, 'resize');\r\n },\r\n onclose_end: function (type, pane) {\r\n windows.refreshEditor(pane, 'close');\r\n },\r\n onopen_end: function (type, pane) {\r\n windows.refreshEditor(pane, 'open');\r\n },\r\n onshow_end: function (type, pane) {\r\n windows.refreshEditor(pane, 'show');\r\n }\r\n }\r\n });\r\n\r\n this.outerLayout.addCloseBtn(\".side .ico-min\", \"west\");\r\n this.innerLayout.addCloseBtn(\".side-right .ico-min\", \"east\");\r\n this.innerLayout.addCloseBtn(\".bottom-window-group .ico-min\", \"south\");\r\n\r\n if (layout.side.state === 'max') {\r\n windows.maxSide();\r\n }\r\n if (layout.sideRight.state === 'max') {\r\n windows.maxSideRight();\r\n }\r\n if (layout.bottom.state === 'max') {\r\n windows.maxBottom();\r\n }\r\n\r\n $(\".toolbars .ico-max\").click(function () {\r\n windows.toggleEditor();\r\n });\r\n\r\n $(\".edit-panel .tabs\").on(\"dblclick\", function () {\r\n windows.toggleEditor();\r\n });\r\n\r\n $(\".bottom-window-group .tabs\").dblclick(function () {\r\n var $it = $(\".bottom-window-group\");\r\n if ($it.hasClass(\"bottom-window-group-max\")) {\r\n windows.restoreBottom();\r\n } else {\r\n windows.maxBottom($it);\r\n }\r\n });\r\n\r\n $(\".side .tabs\").dblclick(function () {\r\n var $it = $(\".side\");\r\n if ($it.hasClass(\"side-max\")) {\r\n windows.restoreSide();\r\n } else {\r\n windows.restoreSide($it);\r\n }\r\n });\r\n\r\n $(\".side-right .tabs\").dblclick(function () {\r\n var $it = $(\".side-right\");\r\n if ($it.hasClass(\"side-right-max\")) {\r\n windows.restoreSideRight();\r\n } else {\r\n windows.maxSideRight($it);\r\n }\r\n });\r\n\r\n $('.bottom-window-group .search').height($('.bottom-window-group .tabs-panel').height());\r\n $(window).resize(function () {\r\n windows.refreshEditor($('.bottom-window-group'));\r\n });\r\n\r\n },\r\n maxEditor: function () {\r\n var $it = $(\".toolbars .font-ico\");\r\n windows.outerLayout.close('west');\r\n windows.innerLayout.close('south');\r\n windows.innerLayout.close('east');\r\n $it.removeClass('ico-max').addClass('ico-restore').attr('title', config.label.min);\r\n windows.isMaxEditor = true;\r\n },\r\n maxBottom: function ($it) {\r\n $it.data('height', $it.height()).addClass(\"bottom-window-group-max\").find('.ico-min').hide();\r\n windows.outerLayout.hide('west');\r\n windows.innerLayout.hide('east');\r\n windows.innerLayout.sizePane('south', $('.content').height());\r\n },\r\n maxSide: function ($it) {\r\n $it.data('width', $it.width()).addClass(\"side-max\").find('.ico-min').hide();\r\n $('.content').hide();\r\n windows.outerLayout.sizePane('west', $('body').width());\r\n },\r\n maxSideRight: function ($it) {\r\n $it.addClass(\"side-right-max\").data('width', $it.width()).find('.ico-min').hide();\r\n windows.outerLayout.hide('west');\r\n windows.innerLayout.hide('south');\r\n windows.innerLayout.sizePane('east', $('body').width());\r\n },\r\n toggleEditor: function () {\r\n var $it = $(\".toolbars .font-ico\");\r\n if ($it.hasClass('ico-restore')) {\r\n windows.restoreEditor();\r\n } else {\r\n windows.maxEditor();\r\n }\r\n },\r\n restoreBottom: function () {\r\n var $it = $(\".bottom-window-group\");\r\n $it.removeClass(\"bottom-window-group-max\").find('.ico-min').show();\r\n windows.outerLayout.show('west');\r\n windows.innerLayout.show('east');\r\n windows.innerLayout.sizePane('south', $it.data('height'));\r\n },\r\n restoreSide: function () {\r\n var $it = $(\".side\");\r\n $it.removeClass(\"side-max\").find('.ico-min').show();\r\n $('.content').show();\r\n windows.outerLayout.sizePane('west', $it.data('width'));\r\n },\r\n restoreSideRight: function () {\r\n var $it = $(\".side-right\");\r\n $it.removeClass(\"side-right-max\").find('.ico-min').show();\r\n windows.outerLayout.show('west');\r\n windows.innerLayout.show('south');\r\n windows.innerLayout.sizePane('east', $it.data('width'));\r\n },\r\n restoreEditor: function () {\r\n windows.outerLayout.open('west');\r\n windows.innerLayout.open('south');\r\n windows.innerLayout.open('east');\r\n windows.isMaxEditor = false;\r\n $(\".toolbars .font-ico\").addClass('ico-max').removeClass('ico-restore').attr('title', config.label.max_editor);\r\n },\r\n refreshEditor: function (pane, type) {\r\n var editorDatas = editors.data,\r\n height = $('.content').height() - pane.height() - 24;\r\n switch (type) {\r\n case 'close':\r\n height = $('.content').height() - 40;\r\n break;\r\n default:\r\n break;\r\n }\r\n for (var i = 0, ii = editorDatas.length; i < ii; i++) {\r\n editorDatas[i].editor.setSize(\"100%\", height);\r\n }\r\n\r\n $('.bottom-window-group .search').height($('.bottom-window-group .tabs-panel').height());\r\n },\r\n flowBottom: function () {\r\n if (windows.innerLayout.south.state.isClosed) {\r\n windows.innerLayout.slideOpen('south');\r\n }\r\n }\r\n};","/*\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\n */\n\n/*\r\n * @file hotkeys.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.0.0.2, Dec 15, 2015\r\n */\r\nvar hotkeys = {\r\n defaultKeyMap: {\r\n // Ctrl-0\r\n goEditor: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 48,\r\n fun: function () {\r\n if (wide.curEditor) {\r\n wide.curEditor.focus();\r\n }\r\n }\r\n },\r\n // Ctrl-1\r\n goFileTree: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 49,\r\n fun: function () {\r\n // 有些元素需设置 tabindex 为 -1 时才可以 focus\r\n if (windows.outerLayout.west.state.isClosed) {\r\n windows.outerLayout.slideOpen('west');\r\n }\r\n $(\"#files\").focus();\r\n }\r\n },\r\n // Ctrl-2\r\n goOutline: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 50,\r\n fun: function () {\r\n if (windows.innerLayout.east.state.isClosed) {\r\n windows.innerLayout.slideOpen('east');\r\n }\r\n\r\n $(\"#outline\").focus();\r\n }\r\n },\r\n // Ctrl-4\r\n goOutput: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 52,\r\n fun: function () {\r\n bottomGroup.tabs.setCurrent(\"output\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .output\").focus();\r\n }\r\n },\r\n // Ctrl-5\r\n goSearch: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 53,\r\n fun: function () {\r\n bottomGroup.tabs.setCurrent(\"search\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .search\").focus();\r\n }\r\n },\r\n // Ctrl-6\r\n goNotification: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 54,\r\n fun: function () {\r\n bottomGroup.tabs.setCurrent(\"notification\");\r\n windows.flowBottom();\r\n $(\".bottom-window-group .notification\").focus();\r\n }\r\n },\r\n // Alt-C\r\n clearWindow: {\r\n ctrlKey: false,\r\n altKey: true,\r\n shiftKey: false,\r\n which: 67\r\n },\r\n // Ctrl-D 窗口组切换 \r\n changeEditor: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 68\r\n },\r\n // Ctrl-F search \r\n search: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 70\r\n },\r\n // Ctrl-Q close current editor \r\n closeCurEditor: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 81\r\n },\r\n // Ctrl-R\r\n rename: {\r\n ctrlKey: true,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 82\r\n },\r\n // Shift-Alt-O 跳转到文件\r\n goFile: {\r\n ctrlKey: false,\r\n altKey: true,\r\n shiftKey: true,\r\n which: 79\r\n },\r\n // F5 Build\r\n build: {\r\n ctrlKey: false,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 116\r\n },\r\n // F6 Build & Run\r\n buildRun: {\r\n ctrlKey: false,\r\n altKey: false,\r\n shiftKey: false,\r\n which: 117\r\n }\r\n },\r\n bindList: function ($source, $list, enterFun) {\r\n $list.data(\"index\", 0);\r\n $source.keydown(function (event) {\r\n var index = $list.data(\"index\"),\r\n count = $list.find(\"li\").length;\r\n\r\n if (count === 0) {\r\n return true;\r\n }\r\n\r\n if (event.which === 38) { // up\r\n index--;\r\n if (index < 0) {\r\n index = count - 1;\r\n }\r\n }\r\n\r\n if (event.which === 40) { // down\r\n index++;\r\n if (index > count - 1) {\r\n index = 0;\r\n }\r\n }\r\n\r\n var $selected = $list.find(\"li:eq(\" + index + \")\");\r\n\r\n if (event.which === 13) { // enter\r\n enterFun($selected);\r\n }\r\n\r\n $list.find(\"li\").removeClass(\"selected\");\r\n $list.data(\"index\", index);\r\n $selected.addClass(\"selected\");\r\n\r\n if (index === 0) {\r\n $list.scrollTop(0);\r\n } else {\r\n if ($selected[0].offsetTop + $list.scrollTop() > $list.height()) {\r\n if (event.which === 40) {\r\n $list.scrollTop($list.scrollTop() + $selected.height());\r\n } else {\r\n $list.scrollTop($selected[0].offsetTop);\r\n }\r\n } else {\r\n $list.scrollTop(0);\r\n }\r\n }\r\n\r\n // 阻止上下键改变光标位置\r\n if (event.which === 38 || event.which === 40 || event.which === 13) {\r\n return false;\r\n }\r\n });\r\n },\r\n _bindOutput: function () {\r\n $(\".bottom-window-group .output\").keydown(function (event) {\r\n var hotKeys = hotkeys.defaultKeyMap;\r\n if (event.altKey === hotKeys.clearWindow.altKey\r\n && event.which === hotKeys.clearWindow.which) { // Alt-C clear output\r\n bottomGroup.clear('output');\r\n\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n });\r\n },\r\n _bindFileTree: function () {\r\n $(\"#files\").keydown(function (event) {\r\n event.preventDefault();\r\n\r\n var hotKeys = hotkeys.defaultKeyMap;\r\n if (event.ctrlKey === hotKeys.search.ctrlKey\r\n && event.which === hotKeys.search.which) { // Ctrl-F 搜索\r\n $(\"#dialogSearchForm\").dialog(\"open\");\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.rename.ctrlKey\r\n && event.which === hotKeys.rename.which) { // Ctrl-R 重命名\r\n if (wide.curNode.removable) {\r\n $(\"#dialogRenamePrompt\").dialog(\"open\");\r\n }\r\n return;\r\n }\r\n\r\n switch (event.which) {\r\n case 46: // delete\r\n tree.removeIt();\r\n break;\r\n case 13: // enter\r\n if (!wide.curNode) {\r\n return false;\r\n }\r\n\r\n if (tree.isDir()) {\r\n if (wide.curNode.open) {\r\n return false;\r\n }\r\n\r\n tree.fileTree.expandNode(wide.curNode, true, false, true);\r\n $(\"#files\").focus();\r\n\r\n break;\r\n }\r\n\r\n tree.openFile(wide.curNode);\r\n\r\n break;\r\n case 38: // up\r\n var node = {};\r\n\r\n if (!wide.curNode) { // select the first one if no node been selected\r\n node = tree.fileTree.getNodeByTId(\"files_1\");\r\n } else {\r\n if (wide.curNode && wide.curNode.isFirstNode && wide.curNode.level === 0) {\r\n return false;\r\n }\r\n\r\n node = wide.curNode.getPreNode();\r\n if (wide.curNode.isFirstNode && wide.curNode.getParentNode()) {\r\n node = wide.curNode.getParentNode();\r\n }\r\n\r\n var preNode = wide.curNode.getPreNode();\r\n if (preNode && tree.isDir() && preNode.open) {\r\n node = tree.getCurrentNodeLastNode(preNode);\r\n }\r\n }\r\n\r\n wide.curNode = node;\r\n tree.fileTree.selectNode(node);\r\n $(\"#files\").focus();\r\n break;\r\n case 40: // down\r\n var node = {};\r\n\r\n if (!wide.curNode) { // select the first one if no node been selected \r\n node = tree.fileTree.getNodeByTId(\"files_1\");\r\n } else {\r\n if (wide.curNode && tree.isBottomNode(wide.curNode)) {\r\n return false;\r\n }\r\n\r\n node = wide.curNode.getNextNode();\r\n if (tree.isDir() && wide.curNode.open) {\r\n node = wide.curNode.children[0];\r\n }\r\n\r\n var nextShowNode = tree.getNextShowNode(wide.curNode);\r\n if (wide.curNode.isLastNode && wide.curNode.level !== 0 && !wide.curNode.open && nextShowNode) {\r\n node = nextShowNode;\r\n }\r\n }\r\n\r\n if (node) {\r\n wide.curNode = node;\r\n tree.fileTree.selectNode(node);\r\n }\r\n\r\n $(\"#files\").focus();\r\n break;\r\n case 37: // left\r\n if (!wide.curNode) {\r\n wide.curNode = tree.fileTree.getNodeByTId(\"files_1\");\r\n tree.fileTree.selectNode(wide.curNode);\r\n $(\"#files\").focus();\r\n return false;\r\n }\r\n\r\n if (!tree.isDir() || !wide.curNode.open) {\r\n return false;\r\n }\r\n\r\n tree.fileTree.expandNode(wide.curNode, false, false, true);\r\n $(\"#files\").focus();\r\n break;\r\n case 39: // right\r\n if (!wide.curNode) {\r\n wide.curNode = tree.fileTree.getNodeByTId(\"files_1\");\r\n tree.fileTree.selectNode(wide.curNode);\r\n $(\"#files\").focus();\r\n return false;\r\n }\r\n\r\n if (!tree.isDir() || wide.curNode.open) {\r\n return false;\r\n }\r\n\r\n tree.fileTree.expandNode(wide.curNode, true, false, true);\r\n $(\"#files\").focus();\r\n\r\n break;\r\n case 116: // F5\r\n if (!wide.curNode || !tree.isDir()) {\r\n return false;\r\n }\r\n\r\n tree.refresh(wide.curNode);\r\n\r\n break;\r\n }\r\n });\r\n },\r\n _bindDocument: function () {\r\n var hotKeys = this.defaultKeyMap;\r\n $(document).keydown(function (event) {\r\n if (event.ctrlKey === hotKeys.goEditor.ctrlKey\r\n && event.which === hotKeys.goEditor.which) { // Ctrl-0 焦点切换到当前编辑器\r\n hotKeys.goEditor.fun();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.goFileTree.ctrlKey\r\n && event.which === hotKeys.goFileTree.which) { // Ctrl-1 焦点切换到文件树\r\n hotKeys.goFileTree.fun();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.goOutline.ctrlKey\r\n && event.which === hotKeys.goOutline.which) { // Ctrl-2 焦点切换到大纲\r\n hotKeys.goOutline.fun();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.goOutput.ctrlKey\r\n && event.which === hotKeys.goOutput.which) { // Ctrl-4 焦点切换到输出窗口 \r\n hotKeys.goOutput.fun();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.goSearch.ctrlKey\r\n && event.which === hotKeys.goSearch.which) { // Ctrl-5 焦点切换到搜索窗口 \r\n hotKeys.goSearch.fun();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.goNotification.ctrlKey\r\n && event.which === hotKeys.goNotification.which) { // Ctrl-6 焦点切换到通知窗口 \r\n hotKeys.goNotification.fun();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.closeCurEditor.ctrlKey\r\n && event.which === hotKeys.closeCurEditor.which) { // Ctrl-Q 关闭当前编辑器 \r\n $(\".edit-panel .tabs > div.current\").find(\".ico-close\").click();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.changeEditor.ctrlKey\r\n && event.which === hotKeys.changeEditor.which) { // Ctrl-D 窗口组切换\r\n if (document.activeElement.className === \"notification\"\r\n || document.activeElement.className === \"output\"\r\n || document.activeElement.className === \"search\") {\r\n // 焦点在底部窗口组时,对底部进行切换\r\n var tabs = [\"output\", \"search\", \"notification\"],\r\n nextPath = \"\";\r\n for (var i = 0, ii = tabs.length; i < ii; i++) {\r\n if (bottomGroup.tabs.getCurrentId() === tabs[i]) {\r\n if (i < ii - 1) {\r\n nextPath = tabs[i + 1];\r\n } else {\r\n nextPath = tabs[0];\r\n }\r\n break;\r\n }\r\n }\r\n bottomGroup.tabs.setCurrent(nextPath);\r\n $(\".bottom-window-group .\" + nextPath).focus();\r\n\r\n event.preventDefault();\r\n\r\n return false;\r\n }\r\n\r\n if (editors.data.length > 1) {\r\n var nextPath = \"\";\r\n for (var i = 0, ii = editors.data.length; i < ii; i++) {\r\n var currentId = editors.getCurrentId();\r\n if (currentId) {\r\n if (currentId === editors.data[i].id) {\r\n if (i < ii - 1) {\r\n nextPath = editors.data[i + 1].id;\r\n wide.curEditor = editors.data[i + 1].editor;\r\n } else {\r\n nextPath = editors.data[0].id;\r\n wide.curEditor = editors.data[0].editor;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n editors.tabs.setCurrent(nextPath);\r\n var nextTId = tree.getTIdByPath(nextPath);\r\n wide.curNode = tree.fileTree.getNodeByTId(nextTId);\r\n\r\n tree.fileTree.selectNode(wide.curNode);\r\n wide.refreshOutline();\r\n var cursor = wide.curEditor.getCursor();\r\n $(\".footer .cursor\").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |');\r\n wide.curEditor.focus();\r\n }\r\n\r\n event.preventDefault();\r\n\r\n return false;\r\n }\r\n\r\n if (event.which === hotKeys.build.which) { // F5 Build\r\n menu.build();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.which === hotKeys.buildRun.which) { // F6 Build & Run\r\n menu.run();\r\n event.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n if (event.ctrlKey === hotKeys.goFile.ctrlKey\r\n && event.altKey === hotKeys.goFile.altKey\r\n && event.shiftKey === hotKeys.goFile.shiftKey\r\n && event.which === hotKeys.goFile.which) { // Shift-Alt-O 跳转到文件\r\n $(\"#dialogGoFilePrompt\").dialog(\"open\");\r\n }\r\n });\r\n },\r\n init: function () {\r\n this._bindFileTree();\r\n this._bindOutput();\r\n this._bindDocument();\r\n }\r\n};","/*\r\n * Copyright (c) 2014-2017, b3log.org & hacpai.com\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/*\r\n * @file bottomGroup.js\r\n *\r\n * @author Liyuan Li\r\n * @author Liang Ding\r\n * @version 1.1.1.1, Mar 15, 2017\r\n */\r\nvar bottomGroup = {\r\n tabs: undefined,\r\n searchTab: undefined,\r\n init: function () {\r\n this._initTabs();\r\n this._initFrame();\r\n\r\n $('.bottom-window-group .output').click(function () {\r\n $(this).focus();\r\n });\r\n\r\n $('.bottom-window-group .output').on('click', '.path', function (event) {\r\n var $path = $(this),\r\n tId = tree.getTIdByPath($path.data(\"path\"));\r\n tree.openFile(tree.fileTree.getNodeByTId(tId),\r\n CodeMirror.Pos($path.data(\"line\") - 1, $path.data(\"column\") - 1));\r\n event.preventDefault();\r\n return false;\r\n });\r\n },\r\n _initFrame: function () {\r\n $(\".bottom-window-group .output\").parent().mouseup(function (event) {\r\n event.stopPropagation();\r\n\r\n if (event.button === 0) { // 左键\r\n $(\".bottom-window-group .frame\").hide();\r\n return;\r\n }\r\n\r\n // event.button === 2 右键\r\n var left = event.screenX,\r\n $it = $(this);\r\n if ($(\".side\").css(\"left\") === \"auto\" || $(\".side\").css(\"left\") === \"0px\") {\r\n left = event.screenX - $(\".side\").width();\r\n }\r\n $(\".bottom-window-group .frame\").show().css({\r\n \"left\": left + \"px\",\r\n \"top\": (event.offsetY + event.target.offsetTop - $it.scrollTop() - 10) + \"px\"\r\n });\r\n return;\r\n });\r\n },\r\n clear: function (id) {\r\n $('.bottom-window-group .' + id + ' > div').text('');\r\n },\r\n resetOutput: function () {\r\n this.clear('output');\r\n bottomGroup.tabs.setCurrent(\"output\");\r\n windows.flowBottom();\r\n },\r\n _initTabs: function () {\r\n this.tabs = new Tabs({\r\n id: \".bottom-window-group\",\r\n clickAfter: function (id) {\r\n this._$tabsPanel.find(\".\" + id).focus();\r\n }\r\n });\r\n },\r\n fillOutput: function (data) {\r\n var $output = $('.bottom-window-group .output');\r\n\r\n data = data.replace(/\\r/g, '');\r\n data = data.replace(/\\n/g, '
    ');\r\n\r\n if (-1 !== data.indexOf(\"
    \")) {\r\n data = Autolinker.link(data);\r\n }\r\n\r\n $output.find(\"div\").html(data);\r\n $output.parent().scrollTop($output[0].scrollHeight);\r\n }\r\n};\r\n"],"sourceRoot":"/source/"} From e1dca8c16de585c3362ca398259f8826dfe8520b Mon Sep 17 00:00:00 2001 From: khjde1207 Date: Mon, 27 Mar 2017 10:58:05 +0900 Subject: [PATCH 05/13] Update menu.js --- static/js/menu.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/static/js/menu.js b/static/js/menu.js index 455c841..be81415 100644 --- a/static/js/menu.js +++ b/static/js/menu.js @@ -425,7 +425,9 @@ var menu = { $fontFamily = $dialogPreference.find("input[name=fontFamily]"), $fontSize = $dialogPreference.find("input[name=fontSize]"), $goFmt = $dialogPreference.find("select[name=goFmt]"), - $goBuildArgs = $dialogPreference.find("input[name=goBuildArgs]"), + $GoBuildArgsforLinux = $dialogPreference.find("input[name=GoBuildArgsforLinux]"), + $GoBuildArgsforWindows = $dialogPreference.find("input[name=GoBuildArgsforWindows]"), + $GoBuildArgsforDarwin = $dialogPreference.find("input[name=GoBuildArgsforDarwin]"), $workspace = $dialogPreference.find("input[name=workspace]"), $password = $dialogPreference.find("input[name=password]"), $email = $dialogPreference.find("input[name=email]"), @@ -442,7 +444,9 @@ var menu = { "fontFamily": $fontFamily.val(), "fontSize": $fontSize.val(), "goFmt": $goFmt.val(), - "goBuildArgs": $goBuildArgs.val(), + "GoBuildArgsforLinux": $GoBuildArgsforLinux.val(), + "GoBuildArgsforWindows": $GoBuildArgsforWindows.val(), + "GoBuildArgsforDarwin": $GoBuildArgsforDarwin.val(), "workspace": $workspace.val(), "password": $password.val(), "email": $email.val(), @@ -472,7 +476,9 @@ var menu = { $fontFamily.data("value", $fontFamily.val()); $fontSize.data("value", $fontSize.val()); $goFmt.data("value", $goFmt.val()); - $goBuildArgs.data("value", $goBuildArgs.val()); + $goBuildArgs.data("value", $GoBuildArgsforLinux.val()); + $goBuildArgs.data("value", $GoBuildArgsforWindows.val()); + $goBuildArgs.data("value", $GoBuildArgsforDarwin.val()); $workspace.data("value", $workspace.val()); $password.data("value", $password.val()); $email.data("value", $email.val()); @@ -507,4 +513,4 @@ var menu = { }); }); } -}; \ No newline at end of file +}; From b33638dc06bc61c830915e4554852e6191c3b4aa Mon Sep 17 00:00:00 2001 From: khjde1207 Date: Mon, 27 Mar 2017 10:59:35 +0900 Subject: [PATCH 06/13] Update user.go --- conf/user.go | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/conf/user.go b/conf/user.go index 86f3863..b119885 100644 --- a/conf/user.go +++ b/conf/user.go @@ -59,7 +59,9 @@ type User struct { Workspace string // the GOPATH of this user (maybe contain several paths splitted by os.PathListSeparator) Locale string GoFormat string - GoBuildArgs string + GoBuildArgsforLinux string + GoBuildArgsforWindows string + GoBuildArgsforDarwin string FontFamily string FontSize string Theme string @@ -92,7 +94,7 @@ func NewUser(username, password, email, workspace string) *User { now := time.Now().UnixNano() return &User{Name: username, Password: password, Salt: salt, Email: email, Gravatar: gravatar, Workspace: workspace, - Locale: Wide.Locale, GoFormat: "gofmt", GoBuildArgs: "-i", FontFamily: "Helvetica", FontSize: "13px", Theme: "default", + Locale: Wide.Locale, GoFormat: "gofmt", GoBuildArgsforLinux: "-i", GoBuildArgsforWindows: "-i", GoBuildArgsforDarwin: "-i", FontFamily: "Helvetica", FontSize: "13px", Theme: "default", Keymap: "wide", Created: now, Updated: now, Lived: now, Editor: &editor{FontFamily: "Consolas, 'Courier New', monospace", FontSize: "inherit", LineHeight: "17px", @@ -155,3 +157,23 @@ func Salt(password, salt string) string { return hex.EncodeToString(sha1hash.Sum(nil)) } + +func (u *User) GetBuildArgs(os string) []string { + var tmp string + if os == "windows" { + tmp = u.GoBuildArgsforWindows + } + if os == "linux" { + tmp = u.GoBuildArgsforLinux + } + if os == "darwin" { + tmp = u.GoBuildArgsforDarwin + } + exp := regexp.MustCompile(`[^\s"']+|"([^"]*)"|'([^']*)'`) + words := exp.FindAllString(tmp, -1) + for idx := range words { + words[idx] = strings.Replace(words[idx], "\"", "", -1) + } + return words +} + From 4b1cdbb249efd878e153b3e3df1f13159cfe0dd8 Mon Sep 17 00:00:00 2001 From: khjde1207 Date: Mon, 27 Mar 2017 11:00:15 +0900 Subject: [PATCH 07/13] Update wide.go --- conf/wide.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/conf/wide.go b/conf/wide.go index 77896bb..f302563 100644 --- a/conf/wide.go +++ b/conf/wide.go @@ -138,8 +138,14 @@ func initUsers() { } // Compatibility upgrade (1.5.3): https://github.com/b3log/wide/issues/308 - if "" == user.GoBuildArgs { - user.GoBuildArgs = "-i" + if "" == user.GoBuildArgsforLinux { + user.GoBuildArgsforLinux = "-i" + } + if "" == user.GoBuildArgsforWindows { + user.GoBuildArgsforWindows = "-i" + } + if "" == user.GoBuildArgsforDarwin { + user.GoBuildArgsforDarwin = "-i" } Users = append(Users, user) From ed7170a02f57783f53b37f946ac8ae3cb6f0ee89 Mon Sep 17 00:00:00 2001 From: khjde1207 Date: Mon, 27 Mar 2017 11:04:34 +0900 Subject: [PATCH 08/13] Update build.go --- output/build.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/output/build.go b/output/build.go index 05a5cc8..b2c21df 100644 --- a/output/build.go +++ b/output/build.go @@ -17,6 +17,7 @@ package output import ( "bufio" "encoding/json" + "fmt" "io" "net/http" "os" @@ -94,7 +95,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { goBuildArgs := []string{} goBuildArgs = append(goBuildArgs, "build") - goBuildArgs = append(goBuildArgs, strings.Split(user.GoBuildArgs, " ")...) + goBuildArgs = append(goBuildArgs, user.GetBuildArgs(runtime.GOOS)...) cmd := exec.Command("go", goBuildArgs...) cmd.Dir = curDir @@ -130,7 +131,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { // display "START [go build]" in front-end browser msg := i18n.Get(locale, "start-build").(string) - msg = strings.Replace(msg, "build]", "build "+user.GoBuildArgs+"]", 1) + msg = strings.Replace(msg, "build]", "build "+fmt.Sprint(user.GetBuildArgs(runtime.GOOS))+"]", 1) channelRet["output"] = "" + msg + "\n" channelRet["cmd"] = "start-build" From 2293e37e725c800ec18dbca3851a02166b191ba9 Mon Sep 17 00:00:00 2001 From: khjde1207 Date: Mon, 27 Mar 2017 11:05:31 +0900 Subject: [PATCH 09/13] Update cross.go --- output/cross.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/output/cross.go b/output/cross.go index 53c26c7..64b2d60 100644 --- a/output/cross.go +++ b/output/cross.go @@ -75,7 +75,12 @@ func CrossCompilationHandler(w http.ResponseWriter, r *http.Request) { suffix = ".exe" } - cmd := exec.Command("go", "build") + user := conf.GetUser(username) + goBuildArgs := []string{} + goBuildArgs = append(goBuildArgs, "build") + goBuildArgs = append(goBuildArgs, user.GetBuildArgs(goos)...) + + cmd := exec.Command("go", goBuildArgs...) cmd.Dir = curDir setCmdEnv(cmd, username) From d7550b110a68cc133c6ac035675c3edc3f878ccd Mon Sep 17 00:00:00 2001 From: khjde1207 Date: Mon, 27 Mar 2017 11:22:22 +0900 Subject: [PATCH 10/13] Update user.go --- conf/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/user.go b/conf/user.go index b119885..7a43288 100644 --- a/conf/user.go +++ b/conf/user.go @@ -24,7 +24,7 @@ import ( "path/filepath" "strings" "time" - + "regexp" "github.com/b3log/wide/util" ) From b5365794eb7597ea817b1b25eee664e8c20e073c Mon Sep 17 00:00:00 2001 From: khjde1207 Date: Mon, 27 Mar 2017 11:42:10 +0900 Subject: [PATCH 11/13] Update cross.go --- output/cross.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/output/cross.go b/output/cross.go index 64b2d60..0d4613a 100644 --- a/output/cross.go +++ b/output/cross.go @@ -25,7 +25,7 @@ import ( "path/filepath" "strconv" "strings" - + "runtime" "github.com/b3log/wide/conf" "github.com/b3log/wide/i18n" "github.com/b3log/wide/session" From bc9466f43595ccf7919010e3cf2e059975c990af Mon Sep 17 00:00:00 2001 From: khjde1207 Date: Mon, 27 Mar 2017 11:51:55 +0900 Subject: [PATCH 12/13] Update cross.go --- output/cross.go | 1 - 1 file changed, 1 deletion(-) diff --git a/output/cross.go b/output/cross.go index 0d4613a..bd0af89 100644 --- a/output/cross.go +++ b/output/cross.go @@ -25,7 +25,6 @@ import ( "path/filepath" "strconv" "strings" - "runtime" "github.com/b3log/wide/conf" "github.com/b3log/wide/i18n" "github.com/b3log/wide/session" From dfcbeaa9c822636be18e1bca09e92b29f2bb62d0 Mon Sep 17 00:00:00 2001 From: khjde1207 Date: Mon, 27 Mar 2017 11:52:32 +0900 Subject: [PATCH 13/13] Update build.go --- output/build.go | 1 + 1 file changed, 1 insertion(+) diff --git a/output/build.go b/output/build.go index b2c21df..a8fc253 100644 --- a/output/build.go +++ b/output/build.go @@ -25,6 +25,7 @@ import ( "path/filepath" "strconv" "strings" + "runtime" "github.com/b3log/wide/conf" "github.com/b3log/wide/i18n"