/* Js for , Version=1775246322 */
 v.lang = {"confirmDelete":"\u60a8\u786e\u5b9a\u8981\u6267\u884c\u5220\u9664\u64cd\u4f5c\u5417\uff1f","deleteing":"\u5220\u9664\u4e2d","doing":"\u5904\u7406\u4e2d","loading":"\u52a0\u8f7d\u4e2d","updating":"\u66f4\u65b0\u4e2d...","timeout":"\u7f51\u7edc\u8d85\u65f6,\u8bf7\u91cd\u8bd5","errorThrown":"\u6267\u884c\u51fa\u9519\uff1a","continueShopping":"\u7ee7\u7eed\u8d2d\u7269","required":"\u5fc5\u586b","back":"\u8fd4\u56de","continue":"\u7ee7\u7eed","bindWechatTip":"\u53d1\u5e16\u529f\u80fd\u8bbe\u7f6e\u4e86\u7ed1\u5b9a\u5fae\u4fe1\u7684\u9650\u5236\uff0c\u8bf7\u5148\u7ed1\u5b9a\u5fae\u4fe1\u4f1a\u5458\u3002","importTip":"\u53ea\u5bfc\u5165\u4e3b\u9898\u7684\u98ce\u683c\u548c\u6837\u5f0f","fullImportTip":"\u5c06\u4f1a\u5bfc\u5165\u6d4b\u8bd5\u6570\u636e\u4ee5\u53ca\u66ff\u6362\u7ad9\u70b9\u6587\u7ae0\u3001\u4ea7\u54c1\u7b49\u6570\u636e"};;
  $(function()
  {
    if($(window).width() > 768) $("#siteNav a[href*='login']").click(function(elem)
    {
      if(window.qrCodeTimer) window.clearInterval(window.qrCodeTimer);
      const id = 'loginModal';
      sessionStorage.removeItem('demoOpen');
      sessionStorage.removeItem('demoLocate');
      $.cookie('noDemoLogin', 1, {path: config.cookiePath});
      showModalLogin(id, elem.target, 23, 0, 1);
      $('body').css('padding-right', 'unset');
      return false;
    });
  });
