PageSourceSearch

https://static-cdn.gvgmall.com/mall/js/index.js?v20260918

js gvgmall.com collected 2026-09-25 15:13:30 UTC 19,612 bytes, 501 lines download raw bytes

1$(document).ready(function(){
2    function safeStr(str){
3        return str.replace(/&/g,'&')
4        .replace(/</g,'&lt;')
5        .replace(/>/g,'&gt;')
6        .replace(/"/g, "&quot;")
7        .replace(/'/g, "&#039;")
8        .replace(/\//, "&quot;");
9    }
10
11    //-------------------------------------game search-------------------
12    //game search
13    function searchGame(search){
14        search = $.trim(search);
15        if(search) {
16            $('.search-min .no_results').hide();
17            $('.web-search-down .activity-code').remove();
18            var page = $('.search-min .pagination .txt-c a').attr('page');
19            var startTime = Math.floor(Math.random()*15);
20            $.get(
21                '/index/game',
22                {search: search, page: page},
23                function (msg) {
24                    if (msg.code == 0000) {
25                        var game='';
26                        for (var i = 0; i < msg.msg.length; i++) {
27                            // Recharge  search images
28                            const productTypes = msg.msg[i].product_types || [];
29                            const firstType = productTypes[0] || {};
30                            const subject_id = firstType.subject_id || 0;
31                            let imageUrl = '';
32                            if (subject_id === 8) {
33                                imageUrl = msg.msg[i].image_logo || '';
34                            } else if (subject_id === 1 || subject_id === 2) {
35                                imageUrl = msg.msg[i].image_master || '';
36                            } else {
37                                imageUrl = msg.msg[i].image || '';
38                            }
39
40                            const isWebP = imageUrl.endsWith('.webp');
41                            const finalSrc = isWebP ? imageUrl.replace('_thumb', '') : imageUrl;
42                            if(msg.msg[i].product_types){
43                                if((msg.msg[i].product_types).length > 0){
44                                    game += '<li class="web-bell"><a href="'+firstType.type_url+ '">';
45                                    game += '<img src="'+ finalSrc +'" alt="Cheap '+msg.msg[i].game_name+'"><p class="title-one"><span>' + msg.msg[i].game_name + '</span></p></a>';
46                                    game += '<p class="title-two clearfix">';
47                                    for (var j = 0; j < msg.msg[i].product_types.length;j++){
48                                        game += '<a href="' + msg.msg[i].product_types[j].type_url + '">';
49                                        game += '<i class="' + msg.msg[i].product_types[j].type_class + '"></i>' + msg.msg[i].product_types[j].type_name + '</a>';
50                                    }
51                                    game += '</p></li>';
52                                }
53                            }else{
54                                var l = msg.msg[i];
55                                game += '<li class="web-product"><a href="'+l.detail_url+'">';
56                                game += '<img src="'+ finalSrc +'" alt="Cheap '+ l.product_name +'">';
57                                game += '<p class="title-one"><span>'+l.product_name+'</span></p>';
58                                if(l.price && l.price > l.net_price){
59                                    game += '<del>'+l.price + ' ' +l.currency+'</del>';
60                                }
61                                game += '<span class="price">'+l.net_price+' '+l.currency+'</span>';
62                                game += '<span class="btn">Buy Now</span></a></li>';
63                            }
64                        }
65
66                        $('.search-min .no_results').hide();
67                        $('.web-search-down ul:first').html(game);
68                        $('.pagination .txt-c a').html(page+'/'+msg.count);
69                        $('.pagination .txt-c a').attr('count',msg.count);
70                        $('.we_found .record em').html(msg.amount);
71                        $('.we_found strong').html(startTime);
72                        $('.we_found span').html(msg.search);
73                        $('.web-search-down ul').show();
74                        if(msg.count <=1)
75                            $('.web-search-down .pagination').hide();
76
77                        //command
78                        $('.web-search-down .activity-code').remove();
79                        if (msg.command) {
80                            var command = '';
81                            for (var i = 0; i < msg.command.length; i++) {
82                                command += '<div class="activity-code"><div class="ac-warp">';
83                                command += '<a href="'+msg.command[i].activity_url+'"><img src="' + msg.command[i].img+'">';
84                                command += '<div class="awgo">GO</div></a></div></div>';
85                            }
86                            $('.web-search-down .we_found').after(command);
87                        }
88                    } else if (msg.code == 2222) {
89                        window.location.href = msg.redirect_url;
90                    } else {
91                        $('.web-search-down ul').hide();
92                        $('.search-min .no_results').show();
93                         $('.we_found strong').html(startTime);
94                        $('.we_found span').html(msg.search);
95                        $('.we_found .record em').html(0);
96                    }
97
98                    recordHistorySearch(search);
99                },'json');
100            $('.web-search-down,.warp_page').show();
101            $('.warp').hide();
102            $('.we_found span').html(safeStr(search));
103
104        }else{
105          $('.warp_page').hide();
106           $('.warp').show();
107
108        }
109
110    }
111
112    $(document).bind("click",function(e){
113        $('.hot_search').hide();
114    })
115
116    var timer;
117    $(".search-min input").keyup(function() {
118        var $this = $(this);
119        if(timer) clearTimeout(timer);
120        timer = setTimeout(function(){
121            $('.hot_search').hide();
122            $('.web-search-down').show();
123            $('.pagination .txt-c a').attr('page',1);
124
125            var search = $this.val();
126            searchGame(search);
127        },500);
128    });
129
130    $(".search-min input").click(function() {
131        $('.hot_search').hide();
132        return false;
133    });
134
135    //上页
136    $(".search-min .page_left").click(function () {
137        var page = $('.pagination .txt-c a').attr('page');
138        var count = $('.pagination .txt-c a').attr('count');
139        page = parseInt(page);
140        if (page <= 1)
141            return
142        $('.pagination .txt-c a').attr('page', page - 1);
143        var search = $(".search-min input").val();
144        searchGame(search);
145        return false;
146    });
147
148    //下页
149    $(".search-min .page_right").click(function () {
150        var page = $('.pagination .txt-c a').attr('page');
151        var count = $('.pagination .txt-c a').attr('count');
152        page = parseInt(page);
153        if (page == count || page > count - 1)
154            return
155        $('.pagination .txt-c a').attr('page', page + 1);
156        var search = $(".search-min input").val();
157        searchGame(search);
158        return false;
159    });
160
161    $(".search-min input").bind('click', function (e) {
162        var search = $(this).val();
163        if (!search) {
164
165            if (!getCookieValue('history_search')) {
166                return;
167            }
168            $('.hot_search').show();
169            var value = getCookieValue('history_search');
170            var list = value.split("||");
171            var html = "";
172            for (var i = 0 ; i < list.length; i++) {
173                if (list[i]) {
174                    html += "<li><a href='javascript:void(0);' class='history_search_li'>"+list[i]+"</a></li>";
175                }
176            }
177            $('.history_search_content').html(html);
178        }
179    });
180
181    $('.hot_search').on('click', '.history_search_li', function(e){
182        var text = $(this).text();
183        $('.search-min input').val(text);
184        $(".hot_search").hide();
185
186        var ke = jQuery.Event("keyup");
187        ke.keyCode = 13;
188        ke.which = 13;
189        $('.search-min input').trigger(ke);
190    });
191
192    //----------------------登录注册弹窗-----------------------------------------
193    $('.registerModel').click(function(){
194        showRegisterModel();
195    });
196
197    $('.loginModel').click(function(){
198        showLoginModel();
199    });
200
201    //----------------------购物车--------------------------------
202
203     //添加到购物车未登录时弹出登陆框
204    $('span.js-shopping-cart').click(function(e){
205        e.preventDefault();
206        var $this = $(this),
207            href = $this.data('href');
208
209        if ($this.hasClass('pitch')) {
210            return;
211        }
212
213        $.getJSON(href, function(data){
214            if (data.status == 'success') {
215
216                $this.addClass('pitch').delay(3000).queue(function(next){
217                    $this.removeClass("pitch");
218                    next();
219                });
220                $('#min_cart .glyphicon-shopping-cart').removeClass("forbidden");
221                $('#min_cart').find('em.web-badge').text(data.cart_count);
222                $('#addcartModal').modal('show');
223            } else {
224                $('div.wrong_width').find('div.text').text(data.message);
225            }
226        });
227    });
228
229    //动态显示购物车的微缩信息
230    $(document).on('click', '#min_cart span', function(e){
231        $(this).children("i").attr("class","fa fa-spinner fa-pulse"); //loading
232            if ($(this).hasClass('forbidden')) {
233                window.location.href = '/cart';
234                return;
235            };
236        $.get('/cart/show', function(data){
237            $('#min_cart').html(data);
238            $(".login-right li ul").hide();
239            $('#min_cart').children("ul").show();
240            $(".login-right li,.login-right li span").removeClass("active");
241            if ($('#min_cart').find('.web-badge').text()) {
242                $('#min_cart').addClass("active");
243            }
244        });
245    });
246
247    $(document).on('click', '#min_cart a', function(e){
248        e.preventDefault();
249        var href = $(this).attr('href');
250        location.href = href;
251    });
252
253    //购物车商品删除
254    $(document).on('click', '.cart-remove', function(e){
255        e.preventDefault();
256        var $this = $(this);
257            link = $this.data('link');
258        $this.siblings('.loader-inner').show();
259        $.getJSON(link, function(data){
260            if (data.cart_count) {
261                $('#min_cart').find('.web-badge').text(data.cart_count);
262                $('#cart-total').text(data.amount);
263                $this.parent().remove();
264                $('#min_cart .glyphicon-shopping-cart').removeClass("forbidden");
265            } else {
266                $('#min_cart span').click();
267                $('#min_cart').find('.web-badge').text('');
268                $this.parents('.cart-list').html('');
269                $('#min_cart .glyphicon-shopping-cart').addClass("forbidden");
270
271            }
272        });
273    });
274
275    //订阅邮件收集
276    $("#subscribe_btn").click(function() {
277        var email = $('#subscribe_email').val();
278        var reg = /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/;
279        if(!email||!reg.test(email)){
280            //showBgContent('prompt_width','88888','error_email_null');
281            $('.input-box .tips').css('display','');
282            $('.loader-inner').hide();
283        }else {
284            $('.input-box .tips').css('display','none');
285            $('.loader-inner').show();
286            $.get(
287                '/index/subscribe',
288                {email:email},
289                function (msg) {
290                    msg = eval('('+msg+')');
291                    //showBgContent('prompt_width',msg.code,msg.msg);
292                    $('.loader-inner').hide();
293                     $('.psc_success').show();
294                    function delayer(){
295                        $('.psc_success').fadeOut();
296                    }
297                    setTimeout(delayer, 3000);
298                    if(msg.code == '0000'){
299                        if(reg.test(email)){
300                            var div = document.getElementById("foot_bottom");
301                         var img = document.createElement("img");
302                            img.setAttribute("height", "0");
303                            img.setAttribute("width", "0");
304                            img.src = "https://suite24.emarsys.net/u/register.php?CID=785204993&f=1533&p=2&a=r&SID=&el=&llid=&counted=&c=&optin=y&inp_3="+ email + "&inp_12126=gvg";
305                            div.appendChild(img);
306                        }
307                    }
308                    $('#subscribe_email').val('');
309                    // $('.btn-sendmail i').addClass('glyphicon-ok');
310                })
311        }
312    });
313
314    //币种切换
315    $('.current_currency').click(function(){
316        var value = $(this).attr('value');
317        var href = window.location.href.replace(window.location.hash,'');
318        var reg = /currency=.[^&]*/g;
319        var currency = href.match(reg);
320        if(currency)
321            href = href.replace(currency,'currency=' + value);
322        else {
323            if(href.match(/\?/))
324                href += '&currency=' + value;
325            else
326                href += '?currency=' + value;
327        }
328        setCookie('currency',value);
329        window.location.href = href;
330    });
331
332    //Language switch
333    $('.current_lang').click(function(){
334        const value = $(this).data('value');
335        const domain = $(this).data('domain');
336        const cur_value = $('#gvgmall_cursite').data('value');
337        const href = window.location.href.replace(window.location.hash,'');
338        if(value === cur_value){
339            return;
340        }
341        const match = /:\/\/([^.^\/]+)\./.exec(href);
342        if(!match){
343            return;
344        }
345        const site = match[1];
346        const subDomain = domain !== 'com' ? domain : 'www';
347        let newHref = href.replace(site, subDomain);
348        newHref = newHref.replace(/^http:\/\//i, 'https://');
349        window.location.href = newHref;
350    });
351
352    //注册成功确认
353    $('#register_success_btn').click(function(){
354        window.location.reload();
355    });
356
357
358    if (is_logined == 1) {
359        $.get('/user/rsyncNotification',function(ret) {
360
361        },'json')
362    }
363
364        //改写方法 可以加入 titile  和 content
365    window.showBgContent = function(ct ,title,content,sub_fun,param) {
366        $(".dialog,.dialog_s").hide();
367        var bH = $(document).height();
368        var bW = $("body").width();
369        var objWH = getObjWh(ct);
370        $(".fullbg").css({ width: bW, height: bH, display: "block",opacity:0.8});
371        var tbT = objWH.split("|")[0] + "px";
372
373        //算出 top和值
374        var window_width = $(window).width();
375        var w_div_width = $("." + ct).width();
376        var he_width = (window_width - w_div_width) / 2;
377
378        var window_height = $(window).height();
379        var h_div_height = $("." + ct).height();
380        var he_height = (window_height - h_div_height)/2;
381
382        $("." + ct).css({ top: he_height-180, left: he_width });
383        $("." + ct).show();
384        $("." + ct).animate({ top: he_height,opacity:1},500);
385
386
387        var obj =  $("." + ct);
388        if(window.console && console.log){
389            console.log($(obj).children().find('.alert_w p').html(title));
390            console.log($(obj).children().find('.alert_w .text').html(content));
391            if(sub_fun)
392            {
393                console.log($(obj).children().find(':submit').one('click',function(){
394                    sub_fun(param);
395                } ));
396            }
397            //$("'" + htmlContent + "'").html(title);
398            //$("." + content .w_tanceng_t .text).html(content);
399        }
400
401        //$("." + ct).html("<div style='text-align:center'>Loading...</div>");
402        $(window).scroll(function () { resetBg() });
403        $(window).resize(function () { resetBg() });
404    }
405
406    $('.windows-tiops .close-img-shade').click(function(){
407        setCookie('vip_zone_ad_close',true,1/96);
408        $('.windows-tiops').hide();
409    });
410});
411
412function showRegisterModel(){
413    $('#signupModal').modal('show');
414    if(is_captcha == 1) resetCaptcha();
415}
416function showLoginModel(){
417    $('#signinModal').modal('show');
418    if(is_captcha == 1) resetCaptcha();
419}
420
421function showBuyWarningNotice(){
422    $('#buy_warning').modal('show');
423}
424
425function showSuccess(){
426    $('#successfulModal').modal('show');
427}
428
429function resetCaptcha(){
430   var captcha_html = '<p class="t_title">Verification Code</p>';
431        captcha_html += '<em class="tips captcha_msg" style="display:none;"><i class="caret"></i></em>';
432        captcha_html += '<input class="form-control yz-control captcha_data current_data">';
433        captcha_html += '<img class="captcha" title="Refresh" src="/authUser/getCaptcha" style="margin-left: 20px;width:150px; padding:none; height:43px;border-color: #dbd9d9;cursor:pointer">';
434    $('.verification').html(captcha_html);
435}
436
437// live chat
438function StartChat(name) {
439    initWebChat(1);
440}
441
442function recordHistorySearch(value) {
443    if (value.length > 2) {
444        var key = 'history_search';
445        var list = getCookieValue(key);
446        var new_value = '';
447        if (list) {
448            list = list.split("||");
449            var new_list = [value];
450            for (var i = 0; i < list.length; i++) {
451                if (i < 8) {
452                    var is_exist = false;
453                    for (var j = 0; j < new_list.length; j++) {
454                        if (list[i] == new_list[j]) {
455                            is_exist = true;
456                        }
457                    }
458                    if (!is_exist) {
459                        new_list.push(list[i]);
460                    }
461                }
462            }
463
464            for (var i = 0; i < new_list.length; i++) {
465                new_value += '||' + new_list[i];
466            }
467        } else {
468            new_value = value;
469        }
470        setCookie('history_search', new_value, 5);
471        $(".history_search").hide();
472    }
473}
474
475function setCookie(cname, cvalue, exdays) {
476    var host = location.host;
477    var domain = host.substring(host.lastIndexOf(".",host.lastIndexOf(".")-1)+1);
478
479    if(exdays)
480    {
481        let d = new Date();
482        d.setTime(d.getTime() + (exdays*24*60*60*1000));
483        var expires = "expires="+d.toUTCString();
484        document.cookie = cname + "=" + cvalue + "; " + expires+"; path=/;domain=."+domain;
485    }
486    else
487    {
488        document.cookie = cname + "=" + cvalue + "; path=/;domain=."+domain;
489    }
490}
491
492function getCookieValue(name){
493    var name = name + "=";
494    var ca = document.cookie.split(";");
495    for (var i = 0; i < ca.length; i++) {
496        var c = ca[i].trim();
497        if (c.indexOf(name) == 0) {
498            return c.substring(name.length, c.length);
499        }
500    }
501}

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.