<commit_before>(function ($) {
	var numYears = 5;

	function formatDate(year, month, day) {
		return ('0000' + year).substr(-4) + '-' + ('00' + month).substr(-2) + '-' + ('00' + day).substr(-2);
	}

	function getMonthHtml(year, month, settings) {
		var monthHtml = '<div class="sys-datepicker-month" data-year="' + year + '" data-month="' + month + '"><div class="sys-datepicker-month-header">' + settings.monthNames[month - 1] + ' ' + year + '</div>';

		var date = new Date(formatDate(year, month, 1)),
			daysPerMonth = month == 4 || month == 6 || month == 9 || month == 11 ? 30
				: (month == 2 ? (year & 3 || !(year % 25) && year & 15 ? 28 : 29) : 31);

		for (var i = 0; i < (date.getDay() - settings.firstDay)%7; i++) {
			monthHtml = monthHtml + '<div class="sys-datepicker-placeholder"/>';
		}
		var today = getTodayISO();
		for (var d = 1; d <= daysPerMonth; d++) {
			var classes = [ 'sys-datepicker-day' ],
				thisDate = formatDate(year, month, d);
			if (thisDate == today) {
				classes.push('sys-datepicker-day-today');
			}
			var dow = getDayOfWeek(thisDate);
			if (dow == 0 || dow == 6) {
				classes.push('sys-datepicker-day-weekend');
			}
			monthHtml = monthHtml + '<div class="' + classes.join(' ') + '" data-date="' + thisDate + '">' + d + '</div>';
		}

		monthHtml = monthHtml + '</div>';

		return monthHtml;
	}

	function getYearHtml(year, settings) {
		var yearHtml = '<div class="sys-datepicker-year" data-year="' + year + '">';

		for (var m = 1; m <= 12; m++) {
			yearHtml = yearHtml + getMonthHtml(year, m, settings);
		}

		yearHtml = yearHtml + '</div>';

		return yearHtml;
	}

	function addYear(dp, year, settings) {
		var dpBody = dp.find('.sys-datepicker-body');
		var bottomYear = $('.sys-datepicker-year:eq(-1)').data('year');

		if (year > bottomYear) {
			// Append one at the bottom
			dpBody.append(getYearHtml(year, settings));
			// Remove one at the top while maintaining the scroll position
			var scrollTop = dpBody.scrollTop();
			dp.find('.sys-datepicker-year:eq(0)').remove();
			dpBody.scrollTop(scrollTop - dp.find('.sys-datepicker-year:eq(0)').outerHeight(true));
		} else {
			// Append year at the top while maintaining scroll position
			var scrollTop = dpBody.scrollTop();
			dpBody.prepend(getYearHtml(year, settings));
			dpBody.scrollTop(scrollTop + dp.find('.sys-datepicker-year:eq(0)').outerHeight(true));
			// Remove one at the bottom
			dp.find('.sys-datepicker-year:eq(-1)').remove();
		}
	}

	function populate(dp, settings) {
		var dpBody = dp.find('.sys-datepicker-body'),
			startYear = parseInt(settings.defaultDate);

		// Add years
		for (var y = startYear - (numYears - 1) / 2; y <= startYear + (numYears - 1) / 2; y++) {
			dpBody.append(getYearHtml(y, settings));
		}
	}

	function gotoYearMonth(dp, year, month, settings) {
		var dpBody = dp.find('.sys-datepicker-body');
		var selector = '.sys-datepicker-month[data-year="' + year + '"]';

		if (month >= 1 && month <= 12) {
			selector = selector + '[data-month="' + month + '"]';
		}

		var monthEl = dp.find(selector);
		if (monthEl.length == 0) {
			// Append year
			addYear(dp, year, settings);
			monthEl = dp.find(selector)
		}

		// Remove all other years
		dp.find('.sys-datepicker-year:not([data-year="' + year + '"])').remove();
		// Add the years before ...
		for (var y = year - 1; y >= year - (numYears - 1) / 2; y--) {
			dpBody.prepend(getYearHtml(y, settings));
		}
		// ... and after
		for (var y = year + 1; y <= year + (numYears - 1) / 2; y++) {
			dpBody.append(getYearHtml(y, settings));
		}

		// Scroll to that year and month
		dpBody.scrollTop(dpBody.scrollTop() + monthEl.position().top);
		// dpBody.animate({scrollTop: dpBody.scrollTop() + monthEl.position().top}, 250);
	}

	function getCurrent(dp) {
		var current;

		dp.find('.sys-datepicker-month').each(function () {
			var monthEl = $(this);

			if (monthEl.position().top + monthEl.outerHeight(true) / 2 > 0) {
				current = {
					year: monthEl.data('year'),
					month: monthEl.data('month')
				};
				return false;
			}
		});

		return current;
	}

	function getTodayISO() {
		var today = new Date();

		return formatDate(today.getFullYear(), today.getMonth() + 1, today.getDate());
	}

	function getDayOfWeek(date) {
		return (new Date(date)).getDay();
	}

	$.fn.datepicker = function (options, value) {
		if (options == 'show') {
			this.trigger('show.sys-datepicker');

		} else if (options == 'hide') {
			this.trigger('hide.sys-datepicker');

		} else if (options == 'addDates') {
			this.trigger('addDates.sys-datepicker', [value]);

		} else if (options == 'removeDates') {
			this.trigger('removeDates.sys-datepicker', [value]);

		} else {
			var settings = $.extend({
				onSelect: null,
				defaultDate: getTodayISO(),
				monthNames: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ],
				dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ],
				firstDay: 0,
				prevYearText: '&lt;&lt;',
				prevText: '&lt;',
				todayText: 'today',
				nextText: '&gt;',
				nextYearText: '&gt;&gt;'
			}, options);

			this.each(function () {
				var el = $(this);

				if (el.hasClass('sys-datepicker-attached')) {
					// Don’t init twice
					return;
				}

				el.addClass('sys-datepicker-attached');

				var dp = $('<div class="sys-datepicker" style="display:none"/>').appendTo('body'),
					dpContent = $('<div class="sys-datepicker-content"/>').appendTo(dp),
					// Note on the spaces between elements in the next line: this is required for text-align:justify to work
					// See http://stackoverflow.com/questions/12822068/dom-equidistant-divs-with-inline-blocks-and-text-justify-wont-work-when-inserti#12822407
					dpHeader = $('<div class="sys-datepicker-header"><div class="sys-datepicker-buttons"><div class="sys-datepicker-button sys-datepicker-button-prevyear">' + settings.prevYearText + '</div> <div class="sys-datepicker-button sys-datepicker-button-prevmonth">' + settings.prevText + '</div> <div class="sys-datepicker-button sys-datepicker-button-today">' + settings.todayText + '</div> <div class="sys-datepicker-button sys-datepicker-button-nextmonth">' + settings.nextText + '</div> <div class="sys-datepicker-button sys-datepicker-button-nextyear">' + settings.nextYearText + '</div></div></div>').appendTo(dpContent),
					dpBody = $('<div class="sys-datepicker-body"/>').appendTo(dpContent),
					selectedDates = [];

				var dpDayHeaders = $('<div class="sys-datepicker-days"/>').appendTo(dpHeader);
				for (var i = settings.firstDay; i <= settings.firstDay + 6; i++) {
					var dayHeaderHtml = '<div class="sys-datepicker-days-dow';
					if (i == 0 || i == 6) {
						dayHeaderHtml = dayHeaderHtml + ' sys-datepicker-day-weekend';
					}
					$(dayHeaderHtml + '">' + (settings.dayNamesMin[i % 7] + '</div>')).appendTo(dpDayHeaders);
				}
<commit_msg>Fixed problem with Sunday not being recognized as weekend when week start with Monday<commit_after>(function ($) {
	var numYears = 5;

	function formatDate(year, month, day) {
		return ('0000' + year).substr(-4) + '-' + ('00' + month).substr(-2) + '-' + ('00' + day).substr(-2);
	}

	function getMonthHtml(year, month, settings) {
		var monthHtml = '<div class="sys-datepicker-month" data-year="' + year + '" data-month="' + month + '"><div class="sys-datepicker-month-header">' + settings.monthNames[month - 1] + ' ' + year + '</div>';

		var date = new Date(formatDate(year, month, 1)),
			daysPerMonth = month == 4 || month == 6 || month == 9 || month == 11 ? 30
				: (month == 2 ? (year & 3 || !(year % 25) && year & 15 ? 28 : 29) : 31);

		for (var i = 0; i < (date.getDay() - settings.firstDay)%7; i++) {
			monthHtml = monthHtml + '<div class="sys-datepicker-placeholder"/>';
		}
		var today = getTodayISO();
		for (var d = 1; d <= daysPerMonth; d++) {
			var classes = [ 'sys-datepicker-day' ],
				thisDate = formatDate(year, month, d);
			if (thisDate == today) {
				classes.push('sys-datepicker-day-today');
			}
			var dow = getDayOfWeek(thisDate);
			if (dow == 0 || dow == 6) {
				classes.push('sys-datepicker-day-weekend');
			}
			monthHtml = monthHtml + '<div class="' + classes.join(' ') + '" data-date="' + thisDate + '">' + d + '</div>';
		}

		monthHtml = monthHtml + '</div>';

		return monthHtml;
	}

	function getYearHtml(year, settings) {
		var yearHtml = '<div class="sys-datepicker-year" data-year="' + year + '">';

		for (var m = 1; m <= 12; m++) {
			yearHtml = yearHtml + getMonthHtml(year, m, settings);
		}

		yearHtml = yearHtml + '</div>';

		return yearHtml;
	}

	function addYear(dp, year, settings) {
		var dpBody = dp.find('.sys-datepicker-body');
		var bottomYear = $('.sys-datepicker-year:eq(-1)').data('year');

		if (year > bottomYear) {
			// Append one at the bottom
			dpBody.append(getYearHtml(year, settings));
			// Remove one at the top while maintaining the scroll position
			var scrollTop = dpBody.scrollTop();
			dp.find('.sys-datepicker-year:eq(0)').remove();
			dpBody.scrollTop(scrollTop - dp.find('.sys-datepicker-year:eq(0)').outerHeight(true));
		} else {
			// Append year at the top while maintaining scroll position
			var scrollTop = dpBody.scrollTop();
			dpBody.prepend(getYearHtml(year, settings));
			dpBody.scrollTop(scrollTop + dp.find('.sys-datepicker-year:eq(0)').outerHeight(true));
			// Remove one at the bottom
			dp.find('.sys-datepicker-year:eq(-1)').remove();
		}
	}

	function populate(dp, settings) {
		var dpBody = dp.find('.sys-datepicker-body'),
			startYear = parseInt(settings.defaultDate);

		// Add years
		for (var y = startYear - (numYears - 1) / 2; y <= startYear + (numYears - 1) / 2; y++) {
			dpBody.append(getYearHtml(y, settings));
		}
	}

	function gotoYearMonth(dp, year, month, settings) {
		var dpBody = dp.find('.sys-datepicker-body');
		var selector = '.sys-datepicker-month[data-year="' + year + '"]';

		if (month >= 1 && month <= 12) {
			selector = selector + '[data-month="' + month + '"]';
		}

		var monthEl = dp.find(selector);
		if (monthEl.length == 0) {
			// Append year
			addYear(dp, year, settings);
			monthEl = dp.find(selector)
		}

		// Remove all other years
		dp.find('.sys-datepicker-year:not([data-year="' + year + '"])').remove();
		// Add the years before ...
		for (var y = year - 1; y >= year - (numYears - 1) / 2; y--) {
			dpBody.prepend(getYearHtml(y, settings));
		}
		// ... and after
		for (var y = year + 1; y <= year + (numYears - 1) / 2; y++) {
			dpBody.append(getYearHtml(y, settings));
		}

		// Scroll to that year and month
		dpBody.scrollTop(dpBody.scrollTop() + monthEl.position().top);
		// dpBody.animate({scrollTop: dpBody.scrollTop() + monthEl.position().top}, 250);
	}

	function getCurrent(dp) {
		var current;

		dp.find('.sys-datepicker-month').each(function () {
			var monthEl = $(this);

			if (monthEl.position().top + monthEl.outerHeight(true) / 2 > 0) {
				current = {
					year: monthEl.data('year'),
					month: monthEl.data('month')
				};
				return false;
			}
		});

		return current;
	}

	function getTodayISO() {
		var today = new Date();

		return formatDate(today.getFullYear(), today.getMonth() + 1, today.getDate());
	}

	function getDayOfWeek(date) {
		return (new Date(date)).getDay();
	}

	$.fn.datepicker = function (options, value) {
		if (options == 'show') {
			this.trigger('show.sys-datepicker');

		} else if (options == 'hide') {
			this.trigger('hide.sys-datepicker');

		} else if (options == 'addDates') {
			this.trigger('addDates.sys-datepicker', [value]);

		} else if (options == 'removeDates') {
			this.trigger('removeDates.sys-datepicker', [value]);

		} else {
			var settings = $.extend({
				onSelect: null,
				defaultDate: getTodayISO(),
				monthNames: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ],
				dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ],
				firstDay: 0,
				prevYearText: '&lt;&lt;',
				prevText: '&lt;',
				todayText: 'today',
				nextText: '&gt;',
				nextYearText: '&gt;&gt;'
			}, options);

			this.each(function () {
				var el = $(this);

				if (el.hasClass('sys-datepicker-attached')) {
					// Don’t init twice
					return;
				}

				el.addClass('sys-datepicker-attached');

				var dp = $('<div class="sys-datepicker" style="display:none"/>').appendTo('body'),
					dpContent = $('<div class="sys-datepicker-content"/>').appendTo(dp),
					// Note on the spaces between elements in the next line: this is required for text-align:justify to work
					// See http://stackoverflow.com/questions/12822068/dom-equidistant-divs-with-inline-blocks-and-text-justify-wont-work-when-inserti#12822407
					dpHeader = $('<div class="sys-datepicker-header"><div class="sys-datepicker-buttons"><div class="sys-datepicker-button sys-datepicker-button-prevyear">' + settings.prevYearText + '</div> <div class="sys-datepicker-button sys-datepicker-button-prevmonth">' + settings.prevText + '</div> <div class="sys-datepicker-button sys-datepicker-button-today">' + settings.todayText + '</div> <div class="sys-datepicker-button sys-datepicker-button-nextmonth">' + settings.nextText + '</div> <div class="sys-datepicker-button sys-datepicker-button-nextyear">' + settings.nextYearText + '</div></div></div>').appendTo(dpContent),
					dpBody = $('<div class="sys-datepicker-body"/>').appendTo(dpContent),
					selectedDates = [];

				var dpDayHeaders = $('<div class="sys-datepicker-days"/>').appendTo(dpHeader);
				for (var i = settings.firstDay; i <= settings.firstDay + 6; i++) {
					var dayHeaderHtml = '<div class="sys-datepicker-days-dow',
						dow = i % 7;
					if (dow == 0 || dow == 6) {
						dayHeaderHtml = dayHeaderHtml + ' sys-datepicker-day-weekend';
					}
					$(dayHeaderHtml + '">' + (settings.dayNamesMin[dow] + '</div>')).appendTo(dpDayHeaders);
				}

{'fraction_non_alphanumeric': 0.19511139952411855, 'fraction_numerical': 0.01254596582305862, 'mean_word_length': 3.5076373090672734, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 69, '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': '2056322', 'n_tokens_mistral': 5496, 'n_tokens_neox': 4604, 'n_words': 1043}