SlideShare una empresa de Scribd logo
1 de 15
Descargar para leer sin conexión
Alonzo Turner



Leveraging JavaScript
Frameworks in your
    Joomla Sites
A Quick History
    Why we need JavaScript
 Frameworks in the first place.

First, there was the Internet, and it was good.

Then there was Netscape, and it had a <blink> tag.

And, then came Internet Explorer.

Then came Firefox and things got a lot better but...

It was complicated.
What Frameworks Provide
      DOM Manipulation

      Class Structures

      Event Listeners

      AJAX

      Binding

      Effects
The Default JavaScript Framework
      Provided by Joomla

jimport('joomla.html.html.behavior');
JHtmlBehavior::framework(boolean);

/media/system/js/mootools-core.js
/media/system/js/mootools-more.js
MooTools Libraries
            DOM Manipulation
  $(selector) //returns extended element
  $$(selector) //returns an array of elements

                   Classes
        var someObject = new Class({
           initialize: function(){
              // some constructor actions
            }
        });

              Event Listeners
$$('a').invoke('addEvent', 'click' function(evt){
   var someAnchor = evt.target;
   window.console.log(someAnchor.href);
});
MooTools Libraries
                    AJAX
var someRequest = new Request({
    method: 'post',
    url: '/index.php',
    onSuccess: function(textResult, xmlResult){},
    onFailure: function(xhr){}
});
someRequest.send({'data': obj});



                  Binding
var myObject = {name: 'Alonzo', title: 'dev'};
var myFunction = function(){
   window.console.log(this.name);
}
var bound = myFunction.bind(myObject);
bound(); // OUTPUTS: Alonzo
MooTools Libraries
                    Effects
          Tween A single Property
var myTween = new Fx.Tween('someElement', {
   duration: 1000.0,
   property: 'left'
});
myTween.start(0,400);



Morph any number of styles in tandem
var myMorph = new Fx.Morph('someElement', {
   duration: 2500.0,
   transition: Fx.Transitions.Sine.easeInOut,
   chain: 'cancel'
});
myMorph.start({'height': 300, 'width': 100});
MooTools Libraries
          Putting It All Together

var myInterface = new Class({
   initialize: function(){
       this.links = this.listenToLinks.bind(this);
        this.buttons = this.listenToButtons.bind(this);
        this.startListening();
    },
   startListening: function(){
       $$('a').invoke('addEvent', this.links);
       $$('button').invoke('addEvent', this.buttons);
    },
   listenToLinks: function(evt){
       // do something with links
    },
   listenToButtons: function(evt){
       // do something with buttons
    }
});
JHtml Behaviors
             Loading the Built-In
              Javascript Libraries
Form Validation                        No-Frames
JHtml::_(‘behavior.formvalidation’);   JHtml::_(‘behavior.noframes’);


Modal Windows                          Calendar
JHtml::_(‘behavior.modal’);            JHtml::_(‘behavior.calendar’);


ToolTips                               Uploader
JHtml::_(‘behavior.tooltip’);          JHtml::_(‘behavior.uploader’);
Inserting Javascript
             Template index.php file
$doc =& JFactory::getDocument();
$doc->addScript('path/to/script');
$doc->addScriptDeclaration('script as text');



// FILTER OUT MOOTOOLS JAVASCRIPT
$header = $this->getHeadData();
$scripts = $header['scripts'];
$allow = array();
foreach($scripts as $script => $type){
   if(strpos($script, "/media/system/js") === FALSE){
      $allow[$script] = $type;
   }
}
// RESET THE PRELOADED JAVASCRIPT LIBRARIES
$header['scripts'] = $allow;
$this->setHeadData($header);
Google Loader API
       Decrease page load times and offset
       network traffic by implementing the
                   loader API

             First, sign up for an API key
     http://code.google.com/apis/loader/signup.html


             Implement the google loader
<script type="text/javascript"
      src="http://www.google.com/jsapi?key=xxxx"></script>
<script type="text/javascript">google.load(script, version)</script>
Google Loader API
      Implement the Google Loader in your
            Template index.php file


