Skip to content

Commit

Permalink
removing ood scrollTo plugin, tweaking utils and non-input styles
Browse files Browse the repository at this point in the history
  • Loading branch information
addyosmani committed Dec 19, 2011
1 parent 36014f6 commit 1ced4b1
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 50 deletions.
11 changes: 0 additions & 11 deletions app/plugins/jquery.scrollTo.js

This file was deleted.

75 changes: 38 additions & 37 deletions app/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,52 +23,57 @@ define( ['jquery' ],
// The pagination index currently being queried. e.g 2 refers to page 2.

utils.dfdQuery = function( searchType, ctx, query, sort, page ) {
var entries = null;
page = (page == undefined) ? 1 : page;

utils.loadPrompt( 'Querying Flickr API...' );
if(!(query==undefined || query == "")){

$.when( utils.fetchResults( searchType, query, sort, page ) )
.then( $.proxy( function( response ) {
var entries = null;
page = (page == undefined) ? 1 : page;

ctx.setCollection( searchType );
utils.loadPrompt( 'Querying Flickr API...' );

$.when( utils.fetchResults( searchType, query, sort, page ) )
.then( $.proxy( function( response ) {

// The application can handle routes that come in
// through a bookmarked URL differently if needed
// simply check against workspace.bookmarkMode
// e.g if(!mobileSearch.routers.workspace.bookmarkMode) etc.
ctx.setCollection( searchType );

if ( searchType == 'search' || searchType == undefined ) {
// The application can handle routes that come in
// through a bookmarked URL differently if needed
// simply check against workspace.bookmarkMode
// e.g if(!mobileSearch.routers.workspace.bookmarkMode) etc.

entries = response.photos.photo;
if ( searchType == 'search' || searchType == undefined ) {

mobileSearch.routers.workspace.q = query;
mobileSearch.routers.workspace.p = page;
mobileSearch.routers.workspace.s = sort;
entries = response.photos.photo;

$( '.search-meta p' ).html( 'Page: ' + response.photos.page + ' / ' + response.photos.pages );

ctx.result_collection.reset( entries );
mobileSearch.routers.workspace.q = query;
mobileSearch.routers.workspace.p = page;
mobileSearch.routers.workspace.s = sort;

// switch to search results view
utils.changePage( "#search", "slide", false, false );
$( '.search-meta p' ).html( 'Page: ' + response.photos.page + ' / ' + response.photos.pages );

ctx.result_collection.reset( entries );

// update title
utils.switchTitle( query + ' (Page ' + page + ' of ' + response.photos.total + ')' );
// switch to search results view
utils.changePage( "#search", "slide", false, false );

}
else {
// update title
utils.switchTitle( query + ' (Page ' + page + ' of ' + response.photos.total + ')' );

entries = response.photo;
ctx.photo_collection.reset( entries );
}
else {

// switch to the individual photo viewer
utils.changePage( "#photo", "slide", false, false );

}
entries = response.photo;
ctx.photo_collection.reset( entries );

}, ctx ) );
// switch to the individual photo viewer
utils.changePage( "#photo", "slide", false, false );

}

}, ctx ) );
}else{
utils.loadPrompt( 'Please enter a valid search query.' );
}
};


Expand Down Expand Up @@ -107,10 +112,6 @@ define( ['jquery' ],

utils.fetchResults = function( searchType, query, sort, page ) {


//todo: undefined queries should result in an error being thrown or
// a message passed back to the UI

var serviceUrl = "http://api.flickr.com/services/rest/?format=json&jsoncallback=?",
apiKey = "8662e376985445d92a07c79ff7d12ff8",
geoTagged = null,
Expand All @@ -132,10 +133,10 @@ define( ['jquery' ],
($( '#geo-choice-z1' ).prop( 'checked' ) || mobileSearch.defaults.geoTagged) ? geoTagged = 0 : geoTagged = 1;
page = (page == undefined) ? 0 : page;
sort = (sort == undefined) ? ($( '#sortBy' ).val()) : sort;
serviceUrl += "&method=flickr.photos.search" + "&per_page=" + quantity + "&page=" + page + "&is_geo=" + geoTagged + "&safe_search=" + safeSearch + "&sort=" + sort + "&min_taken_date=" + minDate + "&max_taken_date=" + maxDate + "&text=" + query + "&api_key=" + apiKey;
serviceUrl += "&method=flickr.photos.search" + "&per_page=" + quantity + "&page=" + page + "&is_geo=" + geoTagged + "&safe_search=" + safeSearch + "&sort=" + sort + "&min_taken_date=" + minDate + "&max_taken_date=" + maxDate + "&text=" + encodeURIComponent(query) + "&api_key=" + apiKey;

} else if ( searchType == 'photo' ) {
serviceUrl += "&method=flickr.photos.getInfo&photo_id=" + query + "&api_key=" + apiKey;
serviceUrl += "&method=flickr.photos.getInfo&photo_id=" + encodeURIComponent(query) + "&api_key=" + apiKey;
}


Expand Down
1 change: 1 addition & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ and (max-width : 500px) {
margin:0px;
border-radius:0px;
padding:5px;
overflow:hidden;
}

#photoviewholder ul li .key{
Expand Down
2 changes: 0 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
<link rel="stylesheet" href="css/jquery.ui.datepicker.css"/>
<link rel="stylesheet" href="css/custom_mobile_theme.css"/>
<link rel="stylesheet" href="css/style.css"/>

<script data-main="app/main" type="text/javascript" src="app/libs/require/require-1.0.2.min.js"></script>

</head>

<body lang="en">
Expand Down

0 comments on commit 1ced4b1

Please sign in to comment.