[TYPO3-dev] Adding JS file to list frame

J. Lingott jbl at deweblop.de
Fri Aug 13 15:56:14 CEST 2010


Once again providing a solution to my own question which is more of a 
workaround than a real clean solution.

What I did is added a hook to top.loadModule by a method capable of 
adding hooks to JS methods. That hook fires as soon a module gets loaded 
from the TYPO3 module navigation. Inside this method the content frame 
gets an onLoad handler refering to another load method determining if 
the list_frame is contained and if so an onLoad handler is added to the 
frameElement linking to the method actually extending the Clickmenu and 
its items. This is achieved by using Object.extend on the Clickmenu 
object and adding a method setNode to be able to track the clicked 
element node. To make this method be executed the items need to be 
extended by an onClick handler, which is done by retrieving all links 
inside the document and reducing them to those containing showClickmenu 
in their onlick attribute. If anyone is interested in the source code, 
just message me directly or over the list.

If anyone can point me to a real solution for it I'd really appreciate 
it though.

> While working on a backend module extending the clickmenu with some 
> new items I needed a way to add my javascript file globally to be able 
> to send AJAX  requests from the new items to my script and execute 
> code without switching into the module itself. The method I found 
> searching for a solution was extending backend.php's 
> additionalBackendItems by a small script injecting the JS file (like 
> shown on 
> http://wiki.typo3.org/index.php/ExtDirect#How_to_use_Ext_Direct_.3F).
>
> This works and I can run my script directly from clickmenu items now, 
> but unfortunately what I would rather need is a way to extend the 
> document loaded in list_frame (alt_db_navframe.php/ dblist.php). As I 
> need to extend the JS object Clickmenu with a new function (which 
> works fine when the module itself is loaded on content frame), but 
> that object is just available when needed (for sure) and therefore 
> doesn't exist yet when backend.php is loaded.
>
-- 

deweblop applications
Heidelberger- 55
69221 Dossenheim

fon: +4962218682063
fax: +4962218682067

mail: jbl at deweblop.de
http://www.deweblop.de



More information about the TYPO3-dev mailing list