// USE GOOGLE LOADER API TO PRELOAD COMMON JAVASCRIPT LIBRARIES
$js = '{"modules":{"name":"mootools","version":"1.4.1"}}';
$key = $this->params->get('google_api');
if($key){
   $source = "www.google.com/jsapi?autoload=".urlencode($js)."&amp;key=";
   $document->addScript(HTTP_PROTOCOL.$source.$key);
}else{
   $document->addScript("templates/yourtemplate/javascript/mootools.js");
   $document->addScript("templates/inkandpaper/javascript/swfobject.js");
}
Additional
             Resources

http://code.google.com/apis/loader
https://groups.google.com/group/joomla-dev-general
http://docs.joomla.org/Developers
http://mootools.net/docs/core
http://jquery.com
http://www.prototypejs.org
Special Thanks

  Lokesh Dhakar - lightbox
 Sam Stephenson - prototype
Thomas Fuchs - scriptaculous
 Valerio Proietti - mootools
     John Resig - jquery


The Joomla and Open Source
       Communities
https://www.subtextproductions.com

alonzo.turner@subtextproductions.com

Más contenido relacionado

La actualidad más candente

Sprout core and performance
Sprout core and performanceSprout core and performance
Sprout core and performance
Yehuda Katz
 
Powerful and flexible templates with Twig
Powerful and flexible templates with Twig Powerful and flexible templates with Twig
Powerful and flexible templates with Twig
Michael Peacock
 
The Open Web and what it means
The Open Web and what it meansThe Open Web and what it means
The Open Web and what it means
Robert Nyman
 

La actualidad más candente (20)

Javascript - Beyond-jQuery
Javascript - Beyond-jQueryJavascript - Beyond-jQuery
Javascript - Beyond-jQuery
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS Architecture
 
Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1
Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1
Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1
 
AngularJS Compile Process
AngularJS Compile ProcessAngularJS Compile Process
AngularJS Compile Process
 
Testable, Object-Oriented JavaScript
Testable, Object-Oriented JavaScriptTestable, Object-Oriented JavaScript
Testable, Object-Oriented JavaScript
 
Perkenalan ReasonML
Perkenalan ReasonMLPerkenalan ReasonML
Perkenalan ReasonML
 
Sprout core and performance
Sprout core and performanceSprout core and performance
Sprout core and performance
 
06 jQuery #burningkeyboards
06 jQuery  #burningkeyboards06 jQuery  #burningkeyboards
06 jQuery #burningkeyboards
 
The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
 
Jquery Fundamentals
Jquery FundamentalsJquery Fundamentals
Jquery Fundamentals
 
jQuery: Events, Animation, Ajax
jQuery: Events, Animation, AjaxjQuery: Events, Animation, Ajax
jQuery: Events, Animation, Ajax
 
Getting classy with ES6
Getting classy with ES6Getting classy with ES6
Getting classy with ES6
 
Powerful and flexible templates with Twig
Powerful and flexible templates with Twig Powerful and flexible templates with Twig
Powerful and flexible templates with Twig
 
Building Large jQuery Applications
Building Large jQuery ApplicationsBuilding Large jQuery Applications
Building Large jQuery Applications
 
05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards
 
Introduction to ReasonML
Introduction to ReasonMLIntroduction to ReasonML
Introduction to ReasonML
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
The Open Web and what it means
The Open Web and what it meansThe Open Web and what it means
The Open Web and what it means
 
Drupal 8: Fields reborn
Drupal 8: Fields rebornDrupal 8: Fields reborn
Drupal 8: Fields reborn
 
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
 

Destacado (6)

FELICIDADES JUANMI
FELICIDADES JUANMIFELICIDADES JUANMI
FELICIDADES JUANMI
 
Joomla e commerce gabe wahhab
Joomla e commerce gabe wahhabJoomla e commerce gabe wahhab
Joomla e commerce gabe wahhab
 
Proud of who we are
Proud of who we areProud of who we are
Proud of who we are
 
Strategic planning
Strategic planningStrategic planning
Strategic planning
 
Template frameworks
Template frameworksTemplate frameworks
Template frameworks
 
Microbiology (major microbial diseases)
Microbiology (major microbial diseases)Microbiology (major microbial diseases)
Microbiology (major microbial diseases)
 

Similar a Javascript Frameworks for Joomla

Week 4 - jQuery + Ajax
Week 4 - jQuery + AjaxWeek 4 - jQuery + Ajax
Week 4 - jQuery + Ajax
baygross
 
international PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secretsinternational PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secrets
smueller_sandsmedia
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
David Padbury
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js framework
Ben Lin
 
Avinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPressAvinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPress
wpnepal
 
J Query The Write Less Do More Javascript Library
J Query   The Write Less Do More Javascript LibraryJ Query   The Write Less Do More Javascript Library
J Query The Write Less Do More Javascript Library
rsnarayanan
 

Similar a Javascript Frameworks for Joomla (20)

Week 4 - jQuery + Ajax
Week 4 - jQuery + AjaxWeek 4 - jQuery + Ajax
Week 4 - jQuery + Ajax
 
international PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secretsinternational PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secrets
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 
Rails is not just Ruby
Rails is not just RubyRails is not just Ruby
Rails is not just Ruby
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScript
 
jQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends ForeverjQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends Forever
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
J query training
J query trainingJ query training
J query training
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js framework
 
jQuery
jQueryjQuery
jQuery
 
jQuery for web development
jQuery for web developmentjQuery for web development
jQuery for web development
 
Avinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPressAvinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPress
 
Clean Javascript
Clean JavascriptClean Javascript
Clean Javascript
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testing
 
J Query The Write Less Do More Javascript Library
J Query   The Write Less Do More Javascript LibraryJ Query   The Write Less Do More Javascript Library
J Query The Write Less Do More Javascript Library
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 

Más de Luke Summerfield

Improving joomla's backend user experience
Improving joomla's backend user experienceImproving joomla's backend user experience
Improving joomla's backend user experience
Luke Summerfield
 
Joomla e commerce gabe wahhab
Joomla e commerce gabe wahhabJoomla e commerce gabe wahhab
Joomla e commerce gabe wahhab
Luke Summerfield
 
Joomla e commerce gabe wahhab
Joomla e commerce gabe wahhabJoomla e commerce gabe wahhab
Joomla e commerce gabe wahhab
Luke Summerfield
 
Harnessing the cloud_for_saa_s_hosted_platfor
Harnessing the cloud_for_saa_s_hosted_platforHarnessing the cloud_for_saa_s_hosted_platfor
Harnessing the cloud_for_saa_s_hosted_platfor
Luke Summerfield
 

Más de Luke Summerfield (10)

Supercharge Your Wordpress Website With Inbound Marketing: A Complete Guide
Supercharge Your Wordpress Website With Inbound Marketing: A Complete GuideSupercharge Your Wordpress Website With Inbound Marketing: A Complete Guide
Supercharge Your Wordpress Website With Inbound Marketing: A Complete Guide
 
Supercharge your Sales with Inbound Marketing: A Complete Guide
Supercharge your Sales with Inbound Marketing: A Complete Guide Supercharge your Sales with Inbound Marketing: A Complete Guide
Supercharge your Sales with Inbound Marketing: A Complete Guide
 
Supercharge Your Local SEO: The Complete Guide
Supercharge Your Local SEO: The Complete GuideSupercharge Your Local SEO: The Complete Guide
Supercharge Your Local SEO: The Complete Guide
 
SEOMoz Mozcation:
SEOMoz Mozcation: SEOMoz Mozcation:
SEOMoz Mozcation:
 
Improving joomla's backend user experience
Improving joomla's backend user experienceImproving joomla's backend user experience
Improving joomla's backend user experience
 
Joomla e commerce gabe wahhab
Joomla e commerce gabe wahhabJoomla e commerce gabe wahhab
Joomla e commerce gabe wahhab
 
Template frameworks
Template frameworksTemplate frameworks
Template frameworks
 
Joomla e commerce gabe wahhab
Joomla e commerce gabe wahhabJoomla e commerce gabe wahhab
Joomla e commerce gabe wahhab
 
Harnessing the cloud_for_saa_s_hosted_platfor
Harnessing the cloud_for_saa_s_hosted_platforHarnessing the cloud_for_saa_s_hosted_platfor
Harnessing the cloud_for_saa_s_hosted_platfor
 
