123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- /*
- The MIT License (MIT)
- Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contributors. (https://github.com/NikolaySuslov/livecodingspace/blob/master/LICENSE.md)
- */
- //import page from '/lib/page.mjs';
- class Header {
- constructor() {
- console.log("header constructor");
- }
- init() {
- var rootDoc = document.body
- if(_app.indexApp){
- rootDoc = _app.indexApp.entry == 'index' ? document.querySelector('#indexPage') : document.querySelector('#app');
- //let rootDoc = document.querySelector('#app');
- }
- let el = document.createElement("div");
- el.setAttribute("id", "header");
- rootDoc.prepend(el);
- document.querySelector("#header").$cell({
- id: 'header',
- $cell: true,
- $type: "div",
- $components: [
- {
- $type: "div",
- class: "mdc-layout-grid",
- $components: [
- {
- $type: "div",
- class: "mdc-layout-grid__inner",
- $components: [
- {
- $type: "div",
- class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
- $components: [
- {
- $type: "a",
- style: "cursor:pointer; margin-right: 10px",
- class: "mdc-typography link-in-text mdc-theme--text-hint-on-background",
- $text: _l.t("header_home"),//"Home",
- //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
- onclick: function (e) {
- window.location.pathname = '/'
- //window.history.back();
- }
- },
- {
- $type: "a",
- style: "cursor:pointer; margin-right: 10px",
- class: "mdc-typography link-in-text mdc-theme--text-hint-on-background",
- $text: _l.t("conn_settings"),
- //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
- onclick: function (e) {
- window.location.pathname = '/settings'
- //window.history.back();
- }
- },
- {
- $type: "a",
- style: "cursor:pointer; margin-right: 40px",
- class: "mdc-typography link-in-text mdc-theme--text-hint-on-background",
- $text: _l.t("help"),
- //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
- href: 'https://www.krestianstvo.org/docs/sdk3'
- },
- {
- $type: "a",
- id: 'ruLang',
- style: "cursor:pointer; margin-right: 10px",
- class: "mdc-typography link-in-text mdc-theme--text-hint-on-background",
- $text: _l.t("ru"),
- //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
- onclick: function (e) {
- _LangManager.locale = 'ru';
- window.location.reload(true);
- }
- },
- {
- $type: "a",
- id: 'enLang',
- style: "cursor:pointer; margin-right: 10px",
- class: "mdc-typography link-in-text mdc-theme--text-hint-on-background",
- $text: _l.t("en"),
- //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
- onclick: function (e) {
- _LangManager.locale = 'en';
- window.location.reload(true);
- }
- }
- ]
- },
- {
- $type: "div",
- class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
- $components: [
- _app.widgets.divider
- ]
- }
-
- ]
- }
- ]
- }
- ]
- })
- }
- }
- export { Header }
|