diff --git a/webroot/AutoSa/static/js/main.js b/webroot/AutoSa/static/js/main.js index b236137bd..f1479e16c 100644 --- a/webroot/AutoSa/static/js/main.js +++ b/webroot/AutoSa/static/js/main.js @@ -15,51 +15,3 @@ function selectAll(){ } -$.fn.webSocket = function(opt){ - - var st = {}; - st = $.extend(st,opt); - var message = {}; - var $this = $(this); - - - var genUid = function(){ - return new Date().getTime()+""+Math.floor(Math.random()*899+100); - }; - - var init = function(e){ - - var socket = io.connect('ws://'+globalConfig.SOCKET_HOST); - var node = $(e.target); - message.id = genUid(); - message.filename = node.attr('filename'); - BootstrapDialog.show({message:function(){ - var escapeString = function (html){ - var elem = document.createElement('div') - var txt = document.createTextNode(html) - elem.appendChild(txt) - return elem.innerHTML; - } - var tag = $('
'); - //告诉服务器端有用户登录 - socket.emit('login', {userid:message.id, filename:message.filename}); - socket.on('message',function(obj){ - //去除log中的颜色控制字符 - var regx = /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/g; - tag.append('

'+escapeString(obj.content.replace(regx,''))+'

'); - }); - return tag[0]; - } , - title:'实时监控:', - onhide:function(){ - socket.emit('disconnect'); - }}); - } - - - $this.on("click",function(e){ - init(e); - return false; - }); - -} diff --git a/webroot/AutoSa/templates/logView.html b/webroot/AutoSa/templates/logView.html index 3312005dd..bde851d79 100644 --- a/webroot/AutoSa/templates/logView.html +++ b/webroot/AutoSa/templates/logView.html @@ -43,6 +43,54 @@