;v.demoPcUrl = "\/demo-pc";;v.demoMobileUrl = "\/demo-mobile";;v.copySuccess = "\u590d\u5236\u6210\u529f";;v.objectType = "book";;v.objectID = 198;;v.scheme = "https";;v.httpHost = "www.xuanim.com";;
$(function()
{
    var videoContainer = "<video id=\"VIDEO_ID\" class=\"video-js vjs-default-skin vjs-big-play-centered\" controls preload=\"auto\" loop=\"loop\" data-setup='{\"autoplay\": VIDEO_AUTOSTART, \"width\": VIDEO_WIDTH, \"height\": VIDEO_HEIGHT, \"controlBar\": {\"fullscreenToggle\": VIDEO_FULLSCREEN}}'><source src=\"VIDEO_SRC\" type=\"video\/VIDEO_TYPE\" \/> <\/video>";
    $('embed').each(function(index)
    {
        if($(this).hasClass('videojs')) 
        {
            var $embed      = $(this),
                src         = $embed.attr('src'),
                w           = $embed.width(),
                h           = $embed.height(),
                type        = src.match(/t=\w+/g),
                autostart   = $embed.attr('autostart'),
                fullscreen  = $embed.attr('allowfullscreen'),
                containerID = 'video_' + index;

            $container = videoContainer.replace(/VIDEO_SRC/g, src);
            $container = $container.replace(/VIDEO_WIDTH/, w);
            $container = $container.replace(/VIDEO_HEIGHT/, h);
            $container = $container.replace(/VIDEO_ID/, containerID);
            $container = $container.replace(/VIDEO_AUTOSTART/, autostart);
            $container = $container.replace(/VIDEO_FULLSCREEN/, fullscreen);
            $container = $container.replace(/VIDEO_TYPE/, type[0].replace('t=', ''));
            $(this).replaceWith($container);
        }
    })
});
;(function() {var _53code = document.createElement("script");_53code.src = "https://tb.53kf.com/code/code/ef35685c8390f5aa37b2ddce53eca3e09/2";var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(_53code, s);})();;$(document).ready(function()
{
    var clipboard = new ClipboardJS('.url-copy');
    clipboard.on('success', function(e) {
        $(e.trigger).tooltip('show');
        setTimeout(function(){$(e.trigger).tooltip('hide');}, 2000);
        $(e.trigger).popover('hide');
    });

    $('.nav-system-book').addClass('active');
    $('#navbar li.active').parents('li').addClass('active');
    $('#article' + v.objectID).addClass('active');
    $('#article' + v.objectID).parents('dd').each(function()
    {
        $(this).attr('class', $(this).attr('class').replace('closed', 'opened'));
        $(this).addClass('active');
    })
    if(v.fullScreen)
    {
        $('html, body').css('height', '100%');

        curPos = sessionStorage.getItem('curPos');
        if(curPos) $('.fullScreen-catalog').animate({scrollTop: curPos}, 0);

        $('.article').click(function(){sessionStorage.setItem('curPos', $('.fullScreen-catalog').scrollTop());});
    }

    $('dd a').click(function()
    {
        getContent(this);
        return false;
    });

    $('body').on("click",".icon-next a, .icon-previous a, .previous a, .next a",function()
    {
        getContent(this);
        return false;
    });

    $('body').on("blur",'.popover input',function()
    {
        $('[data-toggle="popover"]').popover('hide');
        return false;
    });


    function getContent(obj)
    {
        var url = $(obj).attr('href');
        if($('.article.book-content').length !== 0)
        {
            $('.col-md-9').load(url + ' .col-md-9 > div', function(){init();});
        }
        else
        {
            $.get(url, function(data)
            {   
                $('.fullScreen-content').html($(data).find('.fullScreen-content').html());
                $('.fullScreen-nav').html($(data).find('.fullScreen-nav').html());
                init();
            })
        }
    }

    function init()
    {
        var objectID = $('#id').val();
        $('.article').removeClass('active');
        $('#article' + objectID).addClass('active');
        $('#article' + objectID).parents('dd').each(function()
        {
            $(this).attr('class', $(this).attr('class').replace('closed', 'opened'));
            $(this).addClass('active');
        })
        if($(".books dd.article.active > a").attr('href'))
        {
            if($(".qrcode-mobile").length)
            {
                articleID = $(".books dd.article.active").attr('id').substr('7');
                if($(".qrcode-mobile").attr('data-src'))
                {
                    length = $(".qrcode-mobile").attr('data-src').indexOf('qrcode');
                    $(".qrcode-mobile").attr('data-src', createLink('misc', 'qrcode', 'articleID=' + articleID));
                }
                else
                {
                    length = $(".qrcode-mobile").attr('src').indexOf('qrcode');
                    $(".qrcode-mobile").attr('src', createLink('misc', 'qrcode', 'articleID=' + articleID));
                }
            }
        }
        $('[data-toggle="popover"]').popover(
        { 
            content : v.scheme + "://" + v.httpHost + $(".books dd.article.active a").attr('href'),
            template : '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><input class="form-control" type="text" value=' + v.scheme + "://" + v.httpHost + $(".books dd.article.active a").attr('href') + '></div></div>',
            trigger : 'click',
        });
        $('[data-toggle="popover"]').tooltip({placement : 'right', title : v.copySuccess, trigger : 'manual'});
    }

    $(window).keydown(function(e)
    {
        if(e.keyCode == 37) getContent($('.previous a'));
        if(e.keyCode == 39) getContent($('.next a'));
    });

    init();
});
$(document).ready(function()
{
    if($('.fullScreen-nav .nav-content').height() < $(window).height())
    {
        $('.fullScreen-nav .nav-content').css('padding-top', '0px');
    }

    $('.fullScreen-nav .nav-content a').click(function()
    {
        $('.fullScreen-nav .nav-content a').removeClass('active');
        $(this).addClass('active');
    });
    
    $('body').tooltip(
    {
         html: true,
         selector: "[data-toggle=tooltip]",
         container: "body"
    });

    $('.fullScreen-content').on("scroll", function()
    {
        var count = $(".fullScreen-nav li").length;
        if(!count) return false;
        for(var i=0;i<count;i++)
        {
            if($('#' + i).offset().top <= '80')
            {
                $('.fullScreen-nav .nav-content a').removeClass('active');
                $(".fullScreen-nav .nav-content a[href='#" + i + "']").addClass('active');
            }
        }
    });
    /* Scroll function. */
    function yrScroll()
    {
         var listTitleHeight = $(".book-catalog .panel-heading").height();

         var catalogWidth  = $('.book-catalog').width();
         var catalogHeight = $(window).height() - 10;
         $(".book-catalog").css({'max-height': catalogHeight, 'overflow-y': 'auto', 'overflow-x': 'hidden'});

         if($('.books .active').length)
         {
             var listScrollTop =  $(".books .active").position().top;
             var listMoveSize = listScrollTop > ( $(".bookScrollListsBox").height() - listTitleHeight ) / 2 ? listScrollTop : 0;
             var scrollMoveSize = listMoveSize / $(".books").height(); 
             $(".bookScrollListsBox").scrollTop
             (
                 $(".bookScrollListsBox .books").height() * scrollMoveSize -($(".bookScrollListsBox").height() / 2 - $(".bookScrollListsBox .panel-heading").height() - 47)
             );
         }


         /* Bind scroll event */
         $(document).on("scroll", function ()
         {
              if( $("#book").offset()) var headerHeight = $("#book").offset().top;
              if( $('.col-md-9').offset()) { var footerHeight = $('.col-md-9').offset().top + $('.col-md-9').height() - $(window).height();}

              $(".page-wrapper").css({"min-height":$(".book-catalog").height()})
              if($(document).scrollTop() > headerHeight )
              {
                   $('.book-catalog').css({'position': 'fixed', 'top':'0', 'width': catalogWidth});

                   if($(document).scrollTop() > footerHeight)
                   {
                       catalogHeight2 = $(window).height() - $('.blocks.all-bottom').outerHeight() - $('#footer').outerHeight() - 60;
                       $('.book-catalog').css({'max-height': catalogHeight2, 'overflow-y': 'auto', 'overflow-x': 'hidden'});
                   }
                   else
                   {
                       $('.book-catalog').css({'max-height': catalogHeight, 'overflow-y': 'auto', 'overflow-x': 'hidden'});
                   }
              }
              else if( $(document).scrollTop() < headerHeight )
              {
                   $('.book-catalog').css({'position': 'relative' });
              }
         });
    };
    yrScroll();

    $('.previous > a, .next > a').css('max-width', (($('.pager').width() - $('.pager > .back > a').width()) * 0.45));

    if($('.previous > a > span').width() > $('.previous > a').width())
    {
        previousSpanWidth = $('.previous > a').width() - $('.previous .icon-arrow-left').width() - 5;
        $('.previous > a > span').css('width', previousSpanWidth);
    }

    if($('.next > a > span').width() > $('.next > a').width())
    {
        nextSpanWidth = $('.next > a').width() - $('.next .icon-arrow-right').width() - 5;
        $('.next > a > span').css('width', nextSpanWidth);
    }

    $('dd > span').click(function()
    {
        if($(this).parent().attr('class').indexOf('closed') != '-1')
        {
            $(this).parent().attr('class', $(this).parent().attr('class').replace('closed', 'opened'));
        }
        else
        {
            $(this).parent().attr('class', $(this).parent().attr('class').replace('opened', 'closed'));
        }
    });
});
window.xuanxuan = {
    // beta 版本相关信息
    betadate: "04月24日",
    betaver: "7.2.beta",
    betadownload: "/dynamic/xuanxuan7.2.beta-104.html",

    // 设置喧喧当前版本
    version: "10.1",

    // 设置喧喧更新日期
    publishDate: "2025.04.25",

    // 首页幻灯片发布日期
    date: "7月11日",

    // 以下只能填写版本号，不可以加英文字母
    ver: "10.2",

    xxcVersion: "10.2",

    xxbVersion: "10.2",

    xxdVersion: "10.2",

    androidVersion: "10.2.0",
    
    version:"10.2.0",

    iosVersion: "10.2.0",

    owtVersion: "1.5",

    // 所有下载按钮指向的位置
    download: "/dynamic/xuanxuan9.1-111.html",

    // 设置喧喧下载地址前缀
    downloadUrl: "/dl/xuanxuan/{ver}/",
    androidDownloadUrl: "/dl/xuanxuan/{ver}/",
    owtDownloadUrl: "/dl/xuanxuan/owt/",
    jitsiDownloadUrl: "https://dl.zentao.net/xuanmeet/xuanmeet-1.0.zip",
    downloadDockerBaidu: "https://pan.baidu.com/s/1Pvz5Yz4fsvS8-VNzKLqPSQ",
    owt_docker_baidu_code: "cgna",

    // 以下内容无需更改
    downloads: {
        windows_setup: "xuanxuan.{xxcVersion}.win64.setup.exe",
        windows_setup_debug: "xuanxuan.{xxcVersion}.debug.win64.setup.exe",
        windows_setup_win32: "xuanxuan.{xxcVersion}.win32.setup.exe",
        windows_7z: "xuanxuan.{xxcVersion}.win64.7z.exe",
        windows_7z_win32: "xuanxuan.{xxcVersion}.win32.7z.exe",
        windows_zip: "xuanxuan.{xxcVersion}.win64.zip",
        windows_zip_win32: "xuanxuan.{xxcVersion}.win32.zip",
        mac_dmg: "xuanxuan.{xxcVersion}.mac.dmg",
        mac_zip: "xuanxuan.{xxcVersion}.mac.zip",
        mac_dmg_debug: "xuanxuan.{xxcVersion}.debug.mac.dmg",
        browser: "xuanxuan.{xxcVersion}.browser.zip",
        linux_deb: "xuanxuan.{xxcVersion}.linux.amd64.deb",
        linux_deb_32: "xuanxuan.{xxcVersion}.linux.i386.deb",
        linux_zip: "xuanxuan.{xxcVersion}.linux64.zip",
        linux_targz: "xuanxuan.{xxcVersion}.linux.x64.tar.gz",
        linux_targz_32: "xuanxuan.{xxcVersion}.linux.ia32.tar.gz",
        linux_rpm: "xuanxuan.{xxcVersion}.linux.x86_64.rpm",
        linux_rpm_32: "xuanxuan.{xxcVersion}.linux.i686.rpm",
        ranzhi_server: "xuanxuan.ranzhi.{xxbVersion}.zip",
        zentao_server: "xuanxuan.zentao.{xxbVersion}.zip",
        source: "xuanxuan.source.{ver}.zip",
        xxd_win32: "xxd.{xxdVersion}.win32.zip",
        xxd_win64: "xxd.{xxdVersion}.win.x64.zip",
        xxd_mac: "xxd.{xxdVersion}.mac.tar.gz",
        xxd_linux32: "xxd.{xxdVersion}.linux.ia32.tar.gz",
        xxd_linux64: "xxd.{xxdVersion}.linux.x64.tar.gz",
        xxb_source: "xxb.{xxbVersion}.zip",
        xxb_source_php53: "xxb.{xxbVersion}.php53.zip",
        xxb_source_php70: "xxb.{xxbVersion}.php70.zip",
        xxb_source_php71: "xxb.{xxbVersion}.php71.zip",
        xxb_source_php72: "xxb.{xxbVersion}.php72.zip",
        xxb_win64_zbox: "xuan.{xxbVersion}.zbox.win.x64.exe",
        xxb_win64: "xxb.{xxbVersion}.win64.exe",
        xxb_win32: "xxb.{xxbVersion}.win32.exe",
        xxb_zbox64: "xuan.{xxbVersion}.zbox.linux.x64.tar.gz",
        xxb_zbox32: "xxb.{xxbVersion}.zbox_32.tar.gz",
        xxb_linux_rpm: "xxb-{xxbVersion}-1.noarch.rpm",
        xxb_linux_deb: "xxb_{xxbVersion}_1_all.deb",
        android: "xuanxuan.android.{androidVersion}.apk",
        owt_docker: "owt.{owtVersion}.docker.tar.xz",
        owt_docker_baidu: "{downloadDockerBaidu}",
        jisti_docker: "{jitsiDownloadUrl}",
        windows_bundle: "xxb.{xxbVersion}.bundle.win64.zip",
        linux_bundle: "xxb.{xxbVersion}.bundle.zbox_64.tar.gz",
    }
};
xuanxuan.downloadUrlOrigin = xuanxuan.downloadUrl;
xuanxuan.downloadUrl = xuanxuan.downloadUrl.format(xuanxuan);
xuanxuan.androidDownloadUrl = xuanxuan.androidDownloadUrl.format(xuanxuan);

var timeNow = new Date().getTime();
for(var downloadType in xuanxuan.downloads) {
    var url = xuanxuan.downloads[downloadType];
    var preUrl = url.indexOf('{xxcVersion}') > -1 ? xuanxuan.downloadUrl.format({version: xuanxuan.xxcVersion}) :
        (url.indexOf('{xxbVersion}') > -1 ? xuanxuan.downloadUrl.format({version: xuanxuan.xxbVersion}) :
        (url.indexOf('{xxdVersion}') > -1 ? xuanxuan.downloadUrl.format({version: xuanxuan.xxdVersion}) :
        (url.indexOf('{androidVersion}') > -1 ? xuanxuan.androidDownloadUrl.format({version: xuanxuan.androidVersion}) : (url.indexOf('{owtVersion}') > -1 ? xuanxuan.owtDownloadUrl : xuanxuan.downloadUrl))));
    xuanxuan.downloads[downloadType] = url.format(xuanxuan);
    var thisDownloadUrl = xuanxuan.downloads[downloadType];
    if (thisDownloadUrl.indexOf('https://') !== 0 && thisDownloadUrl.indexOf('http://')) {
        thisDownloadUrl = preUrl + thisDownloadUrl;
    }
    xuanxuan['download.' + downloadType] = thisDownloadUrl;
    xuanxuan['filename.' + downloadType] = xuanxuan.downloads[downloadType];
};

