PageSourceSearch

https://www.pizzaria.co.uk/catalog/view/javascript/product_aiq.js

js pizzaria.co.uk collected 2026-10-06 12:52:56 UTC 11,834 bytes, 237 lines download raw bytes

1var docCookies = {
2  getItem: function (sKey) {
3    if (!sKey) { return null; }
4    return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
5  },
6  setItem: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) {
7    if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; }
8    var sExpires = "";
9    if (vEnd) {
10      switch (vEnd.constructor) {
11        case Number:
12          sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd;
13          break;
14        case String:
15          sExpires = "; expires=" + vEnd;
16          break;
17        case Date:
18          sExpires = "; expires=" + vEnd.toUTCString();
19          break;
20      }
21    }
22    document.cookie = encodeURIComponent(sKey) + "=" + encodeURIComponent(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : "");
23    return true;
24  },
25  removeItem: function (sKey, sPath, sDomain) {
26    if (!this.hasItem(sKey)) { return false; }
27    document.cookie = encodeURIComponent(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "");
28    return true;
29  },
30  hasItem: function (sKey) {
31    if (!sKey) { return false; }
32    return (new RegExp("(?:^|;\\s*)" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie);
33  },
34  keys: function () {
35    var aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/);
36    for (var nLen = aKeys.length, nIdx = 0; nIdx < nLen; nIdx++) { aKeys[nIdx] = decodeURIComponent(aKeys[nIdx]); }
37    return aKeys;
38  }
39}
40function addCart(id_product){
41    var total = 0;
42    if($('#etsSelect_'+id_product).length>0){
43        total = parseFloat($('#etsSelect_'+id_product+' option:selected').attr('rel'));
44    }else if($('#price_ets_'+id_product).length >0){
45        total = parseFloat($('#price_ets_'+id_product).data('price'));
46    }
47    if($('#qty-'+id_product).length > 0 && total >0){
48        total *= parseInt($('#qty-'+id_product).val());
49    }
50    if(total >=0 && $('.total-price-'+id_product).length >0 && $('.ets-option-'+id_product).length >0){
51        $('.total-price-'+id_product).html(total.toFixed(2));
52        $('.total-price-'+id_product).attr('data-total',total.toFixed(2));
53        // add to popup
54        $('.item-product-popup.p-'+id_product).addClass('actived');
55        $('.item-product-bg.p-'+id_product).addClass('actived');
56        $('.free-item-'+id_product).addClass('hide-item').removeClass('show-item');
57        //$('ul.config input,.select-topping').trigger('change');
58    }
59    else if($('.boxcomment.request-'+id_product).hasClass('show')){
60        $('.free-item-'+id_product).addClass('show-item').removeClass('hide-item');
61        $('.step_current.p-'+id_product).addClass('step_done').removeClass('step_current');
62        $('.free-item-'+id_product).addClass('hide-item').removeClass('show-item'); 
63        
64    }else
65        addToCart(id_product);   
66}
67function showFee(id_product){
68    
69}
70
71$(document).ready(function(){
72    // when change select choose price
73    $(document).off('change.mfbAiqSize', '.etsSelect').on('change.mfbAiqSize', '.etsSelect', function(){
74        var id_product = $(this).attr('rel');
75        //alert(id_product);
76        var value = $(this).find('option:selected').attr('value');
77        $('.ets-option-'+id_product).each(function(){
78            if($(this).data('set-option')==3 && value >0){
79                var price_topping = $(this).children('a').find('span.pricesize_'+id_product+'_'+value).data('price');
80                if($(this).children('div').data('mainprice')==0 && price_topping >0){
81                    if($(this).data('type-option')=='checkbox'){
82                        $(this).children('div').find('ul li input').filter(function(index){
83                            return $(this).attr('data-price',price_topping);
84                        });
85                        $(this).children('div').find('ul.config li label span.price-topping').filter(function(index){
86                            return $(this).html('+ '+price_topping.toFixed(2));
87                        });
88                    }else{
89                        $(this).children('div').find('select option').filter(function(index){
90                            if($(this).hasClass('extramainprice'))
91                                return 0;
92                            else
93                                return $(this).attr('data-price',price_topping);
94                        });
95                    } 
96                }
97            }
98        });
99    });
100    
101    /*if($('.etsSelect').length >0)
102        $('.etsSelect').trigger('change');*/
103    
104    $(document).off('change.mfbAiqTopping', 'ul.config input,.select-topping').on('change.mfbAiqTopping', 'ul.config input,.select-topping', function(){
105        var id_product = $(this).data('id-product');
106        var total = (id_product >0? parseFloat($('.total-price-'+id_product).data('total')):0);
107        var count_fee = 0;
108        var total_choose = 0;
109        var total_checked = 0;
110        $('.ets-option-'+id_product).each(function(){
111            if($(this).data('set-option')!=1)
112            {
113                if($(this).data('type-option')=='checkbox'){
114                    var choose = $(this).children('div').data('choose');
115                    var count = 0;
116                    $(this).children('div').find('ul li input').each(function(){
117                        if($(this).is(':checked')){
118                            count++;
119                            if(count>choose){
120                                total += parseFloat($(this).data('price'));
121                                $(this).parent('li').find('label span.price-topping').html('+ '+$(this).data('price').toFixed(2));
122                            }else{
123                                $(this).parent('li').find('label span.price-topping').html('+ free');
124                            }
125                        }else{
126                            $(this).parent('li').find('label span.price-topping').html('+ '+$(this).data('price').toFixed(2));
127                        }
128                    });
129                    total_choose += parseInt(choose);
130                    total_checked += count;
131                    $('.total-price-'+id_product).html(total.toFixed(2));
132                    count_fee+=(choose > count)?(choose - count):0;
133                    
134                }else{
135                    if($(this).children('div').data('selected') == 0)
136                            total+=parseFloat($(this).children('div').find('select option:selected').data('price'));
137                   $('.total-price-'+id_product).html(total.toFixed(2));
138                }                
139            }else{
140                 if($(this).data('type-option')=='checkbox'){
141                    var choose = $(this).children('div').data('choose');
142                    $(this).children('div').find('ul li input').each(function(){
143                        if($(this).is(':checked'))
144                            total_checked++;
145                    });
146                    total_choose += parseInt(choose);
147                    $('.total-price-'+id_product).html(total.toFixed(2));
148                    count_fee+=(choose > count)?(choose - count):0;
149                }               
150            }
151        });
152        if(count_fee > 0){
153            $('.free-item-'+id_product).addClass('show-item').removeClass('hide-item');
154            $('.total-item-free-'+id_product).html(count_fee);
155        }else{
156            $('.free-item-'+id_product).addClass('hide-item').removeClass('show-item');
157            $('.total-item-free-'+id_product).html('');
158            //$('.price-topping.p-'+id_product).addClass('show-item').removeClass('hide-item');
159        }
160        if(total_choose >=total_checked)
161            $('.price-topping.p-'+id_product).addClass('hide-item').removeClass('show-item');
162        else if(count_fee <=0)
163            $('.price-topping.p-'+id_product).addClass('show-item').removeClass('hide-item');
164        else
165            $('.price-topping.p-'+id_product).addClass('hide-item').removeClass('show-item');
166    });
167    
168    $(document).off('click.mfbAiqNext', '.button.btn-next-add').on('click.mfbAiqNext', '.button.btn-next-add', function(){
169        if(window.MfbMenuService && window.MfbMenuService.isUpdating()) return false;
170        var id_product = $(this).data('id-product');
171        var requireds = 0;
172        var success = 0;
173        $('.ets-option-'+id_product).each(function(){
174            if($(this).children('div').data('required')==1){
175                requireds++;
176                if($(this).data('type-option')=='checkbox'){
177                    var inputs = 0;
178                    $(this).children('div').find('ul li input').each(function(index){
179                        if($(this).is(':checked'))
180                            inputs++;
181                    });
182                    if(inputs == 0){
183                        $(this).css('border','1px solid red');
184                        return;
185                    }else{
186                        $(this).css('border','none');
187                        success++;
188                    }
189                }else{
190                    var ischoose = $(this).children('div').find('select option:selected').data('price');
191                    if(ischoose <=0){
192                        $(this).css('border','3px solid red');
193                        return;
194                    }else{
195                        $(this).css('border','none');
196                        success++;
197                    }
198                } 
199            }
200        });
201        
202        if(parseFloat( $('.total-price-'+id_product).text().trim())>0 && success == requireds){
203            if($('.last.p-'+id_product).hasClass('step_current')){
204                addToCart(id_product);
205                $('.item-product-popup.p-'+id_product).removeClass('actived');
206                $('.item-product-bg.p-'+id_product).removeClass('actived');
207                $('.first.p-'+id_product).addClass('step_current').removeClass('step_done');
208                $('.last.p-'+id_product).addClass('step_todo').removeClass('step_current');
209            }else{
210                $('.step_current.p-'+id_product).addClass('step_done').removeClass('step_current');
211                $('.step_todo.p-'+id_product).addClass('step_current').removeClass('step_todo');
212            }
213        }
214    });
215    
216    $(document).off('click.mfbAiqPrev', '.button.btn-prev').on('click.mfbAiqPrev', '.button.btn-prev', function(){
217        var id_product = $(this).data('id-product');
218        if($('.first.p-'+id_product).hasClass('step_current')){
219            return;
220        }else{
221            $('.step_current.p-'+id_product).addClass('step_todo').removeClass('step_current');
222            $('.step_done.p-'+id_product).addClass('step_current').removeClass('step_done');            
223        }
224        
225    });
226    
227    
228    $('.ui-dialog-titlebar-close').click(function(){
229        $(this).closest('.item-product-popup').removeClass('actived');
230        $(this).closest('.item-product-popup').prev().removeClass('actived');
231    })
232    $(document).off('click.mfbAiqBackdrop', '.item-product-bg').on('click.mfbAiqBackdrop', '.item-product-bg', function(){
233        $(this).next().removeClass('actived');
234        $(this).removeClass('actived');
235    })
236   
237});

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.