SlideShare ist ein Scribd-Unternehmen logo
1 von 55
Downloaden Sie, um offline zu lesen
CRAFTING APP
INTERFACES WITH




          Presented by Nathan Smith
Carpal Tunnel Relief

Note: Don’t feel like you need to write all of
this down. The slides are available here...

http://www.slideshare.net/nathansmith/drupalcon-jquery
“Allow myself to... introduce myself”


           I work (from home) for HP
           as a front-end developer.


           I’m best known for making
           a helpful 5.6 KB CSS file.
Shh... My secret in-house code reviewer




  Note: This was shot hastily with a camera phone. I make no claims of being a decent photographer.
FYI – I don’t especially love CSS



The reason I create and use CSS
frameworks is because I hate doing
mundane tasks repeatedly (yawn).

I’d rather be working in JavaScript.
JavaScript books I’ve worked on...

                                 Co-author

 Tech editor                                                     Tech editor




jQueryEnlightenment.com                                       JavaScriptEnlightenment.com


                          oreilly.com/catalog/9780596159788
Our team at HP uses Sass
 to expedite writing CSS




     http://www.sass-lang.com
Sass compiles down to CSS...


$blue: #3bbfce
                             #foo {
$margin: 20px
                               border-color: #3bbfce;
                               color: #2b9eab;
#foo                         }
  border-color: $blue
  color: darken($blue, 9%)   #foo .bar {
  .bar                         border-color: #3bbfce;
     border-color: $blue       padding: 10px;
                               margin: 10px;
     padding: $margin / 2    }
     margin: $margin / 2
But Sass isn’t a magic bullet
   (Because no framework is)

Assuming you already know CSS,
Sass can help you write CSS faster.

But using Sass doesn’t magically
create “better” CSS. If you write
bad code, Sass won’t remedy it.
The same principles
    apply to JavaScript

An important discipline when
using any framework is striving
to understand the underlying
language. In other words, use
it as a tool – Not a black box
Veteran “ninjas” master a variety of tools – Not just one.




                                                                 FRAMEWORK
         BY H
             AND




                          Use a framework as an extension
                          of yourself – Not just as a crutch.

                                                  http://imdb.com/title/tt1046173
A day to learn, A lifetime to master


“JavaScript is the only language
that I’m aware of that people
feel they don’t need to learn
before they start using it.”

— Douglas Crockford
http://www.youtube.com/watch?v=hQVTIJBZook
Today, I’ll discuss two examples...

jQuery Desktop                  Formalize.Me




 http://desktop.sonspring.com    http://formalize.me
jQuery Desktop
Fun with z-index
jQuery Desktop
Fun with z-index
Demystifying z-index




  http://sonspring.com/journal/jquery-desktop
Demystifying z-index

The default z-index value is 0, and it
only takes effect if an element is
position: fixed, relative, or absolute.
The default is position: static.

You don’t have to go overboard with
z-index: 99999. Just +1 higher than
another element will suffice.
CDN & Local Fallback
                       => Best of both worlds

<body>
...
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
<script>
  if (!window.jQuery) {
    document.write(unescape('%3Cscript src="assets/javascripts/jquery.js"%3E%3C/script%3E'));
    document.write(unescape('%3Cscript src="assets/javascripts/jquery.ui.js"%3E%3C/script%3E'));
  }
</script>
<script src="assets/javascripts/jquery.desktop.js"></script>
...
</body>


                                    http://desktop.sonspring.com
Singleton Pattern = Object-oriented JS
        Nested JS objects versus dot-notation
        => Same result, but different approaches

                                var APP = {};
var APP = {
  foo: function() {
                                APP.foo = function() {
     // Do stuff.
                                   // Do stuff.
  },
                                };
  bar: function() {
     // Do more stuff.
                                APP.bar = function() {
  }
                                   // Do more stuff.
}
                                };



I prefer the one on the left, but you would call methods by
using the same syntax either way: APP.foo() + APP.bar()
// Module pattern.

                                                        Module Pattern
var APP = (function($, window, document, undefined) {
  // For use only inside APP.
  var PRIVATE_CONSTANT_1 = 'foo';

                                                        << init example
  var PRIVATE_CONSTANT_2 = 'bar';

  // Expose contents of APP.
  return {
     go: function() {
        for (var i in APP.init) {
           APP.init[i]();
                                                        Using a module pattern exposes
        }
     },                                                 only one global variable, in this
     // APP.init
     init: {                                            case “APP” – with the rest of
        call_automatically: function() {
           // Called when DOM is ready.                 your methods within an object.
           // Can still be called individually, via:
           // APP.init.call_automatically();
        },
        // etc.
     },                                                 It gives you the ability to use
     // APP.misc
     misc: {                                            private “constant” variables
        call_specifically: function() {
           // Must be called individually, via:
           // APP.misc.call_specifically();
                                                        inside your appʼs function scope.
        },
        // etc.
     }
  };                                                    Nesting functions within an “init”
// Alias window, document.
})(jQuery, this, this.document);                        object allows them to be called
// Automatically run all functions in APP.init
jQuery(document).ready(function() {                     automatically on DOM ready.
  APP.go();
});
.live() is Awesome. Use it. Love it.
$('div.window').live('mousedown', function() {
  // Bring window to front.
  JQD.util.window_flat();
  $(this).addClass('window_stack');
}).live('mouseenter', function() {
  $(this).die('mouseenter').draggable({
    // Confine to desktop.
    // Movable via top bar only.
    cancel: 'a',
    containment: 'parent',
    handle: 'div.window_top'
  }).resizable({
    containment: 'parent',
    minWidth: 400,
    minHeight: 200
  });

  // etc.
});
Live (pun intended) example of .live()

http://desktop.sonspring.com/ajax_load.html

