<commit_before>

// pages
angular.module('locations', []).
	config(function($routeProvider) {
		$routeProvider.
			when('/', {controller:GalleryCtrl, templateUrl:'/partials/home.html'}).
			otherwise({redirectTo:'/'});
	}).
	directive('mediaItemDirective', function() {
	  return {
	  	controller: function ($scope) {
	  		$scope.active = true;
	  		$scope.audio = {'playing': false, 'Volumn': 0};
	  		$scope.yPosition = {'start': 0, 'end': 0};
	  		console.log($scope);
	  	},
	  	template:
	  		'<div id="item-{{item.name}}" class="location-item" audio-mixer>'+
			'	<h2>{{item.name}}</h2>'+
			'	<img src="{{item.imagePath}}" alt="{{item.name}}" width="100%">'+
			'	<audio src="{{item.audioPath}}" id="audio-{{item.name}}" loop>'+
			'		<p>Your browser does not support the audio element. Please upgrade.</p>'+
			'	</audio>'+
			'</div>'
	  };
	}).
	directive('audioMixer', function () {
		return function ($scope, element, attrs) {
		
			$(window).scroll(function() {
				var	elementPosition = element.offset(),
					elementHeight = element.height(),
					browserHeight = $(window).height(),
					scrollPosition = $('body').scrollTop(),
					viewportCenter = scrollPosition + (browserHeight / 2);

				if( viewportCenter >= elementPosition.top && viewportCenter <= (elementPosition.top + elementHeight) ){
					document.getElementById('audio-'+$scope.item.name).play();
					console.log($scope.item.name);
				}
				if( viewportCenter < elementPosition.top || viewportCenter > (elementPosition.top + elementHeight) ){
					document.getElementById('audio-'+$scope.item.name).pause();
				}	
			});

		}
	});

function GalleryCtrl($scope, $http) {
	$scope.audio = function () {
		var items = $('.location-item');
		console.log(items);
		$.each( items, function(index, value) {<commit_msg>added fade<commit_after>

// pages
angular.module('locations', []).
	config(function($routeProvider) {
		$routeProvider.
			when('/', {controller:GalleryCtrl, templateUrl:'/partials/home.html'}).
			otherwise({redirectTo:'/'});
	}).
	directive('mediaItemDirective', function() {
	  return {
	  	controller: function ($scope) {
	  		$scope.active = true;
	  		$scope.audio = {'playing': false, 'Volumn': 0};
	  		$scope.yPosition = {'start': 0, 'end': 0};
	  		console.log($scope);
	  	},
	  	template:
	  		'<div id="item-{{item.name}}" class="location-item" audio-mixer>'+
			'	<h2>{{item.name}}</h2>'+
			'	<img src="{{item.imagePath}}" alt="{{item.name}}" width="100%">'+
			'	<audio src="{{item.audioPath}}" id="audio-{{item.name}}" loop>'+
			'		<p>Your browser does not support the audio element. Please upgrade.</p>'+
			'	</audio>'+
			'</div>'
	  };
	}).
	directive('audioMixer', function () {
		return function ($scope, element, attrs) {
			$(window).scroll(function() {
				var	elementPosition = element.offset(),
					elementHeight = element.height(),
					browserHeight = $(window).height(),
					scrollPosition = $('body').scrollTop(),
					sound = document.getElementById('audio-'+$scope.item.name),
					viewportCenter = scrollPosition + (browserHeight / 2);

				if( viewportCenter >= elementPosition.top && viewportCenter <= (elementPosition.top + elementHeight)){
					sound.play();
					if(sound.volume < 1){
						sound.volume  = (sound.volume+=0.1).toFixed(1);						
					}
					$scope.audio.playing = true;
				}

				if( viewportCenter < elementPosition.top || viewportCenter > (elementPosition.top + elementHeight) && $scope.audio.playing == true){
					if(sound.volume > 0){
						sound.volume  = (sound.volume-=0.1).toFixed(1);						
					}
				}	
			});

		}
	});

function GalleryCtrl($scope, $http) {
	$scope.audio = function () {
		var items = $('.location-item');
		console.log(items);
		$.each( items, function(index, value) {
{'fraction_non_alphanumeric': 0.2017590618336887, 'fraction_numerical': 0.006929637526652452, 'mean_word_length': 3.627620221948212, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2601341', 'n_tokens_mistral': 1446, 'n_tokens_neox': 1215, 'n_words': 219}