webodf / ViewerJS

ViewerJS: Document Reader in JavaScript
http://viewerjs.org
1.94k stars 419 forks source link

Check if element in template exists before adding event listener #100

Closed jbwilliams1 closed 9 years ago

jbwilliams1 commented 10 years ago

Just ran into an issue after I edited the default template. Some people may want to remove (not just hide) the download button entirely, or make aesthetic changes to the default template.

None of the buttons (zoom functions namely) would work thanks to a js error when the script would try to add an event listener to an element you removed from the template.

kossebau commented 9 years ago

Hi, thanks for your request. Just, the "default template" is not meant as a template, but as the one and only shell. At least the current mission statement of ViewerJS is to be a simple to use component that people can use just by an url for an iframe or as whole page, with "/ViewerJS/#path/to/document". Support for further configuration/customization is not yet part of this mission, to stay focussed. So your needs sadly cannot be matched these days by this project. Thus closing this issue for now as invalid.