I've just discovered the ability to use javascript in headers and footers when converting EPUB to PDF. I think it's great.
So far I've been able to write simple functions with conditionals. However, I'm stuck when I introduce an indexOf().
I would like not to show headers in initial pages (TOC, title page, etc.) so I'm trying to write something like this after <p id="header">....</p>
Code:
<script>
function header() {
if ( document.getElementById("header").indexOf("Title Page") >= 0 ){
document.getElementById("header").style.display = 'none'
}
}
header()
</script>
If I remove
Code:
.indexOf("Page Title") >= 0
the function works as expected as all the headers are hidden in output file.
This is why I'm suspecting Calibre may not accept indexOf(). Is this right? And if so, how to hide headers and page numbers for certain sections?