All the event wire-ups are ready, before
the page even has any content. Once
the content is loaded remotely via Ajax,
the elements respond to their respective
predefined .live() event listeners.
Basic structure of jQuery Desktop
var JQD = (function($, window, document, undefined) {
  return {
    go: function() {
       for (var i in JQD.init) {
         JQD.init[i]();
       }
    },
    init: {
       frame_breaker: function() {/* ... */},
       clock: function()         {/* ... */},
       desktop: function()       {/* ... */},
       wallpaper: function()     {/* ... */}
    },
    util: {
       clear_active: function() {/* ... */},
       window_flat: function()   {/* ... */},
       window_resize: function() {/* ... */}
    }
})(jQuery, this, this.document);
Event listeners at the document level


// Cancel mousedown, right-click.
$(document).mousedown(function(ev) {
  var tags = ['a', 'button', 'input', 'select', 'textarea'];

  if (!$(ev.target).closest(tags).length) {
    JQD.util.clear_active();
    ev.preventDefault();
    ev.stopPropagation();
  }
}).bind('contextmenu', function() {
  return false;
});
External links open in a new window

      // Relative or remote links?
      $('a').live('click', function(ev) {
        var url = $(this).attr('href');
        this.blur();

        if (url.match(/^#/)) {
          ev.preventDefault();
          ev.stopPropagation();
        }
        else {
          $(this).attr('target', '_blank');
        }
      });
Top level drop-down menus
// Make top menus active.
$('a.menu_trigger').live('mousedown', function() {
  if ($(this).next('ul.menu').is(':hidden')) {
    JQD.util.clear_active();
    $(this).addClass('active').next('ul.menu').show();
  }
  else {
    JQD.util.clear_active();
  }
}).live('mouseenter', function() {
  // Transfer focus, if already open.
  if ($('ul.menu').is(':visible')) {
    JQD.util.clear_active();
    $(this).addClass('active').next('ul.menu').show();
  }
});
Making desktop icons interactive
     // Desktop icons.
     $('a.icon').live('mousedown', function() {
       // Highlight the icon.
       JQD.util.clear_active();
       $(this).addClass('active');
     }).live('dblclick', function() {
       // Get the link's target.
       var x = $(this).attr('href');
       var y = $(x).find('a').attr('href');

       // Show the taskbar button.
       if ($(x).is(':hidden')) {
         $(x).remove().appendTo('#dock');
         $(x).show('fast');
       }

       // Bring window to front.
       JQD.util.window_flat();
       $(y).addClass('window_stack').show();
     }).live('mouseenter', function() {
       $(this).die('mouseenter').draggable({
         revert: true,
         containment: 'parent'
       });
     });
Taskbar / Dock buttons

// Taskbar buttons.
$('#dock a').live('click', function() {
  // Get the link's target.
  var x = $($(this).attr('href'));

  // Hide, if visible.
  if (x.is(':visible')) {
    x.hide();
  }
  else {
    // Bring window to front.
    JQD.util.window_flat();
    x.show().addClass('window_stack');
  }
});
Manipulating the “windows”

// Minimize the window.
$('a.window_min').live('click', function() {
  $(this).closest('div.window').hide();
});

// Maximize or restore the window.
$('a.window_resize').live('click', function() {
  JQD.util.window_resize(this);
});

// Close the window.
$('a.window_close').live('click', function() {
  $(this).closest('div.window').hide();
  $($(this).attr('href')).hide('fast');
});
Clicking the Show Desktop button

// Show desktop button, ala Windows OS.
$('#show_desktop').live('click', function() {
  // If any windows are visible, hide all.
  if ($('div.window:visible').length) {
    $('div.window').hide();
  }
  else {
    // Otherwise, reveal hidden windows that are open.
    $('#dock li:visible a').each(function() {
      $($(this).attr('href')).show();
    });
  }
});
To prevent developers from
wasting countless hours on
styling dumb form elements
It’s been awhile in the making...

“Future plans include a tutorial on how
to use jQuery to add styling hooks to
form elements, since I know from
experience that is no cup of tea.”

— Source = Me when announcing 960.gs in 2008!
— Excuse = New HTML5 elements set me back :)
WebKit’s form styling secret sauce


select {
  -webkit-appearance: none;
}

This gives you back a bit of control
for things like <select> drop-downs.
document.write(ad) with position:absolute
document.write(ad) with position:absolute
document.write(ad) with position:absolute




<script>
  document.write(unescape('%3Cscr' + 'ipt src="http://adn.fusionads.net/...' + M
</script>
<span id="fusion_link">
  <a href="http://fusionads.net/">Ads by Fusion</a>
</span>
...
</body>
Base64 encode background images

header[role="banner"] h1 {
  background-repeat: no-repeat;
  background-position: center 20px;
  background-image: url(../images/logo.png);
  background-image: url(data:imagepng;base64,
    iVBORw0KGgoAAA...);
  color: transparent;
  font-size: 0;
  overflow: hidden;
  text-indent: -99999px;
  height: 130px;
}

      http://formalize.me   http://www.motobit.com/util/base64-decoder-encoder.asp
Pre-load JavaScript files
<body>
...


<!-- Pre-load JavaScript libraries -->
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5.0/dojo/dojo.xd.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools-yui-compressed.js"
<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script>
<script src="http://yui.yahooapis.com/3.3.0/build/simpleyui/simpleyui-min.js"></script>
<!-- Pre-load Formalize files -->
<script src="assets/javascripts/dojo.formalize.js"></script>
<script src="assets/javascripts/extjs.formalize.js"></script>
<script src="assets/javascripts/jquery.formalize.js"></script>
<script src="assets/javascripts/mootools.formalize.js"></script>
<script src="assets/javascripts/prototype.formalize.js"></script>
<script src="assets/javascripts/yui.formalize.js"></script>
</body>


http://formalize.me/demo.html
Pre-load JavaScript files
<body>
...


<!-- Pre-load JavaScript libraries -->
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5.0/dojo/dojo.xd.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools-yui-compressed.js"
<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script>
<script src="http://yui.yahooapis.com/3.3.0/build/simpleyui/simpleyui-min.js"></script>
<!-- Pre-load Formalize files -->
<script src="assets/javascripts/dojo.formalize.js"></script>
<script src="assets/javascripts/extjs.formalize.js"></script>
<script src="assets/javascripts/jquery.formalize.js"></script>
<script src="assets/javascripts/mootools.formalize.js"></script>
<script src="assets/javascripts/prototype.formalize.js"></script>
<script src="assets/javascripts/yui.formalize.js"></script>
</body>


http://formalize.me/demo.html
IE detection for Prototype.js
     Prevents false positives since Opera can be made to impersonate IE.
     Note: I did this because Prototype doesn’t detect IE version number.



var IE6 = IE(6);
var IE7 = IE(7);

// Internet Explorer detection.
function IE(version) {
  var b = document.createElement('b');
  b.innerHTML = '<!--[if IE ' + version + ']><br><![endif]-->';
  return !!b.getElementsByTagName('br').length;
}


                 http://formalize.me/assets/javascripts/prototype.formalize.js
James Padolsey's IE detection (whoa!)

var ie = (function() {
  var undef,
    v = 3,
    div = document.createElement('div'),
    all = div.getElementsByTagName('i');

  while (
     div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
     all[0]
  );

  return v > 4 ? v : undef;
}());


                          https://gist.github.com/527683
Line number counts in Formalize JS

   Dojo = 174 lines      ExtJS = 168 lines



  jQuery = 158 lines    MooTools = 163 lines



Prototype = 171 lines      YUI = 168 lines



   “Write Less, Do More” FTW! :)
Basic structure of Formalize JS
var FORMALIZE = (function($, window, document, undefined) {
  // Private constants.
!   var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
!   var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
!   var WEBKIT = 'webkitAppearance' in document.createElement('select').style;
!   var IE6 = !!($.browser.msie && parseInt($.browser.version, 10) === 6);
!   var IE7 = !!($.browser.msie && parseInt($.browser.version, 10) === 7);

  // Expose innards of FORMALIZE.
  return {
     go: function() {/* ... */},
     init: {
        detect_webkit: function() {/* ... */},
        full_input_size: function() {/* ... */},
        ie6_skin_inputs: function() {/* ... */},
        autofocus: function() {/* ... */},
        placeholder: function() {/* ... */}
     },
     misc: {
        add_placeholder: function() {/* ... */}
     }
  };
})(jQuery, this, this.document);
Detecting WebKit


// FORMALIZE.init.detect_webkit
detect_webkit: function() {
! if (!WEBKIT) {
! ! return;
! }

! // Tweaks for Safari + Chrome.
! $('html').addClass('is_webkit');
},

...
Basic structure of Formalize JS

// FORMALIZE.init.full_input_size
full_input_size: function() {
! if (!IE7 || !$('textarea, input.input_full').length) {
! ! return;
! }

!     // This fixes width: 100% on <textarea> and class="input_full".
!     // It ensures that form elements don't go wider than container.
!     $('textarea, input.input_full')
        .wrap('<span class="input_full_wrap"></span>');
},

...
Adding styling
// FORMALIZE.init.ie6_skin_inputs
ie6_skin_inputs: function() {
  // Test for Internet Explorer 6.
  if (!IE6 || !$('input, select, textarea').length) {
    // Exit if the browser is not IE6,
    // or if no form elements exist.
    return;
                                                                               hooks for IE6
  }

     // For <input type="submit" />, etc.
     var button_regex = /button|submit|reset/;

     // For <input type="text" />, etc.
     var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;

     $('input').each(function() {
       var el = $(this);

       // Is it a button?
       if (this.getAttribute('type').match(button_regex)) {
         el.addClass('ie6_button');

           /* Is it disabled? */
           if (this.disabled) {
             el.addClass('ie6_button_disabled');
           }
       }
       // Or is it a textual input?
       else if (this.getAttribute('type').match(type_regex)) {
         el.addClass('ie6_input');

           /* Is it disabled? */
           if (this.disabled) {
             el.addClass('ie6_input_disabled');
           }
       }
     });

     $('textarea, select').each(function() {
       /* Is it disabled? */
       if (this.disabled) {
         $(this).addClass('ie6_input_disabled');
       }
     });
},
Adding HTML5 autofocus support


// FORMALIZE.init.autofocus
autofocus: function() {
! if (AUTOFOCUS_SUPPORTED || !$(':input[autofocus]').length) {
! ! return;
! }

! $(':input[autofocus]:visible:first').focus();
},

...
Adding HTML5 placeholder support
  // FORMALIZE.init.placeholder
  placeholder: function() {
  !    if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
  !    !    // Exit if placeholder is supported natively,
  !    !    // or if page does not have any placeholder.
  !    !    return;
  !    }

  !    FORMALIZE.misc.add_placeholder();

  !    $(':input[placeholder]').each(function() {
  !    !    var el = $(this);
  !    !    var text = el.attr('placeholder');

  !    !     el.focus(function() {
  !    !     !    if (el.val() === text) {
  !    !     !    !    el.val('').removeClass('placeholder_text');
  !    !     !    }
  !    !     }).blur(function() {
  !    !     !    FORMALIZE.misc.add_placeholder();
  !    !     });

  !    !     // Prevent <form> from accidentally
  !    !     // submitting the placeholder text.
  !    !     el.closest('form').submit(function() {
  !    !     !    if (el.val() === text) {
  !    !     !    !    el.val('').removeClass('placeholder_text');
  !    !     !    }
  !    !     }).bind('reset', function() {
  !    !     !    setTimeout(FORMALIZE.misc.add_placeholder, 50);
  !    !     });
  !    });
  }
Moved outside of init, for easier reuse

    // FORMALIZE.misc
    misc: {
    !    // FORMALIZE.misc.add_placeholder
    !    add_placeholder: function() {
    !    !    if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length)
    {
    !    !    !    // Exit if placeholder is supported natively,
    !    !    !    // or if page does not have any placeholder.
    !    !    !    return;
    !    !    }

    !    !    $(':input[placeholder]').each(function() {
    !    !    !    var el = $(this);
    !    !    !    var text = el.attr('placeholder');

    !    !    !     if (!el.val() || el.val() === text) {
    !    !    !     !    el.val(text).addClass('placeholder_text');
    !    !    !     }
    !    !    });
    !    }
    }
