<commit_before>fbf = {};

fbf.FRAMES_PER_SECOND = 25;
fbf.PLAYER_ID = "movie_player";
fbf.LEFT_SQUARE_BRACKET = 219;
fbf.RIGHT_SQUARE_BRACKET = 221;
fbf.COMMA = 188;
fbf.PERIOD = 190;
fbf.P_KEY = 80;
fbf.O_KEY = 79;
var FRAMESKIP = 1;

fbf.prevFrame = function(FRAMESKIP) {
    // Based on YouTube enhancer userscript, http://userscripts.org/scripts/show/33042.
    player = document.getElementById(fbf.PLAYER_ID);
    player.pauseVideo();
    player.seekBy(-FRAMESKIP * (1/fbf.FRAMES_PER_SECOND));
}

fbf.nextFrame = function(FRAMESKIP) {
    // Based on YouTube enhancer userscript, http://userscripts.org/scripts/show/33042.
    player = document.getElementById(fbf.PLAYER_ID);
    player.pauseVideo();
    player.seekBy(FRAMESKIP * (1/fbf.FRAMES_PER_SECOND));
}

fbf.fbfPlayback = function() {
	if (player.getPlaybackRate()==0.25) {
		player.setPlaybackRate(1);
	}
	else {
		player.setPlaybackRate(0.25);
	}
}

fbf.setFrameRate = function() {
	if (fbf.FRAMES_PER_SECOND==25) {
		fbf.FRAMES_PER_SECOND = 30;
		console.log("FRAMESKIP set to 1/30 for 30 FPS video");
	}
	else {
		fbf.FRAMES_PER_SECOND = 25;
		console.log("FRAMESKIP set to 1/25 for 25 FPS video");
	}
	fbf.updateFpsAndFS();
}

fbf.multiplyFS = function(factor) {
	if (factor=="decrease" && FRAMESKIP >=2){
		FRAMESKIP/=2;
	} 
	if (factor=="increase" && FRAMESKIP <=16) {
		FRAMESKIP*=2;
	}
	fbf.updateFpsAndFS();
}
fbf.injectControls = function() {
    var controls_html = "<i class=\"icon icon-to-start\"></i><i class=\"icon icon-to-end\"></i>";
    var control_bar = document.getElementsByClassName("ytp-chrome-controls")[0];
    var fpsAndFrameskip_html = "<b>fps:&nbsp;" + fbf.FRAMES_PER_SECOND + "</b>\
	&nbsp;&nbsp;&nbsp;<b> frameskip:&nbsp;" + FRAMESKIP + "</b>";
	
    var newButtons = document.createElement('div');
    newButtons.innerHTML = controls_html;
    newButtons.style.float = 'left';
    newButtons.style['margin-top'] = '2px';
	
	var fpsAndFrameskip = document.createElement('div');
    fpsAndFrameskip.innerHTML = fpsAndFrameskip_html;
    fpsAndFrameskip.style.float = 'right';
	fpsAndFrameskip.style['margin-top'] = '2px';
	
    var child = document.getElementsByClassName('ytp-volume-hover-area')[0];

    control_bar.insertBefore(newButtons, child);
	control_bar.insertBefore(fpsAndFrameskip, child);
	
	fbf.updateFpsAndFS = function() {
		fpsAndFrameskip_html = "<b>fps:&nbsp;" + fbf.FRAMES_PER_SECOND + "</b>\
	&nbsp;&nbsp;&nbsp;<b> frameskip:&nbsp;" + FRAMESKIP + "</b>";
		fpsAndFrameskip.innerHTML = fpsAndFrameskip_html;
	}
	
    var forward_button = document.getElementsByClassName("icon-to-end")[0];
    forward_button.addEventListener('click', function() {
        fbf.nextFrame(FRAMESKIP);
    });

    var back_button = document.getElementsByClassName("icon-to-start")[0];
    back_button.addEventListener('click', function() {
        fbf.prevFrame(FRAMESKIP);
    });
}
<commit_msg>Minor text formatting<commit_after>fbf = {};

