Fixed JS for iframed apps so the CSS class is injected on page change

This commit is contained in:
str4d
2012-06-27 02:16:21 +00:00
parent 255894e241
commit 5be02b1592
2 changed files with 6 additions and 8 deletions

View File

@@ -23,20 +23,19 @@
function initAjax() { setTimeout(requestAjax1, <%=intl.getRefresh()%>000); }
function resizeFrame(f) { f.style.height = f.contentWindow.document.body.scrollHeight + "px"; }
function injectClass(f) { f.contentWindow.document.getElementsByTagName('body')[0].setAttribute('class', 'iframed'); }
function init() {
function setupFrame() {
f = document.getElementById("i2ptunnelframe");
resizeFrame(f);
injectClass(f);
initAjax();
}
</script>
</head><body onload="init()">
</head><body onload="initAjax()">
<%@include file="summary.jsi" %>
<h1><%=intl._("I2P Tunnel Manager")%></h1>
<div class="main" id="main">
<iframe src="/i2ptunnel/" width="100%" height="100%" frameborder="0" border="0" name="i2ptunnelframe" id="i2ptunnelframe" onload="resizeFrame(document.getElementById('i2ptunnelframe'))" allowtransparency="true">
<iframe src="/i2ptunnel/" width="100%" height="100%" frameborder="0" border="0" name="i2ptunnelframe" id="i2ptunnelframe" onload="setupFrame()" allowtransparency="true">
</iframe>
</div></body></html>
<%

View File

@@ -23,20 +23,19 @@
function initAjax() { setTimeout(requestAjax1, <%=intl.getRefresh()%>000); }
function resizeFrame(f) { f.style.height = f.contentWindow.document.body.scrollHeight + "px"; }
function injectClass(f) { f.contentWindow.document.getElementsByTagName('body')[0].setAttribute('class', 'iframed'); }
function init() {
function setupFrame() {
f = document.getElementById("i2psnarkframe");
resizeFrame(f);
injectClass(f);
initAjax();
}
</script>
</head><body onload="init()">
</head><body onload="initAjax()">
<%@include file="summary.jsi" %>
<h1><%=intl._("I2P Torrent Downloader")%></h1>
<div class="main" id="main">
<iframe src="/i2psnark/" width="100%" height="100%" frameborder="0" border="0" name="i2psnarkframe" id="i2psnarkframe" onload="resizeFrame(document.getElementById('i2psnarkframe'))" allowtransparency="true">
<iframe src="/i2psnark/" width="100%" height="100%" frameborder="0" border="0" name="i2psnarkframe" id="i2psnarkframe" onload="setupFrame()" allowtransparency="true">
</iframe>
</div></body></html>
<%