/*************************************************************** * Copyright notice * * (c) 2012 Alexander Kellner , in2code * * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is * free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * The GNU General Public License can be found at * http://www.gnu.org/copyleft/gpl.html. * * This script is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ jQuery(document).ready(function($) { $.fn.powermailTabs = function(options) { 'use strict'; var $form = jQuery(this); options = jQuery.extend({ container: 'fieldset', header: 'legend', tabs: true, navigation: true, openTabOnError: true, tabIndex: true, tabMenuClassName: 'powermail_tabmenu', tabMenuActiveClassName: 'act' }, options); showOnlyFirstFieldset($form, options); generateTabNavigation($form, options); generateButtonNavigation($form, options); cleanAndAddErrorClassToTabs($form, options); openTabWithError($form, options); }; /** * initial show first fieldset * * @param {object} $form Complete form object * @param {array} options * @returns {void} */ function showOnlyFirstFieldset($form, options) { hideAllFieldsets($form, options); $form.find(options.container).first().show(); } /** * Generate Tabs * * @param {jQuery} $form Complete form object * @param {array} options * @return {void} */ function generateTabNavigation($form, options) { if (!options.tabs) { return; } // generate menu var $tabMenu = $('