-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move tree into frame, orchestrate navigation via channels
- Loading branch information
Showing
6 changed files
with
120 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
src/main/resources/net/shrimpworks/unreal/scriptbrowser/www/index.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="en"> | ||
<head> | ||
<title>UnrealScript Browser</title> | ||
<link rel="stylesheet" href="static/style.css"> | ||
<link rel="stylesheet" href="static/solarized-light.css"> | ||
</head> | ||
|
||
<body> | ||
<div id="page"> | ||
<iframe id="nav" src="tree.html"></iframe> | ||
|
||
<header><h1 id="header"></h1></header> | ||
|
||
<iframe id="source"></iframe> | ||
</div> | ||
</body> | ||
|
||
<#noparse> | ||
<script> | ||
document.addEventListener("DOMContentLoaded", () => { | ||
const header = document.getElementById("header") | ||
const nav = document.getElementById("nav") | ||
const source = document.getElementById("source") | ||
// establish comms with the navigation tree, so it can tell us what to put into the source area | ||
nav.addEventListener("load", () => { | ||
const channel = new MessageChannel() | ||
const port1 = channel.port1 | ||
port1.onmessage = (m) => { | ||
switch (m.data.event) { | ||
case "nav": | ||
source.src = m.data.url; | ||
break | ||
default: | ||
console.log("unknown message event ", m.data.type, m.data) | ||
} | ||
} | ||
nav.contentWindow.postMessage('hello nav', '*', [channel.port2]) | ||
}) | ||
// establish comms with the source area, so we can change the title based on what its showing | ||
source.addEventListener("load", () => { | ||
const channel = new MessageChannel() | ||
const port1 = channel.port1 | ||
port1.onmessage = (m) => { | ||
switch (m.data.event) { | ||
case "loaded": | ||
header.innerHTML = m.data.pkg + " / " + m.data.clazz | ||
break | ||
default: | ||
console.log("unknown message event ", m.data.type, m.data) | ||
} | ||
} | ||
source.contentWindow.postMessage('hello source', '*', [channel.port2]) | ||
}) | ||
}) | ||
</script> | ||
</#noparse> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ header { | |
border-left: 50px solid #eee8d5; | ||
} | ||
|
||
nav { | ||
#nav, #tree-holder { | ||
background-color: #eee8d5; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters