Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cleanup

  • Loading branch information...
commit 36014f6a91dcb98ca320cef80ca1268c3dd8d542 1 parent 5113723
@addyosmani authored
View
3  README.md
@@ -10,3 +10,6 @@ A complete Backbone.js mobile application demonstrating searching for images usi
<li>jQuery Mobile + jQuery for DOM manipulation, mobile helpers</li>
<li>Flickr API for data</li>
</ul>
+
+
+<strong>Note:</strong> This application needs to be run on a HTTP server, local or otherwise. To remove this requirement, simply switch from using external templates via Require.js/the text plugin to inline ones.
View
1  app/ui.js
@@ -1,4 +1,3 @@
-/*need to be included in the namespace*/
define( ['jquery', 'utils' ],
function( $, utils ) {
// Using ECMAScript 5 strict mode during development. By default r.js will ignore that.
View
5 app/views/appview.js
@@ -28,10 +28,11 @@ define( ['jquery', 'backbone', 'utils', 'models/ResultCollection', 'models/Photo
keyLoadResults: function( event ) {
var query = $( '#searchbox' ).val();
+
if ( query ) {
- var sort = $( '#sortBy' ).val(),
- endpoint = mobileSearch.utils.queryConstructor( query, sort, 1 );
+ var sort = $( '#sortBy' ).val(),
+ endpoint = mobileSearch.utils.queryConstructor( query, sort, 1 );
location.hash = endpoint;
}
View
7 app/views/photoList.js
@@ -14,16 +14,11 @@ define( ['jquery', 'backbone', 'underscore','text!templates/photoview.html'],
var compiled_template = _.template(photoTemplate);
mobileSearch.utils.loadPrompt( "Loading photo..." );
-
$( '#photo .ui-title' ).html( 'Photo view' );
-
collection.photolist.el.html( compiled_template( { results: collection.models } ) );
setTimeout( function() {
- //hack (note all the below are on purpose)
- var $photo = $( '#photo' );
- $photo.find( 'ul' ).listview();
- $photo.find( 'ul' ).listview( "refresh" );
+ collection.photolist.el.listview('refresh');
}, 0 );
View
4 app/views/resultList.js
@@ -15,14 +15,12 @@ define( ['jquery', 'backbone', 'underscore','text!templates/listview.html'],
var compiled_template = _.template( listTemplate );
mobileSearch.utils.loadPrompt( "Loading results..." );
-
mobileSearch.utils.toggleNavigation( true );
-
collection.resultlist.el.html( compiled_template( { results: collection.models } ) );
setTimeout( function() {
collection.resultlist.el.listview('refresh');
- }, 50 );
+ }, 0 );
}
} );
Please sign in to comment.
Something went wrong with that request. Please try again.