$(function() {
    $('[data-xuanxuan]').each(function() {
        var $this = $(this);
        var data = $this.data('xuanxuan');
        $.each(data.split(' '), function(idx, dataItem) {
            dataItem = dataItem.split('|');
            var attr = dataItem[0] || 'text';
            var key = dataItem[1];
            var value = xuanxuan[key];
            if(!key || !value) {
                var oldValue = attr === 'text' ? $this.text() : $this.attr(attr);
                if(oldValue) value = oldValue.format(xuanxuan);
            }
            if(attr === 'text') {
                $this.text(value);
            } else {
                $this.attr(attr, value);
            }
        });
    });
    $('.text-xuanxuan').each(function()
    {
        var $this = $(this);
        var format = $this.text();
        $this.text(format.format(xuanxuan));
    });
    $('.link-xuanxuan').each(function()
    {
        var $this = $(this);
        var attrName = $this.is('img') ? 'src' : 'href';
        var format = $this.data(attrName) || $this.attr(attrName);
        if(format.indexOf('/#') === 0) format = format.substr(2);
        else if(format.indexOf('#') === 0) format = format.substr(1);
        $this.attr(attrName, format.format(xuanxuan));
    });
});

if(screen.width > 767){
    $('#words').attr('placeholder','搜一搜');
    $("#searchbar").insertAfter("#navbarWrapper");
    $("#siteNav").insertAfter("#searchbar");
} else {
    $("#siteNav").insertAfter("#siteTitle");
};

$(document).ready(function(){
    if(typeof headerList != 'undefined') return ;
    headerList = true;
    $('#footer #icpInfo').after('<a class="privacy" href="/page/xuan-privacypolicy.html">隐私政策</a>');
    $('.m-user-register .form-horizontal .agreement-form span').after('<span>和《<a href="/page/xuan-privacypolicy.html" target="_blank">隐私政策</a>》</span>');
});

$(document).on('click', '.icon_img_bg', function(){open_floatWindow();});


// 首页点击空白处登录弹框隐藏
$(document).click(function(e) {
    if($(this).children('html').hasClass('m-user-login')) {
        return;
    } else {
        $('#loginModal').hide();
        if(window.qrCodeTimer) clearInterval(window.qrCodeTimer);
        $('#whitePaper').remove();
    }
})
$(document).on('click', '#loginModal, #privacyagreement, #agreement', function(e) {
    e.stopPropagation();
})
function showModalLogin(id, elem,  moreTop, moreLeft, showHeader, style, callback)
{
    var isVisible = document.getElementById(id) && document.getElementById(id).offsetParent;
    if(isVisible) return false;
    if(!style) {
        style = {}
    }

    var modalLoginOptions =
    {
        url     : "/user-loginmodal.html",
        name    : id,
        keyboard: false,
        backdrop: 'static',
        loaded  : function() {
            $('#' + id).addClass('modalLogin');
            if(showHeader == 0) $('#' + id + ' .close').hide();
            if($('html').hasClass('m-user-login')) $('#loginModal').css('height', $('.page-wrapper').height() + 100);
            callback && callback();
        },
        onHide: function(){
            if(window.smsTimer) clearInterval(window.smsTimer);
            if(window.qrCodeTimer) clearInterval(window.qrCodeTimer);
        }
    };
    var myModalTrigger = new $.zui.ModalTrigger(modalLoginOptions);
    myModalTrigger.show();
}
$('.demo-link').click(function(e)
{
    e.preventDefault();
    if (location.pathname == createLink('user', 'login', 'referer=pcDemo') || location.pathname == createLink('user', 'login', 'referer=mobileDemo')) {
        return;
    }
    var demoLink = $(this).attr('href');
    getUserFingerprint().then(visitorID => {
        if (demoLink == v.demoPcUrl) 
        {
          var postFunc = 'pc';
        }
        if (demoLink == v.demoMobileUrl) 
        {
          var postFunc = 'mobile';
        }
        var postLink = `/demo-${postFunc}`;
        $.post(postLink, 
        {
            url: demoLink,
            fingerprint: visitorID,
            referrer: location.href
        }, function(response) 
        {
            if(response.result == 'success')
            {
                if(response.data.open) 
                {
                    sessionStorage.setItem('demoOpen', response.data.open);
                } 
                else 
                {
                    sessionStorage.removeItem('demoOpen');
                }

                if(response.data.locate)
                {
                    sessionStorage.setItem('demoLocate', response.data.locate);
                    $.cookie('noDemoLogin', 0, {path: config.cookiePath});
                }

               if (response.data.target === '_blank') {
                    // 1. 获取原始URL和时间戳
                    const originalUrl = response.data.url;
                    const timestamp = new Date().getTime();
                
                    // 2. 分离URL的hash部分（#及后面的内容）
                    let urlWithoutHash = originalUrl;
                    let hashPart = '';
                    const hashIndex = originalUrl.indexOf('#');
                    if (hashIndex !== -1) {
                        urlWithoutHash = originalUrl.slice(0, hashIndex); // 截取#前面的URL
                        hashPart = originalUrl.slice(hashIndex); // 截取#及后面的hash
                    }
                
                    // 3. 处理URL参数（删除原有v，添加新v）
                    // 兼容相对路径：如果URL是相对路径，拼接当前页面origin
                    const baseUrl = window.location.origin;
                    const urlObj = new URL(urlWithoutHash, baseUrl);
                    urlObj.searchParams.delete('v'); // 移除原有v参数
                    urlObj.searchParams.append('v', timestamp); // 添加新的时间戳v参数
                
                    // 4. 拼接回完整URL（处理后的参数 + 原始hash）
                    const newUrl = urlObj.toString() + hashPart;
                
                    // 5. 打开新窗口
                    window.open(newUrl, '_blank', 'noopener');
                }
                else 
                {
                    window.location.href = response.data.url;
                }
            }
        }, 'json')
    });
});

