<commit_before>$(document).ready(function() {
		
	// BUTTON CHECK FOR ICON
	$('.button-blue a, .button-white a').has('span.icon' && 'span.nodisplay').parents('p').addClass('only-icon');
	$('.button-blue a, .button-white a').has('span.icon').parents('p, li').addClass('has-icon');

	// POPOVER WINDOWS
	function popoverHide () {
		$(".popover-window").bind( "clickoutside", function(event){
			$(this).fadeOut('fast').unbind();
		});
	}
	$('a.popover-trigger').live('click', function(e) {
		$(this).closest('.popover').toggleClass('active');
		$(this).closest('.popover').find('.popover-window').fadeToggle('fast')
		popoverHide();
		return false;
	});
	
	// FILTERS TOGGLE DISPLAY
	$('.filters-type .toggle-filters-display').live('click touchstart', function() {
		$(this).parent().toggleClass('visible');
		$(this).siblings('.filters-type-details').slideToggle('fast');
	});
	
	// A common object for all window types
	function Dialog(contents, modal) {
		// Whether the dialog is modal or not
		this.modal = (modal == undefined ? false : modal);

		// Overlay  holding the dialog
		this.container = this.modal ? $("#modal-container") : $("#zoom-container");

		// Contents of the dialog
		this.contents = $(contents);

		// The dialog box
		this.dialogBox = $("div.modal-window #modal-viewport", this.container);
		
		// Stack of hidden views in this dialog
		this.views = [];
	}
	
	// Hides a window
	Dialog.prototype.hide = function() {
		// Do nothing if an attempt is made to close a zoom window
		// when a modal window is open
		if (!this.modal && $('body').hasClass('has_modal')) {			
			return;
		} 
		
		this.container.fadeOut('slow');

		if (!this.modal) {			
			$('body').removeClass("zoomed");
		} else {			
			$('body').removeClass("has_modal");
		}
		this.container.removeClass("visible");
		
		if (!$('body').hasClass('zoomed') && !$('body').hasClass('has_modal')) {
			$('body').removeClass('noscroll');
		}
		
		this.dialogBox.html("");
		this.dialogBox.unbind();
		return this;
	};
	
	// Bind window close event handlers
	Dialog.prototype._registerHide = function() {
		var context = this;
		
		// Close when clicked outside
		this.dialogBox.bind("clickoutside", function(event){
			context.hide();
			return false;
		});
		
		// Close the window when the escape key is pressed
		var keyHandler = function (e) {
			if(e.keyCode == 27){
				if (context.hide()) {
					$(window).unbind("keypress", keyHandler);
				}
				return false;
			}
		}
		$(window).bind("keypress", keyHandler);
		return this;
	};
	
	// Show the window
	Dialog.prototype.show = function() {
		this.dialogBox.append(this.contents);
		
		this.container.addClass("visible");
		this.container.fadeIn(350);
		$('body').addClass('noscroll');
		
		if (!this.modal) {
			$('body').addClass('zoomed');
			this._registerHide();
		} else {
			$('body').addClass('has_modal');
		}
		
		this._registerBackHandler();

		return this;
	};
	
	Dialog.prototype.transition = function(newContent) {
		var oldContent = this.contents; 
		this.views.push(oldContent);
		this.contents = $(newContent);
		this.dialogBox.append(this.contents);
		oldContent.addClass("view-secondary").fadeOut("fast");		
		this.contents.fadeIn("fast");
		$(this.container).scrollTop(0,0);
		
		return this;
	};
	
	Dialog.prototype.back = function() {
		var oldContent = this.contents;
		var newContent = this.contents = this.views.pop();
		newContent.fadeIn("fast", function() {
			$(this).removeClass('view-secondary');
			oldContent.fadeOut("fast", function() {$(this).remove();});
		});
		
		return this;
	};
	
	Dialog.prototype._registerBackHandler = function() {
		var root = $(this.container);
		var dialog = this;
		$('a.modal-back', root).live('click', function() {
			dialog.back();
			return false;
		});
		
		return this;
	};
	
	function loadUrl(url, cssClass, callback, context) {
		if (!context) {
			context = this;
		}
		$.get(url, function(data) {
			// jQuery doesn't have a method like closest() that traverses
			// down the DOM so the below is required to check if the root
			// node of the data retrieved contains the class we want otherwise
			// find starting with the children.<commit_msg>Fix back handler for Dialogs<commit_after>$(document).ready(function() {
		
	// BUTTON CHECK FOR ICON
	$('.button-blue a, .button-white a').has('span.icon' && 'span.nodisplay').parents('p').addClass('only-icon');
	$('.button-blue a, .button-white a').has('span.icon').parents('p, li').addClass('has-icon');

	// POPOVER WINDOWS
	function popoverHide () {
		$(".popover-window").bind( "clickoutside", function(event){
			$(this).fadeOut('fast').unbind();
		});
	}
	$('a.popover-trigger').live('click', function(e) {
		$(this).closest('.popover').toggleClass('active');
		$(this).closest('.popover').find('.popover-window').fadeToggle('fast')
		popoverHide();
		return false;
	});
	
	// FILTERS TOGGLE DISPLAY
	$('.filters-type .toggle-filters-display').live('click touchstart', function() {
		$(this).parent().toggleClass('visible');
		$(this).siblings('.filters-type-details').slideToggle('fast');
	});
	
	// A common object for all window types
	function Dialog(contents, modal) {
		// Whether the dialog is modal or not
		this.modal = (modal == undefined ? false : modal);

		// Overlay  holding the dialog
		this.container = this.modal ? $("#modal-container") : $("#zoom-container");

		// Contents of the dialog
		this.contents = $(contents);

		// The dialog box
		this.dialogBox = $("div.modal-window #modal-viewport", this.container);
		
		// Stack of hidden views in this dialog
		this.views = [];
	}
	
	// Hides a window
	Dialog.prototype.hide = function() {
		// Do nothing if an attempt is made to close a zoom window
		// when a modal window is open
		if (!this.modal && $('body').hasClass('has_modal')) {			
			return;
		} 
		
		this.container.fadeOut('slow');

		if (!this.modal) {			
			$('body').removeClass("zoomed");
		} else {			
			$('body').removeClass("has_modal");
		}
		this.container.removeClass("visible");
		
		if (!$('body').hasClass('zoomed') && !$('body').hasClass('has_modal')) {
			$('body').removeClass('noscroll');
		}
		
		this.dialogBox.html("");
		this.dialogBox.unbind();
		return this;
	};
	
	// Bind window close event handlers
	Dialog.prototype._registerHide = function() {
		var context = this;
		
		// Close when clicked outside
		this.dialogBox.bind("clickoutside", function(event){
			context.hide();
			return false;
		});
		
		// Close the window when the escape key is pressed
		var keyHandler = function (e) {
			if(e.keyCode == 27){
				if (context.hide()) {
					$(window).unbind("keypress", keyHandler);
				}
				return false;
			}
		}
		$(window).bind("keypress", keyHandler);
		return this;
	};
	
	// Show the window
	Dialog.prototype.show = function() {
		this.dialogBox.append(this.contents);
		
		this.container.addClass("visible");
		this.container.fadeIn(350);
		$('body').addClass('noscroll');
		
		if (!this.modal) {
			$('body').addClass('zoomed');
			this._registerHide();
		} else {
			$('body').addClass('has_modal');
		}

		return this;
	};
	
	Dialog.prototype.transition = function(newContent) {
		var oldContent = this.contents; 
		this.views.push(oldContent);
		this.contents = $(newContent);
		this.dialogBox.append(this.contents);
		oldContent.addClass("view-secondary").fadeOut("fast");		
		this.contents.fadeIn("fast");
		$(this.container).scrollTop(0,0);
		
		this._registerBackHandler();
		
		return this;
	};
	
	Dialog.prototype.back = function() {
		var oldContent = this.contents;
		var newContent = this.contents = this.views.pop();
		newContent.fadeIn("fast", function() {
			$(this).removeClass('view-secondary');
			oldContent.fadeOut("fast", function() {$(this).remove();});
		});
		
		return this;
	};
	
	Dialog.prototype._registerBackHandler = function() {
		var root = $(this.container);
		var dialog = this;
		$('a.modal-back', root).bind('click', function() {
			dialog.back();
			return false;
		});
		
		return this;
	};
	
	function loadUrl(url, cssClass, callback, context) {
		if (!context) {
			context = this;
		}
		$.get(url, function(data) {
			// jQuery doesn't have a method like closest() that traverses
			// down the DOM so the below is required to check if the root
			// node of the data retrieved contains the class we want otherwise
			// find starting with the children.
{'fraction_non_alphanumeric': 0.18275572610624774, 'fraction_numerical': 0.0016788583763041132, 'mean_word_length': 3.6307606885063852, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5880048', 'n_tokens_mistral': 3019, 'n_tokens_neox': 2594, 'n_words': 583}