<commit_before>var Radium = new function ($) {
	"use strict";

	/**
	 * Initialise the ArkAdmin theme
	 * @param charts
	 */
	this.init = function (charts) {
		initJsExtensions();
		initControls();
		// initDatePickers();
		initMenus();
		initDataswitch();
		initRTE();
		// //init code highlighter
		// if (typeof prettyPrint === "function"){
		// 	prettyPrint();
		// }
		// initCharts(charts);
		updateContentHeight();
		$( window ).resize(function (){
			updateContentHeight();
		});
		initDatetimes();
	};

	/**
	 * Update the height of the content to match the window size
	 */
	function updateContentHeight(){
		var windowHeight = $(window).height();
		var navHeight = $('.navbar-main').height();
		$('.content').css('min-height', (windowHeight) + "px");
	}


	/**
	 * Init toggle open menu functionality
	 */
	function initMenus() {
		function toggleMenu($menu){
			$menu.toggleClass('open');
		}
		$(document).on('click', '.menu .menu-toggle', function (event){
			event.preventDefault();
			toggleMenu($(this).parents('.menu').first());
		});
	}

	/**
	 * Init the form controls and other input functionality
	 */
	function initControls() {
		// set up textarea autosize
		$('textarea').autoResize({
			maxHeight: 500
		});
		// set up tooltips
		$('[data-toggle="tooltip"]').tooltip();
		// set up checkbox/radiobox styles
		$("input:checkbox:visible, input:radio:visible").uniform();
		// set up select2
		$('select').select2({
			placeholder: "- choose one -",
			allowClear: true
		});

		$('input[name*="slug"]').slugify('input[name*="name"]');
	}

	function initDataswitch() {
		$('body').on('change', '[data-switch]', function(e){
			var name = $(this).attr('data-switch'),
				val = $(this).val(),
				target = name + '_' + val;

			$('[class*="' + name + '_"]').hide();
			if (this.value !== '') {
				$('div.'+target).show();
			}
		});
		$('[data-switch]').trigger('change');
	}
	function initRTE() {
		$('.rte').trumbowyg();
	}

	function initDatetimes() {
		$("[data-datetime]").each(function(){
			var $this = $(this),
				date = $this.data('datetime'),
				valid = ((date != undefined && date > 0)
					|| (date != undefined && typeof(date)=='string' && date.length > 0) );
			if (!valid) {
				return;
			}
			var mom = 0;
			if (typeof(date)=='number') {
				mom = moment(date*1000);
			} else {
				mom = moment(date);
			}
			$this.html(mom.fromNow());
		});
	}

	function initJsExtensions() {
		String.prototype.allReplace = function(obj) {
			var retStr = this
			for (var x in obj) {
				retStr = retStr.replace(new RegExp(x, 'g'), obj[x])
			}
			return retStr;
		};
	}

}(jQuery);

/**
 * Radium Init method
 */
jQuery(function () {
	"use strict";
	Radium.init();
});<commit_msg>fixed slug selector for automatic name<->slug inputs<commit_after>var Radium = new function ($) {
	"use strict";

	/**
	 * Initialise the ArkAdmin theme
	 * @param charts
	 */
	this.init = function (charts) {
		initJsExtensions();
		initControls();
		// initDatePickers();
		initMenus();
		initDataswitch();
		initRTE();
		// //init code highlighter
		// if (typeof prettyPrint === "function"){
		// 	prettyPrint();
		// }
		// initCharts(charts);
		updateContentHeight();
		$( window ).resize(function (){
			updateContentHeight();
		});
		initDatetimes();
	};

	/**
	 * Update the height of the content to match the window size
	 */
	function updateContentHeight(){
		var windowHeight = $(window).height();
		var navHeight = $('.navbar-main').height();
		$('.content').css('min-height', (windowHeight) + "px");
	}


	/**
	 * Init toggle open menu functionality
	 */
	function initMenus() {
		function toggleMenu($menu){
			$menu.toggleClass('open');
		}
		$(document).on('click', '.menu .menu-toggle', function (event){
			event.preventDefault();
			toggleMenu($(this).parents('.menu').first());
		});
	}

	/**
	 * Init the form controls and other input functionality
	 */
	function initControls() {
		// set up textarea autosize
		$('textarea').autoResize({
			maxHeight: 500
		});
		// set up tooltips
		$('[data-toggle="tooltip"]').tooltip();
		// set up checkbox/radiobox styles
		$("input:checkbox:visible, input:radio:visible").uniform();
		// set up select2
		$('select').select2({
			placeholder: "- choose one -",
			allowClear: true
		});

		$('input[name~="slug"]').slugify('input[name~="name"]');
	}

	function initDataswitch() {
		$('body').on('change', '[data-switch]', function(e){
			var name = $(this).attr('data-switch'),
				val = $(this).val(),
				target = name + '_' + val;

			$('[class*="' + name + '_"]').hide();
			if (this.value !== '') {
				$('div.'+target).show();
			}
		});
		$('[data-switch]').trigger('change');
	}
	function initRTE() {
		$('.rte').trumbowyg();
	}

	function initDatetimes() {
		$("[data-datetime]").each(function(){
			var $this = $(this),
				date = $this.data('datetime'),
				valid = ((date != undefined && date > 0)
					|| (date != undefined && typeof(date)=='string' && date.length > 0) );
			if (!valid) {
				return;
			}
			var mom = 0;
			if (typeof(date)=='number') {
				mom = moment(date*1000);
			} else {
				mom = moment(date);
			}
			$this.html(mom.fromNow());
		});
	}

	function initJsExtensions() {
		String.prototype.allReplace = function(obj) {
			var retStr = this
			for (var x in obj) {
				retStr = retStr.replace(new RegExp(x, 'g'), obj[x])
			}
			return retStr;
		};
	}

}(jQuery);

/**
 * Radium Init method
 */
jQuery(function () {
	"use strict";
	Radium.init();
});
{'fraction_non_alphanumeric': 0.21171088746569075, 'fraction_numerical': 0.004391582799634035, 'mean_word_length': 3.3380952380952382, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, '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': '2718126', 'n_tokens_mistral': 2143, 'n_tokens_neox': 1824, 'n_words': 392}