http://jeromeetienne.github.com/jquery-mobile-960
Additional Resources
jQuery Companion Libraries
jQuery UI – http://jqueryui.com
jQuery Mobile – http://jquerymobile.com
Amplify – http://amplifyjs.com
Underscore – http://documentcloud.github.com/underscore
Backbone – http://documentcloud.github.com/backbone


JS Testing
Jasmine – http://pivotal.github.com/jasmine
QUnit – http://docs.jquery.com/Qunit


If you want write Ruby-esque code that compiles to JS...
CoffeeScript – http://jashkenas.github.com/coffee-script
Recommended Books

Learning jQuery – https://www.packtpub.com/learning-jquery-1.3
jQuery Enlightenment – http://jqueryenlightenment.com
DOM Scripting – http://domscripting.com
JavaScript: The Good Parts – http://oreilly.com/catalog/9780596517748
JavaScript: The Definitive Guide – http://oreilly.com/catalog/9780596101992
High Performance JavaScript – http://oreilly.com/catalog/9780596802806
Pro JavaScript Design Patterns – http://jsdesignpatterns.com
Object-Oriented JavaScript – https://www.packtpub.com/object-oriented-javascript/book
The Art and Science of JavaScript – http://www.sitepoint.com/books/jsdesign1
Test-Driven JavaScript Development – http://tddjs.com
For questions – Or just to say hi :)



 Contact – http://sonspring.com/contact
 Twitter – http://twitter.com/nathansmith


http://www.slideshare.net/nathansmith/drupalcon-jquery
What did you think?

Locate this session on the DCC website:
http://chicago2011.drupal.org/sessions

Click the “Take the Survey” link.


Thanks!

Weitere ähnliche Inhalte

Was ist angesagt?

How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony AppsKris Wallsmith
 
Avinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPressAvinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPresswpnepal
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsJarod Ferguson
 
jQuery Performance Tips and Tricks (2011)
jQuery Performance Tips and Tricks (2011)jQuery Performance Tips and Tricks (2011)
jQuery Performance Tips and Tricks (2011)Addy Osmani
 
Beyond DOMReady: Ultra High-Performance Javascript
Beyond DOMReady: Ultra High-Performance JavascriptBeyond DOMReady: Ultra High-Performance Javascript
Beyond DOMReady: Ultra High-Performance Javascriptaglemann
 
jQuery Plugin Creation
jQuery Plugin CreationjQuery Plugin Creation
jQuery Plugin Creationbenalman
 
Plugin jQuery, Design Patterns
Plugin jQuery, Design PatternsPlugin jQuery, Design Patterns
Plugin jQuery, Design PatternsRobert Casanova
 
WordPress Third Party Authentication
WordPress Third Party AuthenticationWordPress Third Party Authentication
WordPress Third Party AuthenticationAaron Brazell
 
An Event Apart Boston: Principles of Unobtrusive JavaScript
An Event Apart Boston: Principles of Unobtrusive JavaScriptAn Event Apart Boston: Principles of Unobtrusive JavaScript
An Event Apart Boston: Principles of Unobtrusive JavaScriptPeter-Paul Koch
 
Angular JS blog tutorial
Angular JS blog tutorialAngular JS blog tutorial
Angular JS blog tutorialClaude Tech
 
H3 경쟁력있는 웹앱 개발을 위한 모바일 js 프레임웍
H3 경쟁력있는 웹앱 개발을 위한 모바일 js 프레임웍H3 경쟁력있는 웹앱 개발을 위한 모바일 js 프레임웍
H3 경쟁력있는 웹앱 개발을 위한 모바일 js 프레임웍민태 김
 
Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)Jeff Eaton
 
iPhone Appleless Apps
iPhone Appleless AppsiPhone Appleless Apps
iPhone Appleless AppsRemy Sharp
 
Javascript MVC & Backbone Tips & Tricks
Javascript MVC & Backbone Tips & TricksJavascript MVC & Backbone Tips & Tricks
Javascript MVC & Backbone Tips & TricksHjörtur Hilmarsson
 
Turn your spaghetti code into ravioli with JavaScript modules
Turn your spaghetti code into ravioli with JavaScript modulesTurn your spaghetti code into ravioli with JavaScript modules
Turn your spaghetti code into ravioli with JavaScript modulesjerryorr
 
Getting touchy - an introduction to touch events / Web Standards Days / Mosco...
Getting touchy - an introduction to touch events / Web Standards Days / Mosco...Getting touchy - an introduction to touch events / Web Standards Days / Mosco...
Getting touchy - an introduction to touch events / Web Standards Days / Mosco...Patrick Lauke
 
An intro to Backbone.js
An intro to Backbone.jsAn intro to Backbone.js
An intro to Backbone.jstonydewan
 
Survey of Front End Topics in Rails
Survey of Front End Topics in RailsSurvey of Front End Topics in Rails
Survey of Front End Topics in RailsBenjamin Vandgrift
 
Maintainable JavaScript 2012
Maintainable JavaScript 2012Maintainable JavaScript 2012
Maintainable JavaScript 2012Nicholas Zakas
 
Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Chris Alfano
 

Was ist angesagt? (20)

How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
Avinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPressAvinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPress
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.js
 
jQuery Performance Tips and Tricks (2011)
jQuery Performance Tips and Tricks (2011)jQuery Performance Tips and Tricks (2011)
jQuery Performance Tips and Tricks (2011)
 
Beyond DOMReady: Ultra High-Performance Javascript
Beyond DOMReady: Ultra High-Performance JavascriptBeyond DOMReady: Ultra High-Performance Javascript
Beyond DOMReady: Ultra High-Performance Javascript
 
