Permalink
Browse files

Commit Evented code

  • Loading branch information...
wycats committed Apr 28, 2010
0 parents commit 29e009e0c109e790a356199f14f971bf2d476abb
Showing with 1,021 additions and 0 deletions.
  1. +25 −0 config.ru
  2. +16 −0 config/site.rb
  3. BIN site/images/button_bg.png
  4. BIN site/images/datepicker.gif
  5. BIN site/images/icon_sprite.png
  6. BIN site/images/jqia2.jpg
  7. BIN site/images/loader.gif
  8. BIN site/images/ninja2.jpg
  9. BIN site/images/progress_bar.gif
  10. BIN site/images/slider_h_bg.gif
  11. BIN site/images/slider_handles.png
  12. BIN site/images/slider_v_bg.gif
  13. BIN site/images/tab_bg.gif
  14. BIN site/images/the_gradient.gif
  15. BIN site/images/ui-bg_diagonals-thick_18_b81900_40x40.png
  16. BIN site/images/ui-bg_diagonals-thick_20_666666_40x40.png
  17. BIN site/images/ui-bg_flat_10_000000_40x100.png
  18. BIN site/images/ui-bg_glass_100_f6f6f6_1x400.png
  19. BIN site/images/ui-bg_glass_100_fdf5ce_1x400.png
  20. BIN site/images/ui-bg_glass_65_ffffff_1x400.png
  21. BIN site/images/ui-bg_gloss-wave_35_f6a828_500x100.png
  22. BIN site/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
  23. BIN site/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
  24. BIN site/images/ui-icons_222222_256x240.png
  25. BIN site/images/ui-icons_228ef1_256x240.png
  26. BIN site/images/ui-icons_ef8c08_256x240.png
  27. BIN site/images/ui-icons_ffd27a_256x240.png
  28. BIN site/images/ui-icons_ffffff_256x240.png
  29. +100 −0 site/index.html
  30. +125 −0 site/javascripts/application.js
  31. +106 −0 site/javascripts/application.selector.js
  32. +18 −0 site/javascripts/bbq.jquery.js
  33. +163 −0 site/javascripts/jquery.js
  34. +1 −0 site/javascripts/selectors.js
  35. +21 −0 site/katz.html
  36. +2 −0 site/snippet.html
  37. +172 −0 site/stylesheets/application.css
  38. 0 site/stylesheets/jquery-ui.css
  39. +5 −0 site/stylesheets/screen.css
  40. +9 −0 src/layouts/application.haml
  41. +1 −0 src/layouts/blank.haml
  42. +32 −0 src/pages/_irish.haml
  43. +37 −0 src/pages/_resig.haml
  44. +21 −0 src/pages/index.haml
  45. +25 −0 src/pages/katz.haml
  46. +10 −0 src/stylesheets/application.sass
  47. +128 −0 src/stylesheets/jquery-ui.sass
  48. +4 −0 src/stylesheets/screen.sass
