Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 4th, 2012  |  syntax: None  |  size: 0.73 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. A library to couple with jquery which helps work with classes easily (create/inheritance and so on)
  2. (function() {
  3.     MySite = {
  4.         ... some basic functions that involve whatever javascript libraries
  5.     }
  6. })();
  7.        
  8. MySite.ui = {
  9.     uiButton: function($buttons) {
  10.         $.each($buttons, function() {
  11.             var $this = $(this),
  12.                 settings = $this.data("settings");
  13.  
  14.             $this.click(function() {
  15.                 if (settings.type == 0) {
  16.                     MySite.handleLocationChange(settings.location);
  17.                 }
  18.             });
  19.         });
  20.     }
  21. }
  22.        
  23. <div class='uiButton'data-settings='{"type":"0"}'>MySweetButton</div>
  24. <script type='text/javascript'>MySite.ui.uiButton($(".uiButton"));(</script>