PageSourceSearch

https://kaloriabazis.hu/js/func_tabbox_s.js?615

js kaloriabazis.hu collected 2026-09-26 17:19:29 UTC 27,495 bytes, 868 lines download raw bytes

1
2'use strict';
3
4let Tabbox_s = null;
5
6// open_tabbox
7// make_tabbox_appear
8// make_tabbox_disappear
9// icon_strip_setup
10
11class tabbox_s {
12    constructor() {
13        this.tabbox_visible = false; // egesz tabbox nyitva
14
15        this.tabbox_open_orig_type = 0;    // tab box nyitasnal az atadott tipus
16        this.type = null; // egyenlore ugyanaz, mint orig type
17
18
19        this.sport_id   = 0;
20        this.syn_id     = 0;
21        this.url_id     = 0;
22        this.su_id      = 0;
23        this.name       = 0;
24        this.quan       = 0;
25        this.unit_id    = 0;
26        this.offset_top = 0;
27
28        this.prev_data     = null;
29        this.prev_data_fav = null;
30
31        // nem azt mutatja, hogy eppen animacio folyik-e, hanem
32        // azt, hogy nyitas-csukas tipus es mobil/desktop tipus
33        // animacios-e
34        this.animation_on = null;
35
36        this.anim_time = null;
37
38        // nyitasnal mielott akarmit is elmozditanank
39        this.scroll_top_before_move = null;
40        // nyitasnal miutan tabbox a kepernyo tetejere
41        // gordult, de meg egesz site latszik
42        this.scroll_top_after_move = null;
43    }
44
45    reset_data_at_close() {
46        this.tabbox_visible = false;
47
48        this.tabbox_open_orig_type = 0;
49        this.type = null;
50
51        this.sport_id   = 0;
52        this.syn_id     = 0;
53        this.url_id     = 0;
54        this.su_id      = 0;
55        this.name       = 0;
56        this.quan       = 0;
57        this.unit_id    = 0;
58        this.offset_top = 0;
59
60        this.prev_data     = null;
61        this.prev_data_fav = null;
62
63        this.animation_on = null;
64
65        this.anim_time = null;
66
67        this.scroll_top_before_move = null;
68        this.scroll_top_after_move = null;
69    }
70
71    icon_strip_setup( own, fav ) {
72
73        // Glb_absolute_calc_sport_id
74
75        // log( "sport icon_strip_setup BBBBBBBBBBBBBBBBBBBBBBB");
76
77        // eloszor is leszedjuk osszes ikont
78        $(".tabbox_s_icon, .tabbox_s_icon_combi").hide().addClass("ref_168557");
79
80        if( this.type == TB_type_edit ) {
81            // ilyenkor kellenek ezek az ikonok is
82
83            if( Glb_logined ) // masolas csak bejelentkezve
84                $("#tabbox_s_icon_copy").show();
85
86            $("#tabbox_s_icon_deldone").show();
87        }
88
89        if( this.sport_id == Glb_absolute_calc_sport_id ) {
90            // abszolut kaloria megadas
91
92            if( this.type == TB_type_edit ) {
93                // utolagos kcal szerkesztes, fentebb betett ket ikon jo
94                return;
95            }
96            else {
97
98                // uj kcal megadas, semmi ikon nem kell
99
100                // sot, az egesz ikon savot leszedjuk
101                // (ezt korabban show_15234545 tette ki)
102                $( "#tabbox_s_tab_icons" ).hide().addClass( "hide_76556743" );
103
104                return;
105            }
106        }
107
108        if( own ) {
109            $( "#tabbox_s_icon_delown" ).show();
110        }
111
112        if( Glb_logined > 0 ) { // csak bejelentkezve lehet kedvencezes
113            if( fav ) {
114                $( "#tabbox_s_icon_delfav" ).show();
115            }
116            if( ! fav && ! own ) {
117                $( "#tabbox_s_icon_addfav" ).show();
118            }
119        }
120    }
121
122    // ha nincs id-je, csinal egyet url_id-bol
123    create_ids_from_url_id() {
124        if( this.sport_id > 0 )
125            return; // van mar id
126
127        if( ! this.url_id )
128            return; // nics forras
129
130        const arr = this.url_id.split("_");
131
132        if( arr[0] > 0 )
133            this.sport_id = int_or_zero( arr[0] );
134        if( arr[1] != "undefined" && ! this.syn_id )
135            this.syn_id = int_or_zero( arr[1] );
136    }
137
138    async open_tabbox( type, open_o_par ) {
139
140        // Throwaway = this.tesztelo();
141        // return null;
142
143
144        // VALSZEG kene ellenorzes, hogy nyitva van-e mar
145
146        this.reset_data_at_close();
147        this.tabbox_visible = true;
148
149        this.tabbox_open_orig_type = type;
150        this.type = type;
151        this.tabbox_open_orig_o = open_o_par;
152
153
154        copy_properties( this.tabbox_open_orig_o, this );
155
156        this.create_ids_from_url_id();
157
158        // melyik nyilt meg utoljara. az eteles, vagy a sportos
159        Mbfs_when_displayed_last_food = false;
160
161        // nem tudom, hogy kell-e
162        Mbs_when_displayed = true;
163
164        // ez nem kell, mert ktl-t kinthagyjuk
165        // Mbs_flist_displayed = false;
166
167        // Azert hogy mas fv-ek is egyszeruen lassak ezeket a valtozokat:
168        Mbs_when_edit_mode = this.type == TB_type_edit;
169
170        if( this.abscal_mode ) {
171            Mbs_when_abscal_mode = true;
172        }
173        else {
174            Mbs_when_abscal_mode = false;
175            this.abscal_mode     = false;
176        }
177
178        if( this.type != TB_type_edit )
179            Mbs_when_edit_mode_suid = 0;
180
181        // talalati listabol jove ez a valtozo majd kell
182        if( this.type == TB_type_edit ) {
183            // utolagos editnel viszont null-azza
184            // ezek a dolgok exlain ennek a valtozonak a defjenel
185            Mbs_search_list_orig_received_things = null;
186
187            // utolso 10 sportbol nyilasnal nem itt, hanem ebben
188            // a fv-ben null-azodik:  last10S_clicked()
189        }
190
191        Mbs_dimtype_calperquan = 0;
192        Mbs_when_edit_mode_initial_kcal = 0;
193
194        // Megvan Mbf_tod_cur_index, mehet flist elem atpofozasa mikor
195        // doboz tetejen valo megjeleniteshez:
196        //Mbs_when_sport_name = mbs_flist_when_conversion(i);
197
198        if( ! this.name )
199            throw "err_kseuwehu";
200
201        Mbs_when_sport_name = this.name;
202
203        // Mikor-mennyit dobozt megjelenitjuk:
204        Mbs_num_is_tentative = true;
205
206        Mbs_selected_sport_index = -1;
207
208
209        // az egesz ikon savot kitesszuk
210        // (ezt lehet leszedte egy regebbi hide_76556743)
211        $("#tabbox_s_tab_icons").show().addClass("show_15234545");
212        // viszont leszedjuk osszes ikont
213        $(".tabbox_s_icon").hide(). addClass("ref_543543");
214
215
216        if( this.abscal_mode ) {
217            // Abszolut kaloria intezeskor csak egy mertekegyseg van:
218
219            Mbs_dimtype_cur = null;
220
221            Mbs_dimtype_sel_index = 0;    // explain deklarnal
222
223            let f = 1; // mennyiseg mezo erteke
224            if( this.type == TB_type_edit )
225                f = this.quan;
226            mbs_init_when_quan( f );
227
228            // Mertekegysegeknek nem kell popup menu:
229            Mbs_dimtype_with_pup = false;
230
231            // Mennyiseg mezobe kiirjuk mennyiseget:
232            Mbs.num_field.innerHTML = Mbs.num;
233            // Kiteszunk moge egy kek teglalapot, mintha kijeloles lenne:
234            const jq = $( Mbs.num_field );
235
236            let width = jq.width() + 8;
237            let box_size = 82;
238            if( Glb_mb_dtop )
239                box_size = 113; // 133
240            let left = (box_size-width)/2 + 'px'; // 82
241            $('#tabbox_s .mbs .when .num_highlight').css('marginLeft', left)
242                .css('width', width + 'px')
243                .show();
244
245            // Mertekegysegek hatter szinet es szoveget alaphelyzetbe allitjuk:
246            $('#tabbox_s .mbs .when .dimtype').css('backgroundColor', '')
247                .css('borderColor', '')
248                .html('');
249
250            // Nyil gombot is alaphelyzetbe allitjuk, mintha
251            // mertekegyseg lenne:
252            $('#tabbox_s .mbs .when .dimtype_3')
253                .css('backgroundColor', '')
254                .css('backgroundImage', '')
255                .css('borderColor', '')
256                .html('');
257
258            // Popup menuben levo mertekegyseg kockakat eltuntetjuk:
259            $('#tabbox_s .mbs .when .pup3 .dimtype').css('display', 'none');
260
261            // Rairjuk elso mertekegyseg kockaba nevet:
262            $('#tabbox_s .mbs .when .dimtype_0').html('kcal');
263
264            // Ez hasznalja ezeket:
265            //      Mbs_dimtype_sel_index
266            //      Mbs_dimtype_cur
267            //      Mbs.num
268            mbs_display_grey_weight_and_cal();
269
270            Mbs_dimtype_calperquan = 1;
271            if( Mbs_when_edit_mode )
272                Mbs_when_edit_mode_initial_kcal = float_or_zero(Mbs.num);
273
274            setTimeout(function () {
275                const jq2 = $('#tabbox_s .mbs .when .num_input input');
276                jq2.select().focus();
277            }, 500);
278
279            this.icon_strip_setup( false /*own*/, false /*fav*/ );
280
281            this.make_tabbox_appear(); // beanimalja tabbox-ot
282
283            return null;
284        }
285
286
287
288        this.make_tabbox_appear(); // beanimalja tabbox-ot
289
290        ///////////////////////////////////////////////////////////
291        ///////////////////////////////////////////////////////////
292        ///////////////////////////////////////////////////////////
293        ///////////////////////////////////////////////////////////
294        ///////////////////////////////////////////////////////////
295        ///////////////////////////////////////////////////////////
296        ///////////////////////////////////////////////////////////
297        ///////////////////////////////////////////////////////////
298        ///////////////////////////////////////////////////////////
299        ///////////////////////////////////////////////////////////
300        ///////////////////////////////////////////////////////////
301        ///////////////////////////////////////////////////////////
302        ///////////////////////////////////////////////////////////
303        ///////////////////////////////////////////////////////////
304        ///////////////////////////////////////////////////////////
305        ///////////////////////////////////////////////////////////
306        ///////////////////////////////////////////////////////////
307        ///////////////////////////////////////////////////////////
308        ///////////////////////////////////////////////////////////
309        ///////////////////////////////////////////////////////////
310        ///////////////////////////////////////////////////////////
311        ///////////////////////////////////////////////////////////
312        ///////////////////////////////////////////////////////////
313        ///////////////////////////////////////////////////////////
314        ///////////////////////////////////////////////////////////
315        ///////////////////////////////////////////////////////////
316        ///////////////////////////////////////////////////////////
317        ///////////////////////////////////////////////////////////
318
319
320        // parhuzamosan elinditjuk a ket lekerest
321
322        // php "getsportme" vegyesen ad vissza int kulcsu unit-okat es
323        // string kulcsu propertiket. ez nem baj, mart js nem akar
324        // vegigiteralni az elemeken
325        let data_prom = my_getJSON(
326            $url + "/food.php",
327            {
328                show:   "getsportme",
329                id:     this.sport_id,
330                syn_id: this.syn_id
331            }
332        );
333
334        // lekerjuk kedvenc infot is
335        let data_fav_prom = await my_getJSON(
336            $url + "/food.php",
337            {
338                show: "getsportmeisfav",
339                id:   this.sport_id,
340            }
341        );
342
343        // megvarjuk mindket lekeres eredmenyet
344        let data     = await data_prom;
345        let data_fav = await data_fav_prom;
346
347        this.prev_data = data;
348        this.prev_data_fav = data_fav;
349
350        //alert( `own: ${data.own}, fav: ${data.fav}` );
351
352        this.icon_strip_setup( data.own, data.fav );
353
354        // Ilyen sportnal nincsen:
355        // Mbs_dimtype_cur = data.getme; // explain deklarnal
356        // Ezert igy csinaljuk:
357        Mbs_dimtype_cur = data;
358
359        Mbs_dimtype_sel_index = 0;    // explain deklarnal
360
361        mbs_init_when_quan( 1 ); // mennyiseg mezo erteke
362
363        let favorite = data_fav.isfav == "1";
364
365        if( favorite &&
366            this.type != TB_type_edit &&
367            // ezt a feltetelt csak valoszinusitem, hogy kell
368            this.type != TB_type_last10 ) {
369
370            // Megkeressuk kedvenc elemet:
371            for( let key in Mbs_dimtype_cur ) {
372                if( ! Mbs_dimtype_cur.hasOwnProperty(key) )
373                    continue;
374                ////
375                const e = Mbs_dimtype_cur[key];
376                if( e.ID == data_fav.nSportUnitRef ) {
377                    // Megvan elem:
378
379                    // Mennyiseg megdolgozasa:
380                    Mbs.num = trim_unnec_zeros( data_fav.nQuantity );
381                    mbs_init_when_quan( Mbs.num ); // ki is tesszuk
382
383                    Mbs_dimtype_sel_index = key;
384                    break;
385                }
386            }
387        }
388
389        //                                ||||||
390        // BEIRNI last10 feltetelt is ide vvvvvv
391
392        if( this.type == TB_type_edit ||
393            this.type == TB_type_last10 ) {
394            // edit es last10 eseten sport unit ref es quan
395            // meg vannak adva
396
397            // Mennyiseg megdolgozasa:
398            let f = trim_unnec_zeros( this.quan );
399            mbs_init_when_quan( f );
400
401            // Megkeressuk a megadott unit-ot:
402            for( let key in Mbs_dimtype_cur ) {
403                if( ! Mbs_dimtype_cur.hasOwnProperty(key) )
404                    continue;
405
406                const e = Mbs_dimtype_cur[key];
407                if( e.ID == this.unit_id ) {
408                    // Megvan elem:
409                    Mbs_dimtype_sel_index = key;
410                    break;
411                }
412            }
413        }
414
415        // Eldontjuk, hogy mertekegysegeknek kell-e popup menu:
416        if( Mbs_dimtype_cur.length > 4 ) {
417            // Tul sok mertekegyseg van, kell popup menu:
418            Mbs_dimtype_with_pup = true;
419        }
420        else {
421            // Nem kell popup menu, unitok anelkul is kifernek:
422            Mbs_dimtype_with_pup = false;
423        }
424
425        // Mennyiseg mezobe kiirjuk mennyiseget:
426        Mbs.num_field.innerHTML = Mbs.num;
427        // Kiteszunk moge egy kek teglalapot, mintha kijeloles lenne:
428        let jq = $(Mbs.num_field);
429
430        let width = jq.width() + 8;
431
432        let box_size = 82;
433        if( Glb_mb_dtop )
434            box_size = 113; // 133
435        let left = (box_size-width)/2 + 'px'; // 82
436        $('#tabbox_s .mbs .when .num_highlight').css('marginLeft', left)
437            .css('width', width + 'px')
438            .show();
439
440        // Mertekegysegek hatter szinet es szoveget alaphelyzetbe allitjuk:
441        $('#tabbox_s .mbs .when .dimtype').css('backgroundColor', '')
442            .css('borderColor', '')
443            .html('');
444
445        // Nyil gomb vagy van, vagy nincs:
446        if( Mbs_dimtype_with_pup ) {
447            // Nyil gomb van (valojaban 'more' gomb):
448            $('#tabbox_s .mbs .when .dimtype_3')
449                .css('backgroundColor', '')
450                .css('backgroundImage', 'url(../tpls/_img/more.png)')
451                .css('borderColor', '')
452                .html('');
453        }
454        else {
455            // Nyil gombot is alaphelyzetbe allitjuk, mintha
456            // mertekegyseg lenne:
457            $('#tabbox_s .mbs .when .dimtype_3')
458                .css('backgroundColor', '')
459                .css('backgroundImage', '')
460                .css('borderColor', '')
461                .html('');
462        }
463
464        // Popup menuben levo mertekegyseg kockakat eltuntetjuk:
465        $('#tabbox_s .mbs .when .pup3 .dimtype').css('display', 'none');
466
467        // Ha kivalasztott popup menuben van, akkor becsereljuk lathatoba:
468        // Mbs_dimtype_sel_index eddig csuszas nelkuli index volt:
469        if( Mbs_dimtype_with_pup &&
470            Mbs_dimtype_sel_index >= 3 ) {
471
472            let tmp = Mbs_dimtype_cur[0];
473            Mbs_dimtype_cur[0] = Mbs_dimtype_cur[Mbs_dimtype_sel_index];
474            Mbs_dimtype_cur[Mbs_dimtype_sel_index] = tmp;
475
476            Mbs_dimtype_sel_index = 0;
477        }
478
479        for( let j = 0; j <= Mbs_dimtype_but_max_num; j++ ) {
480            if( ! (j in Mbs_dimtype_cur) )
481                break;
482
483            let button_index = j; // lehet hogy eltolodik
484            if( Mbs_dimtype_with_pup && j >= 3 ) {
485                // Lefele nyil miatt ez a mertekegyseg eggyel csuszik:
486                button_index++;
487            }
488
489            mbs_write_dim_button( j, button_index );
490            //$('.mbs .when .dimtype_' + button_index).
491            //                        html(Mbs_dimtype_cur[j].Name);
492
493            if( button_index >= 4 )
494                $('#tabbox_s .mbs .when .dimtype_' + button_index)
495                                            .css('display', 'block');
496
497            // Ha nincs favorite, akkor Mbs_dimtype_sel_index
498            // ugyis 0:
499            // Es Mbs_dimtype_sel_index sosem kerul popup menube,
500            // mert akkor becserelodik lathatoba:
501            if( j == Mbs_dimtype_sel_index ) {
502                // O a kivalasztott:
503                // (biztos hogy lathato helyen van)
504
505                // Ez hasznalja ezeket:
506                //      Mbs_dimtype_sel_index
507                //      Mbs_dimtype_cur
508                //      Mbs.num
509                let kcal = mbs_display_grey_weight_and_cal();
510                if( this.type == TB_type_edit )
511                    Mbs_when_edit_mode_initial_kcal = kcal;
512            }
513        }
514
515        setTimeout( function () {
516            const jq2 = $('#tabbox_s .mbs .when .num_input input');
517            jq2.select().focus();
518        }, 500 );
519    }
520
521    // ez beanimalja, vagy csak siman megjeleniti tabbox-ot
522    // tabbox_open_orig_type alapjan donti el, hogy hogyan csinalja
523    make_tabbox_appear() {
524
525        let body = $( "body" );
526        let tabbox = $( "#tabbox_s" );
527        let darkener = $( "#tabbox_outside_darkener" );
528
529        body.addClass( "tabbox_open" );
530
531        // mindenhol van animacio, kiveve mobil ktl-es nyitasnal
532        this.animation_on = true;
533        if( ! Glb_mb_dtop && this.get_tabbox_type() == TB_type_ktl )
534            this.animation_on = false;
535
536        let top;
537        if( this.get_tabbox_type() == TB_type_edit ) {
538            // a szoban forgo megevett etel fole pozicionaljuk
539            let top1 = $( ".siteContainer" ).offset().top;
540            let top2 = this.offset_top;
541            top = top2 - top1;
542            top -= 5;
543        }
544        else {
545            // minden mas esetben a kereso mezo fole tesszuk
546            if( Glb_mb_dtop ) {
547                let top1 = $( ".siteContainer" ).offset().top;
548                let top2 = $( ".mbs .sear" ).offset().top;
549                top = top2 - top1;
550
551                top -= 5;
552            }
553            else {
554                let top1 = $( ".siteContainer" ).offset().top;
555                let top2 = $( ".mbs .sear" ).offset().top;
556                top = top2 - top1;
557
558                top -= 5;
559
560                // top = $( ".pageMain" ).offset().top;
561                // top -= 5;
562            }
563        }
564
565        // akkor kell beallitani tabbox tetejet
566        // ha desktop-os a mukodes
567        // vagy ha mobilon van animacio
568        // (ha mobilon nincsen animacio, akkor felesleges allitgatni
569        // a tetejet, mert ugyis tabbox egyedul van kint site-bol)
570        if( Glb_mb_dtop || this.animation_on ) {
571            tabbox.addClass( "lefttop_8736467542" );
572            tabbox.css( "top", top + "px" );
573            if( Glb_mb_dtop )
574                tabbox.css( "left", "45px" );
575            else
576                tabbox.css( "left", "0" );
577        }
578
579        let on_animation_complete = () => {
580
581            this.scroll_top_after_move = $( "html" ).scrollTop();
582
583            if( !Glb_mb_dtop ) {
584                body.addClass( "tabbox_alone tabbox_all_alone" );
585            }
586        };
587
588        // elinditjuk animaciot
589
590        if( this.animation_on ) {
591            this.anim_time = TB_open_anim_time;
592        }
593        else {
594            this.anim_time = 1;
595        }
596
597        tabbox.slideDown( this.anim_time, Anim_easing, on_animation_complete );
598
599        darkener.css( "opacity", "0" );
600        if( Glb_mb_dtop ) {
601            darkener.animate(
602                {
603                    opacity: "+=0.7"
604                },
605                this.anim_time
606            );
607        }
608        else {
609            darkener.animate(
610                {
611                    opacity: "+=1"
612                },
613                this.anim_time
614            );
615        }
616
617
618        this.scroll_top_before_move = $( "html" ).scrollTop();
619
620        // meg felgorgetjuk kepernyot, ha kell
621        if( this.animation_on && !Glb_mb_dtop ) {
622
623            let top = tabbox.offset().top;
624
625            $( 'html, body' ).animate( {
626                scrollTop: top
627            }, this.anim_time, Anim_easing );
628        }
629    }
630
631    // ez kianimalja, vagy csak siman hide-olja tabbox-ot
632    // talan tabbox_open_orig_type alapjan donti el, hogy hogyan
633
634    // (ha ktl-bol nyilt meg, akkor mbf_when_sendfood_clk-nek kell
635    // hivnia mbf_pup_open_click-et)
636    async make_tabbox_disappear() {
637
638        if( !this.tabbox_visible )
639            return;
640
641        let body = $( "body" );
642        let tabbox = $( "#tabbox_s" );
643        let darkener = $( "#tabbox_outside_darkener" );
644
645        body.removeClass( "tabbox_alone tabbox_all_alone" );
646
647        if( this.animation_on ) {
648            if( Glb_mb_dtop ) {
649                darkener.animate(
650                    {
651                        opacity: "-=0.7"
652                    },
653                    this.anim_time
654                );
655            }
656            else {
657                darkener.animate(
658                    {
659                        opacity: "-=1"
660                    },
661                    this.anim_time
662                );
663            }
664        }
665
666        // tabbox maradjon a kepernyo tetejen akkor is, ha tabbox
667        // melle visszakapcsoljuk a site-ot
668        if( !Glb_mb_dtop )
669            $( "html" ).scrollTop( this.scroll_top_after_move );
670
671        // meg visszagorgetjuk kepernyot az eredeti helyere, ha kell
672        if( this.animation_on && !Glb_mb_dtop ) {
673
674            $( 'html' ).animate( {
675                scrollTop: this.scroll_top_before_move
676            }, this.anim_time, Anim_easing );
677        }
678
679        await my_slideUp( tabbox, this.anim_time );
680
681        // -------------------------------------
682        //   ide animacio lejatszodas utan jut
683        // -------------------------------------
684
685        this.tabbox_visible = false;
686
687        // ezek mar csukas kezdetekor is remove-olva voltak. hogy
688        // miert vannak itt meg egyszer remove-olva, arrol eteles
689        // make_tabbox_disappear-ben van vmennyi magyarazat
690        body.removeClass( "tabbox_alone tabbox_all_alone" );
691
692
693        body.removeClass( "tabbox_open" );
694
695        this.reset_data_at_close();
696    }
697
698    get_tabbox_type() {
699        return int_or_zero( this.tabbox_open_orig_type );
700    }
701
702    // lekeri es frissiti az uj ikon adatokat
703    async refresh_icon_strip() {
704
705        if( ! this.tabbox_visible )
706            return null; // null warning miatt
707
708        // lekerjuk az uj ikon adatokat
709        let data = await my_getJSON(
710            $url + "/food.php",
711            {
712                show:   "getsportme",
713                id:     this.sport_id,
714                syn_id: this.syn_id
715            }
716        );
717
718        this.icon_strip_setup( data.own, data.fav );
719    }
720
721    async tesztelo() {
722
723        let fn_prom;
724        let myprom = new Promise ( function ( resolve ) {
725            fn_prom = function ( u ) {
726                resolve( 15 );
727            };
728        });
729
730        // aaaa
731
732        fn_prom( 38 );
733
734        // myprom.then( function( q ) {
735        //     let p = q + 2;
736        //     p = p + this.type; // nem latszik this
737        //     let k = p + 4;
738        // });
739
740        let q = await myprom;
741
742        let p = q + 2;
743        p = p + this.type; // latszik this
744        let k = p + 4;
745    }
746
747    sport_del_common_own_and_fav( del_fav ) {
748
749        let showtext = 'delownsport';
750        if( del_fav )
751            showtext = 'delfavsport';
752
753        $.ajax( {
754            url: $url + '/food.php',
755            dataType: 'text',
756            data: {
757                show: showtext,
758                id:   this.sport_id
759            },
760            success: async function ( data ) {
761
762                // valtozasokkal frissitjuk listat
763                if( Mbs_flist_reload )
764                    Mbs_flist_reload();
765
766
767                // lehet megcsinaltam listat is kene frissiteni
768
769
770                // lekeri es frissiti az uj ikon adatokat
771                Tabbox_s.refresh_icon_strip();
772            }
773        });
774    }
775
776    icon_addfav_click() {
777        // mbs_addfavsport_2(583,1.00,5,128);
778        //mbs_addfavsport_2
779
780        let quan;
781        let unit_id;
782
783        // aaaa
784
785        if( this.type == TB_type_edit ) {
786            // megevett etel unitjat hasznaljuk
787            quan    = this.quan;
788            unit_id = this.unit_id;
789        }
790        else {
791
792            quan = 1;
793
794            // default unitot hasznaljuk
795
796            // ebbol vesszuk ki
797            for( let [key, val] of Object.entries( this.prev_data ) ) {
798                const new_unit_id = int_or_zero( val.ID );
799                if( new_unit_id > 0 && val.bDefault > 0 ) {
800                    unit_id = new_unit_id;
801                    break;
802                }
803            }
804
805            if( ! unit_id )
806                throw "err_293647865";
807        }
808
809        if( ! unit_id || quan == 0 )
810            throw "err_266556725";
811
812        mbs_addfavsport_2( this.sport_id, quan, unit_id, this.syn_id );
813    }
814}
815
816function tabbox_s_close() {
817    Tabbox_s.make_tabbox_disappear();
818}
819
820function tabbox_s_closer_clicked( this_par, event ) {
821    tabbox_s_close();
822}
823
824// IKON LEKEZELOK KEZDODNEK
825
826function tabbox_s_icon_deldone_click( this_par, event ) {
827    mbs_delsport_mb( Tabbox_s.su_id );
828
829    Tabbox_s.make_tabbox_disappear();
830}
831
832function tabbox_s_icon_delown_click( this_par, event ) {
833
834    const del_fav = false; // nem fav, hanem own torles
835    Tabbox_s.sport_del_common_own_and_fav( del_fav );
836
837    if( Mbs_flist_reload )
838        Mbs_flist_reload();
839
840    Tabbox_s.make_tabbox_disappear();
841}
842
843function tabbox_s_icon_delfav_click( this_par, event ) {
844
845    const del_fav = true; // nem own, hanem fav torles
846    Tabbox_s.sport_del_common_own_and_fav( del_fav );
847
848    if( Mbs_flist_reload )
849        Mbs_flist_reload();
850
851    // Tabbox_s.make_tabbox_disappear();
852}
853
854function tabbox_s_icon_addfav_click( this_par, event ) {
855
856    Tabbox_s.icon_addfav_click();
857}
858
859function tabbox_s_icon_copy_click( this_par, event ) {
860
861    if( Tabbox_s.get_tabbox_type() != TB_type_edit )
862        return; // ilyennek eleve nem szabadna elofordulnia
863
864    copysport( Tabbox_s.su_id );
865
866    // bezarjuk, mint ahogyan eteleknel is bezarodik ilyenkor
867    // Tabbox_s.make_tabbox_disappear();
868}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.