DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: t3mootools

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed:2009-04-23T19:44:41
Author:Peter Klein
Email:peter@umloud.dk
Info 3:
Info 4:

EXT: t3mootools

Extension Key: t3mootools

Copyright 2007-2009, Peter Klein, <peter@umloud.dk>

mootools.js © Valerio Proietti, < http://mootools.net/ >

class.JavaScriptPacker.php © by Dean Edwards, Nicolas Martin & Mark Fabrizio Jr.< http://joliclic.free.fr/php/javascript-packer/en/ >

jsmin2.php © by Douglas Crockford, David Holmes & Gaetano Giunta,< http://www.crockford.com/javascript/jsmin.html >

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: t3mootools 1

Introduction 1

What does it do? 1

Screenshots 1

Users manual 3

Analyze the .js of a Mootools extension 3

Process and Analyze t3mootools.txt in extensions 4

Create a custom Mootools JS Libraray 4

Configuration 4

t3mootools.txt what is this? 5

t3mootools.txt example: 5

Known problems 5

To-Do list 5

You like the extension? 5

Thanks to 5

Changelog 5

Introduction

What does it do?

This extension provides a shared version of the Mootools Javascript framework for use in other extensions like pmkslimbox or rgsmoothgallery to avoid any conflicts between these extensions.

It is possible to check with t3mootools other extensions which components of Mootools need to be loaded and to include only these.

Screenshots

img-1

Image 1 : A list of all available components of the Mootools Library

img-2

Image 2 : Analyze of an extension to find the needed components

img-3

Image 3 : Processing and Analyzing of t3mootools.txt in an extension to find the needed components

Users manual

To use the extension you need to follow these steps:

Install the extension.

Reload the Backend to access the backend module (e.g. press F5 to reload the page or logout & login again).

Enter the Backend module “Mootools Setup” (last entry in the section “Tools”).

Use one of the 3 entries in the dropdown menu at the top right corner. (If the “Extension Development Evaluator” [extkey: extdeveval] extension is installed, a 4 th entry will be added to the drowdown, which gives you quick access to displaying the t3mootools API docs)

Follow the steps below.

Analyze the .js of a Mootools extension

Choose this entry in the dropdown menu at the top right corner to create a custom Mootools library out of existing javascript files.You can either enter

  • the remote file which is the path to the file on the server.An example would be EXT:rgsmoothgallery/res/scripts/jd.gallery1010.jsThis depends completely on the checked extension!
  • a local file. Just upload the javascript file.

You will get a list of all needed components as result.

Click now “Use” or “Use & Merge” if you already did this step for another extension.

You are now forwarded to the 1 st view of the extension and all needed components are checked.

Follow the steps below

Process and Analyze t3mootools.txt in extensions

Choose this entry in the dropdown menu at the top right corner to create a custom Mootools library out of information stored in t3mootools.txt files available in installed extensions.

Select the extensions you want processed and analyzed, and click the “Check” button.

Click now “Use” or “Use & Merge” if you already did this step for another extension.

You are now forwarded to the 1 st view of the extension and all needed components are checked.

Follow the steps below

Create a custom Mootools JS Libraray

You will get an overview over all needed components and if you used the previous steps, some components will be already selected.

Choose at the bottom the compression type you wanna use. The best one is already selected.

Click on the button “Create Mootools Library”.

You are done. If the extension which used Mootools is cached, you need to clear the cache manually.

Configuration

If you want to use t3mootools for your own extension, you need just some several lines which look like this:

// checks if t3mootools is loaded
if (t3lib_extMgm::isLoaded('t3mootools'))    {
   require_once(t3lib_extMgm::extPath('t3mootools').'class.tx_t3mootools.php');
}
// if t3mootools is loaded and the custom Library had been created
if (defined('T3MOOTOOLS')) {
        tx_t3mootools::addMooJS();
// if none of the previous is true, you need to include your own library
// just as an example in this way
} else {
        $GLOBALS['TSFE']->additionalHeaderData['rgsmoothgallery'] =   '<script src="'.$this->getPath($this->conf['pathToMootools']).'" type="text/javascript"></script>';
}

