PageSourceSearch

https://bogote.hu/js/functions.js

js bogote.hu collected 2026-10-02 22:21:57 UTC 22,951 bytes, 611 lines download raw bytes

1$(function () {
2    //$("a.fancy").fancybox({'hideOnContentClick': false, 'frameWidth': 350, 'frameHeight': 200});
3    anch = getAnchor();     
4
5    $('.languagechooser').hide();
6
7    $("a.fancy").fancybox({
8        //'padding'               : 10,           //Space between FancyBox wrapper and content
9        //'scrolling'             : 'auto',       //Set the overflow CSS property to create or hide scrollbars. Can be set to 'auto', 'yes', or 'no'
10        //'autoScale'             : true,         //If true, FancyBox is scaled to fit in viewport
11        //'autoDimensions'        : true,         //For inline and ajax views, resizes the view to the element recieves. Make sure it has dimensions otherwise this will give unexpected results
12        //'centerOnScroll'        : false,        //When true, FancyBox is centered while scrolling page
13        //'hideOnOverlayClick'    : true,         //Toggle if clicking the overlay should close FancyBox
14        //'hideOnContentClick'    : false,        //Toggle if clicking the content should close FancyBox
15        //'overlayShow'           : true,         //Toggle overlay
16        'overlayOpacity'        : 0.7,          //Opacity of the overlay (from 0 to 1; default - 0.3)
17        'overlayColor'          : '#000'       //Color of the overlay
18        //'titleShow'             : true,         //Toggle title
19        //'titlePosition'         : 'inside',     //The position of title. Can be set to 'outside', 'inside' or 'over'
20        //'transitionIn'          : 'none',       //The transition type. Can be set to 'elastic', 'fade' or 'none'
21        //'transitionOut'         : 'none',       //The transition type. Can be set to 'elastic', 'fade' or 'none'
22        //'speedIn'               : 300,          //Speed of the fade and elastic transitions, in milliseconds
23        //'speedOut'              : 300,          //Speed of the fade and elastic transitions, in milliseconds
24        //'changeSpeed'           : 300,          //Speed of resizing when changing gallery items, in milliseconds
25        //'changeFade'            : 'fast',       //Speed of the content fading while changing gallery items
26        //'showCloseButton'       : true,         //Toggle close button
27        //'showNavArrows'         : true,         //Toggle navigation arrows
28        //'enableEscapeButton'    : true          //Toggle if pressing Esc button closes FancyBox
29    });
30
31    //$('img.fancyimg').wrap('<a href="'+$('img.fancyimg').attr('src')+'" class="fancyimg"></a>');
32
33    $.each($('img.fancyimg'), function( key, value ) {
34        $(this).wrap('<a href="'+$(this).attr('src')+'" rel="gallery" class="fancyimg"></a>');
35    });
36
37    $("a.fancyimg").fancybox({
38        'overlayOpacity'        : 0.7,          //Opacity of the overlay (from 0 to 1; default - 0.3)
39        'overlayColor'          : '#000'       //Color of the overlay
40    });
41
42    /*$("a.fancyinline").fancybox({
43        'overlayOpacity'        : 0.7,          //Opacity of the overlay (from 0 to 1; default - 0.3)
44        'overlayColor'          : '#000',       //Color of the overlay
45        'width'                 : 1024,
46        'height'                : 500,
47        'centerOnScroll'        : true,
48        //'autoScale'             :   false,         //if using older fancybox
49        'autoSize'              :   true,         //if using newer fancybox
50        'padding'               : 0,
51        onComplete: function(){
52            $("#fancybox-wrap").css({'width': '1024', 'padding': '0', 'margin': '0 -20px'});
53            $.fancybox.center();
54        }
55    });*/
56
57    $(window).bind('resize', function() {
58        $.fancybox.center();
59        $.fancybox.resize();
60    });
61
62    $('<link href="/css/styles_lang.css" rel="stylesheet" type="text/css" media="screen, print" />').prependTo('head');
63    $('<link href="/css/styles_urlapok.css" rel="stylesheet" type="text/css" media="screen, print" />').prependTo('head');
64    
65    $.get('/'+_lang+'/jsrpc/getLanguages/', function(data) {
66        $('body').prepend(data);
67    });
68
69    $.get('/'+_lang+'/jsrpc/getWebgenerator/', function(data) {
70        $('#footer').append(data);
71    });
72
73    if ( _show_page_search === true ) {
74        $.get('/'+_lang+'/jsrpc/getSiteSearch/', function(data) {
75            $('#footer').append(data);
76        });
77    }
78
79    if (typeof details != 'undefined') {
80        setTimeout(function() {
81            if ( anch != '' && $("#"+anch).length > 0 ) {
82                scrollToIndexBlock(anch);
83
84            } else {
85                $('html, body').animate({
86                    scrollTop: parseInt(($('#data').offset().top) - ((typeof top_offset != 'undefined')?top_offset:0)) + 'px'
87                }, 250);
88            }
89        }, 500);
90    }
91
92    /*
93    ** swiper-container
94    **/
95    if ($('div').hasClass('swiper-container')) {
96        $('.setcolor').css('color', '#'+colors[0]);
97        $('.logo_txt strong').css({
98            'border-color': '#'+colors[0],
99            'color': '#'+colors[0]
100        });
101
102        var swiper = new Swiper('.swiper-container', {
103            pagination: '.swiper-pagination',
104            slidesPerView: 1,
105            paginationClickable: true,
106            spaceBetween: 0,
107            loop: false,
108            autoplay: 5000,
109            speed: 1000,
110            effect: 'fade',
111            onSlideChangeStart: function(swiper){
112                $('.img_txt').fadeOut();
113                $('#txt'+parseInt(swiper.activeIndex+1)).fadeIn();
114
115                $('.setcolor').css('color', '#'+colors[swiper.activeIndex]);
116
117                if ($('a').hasClass('logo_txt')) {
118                    $('.logo_txt strong').css({
119                        'border-color': '#'+colors[swiper.activeIndex],
120                        'color': '#'+colors[swiper.activeIndex]
121                    });
122                }
123
124                $('.logo_icons').hide(0);
125                $('.pictograms .logo_icons').eq(swiper.activeIndex).show(0);
126            } 
127        });        
128
129        if (swiper.slides.size() <= 1) {
130            $('.swiper-pagination').css('visibility', 'hidden');
131        }
132    }
133
134    // SlimScroll
135    if ( $('.list_items').length > 0 ) {
136        setTimeout(function() {
137            $('.list_items').slimScroll({
138                height: 'auto',
139                alwaysVisible: true
140                
141            }).bind('slimscroll', function(e, pos) {
142                //console.log("Reached " + pos);
143            });
144        }, 500);        
145    }
146
147    $.mask.definitions['p'] = "[0-9()\-]"; 
148    $("#fp_email_kapcsolat_phone").mask("+pppppp?pppppppppppppp");
149    $('.phone').mask("+pppppp?pppppppppppppp");
150    //$('.phone').mask("+36 (99) 999-999?9");
151
152    $('.precent').mask("99% / 99%");
153    $('.bszsz').mask("99999999 - 99999999 - ?99999999");
154    $('.tax').mask("99999999 - 9 - 99");
155    $('.hourmin').mask("99:99");
156
157    $('.js-foods-toggle-cat').bind('click', function() {      
158        $('.js-foods-toggle-cat.current').not(this).each( function( index, element ){
159            $(this).click();
160        });
161              
162        $('#'+this.id+'_container').slideToggle(300);
163        
164        $(this).toggleClass('current');
165    });
166    $('.js-foods-open-category').bind('click', function() {      
167        $('.js-foods-toggle-cat.current').each( function( index, element ){
168            $(this).click();
169        });
170
171        $('#'+$(this).attr('data-container')).slideToggle(300);
172        
173        $(this).toggleClass('current');
174        $('#'+$(this).attr('data-cat')).toggleClass('current');
175
176        var _item_scrollto = $('#'+$(this).attr('href').replace('#', ''));
177        setTimeout(function() {
178            $('html,body').animate({
179                scrollTop: _item_scrollto.offset().top - 50},
180                'slow');
181        }, 600);
182
183        return false;
184    });
185
186    $('.js-product-price-select').change(function(event) {
187        $.ajax({
188            'url': '/'+_lang+'/' + $(this).attr('data-url') + '/get-selected-price/',
189            'type': "POST",
190            'data': {
191                'item_id': $(this).attr('data-id'),
192                'price_id': $(this).val()
193            },
194            'success': function( data ) {
195                $('#js-product-selected-price').html(data);
196            }
197        });        
198    });
199
200    $('.js-dlist-price-select').change(function(event) {
201        $.ajax({
202            'url': '/'+_lang+'/' + $(this).attr('data-url') + '/get-selected-price/',
203            'type': "POST",
204            'dataType': 'json',
205            'data': {
206                'item_id': $(this).attr('data-id'),
207                'price_id': $(this).val()
208            },
209            'success': function( data ) {
210                $('#js-dlist-selected-price').html(data.html);
211
212                $('.js-dlist-mfcode-number').html(data.mfcode);
213                if (data.mfcode != '') {
214                    $('.js-dlist-mfcode-container').show();
215                } else {
216                    $('.js-dlist-mfcode-container').hide();
217                }
218            }
219        });
220    });
221
222    $('.responsive .btn_close').bind('click', function() {
223        $('.responsive.mobile_filter').removeClass('open').css('left', '0').animate({left: '-100%'}, 500);
224    });
225
226    $('.responsive.detail').bind('click', function() {
227        $('.responsive.mobile_filter').animate({left: 0}, 500);
228    });
229
230});
231
232function captchaSubmitBlogCommentForm(data) {
233    document.getElementById("blog-comment-form").submit();
234}
235    
236function validateSearchKeywordLength() {
237    var searchKeyword = jQuery.trim($('#search-input').val());
238
239    if ( searchKeyword.length < 3) {
240        alert(_show_page_search_error_1);
241        return false;
242    }
243}
244
245function scrollToIndexBlock(module_url) {
246    block = $("#"+module_url);
247
248    $('html, body').animate({
249        scrollTop: (block.offset().top - 30)
250    }, 1000);
251}
252
253function getAnchor() {
254    var myFile = document.location.toString();
255    if (myFile.match('#'))
256      return myAnchor = myFile.split('#')[1];
257
258    return '';
259}
260
261// Kosár kezelés
262function addFoodToBasket(e) {
263    var food_id = $(e).attr('data-id');
264    var amount  = $("input[name='basket_amount_"+food_id+"']").val();
265    var type    = $("input[name='basket_type_"+food_id+"']:checked").val();
266
267    if ( !(amount >= 1) ) {
268        sweetAlert(GLOBAL_MESSAGES.global_error, GLOBAL_MESSAGES.orders_empty_amount, "error");
269        return false;
270    } else {
271        $.ajax({
272            'dataType': 'json',
273            'url': '/'+_lang+'/storehandler/set/',
274            'type': "POST",
275            'data': {
276                'module': 'foods',
277                'item_id': food_id,
278                'subitem_id': type,
279                'amount': amount
280            },
281            'success': function( data ) {
282
283                if (typeof(data.msg) == 'undefined' || (typeof(data.msg) != 'undefined' && data.msg == 'fail')) {
284                    sweetAlert(GLOBAL_MESSAGES.global_error, GLOBAL_MESSAGES.orders_to_basket_failed, "error");
285                } else {
286                    setBasketSumData(data.sum);
287
288                    swal({
289                      title: GLOBAL_MESSAGES.orders_to_basket_success,
290                      type: "success",
291                      showCancelButton: true,
292                      confirmButtonColor: "#DD6B55",
293                      confirmButtonText: GLOBAL_MESSAGES.orders_go_to_basket,
294                      cancelButtonText: GLOBAL_MESSAGES.orders_continue_shopping,
295                      closeOnConfirm: false
296                    },
297                    function(){
298                        window.location="/"+_lang+"/rendeles/";
299                    });
300                }
301            }
302        });
303    }
304}
305
306function addDrinkToBasket(e) {
307    var drink_id = $(e).attr('data-id');
308    var amount  = $("input[name='basket_amount_"+drink_id+"']").val();
309    var type    = $("input[name='basket_type_"+drink_id+"']:checked").val();
310
311    if ( !(amount >= 1) ) {
312        sweetAlert(GLOBAL_MESSAGES.global_error, GLOBAL_MESSAGES.orders_empty_amount, "error");
313        return false;
314    } else {
315        $.ajax({
316            'dataType': 'json',
317            'url': '/'+_lang+'/storehandler/set/',
318            'type': "POST",
319            'data': {
320                'module': 'drinks',
321                'item_id': drink_id,
322                'subitem_id': type,
323                'amount': amount
324            },
325            'success': function( data ) {
326
327                if (typeof(data.msg) == 'undefined' || (typeof(data.msg) != 'undefined' && data.msg == 'fail')) {
328                    sweetAlert(GLOBAL_MESSAGES.global_error, GLOBAL_MESSAGES.orders_to_basket_failed, "error");
329                } else {
330                    setBasketSumData(data.sum);
331
332                    swal({
333                      title: GLOBAL_MESSAGES.orders_to_basket_success,
334                      type: "success",
335                      showCancelButton: true,
336                      confirmButtonColor: "#DD6B55",
337                      confirmButtonText: GLOBAL_MESSAGES.orders_go_to_basket,
338                      cancelButtonText: GLOBAL_MESSAGES.orders_continue_shopping,
339                      closeOnConfirm: false
340                    },
341                    function(){
342                        window.location="/"+_lang+"/rendeles/";
343                    });
344                }
345            }
346        });
347    }
348}
349
350function addMenuToBasket(e) {
351    var menu_id = $(e).attr('data-id');
352    var amount  = parseInt($("input[name='basket_amount_"+menu_id+"']").val());
353
354    if ( !(amount >= 1) ) {
355        sweetAlert(GLOBAL_MESSAGES.global_error, GLOBAL_MESSAGES.orders_empty_amount, "error");
356        return false;
357    } else {
358        $.ajax({
359            'dataType': 'json',
360            'url': '/'+_lang+'/storehandler/set/',
361            'type': "POST",
362            'data': {
363                'module': 'menus',
364                'item_id': menu_id,
365                'amount': amount
366            },
367            'success': function( data ) {
368
369                if (typeof(data.msg) == 'undefined' || (typeof(data.msg) != 'undefined' && data.msg == 'fail')) {
370                    sweetAlert(GLOBAL_MESSAGES.global_error, GLOBAL_MESSAGES.orders_to_basket_failed, "error");
371                } else {
372                    setBasketSumData(data.sum);
373
374                    $(e).closest('td').addClass('menu-ordered');
375
376                    ordered_num = parseInt($(e).closest('td').find('.basket_in span').html()) || 0;
377                    $(e).closest('td').find('.basket_in span').html(ordered_num + amount);
378                    $(e).closest('td').find('.basket_in').show();
379
380                    swal({
381                      title: GLOBAL_MESSAGES.orders_to_basket_success,
382                      type: "success",
383                      showCancelButton: true,
384                      confirmButtonColor: "#DD6B55",
385                      confirmButtonText: GLOBAL_MESSAGES.orders_go_to_basket,
386                      cancelButtonText: GLOBAL_MESSAGES.orders_continue_shopping,
387                      closeOnConfirm: false
388                    },
389                    function(){
390                        window.location="/"+_lang+"/rendeles/";
391                    });
392                }
393            }
394        });
395    }
396}
397
398function addProductToBasket(e) {
399    var product_id = $(e).attr('data-id');
400    var amount  = parseInt($("input[name='basket_amount_"+product_id+"']").val());
401    var type    = ($("select[name='basket_type_"+product_id+"']").length > 0) ? $("select[name='basket_type_"+product_id+"']").val() : -1;
402
403    if ( !(amount >= 1) ) {
404        sweetAlert(GLOBAL_MESSAGES.global_error, GLOBAL_MESSAGES.orders_empty_amount, "error");
405        return false;
406    } else {
407        $.ajax({
408            'dataType': 'json',
409            'url': '/'+_lang+'/storehandler/set/',
410            'type': "POST",
411            'data': {
412                'module': 'products',
413                'item_id': product_id,
414                'subitem_id': type,
415                'amount': amount
416            },
417            'success': function( data ) {
418
419                if (typeof(data.msg) == 'undefined' || (typeof(data.msg) != 'undefined' && data.msg == 'fail')) {
420                    sweetAlert(GLOBAL_MESSAGES.global_error, GLOBAL_MESSAGES.orders_to_basket_failed, "error");
421                } else {
422                    setBasketSumData(data.sum);
423
424                    $(e).closest('td').addClass('menu-ordered');
425
426                    ordered_num = parseInt($(e).closest('td').find('.basket_in span').html()) || 0;
427                    $(e).closest('td').find('.basket_in span').html(ordered_num + amount);
428                    $(e).closest('td').find('.basket_in').show();
429
430                    swal({
431                      title: GLOBAL_MESSAGES.orders_to_basket_success,
432                      type: "success",
433                      showCancelButton: true,
434                      confirmButtonColor: "#DD6B55",
435                      confirmButtonText: GLOBAL_MESSAGES.orders_go_to_basket,
436                      cancelButtonText: GLOBAL_MESSAGES.orders_continue_shopping,
437                      closeOnConfirm: false
438                    },
439                    function(){
440                        window.location="/"+_lang+"/rendeles/";
441                    });
442                }
443            }
444        });
445    }
446}
447
448function addDlistItemToBasket(e) {
449    var dlitem_id = $(e).attr('data-id');
450    var amount  = parseInt($("input[name='basket_amount_"+dlitem_id+"']").val());
451    var type    = ($("select[name='basket_type_"+dlitem_id+"']").length > 0) ? $("select[name='basket_type_"+dlitem_id+"']").val() : -1;
452
453    if ( !(amount >= 1) ) {
454        sweetAlert(GLOBAL_MESSAGES.global_error, GLOBAL_MESSAGES.orders_empty_amount, "error");
455        return false;
456    } else {
457        $.ajax({
458            'dataType': 'json',
459            'url': '/'+_lang+'/storehandler/set/',
460            'type': "POST",
461            'data': {
462                'module': 'dynamiclists',
463                'item_id': dlitem_id,
464                'subitem_id': type,
465                'amount': amount
466            },
467            'success': function( data ) {
468                if (typeof(data.msg) == 'undefined' || (typeof(data.msg) != 'undefined' && data.msg == 'fail')) {
469                    if (typeof(data.error_msg) != 'undefined' && data.error_msg !== '') {
470                        sweetAlert(GLOBAL_MESSAGES.global_error, data.error_msg, "error");
471                    } else {
472                        sweetAlert(GLOBAL_MESSAGES.global_error, GLOBAL_MESSAGES.orders_to_basket_failed, "error");
473                    }
474                } else {
475                    setBasketSumData(data.sum);
476
477                    $(e).closest('td').addClass('menu-ordered');
478
479                    ordered_num = parseInt($(e).closest('td').find('.basket_in span').html()) || 0;
480                    $(e).closest('td').find('.basket_in span').html(ordered_num + amount);
481                    $(e).closest('td').find('.basket_in').show();
482
483                    swal({
484                      title: GLOBAL_MESSAGES.orders_to_basket_success,
485                      type: "success",
486                      showCancelButton: true,
487                      confirmButtonColor: "#DD6B55",
488                      confirmButtonText: GLOBAL_MESSAGES.orders_go_to_basket,
489                      cancelButtonText: GLOBAL_MESSAGES.orders_continue_shopping,
490                      closeOnConfirm: false
491                    },
492                    function(){
493                        window.location="/"+_lang+"/rendeles/";
494                    });
495                }
496            }
497        });
498    }
499}
500
501function deleteBasketItem(el, id) {
502    swal({
503      title: GLOBAL_MESSAGES.global_system_message,
504      text: GLOBAL_MESSAGES.orders_basket_delete_confirm,
505      type: "warning",
506      showCancelButton: true,
507      confirmButtonColor: "#DD6B55",
508      confirmButtonText: GLOBAL_MESSAGES.orders_basket_delete_confirm_yes,
509      cancelButtonText: GLOBAL_MESSAGES.orders_basket_delete_cancel,
510      closeOnConfirm: false
511    },
512    function(){
513        $.ajax({
514            'url': '/'+_lang+'/storehandler/del/'+id+'/',
515            'dataType': 'json',
516            'success': function(param) {
517                window.location.reload();
518            }
519        });
520    });    
521}    
522
523function setBasketSumData(data) {
524    if (typeof(data) != 'undefined') {
525        if (typeof(data.count) == 'undefined'){
526            data.count = 0;
527        }
528        if (typeof(data.price_huf) == 'undefined'){
529            data.price_huf = 0;
530        }
531        if (typeof(data.price_eur) == 'undefined'){
532            data.price_eur = 0;
533        }  
534
535        $('.basket-sum-count').html(data.count);              
536        $('#basket-sum-price-huf').html(number_format(data.price_huf, 0, '', ' '));              
537        $('#basket-sum-price-eur').html(number_format(data.price_eur, 2, '.', ' '));              
538    }
539}
540
541function number_format(a, b, c, d) {
542    a = Math.round(a * Math.pow(10, b)) / Math.pow(10, b);
543    e = a + '';
544    f = e.split('.');
545
546    if (!f[0])
547        f[0] = '0';
548
549    if (!f[1])
550        f[1] = '';
551
552    if (f[1].length < b) {
553        g = f[1];
554
555        for (i=f[1].length + 1; i <= b; i++)
556            g += '0';
557
558        f[1] = g;
559    }
560
561    if(d != '' && f[0].length > 3) {
562        h = f[0];
563        f[0] = '';
564
565        for(j = 3; j < h.length; j+=3) {
566            i = h.slice(h.length - j, h.length - j + 3);
567            f[0] = d + i +  f[0] + '';
568        }
569
570        j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3));
571        f[0] = j + f[0];
572    }
573
574    c = (b <= 0) ? '' : c;
575
576    return f[0] + c + f[1];
577}
578
579var delay = (function(){
580  var timer = 0;
581  return function(callback, ms){
582    clearTimeout (timer);
583    timer = setTimeout(callback, ms);
584  };
585})();
586
587function MenuLoadWeekTable(e) {
588
589    $.ajax({
590        'url': $(e).attr('href'),
591        'type': "GET",
592        'success': function( data ) {
593            $('#menu-table-container').html(data);
594            $('#menu-order-container').addClass('menu_layer');
595        }
596    });
597}
598
599/*
600function keyPressedAkadalymentes(e) {
601    var item = $(e.target);
602    console.log('Element: ', item);
603
604    if (e.keyCode == '38') {
605        item.prev().focus();
606    } else if (e.keyCode == '40') {
607        item.next().focus();
608    }
609}
610document.onkeydown = keyPressedAkadalymentes;
611 */

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.