Created
November 4, 2015 08:44
-
-
Save asyndrige/96c4f6824fd0c1e97284 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
oscar.init(); | |
var $hrefs = ['#tab-child', '#tab-adult']; | |
$hrefs.map(function($link){ | |
$('a[href='+$link+']').click(function(e) { | |
e.preventDefault(); | |
$hrefs.map(function($$link) { | |
$('a[href='+$$link+']').removeClass('active'); | |
$($$link).hide(); | |
}); | |
$($link).show(); | |
$('.order-lesson '+'a[href='+$link+']').addClass('active'); | |
}) | |
}); | |
var childTypes = ['#filial0', '#filial1', '#filial2', '#filial3', '#filial4', '#filial5', ]; | |
var adultTypes = ['#filial0', ]; | |
var childFilials = ['#day0', '#day1', '#day2', '#day3', '#day4', '#day5', '#day6', '#day7', '#day8', '#day9', '#day10', '#day11', '#day12', '#day13', '#day0', '#day0', '#day0', '#day0', '#day1', '#day0', ]; | |
var adultFilials = ['#day0', '#day1', ]; | |
var scheduleType = function(type, filials) { | |
type.map(function($link) { | |
$('a[href='+$link+']').click(function(e) { | |
var visibleFilial = $('.active-filial').attr('href'); | |
e.preventDefault(); | |
type.map(function($$link) { | |
$('a[href='+$$link+']').removeClass('active-type'); | |
$('.filial-day-wrapper'+$$link.replace("#", ".")).hide(); | |
}); | |
$('.filial-day-wrapper'+$link.replace('#', '.')).show(); | |
$('.filial-day-wrapper'+$link.replace('#', '.')+' a').first().addClass('active-filial'); | |
$('.filial-day-wrapper'+$link.replace('#', '.')+' .day0').show(); | |
$('.programms-types '+'a[href='+$link+']').addClass('active-type'); | |
}); | |
}); | |
} | |
var scheduleFilial = function(filials, tab_id) { | |
filials.map(function($link){ | |
$(tab_id+' a[href='+$link+']').click(function(e) { | |
var filial0 = $(this).parent().parent().parent().parent().attr('class'); | |
var filial = filial0.replace(' filial', '.filial').replace('filial', '.filial'); | |
e.preventDefault(); | |
filials.map(function($$link) { | |
$('a[href='+$$link+']').removeClass('active-filial'); | |
}); | |
$('.tab-day-wrapper').hide(); | |
$(tab_id+' '+filial+' .tab-day-wrapper'+$link.replace("#", ".")).show(); | |
console.log(tab_id+' '+filial+' .tab-day-wrapper'+$link.replace("#", ".")); | |
$(tab_id+' '+filial+' a[href='+$link+']').addClass('active-filial'); | |
console.log(tab_id+' '+filial+' a[href='+$link+']'); | |
}); | |
}); | |
} | |
scheduleType(childTypes, childFilials); | |
scheduleType(adultTypes, adultFilials); | |
scheduleFilial(childFilials, '#tab-child'); | |
scheduleFilial(adultFilials, '#adult-child'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment