<commit_before>/**
 * mwEmbed jQuery utility functions that are too small for their own file
 */
( function( $ ) {

	/**
	 * Extend Unique to work with strings and number values
	 * http://paulirish.com/2010/duck-punching-with-jquery/
	 */
	var _oldUnique = $.unique;
    $.unique = function(arr){
        // Do the default behavior only if we got an array of elements
        if (!!arr[0].nodeType){
            return _oldUnique.apply(this,arguments);
        } else {
            // reduce the array to contain no dupes via grep/inArray
            return $.grep(arr,function(v,k){
                return $.inArray(v,arr) === k;
            });
        }
    };


	/**
	 * Shortcut to a themed button Should be depreciated for $.button
	 * bellow
	 */
	$.btnHtml = function( msg, styleClass, iconId, opt ) {
		if ( !opt )
			opt = { };
		var href = ( opt.href ) ? opt.href : '#';
		var target_attr = ( opt.target ) ? ' target="' + opt.target + '" ' : '';
		var style_attr = ( opt.style ) ? ' style="' + opt.style + '" ' : '';
		return '<a href="' + href + '" ' + target_attr + style_attr +
			' class="ui-state-default ui-corner-all ui-icon_link ' +
			styleClass + '"><span class="ui-icon ui-icon-' + iconId + '" ></span>' +
			'<span class="btnText">' + msg + '</span></a>';
	};

	// Shortcut to generate a jQuery button
	var mw_default_button_options = {<commit_msg>added check for empty arrays<commit_after>/**
 * mwEmbed jQuery utility functions that are too small for their own file
 */
( function( $ ) {

	/**
	 * Extend Unique to work with strings and number values
	 * http://paulirish.com/2010/duck-punching-with-jquery/
	 */
	var _oldUnique = $.unique;
    $.unique = function(arr){
        // Do the default behavior only if we got an array of elements
        if (arr.length && !!arr[0].nodeType){
            return _oldUnique.apply(this,arguments);
        } else {
            // reduce the array to contain no dupes via grep/inArray
            return $.grep(arr,function(v,k){
                return $.inArray(v,arr) === k;
            });
        }
    };


	/**
	 * Shortcut to a themed button Should be depreciated for $.button
	 * bellow
	 */
	$.btnHtml = function( msg, styleClass, iconId, opt ) {
		if ( !opt )
			opt = { };
		var href = ( opt.href ) ? opt.href : '#';
		var target_attr = ( opt.target ) ? ' target="' + opt.target + '" ' : '';
		var style_attr = ( opt.style ) ? ' style="' + opt.style + '" ' : '';
		return '<a href="' + href + '" ' + target_attr + style_attr +
			' class="ui-state-default ui-corner-all ui-icon_link ' +
			styleClass + '"><span class="ui-icon ui-icon-' + iconId + '" ></span>' +
			'<span class="btnText">' + msg + '</span></a>';
	};

	// Shortcut to generate a jQuery button
	var mw_default_button_options = {
{'fraction_non_alphanumeric': 0.16408222142084386, 'fraction_numerical': 0.003606202668589975, 'mean_word_length': 2.4416873449131513, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '5390235', 'n_tokens_mistral': 947, 'n_tokens_neox': 870, 'n_words': 247}