<commit_before>(function() {
	var player, lastStateSeen;
	var pauseOnReturn = false;
	var mask = document.createElement('div');
	var showNameDiv, pauseOnReturnDiv, dismissDiv;
	var maskSetup = false;
	var masked = false;

	function log(message) {
		console.log("[Interhulude] " + message);
	}

	function maskVideo() {
		setMask();
		log("Masking video");
		if (player.getVolume && player.getVolume() != 0) {
			player.mute();
		}
		player.parentElement.appendChild(mask);
		masked = true;
	}

	function unmaskVideo() {
		log("Unmasking video");
		if (player.getVolume && player.getVolume() == 0) {
			player.unMute();
		}
		player.parentElement.removeChild(mask);
		masked = false;
	}

	function togglePause() {
		pauseOnReturn = !pauseOnReturn;
		pauseOnReturnDiv.className = pauseOnReturn ? "checked" : "unchecked";
	}

	function updateMask() {
		mask.style.width = player.offsetWidth + "px";
		mask.style.height = player.offsetHeight + "px";
		mask.style.top = player.offsetTop + "px";
		mask.style.left = player.offsetLeft + "px";

		var showName = document.getElementsByClassName('show-title')[0] ? document.getElementsByClassName('show-title')[0].innerHTML : "Your show";
		showNameDiv.innerHTML = "<span>" + showName + "</span> will return in a moment.";
	}

	function setMask() {
		if (!maskSetup) {
			mask.id = "InterhuludeMask";

			showNameDiv = document.createElement('div');
			showNameDiv.id = "InterhuludeShowName";
			showNameDiv.innerHTML = "<span>Your show</span> will return in a moment.";

			pauseOnReturnDiv = document.createElement('div');
			pauseOnReturnDiv.id = "InterhuludePauseOnReturn";
			pauseOnReturnDiv.onclick = togglePause;
			pauseOnReturnDiv.innerHTML = "<span>&#x2713;</span> Pause when the show comes back";

			dismissDiv = document.createElement('div');
			dismissDiv.id = "InterhuludeClickToDismiss";
			dismissDiv.innerHTML = "(click here to dismiss)";
			dismissDiv.onclick = unmaskVideo;

			mask.appendChild(showNameDiv);
			mask.appendChild(pauseOnReturnDiv);
			mask.appendChild(dismissDiv);

			maskSetup = true;
		}
	}

	window.setInterval(function() {
		if (!player || !player.getCurrentState) {
			player = document.getElementById('player');
		} else {
			if (!maskSetup) {
				setMask();
			}
			updateMask();
			var currentState = player.getCurrentState().subState;
			if (currentState != lastStateSeen && currentState != "loading") {
				lastStateSeen = currentState;
				if (currentState == "content") {
					if (masked) {
						unmaskVideo();
					}
					if (pauseOnReturn) {
						player.pauseVideo();
					}
				} else {
					if (!masked) {
						maskVideo();
					}
				}
			}
		}
	}, 1000);
})()
<commit_msg>Add save of PauseOnReturn setting to localStorage<commit_after>(function() {
	var player, lastStateSeen;
	var pauseOnReturn = localStorage["Interhulude:pauseOnReturn"] || false;
	var mask = document.createElement('div');
	var showNameDiv, pauseOnReturnDiv, dismissDiv;
	var maskSetup = false;
	var masked = false;

	function log(message) {
		console.log("[Interhulude] " + message);
	}

	function maskVideo() {
		setMask();
		log("Masking video");
		if (player.getVolume && player.getVolume() != 0) {
			player.mute();
		}
		player.parentElement.appendChild(mask);
		masked = true;
	}

	function unmaskVideo() {
		log("Unmasking video");
		if (player.getVolume && player.getVolume() == 0) {
			player.unMute();
		}
		player.parentElement.removeChild(mask);
		masked = false;
	}

	function togglePause() {
		pauseOnReturn = localStorage["Interhulude:pauseOnReturn"] = !pauseOnReturn;
		pauseOnReturnDiv.className = pauseOnReturn ? "checked" : "unchecked";
	}

	function updateMask() {
		mask.style.width = player.offsetWidth + "px";
		mask.style.height = player.offsetHeight + "px";
		mask.style.top = player.offsetTop + "px";
		mask.style.left = player.offsetLeft + "px";

		var showName = document.getElementsByClassName('show-title')[0] ? document.getElementsByClassName('show-title')[0].innerHTML : "Your show";
		showNameDiv.innerHTML = "<span>" + showName + "</span> will return in a moment.";
	}

	function setMask() {
		if (!maskSetup) {
			mask.id = "InterhuludeMask";

			showNameDiv = document.createElement('div');
			showNameDiv.id = "InterhuludeShowName";
			showNameDiv.innerHTML = "<span>Your show</span> will return in a moment.";

			pauseOnReturnDiv = document.createElement('div');
			pauseOnReturnDiv.id = "InterhuludePauseOnReturn";
			pauseOnReturnDiv.onclick = togglePause;
			pauseOnReturnDiv.innerHTML = "<span>&#x2713;</span> Pause when the show comes back";
			pauseOnReturnDiv.className = pauseOnReturn ? "checked" : "unchecked";

			dismissDiv = document.createElement('div');
			dismissDiv.id = "InterhuludeClickToDismiss";
			dismissDiv.innerHTML = "(click here to dismiss)";
			dismissDiv.onclick = unmaskVideo;

			mask.appendChild(showNameDiv);
			mask.appendChild(pauseOnReturnDiv);
			mask.appendChild(dismissDiv);

			maskSetup = true;
		}
	}

	window.setInterval(function() {
		if (!player || !player.getCurrentState) {
			player = document.getElementById('player');
		} else {
			if (!maskSetup) {
				setMask();
			}
			updateMask();
			var currentState = player.getCurrentState().subState;
			if (currentState != lastStateSeen && currentState != "loading") {
				lastStateSeen = currentState;
				if (currentState == "content") {
					if (masked) {
						unmaskVideo();
					}
					if (pauseOnReturn) {
						player.pauseVideo();
					}
				} else {
					if (!masked) {
						maskVideo();
					}
				}
			}
		}
	}, 1000);
})()

{'fraction_non_alphanumeric': 0.14517876489707476, 'fraction_numerical': 0.004333694474539545, 'mean_word_length': 3.9990974729241877, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '7340664', 'n_tokens_mistral': 2076, 'n_tokens_neox': 1767, 'n_words': 350}