Hi Lucien,
see below
lpereira (SVN) wrote:
> Author: lpereira
> Date: 2009-06-18 12:52:07 +0200 (Thu, 18 Jun 2009)
> New Revision: 21332
>
> Added:
>
> sandbox/xwiki-annotation/xwiki-application-annotation/src/main/resources/Annotation.js
> Modified:
>
> sandbox/xwiki-annotation/xwiki-application-annotation/src/main/resources/Panels/AnnotationManager.xml
> Log:
> client side cleaning up.
>
> Added:
> sandbox/xwiki-annotation/xwiki-application-annotation/src/main/resources/Annotation.js
> ===================================================================
> ---
> sandbox/xwiki-annotation/xwiki-application-annotation/src/main/resources/Annotation.js
> (rev 0)
> +++
> sandbox/xwiki-annotation/xwiki-application-annotation/src/main/resources/Annotation.js
> 2009-06-18 10:52:07 UTC (rev 21332)
> @@ -0,0 +1,472 @@
>
> -function getLeftDocument(node, xwikicontent)
> +function onDOMLoaded()
> {
>
[snip]
> + if(typeof(annotationFeatureEnabled) != 'undefined' &&
> annotationFeatureEnabled == true)
> + {
> + annotation = new Annotation();
> + }
> }
>
>
[snip]
> +document.observe('dom:loaded', function(event) {onDOMLoaded();});</code>
You should namespace this function, or better, hide it as an anonymous
callback function or in an anonymous scope, like :
document.observe('dom:loaded', function(event) {
if(typeof(annotationFeatureEnabled) != 'undefined' &&
annotationFeatureEnabled == true)
{
annotation = new Annotation();
}
});
(annonymous callback),
or :
(function(){
function onDOMLoaded(){
if(typeof(annotationFeatureEnabled) != 'undefined'
&& annotationFeatureEnabled == true){
annotation = new Annotation();
}
}
document.observe('dom:loaded',onDOMLoaded);</code>
})();
(named function in an anonymous scope)
This way, if an other library comes with a onDOMLoaded function, it will
not erase yours (or vice-versa).
You can check
http://dev.xwiki.org/xwiki/bin/view/Community/DevelopmentPractices#HXWikiNamespacing
for more info
Jerome.
> </property>
> <property>
> <name>Annotation Feature Client Side Code</name>
>
> _______________________________________________
> notifications mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/notifications
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs