From e0fa1f427c79cf433f88f21e896fc4333bef1a48 Mon Sep 17 00:00:00 2001 From: nacin Date: Wed, 21 Mar 2012 20:17:47 +0000 Subject: [PATCH] Tidy up sanity checks in theme.dev.js. props DH-Shredder, fixes #19815. git-svn-id: http://svn.automattic.com/wordpress/trunk@20242 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/theme.dev.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/wp-admin/js/theme.dev.js b/wp-admin/js/theme.dev.js index 65addc9270..a7f6369888 100644 --- a/wp-admin/js/theme.dev.js +++ b/wp-admin/js/theme.dev.js @@ -105,8 +105,6 @@ jQuery( document ).ready( function($) { var ThemeScroller; (function($){ ThemeScroller = { - nonce: '', - nextPage: 2, // By default, assume we're on the first page. querying: false, scrollPollingDelay: 500, failedRetryDelay: 4000, @@ -119,8 +117,7 @@ var ThemeScroller; * @access private */ init: function() { - var self = this, - startPage; + var self = this; // Get out early if we don't have the required arguments. if ( typeof ajaxurl === 'undefined' || @@ -132,10 +129,7 @@ var ThemeScroller; // Handle inputs this.nonce = $('#_ajax_fetch_list_nonce').val(); - - startPage = theme_list_args.paged; - if ( startPage !== undefined ) - this.nextPage = ( startPage + 1 ); + this.nextPage = ( theme_list_args.paged + 1 ); // Cache jQuery selectors this.$outList = $('#availablethemes'); @@ -147,8 +141,7 @@ var ThemeScroller; * If there are more pages to query, then start polling to track * when user hits the bottom of the current page */ - if ( theme_list_args.total_pages !== undefined && - theme_list_args.total_pages >= this.nextPage ) + if ( theme_list_args.total_pages >= this.nextPage ) this.pollInterval = setInterval( function() { return self.poll(); @@ -181,9 +174,7 @@ var ThemeScroller; * @param results Array with results from this.ajax() query. */ process: function( results ) { - if ( ( results === undefined ) || - ( results.rows === undefined ) || - ( results.rows.indexOf( 'no-items' ) != -1 ) ) { + if ( results === undefined ) { clearInterval( this.pollInterval ); return; }