$('.faq-block .question').click(function()
{
    $(this).siblings('.answer').toggleClass('hide');
    $(this).find('i').toggleClass('rotate');
});

function throttle(func, limit) {
    let inThrottle;
    return function() {
        const args = arguments;
        const context = this;
        if (!inThrottle) {
            func.apply(context, args);
            inThrottle = true;
            setTimeout(() => inThrottle = false, limit);
        }
    }
}

$('#searchbar').click(function(e)
{
    e.stopPropagation();
});

$(document).click(function()
{
    $('#searchbar form').removeClass('active');
    $('#searchbar .search-btn').removeClass('show-form');
});

$('#searchbar .search-btn').click(function(e)
{
    e.stopPropagation();
   $(this).siblings().addClass('active'); 
   $(this).addClass('show-form');
});$(function()
{
    if(window.prettyPrint) {
        $('.article-content pre').addClass('prettyprint');
        window.prettyPrint();
    }
});
;
$(document).ready(function()
{
    $('a[data-download=1]').each(function()
    {   
        link = window.btoa(window.encodeURIComponent($(this).attr('href')));
        fileName = window.btoa(window.encodeURIComponent($(this).text()));
        $(this).attr('data-toggle', 'modal').attr('href', createLink('misc', 'download', 'link=' + link + '&fileName=' + fileName));
    }); 
})
;
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?d1c082425f9ca559c0c1ca5a8783cad0";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
;v.clickNavLogin = ';';v.genFingerprintError = ';';
    async function getUserFingerprint() {
        const agent = typeof (FingerprintJS) !== 'undefined' ? await FingerprintJS.load() : '';
        const result = agent ? await agent.get() : '';
        return result ? result.visitorId : '';
    }

    function debounce(fn, delay = 500) {
        let timer = null;
        return function () {
            if (timer) {
                clearTimeout(timer)
            }
            timer = setTimeout(() => {
                fn.apply(this, arguments);
                timer = null;
            }, delay);
        }
    }

    $().ready(function () {
        getUserFingerprint().then(result => {
            var mouseinTime, mouseoutTime;
            $('.telephone').hover(function () {
                    if ($(this).find('.service').length > 0) {
                        mouseinTime = new Date().getTime();
                    }
                    $(this).find('.popup').addClass('active')
                },
                function () {
                    if ($(this).find('.service').length > 0) {
                        mouseoutTime = new Date().getTime();
                        if (mouseoutTime - mouseinTime > 3000) {
                            const postData = {
                                fingerprint: result,
                                triggerType: 'hover',
                                location: 'rightDocker',
                                triggerTime: Math.round(mouseoutTime / 1000),
                                duration: Math.round((mouseoutTime - mouseinTime) / 1000)
                            };
                            $.post(createLink('contact', 'event'), postData);
                        }
                    }
                    $(this).find('.popup').removeClass('active')
                });

            var location;
            $('.contact-us').click(debounce(function (e) {
                location = $(this).data('location');
                e.preventDefault();
                const postData = {
                    fingerprint: result,
                    location: location,
                    triggerType: 'click',
                };
                $.post(createLink('contact', 'event'), postData);
            }));
        });
    });

    function checkDemoLogin(locate)
    {
        if(locate && locate.includes('checkUserMobile')) return false;

        const demoLocate = sessionStorage.getItem('demoLocate');
        const demoOpen = sessionStorage.getItem('demoOpen');

        if(demoOpen)
        {
            const newWindow = window.open(demoOpen, '_blank', 'noopener');
            setTimeout(function() {
                let windowVerified = false;
                if (newWindow) {
                    try {
                        const closed = newWindow.closed;
                        if (typeof closed !== 'undefined') {
                            if (closed === false) {
                                try {
                                    const width = newWindow.outerWidth;
                                    const height = newWindow.outerHeight;
                                    if (width > 0 && height > 0) {
                                        windowVerified = true;
                                    }
                                } catch(e2) {
                                    windowVerified = true;
                                }
                            }
                        }
                    } catch(e) {
                        // windowVerified = false
                    }
                }

                if (!windowVerified) {
                    if (window.location.href !== demoOpen) {
                        window.location.href = demoOpen;
                        sessionStorage.removeItem('demoOpen');
                        sessionStorage.removeItem('demoLocate');
                    }
                } else {
                    sessionStorage.removeItem('demoOpen');
                }
            }, 500);
        }

        if(demoLocate)
        {
            window.location.href = demoLocate;
            sessionStorage.removeItem('demoLocate');
            return true;
        }
        return false;
    }
