<commit_before>/* http://github.com/AngeloG/Chatzilla-Plugins
 * Copyright (c) <NAME>, 2011
 */

plugin.id = "inline-images";

plugin.init = function(glob)
{
	plugin.version = "1.0";
	plugin.description = "Turns incoming image links (like imgur) into inline images.";
	plugin.glob = glob;
	
	return "OK";
}

plugin.enable = function()
{
	client.munger.addRule("inline-images", new RegExp("(http://([a-z0-9]+\\.)+([a-z]{2,})/[A-Za-z0-9]{5,}.(jpg|png|gif|bmp))"), function(matchText, containerTag, eventData){
		var newLink = document.createElementNS(XHTML_NS, "html:a");
		newLink.setAttribute("href", matchText);
		newLink.setAttribute("location", "_blank");
		newLink.setAttribute("style", "text-decoration:none;");
		
		var newImage = document.createElementNS(XHTML_NS, "html:img");
		newImage.setAttribute("src", matchText);
		newImage.setAttribute("style", "max-width:200px;max-height:200px;");
		newLink.appendChild(newImage);
		
		insertText("", newLink, eventData);
		containerTag.appendChild(newLink);
	}, 15, 10);
	
	return true;
}

plugin.disable = function()
{
	client.munger.delRule("inline-images");
	
	return true;
}<commit_msg>Updated installer package<commit_after>/* http://github.com/AngeloG/Chatzilla-Plugins
 * Copyright (c) <NAME>, 2011
 */

plugin.id = "inline-images";

plugin.init = function(glob)
{
	plugin.version = "1.0";
	plugin.description = "Turns incoming image links (like imgur) into inline images.";
	plugin.glob = glob;
	
	return "OK";
}

plugin.enable = function()
{
	client.munger.addRule("inline-images", new RegExp("(http://([a-z0-9\\-]+\\.)+([a-z]{2,})([A-Za-z0-9/]*)[A-Za-z0-9]{5,}.(jpg|png|gif|bmp))"), function(matchText, containerTag, eventData){
		var newLink = document.createElementNS(XHTML_NS, "html:a");
		newLink.setAttribute("href", matchText);
		newLink.setAttribute("location", "_blank");
		newLink.setAttribute("style", "text-decoration:none;");
		
		var newImage = document.createElementNS(XHTML_NS, "html:img");
		newImage.setAttribute("src", matchText);
		newImage.setAttribute("style", "max-width:200px;max-height:200px;");
		newLink.appendChild(newImage);
		
		insertText("", newLink, eventData);
		containerTag.appendChild(newLink);
	}, 15, 10);
	
	return true;
}

plugin.disable = function()
{
	client.munger.delRule("inline-images");
	
	return true;
}
{'fraction_non_alphanumeric': 0.1932555123216602, 'fraction_numerical': 0.01988759187202767, 'mean_word_length': 5.305177111716621, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '314593', 'n_tokens_mistral': 876, 'n_tokens_neox': 805, 'n_words': 134}