/usr/share/pyshared/bitten/htdocs/tabset.js is in trac-bitten 0.6+final-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | function makeTabSet(parentElement) {
var tabList = document.createElement("ul");
tabList.className = "tabs";
var contentDivs = document.createElement("div");
function makeTab(div) {
var title = div.firstChild;
while (title.nodeType != 1) title = title.nextSibling;
var tabItem = document.createElement("li");
if (!tabList.childNodes.length) tabItem.className = "active";
var link = document.createElement("a");
link.href = "#";
link.appendChild(title.firstChild);
tabItem.appendChild(link);
var contentDiv = document.createElement("div");
contentDiv.className = "tab-content";
while (div.childNodes.length) contentDiv.appendChild(div.firstChild);
if (tabList.childNodes.length) contentDiv.style.display = "none";
link.onclick = function() {
var child = contentDivs.firstChild;
while (child) {
if (child != contentDiv && child.nodeType == 1) {
child.style.display = "none";
}
child = child.nextSibling;
}
var item = tabList.firstChild;
while (item) {
if (item.nodeType == 1) {
item.className = item != tabItem ? "" : "active";
}
item = item.nextSibling;
}
contentDiv.style.display = "block";
return false;
}
contentDivs.appendChild(contentDiv);
tabList.appendChild(tabItem);
}
var divs = parentElement.getElementsByTagName("div");
for (var i = 0; i < divs.length; i++) {
var div = divs[i];
if (!/\btab\b/.test(div.className)) {
continue;
}
makeTab(div);
}
parentElement.appendChild(tabList);
parentElement.appendChild(contentDivs);
}
|