I have made a little progress again... or so I thought.
Instead of the GHOP document explaining that the <hear> tag needs to have a javascript SqueezeBox.initialise script I used this line of code to initialise Squeezebox in my php:
In my javascript, I have something like this:
Code: Select all
function makeSqueezeBoxlink(alink) {
alink.className = 'modal';
alink.setAttribute("rel", '{handler: \'iframe\', size: {x:600, y:400}}');
}
var a = document.getElementsByTagName("a");
for (var i=0;i<a.length;i++){
makeSqueezeBoxlink(a[i]);
}
Similarly, I could have done document write to make a link with the right class and rel. Anyway, like this all my links should open with SqueezeBox, but they don't.
What I do get in the view page source of my browser is as follows (aside from the mootools script tag which is also there).
Code: Select all
<link rel="stylesheet" href="/media/system/css/modal.css" type="text/css" />
<script type="text/javascript" src="/media/system/js/modal.js"></script>
<script type="text/javascript">
window.addEvent('domready', function() {
SqueezeBox.initialize({});
$$('a.externalink').each(function(el) {
el.addEvent('click', function(e) {
new Event(e).stop();
SqueezeBox.fromElement(el);
});
});
});
</script>
When I hardcode the rel attribute and class into the html links are opened with Squeezebox, so the initialisation works. When I check with alerts what the class and rel attribute is of links without hardcoded rel and class they are as they should be according to my javascript.
So, I am really puzzled why this does not work - perhaps modal.js does not recognise link attributes added by javascript? It seemed promising!