this.storage = Client;
const that = this;
- $('.t3js-tabs').each(function(this: Element): void {
- const $tabContainer: JQuery = $(this);
- that.storeLastActiveTab = $tabContainer.data('storeLastTab') === 1;
- const currentActiveTab = that.receiveActiveTab($tabContainer.attr('id'));
- if (currentActiveTab) {
- $tabContainer.find('a[href="' + currentActiveTab + '"]').tab('show');
- }
- $tabContainer.on('show.bs.tab', (e: any) => {
- if (that.storeLastActiveTab) {
- const id = e.currentTarget.id;
- const target = e.target.hash;
- that.storeActiveTab(id, target);
+ $((): void => {
+ $('.t3js-tabs').each(function(this: Element): void {
+ const $tabContainer: JQuery = $(this);
+ that.storeLastActiveTab = $tabContainer.data('storeLastTab') === 1;
+ const currentActiveTab = that.receiveActiveTab($tabContainer.attr('id'));
+ if (currentActiveTab) {
+ $tabContainer.find('a[href="' + currentActiveTab + '"]').tab('show');
}
+ $tabContainer.on('show.bs.tab', (e: any) => {
+ if (that.storeLastActiveTab) {
+ const id = e.currentTarget.id;
+ const target = e.target.hash;
+ that.storeActiveTab(id, target);
+ }
+ });
});
});
}
*
* The TYPO3 project - inspiring people to share!
*/
-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}())});
\ No newline at end of file
+define(["require","exports","jquery","./Storage/Client","bootstrap"],function(t,e,i,r){"use strict";return new(function(){function t(){this.cacheTimeInSeconds=1800,this.storeLastActiveTab=!0,this.storage=r;var t=this;i(function(){i(".t3js-tabs").each(function(){var e=i(this);t.storeLastActiveTab=1===e.data("storeLastTab");var r=t.receiveActiveTab(e.attr("id"));r&&e.find('a[href="'+r+'"]').tab("show"),e.on("show.bs.tab",function(e){if(t.storeLastActiveTab){var i=e.currentTarget.id,r=e.target.hash;t.storeActiveTab(i,r)}})})})}return t.getTimestamp=function(){return Math.round((new Date).getTime()/1e3)},t.prototype.receiveActiveTab=function(e){var i=this.storage.get(e)||"";return(this.storage.get(e+".expire")||0)>t.getTimestamp()?i:""},t.prototype.storeActiveTab=function(e,i){this.storage.set(e,i),this.storage.set(e+".expire",t.getTimestamp()+this.cacheTimeInSeconds)},t}())});
\ No newline at end of file