Leo Repp | 56904d2 | 2021-04-26 15:53:22 +0200 | [diff] [blame] | 1 | /** |
| 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 | |
| 14 | define([ |
| 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"; |
marcrusian | 235a23a | 2021-05-26 14:28:11 +0200 | [diff] [blame^] | 29 | obj._el.classList.remove("pref"); |
| 30 | obj._el.classList.add("entry"); |
Leo Repp | 56904d2 | 2021-04-26 15:53:22 +0200 | [diff] [blame] | 31 | //dont forget to adjust alwaysMenuSpec - alwaysEntry! |
| 32 | return obj; |
| 33 | }, |
| 34 | |
| 35 | _update : function () { |
marcrusian | 235a23a | 2021-05-26 14:28:11 +0200 | [diff] [blame^] | 36 | /* |
Leo Repp | 56904d2 | 2021-04-26 15:53:22 +0200 | [diff] [blame] | 37 | 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 | } |
marcrusian | 235a23a | 2021-05-26 14:28:11 +0200 | [diff] [blame^] | 42 | */ |
Leo Repp | 56904d2 | 2021-04-26 15:53:22 +0200 | [diff] [blame] | 43 | return this._string; // No need to change the text (=innerHTML) |
| 44 | }, |
| 45 | |
| 46 | }; |
| 47 | }); |