PageSourceSearch

https://www.altratene.com/assets/js/plus/products.js?v=Oct0431

js altratene.com collected 2026-10-04 07:49:47 UTC 13,863 bytes, 458 lines download raw bytes

1var nowHost = window.location.host;
2var preview = /^preview.*/;
3if (preview.test(nowHost)) {
4    $('body').append("<div style='position:fixed;bottom:0;left:0;background-color:#ff00b4;color:#fff;font-size:12px;z-index:999;padding:0 30px;line-height:2'>PREVIEW MODE</div>");
5}
6
7BaseUrl = $('.base-url').val();
8var preurl = location.href.split("/",7);
9var _token = $('#_token').val();
10// 切換產品型態
11$('[typeidontype]').on('click',function(){
12    var filterurl = BaseUrl+"/"+preurl[4]+"/"+"Ajax/Changetype";
13    var _this = $(this);
14    $.ajax({
15        url: filterurl,
16        type:'get',
17        data : {
18            _token: _token,
19            type_id:$(this).attr('typeidontype'),
20            cate_id:$('[cateid]').attr('cateid'),
21        },
22        
23    })
24    .done(function (data) {
25            $('[typeidonitem]').remove();
26            $('[itemcontain]').prepend(data.view);
27            $('[typetitle]').text(data.title);
28            $('[typesubtitle]').text(data.content);
29            // console.log($(this).attr('typeidontype'));
30            
31            history.replaceState('', "page 2", BaseUrl+"/"+preurl[4]+"/"+preurl[5]+"/"+_this.attr('typeurl'));
32    })
33    .fail(function (jqXHR, textStatus, errorThrown,data) { 
34    });
35});
36// 詢問車選擇應用類型
37function selectapp(obj)
38{
39    var addcartroute = $('.add-to-list[data-ajax-route]').attr('data-ajax-route').split("/",11);
40    addcartroute[8] = $(obj).attr('appid');
41    $('.add-to-list[data-ajax-route]').attr('data-ajax-route',addcartroute.join('/'));
42}
43// 詢問車選擇單位
44function selectquantity(obj)
45{
46    var addcartroute = $('.add-to-list[data-ajax-route]').attr('data-ajax-route').split("/",11);
47    
48    addcartroute[9] = $(obj).attr('quantityid');
49    $('.add-to-list[data-ajax-route]').attr('data-ajax-route',addcartroute.join('/'));
50}
51// 詢問車輸入應用類型其他
52function apptypeother(obj)
53{
54    var addcartroute = $('.add-to-list[data-ajax-route]').attr('data-ajax-route').split("/",11);
55    
56    addcartroute[10] = $(obj).val()?$(obj).val():'none';
57    $('.add-to-list[data-ajax-route]').attr('data-ajax-route',addcartroute.join('/'));
58    console.log($(obj).val());
59}
60// 開啟將項目加入詢問車的燈箱
61function add_list(obj)
62{
63    var addcarturl = BaseUrl+"/"+'Products'+"/"+"Ajax/AjaxAddCartBefore"+"/"+$(obj).attr('nowitem');
64    $.ajax4({
65        Route: addcarturl,
66        Container: '.add-cart-before',
67        Block: '',
68        Callback: 'ajaxCallback.inquiryAdd',
69        Backready: '',
70        Backloaded: '',
71    });
72}
73// 從詢問物車移除項目
74function remove_list(obj)
75{
76    where = $(obj).attr('where');
77    var removecarturl = BaseUrl+"/"+'Products'+"/"+"Ajax/AjaxRemoveCart"+"/"+$(obj).attr('index')+'/'+where;
78    $.ajax({
79        url: removecarturl,
80        type:'get',
81        data : {
82            _token: _token,
83        },
84        
85    })
86    .done(function (data) {
87        
88        if (where=='incart') {
89            $('[cartcontainer]').html(data.view);
90            setCookie('cartcount',data.count,1);
91            modifycartcount(data.count);
92            txtarr = $('[listcount]').text().split("");
93            var re = /^[0-9]+.?[0-9]*/;
94            var nochange = 0;
95            for (let index = 0; index < txtarr.length; index++) {
96                const element = txtarr[index];
97                if(re.test(element)==true&&nochange==0)
98                {
99                    txtarr[index] = data.count;
100                    nochange = 1;
101                }else if(re.test(element)==true&&nochange==1)
102                {
103                    txtarr[index] = '';
104                }
105            }
106            var newtxt = txtarr.join("");
107            $('[listcount]').text(newtxt);
108            if (data.count==0) {
109                $('[emptyclass]').addClass('empty');
110            }
111        }else if(where=='incontact')
112        {
113            $('.table-content').html(data.view);
114        }
115    })
116    .fail(function (jqXHR, textStatus, errorThrown,data) { 
117        alert('Network error and Please reload');
118    });
119}
120// 開啟詢問車或是在詢問車中加入項目
121function open_list(obj)
122{
123    var addcarturl = BaseUrl+"/"+'Products'+"/"+"Ajax/InquiryCart"+"/"+'0/0/0/none';
124    if ($('.inquiry-cart.ajax_close.show').length<=0) {
125        $.ajax4({
126            Route: addcarturl,
127            Container: '.inquiry-cart',
128            Block: '',
129            Callback: 'ajaxCallback.inquiryCart',
130            Backready: '',
131            Backloaded: ''
132        });
133    }
134}
135// 開啟應用模擬燈箱
136function opensimulation(obj)
137{
138    var addcarturl = BaseUrl+"/"+'Products'+"/"+"Ajax/Simulation";
139    $.ajax4({
140        Route: addcarturl,
141        Container: '.app-simulation',
142        Block: '',
143        Callback: 'ajaxCallback.simulation',
144        Backready: '',
145        Backloaded: ''
146    });
147}
148// 加入標記已開啟模擬應用的GET變數
149function sharesimulation(obj)
150{
151    // console.log(location.href);
152    var newurl = updateQueryStringParameter(window.location.href, 'simulationahare', '1');
153    //向当前url添加参数,没有历史记录
154    window.history.replaceState({
155        path: newurl
156    }, '', newurl);
157}
158// 在網址中加入GET變數的function
159function updateQueryStringParameter(uri, key, value) {
160    if(!value) {
161        return uri;
162    }
163    var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
164    var separator = uri.indexOf('?') !== -1 ? "&" : "?";
165    if (uri.match(re)) {
166        return uri.replace(re, '$1' + key + "=" + value + '$2');
167    }
168    else {
169        return uri + separator + key + "=" + value;
170    }
171}
172// 刪除網址中開啟模擬應用的GET變數
173function unsharesimulation(obj)
174{
175    var newurl = funcUrlDel(location.href,'simulationahare');
176    //向当前url添加参数,没有历史记录
177    window.history.replaceState({
178        path: newurl
179    }, '', newurl);
180}
181// 刪除GET變數的function
182function funcUrlDel(url,name){
183    var loca = url.split("?");
184    var baseUrl = loca[0];
185    if (loca[1].indexOf(name)>-1) {
186        var obj = {}
187        var arr = loca[1].split("&");
188        for (var i = 0; i < arr.length; i++) {
189            arr[i] = arr[i].split("=");
190            obj[arr[i][0]] = arr[i][1];
191        };
192        delete obj[name];
193        var url = baseUrl + '?' + JSON.stringify(obj).replace(/[\"\{\}]/g,"").replace(/\:/g,"=").replace(/\,/g,"&");
194        return url
195    };
196}
197function chksharesimulation(obj)
198{
199    if (funcUrlGet(location.href,'simulationahare')) {
200        opensimulation();
201        // alert('321');
202    }
203    
204}
205// 取得get變數的function
206function funcUrlGet(url,variable){
207    var query = url.split("?");
208    var vars = query[1]!=undefined?query[1].split("&"):[];
209    for (var i=0;i<vars.length;i++) {
210        var pair = vars[i].split("=");
211        if(pair[0] == variable){return pair[1];}
212    }
213    return(false);
214}
215// 應用模擬切換分類
216function changesimulationcate(obj)
217{
218    appimg=$(obj).attr('appimage');
219    appbakimg=$(obj).attr('appbakimage');
220    
221    $(".main").css("background-image","url("+appbakimg+")");
222    $(".mask").css("background-image","url("+appimg+")");
223
224    $('[s2cateid]').hide();
225    $('[s2cateid="'+$(obj).attr('s1cateid')+'"]').show();
226    $('[s2cateid="'+$(obj).attr('s1cateid')+'"] .color-item').eq(0).click();
227    
228}
229// 選擇應用模擬顏色
230function selectsimulationcolor(obj)
231{
232    var addcartroute = $('.open_related[data-ajax-route]').attr('data-ajax-route').split("/",11);
233    addcartroute[7] = $(obj).attr('itemid');
234    $('.open_related[data-ajax-route]').attr('data-ajax-route',addcartroute.join('/'));
235}
236// 詢問車有發生變動時更改詢問車的數量及文字(這支只有在把  詢問車叫進來的blade  跟整個頁面載入的時候使用)
237function modifycartcount(count)
238{
239    // var cartcount =count?count:getCookie('cartcount');
240    if (count) {
241        cartcount = count;
242        modifi(cartcount);
243    }else{
244        
245        var filterurl = BaseUrl+"/"+'Products'+"/"+"Ajax/getcartcount";
246        $.ajax({
247            
248            url: filterurl,
249            type:'get',
250            data : {
251            },
252            
253        })
254        .done(function (data) {
255            var cartcount = data.count;
256            modifi(cartcount);
257            console.log(data.count);
258            console.log(cartcount);
259        })
260        .fail(function (jqXHR, textStatus, errorThrown,data) { 
261            // haschangedcaptcha=0;
262        });
263    }
264}
265
266function modifi(cartcount)
267{
268    $('[data-count]').attr('data-count',cartcount?cartcount:0);
269    // $('.main-navbar [data-count]').attr('data-count',cartcount?cartcount:0);
270    if (cartcount==0||'') {
271        $('[data-count]').removeClass('no_empty');
272        $('[countLesszero]').text(
273            $('[countLesszero]').attr('countLesszero')
274            );
275            $('[countLesszero]').attr('data-count','');
276    }else if(cartcount==1){
277        $('[data-count]').addClass('no_empty');
278        $('[countLesszero]').text($(
279            '[countLesszero]').attr('countequalzero')
280            );
281    }else{
282        $('[data-count]').addClass('no_empty');
283        $('[countLesszero]').text(
284            $('[countLesszero]').attr('countLesszero')
285            );
286        
287    }
288}
289
290function ChangeContinent(obj)
291{
292    $('[name="continent"]').val($(obj).attr('continent_id'));
293}
294
295// 發送產品contact表單
296function ProductSubmit(obj)
297{
298    var filterurl = BaseUrl+"/"+'Products'+"/"+"Ajax/ajax_submit";
299    var Form_data = $('#ProductSubmit').serializeArray();
300    console.log(Form_data);
301    
302    var _this = $(this);
303    $.ajax({
304        url: filterurl,
305        type:'get',
306        data : {
307            _token: _token,
308            data:Form_data,
309            // type_id:$(this).attr('typeidontype'),
310            // cate_id:$('[cateid]').attr('cateid'),
311        },
312        
313    })
314    .done(function (data) {
315        haschangedcaptcha=0;
316        if (data.success==false) {
317            alert(data.warning);
318        }else if(data.success==true){
319            _common.openAjax('.form-btn.submit');
320            // console.log(data.tomail);
321            
322            setCookie('cartcount',0,1);
323            modifycartcount(0);
324        }
325    })
326    .fail(function (jqXHR, textStatus, errorThrown,data) { 
327        haschangedcaptcha=0;
328    });
329}
330function changecaptcha(obj)
331{
332    
333    if ((typeof haschangedcaptcha === 'undefined'||haschangedcaptcha==0)||$(obj).attr('name')!='captchacode') {
334        $('[alt="J個4驗證碼"]').click();
335        haschangedcaptcha=1;
336    }
337}
338function item_list_switch(obj)
339{
340    console.log($(obj).attr('remenber'));
341    var remember = $(obj).attr('remenber');
342    if (remember=='ProductFeature') {
343        history.replaceState('', "page 2", BaseUrl+"/"+preurl[4]+"/"+preurl[5]+"/"+remember);
344    }else if(remember=='list'){
345        $('[typeurl] .active').click();
346    }
347}
348// 輸入cookie名,與cookie值
349function setCookie(cname, cvalue, exdays)
350{
351    var d = new Date();
352    d.setTime(d.getTime() + (exdays*24*60*60*1000));
353    var expires = "expires="+ d.toUTCString();
354    document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
355}
356// 輸入cookie取cookie值
357function getCookie(cname) {
358    var name = cname + "=";
359    var decodedCookie = decodeURIComponent(document.cookie);
360    var ca = decodedCookie.split(';');
361    for(var i = 0; i <ca.length; i++) {
362        var c = ca[i];
363        
364        while (c.charAt(0) == ' ') {
365            c = c.substring(1);
366        }
367        if (c.indexOf(name) == 0) {
368            return c.substring(name.length, c.length);
369        }
370    }
371    return "";
372}
373
374    function search(obj)
375    {
376        $('#hidegooglesearchform [name="q"]').val($('#hidegooglesearchform_query').val());
377        $('#hidegooglesearchform').submit();
378    }
379
380    function colsesuccesslb()
381    {
382        $('.submit-success').removeClass('show');
383        $('.submit-success').remove();
384        $('.form-btn.clear').click();
385        var mt = $('.main-navbar .menubar').innerHeight();
386        $.anchor4({
387        target: '.contact-form',
388        margintop: mt,
389
390        });
391    }
392
393    function successlbreload()
394    {
395        setCookie('getanchorafterseccess',1,1);
396        window.location.reload();
397    }
398
399    function getanchorafterseccess()
400    {
401        if (getCookie('getanchorafterseccess')==1) {
402            var mt = $('.main-navbar .menubar').innerHeight();
403            $.anchor4({
404            target: '.subcategory-navbar',
405            margintop: mt,
406            });
407            setCookie('getanchorafterseccess',0,1);
408        }
409    }
410
411function preventimgrightclick()
412{
413    if (!preview.test(nowHost)) {
414        $('html').on('contextmenu'/*, 'img[src$=".png"],img[src$=".jpg"]'*/,function(e){
415            e.preventDefault();        
416        })
417    }
418}
419
420function forgetsearchquery()
421{
422    $("#hidegooglesearchform_query").val('');
423}
424
425$(document).ready(function () {
426    $('.add-list').off();
427    $('.open_cart').off();
428    $('.open_simulation').off();
429    chksharesimulation();
430    modifycartcount();
431    $('[remenber]').on('click',
432    function()
433    {
434        item_list_switch(this);
435    }
436    );
437    getanchorafterseccess();
438    preventimgrightclick();
439    forgetsearchquery();
440    
441    // Place this code in the head section of your HTML file 
442    (function(r, d, s) {
443        r.loadSkypeWebSdkAsync = r.loadSkypeWebSdkAsync || function(p) {
444            var js, sjs = d.getElementsByTagName(s)[0];
445            if (d.getElementById(p.id)) { return; }
446            js = d.createElement(s);
447            js.id = p.id;
448            js.src = p.scriptToLoad;
449            js.onload = p.callback
450            sjs.parentNode.insertBefore(js, sjs);
451        };
452        var p = {
453            scriptToLoad: 'https://swx.cdn.skype.com/shared/v/latest/skypewebsdk.js',
454            id: 'skype_web_sdk'
455        };
456        r.loadSkypeWebSdkAsync(p);
457    })(window, document, 'script');
458});

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.