From c139a324d181213bde724c4f00cd4eac1cc1e3a2 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Sat, 8 Aug 2015 11:39:48 +1000 Subject: [PATCH] Tidy up code - refs #1318 --- modules/system/assets/ui/js/tab.js | 24 ++++++++++++++---------- modules/system/assets/ui/storm-min.js | 14 +++++++------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/modules/system/assets/ui/js/tab.js b/modules/system/assets/ui/js/tab.js index cf3ef60d3..1c8fb85b0 100644 --- a/modules/system/assets/ui/js/tab.js +++ b/modules/system/assets/ui/js/tab.js @@ -86,18 +86,25 @@ tabIndex = $tabs.index(li), time = new Date().getTime(), targetId = this.tabId + '-tab-' + tabIndex + time, - $a = $('a', li) + $anchor = $('a', li) - $a.attr('data-target', '#'+targetId).attr('data-toggle', 'tab') - if (!$a.attr('title')) - $a.attr('title', $a.text()) + $anchor + .data('target', '#'+targetId) + .attr('data-target', '#'+targetId) + .attr('data-toggle', 'tab') - var html = $a.html() + if (!$anchor.attr('title')) + $anchor.attr('title', $anchor.text()) - $a.html('') - $a.append($('').append($('').html(html))) + var html = $anchor.html() + + $anchor.html('') + $anchor + .append($('') + .append($('').html(html))) var pane = $('> .tab-pane', this.$pagesContainer).eq(tabIndex).attr('id', targetId) + $(li).append($('×').click(function(){ $(this).trigger('close.oc.tab') return false @@ -158,9 +165,6 @@ this.initTab($tab) - $link.data('title', $link.attr('data-title')) - $link.data('target', $link.attr('data-target')) - this.updateClasses() } diff --git a/modules/system/assets/ui/storm-min.js b/modules/system/assets/ui/storm-min.js index 2a347942d..dec0d1b98 100644 --- a/modules/system/assets/ui/storm-min.js +++ b/modules/system/assets/ui/storm-min.js @@ -3811,13 +3811,13 @@ if(this.options.slidable){this.$pagesContainer.touchwipe({wipeRight:function(){s this.$tabsContainer.toolbar({scrollClassContainer:this.$el}) this.updateClasses()} Tab.prototype.initTab=function(li){var -$tabs=$('>li',this.$tabsContainer),tabIndex=$tabs.index(li),time=new Date().getTime(),targetId=this.tabId+'-tab-'+tabIndex+time,$a=$('a',li) -$a.attr('data-target','#'+targetId).attr('data-toggle','tab') -if(!$a.attr('title')) -$a.attr('title',$a.text()) -var html=$a.html() -$a.html('') -$a.append($('').append($('').html(html))) +$tabs=$('>li',this.$tabsContainer),tabIndex=$tabs.index(li),time=new Date().getTime(),targetId=this.tabId+'-tab-'+tabIndex+time,$anchor=$('a',li) +$anchor.data('target','#'+targetId).attr('data-target','#'+targetId).attr('data-toggle','tab') +if(!$anchor.attr('title')) +$anchor.attr('title',$anchor.text()) +var html=$anchor.html() +$anchor.html('') +$anchor.append($('').append($('').html(html))) var pane=$('> .tab-pane',this.$pagesContainer).eq(tabIndex).attr('id',targetId) $(li).append($('×').click(function(){$(this).trigger('close.oc.tab') return false}))