-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests & fix bug when 404 returned
- Loading branch information
1 parent
85cea93
commit 84ee179
Showing
5 changed files
with
115 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<!doctype html> | ||
<!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]--> | ||
<!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]--> | ||
<!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]--> | ||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--> | ||
<head> | ||
|
||
<meta charset="utf-8"> | ||
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
|
||
<title>Infinite Scroll Testing</title> | ||
<meta name="description" content=""> | ||
<meta name="author" content=""> | ||
|
||
|
||
<link rel="stylesheet" href="style.css"> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
<div id="debug"> | ||
<a href="#" id="debug-trigger">+</a> | ||
<h3>Debug bar</h3> | ||
<nav id="debug-nav"> | ||
<a href="#" rel="destroy">Destroy</a> | ||
<a href="#" rel="pause">Pause</a> | ||
<a href="#" rel="resume">Resume</a> | ||
<a href="#" rel="toggle">Toggle</a> | ||
<a href="#" rel="scroll">Scroll</a> | ||
<a href="#" rel="unbind">Unbind</span></a> | ||
<a href="#" rel="bind">Bind</span></a> | ||
<a href="#" rel="retrieve">Retrieve</a> | ||
<a href="#" rel="cthullu">Invalid command</a> | ||
<a href="#" rel="pause" data-arg="the-apocalypse">Invalid argument</a> | ||
</nav> | ||
</div> | ||
|
||
<div id="content"> | ||
|
||
<h1>Infinite Scroll Testing</h1> | ||
|
||
<p>One for all and all for one, Muskehounds are always ready. One for all and all for one, helping everybody. One for all and all for one, it's a pretty story. Sharing everything with fun, that's the way to be. One for all and all for one, Muskehounds are always ready. One for all and all for one, helping everybody. One for all and all for one, can sound pretty corny. If you've got a problem chum, think how it could be.</p> | ||
|
||
<p>Barnaby The Bear's my name, never call me Jack or James, I will sing my way to fame, Barnaby the Bear's my name. Birds taught me to sing, when they took me to their king, first I had to fly, in the sky so high so high, so high so high so high, so - if you want to sing this way, think of what you'd like to say, add a tune and you will see, just how easy it can be. Treacle pudding, fish and chips, fizzy drinks and liquorice, flowers, rivers, sand and sea, snowflakes and the stars are free. La la la la la, la la la la la la la, la la la la la la la, la la la la la la la la la la la la la, so - Barnaby The Bear's my name, never call me Jack or James, I will sing my way to fame, Barnaby the Bear's my name.</p> | ||
|
||
<p>There's a voice that keeps on calling me. Down the road, that's where I'll always be. Every stop I make, I make a new friend. Can't stay for long, just turn around and I'm gone again. Maybe tomorrow, I'll want to settle down, Until tomorrow, I'll just keep moving on.</p> | ||
|
||
<p>Top Cat! The most effectual Top Cat! Who's intellectual close friends get to call him T.C., providing it's with dignity. Top Cat! The indisputable leader of the gang. He's the boss, he's a pip, he's the championship. He's the most tip top, Top Cat.</p> | ||
|
||
<p>Hong Kong Phooey, number one super guy. Hong Kong Phooey, quicker than the human eye. He's got style, a groovy style, and a car that just won't stop. When the going gets tough, he's really rough, with a Hong Kong Phooey chop (Hi-Ya!). Hong Kong Phooey, number one super guy. Hong Kong Phooey, quicker than the human eye. Hong Kong Phooey, he's fan-riffic!</p> | ||
|
||
<p>Barnaby The Bear's my name, never call me Jack or James, I will sing my way to fame, Barnaby the Bear's my name. Birds taught me to sing, when they took me to their king, first I had to fly, in the sky so high so high, so high so high so high, so - if you want to sing this way, think of what you'd like to say, add a tune and you will see, just how easy it can be. Treacle pudding, fish and chips, fizzy drinks and liquorice, flowers, rivers, sand and sea, snowflakes and the stars are free. La la la la la, la la la la la la la, la la la la la la la, la la la la la la la la la la la la la, so - Barnaby The Bear's my name, never call me Jack or James, I will sing my way to fame, Barnaby the Bear's my name.</p> | ||
|
||
<p>There's a voice that keeps on calling me. Down the road, that's where I'll always be. Every stop I make, I make a new friend. Can't stay for long, just turn around and I'm gone again. Maybe tomorrow, I'll want to settle down, Until tomorrow, I'll just keep moving on.</p> | ||
|
||
<p>Top Cat! The most effectual Top Cat! Who's intellectual close friends get to call him T.C., providing it's with dignity. Top Cat! The indisputable leader of the gang. He's the boss, he's a pip, he's the championship. He's the most tip top, Top Cat.</p> | ||
|
||
<p>Hong Kong Phooey, number one super guy. Hong Kong Phooey, quicker than the human eye. He's got style, a groovy style, and a car that just won't stop. When the going gets tough, he's really rough, with a Hong Kong Phooey chop (Hi-Ya!). Hong Kong Phooey, number one super guy. Hong Kong Phooey, quicker than the human eye. Hong Kong Phooey, he's fan-riffic!</p> | ||
|
||
</div> | ||
|
||
<a id="next" href="mobile2.json">next page?</a> | ||
|
||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js"></script> | ||
<script>window.jQuery || document.write("<script src='jquery-1.6.1.js'>\x3C/script>")</script> | ||
|
||
<script src="debug.js"></script> | ||
<script src="../jquery.infinitescroll.js"></script> | ||
<script src="../behaviors/manual-trigger.js"></script> | ||
|
||
<script> | ||
|
||
var _renderItem = function(data) { | ||
return "<p>Title :" + data.title + "</p>" | ||
} | ||
|
||
|
||
$('#content').infinitescroll({ | ||
|
||
// callback : function () { console.log('using opts.callback'); }, | ||
navSelector : "a#next:last", | ||
nextSelector : "a#next:last", | ||
itemSelector : "#content p", | ||
debug : true, | ||
dataType : 'json', | ||
// behavior : 'twitter', | ||
appendCallback : false, // USE FOR PREPENDING | ||
// pathParse : function( pathStr, nextPage ){ return pathStr.replace('2', nextPage ); } | ||
}, function( response ) { | ||
var jsonData = response.results; | ||
$theCntr = $("#content"); | ||
var newElements = ""; | ||
//var newItems = new Array(); | ||
for(var i=0;i<jsonData.length;i++) { | ||
var item = $(_renderItem(jsonData[i])); | ||
//item.css({ opacity: 0 }); | ||
$theCntr.append(item); | ||
//newItems.push(item.attr('id')); | ||
} | ||
//_addMasonryItem(newItems); | ||
}); | ||
</script> | ||
|
||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"results":[{"title":"this is the json title"},{"title":"this is another json title"},{"title":"this is the json title"},{"title":"this is another json title"},{"title":"this is the json title"},{"title":"this is another json title"},{"title":"this is the json title"},{"title":"this is another json title"}]} | ||
{"results":[{"title":"2. this is the json title"},{"title":"2. this is another json title"},{"title":"2. this is the json title"},{"title":"2. this is another json title"},{"title":"2. this is the json title"},{"title":"2. this is another json title"},{"title":"2. this is the json title"},{"title":"2. this is another json title"}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"results":[{"title":"this is the json title"},{"title":"this is another json title"},{"title":"this is the json title"},{"title":"this is another json title"},{"title":"this is the json title"},{"title":"this is another json title"},{"title":"this is the json title"},{"title":"this is another json title"}]} | ||
{"results":[{"title":"3. this is the json title"},{"title":"3. this is another json title"},{"title":"3. this is the json title"},{"title":"3. this is another json title"},{"title":"3. this is the json title"},{"title":"3. this is another json title"},{"title":"3. this is the json title"},{"title":"this is another json title"}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"results":[{"title":"this is the json title"},{"title":"this is another json title"},{"title":"this is the json title"},{"title":"this is another json title"},{"title":"this is the json title"},{"title":"this is another json title"},{"title":"this is the json title"},{"title":"this is another json title"}]} | ||
{"results":[{"title":"4. this is the json title"},{"title":"4. this is another json title"},{"title":"4. this is the json title"},{"title":"4. this is another json title"},{"title":"4. this is the json title"},{"title":"4. this is another json title"},{"title":"4. this is the json title"},{"title":"4. this is another json title"}]} |