beautify_js
This commit is contained in:
parent
0febe4f5fd
commit
5c2f32e184
208 changed files with 3891 additions and 1474 deletions
|
@ -1,33 +1,36 @@
|
|||
|
||||
var http = require('http');
|
||||
var url = require('url');
|
||||
var static = require('node-static');
|
||||
var file = new static.Server('.', { cache: 0 });
|
||||
var file = new static.Server('.', {
|
||||
cache: 0
|
||||
});
|
||||
|
||||
|
||||
function accept(req, res) {
|
||||
|
||||
if (req.url == '/comet') {
|
||||
res.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'});
|
||||
if (req.url == '/comet') {
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'text/html; charset=utf-8'
|
||||
});
|
||||
|
||||
res.write('<!DOCTYPE HTML><html> \
|
||||
<head><meta junk="'+new Array(2000).join('*')+'"/> \
|
||||
res.write('<!DOCTYPE HTML><html> \
|
||||
<head><meta junk="' + new Array(2000).join('*') + '"/> \
|
||||
<script> \
|
||||
var i = parent.IframeComet; \
|
||||
i.onConnected()</script> \
|
||||
</head><body>');
|
||||
|
||||
setInterval(function() {
|
||||
var now = new Date();
|
||||
var timeStr = now.getHours()+':'+now.getMinutes()+':'+now.getSeconds();
|
||||
res.write('<script>i.onMessage("'+timeStr+'")</script>');
|
||||
}, 1000);
|
||||
setInterval(function() {
|
||||
var now = new Date();
|
||||
var timeStr = now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();
|
||||
res.write('<script>i.onMessage("' + timeStr + '")</script>');
|
||||
}, 1000);
|
||||
|
||||
return;
|
||||
} else {
|
||||
return;
|
||||
} else {
|
||||
file.serve(req, res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,6 +40,4 @@ if (!module.parent) {
|
|||
http.createServer(accept).listen(8080);
|
||||
} else {
|
||||
exports.accept = accept;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue