PageSourceSearch

https://www.tps.org/common/controls/TabPortlet/tab-portlet-view.js

js tps.org collected 2026-09-24 12:32:04 UTC 1,993 bytes, 69 lines download raw bytes

1function registerAllTabs() {
2
3	var elList = document.getElementsByClassName('PO-wrapper PO-tabAccordion');
4
5	for (let i = 0; i < elList.length; i++) {
6		var el = elList[i];
7
8		var id = el.id;
9		var clientId = el.attributes['data-clientId'].value;
10
11		locationHashChanged(clientId, id);
12	}
13}
14
15function locationHashChanged(clientId, mainDivId) {
16
17	if (window.location.hash === '')
18		return;
19
20	var anchorName = window.location.hash.substring(1);
21
22	var found = false;
23	var mainDiv = document.getElementById(mainDivId);
24	var tabList = mainDiv.getElementsByTagName("a");
25
26	for (let i = 0; document.getElementById(clientId + "_divTabs_" + i) !== null; i++) {
27		var divId = clientId + "_divTabs_" + i;
28		var divEl = document.getElementById(divId);
29		
30		var anchorList = divEl.querySelectorAll('[name=\'' + anchorName + '\']');
31
32		for (let j = 0; j < anchorList.length; j++) {
33			var anchor = anchorList[j];
34
35			if (anchorList[j].tagName === 'A' && anchor.name === anchorName) {
36				found = true;
37
38				//trigger click event to select the tab contains the anchor link
39				$("#" + mainDivId + " .scrtabs-tabs-fixed-container a")[i].click();
40				// We can use { block: "center", inline: "nearest" } to set position in the middle of the page
41				anchor.scrollIntoView({ block: "center", inline: "nearest" });
42				break;
43			}
44		}
45
46		if (found === true)
47			break;
48	}
49}
50
51function selectTab(mainDiv, clientId) {
52	var anchorList = mainDiv.getElementsByTagName('a');
53
54	for (let i = 0; i < anchorList.length; i++) {
55		var anchor = anchorList[i];
56		var parentEl = anchor.parentElement;
57
58		if (anchor.getAttribute('aria-controls') === clientId) {
59			parentEl.setAttribute("class", "active");
60			anchor.setAttribute("aria-selected", "true");
61		}
62		else {
63			if (parentEl.tagName === "LI" && parentEl.getAttribute("role") === "presentation") {
64				parentEl.setAttribute("class", "");
65				anchor.setAttribute("aria-selected", "false");
66			}
67		}
68	}
69}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.