<commit_before>angular.module('mean.rooms').factory("WindowHandler",[function(){
	

	return function (){
	
		var defaultRelations = [{x:4,y:3},{x:16,y:9}];
		var e= null;

		this.getDefaultWidth = function (winscale){
			return window.innerWidth * winscale;
		}
		this.getDefaultHeight = function(winratio,winscale){
			if (window.innerWidth <= 800) winscale = 0.75;

			var width = this.getDefaultWidth (winscale);
			return (width / defaultRelations[winratio].x * defaultRelations[winratio].y);
		}

		this.getCentered = function (width){
			return  ((window.innerWidth - width) / 2);
		}

		this.getSomeYPosition = function (){
			var winCount = $("wmwindow").length;
			return 80 + (20*winCount);
		}

		this.create = function ($scope,mediaElement,winTitle,source,winratio,winscale,closeable,onopen,onclose){
		
			var winWidth = this.getDefaultWidth(winscale);
			var winHeight = this.getDefaultHeight(winratio,winscale);
			
			var options = {
				position: {
					x: this.getCentered(winWidth),
					y: this.getSomeYPosition ()
				},
				size : {
					width: winWidth,
					height: winHeight
				},
				windowContainer: 'moveZone',
				maximizeTo: 'moveZone',
				title: winTitle,
				initialZIndex: 500
			};
			
			var open = function (win){
				var container = win.elem.find('video').parent();	
				win.elem.find('video').remove();
				container.append (mediaElement);
				window.winHandler = win;
				onopen(window);
			};	
			
			var close = function (win){
				onclose(window);
				for (i = 0; i< $scope.windows.length; i++){
					if (window === $scope.windows[i]){
						$scope.windows.splice(i,1);	
					}
				}
				
				//We also try to enable videos after a close
				setTimeout(function() {selWindow();}, 100);
			};
			
			var window = {
				options: options,
				title: winTitle,
				mediaElement: mediaElement,
				close: close,
				closeable: (closeable===undefined) ? false : closeable,
				open: open,
			};
			
			$scope.windows.unshift (window);

		};
		
		this.init = function ($scope){
			$scope.windows = [];
		}

	};
}]);
<commit_msg>Reenable all videos when a window is selected. Fixed #64<commit_after>angular.module('mean.rooms').factory("WindowHandler",[function(){
	

	return function (){
	
		var defaultRelations = [{x:4,y:3},{x:16,y:9}];
		var e= null;

		this.getDefaultWidth = function (winscale){
			return window.innerWidth * winscale;
		}
		this.getDefaultHeight = function(winratio,winscale){
			if (window.innerWidth <= 800) winscale = 0.75;

			var width = this.getDefaultWidth (winscale);
			return (width / defaultRelations[winratio].x * defaultRelations[winratio].y);
		}

		this.getCentered = function (width){
			return  ((window.innerWidth - width) / 2);
		}

		this.getSomeYPosition = function (){
			var winCount = $("wmwindow").length;
			return 80 + (20*winCount);
		}

		this.create = function ($scope,mediaElement,winTitle,source,winratio,winscale,closeable,onopen,onclose){
		
			var winWidth = this.getDefaultWidth(winscale);
			var winHeight = this.getDefaultHeight(winratio,winscale);
			
			var options = {
				position: {
					x: this.getCentered(winWidth),
					y: this.getSomeYPosition ()
				},
				size : {
					width: winWidth,
					height: winHeight
				},
				windowContainer: 'moveZone',
				maximizeTo: 'moveZone',
				title: winTitle,
				initialZIndex: 500
			};
			
			var open = function (win){
				var container = win.elem.find('video').parent();	
				win.elem.find('video').remove();
				container.append (mediaElement);
				window.winHandler = win;
				onopen(window);
			};	
			
			var close = function (win){
				onclose(window);
				for (i = 0; i< $scope.windows.length; i++){
					if (window === $scope.windows[i]){
						$scope.windows.splice(i,1);	
					}
				}
				
				//We also try to enable videos after a close
				setTimeout(function() {selWindow();}, 100);
			};
			
				var selWindow = function (win){
					//There is a perverse effect on window selection that pauses the video, lets play all 
					var videos = document.getElementsByTagName('video');
					for (i = 0; i< videos.length; i++){
						videos[i].play();	
					}
				};
			
			var window = {
				options: options,
				title: winTitle,
				mediaElement: mediaElement,
				close: close,
				closeable: (closeable===undefined) ? false : closeable,
				selectwindow: selWindow,
				open: open,
			};
			
			$scope.windows.unshift (window);

		};
		
		this.init = function ($scope){
			$scope.windows = [];
		}

	};
}]);

{'fraction_non_alphanumeric': 0.1473613595706619, 'fraction_numerical': 0.011404293381037567, 'mean_word_length': 3.088665447897623, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 3, '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': '6796756', 'n_tokens_mistral': 1878, 'n_tokens_neox': 1448, 'n_words': 312}