/* Js for , Version=1776439990 */
 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"};;v.pageID = 270;;		;(function() {
		    var classifyContainer = $('#switchBtn');
		    var classifyLength    = classifyContainer.children('li').length;
		    var url           = location.search;
		    var urlIndex      = url.indexOf('=') + 1;
            var urlLength     = url.length; 
            var urlID         = url.substring(urlIndex, urlLength);
            
		    function init()
		    {
		        //set size
		        $('.main').height($(window).height() - 50);
			    $('#demoShow').height($('.content').height());
			    
		        //set theme id
		        classifyContainer.children('li').each(function ()
		        {
                    $(this).find('li').each(function ()
                    {
                        var themeUrl  = $(this).find('a').attr('href');
                        var themeID   = themeUrl.substring(7, themeUrl.indexOf('.'));
                        
                        $(this).attr('data-ID', themeID);
                        $(this).find('a').attr('data-href', themeUrl).attr('href', '');
                        $(this).on('click', function ()
                        {
                            activeThemeID = $(this).attr('data-id');//get active theme id
                            addBuyTheme(activeThemeID);//buy theme btn.
                            
                            $('.loading').show();
                            if($(this).hasClass('mobile'))
                            {
                                $('.demoContainer').addClass('mobileDemo');
					            $('#demoShow').height(606);
					            themeUrl = themeUrl + 'index.mhtml';
                            }
                            else
                            {
                                $('.demoContainer').removeClass('mobileDemo');
					            $('#demoShow').height($(window).height());
                            }
                            addTitle('', $(this).find('a').html());
                            addActive($(this));
                            $('#demoShow').attr('src', $(this).find('a').attr('data-href'));  
                            
                            $('#demoShow').load(function() 
                            {
                                $('.loading').fadeOut();
                            });
                            return false;
                        });
                    }); 
                    
                    $(this).on('click', function ()
                    {
                        var cloneTheme    = $(this).find('ul').clone(true);
                        $('.pageCards').html(cloneTheme);
                        
                        var nowTheme      = $('.pageCards').find('li').eq(0);
                        var classifyTitle = $(this).children('span').html();
                        var themeTitle    = nowTheme.find('a').html();
                        
                        addTitle(classifyTitle, themeTitle);
                        addActive($(this));
                        addActive(nowTheme);
                        $('.pageCards').find('li').eq(0).trigger('click');
                    });
		        });
		        
		        //random
		        var classifyRandom = Math.round(classifyLength * Math.random());
		        if(url != '')
		        {
		            urlSelect();
		        }
		        else
		        {
		            classifyContainer.children('li').eq(classifyRandom).trigger('click');
		        }   
		    }
		    init();
			
			function urlSelect()
			{
			    $('#switchBtn a').each(function (index){
		            if($(this).parent().attr('data-id') == urlID)
		            {
		                $(this).parent().parent().parent().trigger('click');
		                $('.pageCards li').each(function ()
		                {
		                    if($(this).attr('data-id') == urlID)
		                    {
		                        $(this).trigger('click');
		                    }
		                });
		            }
			    });
			}
			
			function addActive(self)
			{
			    self.addClass('active');
			    self.siblings().removeClass('active');
			}
			
			function addTitle(classify, theme)
			{
			    if(classify == '')
			    {
			    }
			    else
			    {
    			    //classify
    			    $('.nav .classify').find('span').html(classify);
			    }
			    //theme
			    $('.themeContainer').children('button').find('.title').html(theme);
			}
			
			//buy Btn
			function addBuyTheme(activeThemeID)
			{
			    var buyThemeUrl   = "https://www.chanzhi.org/theme-view-" + activeThemeID + ".html";
			    var buyPackageUrl = "https://jianzhan.chanzhi.org/product-buy-" + activeThemeID + ".html";
			    if(typeof(initBuyThemeBtn) === 'undefined')
			    {
			        //init
			        initBuyThemeBtn = true;
                    var sideHtml = '<div id="buyTheme">' +
                                   '<a class="buyPackage" target="_blank" href="' + buyPackageUrl + '">' +
                                   '<div class="front"><span>立即购买</span></div>' +
                                   '</a>' +
                                   '</div>';
                                   
                    $('.main').append(sideHtml);
			    
			    }
			    else
			    {
			        //update buy theme id
			        $('#buyTheme').find('.buyPackage').attr('href', buyPackageUrl);
			    }
		    }
			
		})();
		        
		$(function(){
		    $('.navbar-nav > li a b').removeClass('caret').addClass('carets');
		});
		/**
 * StyleFix 1.0.3 & PrefixFree 1.0.7
 * @author Lea Verou
 * MIT license
 */(function(){function t(e,t){return[].slice.call((t||document).querySelectorAll(e))}if(!window.addEventListener)return;var e=window.StyleFix={link:function(t){try{if(t.rel!=="stylesheet"||t.hasAttribute("data-noprefix"))return}catch(n){return}var r=t.href||t.getAttribute("data-href"),i=r.replace(/[^\/]+$/,""),s=t.parentNode,o=new XMLHttpRequest,u;o.onreadystatechange=function(){o.readyState===4&&u()};u=function(){var n=o.responseText;if(n&&t.parentNode&&(!o.status||o.status<400||o.status>600)){n=e.fix(n,!0,t);if(i){n=n.replace(/url\(\s*?((?:"|')?)(.+?)\1\s*?\)/gi,function(e,t,n){return/^([a-z]{3,10}:|\/|#)/i.test(n)?e:'url("'+i+n+'")'});var r=i.replace(/([\\\^\$*+[\]?{}.=!:(|)])/g,"\\$1");n=n.replace(RegExp("\\b(behavior:\\s*?url\\('?\"?)"+r,"gi"),"$1")}var u=document.createElement("style");u.textContent=n;u.media=t.media;u.disabled=t.disabled;u.setAttribute("data-href",t.getAttribute("href"));s.insertBefore(u,t);s.removeChild(t);u.media=t.media}};try{o.open("GET",r);o.send(null)}catch(n){if(typeof XDomainRequest!="undefined"){o=new XDomainRequest;o.onerror=o.onprogress=function(){};o.onload=u;o.open("GET",r);o.send(null)}}t.setAttribute("data-inprogress","")},styleElement:function(t){if(t.hasAttribute("data-noprefix"))return;var n=t.disabled;t.textContent=e.fix(t.textContent,!0,t);t.disabled=n},styleAttribute:function(t){var n=t.getAttribute("style");n=e.fix(n,!1,t);t.setAttribute("style",n)},process:function(){t('link[rel="stylesheet"]:not([data-inprogress])').forEach(StyleFix.link);t("style").forEach(StyleFix.styleElement);t("[style]").forEach(StyleFix.styleAttribute)},register:function(t,n){(e.fixers=e.fixers||[]).splice(n===undefined?e.fixers.length:n,0,t)},fix:function(t,n,r){for(var i=0;i<e.fixers.length;i++)t=e.fixers[i](t,n,r)||t;return t},camelCase:function(e){return e.replace(/-([a-z])/g,function(e,t){return t.toUpperCase()}).replace("-","")},deCamelCase:function(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}};(function(){setTimeout(function(){t('link[rel="stylesheet"]').forEach(StyleFix.link)},10);document.addEventListener("DOMContentLoaded",StyleFix.process,!1)})()})();(function(e){function t(e,t,r,i,s){e=n[e];if(e.length){var o=RegExp(t+"("+e.join("|")+")"+r,"gi");s=s.replace(o,i)}return s}if(!window.StyleFix||!window.getComputedStyle)return;var n=window.PrefixFree={prefixCSS:function(e,r,i){var s=n.prefix;n.functions.indexOf("linear-gradient")>-1&&(e=e.replace(/(\s|:|,)(repeating-)?linear-gradient\(\s*(-?\d*\.?\d*)deg/ig,function(e,t,n,r){return t+(n||"")+"linear-gradient("+(90-r)+"deg"}));e=t("functions","(\\s|:|,)","\\s*\\(","$1"+s+"$2(",e);e=t("keywords","(\\s|:)","(\\s|;|\\}|$)","$1"+s+"$2$3",e);e=t("properties","(^|\\{|\\s|;)","\\s*:","$1"+s+"$2:",e);if(n.properties.length){var o=RegExp("\\b("+n.properties.join("|")+")(?!:)","gi");e=t("valueProperties","\\b",":(.+?);",function(e){return e.replace(o,s+"$1")},e)}if(r){e=t("selectors","","\\b",n.prefixSelector,e);e=t("atrules","@","\\b","@"+s+"$1",e)}e=e.replace(RegExp("-"+s,"g"),"-");e=e.replace(/-\*-(?=[a-z]+)/gi,n.prefix);return e},property:function(e){return(n.properties.indexOf(e)?n.prefix:"")+e},value:function(e,r){e=t("functions","(^|\\s|,)","\\s*\\(","$1"+n.prefix+"$2(",e);e=t("keywords","(^|\\s)","(\\s|$)","$1"+n.prefix+"$2$3",e);return e},prefixSelector:function(e){return e.replace(/^:{1,2}/,function(e){return e+n.prefix})},prefixProperty:function(e,t){var r=n.prefix+e;return t?StyleFix.camelCase(r):r}};(function(){var e={},t=[],r={},i=getComputedStyle(document.documentElement,null),s=document.createElement("div").style,o=function(n){if(n.charAt(0)==="-"){t.push(n);var r=n.split("-"),i=r[1];e[i]=++e[i]||1;while(r.length>3){r.pop();var s=r.join("-");u(s)&&t.indexOf(s)===-1&&t.push(s)}}},u=function(e){return StyleFix.camelCase(e)in s};if(i.length>0)for(var a=0;a<i.length;a++)o(i[a]);else for(var f in i)o(StyleFix.deCamelCase(f));var l={uses:0};for(var c in e){var h=e[c];l.uses<h&&(l={prefix:c,uses:h})}n.prefix="-"+l.prefix+"-";n.Prefix=StyleFix.camelCase(n.prefix);n.properties=[];for(var a=0;a<t.length;a++){var f=t[a];if(f.indexOf(n.prefix)===0){var p=f.slice(n.prefix.length);u(p)||n.properties.push(p)}}n.Prefix=="Ms"&&!("transform"in s)&&!("MsTransform"in s)&&"msTransform"in s&&n.properties.push("transform","transform-origin");n.properties.sort()})();(function(){function i(e,t){r[t]="";r[t]=e;return!!r[t]}var e={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};e["repeating-linear-gradient"]=e["repeating-radial-gradient"]=e["radial-gradient"]=e["linear-gradient"];var t={initial:"color","zoom-in":"cursor","zoom-out":"cursor",box:"display",flexbox:"display","inline-flexbox":"display",flex:"display","inline-flex":"display"};n.functions=[];n.keywords=[];var r=document.createElement("div").style;for(var s in e){var o=e[s],u=o.property,a=s+"("+o.params+")";!i(a,u)&&i(n.prefix+a,u)&&n.functions.push(s)}for(var f in t){var u=t[f];!i(f,u)&&i(n.prefix+f,u)&&n.keywords.push(f)}})();(function(){function s(e){i.textContent=e+"{}";return!!i.sheet.cssRules.length}var t={":read-only":null,":read-write":null,":any-link":null,"::selection":null},r={keyframes:"name",viewport:null,document:'regexp(".")'};n.selectors=[];n.atrules=[];var i=e.appendChild(document.createElement("style"));for(var o in t){var u=o+(t[o]?"("+t[o]+")":"");!s(u)&&s(n.prefixSelector(u))&&n.selectors.push(o)}for(var a in r){var u=a+" "+(r[a]||"");!s("@"+u)&&s("@"+n.prefix+u)&&n.atrules.push(a)}e.removeChild(i)})();n.valueProperties=["transition","transition-property"];e.className+=" "+n.prefix;StyleFix.register(n.prefixCSS)})(document.documentElement);
;v.pageLayout = "object";;$(document).ready(function()
{
    $('.nav-page-' + v.pageID + ':first').addClass('active');
    $('#navbar li.active').parents('li').addClass('active');

    function basename(str)
    {
        var pos = str.lastIndexOf('/');
        return str.substring(pos + 1,str.length);
    }

    $('.article-content img').click(function(){
        var itemSrc  = $(this).attr('src');
        var itemName = basename(itemSrc).split('&')[0];
        if(typeof(itemName) == 'string')
        {
            $('.files-list .' + itemName).click();
        }
    });
});
$('#siteNav').insertAfter('#navbarWrapper');
$('#license').insertAfter('#siteNav');
$('#searchbar').insertAfter('#license');
$('.m-usercase-view .page-content>.panel').insertAfter('.col-md-10 .panel');
$('#words').attr('placeholder','搜索');


$(document).ready(function(){
    if(typeof headerList != 'undefined') return ;
    headerList = true;
    $("#searchbar").hide();
    $("#license .search").click(function(){
        $("#searchbar").toggle();
    });
});

$(".span-oauth .sina").mouseover(function(){
    $(".sina-content").show();
});
$(".span-oauth .sina").mouseout(function(){
    $(".sina-content").hide();
});
$(".span-oauth .qq").mouseover(function(){
    $(".qq-content").show();
});
$(".span-oauth .qq").mouseout(function(){
    $(".qq-content").hide();
});$(document).ready(function(){
    var navS = $('.zdoo-nav ul li');
    navVertical = $('.zdoo-content .tab-pane');
    for( var i = 0; i < navS.length; i++ ){
        $(navS.eq(i)).on( 'click', function (event){
            var thisIndex = $(this).index();
            $(this).addClass("current").siblings().removeClass('current');
            navVertical.eq( thisIndex ).css("display", "block").siblings().css("display", "none");
            console.log();
        });
    };
});
$('.zd-main .zd-r a').attr({'data-toggle':'lightbox'});
$('.zd-main .zd-r a').attr({'data-group':'image-group-1'});
;
$(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?29974d7dcc46e26238a69d76e709443d";
  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');}  
                        }  
                    }  
                });
            }
        }
    );
}