jQuery Plugin Creation
jQuery Plugin CreationjQuery Plugin Creation
jQuery Plugin Creation
 
Plugin jQuery, Design Patterns
Plugin jQuery, Design PatternsPlugin jQuery, Design Patterns
Plugin jQuery, Design Patterns
 
WordPress Third Party Authentication
WordPress Third Party AuthenticationWordPress Third Party Authentication
WordPress Third Party Authentication
 
An Event Apart Boston: Principles of Unobtrusive JavaScript
An Event Apart Boston: Principles of Unobtrusive JavaScriptAn Event Apart Boston: Principles of Unobtrusive JavaScript
An Event Apart Boston: Principles of Unobtrusive JavaScript
 
Angular JS blog tutorial
Angular JS blog tutorialAngular JS blog tutorial
Angular JS blog tutorial
 
H3 경쟁력있는 웹앱 개발을 위한 모바일 js 프레임웍
H3 경쟁력있는 웹앱 개발을 위한 모바일 js 프레임웍H3 경쟁력있는 웹앱 개발을 위한 모바일 js 프레임웍
H3 경쟁력있는 웹앱 개발을 위한 모바일 js 프레임웍
 
Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)
 
iPhone Appleless Apps
iPhone Appleless AppsiPhone Appleless Apps
iPhone Appleless Apps
 
Javascript MVC & Backbone Tips & Tricks
Javascript MVC & Backbone Tips & TricksJavascript MVC & Backbone Tips & Tricks
Javascript MVC & Backbone Tips & Tricks
 
Turn your spaghetti code into ravioli with JavaScript modules
Turn your spaghetti code into ravioli with JavaScript modulesTurn your spaghetti code into ravioli with JavaScript modules
Turn your spaghetti code into ravioli with JavaScript modules
 
Getting touchy - an introduction to touch events / Web Standards Days / Mosco...
Getting touchy - an introduction to touch events / Web Standards Days / Mosco...Getting touchy - an introduction to touch events / Web Standards Days / Mosco...
Getting touchy - an introduction to touch events / Web Standards Days / Mosco...
 
An intro to Backbone.js
An intro to Backbone.jsAn intro to Backbone.js
An intro to Backbone.js
 
Survey of Front End Topics in Rails
Survey of Front End Topics in RailsSurvey of Front End Topics in Rails
Survey of Front End Topics in Rails
 
Maintainable JavaScript 2012
Maintainable JavaScript 2012Maintainable JavaScript 2012
Maintainable JavaScript 2012
 
Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011
 

Andere mochten auch

Invitation Autumn
Invitation AutumnInvitation Autumn
Invitation Autumnguestbf0dbb
 
VietnamRealEstate_E-Directory_VN_Q3_2008
VietnamRealEstate_E-Directory_VN_Q3_2008VietnamRealEstate_E-Directory_VN_Q3_2008
VietnamRealEstate_E-Directory_VN_Q3_2008internationalvr
 
6. Social 2.0 Mi Ming Mart And Web 2.0 Erica Yuen
6. Social 2.0   Mi Ming Mart And Web 2.0   Erica Yuen6. Social 2.0   Mi Ming Mart And Web 2.0   Erica Yuen
6. Social 2.0 Mi Ming Mart And Web 2.0 Erica YuenHKAIM
 
10. Social 2.0 Everything 2.0 Charles Mok
10. Social 2.0   Everything 2.0   Charles Mok10. Social 2.0   Everything 2.0   Charles Mok
10. Social 2.0 Everything 2.0 Charles MokHKAIM
 
Draft of Memory of the World Thailand Communication and Advocacy Plan
Draft of Memory of the World Thailand Communication and Advocacy PlanDraft of Memory of the World Thailand Communication and Advocacy Plan
Draft of Memory of the World Thailand Communication and Advocacy PlanRachabodin Suwannakanthi
 
Mapas Finales Wakoo
Mapas Finales WakooMapas Finales Wakoo
Mapas Finales WakooBloom
 
Rapid Templating with Serve
Rapid Templating with ServeRapid Templating with Serve
Rapid Templating with ServeNathan Smith
 
Quintada Regaliera
Quintada RegalieraQuintada Regaliera
Quintada Regalierarauluis
 
Etec 442 Timeline Kanesa4
Etec 442 Timeline Kanesa4Etec 442 Timeline Kanesa4
Etec 442 Timeline Kanesa4kanesa
 
Opening - Green IT
Opening - Green ITOpening - Green IT
Opening - Green ITHKAIM
 
eCMO 2010 The anatomy of social media marketing revisited
eCMO 2010 The anatomy of social media marketing revisitedeCMO 2010 The anatomy of social media marketing revisited
eCMO 2010 The anatomy of social media marketing revisitedHKAIM
 
VietRees_Newsletter_38_Week1_Month07_Year08
VietRees_Newsletter_38_Week1_Month07_Year08VietRees_Newsletter_38_Week1_Month07_Year08
VietRees_Newsletter_38_Week1_Month07_Year08internationalvr
 
Erlang抽象数据结构简介
Erlang抽象数据结构简介Erlang抽象数据结构简介
Erlang抽象数据结构简介Xiaozhe Wang
 
VietRees_Newsletter_45_Tuan4_Thang08
VietRees_Newsletter_45_Tuan4_Thang08VietRees_Newsletter_45_Tuan4_Thang08
VietRees_Newsletter_45_Tuan4_Thang08internationalvr
 
Vietnam Real Estate Newsletter - No. 68, Week 1 Feb, 2009
Vietnam Real Estate Newsletter - No. 68, Week 1 Feb, 2009Vietnam Real Estate Newsletter - No. 68, Week 1 Feb, 2009
Vietnam Real Estate Newsletter - No. 68, Week 1 Feb, 2009internationalvr
 
VietRees_Newsletter_34_Tuan1_Thang06
VietRees_Newsletter_34_Tuan1_Thang06VietRees_Newsletter_34_Tuan1_Thang06
VietRees_Newsletter_34_Tuan1_Thang06internationalvr
 
C:\fakepath\psychological disorders
C:\fakepath\psychological disordersC:\fakepath\psychological disorders
C:\fakepath\psychological disordersSteve Kashdan
 

Andere mochten auch (20)

Invitation Autumn
Invitation AutumnInvitation Autumn
Invitation Autumn
 
VietnamRealEstate_E-Directory_VN_Q3_2008
VietnamRealEstate_E-Directory_VN_Q3_2008VietnamRealEstate_E-Directory_VN_Q3_2008
VietnamRealEstate_E-Directory_VN_Q3_2008
 
6. Social 2.0 Mi Ming Mart And Web 2.0 Erica Yuen
6. Social 2.0   Mi Ming Mart And Web 2.0   Erica Yuen6. Social 2.0   Mi Ming Mart And Web 2.0   Erica Yuen
6. Social 2.0 Mi Ming Mart And Web 2.0 Erica Yuen
 
10. Social 2.0 Everything 2.0 Charles Mok
10. Social 2.0   Everything 2.0   Charles Mok10. Social 2.0   Everything 2.0   Charles Mok
10. Social 2.0 Everything 2.0 Charles Mok
 
Draft of Memory of the World Thailand Communication and Advocacy Plan
Draft of Memory of the World Thailand Communication and Advocacy PlanDraft of Memory of the World Thailand Communication and Advocacy Plan
Draft of Memory of the World Thailand Communication and Advocacy Plan
 
Mapas Finales Wakoo
Mapas Finales WakooMapas Finales Wakoo
Mapas Finales Wakoo
 
surface computing (microsoft)
surface computing (microsoft)surface computing (microsoft)
surface computing (microsoft)
 
Rapid Templating with Serve
Rapid Templating with ServeRapid Templating with Serve
Rapid Templating with Serve
 
Quintada Regaliera
Quintada RegalieraQuintada Regaliera
Quintada Regaliera
 
