function fetchdata(url,cback){
var req = new XMLHttpRequest();
req.open("GET",url,true);
req.addEventListener("load",cback);
req.send();
}
function logreq(event){
console.log("Event:")
console.log(event.target.response)
}
function parse_news_item(dat){
var item = {};
item.title = dat.slice(dat.search("
")+7,dat.search(""));
item.description = dat.slice(dat.search("")+13,dat.search(""));
item.url = dat.slice(dat.search("")+6,dat.search(""));;
item.img = dat.slice(dat.search("")+5,dat.search(""));;
return item;
}
function get_rss_list(data){
var items = data.split("").splice(1);
return items.map(parse_news_item).reverse();
}
//https://davidwalsh.name/query-string-javascript
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};