</head>
<body>
-<div id="featurebrowser-mainlayout" style="position: absolute; top: 0pt; left: 0pt;"><img src="img/header.png" />
+<div id="featurebrowser-mainlayout" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"><img src="img/header.png" />
<div id="featurebrowser-features" style="top: 62px; width: 200px;">
<div location="tree">puu</div>
</div>
<div id="featurebrowser-divider"
- style="overflow: hidden; position: absolute; width: 137px; height: 17px;" /></div>
+ style="overflow: hidden; position: absolute; width: 137px; height: 17px;" />
</div>
<script type="text/javascript">
// Get whole window contents size
document.body.style.padding = 0;
document.body.style.margin = 0;
- mainDiv.style.width="100%";
- mainDiv.style.height="100%";
-
- var width = mainDiv.offsetWidth;
- var height = mainDiv.offsetHeight;
- if (document.body.offsetWidth > mainDiv.offsetWidth) width = document.body.offsetWidth;
- if (document.body.offsetHeight > mainDiv.offsetHeight) height = document.body.offsetHeight;
+ document.body.style.position = "absolute";
+ document.body.style.height = "100%";
+ document.body.style.width = "100%";
+ var width = document.body.offsetWidth;
+ var height = document.body.offsetHeight;
+ mainDiv.style.height = height + "px";
+ mainDiv.style.width = width + "px";
// Recalc features div dimensions
var featuresWidth = 200;
/** Scripts must be evaluated when the document has been rendered */
protected void onLoad() {
super.onLoad();
- eval(scripts);
+ if (scripts != null) {
+ eval(scripts);
+ scripts = null;
+ }
}
/** Evaluate given script in browser document */
private native void eval(String script) /*-{
- try {
+ try {
eval("{ var document = $doc; var window = $wnd; "+ script + "}");
} catch (e) {
}
/** Scan for location divs and add unique ids for them */
private native void addUniqueIdsForLocations(Element e, String idPrefix) /*-{
- try {
+ try {
var divs = e.getElementsByTagName("div");
for (var i = 0; i < divs.length; i++) {
var div = divs[i];
div.innerHTML="";
}
}
- } catch (e) {}
-
+ } catch (e) {}
+
}-*/;
/** Prefix all img tag srcs with given prefix. */
private native void prefixImgSrcs(Element e, String srcPrefix) /*-{
- try {
+ try {
var divs = e.getElementsByTagName("img");
var base = "" + $doc.location;
var l = base.length-1;
} catch (e) { alert(e + " " + srcPrefix);}
}-*/;
- /** Exctract body part and script tags from raw html-template.
+ /**
+ * Exctract body part and script tags from raw html-template.
*
- * Saves contents of all script-tags to private property: scripts.
- * Returns contents of the body part for the html without script-tags.
+ * Saves contents of all script-tags to private property: scripts. Returns
+ * contents of the body part for the html without script-tags.
*
- * @param html Original HTML-template received from server
+ * @param html
+ * Original HTML-template received from server
* @return html that is used to create the HTMLPanel.
*/
private String extractBodyAndScriptsFromTemplate(String html) {
-
+
// Exctract script-tags
- scripts ="";
+ scripts = "";
int endOfPrevScript = 0;
int nextPosToCheck = 0;
String lc = html.toLowerCase();
while (scriptStart > 0) {
res += html.substring(endOfPrevScript, scriptStart);
scriptStart = lc.indexOf(">", scriptStart);
- int j = lc.indexOf("</script>",scriptStart);
- scripts += html.substring(scriptStart+1,j) + ";";
+ int j = lc.indexOf("</script>", scriptStart);
+ scripts += html.substring(scriptStart + 1, j) + ";";
nextPosToCheck = endOfPrevScript = j + "</script>".length();
scriptStart = lc.indexOf("<script", nextPosToCheck);
}
res += html.substring(endOfPrevScript);
-
+
// Extract body
html = res;
lc = html.toLowerCase();
res = html;
} else {
res = "";
- startOfBody = lc.indexOf(">",startOfBody)+1;
- int endOfBody = lc.indexOf("</body>",startOfBody);
+ startOfBody = lc.indexOf(">", startOfBody) + 1;
+ int endOfBody = lc.indexOf("</body>", startOfBody);
if (endOfBody > startOfBody)
- res = html.substring(startOfBody,endOfBody);
- else
+ res = html.substring(startOfBody, endOfBody);
+ else
res = html.substring(startOfBody);
- }
-
+ }
+
return res;
}