SlideShare a Scribd company logo
jQuery DAP Objects

Why?
 • Rich front-end functionality to improve user experience

 • Use appropriate languages for appropriate parts of the system
    • JavaScript for browser functionality
    • CSS for styling
    • Perl for server functionality

 • Avoid server-side work than can be done (quicker!) on the client

 • Avoid re-loading pages ‘in the middle of a task’, e.g.:
    • Validating input values
    • Changing configurations, values, etc.
    • Retrieving ‘choice-making’ information
    • Tailing logs, etc.
jQuery DAP Objects

Why?
Appropriate in JavaScript                Inappropriate in JavaScript
  • Rich front-end functionality to
• Check an input field has a value     improve user experience
                                         • Rounding corners mathematically
• Add a class to an element              • Data storage
• Show or hide elements
 • Use appropriate languages for appropriate parts of the system
                                   Inappropriate in Perl
        • JavaScript
Appropriate in Perl for browser functionality Sorting a table where the data
                                             •
        • CSS to database
• Read/write forastyling                         hasn't changed
        • Perl for
• File handling server functionality         • Re-loading a page with an error
                                             • Setting element colours directly
 Appropriate in CSS
  • Avoid server-side work than can Inappropriate in CSS on the client
• Rounded corners using a background
                                             be done (quicker!)
    image                                    • Sizing images
  • Avoid re-loading pages ‘in the middle of a task’, e.g.:
• Class –based colours, etc.                 • Conditional statements
     • Validating input values
     • Changing configurations, values, etc.
     • Retrieving ‘choice-making’ information
     • Tailing logs, etc.
jQuery DAP Objects

So?...



  We are no longer just         We need to engineer
     adding a bit of
 JavaScript to do simple
   things via ‘onclick’
                           =>    front-end code the
                                same as we do back-
                                    end code - OO
     functions, etc.                  JavaScript
jQuery DAP Objects

What Benefit?
                                                     Almost - No
    • Simple and effective code re-use               inheritance


    • All the benefits of OO-code – encapsulation,
     name-spacing, simple interface, etc.

    • Remove the pain of writing JavaScript – concentrate
     on writing the functionality, not coding up visuals and
     behaviour

    • Respect styling and design
jQuery DAP Objects

DapTable




                               Auto-sort
                 Auto-filter




   Auto-styled

                               CSV/TSV downloadable
jQuery DAP Objects

