<!-- Footer -->
<footer style="padding-bottom: 35px">
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <ul class="list-inline text-center">
                    <% if (config.RSS) { %>
                    <li>
                        <a href="<%= config.root + 'feed.xml' %>">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-rss fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                    <% } %>
                    <% if (config.twitter_username) { %>
                    <li>
                        <a target="_blank" rel="noopener" href="https://twitter.com/<%= config.twitter_username %>">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-twitter fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                    <% } %>
                    <% if (config.zhihu_username) { %>
                    <li>
                        <a target="_blank" rel="noopener"
                            href="https://www.zhihu.com/people/<%= config.zhihu_username %>">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa  fa-stack-1x fa-inverse">知</i>
                            </span>
                        </a>
                    </li>
                    <% } %>

                    <% if (config.weibo_username) { %>
                    <li>
                        <a target="_blank" rel="noopener" href="https://weibo.com/u/<%= config.weibo_username %>">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-weibo fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                    <% } %>

                    <% if (config.facebook_username) { %>
                    <li>
                        <a target="_blank" rel="noopener"
                            href="https://www.facebook.com/<%= config.facebook_username %>">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-facebook fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                    <% } %>

                    <% if (config.github_username) { %>
                    <li>
                        <a target="_blank" rel="noopener" href="https://github.com/<%= config.github_username %>">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-github fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                    <% } %>

                    <% if (config.linkedin_username) { %>
                    <li>
                        <a target="_blank" rel="noopener"
                            href="https://www.linkedin.com/in/<%= config.linkedin_username %>">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-linkedin fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                    <% } %>

                </ul>
                <p class="copyright text-muted">
                    <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh"><img alt="知识共享许可协议"
                            style="border-width:0" src="https://cdn.jsdelivr.net/gh/gyj1109/Blog-Resources@latest/img/cc.png" /></a><br />本站采用<a rel="license"
                        title="Creative Commons Attribution-ShareAlike 4.0 International License"
                        href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh">知识共享署名-相同方式共享 4.0 国际许可协议</a>进行许可
                    <br>
                    Copyright &copy; <%= new Date().getFullYear() %> - <a href="/" target="_blank"
                        rel="noopener">Gyj1109</a>
                    <br>
                    Theme by <a href="https://huangxuan.me">Hux</a> • Hosted by <a
                        href="https://pages.github.com/">GitHub Pages</a>
                </p>
            </div>
        </div>
    </div>
</footer>

<!-- jQuery -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>

<!-- async load function -->
<script>
    function async(u, c) {
        var d = document, t = 'script',
            o = d.createElement(t),
            s = d.getElementsByTagName(t)[0];
        o.src = u;
        if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
        s.parentNode.insertBefore(o, s);
    }
</script>


