');
$('#themes').wrap(themes_wrapper).before(theme_box);
details.each(function() {
var box = this;
var a = $(document.createElement('a'));
a.attr('href','#');
a.attr('title',$('>div h3>label',this).text());
$(box).wrap(a);
$(box).parent().click(function(event) {
update_box(box);
event.preventDefault();
return false;
});
});
function update_box(e) {
theme_box.empty();
var img = $('div.theme-shot',e).clone();
var info = $('div.theme-info',e).clone();
if ($(e).hasClass('current-theme')) {
var actions = $('div.theme-actions',e).clone();
actions.show();
} else {
var actions = $('
');
if (submit_s.length > 0 && !$('input:radio',info).attr('disabled')) {
var select = $('
' + dotclear.msg.use_this_theme + '');
select.css('font-weight','bold').click(function() {
submit_s.click();
return false;
});
actions.append(select).append(' ');
}
if (submit_r.length > 0 && $('input:radio',info).attr('id') != 'theme_default') {
var remove = $('
' + dotclear.msg.remove_this_theme + '');
remove.click(function() {
var t_name = $(this).parents('#theme-box').find('div.theme-info h3:first').text();
t_name = $.trim(t_name);
if (window.confirm(dotclear.msg.confirm_delete_theme.replace('%s',t_name))) {
submit_r.click();
}
return false;
});
actions.append(remove);
}
}
$('input:radio',info).remove();
$('span, a',info).show();
theme_box.append(img).append(info).append(actions);
details.removeClass('theme-selected');
$(e).addClass('theme-selected');
$('input:radio',e).attr('checked','checked');
}
update_box(details[0]);
});