There is no way to get code automatically included in the theme other than the addPluginScript(). You could provide a function that emits the code, but the theme user would have to place a call to the function in his script in the appropriate place.
I am not sure why there is a difference in the behavior, though. The code above (as I read it) should [b]always[/b] load a new page, not a simply a new picture. That is what you get from the getNextImageURL() and getPrevImageURL() functions.
If you want to just load the image you would have to have Javascript that modified the Html
@huogas: No, no side effects, it's just a matter of how a theme is setup.
I agree if you don't want to load the page you have to write some js code for that. It is possible but can't hardly be generalize as it is HTML dependend (since you probably don't want only the image to change but the title, desc, arrows etc as well).
When you're writing a comment for a photo, and if you made a spelling mistake, for example you use the left or right arrow to correct this. With the first code, the picture change ... not really good !
With the second code, you can use the keyboard arrow in a comment area.
Laurent
I made the plugin. You're right Sbillard is was simple ;-)
So you can see it in action on my site : http://www.latitudes-photos.com
You can download and have information at this page :
http://www.latitudes-photos.com/keyboardnav
But, my english is very poor so can someone can make a better translation please :-)
Thanks
Laurent
In order to get the best of this function, I had to :
-use an anchor just over the image and
-modify slightly the plugin code to branch to the anchor (for not taking any "prime space" in the window):
window.location=nextURL+"#topimage
window.location=prevURL+"#topimage
Was there a more elegant way of getting that result ?
Thanks
Gaston