/* Js for , Version=1782355982 */
 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","hide":"\u9690\u85cf"};;if(location.href.includes('needEditNickname'))
{
    $('#editName').modal({
        show: true,
        backdrop: 'static',
        keyboard: false
    });
    $.setAjaxForm('#nicknameForm');
};v.formLayout = "global";;v.location = "\u7f8e\u56fd,\u7f8e\u56fd,,";;
$(document).ready(function()
{
    $(".chosen").chosen({no_results_text: '没有匹配的选项', placeholder_text:' ', disable_search_threshold: 10, width: '100%', search_contains: true});
    $('select.chosen-icons').chosenIcons({lang: 'zh-cn'});
});
;
$(function()
{

    $.fn.fixedDate = function()
    {
        return $(this).each(function()
        {
            var $this = $(this);
            if($this.offset().top + 200 > $(window).height())
            {
                $this.attr('data-picker-position', 'top-right');
            }

            if($this.val() == '0000-00-00')
            {
                $this.focus(function(){ if($this.val() == '0000-00-00') $this.val('').datetimepicker('update');}).blur(function(){ if($this.val() == '') $this.val('0000-00-00')});
            }
        });
    };


    var options =
    {
        language: 'zh-cn',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        showMeridian: 1,
        format: 'yyyy-mm-dd hh:ii'
    };


    var dateOptions = $.extend({}, options, {minView: 2, format: 'yyyy-mm-dd'});
    var timeOptions = $.extend({}, options, {startView: 1, minView: 0, maxView: 1, format: 'hh:ii'});

    $('.form-datetime').fixedDate().datetimepicker(options);
    $('.form-date').fixedDate().datetimepicker(dateOptions);
    $('.form-time').fixedDate().datetimepicker(timeOptions);

    $('.datepicker-wrapper').click(function()
    {
        $(this).find('.form-date, .form-datetime, .form-time').datetimepicker('show').focus();
    });

    $('.input-append.date').on('click', function(){
        $(this).find('input').datetimepicker('show').focus();
    }).find('input').datetimepicker($.extend({}, options, {pickerPosition: 'top-right'}));

});
;v.confirm = "\u63d0\u4ea4\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\uff0c\u786e\u5b9a\u8981\u63d0\u4ea4\u5417\uff1f";;v.fullScreen = 0;;v.type = "form";;v.formID = 5;;v.conditions = [];;v.applicationSuccess = "\u63d0\u4ea4\u6210\u529f";;v.applicationTip = "\u626b\u7801\u652f\u4ed8\u540e\u5373\u53ef\u5b8c\u6210\u62a5\u540d";;v.close = "\u5173\u95ed";;v.itemTotal = 0;;v.pageTotal = 0;;v.page = 1;;$(function(){
   $('.join').click(function(e) {
        e.stopPropagation();
        $(this).find('.code-wrap').toggle()
    })
    $(document).click(function(){
        $('.join .code-wrap').hide();
    })
    $('.code-wrap').click(function(e) {
        e.stopPropagation();
    })
    
    if($('#copyright').find('.footer-link').length === 0) {
        $('#copyright').after('<a href="http://www.easycorp.cn" target="_blank" class="footer-link">禅道软件（青岛）有限公司</a>')
    } 
})

