Absolutely! Modifying javascript libraries is practically a time-honored tradition.
Take a look at one of the lines:
br.getPageURI = function(index, reduce, rotate) {
// reduce and rotate are ignored in this simple implementation, but we
// could e.g. look at reduce and load images from a different directory
// or pass the information to an image server
var leafStr = '000000';
var imgStr = (index+1).toString();
var re = new RegExp("0{"+imgStr.length+"}$");
var url = '/exhibitions/bythebook/book8/W922/W922_'+leafStr.replace(re, imgStr) + '_sap.jpg';
return url;
}
A simple and unintrusive way to alter the URL would be to add a parameter. Consider the following:
br.getPageURI = function(index, reduce, rotate, baseurl) {
baseurl = baseurl|| '/exhibitions/bythebook/book8/W922/W922_';
var leafStr = '000000';
var imgStr = (index+1).toString();
var re = new RegExp("0{"+imgStr.length+"}$");
var url = baseurl + leafStr.replace(re, imgStr) + '_sap.jpg';
return url;
}
This means, replace the base URL with the parameter passed as the fourth parameter. The first line is essentially a failsafe to ensure that it has a value if no fourth parameter is passed. You can apply this modification immediately without causing problems elsewhere. Whenever this method is called, provide the proper fourth parameter.
For lines 80, 83, and 84, you will need to be able to dynamically provide these parameters. Since this is a static js file, you could either remove the section:
br.init();
$('#BRtoolbar').find('.read').hide();
$('#textSrch').hide();
$('#btnSrch').hide();
And execute it yourself in a script after having included the javascript static file, altering parameters as you see fit:
<script src="static.js"></script>
<script>
br.bookTitle= 'Dynamic book title here ' + new Date();
br.bookUrl = 'http://thewalters.org/exhibitions/bythebook/book8/';
br.init();
$('#BRtoolbar').find('.read').hide();
$('#textSrch').hide();
$('#btnSrch').hide();
</script>
Or, you could wrap the entire object in its own function and call it with the parameters to change:
// In static js
function MyBookReader(bookTitle, bookUrl) {
br = new BookReader();
...
br.bookTitle= bookTitle;
br.bookUrl = bookUrl;
br.init();
$('#BRtoolbar').find('.read').hide();
$('#textSrch').hide();
$('#btnSrch').hide();
}
// In script on page
MyBookReader('Tale of two cities', 'http://bookreader-url.com');
Hope that helps.