<commit_before>PlayList.render=function(){
	$('#playlist').show();
	PlayList.parent.empty();
	for(var i=0;i<PlayList.items.length;i++){
		var tr=PlayList.template.clone();
		var item=PlayList.items[i];
		if(i==PlayList.current){
			tr.addClass('current');
		}
		tr.removeClass('template');
		tr.data('name',item.name);
		tr.data('artist',item.artist);
		tr.data('album',item.album);
		tr.data('time',item.length);
		tr.data('plays',item.playcount);
		tr.children('td.name').children('span').text(item.name);
		tr.children('td.artist').text(item.artist);
		tr.children('td.album').text(item.album);
		var secconds=(item.length%60);
		if(secconds<10){
			secconds='0'+secconds;
		}
		var length=Math.floor(item.length/60)+':'+secconds;
		tr.children('td.time').text(length);
		tr.children('td.plays').text(item.playcount);
		tr.data('index',i);
		tr.click(function(){
			PlayList.play($(this).data('index'));
			PlayList.parent.children('tr').removeClass('current');
			$(this).addClass('current');
		});
		tr.hover(function(){
			var button=$('<img class="remove" title="Remove"/>');
			button.attr('src',OC.imagePath('core','actions/delete'));
			$(this).children().last().append(button);
			button.click(function(event){
				event.stopPropagation();
				event.preventDefault();
				var index=$(this).parent().parent().data('index');
				PlayList.remove(index);
			});
		},function(){
			$(this).children().last().children('img.remove').remove();
		});
		tr.children('td.name').children('input').click(function(event){
			event.stopPropagation();
			if($(this).attr('checked')){
				$(this).parent().parent().addClass('selected');
				if($('td.name input:checkbox').length==$('td.name input:checkbox:checked').length){
					$('#selectAll').attr('checked',true);
				}
			}else{
				$(this).parent().parent().removeClass('selected');
				$('#selectAll').attr('checked',false);
			}
			procesSelection();
		});
		PlayList.parent.append(tr);
	}
}
PlayList.getSelected=function(){
	return $('td.name input:checkbox:checked').parent().parent();
}
PlayList.hide=function(){
	$('#playlist').hide();
}

$(document).ready(function(){
	PlayList.parent=$('#playlist tbody');
	PlayList.template=$('#playlist tr.template');
	$('#selectAll').click(function(){
		if($(this).attr('checked')){
			// Check all
			$('td.name input:checkbox').attr('checked', true);
			$('td.name input:checkbox').parent().parent().addClass('selected');
		}else{
			// Uncheck all
			$('td.name input:checkbox').attr('checked', false);
			$('td.name input:checkbox').parent().parent().removeClass('selected');
		}
		procesSelection();
	});
});

function procesSelection(){
	var selected=PlayList.getSelected();
	if(selected.length==0){
		$('th.name span').text('Name');
		$('th.artist').text('Artist');
		$('th.album').text('Album');
		$('th.time').text('Time');
		$('th.plays').empty();
		$('th.plays').text('Plays');
	}else{
		var name=selected.length+' selected';
		var artist=$(selected[0]).data('artist');
		var album=$(selected[0]).data('album');
		var time=$(selected[0]).data('time');
		var plays=$(selected[0]).data('plays');
		for(var i=1;i<selected.length;i++){
			var item=$(selected[i]);
			if(artist!='mixed' && item.data('artist')!==artist){
				artist='mixed'
			}
			if(album!='mixed' && item.data('album')!==album){
				album='mixed'
			}<commit_msg>fix issue with selecting songs in playlist<commit_after>PlayList.render=function(){
	$('#playlist').show();
	PlayList.parent.empty();
	for(var i=0;i<PlayList.items.length;i++){
		var tr=PlayList.template.clone();
		var item=PlayList.items[i];
		if(i==PlayList.current){
			tr.addClass('current');
		}
		tr.removeClass('template');
		tr.data('name',item.name);
		tr.data('artist',item.artist);
		tr.data('album',item.album);
		tr.data('time',item.length);
		tr.data('plays',item.playcount);
		tr.children('td.name').children('span').text(item.name);
		tr.children('td.artist').text(item.artist);
		tr.children('td.album').text(item.album);
		var secconds=(item.length%60);
		if(secconds<10){
			secconds='0'+secconds;
		}
		var length=Math.floor(item.length/60)+':'+secconds;
		tr.children('td.time').text(length);
		tr.children('td.plays').text(item.playcount);
		tr.data('index',i);
		tr.click(function(){
			PlayList.play($(this).data('index'));
			PlayList.parent.children('tr').removeClass('current');
			$(this).addClass('current');
		});
		tr.hover(function(){
			var button=$('<img class="remove" title="Remove"/>');
			button.attr('src',OC.imagePath('core','actions/delete'));
			$(this).children().last().append(button);
			button.click(function(event){
				event.stopPropagation();
				event.preventDefault();
				var index=$(this).parent().parent().data('index');
				PlayList.remove(index);
			});
		},function(){
			$(this).children().last().children('img.remove').remove();
		});
		tr.children('td.name').children('input').click(function(event){
			event.stopPropagation();
			if($(this).attr('checked')){
				$(this).parent().parent().addClass('selected');
				if($('tbody td.name input:checkbox').length==$('tbody td.name input:checkbox:checked').length){
					$('#selectAll').attr('checked',true);
				}
			}else{
				$(this).parent().parent().removeClass('selected');
				$('#selectAll').attr('checked',false);
			}
			procesSelection();
		});
		PlayList.parent.append(tr);
	}
}
PlayList.getSelected=function(){
	return $('tbody td.name input:checkbox:checked').parent().parent();
}
PlayList.hide=function(){
	$('#playlist').hide();
}

$(document).ready(function(){
	PlayList.parent=$('#playlist tbody');
	PlayList.template=$('#playlist tr.template');
	$('#selectAll').click(function(){
		if($(this).attr('checked')){
			// Check all
			$('tbody td.name input:checkbox').attr('checked', true);
			$('tbody td.name input:checkbox').parent().parent().addClass('selected');
		}else{
			// Uncheck all
			$('tbody td.name input:checkbox').attr('checked', false);
			$('tbody td.name input:checkbox').parent().parent().removeClass('selected');
		}
		procesSelection();
	});
});

function procesSelection(){
	var selected=PlayList.getSelected();
	if(selected.length==0){
		$('th.name span').text('Name');
		$('th.artist').text('Artist');
		$('th.album').text('Album');
		$('th.time').text('Time');
		$('th.plays').empty();
		$('th.plays').text('Plays');
	}else{
		var name=selected.length+' selected';
		var artist=$(selected[0]).data('artist');
		var album=$(selected[0]).data('album');
		var time=$(selected[0]).data('time');
		var plays=$(selected[0]).data('plays');
		for(var i=1;i<selected.length;i++){
			var item=$(selected[i]);
			if(artist!='mixed' && item.data('artist')!==artist){
				artist='mixed'
			}
			if(album!='mixed' && item.data('album')!==album){
				album='mixed'
			}
{'fraction_non_alphanumeric': 0.25092798812175204, 'fraction_numerical': 0.004157386785449147, 'mean_word_length': 5.378787878787879, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, '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': '2327347', 'n_tokens_mistral': 2555, 'n_tokens_neox': 2281, 'n_words': 261}