jQuery(document).ready(function($) { try { $('.b3theme-color-option').wpColorPicker(); } finally {} $('ul.b3theme-settings-tabs a').bind('click', function(index){ $('ul.b3theme-settings-tabs li').removeClass('tab-active'); $(this).parent().addClass('tab-active'); if ( $(this).attr('href') == '#b3theme-display-all') { $('.b3theme-settings-section').show(); } else { $('.b3theme-settings-section').hide(); $('.' + $( this ).attr('href').substring(1) ).toggle(); } $('.b3theme-slides textarea').each(function(index, elem) { b3theme_add_quicktags(elem.getAttribute('id')); }); return false; }); }); window.qtjs = location.href; qtjs = qtjs.substring(0, qtjs.indexOf('/wp-admin')) + '/wp-includes/js/quicktags.js'; /* Adds quicktags to the textarea identified by id */ function b3theme_add_quicktags(id) { if (!jQuery('#qt_'+ id + '_toolbar').length) { jQuery('').insertBefore('#'+id); quicktags({id: id, buttons: 'strong,em,link,block,del,ins,ul,ol,li,code,close'}); } } function b3theme_reset() { if (confirm(b3theme_admin.reset)) { jQuery('#b3theme_action').val('reset'); jQuery('#b3theme_options_form').submit(); } } function b3theme_upload() { if (confirm(b3theme_admin.upload)) { jQuery('#b3theme_action').val('upload'); jQuery('#b3theme_options_form').submit(); } } function b3theme_remove_slide(i) { if (confirm(b3theme_admin.slide_remove)) { jQuery('#slide-' + i).remove(); } return false; } function b3theme_add_new_slide() { var i = 0; var html, id; var after = '.b3theme-slides h3'; var slides = jQuery('.b3theme-slides > div'); slides.each(function(index, elem) { id = jQuery(elem).attr('id'); i = Math.max(i, id.substring(6)); after = '#'+ id; }); i++; html = '
' + '
'; html += '' + '
' + ''; html += ''; html += ''; html += '' + '
'; html += '' + '