PageSourceSearch

https://www.canon.com.cn/Public/Front/js/newHead.js?v=20260817

js canon.com.cn collected 2026-10-02 07:35:20 UTC 39,939 bytes, 991 lines download raw bytes

1// // 用ajax发送请求提前加载页头顶部三个button在鼠标hover时的svg图片
2let svg_url = ["/Public/Front/images/header20260813/header_logo_shop_h.svg", "/Public/Front/images/header20260813/header_logo_club_h.svg", "/Public/Front/images/header20260813/header_logo_smile_h.svg"]
3// 循环遍历svg_url列表
4for (let i = 0; i < svg_url.length; i++) {
5    $.ajax({
6        url: svg_url[i],
7        type: 'GET',
8        success: function (data) { },
9        error: function (xhr, status, error) {
10            console.error('Error:', error);
11        }
12    })
13}//头部菜单栏JS
14var news_swiper1 = 0, news_swiper2 = 0, news_swiper3 = 0, news_swiper4 = 0, news_swiper5 = 0, news_swiper6 = 0;
15var myswiper1,myswiper2,myswiper3,myswiper4,myswiper5,myswiper6;
16$('.right_img_toc').empty();
17$('.right_img').empty();
18newHeadjs.getJSON(`/headnews.json?t=${Date.now()}`,  function (data) {
19    getNewsChild(data.toc_news,'geren','new_toc_box_c_swiper');
20    getNewsChild(data.tob_news,'bangong','new_tob_box_c_swiper');
21    getNewsChild(data.csr_news,'csr','new_csr_box_c_swiper');
22    getNewsChild(data.about_news,'about','new_about_box_c_swiper');
23    getNewsChild(data.purchase_news,'purchase','new_purchase_box_c_swiper',);
24    getNewsChild(data.supports_news,'supports');
25    getNewsChild(data.video_banner,'video');
26    getNewsChilds(data.toc_banner,'toc_banner','new_toc_box','banner_sp_toc');
27    getNewsChilds(data.tob_banner,'tob_banner','new_tob_box','banner_sp_tob');
28
29
30});
31var clickEvent = (function () {
32    if ('ontouchstart' in document.documentElement === true)
33        return 'touchstart';
34    else
35        return 'click';
36})();
37
38var Button_fw = document.querySelector("#nav4>h2>a");
39Button_fw.addEventListener(clickEvent, function () {
40    if (clickEvent == 'click') {
41        window.location.href = '/supports/service.html';
42    }
43});
44
45var Button_gr = document.querySelector("#nav1>h2>a");
46Button_gr.addEventListener(clickEvent, function () {
47    if (clickEvent == 'click') {
48        window.location.href = '/overview/toc.html';
49    }
50});
51
52var Button_bg = document.querySelector("#nav2>h2>a");
53Button_bg.addEventListener(clickEvent, function () {
54    if (clickEvent == 'click') {
55        window.location.href = '/overview/tob.html';
56    }
57});
58
59var Button_csr = document.querySelector("#nav25>h2>a");
60Button_csr.addEventListener(clickEvent, function () {
61    if (clickEvent == 'click') {
62        window.location.href = '/csr/';
63    }
64});
65var Button_about = document.querySelector("#nav5>h2>a");
66Button_about.addEventListener(clickEvent, function () {
67    if (clickEvent == 'click') {
68        window.location.href = '/about/';
69    }
70});
71
72var Button_video = document.querySelector("#nav6>h2>a");
73Button_video.addEventListener(clickEvent, function () {
74    if (clickEvent == 'click') {
75        window.location.href = '/video/';
76    }
77});
78var Button_purchase = document.querySelector("#nav7>h2>a");
79Button_purchase.addEventListener(clickEvent, function () {
80    if (clickEvent == 'click') {
81        window.location.href = '/purchase/guide.html';
82    }
83});
84var Button_zzfw = document.querySelector(".new_supports_head_contents_cc1>h3>a[data-text=zzfwtitle]");
85Button_zzfw.addEventListener(clickEvent, function () {
86    if (clickEvent == 'click') {
87        window.location.href = '/supports/servicemenu/imageinformation.html';
88    }
89});
90var Button_all = document.querySelectorAll(".new_supports_box .new_supports_head_ul li");
91for (var i = 0; i < Button_all.length; i++) {
92    urlClick(Button_all[i], clickEvent);
93};
94
95$(".new_supports_box .new_supports_head_ul li").click(function (event) {
96    let target = event.currentTarget;
97    var flag = urlClick(target, clickEvent);
98});
99
100
101
102function urlClick(Button_all, clickEvent) {
103    Button_all.addEventListener(clickEvent, function (e) {
104        if (clickEvent == 'click') {
105            var link = e.srcElement.getAttribute("data-text");
106            if (link == 'newsall') {
107                window.location.href = '/supports/announce/index.html';
108            }
109            if (link == 'cpxg') {
110                window.location.href = '/supports/announce/products/';
111            }
112            if (link == 'scxg') {
113                window.location.href = '/supports/announce/marketing/';
114            }
115            if (link == 'fjlstz') {
116                window.location.href = '/supports/announce/temporary/';
117            }
118            if (link == 'aqxg') {
119                window.location.href = '/supports/announce/security/';
120            }
121            if (link == 'xxxfl') {
122                window.location.href = '/supports/servicemenu/index.html';
123            }
124            if (link == 'yxxx') {
125                window.location.href = '/supports/servicemenu/imageinformation.html';
126            }
127            if (link == 'xxswlbg') {
128                window.location.href = '/supports/servicemenu/lsetup.html';
129            }
130            if (link == 'dxswlbg') {
131                window.location.href = '/supports/servicemenu/lbimagerunnerrent.html';
132            }
133            if (link == 'zydy') {
134                window.location.href = '/supports/servicemenu/professionalproducts.html';
135            }
136            if (link == 'uvgel') {
137                window.location.href = '/supports/servicemenu/uvgel.html';
138            }
139        }
140    }, false);
141}
142
143function getNewsChild(data,flag,element){
144    var news_contents = '';
145    if(flag == 'supports'){
146        var cpxg_html = creatSupportsNews(data[0]['cpxg']);
147        var scxg_html = creatSupportsNews(data[0]['scxg']);
148        var fjlstz_html = creatSupportsNews(data[0]['fjlstz']);
149        var aqxg_html = creatSupportsNews(data[0]['aqxg']);
150        var newsall_html = creatSupportsNews(data[0]['newsall']);
151        $(".cpxg").append(cpxg_html);
152        $(".scxg").append(scxg_html);
153        $(".fjlstz").append(fjlstz_html);
154        $(".aqxg").append(aqxg_html);
155        $(".newsall").append(newsall_html);
156    }else if(flag == 'video'){
157        if($(".new_video_box_banner_mini").length > 0){
158            var video_html = `<a href="${data['url']}">
159                <img data-src="${data['banner_mini']}" alt="">
160                <img data-src="${data['play_icon']}" alt="play icon" class="new_video_box_img_play">
161            </a>`;
162            $(".new_video_box_banner_mini").append(video_html);
163           }
164           if($(".new_video_box_banner").length > 0){
165            var video_html = `<a href="${data['url']}">
166                <img data-src="${data['banner']}" alt="">
167                <img data-src="${data['play_icon']}" alt="play icon" class="new_video_box_img_play">
168            </a>`;
169            $(".new_video_box_banner").append(video_html);
170        }
171    }
172    else {
173        for (var i = 0; i < 3; i++) {
174            news_contents = `<a href="${data[i]['url']}" class="head_flex_set new_toc_box_c_newsc">
175            <div class="new_toc_box_c_newstitle head_flex_set">
176                <h3>
177                ${data[i]['title']}
178                    <p class="new_head_newslogo ${data[i]['zhanting']?data[i]['zhanting']:''}">
179                        <span>${data[i]['date']}</span>
180                    </p>
181                </h3>
182            </div>
183            <div class="new_toc_box_c_newsimg">
184                <img data-src="${data[i]['img_url']}">
185            </div>
186        </a>`;
187             
188            $(`.${element} .swiper-slide`).eq(i).append(news_contents);
189        }
190    }
191}
192
193function getNewsChilds(data,flag,element,element2){
194    var news_contents = '';
195    var news_contents2 = '';
196    
197    for (var i=0;i<data.length;i++) {
198        news_contents = `
199            <div class="right_img_style">
200                <a href="${data[i]['url']}" class="new_a_stype" onclick="my_smq_header(['custom', '${data[i]['pc-alt']}']);">
201                    <div class="new_banner_style">
202                        <p class="new_new_style">${data[i]['lab']}</p>
203                        <img data-src="${data[i]['img']}" alt="右图${i+1}" class="rightimg_detail">
204                    </div>
205                    <p class="new_button_style">了解更多</p>
206                </a>
207            </div>`;
208        news_contents2 = `
209            <li class="phone_bannerimg">
210                <a href="${data[i]['url']}" class="new_a_stype" onclick="my_smq_header(['custom', '${data[i]['mb-alt']}']);">
211                    <div class="new_banner_style">
212                        <p class="new_new_style">${data[i]['lab']}</p>
213                        <img data-src="${data[i]['img']}" alt="右图${i+1}" class="phone_bannerimg_style">
214                    </div>
215                    <p class="new_button_style">了解更多</p>
216                </a>
217            </li>`;
218        if (flag == 'toc_banner') {
219            $(`.${element} .right_img_toc `).append(news_contents);
220        } else {
221            $(`.${element} .right_img `).append(news_contents);
222        }
223        $(`#${element2} `).append(news_contents2);
224    }
225}
226
227function creatSupportsNews(data){
228    var html= '';
229    for (var i = 0; i < 3; i++) {
230        html += `<div class="new_supports_head_news"><a href="${data[i]['url']}">
231        <div class="head_flex_set">
232            <div class="new_supports_head_news_date">${data[i]['date']}</div>
233            <div class="new_supports_head_news_type">${data[i]['type']}</div>
234        </div>
235        <p>${data[i]['title']}</p>
236    </a></div>`;
237    }
238    return html;
239}
240function newsswiper(flag,classname) {
241    if (flag == 'geren' && news_swiper1 == 0) {
242        news_swiper1++;
243    }
244    if (flag == 'bangong' && news_swiper2 == 0) {
245        news_swiper2++;
246    }
247    if (flag == 'csr' && news_swiper3 == 0) {
248        news_swiper3++;
249    }
250    if (flag == 'about' && news_swiper4 == 0) {
251        news_swiper4++;
252    }
253    if (flag == 'purchase' && news_swiper5 == 0) {
254        news_swiper5++;
255    }
256    if (flag == 'btob' && news_swiper6 == 0) {
257        news_swiper6++;
258    }
259    var obj = new Swiper(`.${classname}`, {
260        loop: true,
261        autoHeight: true,
262        autoplay: {
263            delay: 3000,
264            disableOnInteraction: false
265        },
266        pagination: {
267            el: '.swiper-pagination91',
268            clickable: true,
269        },
270    });
271    return obj;
272
273
274}
275$(window).scroll(function () {
276    if ($(window).scrollTop() > 0) {
277        $(".new_supports_box,.new_toc_box,.new_tob_box,.new_csr_box,.new_about_box,.new_video_box,.new_purchase_box,.new_btob_box").addClass("head_scroll");
278    } else {
279        $(".new_supports_box,.new_toc_box,.new_tob_box,.new_csr_box,.new_about_box,.new_video_box,.new_purchase_box,.new_btob_box").removeClass("head_scroll");
280    }
281});
282$(window).resize(function () {
283    if ($(window).width() > 975) {
284        var height_f = $(".headpc").height() + $(".head2").height();
285        $(".new_supports_box,.new_toc_box,.new_tob_box,.new_csr_box,.new_about_box,.new_video_box,.new_purchase_box,.new_btob_box").css("top", height_f);
286        $(".new_head_bg").css("top", height_f);
287    }
288});
289
290
291$(document).ready(function () {
292    $(".new_head_sp_click").click(function () {
293        if ($(this).hasClass("sp_menu_flag")) {
294            $(this).find(".new_head_sp_show").removeClass("active");
295            $(this).removeClass("sp_menu_flag");
296            $(this).siblings(".new_head_sp_secend").slideUp('slow');
297        } else {
298            $(".new_head_sp_show").removeClass("active");
299            $(this).find(".new_head_sp_show").addClass("active");
300            $(".new_head_sp_click").removeClass("sp_menu_flag");
301            $(this).addClass("sp_menu_flag");
302            $(".new_head_sp_secend").slideUp('slow');
303            $(this).siblings(".new_head_sp_secend").slideDown('slow');
304        }
305    });
306    $(".new_head_sp_secend_click").click(function () {
307        if ($(this).hasClass("active")) {
308            $(this).removeClass("active");
309            $(this).siblings(".new_head_sp_third").slideUp('slow');
310        } else {
311            $(this).addClass("active");
312            $(this).siblings(".new_head_sp_third").slideDown('slow');
313        }
314    });
315    $(".new_supports_head_close").click(function (e) {
316        e.stopPropagation();
317        $(".new_supports_box,.new_toc_box,.new_tob_box,.new_csr_box,.new_about_box,.new_video_box,.new_purchase_box,.new_btob_box").slideUp(600);
318        $(".new_head2_pc>ul>li").removeClass('new_head_hover');
319        $(".new_head_bg").hide();
320    });
321    $("#nav4>h2").click(function (e) {
322        e.stopPropagation();
323        if ($("#nav4").hasClass("new_head_hover")) {
324            lazyImg('nav4');
325            $(".new_supports_box").slideUp(600);
326            $(".new_head_bg").hide();
327            $("#nav4").removeClass('new_head_hover');
328        } else {
329            $(".new_supports_box").slideDown(600);
330            $(".new_head_bg").show();
331            $("#nav4").addClass('new_head_hover');
332        }
333    });
334    $("#nav1>h2").click(function (e) {
335        e.stopPropagation();
336        if ($("#nav1").hasClass("new_head_hover")) {
337            lazyImg('nav1');
338            $(".new_toc_box").slideUp(600);
339            $(".new_head_bg").hide();
340            $("#nav1").removeClass('new_head_hover');
341        } else {
342            $(".new_toc_box").slideDown(600);
343            $(".new_head_bg").show();
344            $("#nav1").addClass('new_head_hover');
345        }
346    });
347    $("#nav2>h2").click(function (e) {
348        e.stopPropagation();
349        if ($("#nav2").hasClass("new_head_hover")) {
350            lazyImg('nav2');
351            $(".new_tob_box").slideUp(600);
352            $(".new_head_bg").hide();
353            $("#nav2").removeClass('new_head_hover');
354        } else {
355            $(".new_tob_box").slideDown(600);
356            $(".new_head_bg").show();
357            $("#nav2").addClass('new_head_hover');
358        }
359    });
360    $("#nav25>h2").click(function (e) {
361        e.stopPropagation();
362        if ($("#nav25").hasClass("new_head_hover")) {
363            lazyImg('nav25');
364            $(".new_csr_box").slideUp(600);
365            $(".new_head_bg").hide();
366            $("#nav25").removeClass('new_head_hover');
367        } else {
368            $(".new_csr_box").slideDown(600);
369            $(".new_head_bg").show();
370            $("#nav25").addClass('new_head_hover');
371        }
372    });
373
374    $("#nav5>h2").click(function (e) {
375        e.stopPropagation();
376        if ($("#nav5").hasClass("new_head_hover")) {
377            lazyImg('nav5');
378            $(".new_about_box").slideUp(600);
379            $(".new_head_bg").hide();
380            $("#nav5").removeClass('new_head_hover');
381        } else {
382            $(".new_about_box").slideDown(600);
383            $(".new_head_bg").show();
384            $("#nav5").addClass('new_head_hover');
385        }
386    });
387
388    $("#nav6>h2").click(function (e) {
389        e.stopPropagation();
390        if ($("#nav6").hasClass("new_head_hover")) {
391            $(".new_video_box").slideUp(600);
392            $(".new_head_bg").hide();
393            $("#nav6").removeClass('new_head_hover');
394            lazyImg('nav6');
395        } else {
396            $(".new_video_box").slideDown(600);
397            $(".new_head_bg").show();
398            $("#nav6").addClass('new_head_hover');
399        }
400    });
401    $("#nav7>h2").click(function (e) {
402        e.stopPropagation();
403        if ($("#nav7").hasClass("new_head_hover")) {
404            lazyImg('nav7');
405            $(".new_purchase_box").slideUp(600);
406            $(".new_head_bg").hide();
407            $("#nav7").removeClass('new_head_hover');
408        } else {
409            $(".new_purchase_box").slideDown(600);
410            $(".new_head_bg").show();
411            $("#nav7").addClass('new_head_hover');
412        }
413    });
414
415   var flag_news = 1,flag_video = 1;
416    newHeadjs("#nav4").hoverIntent(function () {
417        $(".new_supports_box").stop().slideDown(600);
418        $(".new_head_bg").show();
419        $(this).addClass('new_head_hover');
420        if(flag_news == 1){
421            lazyImg($(this)[0].id)
422            ++flag_news;
423        }
424    }, function () {
425        $(".new_supports_box").stop().slideUp(600);
426        $(".new_head_bg").hide();
427        $(this).removeClass('new_head_hover');
428    });
429    newHeadjs(".new_supports_box .new_supports_head_ul").hoverIntent(function () {
430        var flag = $(this).attr("data-text");
431        if (flag !== undefined) {
432            $('.' + flag + '').addClass('new_supports_head_active');
433            $('.' + flag + '').siblings().removeClass('new_supports_head_active');
434        }
435        $(".new_supports_box .new_supports_head_ul li").removeClass("active");
436        $(this).addClass("active");
437        $(".new_supports_head_zzfwtitle").removeClass("active");
438    }, function () {
439    }, 'li');
440    newHeadjs(".new_supports_head_zzfwtitle").hoverIntent(function () {
441        var flag = $(this).attr("data-text");
442        if (flag !== undefined) {
443            $('.' + flag + '').addClass('new_supports_head_active');
444            $('.' + flag + '').siblings().removeClass('new_supports_head_active');
445        }
446        $(".new_supports_head_ul li").removeClass("active");
447        $(this).addClass("active");
448    });
449 
450    //个人产品
451    newHeadjs("#nav1").hoverIntent(function () {
452        $(".new_toc_box").stop().slideDown(600);
453        $(".new_head_bg").show();
454        $(this).addClass('new_head_hover');
455        if(news_swiper1 == 0){
456            lazyImg($(this)[0].id)
457            myswiper1 = newsswiper('geren','new_toc_box_c_swiper');
458        }
459        myswiper1.autoplay.start();
460    }, function () {
461        myswiper1.autoplay.stop();
462        $(".new_toc_box").stop().slideUp(600);
463        $(".new_head_bg").hide();
464        $(this).removeClass('new_head_hover');
465    });
466    //办公及工业产品
467    newHeadjs("#nav2").hoverIntent(function () {
468        $(".new_tob_box").stop().slideDown(600);
469        $(".new_head_bg").show();
470        $(this).addClass('new_head_hover');
471       
472        if(news_swiper2 == 0){
473            lazyImg($(this)[0].id)
474            myswiper2 = newsswiper('bangong','new_tob_box_c_swiper');
475        }
476        myswiper2.autoplay.start();
477    }, function () {
478        myswiper2.autoplay.stop();
479        $(".new_tob_box").stop().slideUp(600);
480        $(".new_head_bg").hide();
481        $(this).removeClass('new_head_hover');
482    });
483    //购买指南
484    newHeadjs("#nav7").hoverIntent(function () {
485        $(".new_purchase_box").stop().slideDown(600);
486        $(".new_head_bg").show();
487        $(this).addClass('new_head_hover');
488        if(news_swiper5 == 0){
489            lazyImg($(this)[0].id)
490            myswiper5 = newsswiper('purchase','new_purchase_box_c_swiper');
491        }
492        myswiper5.autoplay.start();
493    }, function () {
494        myswiper5.autoplay.stop();
495        $(".new_purchase_box").stop().slideUp(600);
496        $(".new_head_bg").hide();
497        $(this).removeClass('new_head_hover');
498    });
499    //企业社会责任
500    newHeadjs("#nav25").hoverIntent(function () {
501        $(".new_csr_box").stop().slideDown(600);
502        $(".new_head_bg").show();
503        $(this).addClass('new_head_hover');
504        if(news_swiper3 == 0){
505            lazyImg($(this)[0].id)
506            myswiper3 = newsswiper('csr','new_csr_box_c_swiper');
507        }
508        myswiper3.autoplay.start();
509    }, function () {
510        myswiper3.autoplay.stop();
511        $(".new_csr_box").stop().slideUp(600);
512        $(".new_head_bg").hide();
513        $(this).removeClass('new_head_hover');
514    });
515    //关于佳能
516    newHeadjs("#nav5").hoverIntent(function () {
517        $(".new_about_box").stop().slideDown(600);
518        $(".new_head_bg").show();
519        $(this).addClass('new_head_hover');
520        if(news_swiper4 == 0){
521            lazyImg($(this)[0].id)
522            myswiper4 = newsswiper('about','new_about_box_c_swiper');
523        }
524        myswiper4.autoplay.start();
525    }, function () {
526        myswiper4.autoplay.stop();
527        $(".new_about_box").stop().slideUp(600);
528        $(".new_head_bg").hide();
529        $(this).removeClass('new_head_hover');
530    });
531    //精彩视频
532    newHeadjs("#nav6").hoverIntent(function () {
533        $(".new_video_box").stop().slideDown(600);
534        $(".new_head_bg").show();
535        $(this).addClass('new_head_hover');
536        if(flag_video == 1){
537            lazyImg($(this)[0].id)
538            ++flag_video;
539        }
540    }, function () {
541        $(".new_video_box").stop().slideUp(600);
542        $(".new_head_bg").hide();
543        $(this).removeClass('new_head_hover');
544    });
545    //官网浮窗弹窗判断
546    let canoweb_cookie_flag = localStorage.getItem('canoweb_cookie');
547    if (canoweb_cookie_flag != 'flag' ){
548        var canoweb_cookie = `<div id="canonweb_cookie"><style>#canonweb_cookie{font-size: 15px;border-radius: 15px;position: fixed;left: 50px;bottom:164px;width: 350px;background-color: #494748;padding: 20px 20px 84px 20px;z-index: 99998;text-align: justify;}.cookie_info_l{color:rgb(163,209,246);padding: 0 5px;}.agreeCookieAlert{font-weight: bold; display: block;position: absolute;width: 100px;padding: 8px;text-align: center;color: #fff!important;text-decoration: none!important;font-size: 18px;line-height: 18px;background-color: #ba3d40;right: 15px;bottom: -55px;margin-top: -15px;border-radius: 15px; }#canonweb_cookie .yszc{font-size: 20px;font-weight: bold;color: #fff;margin-bottom: 15px;height:10px;}.cookie_close{max-width: 21px;}@media (min-width:975px) and (max-width:1400px){#canonweb_cookie{bottom:114px}} @media (max-width: 974px){.overview_box2  .cookie_close, .cookie_close{max-width: 38px!important;}.agreeCookieAlert{ position: unset; margin-top: 20px;font-size: 28px;width: 156px;padding: 18px;margin-left: auto; } #canonweb_cookie .yszc{font-size: 30px;height: 30px;} #canonweb_cookie{left: 17px;width: 82%;padding: 30px;} #canonweb_cookie>div{font-size: 25px;}}</style><div style="position: relative;max-width: 100%;margin: 0 auto;color: #fff;"><p class="yszc"></p>为改善本网站用户体验和提供服务,本网站会使用Cookie等,点击<a href="/about/secrecy/index.html" target="_blank" style="text-decoration: underline;" class="cookie_info_l">隐私政策</a>了解更多。如您继续浏览本网站或点击同意,视为您已经阅读并接受前述隐私政策。<a href="javascript:void(0);" style="position: absolute;top: -8px;right: 0;" onclick="closeCookieAlert()"><img src="/Public/Front/images/x.png" alt="" class="cookie_close"></a><a href="javascript:void(0);" onclick="closeCookieAlert()" class="agreeCookieAlert">同意</a></div></div>`;
549        $('.new_head_bg').after(canoweb_cookie);
550    }
551});
552
553
554function lazyImg(element){
555    for (let index = 0; index < $('#'+element+' img').length; index++) {
556        $('#'+element+' img').eq(index).attr('src', $('#'+element+' img').eq(index).data('src'));
557    }
558}
559function closeCookieAlert() {
560    localStorage.setItem('canoweb_cookie', 'flag');
561    cookieFun();
562}
563function cookieFun() {
564    document.querySelector('#canonweb_cookie').remove();
565}
566//共通侧边栏
567/**
568 * 鼠标指针特效
569 * @param {Object} config 配置项
570 * @param {Array} config.cursors 指针参数数组
571 * @param {Number} config.expire_day 过期时间 单位为天 默认 1天
572 */
573class cursorEffect {
574    constructor(config = {}) {
575        this.cursors = config.cursors || [
576            { img: "/Public/Front/images/cursor_20260817.svg", offsetX: 5, offsetY: 11 },
577            // { img: "/Public/Front/images/cursor_32.svg", offsetX: 2, offsetY: 15 }
578        ];
579        this.enable_expire = config.enable_expire || false; // 默认关闭过期时间检测
580        this.expire_day = config.expire_day || 1; // 24小时过期时间 默认 为 1天
581        this.cursor_style = this._cursorEffectStyle();
582
583        // 检查localStorage中的指针特效状态
584        if (localStorage.getItem("cursorEffectState") === "true" && (this.enable_expire ? new Date(localStorage.getItem("cursorEffectStateTime")) >= new Date() : true)) {
585            this._cursorEffectToggle(true);
586        } else if (localStorage.getItem("cursorEffectState") === "false" && (this.enable_expire ? new Date(localStorage.getItem("cursorEffectStateTime")) >= new Date() : true)) {
587            this._cursorEffectToggle(false);
588        } else {
589            // 如果没有设置状态,默认为开启
590            this._cursorEffectToggle(true);
591            this._storeState(true);
592        }
593    }
594
595    /**
596     * 鼠标指针特效Style样式
597     * @returns {HTMLStyleElement} style
598     */
599    _cursorEffectStyle() {
600        // 动态创建style标签 并设置唯一识别值,用于后续删除
601        const style = document.createElement('style');
602        style.id = "cursorEffectId";
603        style.textContent = `
604        body,
605        .pdb00.pdb .pay #more_li li .pdb3 .pdb4 input,
606        .overview1 .swiper-wrapper .ban1 a,
607        .contmode .swiper-wrapper .ban1 a,
608        .contmode .itmdrow .itmdrowblock .imgblock .xc11_new_a {
609            cursor: ${this.cursors.map(c => `url(${c.img}) ${c.offsetX} ${c.offsetY}`).join(', ')}, auto;
610        }
611
612        a {
613            cursor: pointer;
614        }
615        `;
616        return style;
617    }
618
619    /**
620     * 切换鼠标指针特效状态 
621     * @param {boolean} state 状态 true 打开 false 关闭
622     */
623    _cursorEffectToggle(state) {
624        if (state) {
625            document.head.appendChild(this.cursor_style);
626        } else {
627            if (document.getElementById("cursorEffectId") !== null) {
628                document.head.removeChild(this.cursor_style);
629            }
630        }
631    }
632
633    /**
634     * 保存鼠标指针特效状态
635     * @param {boolean} state 状态 true 打开 false 关闭
636     */
637    _storeState(state) {
638        // state = true 打开
639        if (state) {
640            localStorage.setItem("cursorEffectState", "true");
641            if (this.enable_expire) {
642                localStorage.setItem("cursorEffectStateTime", new Date(new Date().getTime() + this.expire_day * 1000 * 60 * 60 * 24).toISOString());
643            }
644        } else {
645            // state = false 关闭
646            localStorage.setItem("cursorEffectState", "false");
647            if (this.enable_expire) {
648                localStorage.setItem("cursorEffectStateTime", new Date(new Date().getTime() + this.expire_day * 1000 * 60 * 60 * 24).toISOString());
649            }
650        }
651    }
652
653    /**
654     * 外部调用 鼠标指针特效切换开关
655     */
656    cursorEffectSwitch() {
657        if (localStorage.getItem("cursorEffectState") === "true") {
658            this._cursorEffectToggle(false);
659            this._storeState(false);
660        } else {
661            this._cursorEffectToggle(true);
662            this._storeState(true);
663        }
664    }
665}
666
667let isShowCanoSmile = true;
668var cursor = true;
669(function () {
670    const path = window.location.pathname;
671    $(document).ready(function () {
672         // 查看对比显示的聚合页路径
673        const comparePaths = [
674            '/overview/canoscan.html',
675            '/overview/printertob.html',
676            '/overview/eos.html',
677            '/overview/printertoc.html',
678            '/overview/telscope.html',
679            '/overview/dv.html',
680            '/overview/powershot.html'
681        ];
682        const overviewPaths = [
683            '/overview/toc.html',
684            '/overview/tob.html'
685        ];
686        // 隐藏特定路径的菜单
687        const hidePaths = [
688            '/supports/download/sims',
689            '/special/',
690            '/m/special/',
691            '/purchase/dealer/',
692            '/support/pregister/',
693        ];
694        //supports路径判断显示,其余情况不显示
695        const supportsShowPaths = [
696            '/supports/servicemenu/',
697            '/supports/policy/',
698            '/supports/announce/',
699            '/supports/app/',
700            '/supports/webcontact/',
701            '/supports/authenticity/',
702            '/supports/service.html',
703            '/supports/recycle.html',
704            '/supports/sdk/psd/cdis/',
705        ];
706        //判断是否有查看对比,添加数字
707        var num = 0;
708        var classSet = '';
709        if (comparePaths.some(p => path.includes(p))) {
710            var pros = getCookie('pros');
711			if (pros == null) {
712				 num = 0;
713			} else {
714                classSet = 'menu-compare-checked';
715				 num = pros.split(",").length;
716			}
717        }
718        const MENU_ITEMS = {
719            contact: `<a class="right-menu-box right-menu-box-after" href="/about/contact/index.html" onClick="sensors.track('web_BannerClick', {category:'右侧菜单栏', action:'点击咨询', label: '咨询按钮', value: '点击跳转'});">
720              <div class="right-menu-icon contact-icon"></div>
721              <div class="right-menu-text"><p>咨询</p></div>
722            </a>`,
723            compare: `<div class="fixedBox fixedBox-new2 right-menu-box ${classSet} right-menu-box-after" onclick="openb()">
724              <div class="right-menu-icon compare-icon"></div>
725              <div class="right-menu-text">
726                <span id="p_nums">${num}/4</span>
727                <p>对比</p>
728              </div>
729            </div>`,
730            mouse: `<div class="right-menu-box right-menu-mouse right-menu-box-after" onClick="mouse_change()">
731              <div class="right-menu-icon mouse-icon"></div>
732              <div class="right-menu-text"><p>鼠标</p></div>
733              <div class="right-menu-mouse-changebox">
734                  <div class="right-menu-mouse-changebox2">
735                      <p>鼠标特效已<span class="mouse-change-text">开启</span>,<br>点击右侧<img src="/Public/Front/images/icon_s_red.svg"><span class="mouse-change-text2">关闭</span></p>
736                  </div>
737              </div>
738          </div>`,
739            backtop: `<div onClick="GoBackTop()" class="right-menu-box right-menu-backtop">
740          <div class="right-menu-icon backtop-icon"></div>
741           <div class="right-menu-text"><p>回顶部</p></div>
742        </div>`,
743            smile: `<div onClick="smileClick()"  class="canon-smile "></div>`,
744        };
745
746        const MENU_CONFIG = {
747            'compare': {
748                containerClass: 'fixedBox-new2025',
749                menus: ['compare', 'contact', 'mouse', 'backtop']
750            },
751            'overview': {
752                containerClass: 'fixedBox-new2025',
753                menus: ['contact', 'mouse', 'backtop']
754            },
755            'product': {
756                containerClass: 'canon-fixed-right-menu',
757                menus: ['contact', 'mouse', 'backtop']
758            },
759            'default': {
760                containerClass: 'canon-fixed-right-menu',
761                menus: ['mouse', 'backtop']
762            },
763            'onlysmilebacktop': {
764                containerClass: 'canon-fixed-right-menu',
765                menus: ['backtop']
766            },
767            'onlybacktop': {
768                containerClass: 'canon-fixed-right-menu',
769                menus: ['backtop']
770            },
771            'onlysmile': {
772                containerClass: 'canon-fixed-right-menu',
773                menus: ['smile']
774            },
775            'onlymouse': {
776                containerClass: 'canon-fixed-right-menu',
777                menus: ['mouse']
778            },
779            'onlycontact': {
780                containerClass: 'canon-fixed-right-menu',
781                menus: ['contact']
782            },
783            'hide': {
784                containerClass: 'canon-fixed-right-menu',
785                menus: []
786            }
787        };
788        // 根据路径判断右侧菜单显示的位置,显示哪几个菜单
789        const getCurrentConfig = () => {
790            // 处理首页特殊路径隐藏
791            if (path === '/' ||
792                path === '/index.html' ) {
793                return MENU_CONFIG['hide'];
794            }
795
796            // 处理路径隐藏菜单栏
797            if (hidePaths.some(p => path.includes(p))) {
798                return MENU_CONFIG['hide'];
799            }
800            //处理产品路径
801            if (path.startsWith('/product/')) return MENU_CONFIG['product'];
802            //处理supports 路径
803            if (path.startsWith('/supports/')) {
804                if (path === '/supports/sdk/' ||
805                    path === '/supports/sdk/index.html') {
806                    return MENU_CONFIG.default;
807                }
808                return supportsShowPaths.some(p => path.includes(p))
809                    ? MENU_CONFIG.default
810                    : MENU_CONFIG['hide'];
811            }
812            //处理聚合页路径
813            if (path.startsWith('/overview/')) {
814                if (comparePaths.some(p => path.includes(p))) {
815                    return MENU_CONFIG['compare'];
816                }
817                return overviewPaths.some(p => path.includes(p))
818                    ? MENU_CONFIG.default
819                    : MENU_CONFIG['overview'];
820            }
821
822            //返回默认配置
823            return MENU_CONFIG.default;
824        };
825
826        const config = getCurrentConfig();
827        const htmlStr = [
828            `<div class="${config.containerClass}">`,
829            ...config.menus.map(menu => MENU_ITEMS[menu]),
830            '</div>'
831        ].join('');
832        document.body.insertAdjacentHTML('beforeend', htmlStr);
833
834        //判断是否开启鼠标特效
835        if (config.menus.includes('mouse') && window.innerWidth > 996) {
836            cursor = new cursorEffect();
837            if (localStorage.getItem("cursorEffectState") === "true") {
838                $(".right-menu-mouse").addClass('menu-mouse-checked');
839                $('.mouse-change-text').text('开启');
840                $('.mouse-change-text2').text('关闭');
841            } else {
842                $('.mouse-change-text').text('关闭');
843                $('.mouse-change-text2').text('开启');
844            }
845        }
846        //鼠标特效关闭开启控制
847        setTimeout(() => {
848            if ($(".right-menu-mouse-changebox")) {
849                $(".right-menu-mouse-changebox").hide();
850            }
851            // 在这里编写需要延迟执行的逻辑
852        }, 3000); // 3000 毫秒 = 3 秒
853        //可视窗口高度
854        const viewportHeight = window.innerHeight;
855        //HTML 根元素的可视区域高度
856        const clientHeight = document.documentElement.clientHeight;
857        //滚动条总高度
858        const totalScrollHeight = document.documentElement.scrollHeight;
859
860        let flagScrollHeight = 120;
861        //判断页面高度是否超过两屏高度:
862        if (totalScrollHeight >  viewportHeight + 140 && totalScrollHeight - clientHeight > viewportHeight/2 ) {
863            flagScrollHeight = viewportHeight - 200;
864            if(window.innerWidth < 996){
865                flagScrollHeight = viewportHeight / 2;
866            }
867            if(flagScrollHeight > (totalScrollHeight - clientHeight) ){
868                flagScrollHeight = 120;
869            }
870        }
871        if(window.innerWidth < 996 && path.startsWith('/overview/')){
872            flagScrollHeight = viewportHeight / 2;
873        }
874        //监听滚动条
875        let isClassAdded = false;
876        let waitGIFDone = null;
877        //初始化进来判断是否显示大笑ICON和返回顶部
878        const parent = $('.canon-smile');
879        if ($(window).scrollTop() > flagScrollHeight) {
880            isClassAdded = insertSmile(parent);
881             waitGIFDone = setTimeout(() => {
882                parent.css('transform', 'scale(1)');
883                parent.addClass('canon-smile-animate');
884                // 在这里编写需要延迟执行的逻辑
885            }, 3000);
886        }
887        $(window).scroll(debounce(function () {
888            //判断是否显示大笑ICON
889            if (parent.length > 0 ) {
890                if ($(window).scrollTop() > flagScrollHeight) {
891                    //判断是否显示返回顶部
892                    $(".right-menu-backtop").show();
893                    if (!isClassAdded) {
894                        if (isShowCanoSmile) {
895                            isClassAdded = insertSmile(parent);
896                            waitGIFDone = setTimeout(() => {
897                                    parent.css('transform', 'scale(1)');
898                                    parent.addClass('canon-smile-animate');
899                                    // 在这里编写需要延迟执行的逻辑
900                                }, 3000);
901                        }
902                    }
903                } else {
904                    clearTimeout(waitGIFDone);
905                    $(".right-menu-backtop").hide();
906                    isClassAdded = false;
907                    parent.hide();
908                    parent.removeClass('canon-smile-animate');
909                    parent.children().remove();
910                }
911            }else{
912                if ($(window).scrollTop() > flagScrollHeight) {
913                    $(".right-menu-backtop").show();
914                }else{
915                    $(".right-menu-backtop").hide();
916                }
917            }
918        }, 100));
919        if (parent.length > 0) {
920            // 监听父元素动画结束事件
921            document.querySelector('.canon-smile').addEventListener('animationend', () => {
922                // 父元素动画结束后,为子元素添加动画类
923                if ($('.canon-smile').children().length > 0) {
924                    $('.canon-smile').append(`<img src="/Public/Front/images/hand2.gif" class="canon-smile-finger" ><div class="canon-smile-close-sty" onClick="clsoeSmile()"><img src="/Public/Front/images/X.svg"></div>`);
925                }
926            });
927        }
928
929    });
930})();
931
932//返回顶部按钮
933function GoBackTop() {
934    $('body,html').animate({ scrollTop: 0 }, 1000);
935    sensors.track('web_BannerClick', {category:'右侧菜单栏', action:'返回顶部', label: '返回顶部按钮', value: '点击'});
936    return false;
937}
938//鼠标效果切换按钮
939function mouse_change() {
940    if ($('.right-menu-mouse').hasClass('menu-mouse-checked')) {
941        //关闭鼠标特效逻辑
942        $('.right-menu-mouse').removeClass('menu-mouse-checked');
943        $('.mouse-change-text').text('关闭');
944        $('.mouse-change-text2').text('开启');
945        sensors.track('web_BannerClick', {category:'右侧菜单栏', action:'关闭鼠标特效', label: '鼠标效果切换按钮', value: '关闭'});
946    } else {
947        //开启鼠标特效逻辑
948        $('.right-menu-mouse').addClass('menu-mouse-checked');
949        $('.mouse-change-text').text('开启');
950        $('.mouse-change-text2').text('关闭');
951        sensors.track('web_BannerClick', {category:'右侧菜单栏', action:'开启鼠标特效', label: '鼠标效果切换按钮', value: '开启'});
952    }
953    if (cursor) {
954        cursor.cursorEffectSwitch();
955    }
956}
957
958function smileClick() {
959    sensors.track('web_BannerClick', {category:'右侧菜单栏', action:'点击右侧菜单栏推广位', label: '大笑icon', value: '点击跳转'});
960    window.location.href = '/about/china/culture/';
961}
962
963function clsoeSmile() {
964    event.stopPropagation();
965    isShowCanoSmile = false;
966    $('.canon-smile').children().remove();
967    $('.canon-smile').attr('style', '');
968    $('.canon-smile').css('height', '0px');
969    $('.canon-smile-box').children('.canon-smile-finger').remove();
970    sensors.track('web_BannerClick', {category:'右侧菜单栏', action:'关闭右侧边栏推广位', label: '大笑icon', value: '点击关闭'});
971}
972// 防抖函数
973function debounce(func, wait) {
974    let timeout;
975    return function () {
976        const context = this;
977        const args = arguments;
978        clearTimeout(timeout);
979        timeout = setTimeout(() => func.apply(context, args), wait);
980    };
981}
982//插入大笑icon
983function insertSmile(parent) {
984    $(".right-menu-backtop").show();
985    parent.show();
986    parent.css('transform', 'scale(2)');
987    parent.css('margin-bottom', '10px');
988    parent.append(`<img src="/Public/Front/images/canon-smlile.gif?v=${Date.now()}" alt="" srcset="" style="width: 100%;"  class="canon-smile-img">`)
989    return true;
990}
991//共通侧边栏 end

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.