/* * Copyright (c) 2014-2019, b3log.org & hacpai.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Tabs=function(e){e._$tabsPanel=$(e.id+" > .tabs-panel"),e._$tabs=$(e.id+" > .tabs"),e._stack=[],this.obj=e,this.obj.STACKSIZE=64,this._init(e);var i=this;$(e.id+" > .tabs > div").each(function(){var t=$(this).data("index");e._stack.length===i.obj.STACKSIZE&&e._stack.splice(0,1),e._stack[e._stack.length-1]!==t&&i.obj._stack.push(t)})};$.extend(Tabs.prototype,{_init:function(r){var n=this;r._$tabs.on("click","div",function(t){if($(this).hasClass("current"))return!1;var e=$(this).data("index");n.setCurrent(e),"function"==typeof r.clickAfter&&r.clickAfter(e)}),r._$tabs.on("click",".ico-close",function(t){var e=$(this).parent().data("index"),i=!0;"function"==typeof r.removeBefore&&(i=r.removeBefore(e)),i&&n.del(e),t.stopPropagation()})},_hasId:function(t){return 0!==this.obj._$tabs.find('div[data-index="'+t+'"]').length},add:function(t){if(this.getCurrentId()===t.id)return!1;if(this._hasId(t.id))return this.setCurrent(t.id),!1;var e=this.obj._$tabsPanel;this.obj._$tabs.append('
"+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 i={},a=0;a