pgleadershipbook
This repository has no backups
This repository's network speed is throttled to 100KB/sec
Upgrade your account to fix these warnings, or use backups.vc for automated backups
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
//-------------------------------------------------------------------- // Tabs //-------------------------------------------------------------------- var tabLinks = new Array(); var contentDivs = new Array(); function init () { // Grab the tab links and content divs from the page var tabListItems = document.getElementById('tabs').childNodes; console.log(tabListItems); for (var i = 0; i < tabListItems.length; i ++) { if (tabListItems[i].nodeName == "LI") { var tabLink = getFirstChildWithTagName(tabListItems[i], 'A'); var id = getHash(tabLink.getAttribute('href')); tabLinks[id] = tabLink; contentDivs[id] = document.getElementById(id); } } // Assign onclick events to the tab links, and // highlight the first tab var i = 0; for (var id in tabLinks) { tabLinks[id].onclick = showTab; tabLinks[id].onfocus = function () { this.blur() }; if (i == 0) { tabLinks[id].className = 'active'; } i ++; } // Hide all content divs except the first var i = 0; for (var id in contentDivs) { if (i != 0) { console.log(contentDivs[id]); contentDivs[id].className = 'content hide'; } i ++; } } //-------------------------------------------------------------------- function showTab () { var selectedId = getHash(this.getAttribute('href')); // Highlight the selected tab, and dim all others. // Also show the selected content div, and hide all others. for (var id in contentDivs) { if (id == selectedId) { tabLinks[id].className = 'active'; contentDivs[id].className = 'content'; } else { tabLinks[id].className = ''; contentDivs[id].className = 'content hide'; } } // Stop the browser following the link return false; } //-------------------------------------------------------------------- function getFirstChildWithTagName (element, tagName) { for (var i = 0; i < element.childNodes.length; i ++) { if (element.childNodes[i].nodeName == tagName) { return element.childNodes[i]; } } } //-------------------------------------------------------------------- function getHash (url) { var hashPos = url.lastIndexOf('#'); return url.substring(hashPos + 1); } //-------------------------------------------------------------------- function toggle (elem) { elem = document.getElementById(elem); if (elem.style && elem.style['display']) { // Only works with the "style" attr var disp = elem.style['display']; } else if (elem.currentStyle) { // For MSIE, naturally var disp = elem.currentStyle['display']; } else if (window.getComputedStyle) { // For most other browsers var disp = document.defaultView.getComputedStyle(elem, null).getPropertyValue('display'); } // Toggle the state of the "display" style elem.style.display = disp == 'block' ? 'none' : 'block'; return false; } |
Commits for pgleadershipbook/trunk/app/Views/errors/html/debug.js
Revision | Author | Commited | Message |
---|---|---|---|
2 | tporter | Thu 04 Feb, 2021 09:33:04 +0000 | PG Leadership book initial commit |