@@ -0,0 +1,25 @@
+require "pathname"
+root = Pathname.new(File.dirname(__FILE__)).join("site")
+AJAX = root.join("katz.html")
+
+class SlowPage
+ def initialize(app)
+ @app = app
+ end
+
+ def call(env)
+ if env["PATH_INFO"] == "/index.html"
+ system "staticmatic build ."
+ @app.call(env)
+ elsif env["PATH_INFO"] == "/ajax.html"
+ sleep 1
+ [200, {"Content-Type" => "text/html"}, [File.read(AJAX)]]
+ else
+ @app.call(env)
+ end
+ end
+end
+
+use SlowPage
+use Rack::Static, :urls => ["/"], :root => root
+run proc {|env| [200, {"Content-Type" => "text/html"}, ["Hello world"]]}
@@ -0,0 +1,16 @@
+# Default is 3000
+# configuration.preview_server_port = 3000
+
+# Default is localhost
+# configuration.preview_server_host = "localhost"
+
+# Default is true
+# When false .html & index.html get stripped off generated urls
+# configuration.use_extensions_for_page_links = true
+
+# Default is an empty hash
+# configuration.sass_options = {}
+
+# Default is an empty hash
+# http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#options
+# configuration.haml_options = {}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
@@ -0,0 +1,100 @@
+<!DOCTYPE html>
+<html lang='en'>
+ <head>
+ <meta charset='utf-8' />
+ <title>OMG TABS</title>
+ <link href="stylesheets/application.css" media="all" rel="stylesheet" type="text/css"/><link href="stylesheets/jquery-ui.css" media="all" rel="stylesheet" type="text/css"/><link href="stylesheets/screen.css" media="all" rel="stylesheet" type="text/css"/>
+ </head>
+ <body>
+ <div class='ui-tabs'>
+ <ul>
+ <li class='ui-tabs-selected'><a href="#tabs1">Resig</a></li>
+ <li class='ui-state-disabled'><a href="#tabs2">Irish</a></li>
+ <li data-ajax='/ajax.html'><a href="#tabs3">Conference</a></li>
+ </ul>
+ <div class='ui-tabs-panel' id='tabs1'>
+ <h3>Book: Secrets of the JavaScript Ninja (John Resig)</h3>
+ <img alt="Ninja2" height="200" src="images/ninja2.jpg"/>
+ <p>
+ The untold secrets of the elite JavaScript programmers distilled for intermediate
+ JavaScript programmers, bringing them completely up to speed with the challenges of
+ modern JavaScript development. Explores specific techniques, strategies, and
+ solutions to developing robust, cross-browser, JavaScript code.
+ </p>
+ <h3>Overview</h3>
+ <p>
+ This book is intended to take an intermediate JavaScript developer and give him
+ the knowledge he needs to create a cross-browser JavaScript library, from the
+ ground, up.
+ </p>
+ <p>
+ Due to the challenging issues that are continually encountered when developing
+ cross-browser JavaScript applications JavaScript libraries have become a necessity
+ of modern JavaScript development. All JavaScript developers have a collection of
+ reusable code - either written by themselves, someone at the company that they
+ work at, or by a third party. Thus, it becomes increasingly important that a
+ JavaScript developer understand how to, either, construct a library from scratch
+ or understand how their library of choice works.
+ </p>
+ <p>
+ The knowledge necessary for JavaScript library development is taught in three
+ phases: design, construction, and maintenance. A base of strong, advanced,
+ JavaScript knowledge is taught to the reader, giving him the ability to make
+ decisions about the overall design of the library and how to tackle its eventual
+ construction. The construction of the library examines the numerous tasks that
+ all JavaScript libraries have to tackle and provides practical solutions and
+ development strategies for their creation. Finally, maintenance techniques are
+ explored for keeping the library running well into the future. All of these
+ fundamental strategies, combined, provide the reader with all the knowledge
+ necessary to build, or understand, any modern JavaScript library.
+ </p>
+ </div>
+ <div class='ui-tabs-panel ui-tabs-hide' id='tabs2'>
+ <h3>Going GOOG (Paul Irish)</h3>
+ <p>
+ Big news! (for me, at least) I'm taking a position on the Chrome team doing Developer
+ Relations. I'll be evangelizing HTML5, Chrome, Chrome OS, and everything under the Open
+ Web umbrella. It'll be a bunch of writing, speaking, tutorials and guides, and
+ engagement with the developer community. (Hey guys! :)
+ </p>
+ <p>
+ As I'm very passionate about all this, I'm quite excited about this opportunity.
+ Google Chrome has become the browser to beat very quickly. It's a solid platform for
+ browsing and developing as well. I can't wait to join the team and start kicking ass,
+ making Chrome ideal for developers and pushing the open web forward.
+ </p>
+ <p>
+ As part of this, I'm also moving to San Francisco. Farewell, my dear Boston. *sniff* :(
+ </p>
+ <p>
+ I'm leaving an incredible team of UX architects, interactive designers, software
+ engineers, and front-end developers at Molecular/Isobar. It's been 3.5 years and I
+ would've easily stayed longer. If you're in Boston, Toronto or SF and want to develop
+ incredible sites and apps for high-profile clients, I couldn't recommend working there
+ enough. <3z
+ </p>
+ <p>
+ This is all happening over the next 60 days, along with a busy schedule of JSConf,
+ Bay Area jQuery Conference, TXJS, and a few weddings.
+ </p>
+ <p>
+ I plan to continue to be active in the jQuery community (thx to my compadre Karl
+ Swedberg for the referral!), and continue developing Modernizr and CSS3Please.
+ I also got a few more projects on the way. Exciting times. :)
+ </p>
+ </div>
+ <div class='ui-tabs-panel ui-tabs-hide' id='tabs3'>
+ <h3>Tabs 3</h3>
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit,
+ sed do eiusmod tempor incididunt ut labore et dolore magna
+ aliqua. Ut enim ad minim veniam, quis nostrud exercitation
+ ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis
+ aute irure dolor in reprehenderit in voluptate velit esse
+ cillum dolore eu fugiat nulla pariatur. Excepteur sint
+ occaecat cupidatat non proident, sunt in culpa qui officia
+ deserunt mollit anim id est laborum.
+ </div>
+ </div>
+ <script language="javascript" src="javascripts/jquery.js" type="text/javascript"></script><script language="javascript" src="javascripts/bbq.jquery.js" type="text/javascript"></script><script language="javascript" src="javascripts/selectors.js" type="text/javascript"></script><script language="javascript" src="javascripts/application.js" type="text/javascript"></script>
+ </body>
+</html>
@@ -0,0 +1,125 @@
+jQuery(function($) {
+ /**
+ * The Plumbing
+ **/
+
+ // Step 1: Create a plumbing event and define its
+ // default behavior
+ jQuery.event.special.tabactivate = {
+ _default: function(e) {
+ e.tab.addClass("ui-tabs-selected");
+ e.tab.closest("ul").find("li")
+ .not(e.tab).removeClass("ui-tabs-selected");
+
+ e.tab.trigger("tabdisable")
+
+ e.tab.closest("div").find("div.ui-tabs-panel")
+ .addClass("ui-tabs-hide");
+
+ e.pane.removeClass("ui-tabs-hide");
+ }
+ }
+
+
+
+
+
+
+
+
+
+ // Step 2: Define the normal way that the plumbing
+ // event will be triggered
+ $("div.ui-tabs ul a").live("click", function(e) {
+ var link = $(this);
+ var container = link.closest("div");
+
+ if(link.parent().hasClass("ui-tabs-selected"))
+ return false;
+
+ event = {
+ type: "tabactivate",
+ tab: link.parent(),
+ link: link,
+ pane: $(link.attr("href"))
+ }
+
+ container.trigger(event);
+
+ return false;
+ });
+
+
+
+
+
+
+
+ /**
+ * Userland
+ **/
+
+ // Step 3: Add support for disabled tabs. Disabled tabs should
+ // block the default behavior
+ $("div.ui-tabs").live("tabactivate", function(e) {
+ if(e.tab.hasClass("ui-state-disabled")) {
+ e.stopImmediatePropagation();
+ return false;
+ }
+ });
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // Step 4: Add support for Ajax. Tabs with a data-ajax property
+ // should wipe out the content, replace it with a loading bar
+ // and get the new content.
+ $("div.ui-tabs").live("tabactivate", function(e) {
+ if(e.tab.is("[data-ajax]")) {
+ e.pane.html("<h3>Loading</h3><img src='images/loader.gif' />");
+
+ $.get(e.tab.attr("data-ajax"), function(html) {
+ e.pane.html(html);
+ })
+ }
+ });
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // Step 5: Add support for the back button
+ $(window).bind("hashchange", function() {
+ $("a[href='" + location.hash + "']").click();
+ });
+
+ $("div.ui-tabs").live("tabactivate", function(e) {
+ location.hash = e.link.attr("href");
+ })
+
+ $(window).trigger("hashchange");
+});
@@ -0,0 +1,106 @@
+jQuery(function($) {
+ S("body")
+ .def("tabs", "div.ui-tabs")
+ .def("nav", "ul")
+ .def("tab", "li")
+ .def("link", "a");
+
+ S("tabs")
+ .def("panel", "div.ui-tabs-panel");
+
+ /**
+ * The Plumbing
+ **/
+
+ // Step 1: Create a plumbing event and define its default behavior
+ jQuery.event.special.tabactivate = {
+ _default: function(e) {
+ e.tab.up("tabs").down("tab")
+ .not(e.tab).removeClass("ui-tabs-selected");
+
+ e.tab.addClass("ui-tabs-selected");
+
+ e.tab.up("tabs").down("panel").
+ addClass("ui-tabs-hide");
+
+ e.pane.removeClass("ui-tabs-hide");
+ }
+ }
+
+
+
+
+
+
+ // Step 2: Define the normal way that the plumbing event will be triggered
+ S("link").click(function(e) {
+ if(this.up("tab").hasClass("ui-tabs-selected")) return false;
+
+ this.up("tabs").trigger({
+ type: "tabactivate",
+ tab: this.up("tab"),
+ link: this,
+ pane: $(this.attr("href"))
+ });
+
+ return false;
+ });
+
+
+
+
+
+
+
+ /**
+ * Userland
+ **/
+
+ // Step 3: Add support for disabled tabs. Disabled tabs should
+ // block the default behavior
+ $("div.ui-tabs").live("tabactivate", function(e) {
+ if(e.tab.hasClass("ui-state-disabled")) return false;
+ });
+
+
+
+
+
+
+
+
+
+
+
+
+ // Step 4: Add support for Ajax. Tabs with a data-ajax property
+ // should wipe out the content, replace it with a loading bar
+ // and get the new content.
+ $("div.ui-tabs").live("tabactivate", function(e) {
+ if(e.tab.is("[data-ajax]")) {
+ e.pane.html("<h3>Loading</h3><img src='images/loader.gif' />");
+
+ $.get(e.tab.attr("data-ajax"), function(html) {
+ e.pane.html(html);
+ })
+ }
+ });
+
+
+
+
+
+
+
+
+ // Step 5: Add support for the back button
+ $(window).bind("hashchange", function() {
+ $("a[href='" + location.hash + "']").click();
+ });
+
+ $("div.ui-tabs").live("tabactivate", function(e) {
+ location.hash = e.link.attr("href");
+ })
+
+ $(window).trigger("hashchange");
+});
Oops, something went wrong.

0 comments on commit 29e009e

Please sign in to comment.