-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
100 lines (89 loc) · 3.19 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<!-- Standard Meta -->
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="A web app of HackerNews">
<meta name="keywords" content="HackerNews,web,app">
<!-- Site Properities -->
<title>HackerNews - web app</title>
<script type="text/javascript" src="http://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://cdn.bootcss.com/semantic-ui/2.0.8/semantic.min.css">
<script type="text/javascript" src="http://cdn.bootcss.com/semantic-ui/2.0.8/semantic.min.js"></script>
<script type="text/javascript" src="http://cdn.bootcss.com/hammer.js/2.0.4/hammer.min.js"></script>
<script type="text/javascript" src="http://cdn.bootcss.com/jquery-timeago/1.4.1/jquery.timeago.min.js"></script>
<script type="text/javascript" src="http://cdn.bootcss.com/q.js/1.4.1/q.min.js"></script>
<style type="text/css">
.ui.container.main {
padding-top: 6em;
}
#title {
color: white;
margin: auto;
}
.ui.menu .item.side-button {
position: fixed;
}
.spinner.huge.loading.icon {
margin: 15px auto;
display: block;
}
</style>
</head>
<body>
<div class="ui left vertical inverted sidebar labeled icon menu">
<a class="item" data-id="topstories">
<i class="home icon"></i> Home
</a>
<a class="item" data-id="newstories">
<i class="block layout icon"></i> New
</a>
<a class="item" data-id="showstories">
<i class="world icon"></i> Show
</a>
<a class="item" data-id="askstories">
<i class="help icon"></i> Ask
</a>
<a class="item" data-id="jobstories">
<i class="smile icon"></i> Jobs
</a>
<a class="item" href="https://github.com/Lin-H/HackerNews" target="view_window">
<i class="github icon"></i> Github
</a>
</div>
<div class="pusher">
<div class="ui menu fixed inverted">
<a class="side-button item" onclick="toggleSidebar()"><i class="sidebar icon"></i></a>
<div class="ui container">
<h3 class="ui header" id="title">HackerNews</h3>
</div>
</div>
<div class="ui container main">
<div class="ui divided items">
</div>
<i class="spinner huge loading icon"></i>
</div>
</div>
<script type="text/javascript" src="main.js"></script>
<script type="text/javascript">
$('.ui.sidebar').sidebar('setting', 'transition', 'overlay').sidebar('setting', 'mobileTransition', 'overlay');
//main action
hackernews("topstories")
.then(function(res){
topStories = res;
for(var i=0;i<10;i++){
hackernews("item/"+topStories.shift()).then(function(res){
addItem(res);
});
}
}, function(err){console.log(err)});
$('.huge.loading').hide();
//listen to scroll event
window.onscroll=function(){
scrollLoad({"heightOffset":100 });
}
</script>
</body>
</html>