NetTalk Central

Author Topic: Slideshow javascript and Nettalk  (Read 3913 times)

alex.kolaric

  • Full Member
  • ***
  • Posts: 151
  • Do it or do not, there is no try
    • View Profile
    • Email
Slideshow javascript and Nettalk
« on: July 10, 2009, 01:23:27 AM »
Hi,

I'm trying to integrate BarackSlideshow javascript which can be found on this address:

http://devthought.com/blog/projects-news/2008/06/barackslideshow-an-elegant-lightweight-slideshow-script/discussion/pingbacks/

into Nettalk app page. I do everything as described but I always get "Handler could not be added" error from the explorer so slide show doesn't work (just sits on the first image). I was digging a bit into Nettalk .js files and this script and I found that the problem is in AddHandler method which exist in both places but with different prototypes.

Any ideas how to solve this?

Thanks,
Alex

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Slideshow javascript and Nettalk
« Reply #1 on: July 12, 2009, 09:32:07 PM »
Unfortunately JavaScript is written in these tiny tiny bits by most authors, with no, or little regard, to using the script on a page in conjunction with other scripts.

Because scripts are usually added by hand, there's also a desire for most authors to make it as little work to add the script to a page as possible. So a  number of hacks are used to make the script "auto detect" itself on a page and run automatically.

Generally speaking I've found two techniques to be helpful in making JavaScript work better in conjunction with other scripts.

a) try and replace automatic-initalization with explicit initalization. Scripts often use the onLoad event to init themselves, and it's better to have an explicit call to the init function in the code. Another way they init themselves is by detecting specific element names, or classes. Again, having an explicit call is better.

b) where necessary rename function names that clash with other scripts.

Cheers
Bruce

alex.kolaric

  • Full Member
  • ***
  • Posts: 151
  • Do it or do not, there is no try
    • View Profile
    • Email
Re: Slideshow javascript and Nettalk
« Reply #2 on: July 13, 2009, 01:56:14 AM »
Thanks Bruce,

will try renaming technique.

cheers,
Alex