Etec 442 Timeline Kanesa4
Etec 442 Timeline Kanesa4Etec 442 Timeline Kanesa4
Etec 442 Timeline Kanesa4
 
Opening - Green IT
Opening - Green ITOpening - Green IT
Opening - Green IT
 
eCMO 2010 The anatomy of social media marketing revisited
eCMO 2010 The anatomy of social media marketing revisitedeCMO 2010 The anatomy of social media marketing revisited
eCMO 2010 The anatomy of social media marketing revisited
 
Je Xml
Je XmlJe Xml
Je Xml
 
VietRees_Newsletter_38_Week1_Month07_Year08
VietRees_Newsletter_38_Week1_Month07_Year08VietRees_Newsletter_38_Week1_Month07_Year08
VietRees_Newsletter_38_Week1_Month07_Year08
 
Erlang抽象数据结构简介
Erlang抽象数据结构简介Erlang抽象数据结构简介
Erlang抽象数据结构简介
 
VietRees_Newsletter_45_Tuan4_Thang08
VietRees_Newsletter_45_Tuan4_Thang08VietRees_Newsletter_45_Tuan4_Thang08
VietRees_Newsletter_45_Tuan4_Thang08
 
Pervasive Computing
Pervasive ComputingPervasive Computing
Pervasive Computing
 
Vietnam Real Estate Newsletter - No. 68, Week 1 Feb, 2009
Vietnam Real Estate Newsletter - No. 68, Week 1 Feb, 2009Vietnam Real Estate Newsletter - No. 68, Week 1 Feb, 2009
Vietnam Real Estate Newsletter - No. 68, Week 1 Feb, 2009
 
VietRees_Newsletter_34_Tuan1_Thang06
VietRees_Newsletter_34_Tuan1_Thang06VietRees_Newsletter_34_Tuan1_Thang06
VietRees_Newsletter_34_Tuan1_Thang06
 
C:\fakepath\psychological disorders
C:\fakepath\psychological disordersC:\fakepath\psychological disorders
C:\fakepath\psychological disorders
 

Ähnlich wie DrupalCon jQuery

BlackBerry DevCon 2011 - PhoneGap and WebWorks
BlackBerry DevCon 2011 - PhoneGap and WebWorksBlackBerry DevCon 2011 - PhoneGap and WebWorks
BlackBerry DevCon 2011 - PhoneGap and WebWorksmwbrooks
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScriptAndrew Dupont
 
Building Large jQuery Applications
Building Large jQuery ApplicationsBuilding Large jQuery Applications
Building Large jQuery ApplicationsRebecca Murphey
 
Writing JavaScript that doesn't suck
Writing JavaScript that doesn't suckWriting JavaScript that doesn't suck
Writing JavaScript that doesn't suckRoss Bruniges
 
Javascript is your (Auto)mate
Javascript is your (Auto)mateJavascript is your (Auto)mate
Javascript is your (Auto)mateCodemotion
 
Reliable Javascript
Reliable Javascript Reliable Javascript
Reliable Javascript Glenn Stovall
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)arcware
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesSiarhei Barysiuk
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyDavid Padbury
 
CodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложения
CodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложенияCodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложения
CodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложенияCodeFest
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for JoomlaLuke Summerfield
 
Build Web Apps using Node.js
Build Web Apps using Node.jsBuild Web Apps using Node.js
Build Web Apps using Node.jsdavidchubbs
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVCAlive Kuo
 

Ähnlich wie DrupalCon jQuery (20)

BlackBerry DevCon 2011 - PhoneGap and WebWorks
BlackBerry DevCon 2011 - PhoneGap and WebWorksBlackBerry DevCon 2011 - PhoneGap and WebWorks
BlackBerry DevCon 2011 - PhoneGap and WebWorks
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScript
 
jQuery Best Practice
jQuery Best Practice jQuery Best Practice
jQuery Best Practice
 
Building Large jQuery Applications
Building Large jQuery ApplicationsBuilding Large jQuery Applications
Building Large jQuery Applications
 
Writing JavaScript that doesn't suck
Writing JavaScript that doesn't suckWriting JavaScript that doesn't suck
Writing JavaScript that doesn't suck
 
Javascript is your (Auto)mate
Javascript is your (Auto)mateJavascript is your (Auto)mate
Javascript is your (Auto)mate
 
Reliable Javascript
Reliable Javascript Reliable Javascript
Reliable Javascript
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best Practices
 
JavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talkJavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talk
 
Frontin like-a-backer
Frontin like-a-backerFrontin like-a-backer
Frontin like-a-backer
 
"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
 
CodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложения
CodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложенияCodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложения
CodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложения
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
 
Build Web Apps using Node.js
Build Web Apps using Node.jsBuild Web Apps using Node.js
Build Web Apps using Node.js
 
Unittests für Dummies
Unittests für DummiesUnittests für Dummies
Unittests für Dummies
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
 

Mehr von Nathan Smith

Getting Started with React
Getting Started with ReactGetting Started with React
Getting Started with ReactNathan Smith
 
HTML5 Can't Do That
HTML5 Can't Do ThatHTML5 Can't Do That
HTML5 Can't Do ThatNathan Smith
 
Proactive Responsive Design
Proactive Responsive DesignProactive Responsive Design
Proactive Responsive DesignNathan Smith
 
Use Web Skills To Build Mobile Apps
Use Web Skills To Build Mobile AppsUse Web Skills To Build Mobile Apps
Use Web Skills To Build Mobile AppsNathan Smith
 
Adobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + FireworksAdobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + FireworksNathan Smith
 
Accelerated Grid Theming
Accelerated Grid ThemingAccelerated Grid Theming
Accelerated Grid ThemingNathan Smith
 
Urban Leadership Slides
Urban Leadership SlidesUrban Leadership Slides
Urban Leadership SlidesNathan Smith
 
Themes from Ascent of a Leader
Themes from Ascent of a LeaderThemes from Ascent of a Leader
Themes from Ascent of a LeaderNathan Smith
 
Marketing 450 Guest Lecture
Marketing 450 Guest LectureMarketing 450 Guest Lecture
Marketing 450 Guest LectureNathan Smith
 
Fundamental Design Principles
Fundamental Design PrinciplesFundamental Design Principles
Fundamental Design PrinciplesNathan Smith
 
Striking a Balance: Middle Ground in Front-End Development
Striking a Balance: Middle Ground in Front-End DevelopmentStriking a Balance: Middle Ground in Front-End Development
Striking a Balance: Middle Ground in Front-End DevelopmentNathan Smith
 
Echo Conference 2008
Echo Conference 2008Echo Conference 2008
Echo Conference 2008Nathan Smith
 

Mehr von Nathan Smith (20)

Getting Started with React
Getting Started with ReactGetting Started with React
Getting Started with React
 
HTML5 Can't Do That
HTML5 Can't Do ThatHTML5 Can't Do That
HTML5 Can't Do That
 
Proactive Responsive Design
Proactive Responsive DesignProactive Responsive Design
Proactive Responsive Design
 
Use Web Skills To Build Mobile Apps
Use Web Skills To Build Mobile AppsUse Web Skills To Build Mobile Apps
Use Web Skills To Build Mobile Apps
 
Red Dirt JS
Red Dirt JSRed Dirt JS
Red Dirt JS
 
Refresh OKC
Refresh OKCRefresh OKC
Refresh OKC
 
DSVC Design Talk
DSVC Design TalkDSVC Design Talk
DSVC Design Talk
 
Think Vitamin CSS
Think Vitamin CSSThink Vitamin CSS
Think Vitamin CSS
 
Adobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + FireworksAdobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + Fireworks
 
Meet Clumsy
Meet ClumsyMeet Clumsy
Meet Clumsy
 
Echo HTML5
Echo HTML5Echo HTML5
Echo HTML5
 
Accelerated Grid Theming
Accelerated Grid ThemingAccelerated Grid Theming
Accelerated Grid Theming
 
