Sha256: 939b4ed53c9f868e5eb147144cc5bf20f666477b04fd41eecd0c21be670ccc91

Contents?: true

Size: 2 KB

Versions: 1

Compression:

Stored size: 2 KB

Contents

$(document).ready(function() {
    let analytics = new URL("https://rundocs-analytics.glitch.me/collect?v={{ version }}&lang={{ lang }}");
    let highlight = new URL(location.href).searchParams.get("highlight");

    SphinxRtdTheme.Navigation.reset = function() {
        const link = $(".wy-menu-vertical").find(`[href="${location.pathname}"]`);
        if (link.length > 0) {
            $(".wy-menu-vertical .current").removeClass("current");
            link.addClass("current");
            link.closest("li.toctree-l1").parent().addClass("current");
            link.closest("li.toctree-l1").addClass("current");
            link.closest("li.toctree-l2").addClass("current");
            link.closest("li.toctree-l3").addClass("current");
            link.closest("li.toctree-l4").addClass("current");
            link.closest("li.toctree-l5").addClass("current");
        }
    };
    SphinxRtdTheme.Navigation.enable(true);

    if (highlight) {
        $(".section").find("*").each(function() {
            try {
                if (this.outerHTML.match(new RegExp(highlight, "im"))) {
                    $(this).addClass("highlighted-box");
                }
            } catch (e) {
                feedback(["highlight", e.message]);
            }
        });
        $(".section").find(".highlighted-box").each(function() {
            if (($(this).find(".highlighted-box").length > 0)) {
                $(this).removeClass("highlighted-box");
            }
        });
    }
    for (let item in ui.admonition) {
        $(`.language-${item}`).each(function() {
            $(this).replaceWith(`<div class="admonition ${item}"><p class="admonition-title">${ui.admonition[item]}</p><p>${$(this).html()}</p></div>`);
        });
    }
    anchors.add();

    analytics.searchParams.append("user_lang", navigator.language);
    analytics.searchParams.append("host", location.host);
    analytics.searchParams.append("platform", navigator.platform);
    $.getJSON(analytics.toString(), (data) => $("#counter").html(data.count));
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-rtd-theme-1.1.1 _includes/assets/common.js