Fix JSHint errors in theme-install.js.
props kovshenin. fixes #26045. git-svn-id: https://develop.svn.wordpress.org/trunk@26210 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
92f9cc1d5f
commit
6597d9d43e
|
@ -1,3 +1,7 @@
|
||||||
|
/* global ajaxurl, list_args, theme_list_args */
|
||||||
|
|
||||||
|
var theme_viewer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Theme Browsing
|
* Theme Browsing
|
||||||
*
|
*
|
||||||
|
@ -28,16 +32,18 @@ jQuery(document).ready( function($) {
|
||||||
tb_position = function() {
|
tb_position = function() {
|
||||||
var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 1040 < width ) ? 1040 : width, adminbar_height = 0;
|
var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 1040 < width ) ? 1040 : width, adminbar_height = 0;
|
||||||
|
|
||||||
if ( $('body.admin-bar').length )
|
if ( $('body.admin-bar').length ) {
|
||||||
adminbar_height = 28;
|
adminbar_height = 28;
|
||||||
|
}
|
||||||
|
|
||||||
if ( tbWindow.size() ) {
|
if ( tbWindow.size() ) {
|
||||||
tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
|
tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
|
||||||
$('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height );
|
$('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height );
|
||||||
tbWindow.css({'margin-left': '-' + parseInt( ( ( W - 50 ) / 2 ), 10 ) + 'px'});
|
tbWindow.css({'margin-left': '-' + parseInt( ( ( W - 50 ) / 2 ), 10 ) + 'px'});
|
||||||
if ( typeof document.body.style.maxWidth != 'undefined' )
|
if ( typeof document.body.style.maxWidth !== 'undefined' ) {
|
||||||
tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'});
|
tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'});
|
||||||
};
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(window).resize(function(){ tb_position(); });
|
$(window).resize(function(){ tb_position(); });
|
||||||
|
@ -49,8 +55,9 @@ jQuery(document).ready( function($) {
|
||||||
* Displays theme previews on theme install pages.
|
* Displays theme previews on theme install pages.
|
||||||
*/
|
*/
|
||||||
jQuery( function($) {
|
jQuery( function($) {
|
||||||
if( ! window.postMessage )
|
if ( ! window.postMessage ) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var preview = $('#theme-installer'),
|
var preview = $('#theme-installer'),
|
||||||
info = preview.find('.install-theme-info'),
|
info = preview.find('.install-theme-info'),
|
||||||
|
@ -86,7 +93,7 @@ jQuery( function($) {
|
||||||
var ThemeViewer;
|
var ThemeViewer;
|
||||||
|
|
||||||
(function($){
|
(function($){
|
||||||
ThemeViewer = function( args ) {
|
ThemeViewer = function() {
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
$( '#filter-click, #mini-filter-click' ).unbind( 'click' ).click( function() {
|
$( '#filter-click, #mini-filter-click' ).unbind( 'click' ).click( function() {
|
||||||
|
@ -100,13 +107,15 @@ var ThemeViewer;
|
||||||
var count = $( '#filter-box :checked' ).length,
|
var count = $( '#filter-box :checked' ).length,
|
||||||
text = $( '#filter-click' ).text();
|
text = $( '#filter-click' ).text();
|
||||||
|
|
||||||
if ( text.indexOf( '(' ) != -1 )
|
if ( text.indexOf( '(' ) !== -1 ) {
|
||||||
text = text.substr( 0, text.indexOf( '(' ) );
|
text = text.substr( 0, text.indexOf( '(' ) );
|
||||||
|
}
|
||||||
|
|
||||||
if ( count == 0 )
|
if ( count === 0 ) {
|
||||||
$( '#filter-click' ).text( text );
|
$( '#filter-click' ).text( text );
|
||||||
else
|
} else {
|
||||||
$( '#filter-click' ).text( text + ' (' + count + ')' );
|
$( '#filter-click' ).text( text + ' (' + count + ')' );
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* $('#filter-box :submit').unbind( 'click' ).click(function() {
|
/* $('#filter-box :submit').unbind( 'click' ).click(function() {
|
||||||
|
@ -130,11 +139,11 @@ var ThemeViewer;
|
||||||
init: init
|
init: init
|
||||||
};
|
};
|
||||||
|
|
||||||
return api;
|
return api;
|
||||||
}
|
};
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
jQuery( document ).ready( function($) {
|
jQuery( document ).ready( function() {
|
||||||
theme_viewer = new ThemeViewer();
|
theme_viewer = new ThemeViewer();
|
||||||
theme_viewer.init();
|
theme_viewer.init();
|
||||||
});
|
});
|
||||||
|
@ -169,9 +178,10 @@ var ThemeScroller;
|
||||||
|
|
||||||
// Get out early if we don't have the required arguments.
|
// Get out early if we don't have the required arguments.
|
||||||
if ( typeof ajaxurl === 'undefined' ||
|
if ( typeof ajaxurl === 'undefined' ||
|
||||||
typeof list_args === 'undefined' ||
|
typeof list_args === 'undefined' ||
|
||||||
typeof theme_list_args === 'undefined' ) {
|
typeof theme_list_args === 'undefined' ) {
|
||||||
$('.pagination-links').show();
|
|
||||||
|
$('.pagination-links').show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,11 +199,11 @@ var ThemeScroller;
|
||||||
* If there are more pages to query, then start polling to track
|
* If there are more pages to query, then start polling to track
|
||||||
* when user hits the bottom of the current page
|
* when user hits the bottom of the current page
|
||||||
*/
|
*/
|
||||||
if ( theme_list_args.total_pages >= this.nextPage )
|
if ( theme_list_args.total_pages >= this.nextPage ) {
|
||||||
this.pollInterval =
|
this.pollInterval = setInterval( function() {
|
||||||
setInterval( function() {
|
return self.poll();
|
||||||
return self.poll();
|
}, this.scrollPollingDelay );
|
||||||
}, this.scrollPollingDelay );
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -207,8 +217,9 @@ var ThemeScroller;
|
||||||
var bottom = this.$document.scrollTop() + this.$window.innerHeight();
|
var bottom = this.$document.scrollTop() + this.$window.innerHeight();
|
||||||
|
|
||||||
if ( this.querying ||
|
if ( this.querying ||
|
||||||
( bottom < this.$outList.height() - this.outListBottomThreshold ) )
|
( bottom < this.$outList.height() - this.outListBottomThreshold ) ) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.ajax();
|
this.ajax();
|
||||||
},
|
},
|
||||||
|
@ -227,11 +238,13 @@ var ThemeScroller;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( this.nextPage > theme_list_args.total_pages )
|
if ( this.nextPage > theme_list_args.total_pages ) {
|
||||||
clearInterval( this.pollInterval );
|
clearInterval( this.pollInterval );
|
||||||
|
}
|
||||||
|
|
||||||
if ( this.nextPage <= ( theme_list_args.total_pages + 1 ) )
|
if ( this.nextPage <= ( theme_list_args.total_pages + 1 ) ) {
|
||||||
this.$outList.append( results.rows );
|
this.$outList.append( results.rows );
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -241,11 +254,8 @@ var ThemeScroller;
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
ajax: function() {
|
ajax: function() {
|
||||||
var self = this;
|
var self = this,
|
||||||
|
query = {
|
||||||
this.querying = true;
|
|
||||||
|
|
||||||
var query = {
|
|
||||||
action: 'fetch-list',
|
action: 'fetch-list',
|
||||||
paged: this.nextPage,
|
paged: this.nextPage,
|
||||||
s: theme_list_args.search,
|
s: theme_list_args.search,
|
||||||
|
@ -256,6 +266,8 @@ var ThemeScroller;
|
||||||
'list_args': list_args
|
'list_args': list_args
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.querying = true;
|
||||||
|
|
||||||
this.$spinner.show();
|
this.$spinner.show();
|
||||||
$.getJSON( ajaxurl, query )
|
$.getJSON( ajaxurl, query )
|
||||||
.done( function( response ) {
|
.done( function( response ) {
|
||||||
|
@ -270,9 +282,9 @@ var ThemeScroller;
|
||||||
setTimeout( function() { self.ajax(); }, self.failedRetryDelay );
|
setTimeout( function() { self.ajax(); }, self.failedRetryDelay );
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
$(document).ready( function($) {
|
$(document).ready( function() {
|
||||||
ThemeScroller.init();
|
ThemeScroller.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue