<commit_before>(function(jQuery) {
"use strict";

var $ = jQuery;

var plugin = Echo.Plugin.manifest("MediaCard", "Echo.StreamServer.Controls.Card");

if (Echo.Plugin.isDefined(plugin)) return;

plugin.config = {
	"presentation": {
		"maxCardWidth": 250,
		"mediaLayoutMode": "full"
	},
	"appTargetClass": "echo-apps-mediagallery"
};

plugin.init = function() {
	var cssClass = "." + this.config.get("appTargetClass").replace(/\s/g, ".") // it helps to apply css rules to current app instance only
		+ " ." + this.cssClass;
	Echo.Utils.addCSS(cssClass + ' { width:' + this.config.get("presentation.maxCardWidth") + 'px; }', cssClass);
};

plugin.component.renderers.content = function(element) {
	var item = this.component;
	var itemType = item.visualizer ? item.visualizer.id : "comment";
	var layoutMode = this.config.get("presentation.mediaLayoutMode");

	if (layoutMode === "compact") {
		element.addClass(this.cssPrefix + "layoutCompact");
	} else if (layoutMode === "pure") {
		var media = itemType === "photo"
			? item.view.get("plugin-PhotoCard-photoThumbnail")
			: itemType === "video"
				? item.view.get("plugin-VideoCard-video")
				: undefined;

		return media
			? element.empty().append(media)
			: item.parentRenderer("content", arguments);
	}
	item.parentRenderer("content", arguments);
	return element;
};

var timeout;

var publishingCallback = function(topic, args) {
	var self = this;
	if (timeout) {
		clearTimeout(timeout);
	}
	// this timeout is used to reduce isotope renderings
	// number by suppressing generating rival events
	timeout = setTimeout(function() {
		self.events.publish({
			"topic": "onChangeView"
		});
	}, 50);
};

$.map(["Echo.StreamServer.Controls.Card.onRender",
	"Echo.StreamServer.Controls.Card.Plugins.PhotoCard.onMediaLoad",
	"Echo.StreamServer.Controls.CardComposer.onCollapse",
	"Echo.StreamServer.Controls.CardComposer.onExpand",
	"Echo.StreamServer.Controls.CardComposer.onRender",
	"Echo.StreamServer.Controls.CardComposer.onPostComplete",
	"Echo.StreamServer.Controls.CardComposer.onPostError",
	"Echo.StreamServer.Controls.Card.onDelete",
	"Echo.StreamServer.Controls.Card.onAdd",
	"Echo.StreamServer.Controls.Card.onChildrenExpand",
	"Echo.StreamServer.Controls.MediaContainer.onAttachmentsPanelShow",
	"Echo.StreamServer.Controls.MediaContainer.onAttachmentsPanelHide"
], function(eventName) {
	plugin.events[eventName] = publishingCallback;
});

plugin.css =
	'.{plugin.class:layoutCompact} .echo-streamserver-controls-card-plugin-PhotoCard-photoLabel, .echo-streamserver-controls-card-plugin-VideoCard-label { display: none; }';

Echo.Plugin.create(plugin);

})(Echo.jQuery);
<commit_msg>fix to avoid problems in case of several whitespaces between class names<commit_after>(function(jQuery) {
"use strict";

var $ = jQuery;

var plugin = Echo.Plugin.manifest("MediaCard", "Echo.StreamServer.Controls.Card");

if (Echo.Plugin.isDefined(plugin)) return;

plugin.config = {
	"presentation": {
		"maxCardWidth": 250,
		"mediaLayoutMode": "full"
	},
	"appTargetClass": "echo-apps-mediagallery"
};

plugin.init = function() {
	var cssClass = "." + this.config.get("appTargetClass").replace(/\s+/g, ".") // it helps to apply css rules to current app instance only
		+ " ." + this.cssClass;
	Echo.Utils.addCSS(cssClass + ' { width:' + this.config.get("presentation.maxCardWidth") + 'px; }', cssClass);
};

plugin.component.renderers.content = function(element) {
	var item = this.component;
	var itemType = item.visualizer ? item.visualizer.id : "comment";
	var layoutMode = this.config.get("presentation.mediaLayoutMode");

	if (layoutMode === "compact") {
		element.addClass(this.cssPrefix + "layoutCompact");
	} else if (layoutMode === "pure") {
		var media = itemType === "photo"
			? item.view.get("plugin-PhotoCard-photoThumbnail")
			: itemType === "video"
				? item.view.get("plugin-VideoCard-video")
				: undefined;

		return media
			? element.empty().append(media)
			: item.parentRenderer("content", arguments);
	}
	item.parentRenderer("content", arguments);
	return element;
};

var timeout;

var publishingCallback = function(topic, args) {
	var self = this;
	if (timeout) {
		clearTimeout(timeout);
	}
	// this timeout is used to reduce isotope renderings
	// number by suppressing generating rival events
	timeout = setTimeout(function() {
		self.events.publish({
			"topic": "onChangeView"
		});
	}, 50);
};

$.map(["Echo.StreamServer.Controls.Card.onRender",
	"Echo.StreamServer.Controls.Card.Plugins.PhotoCard.onMediaLoad",
	"Echo.StreamServer.Controls.CardComposer.onCollapse",
	"Echo.StreamServer.Controls.CardComposer.onExpand",
	"Echo.StreamServer.Controls.CardComposer.onRender",
	"Echo.StreamServer.Controls.CardComposer.onPostComplete",
	"Echo.StreamServer.Controls.CardComposer.onPostError",
	"Echo.StreamServer.Controls.Card.onDelete",
	"Echo.StreamServer.Controls.Card.onAdd",
	"Echo.StreamServer.Controls.Card.onChildrenExpand",
	"Echo.StreamServer.Controls.MediaContainer.onAttachmentsPanelShow",
	"Echo.StreamServer.Controls.MediaContainer.onAttachmentsPanelHide"
], function(eventName) {
	plugin.events[eventName] = publishingCallback;
});

plugin.css =
	'.{plugin.class:layoutCompact} .echo-streamserver-controls-card-plugin-PhotoCard-photoLabel, .echo-streamserver-controls-card-plugin-VideoCard-label { display: none; }';

Echo.Plugin.create(plugin);

})(Echo.jQuery);

{'fraction_non_alphanumeric': 0.15566741237882178, 'fraction_numerical': 0.0018642803877703207, 'mean_word_length': 5.223897911832947, 'pattern_counts': {'":': 10, '<': 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': '1267074', 'n_tokens_mistral': 1830, 'n_tokens_neox': 1740, 'n_words': 285}