<commit_before>$(".Options").each(function checkForVideo(url) {

	var ProductCatOpt = $(this);
		ProductId = $(this).parent().parent().find('div.ProductImage').attr('data-product');

	function ajax1() {
	    return $.ajax('/content/videos/'+ProductId+'.mp4')
		    .done(function() { 
		        $(ProductCatOpt).addClass('withVideo');
		    }).fail(function() { 
		    	return;
		    });
		}
		$.when(ajax1()).done(function(a1){

	        $('.withVideo').closest('li').append('<span class="videoDemoBtn"><div class="triangle"></div></span>');
	
	        $('.videoDemoBtn').click(function() {    
	
	        if($(this).hasClass('videoPlaying')) {
	            $(this).removeClass('videoPlaying');
/* 	            $(this).parent().find('img').show(); */
	            $(this).parent().find('div.categoryDemoVideo').hide().html('');
	            }
	            else {
	        
	                var ProductId = $(this).parent().find('div.ProductImage').attr('data-product');
	                $(this).addClass('videoPlaying');
/* 	                $(this).parent().find('img').hide();         */
	                $(this).parent().find('div.categoryDemoVideo').show().html('<video id="demoVideo" class="video" preload="auto" autoplay="autoplay" loop="loop" autobuffer="autobuffer" muted="muted" controls="controls" width="100%" height="100%" poster="https://store-mixi7d.mybigcommerce.com/content/videos/'+ProductId+'.jpg"><source src="https://store-mixi7d.mybigcommerce.com/content/videos/'+ProductId+'.mp4"><source src="https://store-mixi7d.mybigcommerce.com/content/videos/'+ProductId+'.ogv" type="video/ogg"><p>Your browser does not support this video.  Please upgrade your browser!</p></video>');
	                        }
	                        
                        	var video = document.getElementById('demoVideo');
							video.addEventListener('click',function(){
							  video.play();
							},false);
	                        
	                });

            });




        });<commit_msg>Fixed duplicate button bug<commit_after>	$('.ProductList').on('click', '.videoDemoBtn', function () {
	        if ($(this).hasClass('videoPlaying')) {
	            $(this).removeClass('videoPlaying');
/* 	            $(this).parent().find('img').show(); */
	            $(this).parent().find('div.categoryDemoVideo').hide().html('');
	            }
	            else {
	                var ProductId = $(this).parent().find('div.ProductImage').attr('data-product');
	                $(this).addClass('videoPlaying');
/* 	                $(this).parent().find('img').hide();         */
	                $(this).parent().find('div.categoryDemoVideo').show().html(
	                	'<video id="demoVideo" class="video" preload="auto" autoplay="autoplay" loop="loop" autobuffer="autobuffer" muted="muted" controls="controls" width="100%" height="100%" poster="/content/videos/'+ProductId+'.jpg">'+
	                		'<source src="/content/videos/'+ProductId+'.mp4">'+
	                		'<source src="/content/videos/'+ProductId+'.ogv" type="video/ogg">'+
	                		'<p>Your browser does not support this video.  Please upgrade your browser!</p>'+
	                	'</video>');
	                        }
/*
                        	var video = document.getElementById('demoVideo');
							video.addEventListener('click',function(){
							  video.play();
							},false);
*/
	                });

	$(".Options").each(function checkForVideo(url) {
		var ProductCatOpt = $(this);
			ProductId = $(this).parent().parent().find('div.ProductImage').attr('data-product');
		function ajax1() {
		    return $.ajax('/content/videos/'+ProductId+'.mp4')
			    .done(function() { 
			        ProductCatOpt.addClass('withVideo');
			    }).fail(function() { 
			    	return;
			    });
			}
			$.when(ajax1()).done(function(a1){
		        ProductCatOpt.closest('li').append('<span class="videoDemoBtn"><div class="triangle"></div></span>');
	        });
	    });
{'fraction_non_alphanumeric': 0.20433905146316853, 'fraction_numerical': 0.006306760847628658, 'mean_word_length': 2.391787852865697, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 3, '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': '6509743', 'n_tokens_mistral': 1265, 'n_tokens_neox': 1084, 'n_words': 134}