[TYPO3-formidable] How to exclude prototype

JéŽrô™me Schneider j.schneider at ameos.com
Wed May 19 14:36:34 CEST 2010


Hi Hauke,

I modified Formidable today to allow such a feature.
You'll find in revision 466 what you need. The revision log follows:
-------------------
Added new Typoscript switches that allow to fine-tune the inclusion of 
all core js libraries.

   config.tx_ameosformidable {
     minify.enabled = 1
     minify.gzip = 1

     loadJsFramework = 1
     loadPrototype = 1
     loadPrototypeAddons = 1
     mayLoadScriptaculous = 1
   }

The evaluation is processed as follow:

+loadJsFramework
+---------------
|  |
|  +--1(def): JS-Master switch ON
|  |  |
|  |  +minify.enabled
|  |  +--------------
|  |    |
|  |    +--1 (def): jslibs will be minified
|  |    |  |
|  |    |  +minify.gzip
|  |    |  +-----------
|  |    |    |
|  |    |    +--1 (def): minified+gzip libs loaded
|  |    |    |
|  |    |    +--0: minified but not gzip libs
|  |    |
|  |    +--0: js-libs will NOT be minified
|  |      |
|  |      +loadPrototype
|  |      +-------------
|  |      |  |
|  |      |  +--1 (def): load prototype
|  |      |  |
|  |      |  +--0: will not load prototype
|  |      |
|  |      +loadPrototypeAddons
|  |      +-------------------
|  |        |
|  |        +--1 (def): prototype+lowpro+Base+JSON
|  |        |
|  |        +--0: do not load prototype addons
|  |
|  +--0: will not load any js-lib of it's framework
|
+mayLoadScriptaculous
+--------------------
   |
   |--1 (def): load scriptaculous when needed
   |
   +--0: will not load scriptaculous

If one needs to manually handle the formidable header injection in the 
page (to handle multiple prototype-js libraries for instance),
it's possible to define headerData using the new user_formidablets class

Example:

# TYPOSCRIPT --------------
         page.includeLibs.user_formidablets = 
EXT:ameos_formidable/api/class.user_formidablets.php
         page.headerData.10000 = USER
         page.headerData.10000 {
                 userFunc = user_formidablets->manualHeaderTag
                 load = prototype+addons, jsframework, scriptaculous
         }
# /TYPOSCRIPT -------------

user_formidablets->manualHeaderTag will return full <script> tags, whereas
user_formidablets->manualHeaderPath will return only absolute web-path 
to the library.

the load parameter defines what to load (comma-separated values). The 
order of the given libraries is important as it reflects the order of 
headers returned.
Possible load tokens are:
         * minified: all core-libraries, minified
         * minified+gzipped: all core-libraries, minified and gzipped
         * jsframework: framework.js library
         * prototype: the prototype.js library
         * prototype+addons: prototype.js, lowpro.js, Base.js and json.js
         * prototype_addonsonly: lowpro.js, Base.js and json.js
         * scriptaculous: scriptaculous.js and effects.js
         * scriptaculous_dragdrop: dragdrop.js for scriptaculous
         * scriptaculous_builder: builder.js for scriptaculous


I hope this helps
Best regards,
Jérôme Schneider


More information about the TYPO3-project-formidable mailing list