diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2018-05-15 21:20:00 -0500 |
|---|---|---|
| committer | oldmud0 <oldmud0@users.noreply.github.com> | 2018-05-15 21:20:00 -0500 |
| commit | 5685e2b1714c8d85e505e9eccee549723773aaab (patch) | |
| tree | 9cb8a263087218bcc84686f871cd6e70abdc673c /webAO/ui.js | |
| parent | c26ac0e636a71b850fa316f5bead6ba263b55492 (diff) | |
Move files to webAO folder; GoldenLayout works!
Diffstat (limited to 'webAO/ui.js')
| -rw-r--r-- | webAO/ui.js | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/webAO/ui.js b/webAO/ui.js new file mode 100644 index 0000000..25e466a --- /dev/null +++ b/webAO/ui.js @@ -0,0 +1,82 @@ +import GoldenLayout from "./golden/js/goldenlayout.js"; + +var config = { + settings: { + showPopoutIcon: false, + showCloseIcon: false + }, + content: [ + { + type: "row", + content: [ + { + type: "column", + width: 40, + content: [ + { + type: "component", + componentName: "template", + title: "Game", + componentState: { id: "client_wrapper" } + }, + { + type: "component", + title: "Miscellaneous", + height: 5, + componentName: "template", + componentState: { id: "misc" } + }, + ] + }, + { + type: "column", + content: [ + { + type: "stack", + height: 60, + content: [ + { + type: "component", + title: "Server chat", + componentName: "template", + componentState: { id: "ooc" } + }, + { + type: "component", + title: "Log", + componentName: "template", + componentState: { id: "log" } + } + ] + }, + { + type: "row", + content: [ + { + type: "component", + title: "Music", + componentName: "template", + componentState: { id: "music" } + }, + { + type: "component", + title: "Settings", + componentName: "template", + componentState: { id: "client_settings" } + } + ] + } + ] + } + ] + }] +}; + +var golden = new GoldenLayout(config); +golden.registerComponent("template", function(container, componentState) { + let template = document.querySelector(`#${componentState.id}`); + container.getElement().html(template.content); + // TODO: support multiple locales + // container.setTitle(document.querySelector(`#${componentState.id} meta[name='frame-title']`).getAttribute("content")); +}); +golden.init();
\ No newline at end of file |
