infobox: added support for iframes

This commit is contained in:
Benjamin 2016-03-16 20:40:08 +01:00 committed by BE
parent 11a157c58a
commit 961a18fec4
5 changed files with 90 additions and 90 deletions
lib/infobox

View file

@ -1,35 +1,9 @@
define(function () {
function showStatImg(o, source, target) {
var content, caption
if (o.thumbnail) {
content = document.createElement("img")
content.src = o.thumbnail.replace("{SOURCE}", source).replace("{TARGET}", target)
}
if (o.caption) {
caption = o.caption.replace("{SOURCE}", source).replace("{TARGET}", target)
if (!content)
content = document.createTextNode(caption)
}
var p = document.createElement("p")
if (o.href) {
var link = document.createElement("a")
link.target = "_blank"
link.href = o.href.replace("{SOURCE}", source).replace("{TARGET}", target)
link.appendChild(content)
if (caption && o.thumbnail)
link.title = caption
p.appendChild(link)
} else
p.appendChild(content)
return p
var subst = {}
subst["{SOURCE}"] = source
subst["{TARGET}"] = target
return showStat(o, subst)
}
return function (config, el, router, d) {

View file

@ -220,36 +220,9 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
}
function showStatImg(o, nodeId) {
var content, caption
if (o.thumbnail) {
content = document.createElement("img")
content.src = o.thumbnail.replace("{NODE_ID}", nodeId)
}
if (o.caption) {
caption = o.caption.replace("{NODE_ID}", nodeId)
if (!content)
content = document.createTextNode(caption)
}
var p = document.createElement("p")
if (o.href) {
var link = document.createElement("a")
link.target = "_blank"
link.href = o.href.replace("{NODE_ID}", nodeId)
link.appendChild(content)
if (caption && o.thumbnail)
link.title = caption
p.appendChild(link)
} else
p.appendChild(content)
return p
var subst = {}
subst["{NODE_ID}"] = nodeId
return showStat(o, subst)
}
return function(config, el, router, d) {