<commit_before>/**********************************************************************************\
  open PDFs, docs, external site links (start with http://), etc in a new window
\**********************************************************************************/

//Now includes google analytics integration

var file_types = ['pdf','doc','docx','xls','xlsx','ppt','pptx','txt','mp3'];
var image_types = ['jpg','gif','png'];

$('a:not([href^="javascript"])').each(function(i){
	var href = $(this).attr('href');

	if (typeof href !== 'undefined'){
	//for download links and image links
		var file_type = href.substr((href.lastIndexOf('.') +1)).toLowerCase();

		//if file type is in the accepted list of file types...
		if ($.inArray(file_type,file_types) > -1){
			$(this).addClass('downloadLink-JS').addClass('downloadLink--'+file_type+'-JS');

		//if file type is an image and is on a touch device
		} else if ($.inArray(file_type,image_types) > -1 && $('html').hasClass('touch')){
			$(this).addClass('imageLink-JS');
		};

	//Share links

		var isLinkedId = href.match("^http://www.linkedin.com"),
			isTwitter = href.match("^http://twitter.com/intent/tweet"),
			isFacebook = href.match("^http://www.facebook.com/sharer"),
			isEmail = href.match("^mailto:?")
			baseShareClass = 'shareLink';

		if ( isLinkedId || isTwitter ||	isFacebook){
			$(this).addClass(baseShareClass+'-JS');
		};

		if (isLinkedId) {
			$(this).addClass(baseShareClass+'--linkedIn-JS');

		} else if (isTwitter) {
			$(this).addClass(baseShareClass+'--twitter-JS');

		} else if (isFacebook) {
			$(this).addClass(baseShareClass+'--facebook-JS');

		} else if (isEmail) {
			$(this).addClass('emailShare-JS');
		}

	//podcast link
		if (href.match('^http://www.itunes.com')){
			$(this).addClass('podcastLink-JS');
		};

	//External links
		if (
			href.match("^http") &&
			href.indexOf(window.location.host) === -1 &&
			!$(this).hasClass('shareLink-JS') &&
			!$(this).hasClass('podcastLink-JS')
		){
			$(this).addClass('externalLink-JS');
		};

	};

	//once all links have been processed
	if (i == $('a:not([href^="javascript"])').length - 1){
		//any specific new window links get listed here
		var all_new_window_links = '.downloadLink-JS, .imageLink-JS, .externalLink-JS, .podcastLink-JS';

		//Google analytics download tracking
		$('body').on('click','.downloadLink-JS', function(){<commit_msg>You can now disable new-window functionality with data-jshook="newWindow__exclusion"<commit_after>/**********************************************************************************\
  open PDFs, docs, external site links (start with http://), etc in a new window
\**********************************************************************************/

//Now includes google analytics integration

var file_types = ['pdf','doc','docx','xls','xlsx','ppt','pptx','txt','mp3'];
var image_types = ['jpg','gif','png'];

$('a:not([href^="javascript"])').each(function(i){
	var href = $(this).attr('href');

	if (typeof href !== 'undefined'){
	//for download links and image links
		var file_type = href.substr((href.lastIndexOf('.') +1)).toLowerCase();

		//if file type is in the accepted list of file types...
		if ($.inArray(file_type,file_types) > -1){
			$(this).addClass('downloadLink-JS').addClass('downloadLink--'+file_type+'-JS');

		//if file type is an image and is on a touch device
		} else if ($.inArray(file_type,image_types) > -1 && $('html').hasClass('touch')){
			$(this).addClass('imageLink-JS');
		};

	//Share links

		var isLinkedId = href.match("^http://www.linkedin.com"),
			isTwitter = href.match("^http://twitter.com/intent/tweet"),
			isFacebook = href.match("^http://www.facebook.com/sharer"),
			isEmail = href.match("^mailto:?")
			baseShareClass = 'shareLink';

		if ( isLinkedId || isTwitter ||	isFacebook){
			$(this).addClass(baseShareClass+'-JS');
		};

		if (isLinkedId) {
			$(this).addClass(baseShareClass+'--linkedIn-JS');

		} else if (isTwitter) {
			$(this).addClass(baseShareClass+'--twitter-JS');

		} else if (isFacebook) {
			$(this).addClass(baseShareClass+'--facebook-JS');

		} else if (isEmail) {
			$(this).addClass('emailShare-JS');
		}

	//podcast link
		if (href.match('^http://www.itunes.com')){
			$(this).addClass('podcastLink-JS');
		};

	//External links
		if (
			href.match("^http") &&
			href.indexOf(window.location.host) === -1 &&
			!$(this).hasClass('shareLink-JS') &&
			!$(this).hasClass('podcastLink-JS') &&

			//add data-jshook="newWindow__exclusion" to an external link to prevent it opening in a new window
			!$(this).is('[data-jshook*="newWindow__exclusion"]')
		){
			$(this).addClass('externalLink-JS');
		};

	};

	//once all links have been processed
	if (i == $('a:not([href^="javascript"])').length - 1){
		//any specific new window links get listed here
		var all_new_window_links = '.downloadLink-JS, .imageLink-JS, .externalLink-JS, .podcastLink-JS';

		//Google analytics download tracking
		$('body').on('click','.downloadLink-JS', function(){
{'fraction_non_alphanumeric': 0.2621281692952685, 'fraction_numerical': 0.002395687762028349, 'mean_word_length': 4.554323725055433, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7062245', 'n_tokens_mistral': 1750, 'n_tokens_neox': 1576, 'n_words': 329}