2010-09-24 20:50:31 +02:00
|
|
|
var ThemeViewer;
|
|
|
|
|
|
|
|
(function($){
|
|
|
|
ThemeViewer = function( args ) {
|
|
|
|
|
|
|
|
function init() {
|
|
|
|
$( '#filter-click, #mini-filter-click' ).unbind( 'click' ).click( function() {
|
|
|
|
$( '#filter-click' ).toggleClass( 'current' );
|
2010-11-23 21:17:22 +01:00
|
|
|
$( '#filter-box' ).slideToggle();
|
2010-09-24 20:50:31 +02:00
|
|
|
$( '#current-theme' ).slideToggle( 300 );
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2010-11-23 21:17:22 +01:00
|
|
|
$( '#filter-box :checkbox' ).unbind( 'click' ).click( function() {
|
2010-11-23 21:20:44 +01:00
|
|
|
var count = $( '#filter-box :checked' ).length,
|
|
|
|
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 + ')' );
|
2010-09-24 20:50:31 +02:00
|
|
|
});
|
2010-11-23 21:17:22 +01:00
|
|
|
|
|
|
|
$('#filter-box :submit').unbind( 'click' ).click(function() {
|
|
|
|
var features = [];
|
|
|
|
$('#filter-box :checked').each(function() {
|
|
|
|
features.push($(this).val());
|
|
|
|
});
|
|
|
|
|
|
|
|
listTable.update_rows({'features': features}, true, function() {
|
|
|
|
$( '#filter-click' ).toggleClass( 'current' );
|
|
|
|
$( '#filter-box' ).slideToggle();
|
|
|
|
$( '#current-theme' ).slideToggle( 300 );
|
|
|
|
});
|
|
|
|
|
|
|
|
return false;
|
|
|
|
});
|
2010-09-24 20:50:31 +02:00
|
|
|
}
|
2010-10-21 21:55:28 +02:00
|
|
|
|
2010-09-24 20:50:31 +02: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-11-23 01:06:15 +01:00
|
|
|
});
|