<commit_before>API_KEY = "<KEY>"
TABLE = "1aj96ZD5RpRDWKlO4r2rmaWfabTK7efaUG4zrdMA"
QUERY = encodeURIComponent "select * from #{TABLE}"
TABLE_URL = "https://www.googleapis.com/fusiontables/v1/query?key=#{API_KEY}&sql=#{QUERY}"

ABOUT_URL = "https://raw.github.com/aditibhatia/portfolio-content/master/about.md"
CONTACT_URL = "https://raw.github.com/aditibhatia/portfolio-content/master/contact.md"

$ ->
	$.fancybox.showLoading()

$ ->
	$(document).on 'click', 'a', (e) ->
		if e.target.host isnt document.location.host
			e.target.target = '_blank'

$ ->

	$('.navSection').not('#projects').hide()
	$('.btnTop').hide()

	$.getJSON '/md/' + encodeURIComponent(ABOUT_URL), (data) ->
		console.log data
		$('#about').html data.html

	$.getJSON '/md/' + encodeURIComponent(CONTACT_URL), (data) ->
		console.log data
		$('#contact').html data.html

	$.getJSON TABLE_URL, (data) ->

		$.fancybox.hideLoading()

		console.log "Data:", data

		numColumns = data.columns.length
		projects = []

		for row in data.rows
			project = {}
			c = 0
			while c < numColumns
				project[data.columns[c]] = row[c] unless not row[c]
				c++
			projects.push project

		console.log "Projects:", projects

		$projects = $('#projects')
		$projects.empty()

		for project in projects
			continue unless project.thumbnail
			thumbnails = project.thumbnail.split ' '

			$project = $('<a>').addClass('project all').addClass(project.type)
			$img = $('<img>').attr('src', thumbnails[0]).addClass 'img-rounded img-responsive'
			$project.append $img
			$img.hide()

			$img.load (e) ->
				$(this).parent().appendTo $projects
				$(this).fadeIn()
				checkBtnTopOffset()

			$project.attr 'title', project.name

			fancyBoxOptions = {}

			switch project.type

				when 'design', 'art'
					$project.attr 'href', project.image or thumbnails[0]

				when 'web'
					$project.attr 'href', project.externalLink
					$project.addClass 'fancybox.iframe'
					fancyBoxOptions =
						width: '100%'

				when 'video'
					$project.attr 'href', "http://www.youtube.com/embed/#{project.video}?autoplay=1"
					$project.addClass 'fancybox.iframe'

			if project.comment
				fancyBoxOptions.afterLoad = ((comment) ->
					->
						$comment = $('<div>').addClass('comment').html(comment)
						this.outer.append $comment
						true
				)(project.comment)

			$project.fancybox fancyBoxOptions

	$('.filterButton').click (e) ->
		$button = $(e.target)
		filter = $button.attr('x-filter')
		$('.project').hide()
		$('.project').filter(".#{filter}").fadeIn(600)
		$('.filterButton').removeClass 'active'
		$button.addClass 'active'
		checkBtnTopOffset()

	$('.navButton#btnPortfolio').click (e) ->
		$('.navSection').not('#projects').slideUp()
		$('.navButton').removeClass('active')
		$(e.target).addClass('active')
		checkBtnTopOffset()

	$('.navButton').not('#btnPortfolio').click (e) ->
		$button = $(e.target)
		section = $button.attr('x-section')
		$section = $("##{section}")
		if $section.is(":visible")
			$section.slideUp()
			$button.removeClass('active')
		else
			$section.slideDown()
			$button.addClass('active')
		checkBtnTopOffset()

	$('.btnTop').click ->
		$(document).scrollTop 0

	checkBtnTopOffset = ->
		if $(window).height() > $('.footer').offset().top
			$('.btnTop').hide()
		else
			$('.btnTop').show()
<commit_msg>show only one content section at a time<commit_after>API_KEY = "<KEY>"
TABLE = "1aj96ZD5RpRDWKlO4r2rmaWfabTK7efaUG4zrdMA"
QUERY = encodeURIComponent "select * from #{TABLE}"
TABLE_URL = "https://www.googleapis.com/fusiontables/v1/query?key=#{API_KEY}&sql=#{QUERY}"

