cd059357aba414960701e024af6bf8e4a1bb3936
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Resources / Public / JavaScript / Tabs.js
1 /*
2 * This file is part of the TYPO3 CMS project.
3 *
4 * It is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License, either version 2
6 * of the License, or any later version.
7 *
8 * For the full copyright and license information, please read the
9 * LICENSE.txt file that was distributed with this source code.
10 *
11 * The TYPO3 project - inspiring people to share!
12 */
13 define(["require","exports","jquery","./Storage/Client","bootstrap"],function(t,e,r,i){"use strict";return new(function(){function t(){this.cacheTimeInSeconds=1800,this.storeLastActiveTab=!0,this.storage=i;var t=this;r(".t3js-tabs").each(function(){var e=r(this);t.storeLastActiveTab=1===e.data("storeLastTab");var i=t.receiveActiveTab(e.attr("id"));i&&e.find('a[href="'+i+'"]').tab("show"),e.on("show.bs.tab",function(e){if(t.storeLastActiveTab){var r=e.currentTarget.id,i=e.target.hash;t.storeActiveTab(r,i)}})})}return t.getTimestamp=function(){return Math.round((new Date).getTime()/1e3)},t.prototype.receiveActiveTab=function(e){var r=this.storage.get(e)||"";return(this.storage.get(e+".expire")||0)>t.getTimestamp()?r:""},t.prototype.storeActiveTab=function(e,r){this.storage.set(e,r),this.storage.set(e+".expire",t.getTimestamp()+this.cacheTimeInSeconds)},t}())});