-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.html
117 lines (91 loc) · 2.59 KB
/
main.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html>
<html>
<head>
<title>dnodejs.org</title>
<link rel="stylesheet" type="text/css" href="pub/css/style.css">
</head>
<body>
<div id='main'>
<div class="list4">
<div class="head">
<img id="headi" src="" title="" />
</div>
<div class="info">
<span class="mono"></span>
<span class="join"></span>
</div>
</div>
<div class="list5">
<span title="home" class="tab">Home</span>
<span title="mono" class="tab">Post</span>
<span title="join" class="tab">Join</span>
</div>
<div id="mono" style="display:none;" class="list6">
</div>
<div id="home" class="list6">
</div>
<div id="join" style="display:none;" class="list6">
</div>
</div>
<script src="pub/js/jquery-1.9.1.min.js"></script>
<script>
var name = getUrlPara("name");
var spider = require('./spider');
var util = require('util');
spider.getus(name, function(users){
users.forEach(function(user, index){
ch(user.head, user.mono, user.join);
});
spider.getcs(function(cells){
cells.forEach(function(cell, index){
var msg = util.format('<div title="%s %s" class="msg"><div class="cont1"><img src="%s" /></div><div class="cont2">%s</div></div>', cell.replys, cell.times, cell.head, cell.title);
ch2(msg);
});
});
spider.getts(function(tits){
tits.forEach(function(tit, index){
var msg = util.format('<div title="%s %s" class="msg"><div class="cont1"><img src="%s" /></div><div class="cont2">%s</div></div>', tit.replys, tit.times, tit.head, tit.title);
ch1(msg);
});
});
spider.getrs(function(repls){
repls.forEach(function(repl, index){
var msg = util.format('<div title="%s %s" class="msg"><div class="cont1"><img src="%s" /></div><div class="cont2">%s</div></div>', repl.replys, repl.times, repl.head, repl.title);
ch3(msg);
});
});
});
function ch(head, mono, join){
$('#headi').attr('src', head).attr('title', name);
$('.mono').html(mono);
$('.join').html(join);
}
function ch1(ct){
$('#home').append(ct);
}
function ch2(ct){
$('#mono').append(ct);
}
function ch3(ct){
$('#join').append(ct);
}
$(function(){
$(".tab").click(function(){
$(".tab").css({"background-color":"#fff", "border":"1px solid #ccc"});
$(this).css({"background-color":"#eee", "border-bottom":"0px"});
var id = "#" + $(this).attr("title");
$(".list6").hide();
$(id).show();
});
})
function getUrlPara(paraName)
{
var sUrl = location.href;
var sReg = "(?:\\?|&){1}"+paraName+"=([^&]*)"
var re=new RegExp(sReg,"gi");
re.exec(sUrl);
return RegExp.$1;
}
</script>
</body>
</html>