<commit_before>(function($, Craft)
{
	/**
	 * General purpose Doxter module
	 * Enables dynamic code block selection based on highlighter selected and other misc
	 */
	Craft.Doxter = Garnish.Base.extend(
	{
		init: function()
		{
			this.$codeBlockSnippet		= $('.codeBlockSnippet');
			this.$addPrismSnippetBtn	= $('.addPrismSnippetBtn');
			this.$addRainbowSnippetBtn	= $('.addRainbowSnippetBtn');

			this.addListener(this.$addPrismSnippetBtn, 'click', 'addHighlighterSnippet');
			this.addListener(this.$addRainbowSnippetBtn, 'click', 'addHighlighterSnippet');
		},

		addHighlighterSnippet: function(e)
		{
			var highlighter = $(e.target).data('highlighter');

			switch (highlighter)
			{
				case 'PrismJs':
				{
					this.$codeBlockSnippet.val('<pre><code class="language-{languageClass}">{sourceCode}</code></pre>');

					break;
				}
				case 'RainbowJs':
				{
					this.$codeBlockSnippet.val('<pre><code data-language="language-{languageClass}">{sourceCode}</code></pre>');

					break;
				}
				default:
				{
					this.$codeBlockSnippet.val('<pre><code data-language="language-{languageClass}">{sourceCode}</code></pre>');
				}
			}

			e.preventDefault();
		}
	});

	/**
	 * DoxterFieldType class to manage fieldtype instances
	 */
	Craft.DoxterFieldType = Garnish.Base.extend(
	{
		init: function(id)
		{
			this.id						= id;
            this.$textarea              = $("#" + this.id);
			this.$selectEntryButton		= $("#" + this.id + "SelectEntry");
			this.$selectAssetButton		= $("#" + this.id + "SelectAsset");
			this.$selectUserButton		= $("#" + this.id + "SelectUser");
			this.$selectTagButton		= $("#" + this.id + "SelectTag");
			this.$selectCategoryButton	= $("#" + this.id + "SelectCategory");
			this.$selectGlobalButton	= $("#" + this.id + "SelectGlobal");
			this.addListener(this.$selectEntryButton, 'click', 'createEntrySelectorModal');
			this.addListener(this.$selectAssetButton, 'click', 'createAssetSelectorModal');
			this.addListener(this.$selectUserButton, 'click', 'createUserSelectorModal');
			this.addListener(this.$selectTagButton, 'click', 'createTagSelectorModal');
			this.addListener(this.$selectCategoryButton, 'click', 'createCategorySelectorModal');
			this.addListener(this.$selectGlobalButton, 'click', 'createGlobalSetSelectorModal');
		},

		createSelectorModal: function(type)
		{
			var self = this;
			Craft.createElementSelectorModal(type,
			{
				id: this.id + 'Select' + type + 'Modal',
				onSelect: function(elements)
				{
					var tags = self.createReferenceTags(type.toLowerCase(), elements, 'image');
					self.writeToEditor(tags);
				}
			});
		},

		createEntrySelectorModal: function(e)
		{
			this.createSelectorModal('Entry', e);
			e.preventDefault();
		},

		createUserSelectorModal: function(e)
		{
			this.createSelectorModal('User', e);
			e.preventDefault();
		},

		createAssetSelectorModal: function(e)
		{
			var self = this;
			Craft.createElementSelectorModal('Asset',
			{
				id: this.id + 'SelectAssetModal',
				multiSelect: false,
				criteria: {kind: 'image'},
				onSelect: function(elements)
				{
					var tags = self.createReferenceTags(type.toLowerCase(), elements, 'image');
					self.writeToEditor(tags);
				}
			});

			e.preventDefault();
		},
<commit_msg>Fixes issue where a non-existent variable was being referenced<commit_after>(function($, Craft)
{
	/**
	 * General purpose Doxter module
	 * Enables dynamic code block selection based on highlighter selected and other misc
	 */
	Craft.Doxter = Garnish.Base.extend(
	{
		init: function()
		{
			this.$codeBlockSnippet		= $('.codeBlockSnippet');
			this.$addPrismSnippetBtn	= $('.addPrismSnippetBtn');
			this.$addRainbowSnippetBtn	= $('.addRainbowSnippetBtn');

			this.addListener(this.$addPrismSnippetBtn, 'click', 'addHighlighterSnippet');
			this.addListener(this.$addRainbowSnippetBtn, 'click', 'addHighlighterSnippet');
		},

		addHighlighterSnippet: function(e)
		{
			var highlighter = $(e.target).data('highlighter');

			switch (highlighter)
			{
				case 'PrismJs':
				{
					this.$codeBlockSnippet.val('<pre><code class="language-{languageClass}">{sourceCode}</code></pre>');

					break;
				}
				case 'RainbowJs':
				{
					this.$codeBlockSnippet.val('<pre><code data-language="language-{languageClass}">{sourceCode}</code></pre>');

					break;
				}
				default:
				{
					this.$codeBlockSnippet.val('<pre><code data-language="language-{languageClass}">{sourceCode}</code></pre>');
				}
			}

			e.preventDefault();
		}
	});

	/**
	 * DoxterFieldType class to manage fieldtype instances
	 */
	Craft.DoxterFieldType = Garnish.Base.extend(
	{
		init: function(id)
		{
			this.id						= id;
            this.$textarea              = $("#" + this.id);
			this.$selectEntryButton		= $("#" + this.id + "SelectEntry");
			this.$selectAssetButton		= $("#" + this.id + "SelectAsset");
			this.$selectUserButton		= $("#" + this.id + "SelectUser");
			this.$selectTagButton		= $("#" + this.id + "SelectTag");
			this.$selectCategoryButton	= $("#" + this.id + "SelectCategory");
			this.$selectGlobalButton	= $("#" + this.id + "SelectGlobal");
			this.addListener(this.$selectEntryButton, 'click', 'createEntrySelectorModal');
			this.addListener(this.$selectAssetButton, 'click', 'createAssetSelectorModal');
			this.addListener(this.$selectUserButton, 'click', 'createUserSelectorModal');
			this.addListener(this.$selectTagButton, 'click', 'createTagSelectorModal');
			this.addListener(this.$selectCategoryButton, 'click', 'createCategorySelectorModal');
			this.addListener(this.$selectGlobalButton, 'click', 'createGlobalSetSelectorModal');
		},

		createSelectorModal: function(type)
		{
			var self = this;
			Craft.createElementSelectorModal(type,
			{
				id: this.id + 'Select' + type + 'Modal',
				onSelect: function(elements)
				{
					var tags = self.createReferenceTags(type.toLowerCase(), elements, 'image');
					self.writeToEditor(tags);
				}
			});
		},

		createEntrySelectorModal: function(e)
		{
			this.createSelectorModal('Entry', e);
			e.preventDefault();
		},

		createUserSelectorModal: function(e)
		{
			this.createSelectorModal('User', e);
			e.preventDefault();
		},

		createAssetSelectorModal: function(e)
		{
			var self = this;
			Craft.createElementSelectorModal('Asset',
			{
				id: this.id + 'SelectAssetModal',
				multiSelect: false,
				criteria: {kind: 'image'},
				onSelect: function(elements)
				{
					var tags = self.createReferenceTags('asset', elements, 'image');
					self.writeToEditor(tags);
				}
			});

			e.preventDefault();
		},

{'fraction_non_alphanumeric': 0.16336482779640354, 'fraction_numerical': 0.0, 'mean_word_length': 3.9606953892668177, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '6019838', 'n_tokens_mistral': 2494, 'n_tokens_neox': 2063, 'n_words': 322}