<!-- jquery.pjax.js -->
<script src="https://cdn.jsdelivr.net/npm/jquery-pjax@2.0.1/jquery.pjax.min.js"></script>
<script>
    $(document).pjax('a', '#pjax', { fragment: ('#pjax'), timeout: 15000 });
    $(document).on('pjax:start', function () {
        /* JS to close the navbar on the phone */
        if (navOpen) handleMagic();
        /* JS to close the navbar on the phone */

        /* JS to clear the Interval */
        clearInterval(window.timer);
        /* JS to clear the Interval */

        /* JS to set NProgress */
        NProgress.configure({ minimum: 0.08, showSpinner: false, trickle: true, trickleSpeed: 175 });
        NProgress.start();
        /* JS to set NProgress */
    });
    $(document).on('pjax:end', function () {
        /* JS in footer.ejs */
        if ($('#tag_cloud').length !== 0) {
            $.fn.tagcloud.defaults = {
                color: { start: '#80CBC4', end: '#00695C' }
            };
            $('#tag_cloud a').tagcloud();
        }
        var $nav = document.querySelector("nav");
        if ($nav) FastClick.attach($nav);
        function generateCatalog(selector) {
            var P = $('div.post-container'), a, n, t, l, i, c;
            a = P.find('h1,h2,h3,h4,h5,h6');
            a.each(function () {
                n = $(this).prop('tagName').toLowerCase();
                i = "#" + $(this).prop('id');
                t = $(this).text();
                c = $('<a href="' + i + '" rel="nofollow">' + t + '</a>');
                l = $('<li class="' + n + '_nav"></li>').append(c);
                $(selector).append(l);
            });
            return true;
        }
        generateCatalog(".catalog-body");
        $(".catalog-toggle").click((function (e) {
            e.preventDefault();
            $('.side-catalog').toggleClass("fold")
        }))
        $('.catalog-body').onePageNav({
            currentClass: "active",
            changeHash: !1,
            easing: "swing",
            filter: "",
            scrollSpeed: 700,
            scrollOffset: 0,
            scrollThreshold: .2,
            begin: null,
            end: null,
            scrollChange: null,
            padding: 80
        });
        /* JS in footer.ejs */


        /* JS in hux-blog.js */
        $("table").wrap("<div class='table-responsive'></div>");
        $("table").addClass("table");
        $('iframe[src*="youtube.com"]').wrap('<div class="embed-responsive embed-responsive-16by9"></div>');
        $('iframe[src*="youtube.com"]').addClass('embed-responsive-item');
        $('iframe[src*="vimeo.com"]').wrap('<div class="embed-responsive embed-responsive-16by9"></div>');
        $('iframe[src*="vimeo.com"]').addClass('embed-responsive-item');
        var MQL = 1170;
        if ($(window).width() > MQL) {
            var headerHeight = $('.navbar-custom').height(),
                bannerHeight = $('.intro-header .container').height();
            $(window).on('scroll', {
                previousTop: 0
            },
                function () {
                    var currentTop = $(window).scrollTop(),
                        $catalog = $('.side-catalog');
                    if (currentTop < this.previousTop) {
                        if (currentTop > 0 && $('.navbar-custom').hasClass('is-fixed'))
                            $('.navbar-custom').addClass('is-visible');
                        else
                            $('.navbar-custom').removeClass('is-visible is-fixed');
                    } else {
                        $('.navbar-custom').removeClass('is-visible');
                        if (currentTop > headerHeight && !$('.navbar-custom').hasClass('is-fixed')) $('.navbar-custom').addClass('is-fixed');
                    }
                    this.previousTop = currentTop;
                    $catalog.show()
                    if (currentTop > (bannerHeight + 41))
                        $catalog.addClass('fixed');
                    else
                        $catalog.removeClass('fixed');
                });
        }
        /* JS in hux-blog.js */

        /* JS to set NProgress */
        NProgress.done();
        /* JS to set NProgress */

        /* JS to hide the navbar on the PC */
        if ($('.navbar-custom').hasClass('is-fixed')) $('.navbar-custom').removeClass('is-visible is-fixed');
        /* JS to hide the navbar on the PC */

        /* JS to reset PinchZoom.js */
        $('div.zoom').each(function () { new RTP.PinchZoom($(this), {}); });
    /* JS to reset PinchZoom.js */

    <% if (config.ga_track_id) { %>
    /* JS in footer.ejs for Google Analytics */
    var _gaId = '<%= config.ga_track_id %>';
            var _gaDomain = '<%= config.ga_domain %>';
            (function (i, s, o, g, r, a, m) {
                i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
                    (i[r].q = i[r].q || []).push(arguments)
                }, i[r].l = 1 * new Date(); a = s.createElement(o),
                    m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
            })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
            ga('create', _gaId, _gaDomain);
            ga('send', 'pageview');
    /* JS in footer.ejs for Google Analytics */
    <% } %>
});
</script>
<script>
    /* JS to reset PinchZoom.js */
    $('div.zoom').each(function () { new RTP.PinchZoom($(this), {}); });
    /* JS to reset PinchZoom.js */
</script>

<!-- jquery.tagcloud.js -->
<script>
    // only load tagcloud.js in tag.html
    if ($('#tag_cloud').length !== 0) {
        async("https://cdn.jsdelivr.net/gh/gyj1109/Blog/themes/huxblog/source/js/jquery.tagcloud.js", function () {
            $.fn.tagcloud.defaults = {
                //size: {start: 1, end: 1, unit: 'em'},
                color: { start: '#80CBC4', end: '#00695C' }
            };
            $('#tag_cloud a').tagcloud();
        })
    }
</script>

<!--fastClick.js -->
<script>
    async("https://cdn.jsdelivr.net/npm/fastclick@1.0.6/lib/fastclick.min.js", function () {
        var $nav = document.querySelector("nav");
        if ($nav) FastClick.attach($nav);
    })
</script>


<!-- Google Analytics -->

<% if (config.ga_track_id) { %>

<script>
    window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
    ga('create', '<%= config.ga_track_id %>', 'auto');
    ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>

<% } %>


<!-- Baidu Tongji -->
<% if (config.ba_track_id) { %>
<script>
    // dynamic User by Hux
    var _baId = '<%= config.ba_track_id %>';

    // Originial
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "//hm.baidu.com/hm.js?" + _baId;
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>
<% } %>

<!-- Side Catalog -->
<% if ((page.catalog)&&(!page.lock)) { %>
<script type="text/javascript">
    function generateCatalog(selector) {
        var P = $('div#main'), a, n, t, l, i, c;
        a = P.children('h1,h2,h3,h4,h5,h6');
        a.each(function () {
            n = $(this).prop('tagName').toLowerCase();
            i = "#" + $(this).prop('id');
            t = $(this).text();
            c = $('<a href="' + i + '" rel="nofollow">' + t + '</a>');
            l = $('<li class="' + n + '_nav"></li>').append(c);
            $(selector).append(l);
        });
        return true;
    }
    generateCatalog(".catalog-body");
    // toggle side catalog
    $(".catalog-toggle").click((function (e) {
        e.preventDefault();
        $('.side-catalog').toggleClass("fold")
    }))
    /*
     * Doc: https://github.com/davist11/jQuery-One-Page-Nav
     * Fork by Hux to support padding
     */
    async("https://cdn.jsdelivr.net/gh/davist11/jQuery-One-Page-Nav@3.0.0/jquery.nav.min.js", function () {
        $('.catalog-body').onePageNav({
            currentClass: "active",
            changeHash: !1,
            easing: "swing",
            filter: "",
            scrollSpeed: 700,
            scrollOffset: 0,
            scrollThreshold: .2,
            begin: null,
            end: null,
            scrollChange: null,
            padding: 80
        });
    });
</script>
<% } %>

<script>
    async("https://cdn.jsdelivr.net/npm/trianglify@2.0.0/dist/trianglify.min.js", function () {
        targetItem=document.getElementsByTagName("header")[0]
        if (targetItem.id != "404-intro-header") {
            var pattern = Trianglify({width: document.body.clientWidth * 1.2, height: document.body.clientWidth * 0.9, cell_size: Math.round(Math.random()*40) + 40, x_colors: 'random'});
            targetItem.style["background-image"] = 'url(' + pattern.png() + ')';
            async("https://cdn.jsdelivr.net/npm/colorthief@2.3.0/dist/color-thief.min.js", function () {
                var colorThief = new ColorThief();
                var rgb = colorThief.getColor(pattern.canvas());
                var hex = "#" + (((1 << 24) + (rgb[0] << 16) + (rgb[1] << 8) + rgb[2]).toString(16).slice(1));
                var metaThemeColor = document.querySelector("meta[name=theme-color]");
                metaThemeColor.setAttribute("content", hex);
            });
        }
    });
</script>

<script async src="<%- cdn_asset('themes/huxblog/source/js/hux-blog.min.js') %>"></script>
<script async src="https://cdn.jsdelivr.net/npm/bootstrap@3.4.1/dist/js/bootstrap.min.js"></script>
<script async src="<%- cdn_asset('themes/huxblog/source/js/jquery.tagcloud.min.js') %>"></script>
<script async src="https://cdn.jsdelivr.net/gh/davist11/jQuery-One-Page-Nav@3.0.0/jquery.nav.min.js"></script>
<script async src="https://cdn.jsdelivr.net/npm/pinch-zoom-js@2.3.4/dist/pinch-zoom.umd.min.js"></script>
<script async src="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js"></script>
