forked from superfeedr/subtome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload.js
28 lines (26 loc) · 989 Bytes
/
load.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
(function() {
var feeds = [];
var links = document.getElementsByTagName('link');
for(var i = 0; i < links.length; i++) {
if(links[i].rel) {
if(links[i].rel.split(' ').indexOf('alternate') >= 0) {
if(links[i].href && links[i].href.length > 0) {
feeds.push(encodeURIComponent(links[i].href));
}
}
}
}
var s = document.createElement('iframe');
var url = window.location.toString();
var resource = window.location.toString();
s.setAttribute('style','position:fixed;top:0px; left:0px; width:100%; height:100%; border:0px; background: transparent; z-index: 2147483647');
s.setAttribute('src', 'https://www.subtome.com/subscribe.html?resource=' + encodeURIComponent(resource) + '&feeds=' + feeds.join(','));
var loaded = false;
s.onload = function() {
if(loaded) {
document.getElementsByTagName('body')[0].removeChild(s);
}
loaded = true;
}
document.getElementsByTagName('body')[0].appendChild(s);
})();