-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrss-boxes.js
76 lines (67 loc) · 2.68 KB
/
rss-boxes.js
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
Till OpacNavRight
<div class="rss-widget-container">
<div class="rss-widget-head">
Rubriker från bloggen
</div>
<div class="rss-widget-body" id="bloggen">
<ul class="rss-items"></ul>
<div class="loading">
Laddar innehåll från bloggen. Detta kräver Javascript aktiverat i din webbläsare.
</div>
</div>
</div>
<div class="rss-widget-container">
<div class="rss-widget-head">
Bokbästisarna
</div>
<div class="rss-widget-body" id="bokbastisarna">
<ul class="rss-items"></ul>
<div class="loading">
Laddar innehåll från bloggen. Detta kräver Javascript aktiverat i din webbläsare.
</div>
</div>
</div>
Till OpacUserJS
$("#bloggen").ready(function () {
var proxy_url = "http://MINPROXYSERVER.appspot.com/crossdomain?url=http://hyltebiblioteken.blogspot.com/feeds/posts/default&callback=?";
$.getJSON(proxy_url, function (data) {
var feedXML = $(data.content);
feedXML.find("entry").slice(0, 5).each(function () {
var $this = $(this),
item = {
title: $this.find("title").text(),
link: $this.find("link[rel='alternate']").attr('href')
};
if (item.title.length === 0) {
item.title = "Utan titel";
}
var item_html = '<li><a href="' + item.link + '">' + item.title + '</a></li>';
$("#bloggen ul.rss-items").append(item_html);
});
$("#bloggen div.loading").fadeOut();
$("#bloggen ul.rss-items").slideDown();
});
});
$("#bokbastisarna").ready(function () {
var proxy_url = "http://MINPROXYSERVER.appspot.com/crossdomain?url=http://bokbastisarna.blogspot.com/feeds/posts/default&callback=?";
$.getJSON(proxy_url, function (data) {
var feedXML = $(data.content);
feedXML.find("entry").slice(0, 5).each(function () {
var $this = $(this),
item = {
title: $this.find("title").text(),
link: $this.find("link[rel='alternate']").attr('href')
};
if (item.title.length === 0) {
item.title = "Utan titel";
}
var item_html = '<li><a href="' + item.link + '">' + item.title + '</a></li>';
$("#bokbastisarna ul.rss-items").append(item_html);
});
$("#bokbastisarna div.loading").fadeOut();
$("#bokbastisarna ul.rss-items").slideDown();
});
});
/* Please note - you need to use your own proxy server giving you JSONP data when you post a request with the callback parameter.
You can run your own proxy server for free on Google App Enging using our software https://github.com/regionbibliotekhalland/samsokproxy
*/