<commit_before>/** This file handles the page encryption and decryption */

var secrets = (self.options && self.options.active) || [],
keyList = (self.options && self.options.keys) || [],
decryptIndicator = (self.options && self.options.decryptIndicator) || false,
sandboxDecrypt = (self.options && self.options.sandboxDecrypt) || false,
panelMode = false;

/** Called to update the keyring and the active keys */
self.port.on("secret", function(secret_obj){
	secrets = secret_obj.active;
	keyList = secret_obj.keys;
});

/** Called to toggle displaying the decrypt indicator */
self.port.on("decryptIndicator", function(indicate){
	decryptIndicator = indicate;
	$("[grdMeFrameUID]").each(function(i, e){
		msg($(e).attr("grdMeFrameUID"), {id: "decryptIndicator", decryptIndicator: indicate});
	});
});

/** Called to toggle sandboxed decryption */
self.port.on("sandboxDecrypt", function(indicate){
	sandboxDecrypt = indicate;
});

/** Called if crypt is to run into panel mode */
self.port.on("panelMode", function(){
	panelMode = true;
	Mousetrap.unbind('mod+alt+e');
	$("#clipboard").hide();
	self.port.on("show", function onShow() {
		$("textArea").focus().select();
	});
});

/** Notify user that their message was copied to clipboard */
self.port.on("message_add_fail", function(){
	alert("Failed to make short message.\nCiphertext copied to clipboard.");
});

/** Append iframe of decrypted message */
self.port.on("preparedIframe", function(uid){
	var elem = $("[grdMeUID='"+uid+"']");
	elem.append($("<iframe>", {src: 'https://decrypt.grd.me/'+uid, "grdMeFrameUID" : uid, seamless: "seamless"}).css({
		border: 0,
		width: elem.css("display") === "block"? elem.width() > 0 ? elem.outerWidth() : "auto" : "100%",
		height: elem.outerHeight(),
		"margin-bottom": "-5px"
	}).hide());
});<commit_msg>Make sandboxed decryptions more seamless<commit_after>/** This file handles the page encryption and decryption */

var secrets = (self.options && self.options.active) || [],
keyList = (self.options && self.options.keys) || [],
decryptIndicator = (self.options && self.options.decryptIndicator) || false,
sandboxDecrypt = (self.options && self.options.sandboxDecrypt) || false,
panelMode = false;

/** Called to update the keyring and the active keys */
self.port.on("secret", function(secret_obj){
	secrets = secret_obj.active;
	keyList = secret_obj.keys;
});

/** Called to toggle displaying the decrypt indicator */
self.port.on("decryptIndicator", function(indicate){
	decryptIndicator = indicate;
	$("[grdMeFrameUID]").each(function(i, e){
		msg($(e).attr("grdMeFrameUID"), {id: "decryptIndicator", decryptIndicator: indicate});
	});
});

/** Called to toggle sandboxed decryption */
self.port.on("sandboxDecrypt", function(indicate){
	sandboxDecrypt = indicate;
});

/** Called if crypt is to run into panel mode */
self.port.on("panelMode", function(){
	panelMode = true;
	Mousetrap.unbind('mod+alt+e');
	$("#clipboard").hide();
	self.port.on("show", function onShow() {
		$("textArea").focus().select();
	});
});

/** Notify user that their message was copied to clipboard */
self.port.on("message_add_fail", function(){
	alert("Failed to make short message.\nCiphertext copied to clipboard.");
});

/** Append iframe of decrypted message */
self.port.on("preparedIframe", function(uid){
	var elem = $("[grdMeUID='"+uid+"']");
	elem.append($("<iframe>", {src: 'https://decrypt.grd.me/'+uid, "grdMeFrameUID" : uid, seamless: "seamless"}).css({
		border: 0,
		width: elem.css("display") === "block"? elem.width() > 0 ? elem.outerWidth() : "auto" : "100%",
		height: elem.outerHeight()
	}).hide());
});
{'fraction_non_alphanumeric': 0.19435215946843853, 'fraction_numerical': 0.003045404208194906, 'mean_word_length': 5.349736379613357, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '1639337', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1177, 'n_words': 278}