DapTable: Features
 • All styling defined 1. All done client side
                        2. Respects sorting and filter
 • striped
 • collapsable            Currently:
                               • By file size (KB,
 • tsv_downloadable, csv_downloadable MB, etc.)
                               • By node (webd2.dd.com < webd12.db.com
 • tsv_downloadable_custom, csv_downloadable_custom
 • url_downloadable
 • Sorting, and custom sorting
 • Keys
 • Auto-highlighting of rows on rollover
 • Fix width
jQuery DAP Objects

Popup




Suggestions



Expander
jQuery DAP Objects

Popup: Features
  • Works on any element
  • Can use AJAX to populate
  • Optional offset from element
  • Custom close methods


Suggestions: Features
  • Can use list on page, or get results by AJAX


Expander: Features
  • Works on element


Audit
  • Refreshes audit history
jQuery DAP Objects

JavaScript Objects


  var Object = function() {

      this.function = function() {
                                      Looks less like JavaScript
          var self = this            and more like an object in
                                          C++, Java, Perl?
          function code                      (Maybe…)
      }
  }

  var obj = new Object()
jQuery DAP Objects

Generic DAP Objects
 var Object = function() {

     this.includedObject        = new IncludedObject()

     this.init = function() {

         var self = this

         initialisation code

         self.includedObject.init()     // if necessary

         ...
     }
 }
jQuery DAP Objects

Example use: Cluster
            var Cluster = function() { Object variables

              this.dragged = 0                        Included objects
              this.audit    = new Audit()
              this.expander = new Expander()
              this.input    = new Input()
              this.suggestions = new Suggestions()
              this.popup     = new Popup()
              this.table    = new DapTable()

              this.init = function() { Scope self

                var self = this
                                                             Standard jQuery
                self.table.init($('#server_table'))
                  Call object method
                $('#node_div').draggable({ stop: function() { self.dragged = 1 } })

                $('#node_div_close').click( function() { self.deselect_node() })
jQuery DAP Objects

DapTable: Usage
   In Template
   <link rel="stylesheet" type="text/css" href="/css/common.css" />
   <link rel="stylesheet" type="text/css" href="/css/common/daptable.css" />

   <script type="text/javascript" src="/javascript/jquery/jquery.js"></script>
   <script type="text/javascript" src="/javascript/table/table.js"></script>
   <script type="text/javascript" src="/javascript/common/DapTable.js"></script>
   <script type='text/javascript'>
    $(document).ready(
      function() {
         var cluster = new Cluster()
         cluster.init()
                                                          Will ultimately be:
      }
    )                                                     a) one compressed JS script, and
   </script>                                                  one compressed CSS file
                                                      b) CSS at the top, JavaScript at the
                                                          bottom
   <table class=‘dap_table table-autosort cvs_downloadable’>
    …
jQuery DAP Objects

DapTable: Usage

 In Javascript
 var Cluster = function() {

     this.table      = new DapTable()

     this.init = function() {

         var self = this

         self.table.init($('#server_table'))
         self.table.init('#server_table')
         …
     }
 }
jQuery DAP Objects

TableKey




 In Javascript

 self.key = new TableKey('#toggle_key', 65, 17)
jQuery DAP Objects

Generic jQuery Objects: Thickbox

                                       Just add a class
                                   ‘thickbox’ to a <a> tag
jQuery DAP Objects

More Generic Objects:
  • Cookie
  • Format
  • Input
  • StringFuns
  • Url

Future Suggestions:
  • Client-side Validation
  • Generic ‘COMET’
jQuery DAP Objects

Client-side Validation


  function validate() {
     valid = 1
    <div>
     $(‘.mandatory’).each(
         function() {id="rtsub" type="text" class="mandatory“ name="rtsub" value=“" />
             <input
            if ($(this).val() == ‘’)) {
           </div>
               $(this).addClass(‘invalid’)
           <div>
             <input=id="rtenv" type="text“ name="rtenv" value=“" />
               valid 0
           </div> Note: Don’t do this! Do (e.g.):
            })
     if (! valid) { $(‘#element .mandatory’)
           ...
         alert(‘Please complete all mandatory fields’)
         return 0
     }
     return 1
  }
jQuery DAP Objects

“Rich front-end functionality to improve user experience”
jQuery 1.4.2

FYI:


  • “Wow, the performance improvements are overwhelming.”

  • “1.4.2 is blazing fast http://j.mp/9yUNZ9 ...”

  • “There has been a great increase in performance.”

  • “Great work, great performance increases.”

                     http://blog.jquery.com/2010/02/19/jquery-142-released/
jQuery 1.4.2

My Own Tests:
  • N Elements, all same class
  • 3 handlers per element
                              jQuery Bind Times
              250000

        for (var i = 0; i < 10000; i++) {
           $('body').append("<div class='a_div'></div>")
            200000


         } 150000
         $('.a_div').click( function() { $(this).hide() }) 1.3.2
         ms




         $('.a_div').mouseover( function() { $(this).hide() })
            100000                                         1.4.2


         $('.a_div').mouseout( function() { $(this).hide() })
              50000



                   0
                       1000     3000      10000   30000

More Related Content

What's hot (17)

JavaScript - Chapter 7 - Advanced Functions
 JavaScript - Chapter 7 - Advanced Functions JavaScript - Chapter 7 - Advanced Functions
JavaScript - Chapter 7 - Advanced Functions
WebStackAcademy
 
COScheduler
COSchedulerCOScheduler
COScheduler
WO Community
 
Javascript and Jquery Best practices
Javascript and Jquery Best practicesJavascript and Jquery Best practices
Javascript and Jquery Best practices
Sultan Khan
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jquery
Kostas Mavridis
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
scalaconfjp
 
Getting Started with jQuery
Getting Started with jQueryGetting Started with jQuery
Getting Started with jQuery
Akshay Mathur
 
Connect 2016-Move Your XPages Applications to the Fast Lane
Connect 2016-Move Your XPages Applications to the Fast LaneConnect 2016-Move Your XPages Applications to the Fast Lane
Connect 2016-Move Your XPages Applications to the Fast Lane
Howard Greenberg
 
JavaScript!
JavaScript!JavaScript!
JavaScript!
RTigger
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
Ran Mizrahi
 
An Introduction to JavaScript
An Introduction to JavaScriptAn Introduction to JavaScript
An Introduction to JavaScript
tonyh1
 
JavaScript in Object-Oriented Way
JavaScript in Object-Oriented WayJavaScript in Object-Oriented Way
JavaScript in Object-Oriented Way
Chamnap Chhorn
 
Web2.0 with jQuery in English
Web2.0 with jQuery in EnglishWeb2.0 with jQuery in English
Web2.0 with jQuery in English
Lau Bech Lauritzen
 
An introduction to DOM , JAVASCRIPT , JQUERY, AJAX and JSON
An introduction to DOM , JAVASCRIPT , JQUERY, AJAX and JSONAn introduction to DOM , JAVASCRIPT , JQUERY, AJAX and JSON
An introduction to DOM , JAVASCRIPT , JQUERY, AJAX and JSON
Syed Moosa Kaleem
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
Jussi Pohjolainen
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
WO Community
 
High Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
High Performance XQuery Processing in PHP with Zorba by Vikram VaswaniHigh Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
High Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
vvaswani
 
JavaScript 101
JavaScript 101JavaScript 101
JavaScript 101
ygv2000
 
JavaScript - Chapter 7 - Advanced Functions
 JavaScript - Chapter 7 - Advanced Functions JavaScript - Chapter 7 - Advanced Functions
JavaScript - Chapter 7 - Advanced Functions
WebStackAcademy
 
Javascript and Jquery Best practices
Javascript and Jquery Best practicesJavascript and Jquery Best practices
Javascript and Jquery Best practices
Sultan Khan
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jquery
Kostas Mavridis
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
scalaconfjp
 
Getting Started with jQuery
Getting Started with jQueryGetting Started with jQuery
Getting Started with jQuery
Akshay Mathur
 
Connect 2016-Move Your XPages Applications to the Fast Lane
Connect 2016-Move Your XPages Applications to the Fast LaneConnect 2016-Move Your XPages Applications to the Fast Lane
Connect 2016-Move Your XPages Applications to the Fast Lane
Howard Greenberg
 
JavaScript!
JavaScript!JavaScript!
JavaScript!
RTigger
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
Ran Mizrahi
 
An Introduction to JavaScript
An Introduction to JavaScriptAn Introduction to JavaScript
An Introduction to JavaScript
tonyh1
 
JavaScript in Object-Oriented Way
JavaScript in Object-Oriented WayJavaScript in Object-Oriented Way
JavaScript in Object-Oriented Way
Chamnap Chhorn
 
An introduction to DOM , JAVASCRIPT , JQUERY, AJAX and JSON
An introduction to DOM , JAVASCRIPT , JQUERY, AJAX and JSONAn introduction to DOM , JAVASCRIPT , JQUERY, AJAX and JSON
An introduction to DOM , JAVASCRIPT , JQUERY, AJAX and JSON
Syed Moosa Kaleem
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
WO Community
 
High Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
High Performance XQuery Processing in PHP with Zorba by Vikram VaswaniHigh Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
High Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
vvaswani
 
JavaScript 101
JavaScript 101JavaScript 101
JavaScript 101
ygv2000
 

Viewers also liked (7)

Jozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz604
Jozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz604Jozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz604
Jozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz604
Luz Elena Madrigal Hernandez
 
GoNetReady Business Presentation Powerpoint
GoNetReady Business Presentation PowerpointGoNetReady Business Presentation Powerpoint
GoNetReady Business Presentation Powerpoint
Bolelang Rakeepile
 
Energy Storage: Nations Vital Security And The Life Line For Renewable Ener...
Energy Storage:   Nations Vital Security And The Life Line For Renewable Ener...Energy Storage:   Nations Vital Security And The Life Line For Renewable Ener...
Energy Storage: Nations Vital Security And The Life Line For Renewable Ener...
Najib Altawell
 
Full Frontal Javascript Conference
Full Frontal Javascript ConferenceFull Frontal Javascript Conference
Full Frontal Javascript Conference
Steve Wells
 
Questionnaire
QuestionnaireQuestionnaire
Questionnaire
popo1996
 
Waterfalls for Agile in a bag
Waterfalls for Agile in a bagWaterfalls for Agile in a bag
Waterfalls for Agile in a bag
Steve Wells
 
GoNetReady Business Presentation Powerpoint
GoNetReady Business Presentation PowerpointGoNetReady Business Presentation Powerpoint
GoNetReady Business Presentation Powerpoint
Bolelang Rakeepile
 
Energy Storage: Nations Vital Security And The Life Line For Renewable Ener...
Energy Storage:   Nations Vital Security And The Life Line For Renewable Ener...Energy Storage:   Nations Vital Security And The Life Line For Renewable Ener...
Energy Storage: Nations Vital Security And The Life Line For Renewable Ener...
Najib Altawell
 
Full Frontal Javascript Conference
Full Frontal Javascript ConferenceFull Frontal Javascript Conference
Full Frontal Javascript Conference
Steve Wells
 
Questionnaire
QuestionnaireQuestionnaire
Questionnaire
popo1996
 
Waterfalls for Agile in a bag
Waterfalls for Agile in a bagWaterfalls for Agile in a bag
Waterfalls for Agile in a bag
Steve Wells
 

Similar to jQuery Objects (20)

Java scriptforjavadev part2a
Java scriptforjavadev part2aJava scriptforjavadev part2a
Java scriptforjavadev part2a
Makarand Bhatambarekar
 
User Interface Development with jQuery
User Interface Development with jQueryUser Interface Development with jQuery
User Interface Development with jQuery
colinbdclark
 
OOP and JavaScript
OOP and JavaScriptOOP and JavaScript
OOP and JavaScript
easelsolutions
 
10 Years of JavaScript
10 Years of JavaScript10 Years of JavaScript
10 Years of JavaScript
Mike de Boer
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
Alive Kuo
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
Angel Ruiz
 
Eugene Andruszczenko: jQuery
Eugene Andruszczenko: jQueryEugene Andruszczenko: jQuery
Eugene Andruszczenko: jQuery
Refresh Events
 
jQuery Presentation - Refresh Events
jQuery Presentation - Refresh EventsjQuery Presentation - Refresh Events
jQuery Presentation - Refresh Events
Eugene Andruszczenko
 
DrupalCon jQuery
DrupalCon jQueryDrupalCon jQuery
DrupalCon jQuery
Nathan Smith
 
Building Real-World Dojo Web Applications
Building Real-World Dojo Web ApplicationsBuilding Real-World Dojo Web Applications
Building Real-World Dojo Web Applications
Andrew Ferrier
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
Doris Chen
 
An in-depth look at jQuery
An in-depth look at jQueryAn in-depth look at jQuery
An in-depth look at jQuery
Paul Bakaus
 
HTML5: Building the Next Generation of Web Applications
HTML5: Building the Next Generation of Web ApplicationsHTML5: Building the Next Generation of Web Applications
HTML5: Building the Next Generation of Web Applications
Chrome Developer Relations
 
Big Data loves JS
Big Data loves JSBig Data loves JS
Big Data loves JS
Dominiek ter Heide
 
Building a JavaScript Library
Building a JavaScript LibraryBuilding a JavaScript Library
Building a JavaScript Library
jeresig
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
Mark Roden
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
Andres Baravalle
 
JavaScript
JavaScriptJavaScript
JavaScript
Bharti Gupta
 
JQuery
JQueryJQuery
JQuery
Rahul Jain
 
How I Learned to Stop Worrying and Love jQuery (Jan 2013)
How I Learned to Stop Worrying and Love jQuery (Jan 2013)How I Learned to Stop Worrying and Love jQuery (Jan 2013)
How I Learned to Stop Worrying and Love jQuery (Jan 2013)
David Giard
 
User Interface Development with jQuery
User Interface Development with jQueryUser Interface Development with jQuery
User Interface Development with jQuery
colinbdclark
 
10 Years of JavaScript
10 Years of JavaScript10 Years of JavaScript
10 Years of JavaScript
Mike de Boer
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
Alive Kuo
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
Angel Ruiz
 
Eugene Andruszczenko: jQuery
Eugene Andruszczenko: jQueryEugene Andruszczenko: jQuery
Eugene Andruszczenko: jQuery
Refresh Events
 
jQuery Presentation - Refresh Events
jQuery Presentation - Refresh EventsjQuery Presentation - Refresh Events
jQuery Presentation - Refresh Events
Eugene Andruszczenko
 
Building Real-World Dojo Web Applications
Building Real-World Dojo Web ApplicationsBuilding Real-World Dojo Web Applications
Building Real-World Dojo Web Applications
Andrew Ferrier
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
Doris Chen
 
An in-depth look at jQuery
An in-depth look at jQueryAn in-depth look at jQuery
An in-depth look at jQuery
Paul Bakaus
 
HTML5: Building the Next Generation of Web Applications
HTML5: Building the Next Generation of Web ApplicationsHTML5: Building the Next Generation of Web Applications
HTML5: Building the Next Generation of Web Applications
Chrome Developer Relations
 
Building a JavaScript Library
Building a JavaScript LibraryBuilding a JavaScript Library
Building a JavaScript Library
jeresig
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
Mark Roden
 
How I Learned to Stop Worrying and Love jQuery (Jan 2013)
How I Learned to Stop Worrying and Love jQuery (Jan 2013)How I Learned to Stop Worrying and Love jQuery (Jan 2013)
How I Learned to Stop Worrying and Love jQuery (Jan 2013)
David Giard
 

Recently uploaded (20)

Kubernetes Cloud Native Indonesia Meetup - May 2025
Kubernetes Cloud Native Indonesia Meetup - May 2025Kubernetes Cloud Native Indonesia Meetup - May 2025
Kubernetes Cloud Native Indonesia Meetup - May 2025
Prasta Maha
 
Let’s Get Slack Certified! 🚀- Slack Community
Let’s Get Slack Certified! 🚀- Slack CommunityLet’s Get Slack Certified! 🚀- Slack Community
Let’s Get Slack Certified! 🚀- Slack Community
SanjeetMishra29
 
Introducing Ensemble Cloudlet vRouter
Introducing Ensemble  Cloudlet vRouterIntroducing Ensemble  Cloudlet vRouter
Introducing Ensemble Cloudlet vRouter
Adtran
 
Security Operations and the Defense Analyst - Splunk Certificate
Security Operations and the Defense Analyst - Splunk CertificateSecurity Operations and the Defense Analyst - Splunk Certificate
Security Operations and the Defense Analyst - Splunk Certificate
VICTOR MAESTRE RAMIREZ
 
Fully Open-Source Private Clouds: Freedom, Security, and Control
Fully Open-Source Private Clouds: Freedom, Security, and ControlFully Open-Source Private Clouds: Freedom, Security, and Control
Fully Open-Source Private Clouds: Freedom, Security, and Control
ShapeBlue
 
Talk: On an adventure into the depths of Maven - Kaya Weers
Talk: On an adventure into the depths of Maven - Kaya WeersTalk: On an adventure into the depths of Maven - Kaya Weers
Talk: On an adventure into the depths of Maven - Kaya Weers
Kaya Weers
 
European Accessibility Act & Integrated Accessibility Testing
European Accessibility Act & Integrated Accessibility TestingEuropean Accessibility Act & Integrated Accessibility Testing
European Accessibility Act & Integrated Accessibility Testing
Julia Undeutsch
 
Agentic AI - The New Era of Intelligence
Agentic AI - The New Era of IntelligenceAgentic AI - The New Era of Intelligence
Agentic AI - The New Era of Intelligence
Muzammil Shah
 
SDG 9000 Series: Unleashing multigigabit everywhere
SDG 9000 Series: Unleashing multigigabit everywhereSDG 9000 Series: Unleashing multigigabit everywhere
SDG 9000 Series: Unleashing multigigabit everywhere
Adtran
 
Cyber Security Legal Framework in Nepal.pptx
Cyber Security Legal Framework in Nepal.pptxCyber Security Legal Framework in Nepal.pptx
Cyber Security Legal Framework in Nepal.pptx
Ghimire B.R.
 
Cyber security cyber security cyber security cyber security cyber security cy...
Cyber security cyber security cyber security cyber security cyber security cy...Cyber security cyber security cyber security cyber security cyber security cy...
Cyber security cyber security cyber security cyber security cyber security cy...
pranavbodhak
 
Content and eLearning Standards: Finding the Best Fit for Your-Training
Content and eLearning Standards: Finding the Best Fit for Your-TrainingContent and eLearning Standards: Finding the Best Fit for Your-Training
Content and eLearning Standards: Finding the Best Fit for Your-Training
Rustici Software
 
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Aaryan Kansari
 
Dev Dives: System-to-system integration with UiPath API Workflows
Dev Dives: System-to-system integration with UiPath API WorkflowsDev Dives: System-to-system integration with UiPath API Workflows
Dev Dives: System-to-system integration with UiPath API Workflows
UiPathCommunity
 
Gihbli AI and Geo sitution |use/misuse of Ai Technology
Gihbli AI and Geo sitution |use/misuse of Ai TechnologyGihbli AI and Geo sitution |use/misuse of Ai Technology
Gihbli AI and Geo sitution |use/misuse of Ai Technology
zainkhurram1111
 
Grannie’s Journey to Using Healthcare AI Experiences
Grannie’s Journey to Using Healthcare AI ExperiencesGrannie’s Journey to Using Healthcare AI Experiences
Grannie’s Journey to Using Healthcare AI Experiences
Lauren Parr
 
TrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy ContractingTrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy Contracting
TrustArc
 
Droidal: AI Agents Revolutionizing Healthcare
Droidal: AI Agents Revolutionizing HealthcareDroidal: AI Agents Revolutionizing Healthcare
Droidal: AI Agents Revolutionizing Healthcare
Droidal LLC
 
Contributing to WordPress With & Without Code.pptx
Contributing to WordPress With & Without Code.pptxContributing to WordPress With & Without Code.pptx
Contributing to WordPress With & Without Code.pptx
Patrick Lumumba
 
Microsoft Build 2025 takeaways in one presentation
Microsoft Build 2025 takeaways in one presentationMicrosoft Build 2025 takeaways in one presentation
Microsoft Build 2025 takeaways in one presentation
Digitalmara
 
Kubernetes Cloud Native Indonesia Meetup - May 2025
Kubernetes Cloud Native Indonesia Meetup - May 2025Kubernetes Cloud Native Indonesia Meetup - May 2025
Kubernetes Cloud Native Indonesia Meetup - May 2025
Prasta Maha
 
Let’s Get Slack Certified! 🚀- Slack Community
Let’s Get Slack Certified! 🚀- Slack CommunityLet’s Get Slack Certified! 🚀- Slack Community
Let’s Get Slack Certified! 🚀- Slack Community
SanjeetMishra29
 
Introducing Ensemble Cloudlet vRouter
Introducing Ensemble  Cloudlet vRouterIntroducing Ensemble  Cloudlet vRouter
Introducing Ensemble Cloudlet vRouter
Adtran
 
Security Operations and the Defense Analyst - Splunk Certificate
Security Operations and the Defense Analyst - Splunk CertificateSecurity Operations and the Defense Analyst - Splunk Certificate
Security Operations and the Defense Analyst - Splunk Certificate
VICTOR MAESTRE RAMIREZ
 
Fully Open-Source Private Clouds: Freedom, Security, and Control
Fully Open-Source Private Clouds: Freedom, Security, and ControlFully Open-Source Private Clouds: Freedom, Security, and Control
Fully Open-Source Private Clouds: Freedom, Security, and Control
ShapeBlue
 
Talk: On an adventure into the depths of Maven - Kaya Weers
Talk: On an adventure into the depths of Maven - Kaya WeersTalk: On an adventure into the depths of Maven - Kaya Weers
Talk: On an adventure into the depths of Maven - Kaya Weers
Kaya Weers
 
European Accessibility Act & Integrated Accessibility Testing
European Accessibility Act & Integrated Accessibility TestingEuropean Accessibility Act & Integrated Accessibility Testing
European Accessibility Act & Integrated Accessibility Testing
Julia Undeutsch
 
Agentic AI - The New Era of Intelligence
Agentic AI - The New Era of IntelligenceAgentic AI - The New Era of Intelligence
Agentic AI - The New Era of Intelligence
Muzammil Shah
 
SDG 9000 Series: Unleashing multigigabit everywhere
SDG 9000 Series: Unleashing multigigabit everywhereSDG 9000 Series: Unleashing multigigabit everywhere
SDG 9000 Series: Unleashing multigigabit everywhere
Adtran
 
Cyber Security Legal Framework in Nepal.pptx
Cyber Security Legal Framework in Nepal.pptxCyber Security Legal Framework in Nepal.pptx
Cyber Security Legal Framework in Nepal.pptx
Ghimire B.R.
 
Cyber security cyber security cyber security cyber security cyber security cy...
Cyber security cyber security cyber security cyber security cyber security cy...Cyber security cyber security cyber security cyber security cyber security cy...
Cyber security cyber security cyber security cyber security cyber security cy...
pranavbodhak
 
Content and eLearning Standards: Finding the Best Fit for Your-Training
Content and eLearning Standards: Finding the Best Fit for Your-TrainingContent and eLearning Standards: Finding the Best Fit for Your-Training
Content and eLearning Standards: Finding the Best Fit for Your-Training
Rustici Software
 
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Aaryan Kansari
 
Dev Dives: System-to-system integration with UiPath API Workflows
Dev Dives: System-to-system integration with UiPath API WorkflowsDev Dives: System-to-system integration with UiPath API Workflows
Dev Dives: System-to-system integration with UiPath API Workflows
UiPathCommunity
 
Gihbli AI and Geo sitution |use/misuse of Ai Technology
Gihbli AI and Geo sitution |use/misuse of Ai TechnologyGihbli AI and Geo sitution |use/misuse of Ai Technology
Gihbli AI and Geo sitution |use/misuse of Ai Technology
zainkhurram1111
 
Grannie’s Journey to Using Healthcare AI Experiences
Grannie’s Journey to Using Healthcare AI ExperiencesGrannie’s Journey to Using Healthcare AI Experiences
Grannie’s Journey to Using Healthcare AI Experiences
Lauren Parr
 
TrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy ContractingTrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy Contracting
TrustArc
 
Droidal: AI Agents Revolutionizing Healthcare
Droidal: AI Agents Revolutionizing HealthcareDroidal: AI Agents Revolutionizing Healthcare
Droidal: AI Agents Revolutionizing Healthcare
Droidal LLC
 
Contributing to WordPress With & Without Code.pptx
Contributing to WordPress With & Without Code.pptxContributing to WordPress With & Without Code.pptx
Contributing to WordPress With & Without Code.pptx
Patrick Lumumba
 
Microsoft Build 2025 takeaways in one presentation
Microsoft Build 2025 takeaways in one presentationMicrosoft Build 2025 takeaways in one presentation
Microsoft Build 2025 takeaways in one presentation
Digitalmara
 

jQuery Objects

  • 1. jQuery DAP Objects Why? • Rich front-end functionality to improve user experience • Use appropriate languages for appropriate parts of the system • JavaScript for browser functionality • CSS for styling • Perl for server functionality • Avoid server-side work than can be done (quicker!) on the client • Avoid re-loading pages ‘in the middle of a task’, e.g.: • Validating input values • Changing configurations, values, etc. • Retrieving ‘choice-making’ information • Tailing logs, etc.
  • 2. jQuery DAP Objects Why? Appropriate in JavaScript Inappropriate in JavaScript • Rich front-end functionality to • Check an input field has a value improve user experience • Rounding corners mathematically • Add a class to an element • Data storage • Show or hide elements • Use appropriate languages for appropriate parts of the system Inappropriate in Perl • JavaScript Appropriate in Perl for browser functionality Sorting a table where the data • • CSS to database • Read/write forastyling hasn't changed • Perl for • File handling server functionality • Re-loading a page with an error • Setting element colours directly Appropriate in CSS • Avoid server-side work than can Inappropriate in CSS on the client • Rounded corners using a background be done (quicker!) image • Sizing images • Avoid re-loading pages ‘in the middle of a task’, e.g.: • Class –based colours, etc. • Conditional statements • Validating input values • Changing configurations, values, etc. • Retrieving ‘choice-making’ information • Tailing logs, etc.
  • 3. jQuery DAP Objects So?... We are no longer just We need to engineer adding a bit of JavaScript to do simple things via ‘onclick’ => front-end code the same as we do back- end code - OO functions, etc. JavaScript
  • 4. jQuery DAP Objects What Benefit? Almost - No • Simple and effective code re-use inheritance • All the benefits of OO-code – encapsulation, name-spacing, simple interface, etc. • Remove the pain of writing JavaScript – concentrate on writing the functionality, not coding up visuals and behaviour • Respect styling and design
  • 5. jQuery DAP Objects DapTable Auto-sort Auto-filter Auto-styled CSV/TSV downloadable
  • 6. jQuery DAP Objects DapTable: Features • All styling defined 1. All done client side 2. Respects sorting and filter • striped • collapsable Currently: • By file size (KB, • tsv_downloadable, csv_downloadable MB, etc.) • By node (webd2.dd.com < webd12.db.com • tsv_downloadable_custom, csv_downloadable_custom • url_downloadable • Sorting, and custom sorting • Keys • Auto-highlighting of rows on rollover • Fix width
  • 8. jQuery DAP Objects Popup: Features • Works on any element • Can use AJAX to populate • Optional offset from element • Custom close methods Suggestions: Features • Can use list on page, or get results by AJAX Expander: Features • Works on element Audit • Refreshes audit history
  • 9. jQuery DAP Objects JavaScript Objects var Object = function() { this.function = function() { Looks less like JavaScript var self = this and more like an object in C++, Java, Perl? function code (Maybe…) } } var obj = new Object()
  • 10. jQuery DAP Objects Generic DAP Objects var Object = function() { this.includedObject = new IncludedObject() this.init = function() { var self = this initialisation code self.includedObject.init() // if necessary ... } }
  • 11. jQuery DAP Objects Example use: Cluster var Cluster = function() { Object variables this.dragged = 0 Included objects this.audit = new Audit() this.expander = new Expander() this.input = new Input() this.suggestions = new Suggestions() this.popup = new Popup() this.table = new DapTable() this.init = function() { Scope self var self = this Standard jQuery self.table.init($('#server_table')) Call object method $('#node_div').draggable({ stop: function() { self.dragged = 1 } }) $('#node_div_close').click( function() { self.deselect_node() })
  • 12. jQuery DAP Objects DapTable: Usage In Template <link rel="stylesheet" type="text/css" href="/css/common.css" /> <link rel="stylesheet" type="text/css" href="/css/common/daptable.css" /> <script type="text/javascript" src="/javascript/jquery/jquery.js"></script> <script type="text/javascript" src="/javascript/table/table.js"></script> <script type="text/javascript" src="/javascript/common/DapTable.js"></script> <script type='text/javascript'> $(document).ready( function() { var cluster = new Cluster() cluster.init() Will ultimately be: } ) a) one compressed JS script, and </script> one compressed CSS file b) CSS at the top, JavaScript at the bottom <table class=‘dap_table table-autosort cvs_downloadable’> …
  • 13. jQuery DAP Objects DapTable: Usage In Javascript var Cluster = function() { this.table = new DapTable() this.init = function() { var self = this self.table.init($('#server_table')) self.table.init('#server_table') … } }
  • 14. jQuery DAP Objects TableKey In Javascript self.key = new TableKey('#toggle_key', 65, 17)
  • 15. jQuery DAP Objects Generic jQuery Objects: Thickbox Just add a class ‘thickbox’ to a <a> tag
  • 16. jQuery DAP Objects More Generic Objects: • Cookie • Format • Input • StringFuns • Url Future Suggestions: • Client-side Validation • Generic ‘COMET’
  • 17. jQuery DAP Objects Client-side Validation function validate() { valid = 1 <div> $(‘.mandatory’).each( function() {id="rtsub" type="text" class="mandatory“ name="rtsub" value=“" /> <input if ($(this).val() == ‘’)) { </div> $(this).addClass(‘invalid’) <div> <input=id="rtenv" type="text“ name="rtenv" value=“" /> valid 0 </div> Note: Don’t do this! Do (e.g.): }) if (! valid) { $(‘#element .mandatory’) ... alert(‘Please complete all mandatory fields’) return 0 } return 1 }
  • 18. jQuery DAP Objects “Rich front-end functionality to improve user experience”
  • 19. jQuery 1.4.2 FYI: • “Wow, the performance improvements are overwhelming.” • “1.4.2 is blazing fast http://j.mp/9yUNZ9 ...” • “There has been a great increase in performance.” • “Great work, great performance increases.” http://blog.jquery.com/2010/02/19/jquery-142-released/
  • 20. jQuery 1.4.2 My Own Tests: • N Elements, all same class • 3 handlers per element jQuery Bind Times 250000 for (var i = 0; i < 10000; i++) { $('body').append("<div class='a_div'></div>") 200000 } 150000 $('.a_div').click( function() { $(this).hide() }) 1.3.2 ms $('.a_div').mouseover( function() { $(this).hide() }) 100000 1.4.2 $('.a_div').mouseout( function() { $(this).hide() }) 50000 0 1000 3000 10000 30000