<commit_before>var CamMan=function(){navigator.getUserMedia=function(){return navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||false}();window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback){window.setTimeout(callback,1e3/60)}}();window.URL=function(){return window.URL||window.webkitURL||false}();var CamMan=function CamMan(options){this.snapshots=[];this.canvasStorage=[];this.video=null;this.events={};this.stream=null;this.options={audio:false,container:null};this.setOptions(options);return this};CamMan.prototype.createCanvas=function createCanvas(callback){var width=this.video.videoWidth;var height=this.video.videoHeight;if(width&&height){var canvas=document.createElement("canvas");canvas.width=width;canvas.height=height;var canvasEntry={canvas:canvas,context:canvas.getContext("2d"),onFrame:callback};if(this.canvasStorage.length===0)this.updateCanvas();this.canvasStorage.push(canvasEntry)}return canvas};CamMan.prototype.getCanvas=function getCanvas(container,callback){var element=document.querySelector("#"+container);return element.appendChild(this.createCanvas(callback))};CamMan.prototype.updateCanvas=function updateCanvas(){for(var i=0;i<this.canvasStorage.length;i++){var canvasEntry=this.canvasStorage[i];var canvas=this.canvasStorage[i]["canvas"];var context=this.canvasStorage[i]["context"];var callback=this.canvasStorage[i]["onFrame"];context.drawImage(this.video,0,0,canvas.width,canvas.height);if(callback)callback(canvas)}requestAnimationFrame(this.updateCanvas.bind(this))};CamMan.prototype.on=function on(event,handler){if(!this.events.hasOwnProperty(event))this.events[event]=[];this.events[event].push(handler)};CamMan.prototype.off=function off(event,handler){this.events=this.events[event].filter(function(h){if(h!==handler)return h})};CamMan.prototype.trigger=function trigger(event,data){if(!this.events.hasOwnProperty(event))return false;this.events[event].forEach(function(handler){handler.call(this,data)}.bind(this))};CamMan.prototype.setOptions=function setOptions(options){for(var option in options)this.options[option]=options[option]};CamMan.prototype.getStreamURL=function getStreamURL(){if(window.URL&&window.URL.createObjectURL)return window.URL.createObjectURL(this.stream);else return this.stream};CamMan.prototype.createVideo=function createVideo(){var width=320;var height=0;var streaming=false;var video=document.createElement("video");video.addEventListener("canplay",function(){if(!streaming){height=video.videoHeight/(video.videoWidth/width);video.style.width=width;video.style.height=height;streaming=true;return this.trigger("start")}}.bind(this),false);if(navigator.mozGetUserMedia)video.mozSrcObject=this.stream;else video.src=this.getStreamURL();video.play();return video};CamMan.prototype.snapshot=function snapshot(width,height){width=width||this.video.videoWidth;height=height||this.video.videoHeight;var canvas=document.createElement("canvas");var context=canvas.getContext("2d");canvas.width=width;canvas.height=height;context.drawImage(this.video,0,0,width,height);this.snapshots.push(canvas);this.trigger("snapshot",canvas);context=null;return canvas};CamMan.prototype.start=function start(){if(!navigator.getUserMedia){this.trigger("error","Browser not supported");return false}var success=function success(stream){this.stream=stream;this.video=this.createVideo();var container=this.options.container;if(typeof container==="string"){var element=document.querySelector("#"+container);element.appendChild(this.video)}}.bind(this);var error=function error(error){this.trigger("error",error)}.bind(this);var options={video:true,audio:this.options.audio};return navigator.getUserMedia(options,success,error)};CamMan.prototype.stop=function stop(){this.stream.stop();if(window.URL&&window.URL.revokeObjectURL){window.URL.revokeObjectURL(this.video.src)}return this.trigger("stop")};return CamMan}();var CamMan=function(){navigator.getUserMedia=function(){return navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||false}();window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback){window.setTimeout(callback,1e3/60)}}();window.URL=function(){return window.URL||window.webkitURL||false}();var CamMan=function CamMan(options){this.snapshots=[];this.canvasStorage=[];this.video=null;this.events={};this.stream=null;this.options={audio:false,container:null};this.setOptions(options);return this};CamMan.prototype.createCanvas=function createCanvas(callback){var canvas=null;var width=this.video.videoWidth;var height=this.video.videoHeight;if(width&&height){canvas=document.createElement("canvas");canvas.width=width;canvas.height=height;var canvasData={canvas:canvas,context:canvas.getContext("2d"),onFrame:callback};if(this.canvasStorage.length===0)this.updateCanvas();this.canvasStorage.push(canvasData);return canvas}return canvas};CamMan.prototype.getCanvas=function getCanvas(container,callback){var element=document.querySelector("#"+container);return element.appendChild(this.createCanvas(callback))};CamMan.prototype.updateCanvas=function updateCanvas(){for(var i=0;i<this.canvasStorage.length;i++){var canvasData=this.canvasStorage[i];var canvas=canvasData.canvas;var context=canvasData.context;var callback=canvasData.onFrame;context.drawImage(this.video,0,0,canvas.width,canvas.height);if(callback)callback(canvas)}requestAnimationFrame(this.updateCanvas.bind(this))};CamMan.prototype.on=function on(event,handler){if(!this.events.hasOwnProperty(event))this.events[event]=[];this.events[event].push(handler)};CamMan.prototype.off=function off(event,handler){this.events=this.events[event].filter(function(h){if(h!==handler)return h})};CamMan.prototype.trigger=function trigger(event,data){if(!this.events.hasOwnProperty(event))return false;this.events[event].forEach(function(handler){handler.call(this,data)}.bind(this))};CamMan.prototype.setOptions=function setOptions(options){for(var option in options)this.options[option]=options[option]};CamMan.prototype.getStreamURL=function getStreamURL(){if(window.URL&&window.URL.createObjectURL)return window.URL.createObjectURL(this.stream);else return this.stream};CamMan.prototype.createVideo=function createVideo(){var width=320;var height=0;var streaming=false;var video=document.createElement("video");video.addEventListener("canplay",function(){if(!streaming){height=video.videoHeight/(video.videoWidth/width);video.style.width=width;video.style.height=height;streaming=true;return this.trigger("start")}}.bind(this),false);if(navigator.mozGetUserMedia)video.mozSrcObject=this.stream;else video.src=this.getStreamURL();video.play();return video};CamMan.prototype.snapshot=function snapshot(width,height){width=width||this.video.videoWidth;height=height||this.video.videoHeight;var canvas=document.createElement("canvas");var context=canvas.getContext("2d");canvas.width=width;canvas.height=height;context.drawImage(this.video,0,0,width,height);this.snapshots.push(canvas);this.trigger("snapshot",canvas);context=null;return canvas};CamMan.prototype.start=function start(){if(!navigator.getUserMedia){this.trigger("error","Browser not supported");return false}var success=function success(stream){this.stream=stream;this.video=this.createVideo();var container=this.options.container;if(typeof container==="string"){var element=document.querySelector("#"+container);element.appendChild(this.video)}}.bind(this);var error=function error(err){this.trigger("error",err)}.bind(this);var options={video:true,audio:this.options.audio};return navigator.getUserMedia(options,success,error)};CamMan.prototype.stop=function stop(){this.stream.stop();if(window.URL&&window.URL.revokeObjectURL){window.URL.revokeObjectURL(this.video.src)}return this.trigger("stop")};return CamMan}();<commit_msg>Fixing minified source and commit hook<commit_after>var CamMan=function(){navigator.getUserMedia=function(){return navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||!1}(),window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback){window.setTimeout(callback,1e3/60)}}(),window.URL=function(){return window.URL||window.webkitURL||!1}();var CamMan=function(options){return this.snapshots=[],this.canvasStorage=[],this.video=null,this.events={},this.stream=null,this.options={audio:!1,container:null},this.setOptions(options),this};return CamMan.prototype.createCanvas=function(callback){var canvas=null,width=this.video.videoWidth,height=this.video.videoHeight;if(width&&height){canvas=document.createElement("canvas"),canvas.width=width,canvas.height=height;var canvasData={canvas:canvas,context:canvas.getContext("2d"),onFrame:callback};return 0===this.canvasStorage.length&&this.updateCanvas(),this.canvasStorage.push(canvasData),canvas}return canvas},CamMan.prototype.getCanvas=function(container,callback){var element=document.querySelector("#"+container);return element.appendChild(this.createCanvas(callback))},CamMan.prototype.updateCanvas=function(){for(var i=0;i<this.canvasStorage.length;i++){var canvasData=this.canvasStorage[i],canvas=canvasData.canvas,context=canvasData.context,callback=canvasData.onFrame;context.drawImage(this.video,0,0,canvas.width,canvas.height),callback&&callback(canvas)}requestAnimationFrame(this.updateCanvas.bind(this))},CamMan.prototype.on=function(event,handler){this.events.hasOwnProperty(event)||(this.events[event]=[]),this.events[event].push(handler)},CamMan.prototype.off=function(event,handler){this.events=this.events[event].filter(function(h){return h!==handler?h:void 0})},CamMan.prototype.trigger=function(event,data){return this.events.hasOwnProperty(event)?(this.events[event].forEach(function(handler){handler.call(this,data)}.bind(this)),void 0):!1},CamMan.prototype.setOptions=function(options){for(var option in options)this.options[option]=options[option]},CamMan.prototype.getStreamURL=function(){return window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(this.stream):this.stream},CamMan.prototype.createVideo=function(){var width=320,height=0,streaming=!1,video=document.createElement("video");return video.addEventListener("canplay",function(){return streaming?void 0:(height=video.videoHeight/(video.videoWidth/width),video.style.width=width,video.style.height=height,streaming=!0,this.trigger("start"))}.bind(this),!1),navigator.mozGetUserMedia?video.mozSrcObject=this.stream:video.src=this.getStreamURL(),video.play(),video},CamMan.prototype.snapshot=function(width,height){width=width||this.video.videoWidth,height=height||this.video.videoHeight;var canvas=document.createElement("canvas"),context=canvas.getContext("2d");return canvas.width=width,canvas.height=height,context.drawImage(this.video,0,0,width,height),this.snapshots.push(canvas),this.trigger("snapshot",canvas),context=null,canvas},CamMan.prototype.start=function(){if(!navigator.getUserMedia)return this.trigger("error","Browser not supported"),!1;var success=function(stream){this.stream=stream,this.video=this.createVideo();var container=this.options.container;if("string"==typeof container){var element=document.querySelector("#"+container);element.appendChild(this.video)}}.bind(this),error=function(err){this.trigger("error",err)}.bind(this),options={video:!0,audio:this.options.audio};return navigator.getUserMedia(options,success,error)},CamMan.prototype.stop=function(){return this.stream.stop(),window.URL&&window.URL.revokeObjectURL&&window.URL.revokeObjectURL(this.video.src),this.trigger("stop")},CamMan}();
{'fraction_non_alphanumeric': 0.16719216727514105, 'fraction_numerical': 0.004978426817125788, 'mean_word_length': 18.041074249605057, 'pattern_counts': {'":': 0, '<': 6, '<?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': '1943582', 'n_tokens_mistral': 3398, 'n_tokens_neox': 3397, 'n_words': 171}