SlideShare une entreprise Scribd logo
1  sur  15
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

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
 

Tendances (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...
 

En vedette

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
 

En vedette (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)
 

Similaire à Javascript Frameworks for Joomla

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
 

Similaire à 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
 

Plus de 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
 

Plus 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
 

Dernier

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Dernier (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

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