pull/2/head
guanghongwei 2014-11-12 17:52:56 +08:00
parent 4844f7861b
commit 0f63eadfc1
3 changed files with 12 additions and 3 deletions

View File

@ -29,7 +29,7 @@ $.fn.webSocket = function(opt){
var init = function(e){
var socket = io.connect('ws://172.10.10.9:3000');
var socket = io.connect('ws://'+globalConfig.SOCKET_HOST);
var node = $(e.target);
message.id = genUid();
message.filename = node.attr('filename');
@ -47,7 +47,6 @@ $.fn.webSocket = function(opt){
//去除log中的颜色控制字符
var regx = /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/g;
tag.append('<p>'+escapeString(obj.content.replace(regx,''))+'</p>');
tag.animate({ scrollTop: tag[0].scrollHeight}, 1000);
});
return tag[0];
} ,

View File

@ -18,8 +18,9 @@
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/bootstrap-dialog.js"></script>
<script src="http://172.10.10.9:3000/socket.io/socket.io.js"></script>
<script src="/static/js/main.js"></script>
</head>
<body>
@ -145,6 +146,7 @@
{% block content %}{% endblock %}
</div>
</div>
</div>
</body>
</html>

View File

@ -2,6 +2,7 @@
{% load mytags %}
{% block content %}
<form method="post" action="">
<table class="table table-striped table-hover table-condensed">
<thead>
@ -38,6 +39,9 @@
{% endfor %}
</tbody>
</table>
<script src="http://{{ web_socket_host }}:3000/socket.io/socket.io.js"></script>
<script >
$('.log_command').on('click',function(){
var url = $(this).attr('href');
@ -46,7 +50,11 @@
}});
return false;
})
globalConfig = {
SOCKET_HOST: "{{ web_socket_host }}"
}
$(".monitor").webSocket()
</script>
<!--<button class="btn btn-primary">删除</button>-->
</form>