Subversion Repositories archerygear

Rev

Rev 6 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

function openPage(pageName, elmnt) {
    // Hide all elements with class="tabcontent" by default */
    var i, tabcontent, tablinks;
    tabcontent = document.getElementsByClassName("tabcontent");
    for (i = 0; i < tabcontent.length; i++) {
        tabcontent[i].style.display = "none";
    }

    // Remove the background color of all nav-links/buttons
    tablinks = document.getElementsByClassName("nav-link");
    for (i = 0; i < tablinks.length; i++) {
        tablinks[i].style.backgroundColor = "";
    }

    // Show the specific tab content and scroll to top
    document.getElementById(pageName).style.display = "block";
    document.body.scrollTop = document.documentElement.scrollTop = 0;

    // Change color for active button
    elmnt.style.backgroundColor = "#666";
}

// Get the element with id="defaultOpen" and click on it
document.getElementById("defaultOpen").click();

function initIframes() {
    var iframeDefer = document.getElementsByTagName('iframe');
    for (var i = 0; i < iframeDefer.length; i++) {
        if (iframeDefer[i].getAttribute('data-src')) {
            iframeDefer[i].setAttribute('src', iframeDefer[i].getAttribute('data-src'));
        }
    }
}
window.onload = initIframes;

jQuery(document).on('copy', function(e) {
    var sel = window.getSelection();
    var copyFooter = "<br /><br /> Source: <a href='" + document.location.href + "'>" + document.location.href + "</a>";
    var copyHolder = $('<div>', {html: sel+copyFooter, style: {position: 'absolute', left: '-99999px'}});
    $('body').append(copyHolder);
    sel.selectAllChildren( copyHolder[0] );
    window.setTimeout(function() {
        copyHolder.remove();
    },0);
}
);