fbf.FRAMES_PER_SECOND = 25;
fbf.PLAYER_ID = "movie_player";
fbf.LEFT_SQUARE_BRACKET = 219;
fbf.RIGHT_SQUARE_BRACKET = 221;
fbf.COMMA = 188;
fbf.PERIOD = 190;
fbf.P_KEY = 80;
fbf.O_KEY = 79;
var FRAMESKIP = 1;

fbf.prevFrame = function(FRAMESKIP) {
    // Based on YouTube enhancer userscript, http://userscripts.org/scripts/show/33042.
    player = document.getElementById(fbf.PLAYER_ID);
    player.pauseVideo();
    player.seekBy(-FRAMESKIP * (1/fbf.FRAMES_PER_SECOND));
}

fbf.nextFrame = function(FRAMESKIP) {
    // Based on YouTube enhancer userscript, http://userscripts.org/scripts/show/33042.
    player = document.getElementById(fbf.PLAYER_ID);
    player.pauseVideo();
    player.seekBy(FRAMESKIP * (1/fbf.FRAMES_PER_SECOND));
}

fbf.fbfPlayback = function() {
	if (player.getPlaybackRate()==0.25) {
		player.setPlaybackRate(1);
	}
	else {
		player.setPlaybackRate(0.25);
	}
}

fbf.setFrameRate = function() {
	if (fbf.FRAMES_PER_SECOND==25) {
		fbf.FRAMES_PER_SECOND = 30;
		console.log("FRAMESKIP set to 1/30 for 30 FPS video");
	}
	else {
		fbf.FRAMES_PER_SECOND = 25;
		console.log("FRAMESKIP set to 1/25 for 25 FPS video");
	}
	fbf.updateFpsAndFS();
}

fbf.multiplyFS = function(factor) {
	if (factor=="decrease" && FRAMESKIP >=2){
		FRAMESKIP/=2;
	} 
	if (factor=="increase" && FRAMESKIP <=16) {
		FRAMESKIP*=2;
	}
	fbf.updateFpsAndFS();
}
fbf.injectControls = function() {
    var controls_html = "<i class=\"icon icon-to-start\"></i><i class=\"icon icon-to-end\"></i>";
    var control_bar = document.getElementsByClassName("ytp-chrome-controls")[0];
    var fpsAndFrameskip_html = "<b>FPS:&nbsp;" + fbf.FRAMES_PER_SECOND + "</b>\
	&nbsp;&nbsp;<b> Frameskip:&nbsp;" + FRAMESKIP + "</b>";
	
    var newButtons = document.createElement('div');
    newButtons.innerHTML = controls_html;
    newButtons.style.float = 'left';
    newButtons.style['margin-top'] = '2px';
	
	var fpsAndFrameskip = document.createElement('div');
    fpsAndFrameskip.innerHTML = fpsAndFrameskip_html;
    fpsAndFrameskip.style.float = 'right';
	fpsAndFrameskip.style['margin-top'] = '2px';
	
    var child = document.getElementsByClassName('ytp-volume-hover-area')[0];

    control_bar.insertBefore(newButtons, child);
	control_bar.insertBefore(fpsAndFrameskip, child);
	
	fbf.updateFpsAndFS = function() {
		fpsAndFrameskip_html = "<b>FPS:&nbsp;" + fbf.FRAMES_PER_SECOND + "</b>\
	&nbsp;&nbsp;<b> Frameskip:&nbsp;" + FRAMESKIP + "</b>";
		fpsAndFrameskip.innerHTML = fpsAndFrameskip_html;
	}
	
    var forward_button = document.getElementsByClassName("icon-to-end")[0];
    forward_button.addEventListener('click', function() {
        fbf.nextFrame(FRAMESKIP);
    });

    var back_button = document.getElementsByClassName("icon-to-start")[0];
    back_button.addEventListener('click', function() {
        fbf.prevFrame(FRAMESKIP);
    });
}

{'fraction_non_alphanumeric': 0.1607204710772428, 'fraction_numerical': 0.022514721163837893, 'mean_word_length': 4.432737535277517, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '5080108', 'n_tokens_mistral': 2359, 'n_tokens_neox': 2197, 'n_words': 326}