<commit_before><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JSmol HTML5</title>

<style type="text/css">
	html {
		height: 100%;
	}
	body {
		height: 100%;
		overflow: hidden;
		margin: 0;
	}
	#appdiv {
		width: 100%;
		height: 100%;
	}
</style>

<script type="text/javascript" src="jsmol/JSmol.min.js"></script>
<script type="text/javascript" src="iframe-phone/dist/iframe-phone.js"></script>
<script type="text/javascript" src="http://shutterbug.herokuapp.com/shutterbug/shutterbug.js"></script>
<script type="text/javascript">

var jmolApplet0;

// Developers: The debugCode flag is checked in j2s/core/core.z.js, 
// and, if TRUE, skips loading the core methods, forcing those
// to be read from their individual directories. Set this
// true if you want to do some code debugging by inserting
// System.out.println, document.title, or alert commands
// anywhere in the Java or Jmol code.

Jmol.debugCode = (document.location.search.indexOf("debugcode") >= 0);

var Info = {
	width: "100%",
	height: "100%",
	debug: false,
	color: "0xFFFFFF",
	addSelectionOptions: false,
	serverURL: "http://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
	use: "HTML5",
	j2sPath: "jsmol/j2s",
	//jarPath: "java",
	//jarFile: (useSignedApplet ? "JmolAppletSigned.jar" : "JmolApplet.jar"),
	//isSigned: useSignedApplet,
	disableJ2SLoadMonitor: true,
	disableInitialConsole: true,
	allowJavaScript: true
	// defaultModel: "$dopamine",
	//console: "none", // default will be jmolApplet0_infodiv
};

$(document).ready(function() {
  $("#appdiv").html(Jmol.getAppletHtml("jmolApplet0", Info));
  setHashProperties();
  // Snapshot support.
  new Shutterbug('#appdiv');
});


function setHashProperties() {
	var hash = document.location.hash.substring(1); // rm #
	if (hash === "") return;
	hash.split("&").forEach(function (prop) {
		var nameValue = prop.split("=");
		setProperty(nameValue[0], nameValue[1]);
	});
}

function setProperty(name, value) {
	if (name === 'molecule') {
		// It's special property, not supported natively by JSmol, but it can be used
		// by Lab to load a molecule model.
		Jmol.script(jmolApplet0, 'load ' + value);
		return;
	}
	Jmol.script(jmolApplet0, 'set ' + name + ' ' + value);
}

/********************* integration with Lab *********************/

var phone = iframePhone.getIFrameEndpoint();
phone.addListener('play', function () {
	Jmol.script(jmolApplet0, 'spin on');
	// Notify iframe model that we received 'play' message and reacted appropriately.
	phone.post('play.iframe-model');
});
phone.addListener('stop', function () {
	Jmol.script(jmolApplet0, 'spin off');
	// Notify iframe model that we received 'stop' message and reacted appropriately.
	phone.post('stop.iframe-model');
});
phone.addListener('jsmolScript', function (content) {
	Jmol.script(jmolApplet0, content);
});
phone.addListener('set', function (content) {
	setProperty(content.name, content.value);
});
// Initialize connection *after* listeners are added!
phone.initialize();

// Register Scripting API functions shortcuts. 
phone.post('registerScriptingAPIFunc', 'play');
phone.post('registerScriptingAPIFunc', 'stop');
phone.post('registerScriptingAPIFunc', 'jsmolScript');
phone.post('registerScriptingAPIFunc', 'set');

</script>	
</head>
<body>
	<div id="appdiv"></div>
	<div id="dest"></div>
</body>
</html><commit_msg>Fix iframe phone initialization moment<commit_after><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JSmol HTML5</title>

<style type="text/css">
	html {
		height: 100%;
	}
	body {
		height: 100%;
		overflow: hidden;
		margin: 0;
	}
	#appdiv {
		width: 100%;
		height: 100%;
	}
</style>

<script type="text/javascript" src="jsmol/JSmol.min.js"></script>
<script type="text/javascript" src="iframe-phone/dist/iframe-phone.js"></script>
<script type="text/javascript" src="http://shutterbug.herokuapp.com/shutterbug/shutterbug.js"></script>
<script type="text/javascript">

var jmolApplet0;

// Developers: The debugCode flag is checked in j2s/core/core.z.js, 
// and, if TRUE, skips loading the core methods, forcing those
// to be read from their individual directories. Set this
// true if you want to do some code debugging by inserting
// System.out.println, document.title, or alert commands
// anywhere in the Java or Jmol code.

Jmol.debugCode = (document.location.search.indexOf("debugcode") >= 0);

var Info = {
	width: "100%",
	height: "100%",
	debug: false,
	color: "0xFFFFFF",
	addSelectionOptions: false,
	serverURL: "http://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
	use: "HTML5",
	j2sPath: "jsmol/j2s",
	readyFunction: jsmolReady,
	//jarPath: "java",
	//jarFile: (useSignedApplet ? "JmolAppletSigned.jar" : "JmolApplet.jar"),
	//isSigned: useSignedApplet,
	disableJ2SLoadMonitor: true,
	disableInitialConsole: true,
	allowJavaScript: true
	// defaultModel: "$dopamine",
	//console: "none", // default will be jmolApplet0_infodiv
};

$(document).ready(function() {
  $("#appdiv").html(Jmol.getAppletHtml("jmolApplet0", Info));
  setHashProperties();
  // Snapshot support.
  new Shutterbug('#appdiv');
});

function jsmolReady (applet) {
	// Initialize connection *after* listeners are added and jsmol is ready!
	phone.initialize();
}

function setHashProperties() {
	var hash = document.location.hash.substring(1); // rm #
	if (hash === "") return;
	hash.split("&").forEach(function (prop) {
		var nameValue = prop.split("=");
		setProperty(nameValue[0], nameValue[1]);
	});
}

function setProperty(name, value) {
	if (name === 'molecule') {
		// It's special property, not supported natively by JSmol, but it can be used
		// by Lab to load a molecule model.
		Jmol.script(jmolApplet0, 'load ' + value);
		return;
	}
	Jmol.script(jmolApplet0, 'set ' + name + ' ' + value);
}

/********************* integration with Lab *********************/

var phone = iframePhone.getIFrameEndpoint();
phone.addListener('play', function () {
	Jmol.script(jmolApplet0, 'spin on');
	// Notify iframe model that we received 'play' message and reacted appropriately.
	phone.post('play.iframe-model');
});
phone.addListener('stop', function () {
	Jmol.script(jmolApplet0, 'spin off');
	// Notify iframe model that we received 'stop' message and reacted appropriately.
	phone.post('stop.iframe-model');
});
phone.addListener('jsmolScript', function (content) {
	Jmol.script(jmolApplet0, content);
});
phone.addListener('set', function (content) {
	setProperty(content.name, content.value);
});

// Register Scripting API functions shortcuts. 
phone.post('registerScriptingAPIFunc', 'play');
phone.post('registerScriptingAPIFunc', 'stop');
phone.post('registerScriptingAPIFunc', 'jsmolScript');
phone.post('registerScriptingAPIFunc', 'set');

</script>	
</head>
<body>
	<div id="appdiv"></div>
	<div id="dest"></div>
</body>
</html>
{'fraction_non_alphanumeric': 0.17760731671337956, 'fraction_numerical': 0.01150612184688007, 'mean_word_length': 4.973568281938326, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3166885', 'n_tokens_mistral': 2453, 'n_tokens_neox': 2320, 'n_words': 550}