Urban Leadership Slides
Urban Leadership SlidesUrban Leadership Slides
Urban Leadership Slides
 
Themes from Ascent of a Leader
Themes from Ascent of a LeaderThemes from Ascent of a Leader
Themes from Ascent of a Leader
 
7 Storey Mountain
7 Storey Mountain7 Storey Mountain
7 Storey Mountain
 
Marketing 450 Guest Lecture
Marketing 450 Guest LectureMarketing 450 Guest Lecture
Marketing 450 Guest Lecture
 
Fundamental Design Principles
Fundamental Design PrinciplesFundamental Design Principles
Fundamental Design Principles
 
Striking a Balance: Middle Ground in Front-End Development
Striking a Balance: Middle Ground in Front-End DevelopmentStriking a Balance: Middle Ground in Front-End Development
Striking a Balance: Middle Ground in Front-End Development
 
Echo Conference 2008
Echo Conference 2008Echo Conference 2008
Echo Conference 2008
 
Bible Tech 2008
Bible Tech 2008Bible Tech 2008
Bible Tech 2008
 

Kürzlich hochgeladen

办理澳大利亚国立大学毕业证ANU毕业证留信学历认证
办理澳大利亚国立大学毕业证ANU毕业证留信学历认证办理澳大利亚国立大学毕业证ANU毕业证留信学历认证
办理澳大利亚国立大学毕业证ANU毕业证留信学历认证jdkhjh
 
DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...
DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...
DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...Rishabh Aryan
 
Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Rndexperts
 
Pharmaceutical Packaging for the elderly.pdf
Pharmaceutical Packaging for the elderly.pdfPharmaceutical Packaging for the elderly.pdf
Pharmaceutical Packaging for the elderly.pdfAayushChavan5
 
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一Fi L
 
Chapter 6(1)system devolopment life .ppt
Chapter 6(1)system devolopment life .pptChapter 6(1)system devolopment life .ppt
Chapter 6(1)system devolopment life .pptDoaaRezk5
 
Create Web Pages by programming of your chice.pdf
Create Web Pages by programming of your chice.pdfCreate Web Pages by programming of your chice.pdf
Create Web Pages by programming of your chice.pdfworkingdev2003
 
MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...
MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...
MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...katerynaivanenko1
 
FiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfFiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfShivakumar Viswanathan
 
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一diploma 1
 
西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造kbdhl05e
 
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10uasjlagroup
 
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree 毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree ttt fff
 
General Knowledge Quiz Game C++ CODE.pptx
General Knowledge Quiz Game C++ CODE.pptxGeneral Knowledge Quiz Game C++ CODE.pptx
General Knowledge Quiz Game C++ CODE.pptxmarckustrevion
 
Design principles on typography in design
Design principles on typography in designDesign principles on typography in design
Design principles on typography in designnooreen17
 
Iconic Global Solution - web design, Digital Marketing services
Iconic Global Solution - web design, Digital Marketing servicesIconic Global Solution - web design, Digital Marketing services
Iconic Global Solution - web design, Digital Marketing servicesIconic global solution
 
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degreeyuu sss
 
Dubai Calls Girl Tapes O525547819 Real Tapes Escort Services Dubai
Dubai Calls Girl Tapes O525547819 Real Tapes Escort Services DubaiDubai Calls Girl Tapes O525547819 Real Tapes Escort Services Dubai
Dubai Calls Girl Tapes O525547819 Real Tapes Escort Services Dubaikojalkojal131
 
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一F dds
 
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一z xss
 

Kürzlich hochgeladen (20)

办理澳大利亚国立大学毕业证ANU毕业证留信学历认证
办理澳大利亚国立大学毕业证ANU毕业证留信学历认证办理澳大利亚国立大学毕业证ANU毕业证留信学历认证
办理澳大利亚国立大学毕业证ANU毕业证留信学历认证
 
DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...
DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...
DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...
 
Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025
 
Pharmaceutical Packaging for the elderly.pdf
Pharmaceutical Packaging for the elderly.pdfPharmaceutical Packaging for the elderly.pdf
Pharmaceutical Packaging for the elderly.pdf
 
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
 
Chapter 6(1)system devolopment life .ppt
Chapter 6(1)system devolopment life .pptChapter 6(1)system devolopment life .ppt
Chapter 6(1)system devolopment life .ppt
 
Create Web Pages by programming of your chice.pdf
Create Web Pages by programming of your chice.pdfCreate Web Pages by programming of your chice.pdf
Create Web Pages by programming of your chice.pdf
 
MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...
MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...
MT. Marseille an Archipelago. Strategies for Integrating Residential Communit...
 
FiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfFiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdf
 
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
 
西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造
 
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
 
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree 毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
General Knowledge Quiz Game C++ CODE.pptx
General Knowledge Quiz Game C++ CODE.pptxGeneral Knowledge Quiz Game C++ CODE.pptx
General Knowledge Quiz Game C++ CODE.pptx
 
Design principles on typography in design
Design principles on typography in designDesign principles on typography in design
Design principles on typography in design
 
Iconic Global Solution - web design, Digital Marketing services
Iconic Global Solution - web design, Digital Marketing servicesIconic Global Solution - web design, Digital Marketing services
Iconic Global Solution - web design, Digital Marketing services
 
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
 
Dubai Calls Girl Tapes O525547819 Real Tapes Escort Services Dubai
Dubai Calls Girl Tapes O525547819 Real Tapes Escort Services DubaiDubai Calls Girl Tapes O525547819 Real Tapes Escort Services Dubai
Dubai Calls Girl Tapes O525547819 Real Tapes Escort Services Dubai
 
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
 
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
 

