In case anybody is interested in doing something similar, I solved this.
Incidentally, we switched to Side Navigation skin but the solution should be the same for any skin that uses this search engine.
Here's the fix. I needed to wait for the search results to be written to the page (DOM):
Code: Select all
$().ready(function(){
if ( $('#searchPane').length ) {
waitfor('cite',function() {
$('cite').each(function() {
var node = $(this)
var book = node.html().replace(/([^\/]*)\/.*/,'Document: $1').split('_').join(' ');
node.html(book)
})
})
}
var stopTimer = null, stop = false;
function waitfor(sel,fn){
var node = document.querySelector(sel);
if ( ! node || node.childNodes.length == 0 ) {
if ( stop ) return;
setTimeout(function(){ waitfor(sel,fn);});
}
else {
clearTimeout(stopTimer);
fn();
}
}
});
What this does is turn this:
Reference/Explicitly_Activating_and.htm
into this:
Document: Reference
To link your own js to every page, put it in the head section of your master page, like this:
Code: Select all
<script src="../Scripts/myscript.js"></script>
ETA: My post was missing some code. This is now fixed: