Skip to content
Snippets Groups Projects
bundle.js 1.23 KiB
Newer Older
import ClipboardJS from "clipboard/dist/clipboard";
Thijs Kinkhorst's avatar
Thijs Kinkhorst committed
import hljs from  "highlight.js/lib/core";
import xml from "highlight.js/lib/languages/xml";
import php from "highlight.js/lib/languages/php";
import json from "highlight.js/lib/languages/json";

$(document).ready(function () {
    // side menu
    $('#menuLink').click(function (e) {
        e.preventDefault();
        $('#layout').toggleClass('active');
Jaime Pérez Crespo's avatar
Jaime Pérez Crespo committed
        $('#foot').toggleClass('active');
        $(this).toggleClass('active');
    });
Tim van Dijen's avatar
Tim van Dijen committed
    $('.expandable > .expander').on('click', function (e) {
        e.preventDefault();
        let target = $(e.currentTarget);
        target.parents('.expandable').toggleClass('expanded');
        target.blur();
    });

    // syntax highlight
    hljs.registerLanguage('xml', xml);
    hljs.registerLanguage('php', php);
    hljs.registerLanguage('json', json);
Tim van Dijen's avatar
Tim van Dijen committed
    $('.code-box-content.xml, .code-box-content.php, .code-box-content.json').each(function (i, block) {
        hljs.highlightBlock(block)
    });

    // clipboard
    let clipboard = new ClipboardJS('.copy');
Tim van Dijen's avatar
Tim van Dijen committed
    clipboard.on('success', function (e) {
        setTimeout(function () {
            e.clearSelection();
        }, 150);
    });
Tim van Dijen's avatar
Tim van Dijen committed
});