blob: ae99ae9d2c7c63aeb9b9b54b3a77e9cff961b9c6 [file] [log] [blame]
Leo Repp56904d22021-04-26 15:53:22 +02001/**
2 * An entry in menus that is always
3 * displayed, with a string and onClick functionality
4 * uses menu/prefix.js as prototype and doesn't change much, all
5 * functionality comes from the alwaysmenu
6 *
7 *
8 * @author Leo Repp
9 */
10
11
12"use strict";
13
14define([
15 'menu/prefix'
16], function (prefixClass) {
17
18 return {
19
20 /**
21 * Create new always visible menu entry object.
22 * Like a prefix Object, always visible, for some defined action
23 */
24 create : function (text) {
25 const obj = prefixClass.create()
26 .upgradeTo(this)
27 ._init();
28 obj._el.innerHTML = text || "Speichern";
marcrusian235a23a2021-05-26 14:28:11 +020029 obj._el.classList.remove("pref");
30 obj._el.classList.add("entry");
Leo Repp56904d22021-04-26 15:53:22 +020031 //dont forget to adjust alwaysMenuSpec - alwaysEntry!
32 return obj;
33 },
34
35 _update : function () {
marcrusian235a23a2021-05-26 14:28:11 +020036 /*
Leo Repp56904d22021-04-26 15:53:22 +020037 if (this._string.length!==0){ // I assume that this is a sufficient criterium for infering that the prefix is active
38 this._el.style.bottom="-27px";
39 } else if (this._string.length===0) {
40 this._el.style.bottom="0px";
41 }
marcrusian235a23a2021-05-26 14:28:11 +020042 */
Leo Repp56904d22021-04-26 15:53:22 +020043 return this._string; // No need to change the text (=innerHTML)
44 },
45
46 };
47});