Permalink
Browse files

First!

  • Loading branch information...
0 parents commit a4b178d1152764d4e83a76e32e974739c8840991 @scottgonzalez committed Jun 15, 2011
Showing with 6,397 additions and 0 deletions.
  1. +18 −0 demo/index.html
  2. +5 −0 demo/php/footer.html
  3. +19 −0 demo/php/header.html
  4. +45 −0 demo/php/index.php
  5. +7 −0 demo/php/loading.js
  6. +35 −0 demo/php/style.css
  7. +6,240 −0 external/jquery-1.4.2.js
  8. +28 −0 src/jquery.data-replace.js
@@ -0,0 +1,18 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>data-replace Demos</title>
+</head>
+<body>
+
+<p>The data-replace demo requires server-side code to detect the difference between
+a standard request and an ajax request. Because this detection is language
+(and sometimes framework) specific, demos are available in multiple forms.</p>
+
+<ul>
+ <li><a href="php/">PHP</a></li>
+</ul>
+
+</body>
+</html>
@@ -0,0 +1,5 @@
+</div>
+<p>Aenean tristique orci dui, mattis rutrum sem. Suspendisse et sapien eu lorem malesuada fermentum. Quisque et lorem sapien, nec consequat turpis. Donec tempor luctus tellus quis tempor. Aenean at velit in est sodales porttitor ut vel enim. Etiam porttitor enim et eros hendrerit iaculis. Nam cursus ullamcorper augue, facilisis porttitor nibh posuere ac. Pellentesque nulla felis, euismod vitae porta sit amet, tristique et nunc. Morbi dapibus tellus ut quam congue congue. Aliquam iaculis nulla eget leo vehicula ut pulvinar leo imperdiet. Pellentesque ac lectus purus, non porttitor dolor. Proin vitae ante ac neque dapibus euismod id id risus. Proin nec purus sed nisi aliquam tristique. Aenean rutrum, nulla aliquam varius pulvinar, mi turpis porta lacus, at porta lacus orci at urna. Quisque laoreet varius erat, nec pulvinar dui volutpat vitae. Curabitur nec nibh non diam vulputate sagittis at vitae nulla. Donec consequat commodo mollis. Nulla eu leo sapien. Curabitur elementum dapibus ligula, sed pulvinar metus facilisis ac. Nunc id facilisis tellus.</p>
+
+</div></body>
+</html>
@@ -0,0 +1,19 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>data-replace demo</title>
+
+ <link rel="stylesheet" href="style.css">
+
+ <script src="../../external/jquery-1.4.2.js"></script>
+ <script src="../../src/jquery.data-replace.js"></script>
+ <script src="loading.js"></script>
+</head>
+<body><div id="wrapper">
+
+<h1>data-replace demo</h1>
+
+<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur enim justo, blandit id vulputate quis, dictum vel mi. Nulla sodales mauris risus. Proin lobortis, enim quis ornare posuere, sem purus consequat velit, non accumsan odio augue at erat. Donec at cursus arcu. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Quisque molestie faucibus sollicitudin. Pellentesque bibendum condimentum massa eget fringilla. Curabitur molestie rutrum felis, quis tincidunt dolor adipiscing a. Vivamus varius elit ac sem vehicula vulputate. Cras non lorem enim, id dapibus nibh. Donec egestas lorem at justo vulputate sagittis.</p>
+
+<div id="content">
@@ -0,0 +1,45 @@
+<?php
+
+$ajax = !empty( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) &&
+ $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] === 'XMLHttpRequest';
+
+if ( !$ajax ) {
+ echo file_get_contents( 'header.html' );
+}
+
+// simulate network latency/server load
+if ( $ajax ) {
+ sleep( 1 );
+}
+
+?>
+
+<div class="results">
+<?php
+ $page = empty( $_GET[ 'page' ] ) ? 1 : $_GET[ 'page' ];
+ $start = ( $page - 1 ) * 10;
+ $end = $start + 10;
+ for ( $i = $start; $i < $end; $i++ ) {
+ echo '<span class="result">' . $i . '</span>';
+ }
+?>
+</div>
+<div class="pagination">
+ <a href="?page=1" data-replace="content">1</a>
+ <a href="?page=2" data-replace="content">2</a>
+ <a href="?page=3" data-replace="content">3</a>
+ <a href="?page=4" data-replace="content">4</a>
+ <a href="?page=5" data-replace="content">5</a>
+ <a href="?page=6" data-replace="content">6</a>
+ <a href="?page=7" data-replace="content">7</a>
+ <a href="?page=8" data-replace="content">8</a>
+ <a href="?page=9" data-replace="content">9</a>
+</div>
+
+<?php
+
+if ( !$ajax ) {
+ echo file_get_contents( 'footer.html' );
+}
+
+?>
@@ -0,0 +1,7 @@
+$( document )
+ .bind( "replaceSend", function( event ) {
+ $( event.target ).stop().fadeTo( 200, 0.5 );
+ })
+ .bind( "replaceComplete", function( event ) {
+ $( event.target ).stop().fadeTo( 200, 1 );
+ });
@@ -0,0 +1,35 @@
+#wrapper {
+ width: 760px;
+ margin: 0 auto;
+}
+
+.results {
+ float: left;
+ margin-bottom: 20px;
+}
+
+.result {
+ float: left;
+ width: 140px;
+ height: 95px;
+ padding-top: 45px;
+ font-size: 50px;
+ text-align: center;
+ color: #fff;
+ background-color: #333;
+ margin: 10px 10px 0 0;
+}
+
+.pagination {
+ font-size: 20px;
+ text-align: center;
+}
+
+.pagination a,
+.pagination a:link,
+.pagination a:visited,
+.pagination a:hover,
+.pagination a:active {
+ color: #333;
+ padding: 5px;
+}
Oops, something went wrong.

0 comments on commit a4b178d

Please sign in to comment.