-
-
Notifications
You must be signed in to change notification settings - Fork 190
/
logos.html
79 lines (64 loc) · 2.36 KB
/
logos.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
---
layout: default
end_scripts: |
<script>
(function() {
var getComments = function(nextCommentsURL, comments) {
$.get(nextCommentsURL, function(responseComments, status, jqxhr) {
var linksHeader = jqxhr.getResponseHeader('Link');
var nextCommentsURL = parse_link_header(linksHeader).next;
comments = comments.concat(responseComments);
if (nextCommentsURL) {
getComments(nextCommentsURL, comments);
} else {
buildIssues(comments);
}
});
};
var buildIssues = function(allComments){
var images_html = '';
var template_item = _.template($('#logo-list-item').html());
var index_counter = 1;
_.forEach(allComments, function(comment) {
var re = /!\[(.*?)\]\((.*?)\)/g;
var instances = [];
var result = [];
while ((result = re.exec(comment.body))) {
if (result[2] && result[1].indexOf('smallicons') === -1 && result[1].indexOf('scribus') === -1) {
images_html += template_item({
index: index_counter,
comment_url: comment.html_url,
image_url: result[2]
});
index_counter += 1;
}
}
});
$('#logos').html('<ul>' + images_html + '</ul>');
};
var issueUrl = 'https://api.github.com/repos/opensourcedesign/' +
'opensourcedesign.net/issues/18';
$.get(issueUrl, function(issue, status, jqxhr) {
var created = issue.created_at;
var baseCommentsURL = issueUrl + '/comments';
var comments = [{body: issue.body, html_url: issue.html_url}];
getComments(baseCommentsURL, comments);
}).fail(function(error){
console.log('error', error.statusText, error.getAllResponseHeaders());
});
})()
</script>
---
<p class="logo-intro-text">
We've been talking about our logo, what it should be, and what it should look like. Below is a dynamically created list of all the proposals put forth in the GitHub thread:
</p>
<div id="logos" class="possible-logos">
</div>
<script id="logo-list-item" type="text/template">
<li>
<a href="<%= comment_url %>">
<img src="<%= image_url %>" alt="logo option"/>
<span class="src"><%= index %></span>
</a>
</li>
</script>