<commit_before>/*##################################################|*/
/* #CMS# */

// ensuring django namespace is set correctly
window.django = window.django || undefined;

// ensuring jQuery namespace is set correctly
window.jQuery = (django) ? django.jQuery : window.jQuery || undefined;

// ensuring Class namespace is set correctly
window.Class = window.Class || undefined;

// ensuring CMS namespace is set correctly
var CMS = {
	'$': (jQuery) ? jQuery.noConflict() : undefined,
	'Class': (Class) ? Class.noConflict() : undefined,
	'API': {}
};

/*##################################################|*/
/* #CMS.API# */
(function($) {
// CMS.$ will be passed for $
$(document).ready(function () {
	/*!
	 * CNS.API.Helpers
	 * Multiple helpers used accross all CMS features
	 */
	CMS.API.Helpers = {

		// redirects to a specific url or reloads browser
		reloadBrowser: function (url, timeout, ajax) {
			var that = this;
			// is there a parent window?
			var parent = (window.parent) ? window.parent : window;

			// if there is an ajax reload, prioritize
			if(ajax) {
				// check if the url has changed, if true redirect to the new path
				// this requires an ajax request
				$.ajax({
					'async': false,
					'type': 'GET',
					'url': CMS.config.reload.url,
					'data': {
						'model': CMS.config.reload.model,
						'pk': CMS.config.reload.pk
					},
					'success': function (response) {
						if(parent.location.pathname !== response) {
							// api call to the backend to check if the current path is still the same
							that.reloadBrowser(response);
						} else if(url === 'REFRESH_PAGE') {
							// if on_close provides REFRESH_PAGE, only do a reload
							that.reloadBrowser();
						} else if(url) {
							// on_close can also provide a url, reload to the new destination
							that.reloadBrowser(url);
						}
					},
					'error': function (jqXHR) {
						that.showError(jqXHR.response + ' | ' + jqXHR.status + ' ' + jqXHR.statusText);
					}
				});

				// cancel further operations
				return false;
			}

			// add timeout if provided<commit_msg>if response and url are empty, do nothing<commit_after>/*##################################################|*/
/* #CMS# */

// ensuring django namespace is set correctly
window.django = window.django || undefined;

// ensuring jQuery namespace is set correctly
window.jQuery = (django) ? django.jQuery : window.jQuery || undefined;

// ensuring Class namespace is set correctly
window.Class = window.Class || undefined;

// ensuring CMS namespace is set correctly
var CMS = {
	'$': (jQuery) ? jQuery.noConflict() : undefined,
	'Class': (Class) ? Class.noConflict() : undefined,
	'API': {}
};

/*##################################################|*/
/* #CMS.API# */
(function($) {
// CMS.$ will be passed for $
$(document).ready(function () {
	/*!
	 * CNS.API.Helpers
	 * Multiple helpers used accross all CMS features
	 */
	CMS.API.Helpers = {

		// redirects to a specific url or reloads browser
		reloadBrowser: function (url, timeout, ajax) {
			var that = this;
			// is there a parent window?
			var parent = (window.parent) ? window.parent : window;

			// if there is an ajax reload, prioritize
			if(ajax) {
				// check if the url has changed, if true redirect to the new path
				// this requires an ajax request
				$.ajax({
					'async': false,
					'type': 'GET',
					'url': CMS.config.reload.url,
					'data': {
						'model': CMS.config.reload.model,
						'pk': CMS.config.reload.pk
					},
					'success': function (response) {
						if(response === '' && url === '') {
							// cancel if response is empty
							return false;
						} else if(parent.location.pathname !== response) {
							// api call to the backend to check if the current path is still the same
							that.reloadBrowser(response);
						} else if(url === 'REFRESH_PAGE') {
							// if on_close provides REFRESH_PAGE, only do a reload
							that.reloadBrowser();
						} else if(url) {
							// on_close can also provide a url, reload to the new destination
							that.reloadBrowser(url);
						}
					},
					'error': function (jqXHR) {
						that.showError(jqXHR.response + ' | ' + jqXHR.status + ' ' + jqXHR.statusText);
					}
				});

				// cancel further operations
				return false;
			}

			// add timeout if provided
{'fraction_non_alphanumeric': 0.17843866171003717, 'fraction_numerical': 0.0, 'mean_word_length': 2.8030035335689045, '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': '3815431', 'n_tokens_mistral': 1585, 'n_tokens_neox': 1231, 'n_words': 396}