;$(function()
{
    //if(v.fullScreen == 0 && $('.col-side').length > 0)
    //{
    //    var screenHeight = $(window).height();
    //    var mainTop      = $('.col-main').offset().top;
    //    var mainHeight   = $('.col-main').height();
    //    var sideHeight   = $('.col-side').height();
    //    if(mainTop + mainHeight < screenHeight)
    //    {
    //        if($('#pageFooter').length > 0)  $('#pageFooter').css('margin-top', sideHeight - mainHeight);
    //        if($('#pageFooter').length == 0) $('div[id^=form]').css('padding-bottom', sideHeight - mainHeight);
    //    }
    //}
    //else
    //{
    //    var documentHeight = $(document).height();
    //    var bodyHeight     = $('body').height();
    //    var screenHeight   = $(window).height();
    //    if(bodyHeight < screenHeight)
    //    {
    //        if($('#pageFooter').length > 0)  $('#pageFooter').css('margin-top', documentHeight - bodyHeight);
    //        if($('#pageFooter').length == 0) $('div[id^=form]').css('padding-bottom', documentHeight - bodyHeight);
    //    }
    //}

    citySelector();
    $('input, select, textarea').change(function()
    {
        processProgress();
    });

    /* Add class clicked to avoid click twice. */
    $('.file-name label, .file-name input[type=checkbox]').click(function()
    {
        $(this).parents('.file-name').find('input[type=checkbox]').addClass('clicked');
    });

    /* Check the radio button or checkbox when click the image or div.*/
    $('.file-icon-image, .file-name').click(function()
    {
        $(this).parents('.file-wrapper').find('input[type=radio]').prop('checked', true).change();

        var checkbox = $(this).parents('.file-wrapper').find('input[type=checkbox]');
        if(!checkbox.hasClass('clicked'))
        {
            if(checkbox.prop('checked'))
            {
                checkbox.prop('checked', false).change();
            }
            else
            {
                checkbox.prop('checked', true).change();
            }
        }
        $('.clicked').removeClass('clicked');
    });

    $.setAjaxForm('[id^=form]', function(response)
    {
        if(v.page < v.pageTotal && $('[id^=form]').find('.submit').is(':hidden')) $('[id^=form]').find('.submit').popover('destroy');

        if(response.result == 'success' && response.locate)
        {
            if(false) // $('form[id^=form]').attr('id') == 'forme4da3b7fbbce2345d7772b0674a318d5'
            {
                new $.zui.ModalTrigger({
                    className: 'application-form',
                    custom: `<div class="application-title text-primary"><img src="https://static.zentao.net/rongpm/source/default/wide/icon-application-success.png">${v.applicationSuccess}</div>
                            <img src="https://static.zentao.net/rongpm/source/default/wide/application-qrcode.png" class="application-qrcode">
                            <p class="application-tip">${v.applicationTip}</p>
                            <button class="btn-primary btn-close" data-dismiss="modal">${v.close}</button>
                            `
                }).show({
                    hidden: function() {
                        location.href = response.locate;
                    }
                });
                $('.popover').remove();
            }
            else
            {
                setTimeout(function() {location.href = response.locate;}, 1200);
            }
        }

        if(response.result == 'fail' && $.type(response.message) == 'object')
        {
            var index = 1;
            var page  = 0;
            var e     = $(window);
            $('.items > .item').each(function()
            {
                var $item = $(this);
                var id    = $(this).find('.item-content').attr('id');
                if($(this).find('span#' + id + 'Label').length > 0)
                {
                    $item.css('border', '1px solid #953B39');
                    if(index == 1)
                    {
                        page = $(this).parents('[id^=pageContent]').attr('data-id');
                        e    = $(this);
                    }
                    index++;
                }

                $(this).find('.item-content').find('input,select,textarea').change(function()
                {
                    $item.css('border', 'none');
                });
            });

            if(page > 0) changePage('goto', page, e);
        }
    });

    /* Submit form data. */
    $('#submit').click(function()
    {
        bootbox.confirm(v.confirm, function(result)
        {
            if(result) $('#submit').closest('form').submit();
            return true;
        });
        return false;
    });

    changePage();
});

/* Process progress style. */
function processProgress()
{
    var finished = 0;
    $('.item-content').each(function()
    {
        if($(this).find('input[type=text], select, textarea').length > 0)
        {
            if($(this).find('input[type=text], select, textarea').val() != '') finished++;
        }
        if($(this).find('input[type=radio], input[type=checkbox]').length > 0)
        {
            $(this).find('input[type=radio], input[type=checkbox]').each(function()
            {
                if($(this).prop('checked'))
                {
                    finished++;
                    return false;
                }
            });
        }
    });

    if(v.itemTotal > 0)
    {
        var percent = Math.round(finished / v.itemTotal * 10000) / 100;
        $('.progress-bar').attr('aria-valuenow', percent).css('width', percent + '%');
        $('.percent').html(percent + '%');
        $('.progressbar').addClass('show');
    }
}

