forked from sdepold/jquery-rss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
101 lines (96 loc) · 2.78 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
101
<!DOCTYPE html>
<html>
<head>
<title>jquery.rss example</title>
<script src="lib/jquery-1.6.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js"></script>
<script src="src/jquery.rss.js"></script>
<script>
jQuery(function($) {
$("#rss-feeds").rss("http://blog.superfeedr.com/atom.xml", {
ssl: true,
host: 'push.superfeedr.com',
limit: 15,
buildUrl: function(rss) {
var auth = btoa(['superfeedr', 'c77d4103dfe9fe2f32b19b9b4653c09b'].join(':'));
var apiProtocol = 'http' + (rss.options.ssl ? 's' : '');
var apiHost = apiProtocol + '://' + rss.options.host;
var apiUrl = apiHost + '?';
apiUrl += 'callback=?';
apiUrl += '&count=' + rss.options.limit || 10;
apiUrl += '&format=json';
apiUrl += '&hub.mode=retrieve';
apiUrl += '&hub.topic=' + encodeURIComponent(rss.url);
apiUrl += '&authorization=' + auth;
return apiUrl;
},
transform: function transform(data) {
var x = {
responseData: {
feed: {
feedUrl: data.status.feed,
title: data.title,
link: '',
description: '',
author: '',
entries: []
}
}
};
data.items.forEach(function(i) {
x.responseData.feed.entries.push({
title: i.title,
link: i.permalinkUrl,
content: i.content,
contentSnippet: i.summary || i.content,
publishedDate: new Date(1000 * i.published).toISOString(),
categories: i.categories || [],
author: i.actor.displayName
});
})
return x;
}
})
})
</script>
<style type="text/css">
body {
font-family: Arial, Verdana, Trebuchet MS, Helvetica, lucida grande, "sans-serif";
font-size: 12px;
}
body > div {
margin: 0px auto;
width: 800px;
}
a {
color: #37D;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
ul {
list-style-type: none;
margin: 0px;
padding: 0px;
}
li {
padding: 10px;
border-top: 1px dashed #AAA;
background-color: #EFEFEF;
}
li:first-child {
border-top: none;
}
li:nth-child(2n) {
background-color: white;
}
</style>
</head>
<body>
<div>
<h1>jquery.rss example</h1>
<div id="rss-feeds"></div>
</div>
</body>
</html>