SlideShare a Scribd company logo
1 of 15
Download to read offline
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

More Related Content

What's hot

AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS ArchitectureEyal Vardi
 
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.1Vagmi Mudumbai
 
AngularJS Compile Process
AngularJS Compile ProcessAngularJS Compile Process
AngularJS Compile ProcessEyal Vardi
 
Testable, Object-Oriented JavaScript
Testable, Object-Oriented JavaScriptTestable, Object-Oriented JavaScript
Testable, Object-Oriented JavaScriptJon Kruger
 
Perkenalan ReasonML
Perkenalan ReasonMLPerkenalan ReasonML
Perkenalan ReasonMLRiza Fahmi
 
Sprout core and performance
Sprout core and performanceSprout core and performance
Sprout core and performanceYehuda Katz
 
06 jQuery #burningkeyboards
06 jQuery  #burningkeyboards06 jQuery  #burningkeyboards
06 jQuery #burningkeyboardsDenis Ristic
 
Getting classy with ES6
Getting classy with ES6Getting classy with ES6
Getting classy with ES6Andy Sharman
 
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
 
Building Large jQuery Applications
Building Large jQuery ApplicationsBuilding Large jQuery Applications
Building Large jQuery ApplicationsRebecca Murphey
 
05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboardsDenis Ristic
 
Introduction to ReasonML
Introduction to ReasonMLIntroduction to ReasonML
Introduction to ReasonMLRiza Fahmi
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony AppsKris Wallsmith
 
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 meansRobert Nyman
 
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...Domenic Denicola
 

What's hot (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...
 

Viewers also liked

Joomla e commerce gabe wahhab
Joomla e commerce gabe wahhabJoomla e commerce gabe wahhab
Joomla e commerce gabe wahhabLuke Summerfield
 
Proud of who we are
Proud of who we areProud of who we are
Proud of who we arecheryl12345
 
Strategic planning
Strategic planningStrategic planning
Strategic planningSteve Miller
 
Microbiology (major microbial diseases)
Microbiology (major microbial diseases)Microbiology (major microbial diseases)
Microbiology (major microbial diseases)Erwin Molinos
 

Viewers also liked (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 to Leveraging JavaScript Frameworks in Joomla Sites

Week 4 - jQuery + Ajax
Week 4 - jQuery + AjaxWeek 4 - jQuery + Ajax
Week 4 - jQuery + Ajaxbaygross
 
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 Secretssmueller_sandsmedia
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScriptAndrew Dupont
 
jQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends ForeverjQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends Foreverstephskardal
 
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 jsFrancois Zaninotto
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginnersDivakar Gu
 
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 frameworkBen Lin
 
Avinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPressAvinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPresswpnepal
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingVisual Engineering
 
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 Libraryrsnarayanan
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenerytoddbr
 

Similar to Leveraging JavaScript Frameworks in Joomla Sites (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
 

More from Luke Summerfield

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 GuideLuke Summerfield
 
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 Luke Summerfield
 
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 GuideLuke Summerfield
 
Improving joomla's backend user experience
Improving joomla's backend user experienceImproving joomla's backend user experience
Improving joomla's backend user experienceLuke Summerfield
 
Joomla e commerce gabe wahhab
Joomla e commerce gabe wahhabJoomla e commerce gabe wahhab
Joomla e commerce gabe wahhabLuke Summerfield
 
Joomla e commerce gabe wahhab
Joomla e commerce gabe wahhabJoomla e commerce gabe wahhab
Joomla e commerce gabe wahhabLuke 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_platforLuke Summerfield
 

More from 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
 

Recently uploaded

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 

Recently uploaded (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 

Leveraging JavaScript Frameworks in Joomla Sites

  • 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