You are done!

It is also possible to load and use the API from Typoscript, like this:

includeLibs.t3mootools = EXT:t3mootools/class.tx_t3mootools.php
page.10 = USER
page.10.userFunc = tx_t3mootools->addMooJS

A special function (for Typoscript use) is included in the API, for adding extra Javascript AFTER the mootools.js.This is needed in some situations because headerdata added with "page.headerData" is placed BEFORE the headerdata which is added using PHP.

The function accepts 2 parameters “ jsfile ” and/or “ jsdata ”, both with stdWrap support.

jsfile ” is a path/filename of a javascript file.

jsdata ” is a piece of javascript code.

Note: If you use this function, it is not necessary to add the mootools.js using the tx_t3mootools->addMooJS function, as this function automatically adds the mootools.js if it is not already added.

Example:

10 = USER
10.userFunc = tx_t3mootools->addJS
10.jsfile = fileadmin/testscript.js
10.jsdata = alert('Hello World!');

t3mootools.txt what is this?

If you are writing your own extension, and want to make it easy for the users to create a custom Mootools libray with the components required for your extension, you can create a t3mootools.txt file, and place it in your extension folder.

The t3mootools.txt contains information on what javascript and/or components is required for your extension.

There are 2 parameters you can use in the t3mootools.txt: “ script ” and/or “ components ”.

script ” contains path/filename to the javascript you want analyzed. (seperate more values with a comma.)

components ” contains a list of components you want included, This is sometimes needed it a component is used, which is not present in the javascript file, such as inline script snippets. (seperate more values with a comma.) Allowed values: Core, Class, Class.Extras, Array, String, Function, Number, Element, Element.Event, Element.Filters, Element.Selectors, Element.Form, Element.Dimensions, Window.DomReady, Window.Size, Fx.Base, Fx.CSS, Fx.Style, Fx.Styles, Fx.Elements, Fx.Scroll, Fx.Slide, Fx.Transitions, Drag.Base, Drag.Move, XHR, Ajax, Cookie, Json, Json.Remote, Assets, Hash, Hash.Cookie, Color, Scroller, Slider, SmoothScroll, Sortables, Tips, Group and Accordion.

t3mootools.txt example:

script = res/scripts/slimbox_ex_uncompressed.js,res/scripts/slimbox_pf_uncompressed.js
components=Window.DomReady

Known problems

This extension just includes the library and nothing more! So if 2 extensions do have still a conflict, this is not the fault of t3mootools.

To-Do list

- Automatic look up for the js files of extensions.Done

You like the extension?

If you like this extension, you can do one or more of the following things:

  • Write me a mail with some nice words.
  • Rate the extension in the Repository: http://typo3.org/extensions/ search for t3mootools, click on the title and then at “Ratings” (You need to be registered and logged in at typo3.org)

Thanks to

I want to thank the following people

  • Georg Ringer for writing the initial manual, german translation, bugtesting and tons of good ideas.
  • Martin Fluer for kicking my butt to get the 1.2.1 update released and for bugtesting and various fixes.

Changelog

  • 1.3.0 Extension is now updated for Mootools v1.2.1 usage. This required major changes in the analyzer script.
  • 1.2.0 Fixed problem in the Process and Analyze t3mootools.txt mode, where only the local extension dir was checked.Now it works correctly with Local, Global and System extension folders. Thanks to Jesse Adler for reporting this.Added a new function to the API, named “addJS” which is a small wrapper for adding javascripts script after theMootools Library. This is needed in some situations because headerdata added with "page.headerData" is placed BEFORE the headerdata which is added using PHP.Extension is now marked Stable.
  • 1.1.0 New function to process and analyze t3mootools.txt files located inside extension dirs. This makes it much easier to generate the mootools library with the correct dependencies. Big thanks to Georg Ringer for writing the initial manual a bugreports.
  • 1.0.1. Some clean up, german language files.
  • 1.0.0. Initial release

img-4 EXT: t3mootools - 5