Sha256: d08d90aa0eeac07dc9c5ae1252fa6292b0945dd204863b291600bbac88b849b7

Contents?: true

Size: 1.91 KB

Versions: 1

Compression:

Stored size: 1.91 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) {
        $(".admonition-title").each(function() {
            $(this).html(ui.admonition[$(this).attr("ui")]);
        });
    }
    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.2 _includes/assets/common.js