Mobile app development
Mobile app development  Mobile app development
Mobile app development
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Javascript Frameworks for Joomla

  • 2. A Quick History Why we need JavaScript Frameworks in the first place. First, there was the Internet, and it was good. Then there was Netscape, and it had a <blink> tag. And, then came Internet Explorer. Then came Firefox and things got a lot better but... It was complicated.
  • 3. What Frameworks Provide DOM Manipulation Class Structures Event Listeners AJAX Binding Effects
  • 4. The Default JavaScript Framework Provided by Joomla jimport('joomla.html.html.behavior'); JHtmlBehavior::framework(boolean); /media/system/js/mootools-core.js /media/system/js/mootools-more.js
  • 5. MooTools Libraries DOM Manipulation $(selector) //returns extended element $$(selector) //returns an array of elements Classes var someObject = new Class({ initialize: function(){ // some constructor actions } }); Event Listeners $$('a').invoke('addEvent', 'click' function(evt){ var someAnchor = evt.target; window.console.log(someAnchor.href); });
  • 6. MooTools Libraries AJAX var someRequest = new Request({ method: 'post', url: '/index.php', onSuccess: function(textResult, xmlResult){}, onFailure: function(xhr){} }); someRequest.send({'data': obj}); Binding var myObject = {name: 'Alonzo', title: 'dev'}; var myFunction = function(){ window.console.log(this.name); } var bound = myFunction.bind(myObject); bound(); // OUTPUTS: Alonzo
  • 7. MooTools Libraries Effects Tween A single Property var myTween = new Fx.Tween('someElement', { duration: 1000.0, property: 'left' }); myTween.start(0,400); Morph any number of styles in tandem var myMorph = new Fx.Morph('someElement', { duration: 2500.0, transition: Fx.Transitions.Sine.easeInOut, chain: 'cancel' }); myMorph.start({'height': 300, 'width': 100});
  • 8. MooTools Libraries Putting It All Together var myInterface = new Class({ initialize: function(){ this.links = this.listenToLinks.bind(this); this.buttons = this.listenToButtons.bind(this); this.startListening(); }, startListening: function(){ $$('a').invoke('addEvent', this.links); $$('button').invoke('addEvent', this.buttons); }, listenToLinks: function(evt){ // do something with links }, listenToButtons: function(evt){ // do something with buttons } });
  • 9. JHtml Behaviors Loading the Built-In Javascript Libraries Form Validation No-Frames JHtml::_(‘behavior.formvalidation’); JHtml::_(‘behavior.noframes’); Modal Windows Calendar JHtml::_(‘behavior.modal’); JHtml::_(‘behavior.calendar’); ToolTips Uploader JHtml::_(‘behavior.tooltip’); JHtml::_(‘behavior.uploader’);
  • 10. Inserting Javascript Template index.php file $doc =& JFactory::getDocument(); $doc->addScript('path/to/script'); $doc->addScriptDeclaration('script as text'); // FILTER OUT MOOTOOLS JAVASCRIPT $header = $this->getHeadData(); $scripts = $header['scripts']; $allow = array(); foreach($scripts as $script => $type){ if(strpos($script, "/media/system/js") === FALSE){ $allow[$script] = $type; } } // RESET THE PRELOADED JAVASCRIPT LIBRARIES $header['scripts'] = $allow; $this->setHeadData($header);
  • 11. Google Loader API Decrease page load times and offset network traffic by implementing the loader API First, sign up for an API key http://code.google.com/apis/loader/signup.html Implement the google loader <script type="text/javascript" src="http://www.google.com/jsapi?key=xxxx"></script> <script type="text/javascript">google.load(script, version)</script>
  • 12. Google Loader API Implement the Google Loader in your Template index.php file // USE GOOGLE LOADER API TO PRELOAD COMMON JAVASCRIPT LIBRARIES $js = '{"modules":{"name":"mootools","version":"1.4.1"}}'; $key = $this->params->get('google_api'); if($key){ $source = "www.google.com/jsapi?autoload=".urlencode($js)."&amp;key="; $document->addScript(HTTP_PROTOCOL.$source.$key); }else{ $document->addScript("templates/yourtemplate/javascript/mootools.js"); $document->addScript("templates/inkandpaper/javascript/swfobject.js"); }
  • 13. Additional Resources http://code.google.com/apis/loader https://groups.google.com/group/joomla-dev-general http://docs.joomla.org/Developers http://mootools.net/docs/core http://jquery.com http://www.prototypejs.org
  • 14. Special Thanks Lokesh Dhakar - lightbox Sam Stephenson - prototype Thomas Fuchs - scriptaculous Valerio Proietti - mootools John Resig - jquery The Joomla and Open Source Communities