2010-09-24 14:50:31 -04:00
|
|
|
var ThemeViewer;
|
|
|
|
|
|
|
|
(function($){
|
|
|
|
ThemeViewer = function( args ) {
|
|
|
|
|
|
|
|
function filter_count() {
|
|
|
|
var count = $( '#filters :checked' ).length;
|
|
|
|
var text = $( '#filter-click' ).text();
|
|
|
|
|
|
|
|
if ( text.indexOf( '(' ) != -1 )
|
|
|
|
text = text.substr( 0, text.indexOf( '(' ) );
|
|
|
|
|
|
|
|
if ( count == 0 )
|
|
|
|
$( '#filter-click' ).text( text );
|
|
|
|
else
|
|
|
|
$( '#filter-click' ).text( text + ' (' + count + ')' );
|
|
|
|
}
|
|
|
|
|
|
|
|
function init() {
|
|
|
|
$( '#filter-click, #mini-filter-click' ).unbind( 'click' ).click( function() {
|
|
|
|
$( '#filter-click' ).toggleClass( 'current' );
|
|
|
|
$( '#filters' ).slideToggle();
|
|
|
|
$( '#current-theme' ).slideToggle( 300 );
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
$( '#filters :checkbox' ).unbind( 'click' ).click( function() {
|
|
|
|
filter_count();
|
|
|
|
});
|
|
|
|
|
|
|
|
$( 'p.tags a' ).unbind( 'click' ).click(function() {
|
|
|
|
$( 'p.tags a' ).unbind( 'click' ).click(function() { slow_down(); return false }); // Stop further clicks until we've done
|
|
|
|
$( '.loading' ).fadeIn();
|
|
|
|
$( '.random-info' ).fadeOut();
|
|
|
|
|
|
|
|
var item = this.href.replace( /.*?s=(.*?)#.*/, '$1' );
|
|
|
|
|
|
|
|
// Is this in the features list?
|
|
|
|
if ( $( 'input[value="' + item + '"]' ).length > 0 ) {
|
|
|
|
$( 'input[value="' + item + '"]' ).attr( 'checked', $( 'input[value="' + item + '"]' ).attr( 'checked' ) ? false : true );
|
|
|
|
|
|
|
|
filter_count();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
$( 'input[name=s]' ).val( item ); // Can't find it, just use a search
|
|
|
|
|
|
|
|
// Set the options
|
|
|
|
opts.search = $( 'input[name=s]' ).val();
|
|
|
|
opts.order = document.location.href.match( /order=(\w*)/ ) ? document.location.href.match( /order=(\w*)/ )[1] : 'random';
|
2010-10-21 15:55:28 -04:00
|
|
|
|
2010-09-24 14:50:31 -04:00
|
|
|
$( '#availablethemes td' ).fadeTo( 500, 0.1, function() {
|
|
|
|
$( '#availablethemes td img' ).hide();
|
|
|
|
} );
|
|
|
|
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
2010-10-21 15:55:28 -04:00
|
|
|
|
2010-09-24 14:50:31 -04:00
|
|
|
// These are the functions we expose
|
|
|
|
var api = {
|
|
|
|
init: init
|
|
|
|
};
|
|
|
|
|
|
|
|
return api;
|
|
|
|
}
|
|
|
|
})(jQuery);
|
|
|
|
|
|
|
|
jQuery( document ).ready( function($) {
|
|
|
|
theme_viewer = new ThemeViewer();
|
|
|
|
theme_viewer.init();
|
2010-10-19 03:48:22 -04:00
|
|
|
});
|