ABOUT_URL = "https://raw.github.com/aditibhatia/portfolio-content/master/about.md"
CONTACT_URL = "https://raw.github.com/aditibhatia/portfolio-content/master/contact.md"

$ ->
	$.fancybox.showLoading()

$ ->
	$(document).on 'click', 'a', (e) ->
		if e.target.host isnt document.location.host
			e.target.target = '_blank'

$ ->

	$('.navSection').not('#projects').hide()
	$('.btnTop').hide()

	$.getJSON '/md/' + encodeURIComponent(ABOUT_URL), (data) ->
		console.log data
		$('#about').html data.html

	$.getJSON '/md/' + encodeURIComponent(CONTACT_URL), (data) ->
		console.log data
		$('#contact').html data.html

	$.getJSON TABLE_URL, (data) ->

		$.fancybox.hideLoading()

		console.log "Data:", data

		numColumns = data.columns.length
		projects = []

		for row in data.rows
			project = {}
			c = 0
			while c < numColumns
				project[data.columns[c]] = row[c] unless not row[c]
				c++
			projects.push project

		console.log "Projects:", projects

		$projects = $('#projects')
		$projects.empty()

		for project in projects
			continue unless project.thumbnail
			thumbnails = project.thumbnail.split ' '

			$project = $('<a>').addClass('project all').addClass(project.type)
			$img = $('<img>').attr('src', thumbnails[0]).addClass 'img-rounded img-responsive'
			$project.append $img
			$img.hide()

			$img.load (e) ->
				$(this).parent().appendTo $projects
				$(this).fadeIn()
				checkBtnTopOffset()

			$project.attr 'title', project.name

			fancyBoxOptions = {}

			switch project.type

				when 'design', 'art'
					$project.attr 'href', project.image or thumbnails[0]

				when 'web'
					$project.attr 'href', project.externalLink
					$project.addClass 'fancybox.iframe'
					fancyBoxOptions =
						width: '100%'

				when 'video'
					$project.attr 'href', "http://www.youtube.com/embed/#{project.video}?autoplay=1"
					$project.addClass 'fancybox.iframe'

			if project.comment
				fancyBoxOptions.afterLoad = ((comment) ->
					->
						$comment = $('<div>').addClass('comment').html(comment)
						this.outer.append $comment
						true
				)(project.comment)

			$project.fancybox fancyBoxOptions

	$('.filterButton').click (e) ->
		$button = $(e.target)
		filter = $button.attr('x-filter')
		$('.project').hide()
		$('.project').filter(".#{filter}").fadeIn(600)
		$('.filterButton').removeClass 'active'
		$button.addClass 'active'
		checkBtnTopOffset()

	$('.navButton#btnPortfolio').click (e) ->
		$('.navSection').not('#projects').slideUp()
		$('.navButton').not('#btnPortfolio').removeClass('active')
		checkBtnTopOffset()

	$('.navButton').not('#btnPortfolio').click (e) ->
		$button = $(e.target)
		section = $button.attr('x-section')
		$section = $("##{section}")
		if $section.is(":visible")
			$section.slideUp()
			$button.removeClass('active')
		else
			$('.navSection').not('#projects').slideUp()
			$('.navButton').not('#btnPortfolio').removeClass('active')
			$section.slideDown()
			$button.addClass('active')
		checkBtnTopOffset()

	$('.btnTop').click ->
		$(document).scrollTop 0

	checkBtnTopOffset = ->
		if $(window).height() > $('.footer').offset().top
			$('.btnTop').hide()
		else
			$('.btnTop').show()

{'fraction_non_alphanumeric': 0.19762081784386618, 'fraction_numerical': 0.005947955390334572, 'mean_word_length': 3.8042857142857143, 'pattern_counts': {'":': 2, '<': 13, '<?xml version=': 0, '>': 43, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '874820', 'n_tokens_mistral': 2679, 'n_tokens_neox': 2296, 'n_words': 392}