PublishingJS:TheNewSocial: Difference between revisions

From H&D Publishing Wiki
No edit summary
No edit summary
Line 1: Line 1:
console.log( 'Hello from PublishingJS namespace!' )
document.onreadystatechange = function () {


document.onreadystatechange = function () {
console.log( 'Hello from PublishingJS namespace!' )
const nav_links = document.querySelectorAll('#toc a');
make_case_studies_collapsible()
make_principles_collapsible()
console.log(nav_links)
 
}
function $( selector ) {
return document.querySelectorAll( selector )
}
function make_case_studies_collapsible() {
const nav_links = $('#toc a');
window.onhashchange = function() {
window.onhashchange = function() {
    for (let i = 0; i < nav_links.length; i++) {
    for (let i = 0; i < nav_links.length; i++) {
Line 15: Line 29:
        }
        }
    }
    }
};
}
}
 
function make_principles_collapsible() {
const principle_headers = $( '#principles > table th a' )
for ( const principle_headers in principle_headers ) {
console.log( principle_headers )
}
}
}

Revision as of 09:34, 26 April 2023

document.onreadystatechange = function () {

	console.log( 'Hello from PublishingJS namespace!' )
	
	make_case_studies_collapsible()
	make_principles_collapsible()

	

}





function $( selector ) {
	return document.querySelectorAll( selector )
}


function make_case_studies_collapsible() {
	const nav_links = $('#toc a');
	window.onhashchange = function() {
	    for (let i = 0; i < nav_links.length; i++) {
	        if (nav_links[i].href.match(/(#.*)/)[1] == window.location.hash) {
	            nav_links[i].className = 'selected';
	        } else {
	            nav_links[i].className = '';
	        }
	    }
	}
	
}

function make_principles_collapsible() {
	const principle_headers = $( '#principles > table th a' )
	for ( const principle_headers in principle_headers ) {
		console.log( principle_headers )		
	}
}