-
Notifications
You must be signed in to change notification settings - Fork 13
/
canonical.html
180 lines (152 loc) · 5.61 KB
/
canonical.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<!doctype html>
<html lang='en'>
<head>
<script>
var categories = {
'debugging': [
12769982, 8028957, 845021, 16959576, 22745662, 13840429, 23446377
],
'design': [
16356420, 5863870, 5166087, 151969, 254514, 2418473, 3430181, 4361553, 4595964, 254514
],
'general': [
12859942, 15966812, 17364127, 2005079, 279170, 3577641, 7094118, 10057671, 931407, 676824,
22937618, 20563772, 3737139, 15813490, 15990857, 29308898
],
'security': [
12026842, 134099, 3115559, 4795385, 60174, 520237, 129677
]
};
</script>
<meta charset='UTF-8'>
<title>Canonical Questions - Room 11</title>
<link rel='shortcut icon' href='favicon.ico' type='image/x-icon'>
<link rel='icon' href='favicon.ico' type='image/x-icon'>
<link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/normalize/3.0.0/normalize.min.css'>
<style>
html {
font-size: 14px;
line-height: 1.42857;
}
body {
background: #fff;
color: #000;
margin: 0 auto;
max-width: 60rem;
padding: 0 1rem;
}
h2 {
border-bottom: 1px solid #ccc;
color: #444;
margin: 25px 0 5px 0;
padding-bottom: 5px;
text-transform: capitalize;
}
ul {
list-style-type: none;
margin-top: 0;
padding-left: 0;
}
ul li {
border-bottom: 1px solid #eee;
margin-bottom: 5px;
padding: 5px 0 5px 0;
}
ul li .topic {
background-color: #e0eaf1;
border-bottom: 1px solid #b3cee1;
border-right: 1px solid #b3cee1;
color: #3e6d8e;
display: inline-block;
font-size: 11px;
line-height: 1.4;
margin: 5px 6px 5px 0;
padding: 3px 4px 3px 4px;
white-space: nowrap;
}
ul li .score {
font-size: 16px;
font-weight: 700;
}
ul li .score-box {
background-color: #eee;
color: #918987;
float: left;
font-size: 11px;
margin-right: 10px;
padding: 5px;
text-align: center;
width: 50px;
}
ul li a {
color: #0077DD;
font-weight: 700;;
text-decoration: none;
}
ul li a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div id='container'></div>
<script>
(function () {
'use strict';
var resource, questionIds = [];
questionIds = Object.keys(categories).map(function (categoryName) {
return categories[categoryName].join(';');
});
resource = document.createElement('script');
resource.src = 'https://api.stackexchange.com/2.2/questions/' + questionIds.join(';')
+ '?order=asc&sort=creation&site=stackoverflow&filter='
+ encodeURI('!)94yI_.r0i6M') + '&pagesize=100&callback=buildLists&key='
+ encodeURI('9Rriuek73sGszOC)36uHRA((');
document.body.appendChild(resource);
window.buildLists = function (data) {
Object.keys(categories).forEach(function (category) {
var container, list, header = document.createElement('h2');
header.textContent = category;
header.id = category;
header.addEventListener('click', function () {
window.location.hash = category;
});
list = document.createElement('ul');
data.items.forEach(function (question) {
var topicTags, score, scoreBox, listItem, questionLink;
if (-1 < categories[category].indexOf(question.question_id)) {
score = document.createElement('span');
score.className = 'score';
score.textContent = question.score;
scoreBox = document.createElement('span');
scoreBox.className = 'score-box';
scoreBox.appendChild(score);
scoreBox.appendChild(document.createElement('br'));
scoreBox.appendChild(document.createTextNode('Votes'));
topicTags = document.createElement('div');
question.tags.forEach(function (topic) {
var topicTag = document.createElement('span');
topicTag.className = 'topic';
topicTag.textContent = topic;
topicTags.appendChild(topicTag);
});
questionLink = document.createElement('a');
questionLink.href = question.link;
questionLink.target = '_blank';
questionLink.innerHTML = question.title;
listItem = document.createElement('li');
listItem.appendChild(scoreBox);
listItem.appendChild(questionLink);
listItem.appendChild(topicTags);
list.appendChild(listItem);
}
});
container = document.getElementById('container');
container.appendChild(header);
container.appendChild(list);
});
};
}());
</script>
</body>
</html>