Nikolay Suslov 4 년 전
부모
커밋
2ffe4eee71
3개의 변경된 파일91개의 추가작업 그리고 67개의 파일을 삭제
  1. 72 5
      public/lib/widgets.js
  2. 7 6
      public/web/header.js
  3. 12 56
      public/web/index-app.js

+ 72 - 5
public/lib/widgets.js

@@ -792,6 +792,59 @@ Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contribu
               }
 
 
+              let luminaryFeature = {
+                $type: 'div',
+                _luminarySwitch: null,
+                $components: [
+                    {
+                        $type: "p",
+                        class: "mdc-typography--headline4",
+                        $text: "Use Krestianstvo Luminary (experimental)"
+                    },
+                    {
+                        $type: 'p'
+                    },
+                    _app.widgets.switch({
+                        'id': 'forceLuminary',
+                        'init': function () {
+                            this._switch = new mdc.switchControl.MDCSwitch(this);
+                            let config = localStorage.getItem('lcs_config');
+                            this._switch.checked = JSON.parse(config).luminary;
+    
+                            // this._replaceSwitch = this._switch;
+    
+                        },
+                        'onchange': function (e) {
+    
+                            if (this._switch) {
+                                let chkAttr = this._switch.checked;//this.getAttribute('checked');
+                                if (chkAttr) {
+                                    let config = JSON.parse(localStorage.getItem('lcs_config'));
+                                    config.luminary = true;
+                                    localStorage.setItem('lcs_config', JSON.stringify(config));
+                                    window.location.reload(true);
+                                    //this._switch.checked = false;
+                                } else {
+                                    let config = JSON.parse(localStorage.getItem('lcs_config'));
+                                    config.luminary = false;
+                                    localStorage.setItem('lcs_config', JSON.stringify(config));
+                                    window.location.reload(true);
+                                }
+                            }
+                        }
+                    }
+                    ),
+                    {
+                        $type: 'label',
+                        for: 'input-forceLuminary',
+                        $text: 'Off / On'
+                    },
+                    _app.widgets.p
+    
+                ]
+            }
+    
+
             let reflectorGUI =
             {
                 $type: "div",
@@ -905,17 +958,31 @@ Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contribu
                                     class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
                                     $components: [webrtcConnection ]
                                    },
+                                   { 
+                                    $type: "div",
+                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                    $components: [_app.widgets.divider]
+                                   },
+                                  
+                                // {
+                                //     $type: "div",
+                                //     class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                //     $components: [
+                                //     {
+                                //         $type: "h4",
+                                //         class: "mdc-typography--headline4",
+                                //         $text: "Krestianstvo Luminary settings (experimental)"
+                                //     }
+                                // ]
+                                // },
                                 {
                                     $type: "div",
                                     class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
                                     $components: [
-                                    {
-                                        $type: "h4",
-                                        class: "mdc-typography--headline4",
-                                        $text: "Krestianstvo Luminary settings (experimental)"
-                                    }
+                                        luminaryFeature
                                 ]
                                 },
+                               
                                 {
                                     $type: "div",
                                     class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",

+ 7 - 6
public/web/header.js

@@ -14,19 +14,20 @@ class Header {
 
     init(){
 
-
+        let rootDoc = document.querySelector('#app');
         let el = document.createElement("div");
         el.setAttribute("id", "header");
-        document.body.appendChild(el);
+        rootDoc.prepend(el);
 
         let headerGUI = {
-            
+                $cell: true,
                 $type: "a",
                 class: "mdc-button mdc-button--compact mdc-card__action",
-                $text: "Back",
+                $text: "Home",
                 //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
                 onclick: function (e) {
-                    window.history.back();
+                    window.location.pathname = '/'
+                    //window.history.back();
                 }
             
         }
@@ -37,7 +38,7 @@ class Header {
             $cell: true,
             $type: "div",
             $components: [
-                //headerGUI
+                headerGUI
             ]
         })
 

+ 12 - 56
public/web/index-app.js

@@ -4,7 +4,7 @@ Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contribu
 */
 
 //import page from '/lib/page.mjs';
-import { Header } from '/web/header.js';
+//import { Header } from '/web/header.js';
 
 
 class IndexApp {
@@ -12,6 +12,7 @@ class IndexApp {
         console.log("index app constructor");
 
         this.entry = entry;
+
         this.worlds = {};
         this.instances = {};
 
@@ -81,8 +82,15 @@ class IndexApp {
         //first init from _app
         document.querySelector('head').innerHTML += '<link rel="stylesheet" href="/web/index-app.css">';
 
-        let headerGUI = new Header();
-        headerGUI.init();
+
+        if(this.entry !== 'index'){
+            import('/web/header.js').then(res => {
+                let headerGUI = new res.Header();
+                headerGUI.init();
+              })
+        }
+
+
 
         //add HTML
         let entry = document.createElement("div");
@@ -828,61 +836,9 @@ class IndexApp {
         ]
     }
 
-        let luminaryFeature = {
-            $cell: true,
-            $type: 'div',
-            class: "mdc-layout-grid mdc-layout-grid--align-left",
-            _luminarySwitch: null,
-            $components: [
-                {
-                    $type: "p",
-                    class: "mdc-typography--headline5",
-                    $text: "Use Krestianstvo Luminary (experimental)"
-                },
-                {
-                    $type: 'p'
-                },
-                _app.widgets.switch({
-                    'id': 'forceLuminary',
-                    'init': function () {
-                        this._switch = new mdc.switchControl.MDCSwitch(this);
-                        let config = localStorage.getItem('lcs_config');
-                        this._switch.checked = JSON.parse(config).luminary;
-
-                        // this._replaceSwitch = this._switch;
-
-                    },
-                    'onchange': function (e) {
-
-                        if (this._switch) {
-                            let chkAttr = this._switch.checked;//this.getAttribute('checked');
-                            if (chkAttr) {
-                                let config = JSON.parse(localStorage.getItem('lcs_config'));
-                                config.luminary = true;
-                                localStorage.setItem('lcs_config', JSON.stringify(config));
-                                window.location.reload(true);
-                                //this._switch.checked = false;
-                            } else {
-                                let config = JSON.parse(localStorage.getItem('lcs_config'));
-                                config.luminary = false;
-                                localStorage.setItem('lcs_config', JSON.stringify(config));
-                                window.location.reload(true);
-                            }
-                        }
-                    }
-                }
-                ),
-                {
-                    $type: 'label',
-                    for: 'input-forceLuminary',
-                    $text: 'Off / On'
-                }
-
-            ]
-        }
 
 
-        return [luminaryFeature, connectionSettings, _app.widgets.divider]
+        return [connectionSettings, _app.widgets.divider]
 
     }