/* Js for , Version=1794157888 */
 ;if(typeof(v) != "object") v = {};v.theme = {"template":"default","theme":"wide","device":"desktop"};;v.lang = {"confirmDelete":"\u60a8\u786e\u5b9a\u8981\u6267\u884c\u5220\u9664\u64cd\u4f5c\u5417\uff1f","deleteing":"\u5904\u7406\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()
{
  $('.carousel-caption-title').css('color', $('.carousel-caption-title').data('color'));
});
;$('.icon-remove').click(function(e){
    e.stopPropagation();
    $(this).parents('.block-system-slide').remove();
    $('#header').css('top', 0);
    $('.page-wrapper').css('marginTop', '100px');
    resetStyle();
    localStorage.setItem('adClose', Date.now() + 7 * 24 * 3600 * 1000);
});

if(localStorage.getItem('adClose'))
{
    var now = new Date().getTime();
    if(now > Number(localStorage.getItem('adClose')))
    {
        localStorage.removeItem('adClose');
    }
    $('#header').css('top', 0);
    $('#block1504').hide();
    $('.page-wrapper').css('marginTop', '100px');
    resetStyle();
}

if(!localStorage.getItem('adClose') && $('.salon-ad').length > 0)
{
    $('#block1504').show();
    $('#header').css('top', '60px');
    $('.page-wrapper').css('marginTop', '160px');
    $('.parent-category').css('top', '88px');
    if($('html').hasClass('m-book-read'))
    {
        $('.search-wrap').css('top', '60px');
        $('.page-wrapper').css('marginTop', '60px');
    }
    if($('.ad-remove').length > 0) $('.table-heading').css('top', '159px');
}

function resetStyle()
{
    if($('html').hasClass('m-book-read'))
    {
        $('.search-wrap').css('top', 0);
        $('.page-wrapper').css('marginTop', 0);
    }
    $('.table-heading, .m-zentaoversion-history .type-title').css('top', '100px');
    $('.parent-category').css('top', '28px');
    $("#navbar[data-type='new_desktop_top'] .nav-item > .mega, .m-forum .directory, .m-ask .page-wrapper .col-md-2 .panel").css('top', '100px');
};
/* 国产替代导航 A/B 实验埋点：仅记录点击，POST 至 /event-log.html。 */
$(function()
{
    var BEACON = '/event-log.html';
    var ua = navigator.userAgent || '';
    if(/bot|crawl|spider|slurp|bingpreview|facebookexternalhit|monitor|headless/i.test(ua)) return;

    function send(node)
    {
        if(!node) return;
        $.ajax({
            url: BEACON,
            type: 'POST',
            data: {
                objectType: 'domestic_nav',
                objectID: 0,
                extra: 'domestic_nav_click',
                content: node.data('label') || '',
            }
        });
    }

    $('[data-experiment]').on('click', function()
    {
        send($(this));
    });
});

  /* 顶部导航选中态：根据当前 URL 高亮所属一级菜单。 */
  function normalizeNavHref(href)
  {
      var link = document.createElement("a");
      link.href = href;
      return {
          pathname: link.pathname || "/",
          search:   link.search || "",
          hash:     link.hash || "",
          hostname: link.hostname || ""
      };
  }

  var $newNav = $("#navbar[data-type=\"new_desktop_top\"]");
  if($newNav.length)
  {
      var currentPath = location.pathname + location.search;
      var currentURL  = location.pathname + location.search + location.hash;
      var hasActive   = $newNav.find(".navbar-nav > li.active").length > 0;

      if(!hasActive)
      {
          $newNav.find(".navbar-nav > li").each(function()
          {
              var $top    = $(this);
              var matched = false;

              $top.find("a").each(function()
              {
                  var href = $(this).attr("href");
                  if(!href || href.charAt(0) === "#") return;

                  var normalized = normalizeNavHref(href);
                  if(normalized.hostname && normalized.hostname !== location.hostname) return;

                  var navPath = normalized.pathname + normalized.search;
                  var navFull = navPath + normalized.hash;
                  if(navPath === currentPath || (normalized.hash && navFull === currentURL))
                  {
                      matched = true;
                      return false;
                  }
              });

              if(matched)
              {
                  $top.addClass("active");
                  return false;
              }
          });
      }
  }
;v.random = "20c36d93ce4361baa22a27058585e517";;v.extAutoDownloadID = 0;;v.skillAutoDownloadID = 0;;v.isUserLoginPage = true;;v.mobileWrongMessage = "\u624b\u673a\u53f7\u8f93\u5165\u9519\u8bef\u8bf7\u91cd\u65b0\u8f93\u5165";;v.mobileLoginAgreement = "\u8bf7\u540c\u610f\u4ee5\u4e0a\u534f\u8bae";;v.codeWrongMessage = "\u8bf7\u8f93\u51654\u4f4d\u6570\u5b57\u7684\u9a8c\u8bc1\u7801";;setTimeout(function(){$('#contactModal .modal-header .close').html('<span aria-hidden="true">×</span>')}, 500);
$('#contactModal').on('shown.zui.modal', function() {
    if($('.user-dropdown-menu').length > 0)
    {
        $.post(createLink('user', 'behavior'), {
            referrer: document.referrer,
            url: '/contactus',
            title: '联系我们',
            timestamp: Date.parse(new Date()) / 1000
      });
    }
    else
    {
        var userBehaviorData = JSON.parse(localStorage.getItem('userBehavior'));
        if(!userBehaviorData){ userBehaviorData = []; }
        userBehaviorData.push({
            referrer: document.referrer,
            url: '/contactus',
            title: '联系我们',
            timestamp: Date.parse(new Date()) / 1000
        })
        localStorage.setItem('userBehavior', JSON.stringify(userBehaviorData));
    }
});;setTimeout(function(){$('#touchModal .modal-header .close').html('<span aria-hidden="true">×</span>')}, 500);;let page = 'register';
if(location.href.includes('demo'))     page = 'demo';
if(location.href.includes('download')) page = 'download';
if(localStorage.getItem('giftType'))   page = localStorage.getItem('giftType');

const titleMap = {
    register: '注册成功',
    demo: '感谢试用',
    download: '感谢下载'
};
const descMap = {
    register: '注册',
    demo: '试用',
    download: '下载'
};

const tagSrc = `https://static.zentao.net/web/data/source/zentao/default/wide/${page}-tag.png`;
$('.gift-tag').attr('src', tagSrc);
$('.title-success').text(`${titleMap[page]}`);
$('.desc-tips').text(`${descMap[page]}`);
$('.gift-list').addClass(page);
;/* Keep session random valid. */
needPing = true;
$('#submit').click(function()
{
    var loginText = $(this).val();
    $(this).val($(this).data('loading'));
    var password = $('#password').val();
    var reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
    var hasCaptcha = false;
    if(!reg.test($('#account').val())) password = md5(md5(md5($('#password').val()) + $('#account').val()) + v.random);
    if($('.captcha').size() > 0)
    {
        hasCaptcha = true;
        captchaInput = $('.captcha:last input:text').attr('id');
    }

    getFingerprint().then(result =>
    {
        loginURL = createLink('user', 'login');
        postData = "account=" + $('#account').val() + '&password=' + encodeURIComponent(password) + '&referer=' + encodeURIComponent($('#referer').val()) + '&fingerprint=' + result;
        if(hasCaptcha) postData += '&' + captchaInput + '=' + $('#' + captchaInput).val();
        $.ajax(
        {
            type: "POST",
            data: postData,
            u