DrupalCon jQuery

  • 1. CRAFTING APP INTERFACES WITH Presented by Nathan Smith
  • 2. Carpal Tunnel Relief Note: Don’t feel like you need to write all of this down. The slides are available here... http://www.slideshare.net/nathansmith/drupalcon-jquery
  • 3. “Allow myself to... introduce myself” I work (from home) for HP as a front-end developer. I’m best known for making a helpful 5.6 KB CSS file.
  • 4. Shh... My secret in-house code reviewer Note: This was shot hastily with a camera phone. I make no claims of being a decent photographer.
  • 5. FYI – I don’t especially love CSS The reason I create and use CSS frameworks is because I hate doing mundane tasks repeatedly (yawn). I’d rather be working in JavaScript.
  • 6. JavaScript books I’ve worked on... Co-author Tech editor Tech editor jQueryEnlightenment.com JavaScriptEnlightenment.com oreilly.com/catalog/9780596159788
  • 7. Our team at HP uses Sass to expedite writing CSS http://www.sass-lang.com
  • 8. Sass compiles down to CSS... $blue: #3bbfce #foo { $margin: 20px border-color: #3bbfce; color: #2b9eab; #foo } border-color: $blue color: darken($blue, 9%) #foo .bar { .bar border-color: #3bbfce; border-color: $blue padding: 10px; margin: 10px; padding: $margin / 2 } margin: $margin / 2
  • 9. But Sass isn’t a magic bullet (Because no framework is) Assuming you already know CSS, Sass can help you write CSS faster. But using Sass doesn’t magically create “better” CSS. If you write bad code, Sass won’t remedy it.
  • 10. The same principles apply to JavaScript An important discipline when using any framework is striving to understand the underlying language. In other words, use it as a tool – Not a black box
  • 11. Veteran “ninjas” master a variety of tools – Not just one. FRAMEWORK BY H AND Use a framework as an extension of yourself – Not just as a crutch. http://imdb.com/title/tt1046173
  • 12. A day to learn, A lifetime to master “JavaScript is the only language that I’m aware of that people feel they don’t need to learn before they start using it.” — Douglas Crockford http://www.youtube.com/watch?v=hQVTIJBZook
  • 13. Today, I’ll discuss two examples... jQuery Desktop Formalize.Me http://desktop.sonspring.com http://formalize.me
  • 16. Demystifying z-index http://sonspring.com/journal/jquery-desktop
  • 17. Demystifying z-index The default z-index value is 0, and it only takes effect if an element is position: fixed, relative, or absolute. The default is position: static. You don’t have to go overboard with z-index: 99999. Just +1 higher than another element will suffice.
  • 18. CDN & Local Fallback => Best of both worlds <body> ... <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script> <script> if (!window.jQuery) { document.write(unescape('%3Cscript src="assets/javascripts/jquery.js"%3E%3C/script%3E')); document.write(unescape('%3Cscript src="assets/javascripts/jquery.ui.js"%3E%3C/script%3E')); } </script> <script src="assets/javascripts/jquery.desktop.js"></script> ... </body> http://desktop.sonspring.com
  • 19. Singleton Pattern = Object-oriented JS Nested JS objects versus dot-notation => Same result, but different approaches var APP = {}; var APP = { foo: function() { APP.foo = function() { // Do stuff. // Do stuff. }, }; bar: function() { // Do more stuff. APP.bar = function() { } // Do more stuff. } }; I prefer the one on the left, but you would call methods by using the same syntax either way: APP.foo() + APP.bar()
  • 20. // Module pattern. Module Pattern var APP = (function($, window, document, undefined) { // For use only inside APP. var PRIVATE_CONSTANT_1 = 'foo'; << init example var PRIVATE_CONSTANT_2 = 'bar'; // Expose contents of APP. return { go: function() { for (var i in APP.init) { APP.init[i](); Using a module pattern exposes } }, only one global variable, in this // APP.init init: { case “APP” – with the rest of call_automatically: function() { // Called when DOM is ready. your methods within an object. // Can still be called individually, via: // APP.init.call_automatically(); }, // etc. }, It gives you the ability to use // APP.misc misc: { private “constant” variables call_specifically: function() { // Must be called individually, via: // APP.misc.call_specifically(); inside your appʼs function scope. }, // etc. } }; Nesting functions within an “init” // Alias window, document. })(jQuery, this, this.document); object allows them to be called // Automatically run all functions in APP.init jQuery(document).ready(function() { automatically on DOM ready. APP.go(); });
  • 21. .live() is Awesome. Use it. Love it. $('div.window').live('mousedown', function() { // Bring window to front. JQD.util.window_flat(); $(this).addClass('window_stack'); }).live('mouseenter', function() { $(this).die('mouseenter').draggable({ // Confine to desktop. // Movable via top bar only. cancel: 'a', containment: 'parent', handle: 'div.window_top' }).resizable({ containment: 'parent', minWidth: 400, minHeight: 200 }); // etc. });
  • 22. Live (pun intended) example of .live() http://desktop.sonspring.com/ajax_load.html All the event wire-ups are ready, before the page even has any content. Once the content is loaded remotely via Ajax, the elements respond to their respective predefined .live() event listeners.
  • 23. Basic structure of jQuery Desktop var JQD = (function($, window, document, undefined) { return { go: function() { for (var i in JQD.init) { JQD.init[i](); } }, init: { frame_breaker: function() {/* ... */}, clock: function() {/* ... */}, desktop: function() {/* ... */}, wallpaper: function() {/* ... */} }, util: { clear_active: function() {/* ... */}, window_flat: function() {/* ... */}, window_resize: function() {/* ... */} } })(jQuery, this, this.document);
  • 24. Event listeners at the document level // Cancel mousedown, right-click. $(document).mousedown(function(ev) { var tags = ['a', 'button', 'input', 'select', 'textarea']; if (!$(ev.target).closest(tags).length) { JQD.util.clear_active(); ev.preventDefault(); ev.stopPropagation(); } }).bind('contextmenu', function() { return false; });
  • 25. External links open in a new window // Relative or remote links? $('a').live('click', function(ev) { var url = $(this).attr('href'); this.blur(); if (url.match(/^#/)) { ev.preventDefault(); ev.stopPropagation(); } else { $(this).attr('target', '_blank'); } });
  • 26. Top level drop-down menus // Make top menus active. $('a.menu_trigger').live('mousedown', function() { if ($(this).next('ul.menu').is(':hidden')) { JQD.util.clear_active(); $(this).addClass('active').next('ul.menu').show(); } else { JQD.util.clear_active(); } }).live('mouseenter', function() { // Transfer focus, if already open. if ($('ul.menu').is(':visible')) { JQD.util.clear_active(); $(this).addClass('active').next('ul.menu').show(); } });
  • 27. Making desktop icons interactive // Desktop icons. $('a.icon').live('mousedown', function() { // Highlight the icon. JQD.util.clear_active(); $(this).addClass('active'); }).live('dblclick', function() { // Get the link's target. var x = $(this).attr('href'); var y = $(x).find('a').attr('href'); // Show the taskbar button. if ($(x).is(':hidden')) { $(x).remove().appendTo('#dock'); $(x).show('fast'); } // Bring window to front. JQD.util.window_flat(); $(y).addClass('window_stack').show(); }).live('mouseenter', function() { $(this).die('mouseenter').draggable({ revert: true, containment: 'parent' }); });
  • 28. Taskbar / Dock buttons // Taskbar buttons. $('#dock a').live('click', function() { // Get the link's target. var x = $($(this).attr('href')); // Hide, if visible. if (x.is(':visible')) { x.hide(); } else { // Bring window to front. JQD.util.window_flat(); x.show().addClass('window_stack'); } });
  • 29. Manipulating the “windows” // Minimize the window. $('a.window_min').live('click', function() { $(this).closest('div.window').hide(); }); // Maximize or restore the window. $('a.window_resize').live('click', function() { JQD.util.window_resize(this); }); // Close the window. $('a.window_close').live('click', function() { $(this).closest('div.window').hide(); $($(this).attr('href')).hide('fast'); });
  • 30. Clicking the Show Desktop button // Show desktop button, ala Windows OS. $('#show_desktop').live('click', function() { // If any windows are visible, hide all. if ($('div.window:visible').length) { $('div.window').hide(); } else { // Otherwise, reveal hidden windows that are open. $('#dock li:visible a').each(function() { $($(this).attr('href')).show(); }); } });
  • 31. To prevent developers from wasting countless hours on styling dumb form elements
  • 32. It’s been awhile in the making... “Future plans include a tutorial on how to use jQuery to add styling hooks to form elements, since I know from experience that is no cup of tea.” — Source = Me when announcing 960.gs in 2008! — Excuse = New HTML5 elements set me back :)
  • 33.
  • 34. WebKit’s form styling secret sauce select { -webkit-appearance: none; } This gives you back a bit of control for things like <select> drop-downs.
  • 37. document.write(ad) with position:absolute <script> document.write(unescape('%3Cscr' + 'ipt src="http://adn.fusionads.net/...' + M </script> <span id="fusion_link"> <a href="http://fusionads.net/">Ads by Fusion</a> </span> ... </body>
  • 38. Base64 encode background images header[role="banner"] h1 { background-repeat: no-repeat; background-position: center 20px; background-image: url(../images/logo.png); background-image: url(data:imagepng;base64, iVBORw0KGgoAAA...); color: transparent; font-size: 0; overflow: hidden; text-indent: -99999px; height: 130px; } http://formalize.me http://www.motobit.com/util/base64-decoder-encoder.asp
  • 39. Pre-load JavaScript files <body> ... <!-- Pre-load JavaScript libraries --> <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5.0/dojo/dojo.xd.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools-yui-compressed.js" <script src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script> <script src="http://yui.yahooapis.com/3.3.0/build/simpleyui/simpleyui-min.js"></script> <!-- Pre-load Formalize files --> <script src="assets/javascripts/dojo.formalize.js"></script> <script src="assets/javascripts/extjs.formalize.js"></script> <script src="assets/javascripts/jquery.formalize.js"></script> <script src="assets/javascripts/mootools.formalize.js"></script> <script src="assets/javascripts/prototype.formalize.js"></script> <script src="assets/javascripts/yui.formalize.js"></script> </body> http://formalize.me/demo.html
  • 40. Pre-load JavaScript files <body> ... <!-- Pre-load JavaScript libraries --> <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5.0/dojo/dojo.xd.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools-yui-compressed.js" <script src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script> <script src="http://yui.yahooapis.com/3.3.0/build/simpleyui/simpleyui-min.js"></script> <!-- Pre-load Formalize files --> <script src="assets/javascripts/dojo.formalize.js"></script> <script src="assets/javascripts/extjs.formalize.js"></script> <script src="assets/javascripts/jquery.formalize.js"></script> <script src="assets/javascripts/mootools.formalize.js"></script> <script src="assets/javascripts/prototype.formalize.js"></script> <script src="assets/javascripts/yui.formalize.js"></script> </body> http://formalize.me/demo.html
  • 41. IE detection for Prototype.js Prevents false positives since Opera can be made to impersonate IE. Note: I did this because Prototype doesn’t detect IE version number. var IE6 = IE(6); var IE7 = IE(7); // Internet Explorer detection. function IE(version) { var b = document.createElement('b'); b.innerHTML = '<!--[if IE ' + version + ']><br><![endif]-->'; return !!b.getElementsByTagName('br').length; } http://formalize.me/assets/javascripts/prototype.formalize.js
  • 42. James Padolsey's IE detection (whoa!) var ie = (function() { var undef, v = 3, div = document.createElement('div'), all = div.getElementsByTagName('i'); while ( div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', all[0] ); return v > 4 ? v : undef; }()); https://gist.github.com/527683
  • 43. Line number counts in Formalize JS Dojo = 174 lines ExtJS = 168 lines jQuery = 158 lines MooTools = 163 lines Prototype = 171 lines YUI = 168 lines “Write Less, Do More” FTW! :)
  • 44. Basic structure of Formalize JS var FORMALIZE = (function($, window, document, undefined) { // Private constants. ! var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input'); ! var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input'); ! var WEBKIT = 'webkitAppearance' in document.createElement('select').style; ! var IE6 = !!($.browser.msie && parseInt($.browser.version, 10) === 6); ! var IE7 = !!($.browser.msie && parseInt($.browser.version, 10) === 7); // Expose innards of FORMALIZE. return { go: function() {/* ... */}, init: { detect_webkit: function() {/* ... */}, full_input_size: function() {/* ... */}, ie6_skin_inputs: function() {/* ... */}, autofocus: function() {/* ... */}, placeholder: function() {/* ... */} }, misc: { add_placeholder: function() {/* ... */} } }; })(jQuery, this, this.document);
  • 45. Detecting WebKit // FORMALIZE.init.detect_webkit detect_webkit: function() { ! if (!WEBKIT) { ! ! return; ! } ! // Tweaks for Safari + Chrome. ! $('html').addClass('is_webkit'); }, ...
  • 46. Basic structure of Formalize JS // FORMALIZE.init.full_input_size full_input_size: function() { ! if (!IE7 || !$('textarea, input.input_full').length) { ! ! return; ! } ! // This fixes width: 100% on <textarea> and class="input_full". ! // It ensures that form elements don't go wider than container. ! $('textarea, input.input_full') .wrap('<span class="input_full_wrap"></span>'); }, ...
  • 47. Adding styling // FORMALIZE.init.ie6_skin_inputs ie6_skin_inputs: function() { // Test for Internet Explorer 6. if (!IE6 || !$('input, select, textarea').length) { // Exit if the browser is not IE6, // or if no form elements exist. return; hooks for IE6 } // For <input type="submit" />, etc. var button_regex = /button|submit|reset/; // For <input type="text" />, etc. var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/; $('input').each(function() { var el = $(this); // Is it a button? if (this.getAttribute('type').match(button_regex)) { el.addClass('ie6_button'); /* Is it disabled? */ if (this.disabled) { el.addClass('ie6_button_disabled'); } } // Or is it a textual input? else if (this.getAttribute('type').match(type_regex)) { el.addClass('ie6_input'); /* Is it disabled? */ if (this.disabled) { el.addClass('ie6_input_disabled'); } } }); $('textarea, select').each(function() { /* Is it disabled? */ if (this.disabled) { $(this).addClass('ie6_input_disabled'); } }); },
  • 48. Adding HTML5 autofocus support // FORMALIZE.init.autofocus autofocus: function() { ! if (AUTOFOCUS_SUPPORTED || !$(':input[autofocus]').length) { ! ! return; ! } ! $(':input[autofocus]:visible:first').focus(); }, ...
  • 49. Adding HTML5 placeholder support // FORMALIZE.init.placeholder placeholder: function() { ! if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) { ! ! // Exit if placeholder is supported natively, ! ! // or if page does not have any placeholder. ! ! return; ! } ! FORMALIZE.misc.add_placeholder(); ! $(':input[placeholder]').each(function() { ! ! var el = $(this); ! ! var text = el.attr('placeholder'); ! ! el.focus(function() { ! ! ! if (el.val() === text) { ! ! ! ! el.val('').removeClass('placeholder_text'); ! ! ! } ! ! }).blur(function() { ! ! ! FORMALIZE.misc.add_placeholder(); ! ! }); ! ! // Prevent <form> from accidentally ! ! // submitting the placeholder text. ! ! el.closest('form').submit(function() { ! ! ! if (el.val() === text) { ! ! ! ! el.val('').removeClass('placeholder_text'); ! ! ! } ! ! }).bind('reset', function() { ! ! ! setTimeout(FORMALIZE.misc.add_placeholder, 50); ! ! }); ! }); }
  • 50. Moved outside of init, for easier reuse // FORMALIZE.misc misc: { ! // FORMALIZE.misc.add_placeholder ! add_placeholder: function() { ! ! if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) { ! ! ! // Exit if placeholder is supported natively, ! ! ! // or if page does not have any placeholder. ! ! ! return; ! ! } ! ! $(':input[placeholder]').each(function() { ! ! ! var el = $(this); ! ! ! var text = el.attr('placeholder'); ! ! ! if (!el.val() || el.val() === text) { ! ! ! ! el.val(text).addClass('placeholder_text'); ! ! ! } ! ! }); ! } }
  • 52. Additional Resources jQuery Companion Libraries jQuery UI – http://jqueryui.com jQuery Mobile – http://jquerymobile.com Amplify – http://amplifyjs.com Underscore – http://documentcloud.github.com/underscore Backbone – http://documentcloud.github.com/backbone JS Testing Jasmine – http://pivotal.github.com/jasmine QUnit – http://docs.jquery.com/Qunit If you want write Ruby-esque code that compiles to JS... CoffeeScript – http://jashkenas.github.com/coffee-script
  • 53. Recommended Books Learning jQuery – https://www.packtpub.com/learning-jquery-1.3 jQuery Enlightenment – http://jqueryenlightenment.com DOM Scripting – http://domscripting.com JavaScript: The Good Parts – http://oreilly.com/catalog/9780596517748 JavaScript: The Definitive Guide – http://oreilly.com/catalog/9780596101992 High Performance JavaScript – http://oreilly.com/catalog/9780596802806 Pro JavaScript Design Patterns – http://jsdesignpatterns.com Object-Oriented JavaScript – https://www.packtpub.com/object-oriented-javascript/book The Art and Science of JavaScript – http://www.sitepoint.com/books/jsdesign1 Test-Driven JavaScript Development – http://tddjs.com
  • 54. For questions – Or just to say hi :) Contact – http://sonspring.com/contact Twitter – http://twitter.com/nathansmith http://www.slideshare.net/nathansmith/drupalcon-jquery
  • 55. What did you think? Locate this session on the DCC website: http://chicago2011.drupal.org/sessions Click the “Take the Survey” link. Thanks!