Subversion Repositories archerygear

Rev

Rev 6 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5 - 1
function openPage(pageName, elmnt) {
2
    // Hide all elements with class="tabcontent" by default */
3
    var i, tabcontent, tablinks;
4
    tabcontent = document.getElementsByClassName("tabcontent");
5
    for (i = 0; i < tabcontent.length; i++) {
6
        tabcontent[i].style.display = "none";
7
    }
8
 
9
    // Remove the background color of all nav-links/buttons
10
    tablinks = document.getElementsByClassName("nav-link");
11
    for (i = 0; i < tablinks.length; i++) {
12
        tablinks[i].style.backgroundColor = "";
13
    }
14
 
15
    // Show the specific tab content and scroll to top
16
    document.getElementById(pageName).style.display = "block";
17
    document.body.scrollTop = document.documentElement.scrollTop = 0;
18
 
19
    // Change color for active button
20
    elmnt.style.backgroundColor = "#666";
21
}
22
 
23
// Get the element with id="defaultOpen" and click on it
24
document.getElementById("defaultOpen").click();
25
 
26
function initIframes() {
27
    var iframeDefer = document.getElementsByTagName('iframe');
28
    for (var i = 0; i < iframeDefer.length; i++) {
29
        if (iframeDefer[i].getAttribute('data-src')) {
30
            iframeDefer[i].setAttribute('src', iframeDefer[i].getAttribute('data-src'));
31
        }
32
    }
33
}
34
window.onload = initIframes;
35
 
36
jQuery(document).on('copy', function(e) {
37
    var sel = window.getSelection();
38
    var copyFooter = "<br /><br /> Source: <a href='" + document.location.href + "'>" + document.location.href + "</a>";
39
    var copyHolder = $('<div>', {html: sel+copyFooter, style: {position: 'absolute', left: '-99999px'}});
40
    $('body').append(copyHolder);
41
    sel.selectAllChildren( copyHolder[0] );
42
    window.setTimeout(function() {
43
        copyHolder.remove();
44
    },0);
45
}
46
);