header.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. The MIT License (MIT)
  3. Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contributors. (https://github.com/NikolaySuslov/livecodingspace/blob/master/LICENSE.md)
  4. */
  5. //import page from '/lib/page.mjs';
  6. class Header {
  7. constructor() {
  8. console.log("header constructor");
  9. this.language = _LangManager.language;
  10. }
  11. init(){
  12. let rootDoc = document.querySelector('#app');
  13. let el = document.createElement("div");
  14. el.setAttribute("id", "header");
  15. rootDoc.prepend(el);
  16. let headerGUI = {
  17. $cell: true,
  18. $type: "a",
  19. class: "mdc-button mdc-button--compact mdc-card__action",
  20. $text: "Home",
  21. //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
  22. onclick: function (e) {
  23. window.location.pathname = '/'
  24. //window.history.back();
  25. }
  26. }
  27. document.querySelector("#header").$cell({
  28. id: 'header',
  29. $cell: true,
  30. $type: "div",
  31. $components: [
  32. headerGUI
  33. ]
  34. })
  35. }
  36. }
  37. export { Header }