Skip to content

Commit

Permalink
Merge pull request #31 from adrianjost/#30-iframes-aren't-appended-co…
Browse files Browse the repository at this point in the history
…rrectly-anymore

fixed iFrame fallback
  • Loading branch information
adrianjost authored Apr 23, 2017
2 parents 2c37ce3 + ef4530d commit 25e4d82
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions inc/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,25 +128,23 @@ function loadarticle(t){
}else{
var r = JSON.parse(r);
var s = JSON.parse(getData("content-"+r["id"]));
history.pushState('', document.title, window.location.pathname+window.location.search+"#"+r["id"]);
if(r["status"]){
console.log(s);
document.getElementById("fullcard").innerHTML = get_fullcard(s["content"],r["body"]);
//window.location.hash = c["id"];
history.pushState('', document.title, window.location.pathname+window.location.search+"#"+r["id"]);
document.getElementById("cards").classList.add('hidden');
document.getElementById("fullcard").classList.remove('hidden');
t.classList.remove('loading');
lazyimg();

s["fullcontent"] = r["body"];
saveData("content-"+r["id"], JSON.stringify(s));
}else{ // iFrame Fallback
var ifrm = document.createElement("iframe");
ifrm.src = document.getElementById(r["id"]).getAttribute("url");
console.log(ifrm);
document.getElementById("fullcard").innerHTML = get_fullcard(s,ifrm);
t.classList.remove('loading');
ifrm.src = document.getElementById(r["id"]).getAttribute("url");
var ifrmwrap = document.createElement("div");
ifrmwrap.appendChild(ifrm);
document.getElementById("fullcard").innerHTML = get_fullcard(s["content"],(ifrmwrap.innerHTML));
}
document.getElementById("cards").classList.add('hidden');
document.getElementById("fullcard").classList.remove('hidden');
t.classList.remove('loading');
lastid = r["id"];
window.scrollBy(0,-9999999999);
}
Expand Down

0 comments on commit 25e4d82

Please sign in to comment.