<commit_before>;(function($) {
	$(function () {
		var segment = 'dashboard';
		if ($('#DashboardUrl').length) {
			segment = $('#DashboardUrl').val();
		}
		var collapsed = [];
		var cookie    = $.cookie("dashlets-collapsed");

		if(cookie) {
			collapsed = cookie.split(",");

			$.each(collapsed, function() {
				var dashlet = $(".dashlet[data-id=" + this + "]");

				dashlet.addClass("dashlet-collapsed")
					   .find(".dashlet-content")
					   .slideUp("fast")
					   .end()
					   .find(".dashlet-action-toggle")
					   .addClass("ui-icon-plus")
					   .removeClass("ui-icon-minus");
			});
		}

		var dialog = $("<div />").addClass("dashlet-dialog").hide().appendTo("body");
//
//		function helper() {
//			return $("<div />").addClass("dashlet-drag ui-state-highlight").appendTo("body");
//		}
//
//		function update(e, ui) {
//			var dashboard = $(ui.item).parent(".dashboard");
//			var id        = dashboard.data("id");
//
//			var ids = dashboard.find(".dashlet").map(function(i, el) {
//				return $(el).data("id");
//			});
//
//			$.post(segment + "/updateDashboard", { dashboard: id, 'order[]': ids.get() })
//		}
//
//		$(".dashboard").each(function() {
//			$(this).sortable({
//				placeholder: "ui-state-highlight dashlet-placeholder",
//				handle:      ".dashlet-title",
//				connectWith: ".dashboard",
//				tolerance:   "pointer",
//				revert:      true,
//				helper:      helper,
//				update:      update
//			});
//		});

		var gridster = $(".gridster ul").gridster({
			widget_margins: [10, 10],
			widget_base_dimensions: [120, 120],
			avoid_overlapped_widgets: true,
			resize: {
				enabled: true,
				handle_class: 'dashlet-resize', //Setting the class of the resize handle
				stop: function(e, i, widget) {
					/*
					*	This function creates post requests for the resized object
					*	and also every object that had its position changed.
					*	The resized object, isn't classified as a changed object
					*	hence why there are two separate posts, as we cannot loop
					*	over just the $changed objects.
					*/
					$.post($(widget[0].firstElementChild).attr('data-link') + '/save', this.serialize($(widget))[0])
					.done(function(data) {});

					if(this.$changed.length > 0) {
						for(var i = 0; i < $(this.$changed).length; i++) {
							$.post($(this.$changed[i].firstElementChild).attr('data-link') + '/save', this.serialize($(this.$changed))[i])
							.done(function() {});
						}
					}

					/*
					*	Using this as to clear out what objects are in a "changed" state
					*	as we already have it saved to the database.
					*	This is because the changed states persists across every
					*	change regardless of if the object was actually changed
					*	in that specific call.
					*	Otherwise we'd be writing to the database when we didn't
					*	need to because nothing had changed :)
					*/
					this.$changed = $([]);
				}
			},
			draggable: {
				stop: function(e, i) {
					/*
					*	If objects have changed position, cycle through all changed objects
					*	and create post requests to update positions in the database.
					*/
					if(this.$changed.length > 0) {
						for(var i = 0; i < $(this.$changed).length; i++) {
							$.post($(this.$changed[i].firstElementChild).attr('data-link') + '/save', this.serialize($(this.$changed))[i])
							.done(function() {});
						}
					}

					//See above in resize.stop to see why we do this.
					this.$changed = $([]);<commit_msg>Use a drag handle for dashlets istead of whole dashlet<commit_after>;(function($) {
	$(function () {
		var segment = 'dashboard';
		if ($('#DashboardUrl').length) {
			segment = $('#DashboardUrl').val();
		}
		var collapsed = [];
		var cookie    = $.cookie("dashlets-collapsed");

		if(cookie) {
			collapsed = cookie.split(",");

			$.each(collapsed, function() {
				var dashlet = $(".dashlet[data-id=" + this + "]");

				dashlet.addClass("dashlet-collapsed")
					   .find(".dashlet-content")
					   .slideUp("fast")
					   .end()
					   .find(".dashlet-action-toggle")
					   .addClass("ui-icon-plus")
					   .removeClass("ui-icon-minus");
			});
		}

		var dialog = $("<div />").addClass("dashlet-dialog").hide().appendTo("body");
//
//		function helper() {
//			return $("<div />").addClass("dashlet-drag ui-state-highlight").appendTo("body");
//		}
//
//		function update(e, ui) {
//			var dashboard = $(ui.item).parent(".dashboard");
//			var id        = dashboard.data("id");
//
//			var ids = dashboard.find(".dashlet").map(function(i, el) {
//				return $(el).data("id");
//			});
//
//			$.post(segment + "/updateDashboard", { dashboard: id, 'order[]': ids.get() })
//		}
//
//		$(".dashboard").each(function() {
//			$(this).sortable({
//				placeholder: "ui-state-highlight dashlet-placeholder",
//				handle:      ".dashlet-title",
//				connectWith: ".dashboard",
//				tolerance:   "pointer",
//				revert:      true,
//				helper:      helper,
//				update:      update
//			});
//		});

		var gridster = $(".gridster ul").gridster({
			widget_margins: [10, 10],
			widget_base_dimensions: [120, 120],
			avoid_overlapped_widgets: true,
			resize: {
				enabled: true,
				handle_class: 'dashlet-resize', //Setting the class of the resize handle
				stop: function(e, i, widget) {
					/*
					*	This function creates post requests for the resized object
					*	and also every object that had its position changed.
					*	The resized object, isn't classified as a changed object
					*	hence why there are two separate posts, as we cannot loop
					*	over just the $changed objects.
					*/
					$.post($(widget[0].firstElementChild).attr('data-link') + '/save', this.serialize($(widget))[0])
					.done(function(data) {});

					if(this.$changed.length > 0) {
						for(var i = 0; i < $(this.$changed).length; i++) {
							$.post($(this.$changed[i].firstElementChild).attr('data-link') + '/save', this.serialize($(this.$changed))[i])
							.done(function() {});
						}
					}

					/*
					*	Using this as to clear out what objects are in a "changed" state
					*	as we already have it saved to the database.
					*	This is because the changed states persists across every
					*	change regardless of if the object was actually changed
					*	in that specific call.
					*	Otherwise we'd be writing to the database when we didn't
					*	need to because nothing had changed :)
					*/
					this.$changed = $([]);
				}
			},
			draggable: {
				handle: '.dashlet-title h3',
				stop: function(e, i) {
					/*
					*	If objects have changed position, cycle through all changed objects
					*	and create post requests to update positions in the database.
					*/
					if(this.$changed.length > 0) {
						for(var i = 0; i < $(this.$changed).length; i++) {
							$.post($(this.$changed[i].firstElementChild).attr('data-link') + '/save', this.serialize($(this.$changed))[i])
							.done(function() {});
						}
					}

					//See above in resize.stop to see why we do this.
					this.$changed = $([]);
{'fraction_non_alphanumeric': 0.18400687876182287, 'fraction_numerical': 0.004729148753224419, 'mean_word_length': 2.6029943211151263, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6166808', 'n_tokens_mistral': 2807, 'n_tokens_neox': 2219, 'n_words': 560}