Permalink
Browse files

Example of the extend hack.

DONT USE THIS ANYWHERE.
Just to show that you _can_ have classic sintra style apps without much effort.
  • Loading branch information...
1 parent d3c12af commit d32adec97a062be7a627e55a3ccac65ddab91fd1 @quirkey quirkey committed Nov 17, 2009
Showing with 53 additions and 0 deletions.
  1. +53 −0 examples/extend_hack/index.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+
+ <title>Hello World</title>
+
+ <style type="text/css" media="screen">
+
+ </style>
+
+ <script src="../../vendor/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../../lib/sammy.js" type="text/javascript" charset="utf-8"></script>
+ <script type="text/javascript" charset="utf-8">
+ ;(function($) {
+ // THE EXTEND HACK
+
+ var default_app = $.sammy();
+ $.extend(window, default_app);
+ $(function() {
+ default_app.run();
+ });
+
+ })(jQuery);
+
+ ;(function($) {
+
+ get('#/', function() {
+ $('#main').text('');
+ });
+
+ get('#/test', function() {
+ $('#main').text('Hello World');
+ });
+
+ })(jQuery);
+ </script>
+
+</head>
+
+<body>
+ <div id="container">
+ <div id="main">
+ </div>
+ <ul id="link">
+ <li><a href="#/test">Click me!</a></li>
+ <li><a href="#/">Back</a></li>
+ </div>
+ </div>
+</body>
+</html>

0 comments on commit d32adec

Please sign in to comment.