function changePage(type, page, e)
{
    $('[id^=pageContent]').hide();
    $('#pageFooter .pager li').hide();

    if(type == 'prev') v.page--;
    if(type == 'next') v.page++;
    if(type == 'goto') v.page = page;

    if(v.page <= 1) $('#pageFooter .pager .previous.disabled').show();
    if(v.page >  1) $('#pageFooter .pager .previous').not('.disabled').show();
    if(v.page <  v.pageTotal) $('#pageFooter .pager .next').not('.disabled').show();
    if(v.page >= v.pageTotal) $('#pageFooter .pager .next.disabled').show();
    if(v.page >= v.pageTotal) $('#pageFooter .pager .submit').addClass('lastPageShowed').show();

    $('#pageFooter .pager .submit.lastPageShowed').show();

    $('#pageContent' + v.page).show();

    if(e === undefined)
    {
        window.scrollTo({top: 0});
    }
    else
    {
        $(window).scrollTop(e.offset().top);
    }
}

$(function(){
    $(".siteNav a[href*='register']").remove();
    $(".siteNav a[href*='login']").text('登录/注册');
    
    $('.all-bottom').prependTo('#footer');

    var windowHeight = $(window).innerHeight();
    var minHeight = windowHeight - $('#header').height() - $('#footer').height() + 30;
    if($('html').hasClass('m-user-settings')) minHeight = minHeight - 30;
    if($('.page-wrapper').height() < minHeight) {
        $('.page-wrapper').css('minHeight', minHeight)
    }
    
    if($(window).innerWidth() < 768) {
        if($('html').hasClass('m-ask')) {
            $('.tree > li').removeClass('open');
        }
        
        if($('html').hasClass('m-claim')) {
            $('.clickable-claim').click(function() {
                $('.popover').remove();
            });
        }
    }
    
    if(location.href.includes('rrpl-search')) {
        $('a[href="/rrpl.html"]').parent().addClass('active');
    }
    
    if($('html').hasClass('m-ask-view')) {
        $('a[href="/ask.html"]').parent().addClass('active');
    }
    
    if(location.pathname == '/') $('a[href="/index.html"]').parent().addClass('active');
    
    $('.m-claim-browse .status-list a:last-child').addClass('hide');
    $('.m-claim-browse .type-wrap').css('display', 'none');
    $('.m-claim-browse #keyword').attr('placeholder', '请输入您要搜索的实践');
    if($('.related-zentao').length > 0) $('.details .origin').after($('.details .related-zentao'));
});
;
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?3f3a48b32f0477a6748d1771a83f99a1";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
;
function loadCartInfo(twinkle)
{
    $('.siteNav').load(createLink('misc', 'printTopBar'),
        function()
        {
            if(twinkle)
            {
                bootbox.dialog(
                {
                    message: v.addToCartSuccess,
                    buttons:
                    {
                        back:
                        {
                            label:     v.lang.continueShopping,
                            className: 'btn-primary',
                            callback:  function(){location.reload();}
                        },
                        cart:
                        {
                            label:     v.gotoCart,
                            className: 'btn-primary',
                            callback:  function(){location.href = createLink('cart', 'browse');}
                        }
                    }
                });
            }
        }
    );
}
;
var hash = window.location.hash.substring(1);
var browserLanguage = navigator.language || navigator.userLanguage;
var resolution      = screen.availWidth + ' X ' + screen.availHeight;
$.get(createLink('log', 'record', "hash=" + hash), {browserLanguage:browserLanguage, resolution:resolution});
;
  var formId = '#form' + 'e4da3b7fbbce2345d7772b0674a318d5';
  getFingerprint().then(result =>
  {
    $(formId).append("<input type='hidden' id='fingerprint' name='fingerprint' value='" + result + "'>");

    $.post(createLink('misc', 'ping'), {id: 5, fingerprint: result});
  })
  if(v.type == 'exam')
  {
      $.get(createLink('form', 'ajaxGetTimeLeft', 'formID=' + v.formID), function(timeLeft)
      {
          if(!timeLeft) return false;

          interval = setInterval(function()
          {
              var hour   = Math.floor(timeLeft / 3600);
              var minute = Math.floor(timeLeft % 3600 / 60);
              var second = timeLeft % 60;

              if(hour   < 10) hour   = '0' + hour;
              if(minute < 10) minute = '0' + minute;
              if(second < 10) second = '0' + second;

              if(timeLeft >  0) $('.timeLeft').html('<i class="icon icon-time"> </i>' + hour + ':' + minute + ':' + second);
              if(timeLeft <= 0)
              {
                  $('#submit').closest('form').submit();
                  clearInterval(interval);
              }

              timeLeft--;
          }, 1000);
      });
  }
  