Skip to content

Instantly share code, notes, and snippets.

@8lane
Created December 22, 2014 16:37
Show Gist options
  • Select an option

  • Save 8lane/e79d4d81aa9f1a6f302c to your computer and use it in GitHub Desktop.

Select an option

Save 8lane/e79d4d81aa9f1a6f302c to your computer and use it in GitHub Desktop.
Add 'All' tab to Category Tabs by IPS Themes
<!-- Category Tabs by IPS Themes -->
<if test="$this->settings['tcCategoryTabs_enabled'] == '1'">
<php>
$cats = $this->settings['tcCategoryTabs_tabCategories'];
</php>
<script type="text/javascript">
isjQuery = false;
if (!window.jQuery) {
document.write("<" + "script type='text/javascript' src='{$this->settings['css_base_url']}style_extra/ipsthemes_categoryTabs/js/jquery-1.9.1.min.js'></" + "script>");
isjQuery = true;
}
</script>
<script type="text/javascript">
if(isjQuery){
tcJq = jQuery.noConflict();
} else {
tcJq = jQuery;
}
jQuery(document).ready(function($) {
var catsList = '{$cats}',
catsArray = catsList.split(','),
cats = $('#category_'+catsArray.join(',#category_'));
cats.not(':first').hide();
cats.each(function () {
var anch = $(this).find('h3 a').eq(1).clone();
anch[0].rel = this.id;
$('<li/>').append(anch).appendTo('#tabs');
});
var link = $("<a/>",{href:"#",text:'All',class:"tab-all"});
$('#tabs').prepend($("<li/>").append(link));
var tl = $('#tabs a');
tl.on('click', function(e) {
e.preventDefault();
var catId = $(this).attr('rel');
tl.removeClass('active');
$(this).addClass('active');
cats.hide();
if($(this).hasClass('tab-all')) {
cats.show();
} else {
$(this).parent().parent().parent().find('#'+catId+'').show();
}
});
tl.first().trigger('click');
});
</script>
<if test="$this->settings['tcCategoryTabs_tabStyle'] == 'theme1'">
<link rel="stylesheet" type="text/css" href="{$this->settings['css_base_url']}style_extra/ipsthemes_categoryTabs/css/theme1.css" />
</if>
<if test="$this->settings['tcCategoryTabs_tabStyle'] == 'theme2'">
<link rel="stylesheet" type="text/css" href="{$this->settings['css_base_url']}style_extra/ipsthemes_categoryTabs/css/theme2.css" />
</if>
<if test="$this->settings['tcCategoryTabs_tabStyle'] == 'theme3'">
<link rel="stylesheet" type="text/css" href="{$this->settings['css_base_url']}style_extra/ipsthemes_categoryTabs/css/theme3.css" />
</if>
<if test="$this->settings['tcCategoryTabs_tabStyle'] == 'theme4'">
<link rel="stylesheet" type="text/css" href="{$this->settings['css_base_url']}style_extra/ipsthemes_categoryTabs/css/theme4.css" />
</if>
<if test="$this->settings['tcCategoryTabs_tabStyle'] == 'theme5'">
<link rel="stylesheet" type="text/css" href="{$this->settings['css_base_url']}style_extra/ipsthemes_categoryTabs/css/theme5.css" />
</if>
<if test="$this->settings['tcCategoryTabs_tabStyle'] == 'theme6'">
<link rel="stylesheet" type="text/css" href="{$this->settings['css_base_url']}style_extra/ipsthemes_categoryTabs/css/theme6.css" />
</if>
<if test="$this->settings['tcCategoryTabs_tabPosition'] == 'center'">
<style type="text/css">
#tabs { text-align: center; }
#tabs li { display: inline; float: none; }
#tabs li a { display: inline-block; }
</style>
</if>
<if test="$this->settings['tcCategoryTabs_tabPosition'] == 'right'">
<style type="text/css">
#tabs li { float: right !important; }
</style>
</if>
<if test="$this->settings['tcCategoryTabs_customTab'] == '1'">
<style type="text/css">
#tabs li a {
background: #{$this->settings['tcCategoryTabs_bgColour']} !important;
border: {$this->settings['tcCategoryTabs_borderWidth']} solid #{$this->settings['tcCategoryTabs_borderColour']} !important;
color: #{$this->settings['tcCategoryTabs_text']} !important;
text-shadow: 0 1px 1px #{$this->settings['tcCategoryTabs_textShadow']} !important;
-webkit-box-shadow: inset 0 1px 0 #{$this->settings['tcCategoryTabs_innerShadow']} !important;
-moz-box-shadow: inset 0 1px 0 #{$this->settings['tcCategoryTabs_innerShadow']} !important;
box-shadow: inset 0 1px 0 #{$this->settings['tcCategoryTabs_innerShadow']} !important;
-webkit-border-radius: {$this->settings['tcCategoryTabs_borderRadius']} !important;
-moz-border-radius: {$this->settings['tcCategoryTabs_borderRadius']} !important;
border-radius: {$this->settings['tcCategoryTabs_borderRadius']} !important;
margin: {$this->settings['tcCategoryTabs_margin']} !important;
}
#tabs li a.active {
background: #{$this->settings['tcCategoryTabs_activeBgColour']} !important;
border: {$this->settings['tcCategoryTabs_borderWidth']} solid #{$this->settings['tcCategoryTabs_activeBorderColour']} !important;
color: #{$this->settings['tcCategoryTabs_activeText']} !important;
text-shadow: 0 1px 1px #{$this->settings['tcCategoryTabs_activeTextShadow']} !important;
-webkit-box-shadow: inset 0 1px 0 #{$this->settings['tcCategoryTabs_activeInnerShadow']} !important;
-moz-box-shadow: inset 0 1px 0 #{$this->settings['tcCategoryTabs_activeInnerShadow']} !important;
box-shadow: inset 0 1px 0 #{$this->settings['tcCategoryTabs_activeInnerShadow']} !important;
}
</style>
</if>
</if>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment