if (window.location.href.indexOf("?editMode=1") !== -1) {
window.location.href = window.location.href.replace(
"?editMode=1",
"/editMode/1"
);
}
if (
window.location.href.indexOf("/stream") !== -1 &&
window.location.href.indexOf("/editMode/1") !== -1
) {
setNewEditor();
const gridParams = {
beauty: 0,
type: 0,
trainingsParams: [],
dateParams: [],
progress: 0,
lessonsParams: [],
additionalHeader: "",
};
$(() => {
setNewEditor();
$("body").append(`
`);
$(".stream-table tr").each(function (index) {
$(".training-switcher").append(`
Не на всю ширину
На всю ширину
— Тренинг "${
$(this).find($(".stream-title")).text().trim().substring(0, 50) + "..."
}"
`);
});
if ($(".stream-table tr").length < 1) {
$('button[data-target="#trainings-content"]').addClass("disabled");
}
$(".lesson-list li:not(.divider)").each(function (index) {
$("#lessons-content").append(`
Стандартный чёрный
Жёлтый
Белый
— Урок "${
$(this).find($(".link.title")).text().trim().substring(0, 50) + "..."
}"
`);
});
if ($(".lesson-list li:not(.divider)").length < 1) {
$('button[data-target="#lessons-content"]').addClass("disabled");
}
$(".stream-table tr").each(function (index) {
$(".training-date-switcher").append(`
— Тренинг "${$(this).find($(".stream-title")).text().trim().substring(0, 50) + "..."}"
`);
$(`#datepicker-${index}`).datetimepicker();
});
$("#gridModal .modal-body")
.append(`После выставления всех настроек не забудьте сохранить страницу стандартным способом!
ОК
`);
});
let windowParamCheck = setInterval(() => {
if (window.pageParams !== undefined) {
clearInterval(windowParamCheck);
if (window.pageParams.params.attributesStr.length > 0) {
let encodedData = window.pageParams.params.attributesStr
.substring(
window.pageParams.params.attributesStr.indexOf("data-params"),
window.pageParams.params.attributesStr.indexOf("data-header") - 2
)
.replace('data-params="', "");
let data = JSON.parse(decodeURIComponent(encodedData));
if (data.progress == undefined) {
data.progress = 0;
}
if (data.additionalHeader == undefined) {
data.additionalHeader = "";
}
if (data.dateParams == undefined) {
data.dateParams = [];
}
gridParams.beauty = data.beauty;
if (gridParams.beauty * 1 == 1) {
$(`.beauty-switch`).val(1);
} else {
$(`.beauty-switch`).val(0);
}
gridParams.type = data.type;
if (gridParams.type * 1 == 1) {
$(`.type-switch`).val(1);
} else {
$(`.type-switch`).val(0);
}
$(".header-switch").val(data.additionalHeader);
$(".progress-switch").val(data.progress);
let index = 0;
gridParams.trainingsParams = data.trainingsParams;
gridParams.lessonsParams = data.lessonsParams;
if (gridParams.lessonsParams == undefined)
gridParams.lessonsParams = [];
gridParams.trainingsParams.forEach((training) => {
$(`.trn-${index}`).val(training);
index++;
});
let lsnIndex = 0;
gridParams.lessonsParams.forEach((lesson) => {
$(`.lsn-${lsnIndex}`).val(lesson);
lsnIndex++;
});
let dataIndex = 0;
gridParams.dateParams = data.dateParams;
gridParams.dateParams.forEach((training) => {
$(`#datepicker-${dataIndex}`).val(training);
dataIndex++;
});
}
$("#gridModal input").change(function () {
setPageNewSettings();
});
$("#gridModal .btn-primary").click(function () {
setPageNewSettings();
});
$("#gridModal select").change(function () {
setPageNewSettings();
});
}
}, 1000);
}
function setPageNewSettings() {
let gridParams = {
beauty: $(`.beauty-switch`).val(),
type: $(`.type-switch`).val(),
trainingsParams: [],
lessonsParams: [],
dateParams: [],
progress: $(".progress-switch").val(),
additionalHeader: $(".header-switch").val(),
};
$(".trn").each(function () {
gridParams.trainingsParams.push($(this).val());
});
$(".lesson-switch").each(function () {
gridParams.lessonsParams.push($(this).val());
});
$(".date-trn").each(function () {
gridParams.dateParams.push($(this).val());
});
window.pageParams.params.attributesStr = `data-params="${encodeURIComponent(
JSON.stringify(gridParams)
)}" data-header ="${window.btoa(
unescape(encodeURIComponent($("h1").text()))
)}" data-breadcrumbs="${window.btoa(
unescape(encodeURIComponent($(".breadcrumbs").html()))
)}"`;
}
function setNewEditor() {
if ($.gc !== undefined) {
$.gc.xdget_trainingEditor.prototype.fillOwnPanel = function (a, c) {
$btnToolbar = $("
");
$btnGroup = $("
");
$btnGroup.appendTo($btnToolbar);
$btnToolbar.appendTo(a.body);
$saveButtonEl = $(
" " +
Yii.t("common", "Save") +
" "
);
$saveButtonEl.appendTo($btnGroup);
$onewayButtonEl = $(
" Настройка "
);
$onewayButtonEl.appendTo($btnGroup);
$previewButtonEl = $(
" "
);
$previewButtonEl.appendTo($btnGroup);
$cssButtonEl = $(
" "
);
$cssButtonEl.appendTo($btnGroup);
$selectButtonEl = $(
" "
);
$selectButtonEl.appendTo($btnGroup);
$delButtonEl = $(
"" +
Yii.t(
"common",
"\u0421\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b"
) +
"
"
);
$delButtonEl.appendTo(a.parent());
$delButtonEl.click(function () {
if (
!confirm(
Yii.t(
"common",
"\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043a \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0432\u0438\u0434\u0443?"
)
)
)
return !1;
ajaxCall(
location.pathname,
{ action: "resetXdget" },
{ btn: $(this) },
function (a) {
location.href = location.href;
}
);
});
$(document).keydown(function (a) {
83 == a.keyCode && a.ctrlKey && $saveButtonEl.click();
});
var b = this;
window.pageParams = b;
$cssButtonEl.click(function () {
b.xdget.startEditing();
$(".global-xdget-editor .param-input-css").click();
});
$selectButtonEl.click(function () {
b.xdget.startEditing();
$(".main-settings-panel").get(0).scrollIntoView();
});
a.setHeader("\u0422\u0440\u0435\u043d\u0438\u043d\u0433");
a.addClass("panel-with-toolbar");
$btnToolbar = $(
"
"
);
$btnGroup = $("
");
$btnGroup.appendTo($btnToolbar);
$shortSaveButton = $(
" " +
Yii.t("common", "Save") +
" "
);
$shortSaveButton.appendTo($btnGroup);
$shortPreviewButtonEl = $(
" "
);
$shortPreviewButtonEl.appendTo($btnGroup);
$btnToolbar.appendTo(a.header);
a.find(".btn-oneway").click(function () {
$("#gridModal").modal("show");
});
a.find(".btn-save").click(function () {
b.xdget.getAsObject().params.attributesStr =
window.pageParams.params.attributesStr;
ajaxCall(
b.params.saveUrl,
{ xdgetData: b.xdget.getAsObject() },
{ btn: $(this) },
function (a) {
a.need_refresh_page && (location.href = location.href);
}
);
return !1;
});
a.find(".btn-preview").click(function () {
location.href = "?editMode=0";
return !1;
});
};
}
}
if (
window.location.href.indexOf("/stream/view") !== -1 &&
window.location.href.indexOf("edit") === -1
) {
$(() => {
let beautyChecker = $(".xdget-training").attr("data-params");
if (beautyChecker !== undefined) {
let data = JSON.parse(decodeURIComponent(beautyChecker));
let header = decodeURIComponent(
escape(window.atob($(".xdget-training").attr("data-header")))
);
let breadcrumbs = decodeURIComponent(
escape(window.atob($(".xdget-training").attr("data-breadcrumbs")))
);
if (data.beauty * 1) {
$("body").addClass("isTrainingsPage");
if (data.type == "0") {
$("body").addClass("isBlocksPage");
}
if (data.type == "1") {
$("body").addClass("isModulesPage");
$("body").attr("maximum-progress", data.progress);
createProgress();
}
let index = 0;
data.trainingsParams.forEach((training) => {
$(".stream-table tr").eq(index).attr("fullwidth", training);
index++;
});
let dataIndex = 0;
data.dateParams.forEach((training) => {
if (training.length > 3) {
let hh = new Date(training).getHours();
let mn = new Date(training).getMinutes();
let dd = new Date(training).getDate();
let mm = new Date(training).getMonth() + 1;
if (hh < 10) {
hh = "0" + hh;
}
if (mn < 10) {
mn = "0" + mn;
}
if (dd < 10) {
dd = "0" + dd;
}
if (mm < 10) {
mm = "0" + mm;
}
$(".stream-table tr").eq(dataIndex).addClass("has-date");
$(".stream-table tr")
.eq(dataIndex)
.attr(
"data-date",
`${dd}.${mm}.${new Date(training).getFullYear()} в ${hh}:${mn}`
);
if (new Date(training).getFullYear() == "2033") {
$(".stream-table tr").eq(dataIndex).addClass("closed-no-date");
}
if (new Date(training) > new Date()) {
$(".stream-table tr").eq(dataIndex).addClass("closed");
}
}
dataIndex++;
});
$(".stream-table tr:not(.has-date)").each(function () {
let link = $(this).find($("a")).attr("href");
$.get(link, (data) => {
var lesson = $(" ")
.append($.parseHTML(data))
.find(".lesson-date");
if (lesson.length) {
let date = GCtimeToDate(lesson[0]);
let hh = new Date(date).getHours();
let mn = new Date(date).getMinutes();
let dd = new Date(date).getDate();
let mm = new Date(date).getMonth() + 1;
if (hh < 10) {
hh = "0" + hh;
}
if (mn < 10) {
mn = "0" + mn;
}
if (dd < 10) {
dd = "0" + dd;
}
if (mm < 10) {
mm = "0" + mm;
}
$(this).addClass("has-date");
$(this).attr(
"data-date",
`${dd}.${mm}.${new Date(date).getFullYear()} в ${hh}:${mn}`
);
if (new Date(date).getFullYear() == "2033") {
$(this).addClass("closed");
}
if (new Date(date) > new Date()) {
$(this).addClass("closed");
}
}
});
});
getImages();
$(".breadcrumbs a").each(function () {
$(this).text(
$(this).text().replace("Тренинги", "Доступные тренинги")
);
});
$(".xdget-button").eq(0).parent().addClass("xdget-button-wrapper");
$("body").append(`
`);
$("#buttonsModal .modal-body").append(
$(".xdget-button-wrapper").clone()
);
$(".xdget-trainingList")
.before(``);
$(".xdget-button.mobile-blocks").click(function () {
$("#buttonsModal").modal("show");
});
let calendar = $("#color-calendar").parent();
let calendarParent = calendar.parent();
if (window.matchMedia("(max-width: 991px)").matches) {
$("#buttonsModal .modal-body").append(calendar);
} else {
calendarParent.append(calendar);
}
$(window).on("resize", function () {
if (window.matchMedia("(max-width: 991px)").matches) {
$("#buttonsModal .modal-body").append(calendar);
} else {
calendarParent.append(calendar);
}
});
if ($(".lesson-list li:not(.divider)").length > 0) {
$("body").addClass("isLessonList");
$("body").attr("max-progress", data.progress);
let index = 0;
data.lessonsParams.forEach((lesson) => {
$(".lesson-list li:not(.divider)")
.eq(index)
.attr("data-type", lesson);
index++;
});
if ($(".chatium_body").length) {
$("body").prepend("" + header + " ");
}
if (data.additionalHeader == undefined) {
data.additionalHeader = " ";
} else {
$(".breadcrumbs").append(`${data.additionalHeader} `);
}
$("h1").before(
``
);
if (
$("body").attr("max-progress") !== undefined &&
$(".xdget-trainingAchievements .badge").length > 0
) {
let earned = $(".xdget-trainingAchievements .badge")
.text()
.match(/\d+/)[0];
let maximum = $("body").attr("max-progress");
let size = 122;
if (window.matchMedia("(max-width: 768px)").matches) {
size = 122;
}
$(".xdget-trainingAchievements").hide()
.after(`
Ваш прогресс
${data.additionalHeader}
${$("h1").text().trim()}
`);
var Dial = function (container) {
this.container = container;
this.size = this.container.dataset.size;
this.strokeWidth = this.size / 12;
this.radius = this.size / 2 - this.strokeWidth / 2;
this.value = this.container.dataset.value;
this.direction = this.container.dataset.arrow;
this.svg;
this.defs;
this.slice;
this.overlay;
this.text;
this.arrow;
this.create();
};
Dial.prototype.create = function () {
this.createSvg();
this.createDefs();
this.createSlice();
this.createText();
this.container.appendChild(this.svg);
};
Dial.prototype.createSvg = function () {
var svg = document.createElementNS(
"http://www.w3.org/2000/svg",
"svg"
);
svg.setAttribute("width", this.size + "px");
svg.setAttribute("height", this.size + "px");
this.svg = svg;
};
Dial.prototype.createDefs = function () {
var defs = document.createElementNS(
"http://www.w3.org/2000/svg",
"defs"
);
var linearGradient = document.createElementNS(
"http://www.w3.org/2000/svg",
"linearGradient"
);
linearGradient.setAttribute(
"id",
`gradient${$(".progress-wrapper linearGradient").length}`
);
var stop1 = document.createElementNS(
"http://www.w3.org/2000/svg",
"stop"
);
stop1.setAttribute("stop-color", "#FFDF93");
stop1.setAttribute("offset", "0%");
linearGradient.appendChild(stop1);
var stop2 = document.createElementNS(
"http://www.w3.org/2000/svg",
"stop"
);
stop2.setAttribute("stop-color", "#FFDF93");
stop2.setAttribute("offset", "15%");
linearGradient.appendChild(stop2);
var stop3 = document.createElementNS(
"http://www.w3.org/2000/svg",
"stop"
);
stop3.setAttribute("stop-color", "#FFC233");
stop3.setAttribute("offset", "144%");
linearGradient.appendChild(stop3);
var linearGradientBackground = document.createElementNS(
"http://www.w3.org/2000/svg",
"linearGradient"
);
linearGradientBackground.setAttribute(
"id",
"gradient-background"
);
var stop1 = document.createElementNS(
"http://www.w3.org/2000/svg",
"stop"
);
stop1.setAttribute("stop-color", "rgba(0, 0, 0, 0.2)");
stop1.setAttribute("offset", "0%");
linearGradientBackground.appendChild(stop1);
defs.appendChild(linearGradient);
this.svg.appendChild(defs);
this.defs = defs;
};
Dial.prototype.createSlice = function () {
var slice = document.createElementNS(
"http://www.w3.org/2000/svg",
"path"
);
slice.setAttribute("fill", "none");
slice.setAttribute(
"stroke",
`url(#gradient${$(".progress-wrapper linearGradient").length})`
);
slice.setAttribute("stroke-width", this.strokeWidth);
slice.setAttribute(
"transform",
"translate(" +
this.strokeWidth / 2 +
"," +
this.strokeWidth / 2 +
")"
);
slice.setAttribute("class", "animate-draw");
this.svg.appendChild(slice);
this.slice = slice;
};
Dial.prototype.createText = function () {
var fontSize = this.size / 3.5;
var text = document.createElementNS(
"http://www.w3.org/2000/svg",
"text"
);
text.setAttribute("x", this.size / 2 + fontSize / 7.5);
text.setAttribute("y", this.size / 2 + fontSize / 4);
text.setAttribute("font-family", "var(--text-font)");
text.setAttribute("font-size", fontSize);
text.setAttribute("fill", "white");
text.setAttribute("text-anchor", "middle");
var tspanSize = fontSize / 3;
text.innerHTML =
0 +
' ';
this.svg.appendChild(text);
this.text = text;
};
Dial.prototype.animateStart = function () {
var v = 0;
var self = this;
var intervalOne = setInterval(function () {
var p = +(v / self.value).toFixed(2);
var a = p < 0.95 ? 2 - 2 * p : 0.05;
v += a;
// Stop
if (v >= +self.value) {
v = self.value;
clearInterval(intervalOne);
}
self.setValue(v);
}, 10);
};
Dial.prototype.animateReset = function () {
this.setValue(0);
};
Dial.prototype.polarToCartesian = function (
centerX,
centerY,
radius,
angleInDegrees
) {
var angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0;
return {
x: centerX + radius * Math.cos(angleInRadians),
y: centerY + radius * Math.sin(angleInRadians),
};
};
Dial.prototype.describeArc = function (
x,
y,
radius,
startAngle,
endAngle
) {
var start = this.polarToCartesian(x, y, radius, endAngle);
var end = this.polarToCartesian(x, y, radius, startAngle);
var largeArcFlag = endAngle - startAngle <= 180 ? "0" : "1";
var d = [
"M",
start.x,
start.y,
"A",
radius,
radius,
0,
largeArcFlag,
0,
end.x,
end.y,
].join(" ");
return d;
};
Dial.prototype.setValue = function (value) {
var c = (value / 100) * 360;
if (c === 360) c = 359.99;
var xy = this.size / 2 - this.strokeWidth / 2;
var d = this.describeArc(xy, xy, xy, 180, 180 + c);
this.slice.setAttribute("d", d);
var tspanSize = this.size / 3.5 / 3;
this.text.innerHTML = Math.floor(value) + "%";
};
//
// Usage
//
$("#productModal .modal-body").append(
$(".progress-wrapper").clone()
);
Array.from(document.querySelectorAll(".container-chart")).map(
(element) => {
var dial = new Dial(element);
dial.animateStart();
}
);
$(window).resize(function () {
let size = 122;
if (window.matchMedia("(max-width: 768px)").matches) {
size = 122;
}
$(
".progress-wrapper"
).html(`Ваш прогресс
${data.additionalHeader}
${$("h1").text().trim()}
`);
Array.from(document.querySelectorAll(".container-chart")).map(
(element) => {
var dial = new Dial(element);
dial.animateStart();
}
);
});
}
if (!$(".mobile.blocks").length) {
$(".xdget-lessonList")
.before(``);
$(".xdget-button.mobile-blocks").click(function () {
$("#buttonsModal").modal("show");
});
let progress = $(".progress-wrapper");
let progressParent = progress.parent();
if (window.matchMedia("(max-width: 991px)").matches) {
$("#buttonsModal .modal-body").append(progress);
} else {
progressParent.append(progress);
}
$(window).on("resize", function () {
if (window.matchMedia("(max-width: 991px)").matches) {
$("#buttonsModal .modal-body").append(progress);
} else {
progressParent.append(progress);
}
});
}
}
$(".lesson-list li:not(.divider)").each(function () {
let image = $(this).find($(".item-image"));
if (image.length) {
let imageLink = image.css("background-image");
const hash = imageLink.substring(
imageLink.indexOf("/h/") + 2,
imageLink.indexOf("/s/")
);
const regexAPart = /\/a\/(\d+)\//i;
const matchAPart = regexAPart.exec(imageLink);
const aPart = matchAPart ? matchAPart[0] : null;
const scPart = imageLink.substring(
imageLink.indexOf("sc/"),
imageLink.indexOf(")") - 1
);
image.replaceWith(
``
);
// image.remove()
}
});
if ($(".chatium_body").length) {
$("body").prepend(
'' + breadcrumbs + "
"
);
}
$(".breadcrumbs a").each(function () {
let words = $(this).text().split(" ");
if (words.length > 1) $(this).text(words[0] + " " + words[1]);
});
}
}
});
}
async function getImages() {
const searchList = [];
const trainingTable = document.querySelector(".stream-table");
if (trainingTable) {
Array.from(trainingTable.querySelectorAll("tr")).map((training) => {
searchList.push({
id: training.dataset.trainingId,
title: training.querySelector(".stream-title").textContent.trim(),
});
});
await Promise.all(
searchList.map(async ({ title, id }) => {
const response = await fetch(
`https://${
window.location.hostname
}/c/sa/search?searchStr=${title}&ccc=${Date.now()}`
);
const training = await response.json();
const trainingData = training.data.blocks.filter((block) => {
if (block.id) return block.id.split("/")[2] == id;
})[0];
let trainingDataImage = "";
if (trainingData !== undefined) {
trainingDataImage = trainingData.image;
if (trainingDataImage) {
trainingDataImage = removeThumbnail(trainingDataImage);
trainingTable
.querySelector(`tr[data-training-id="${id}"] a`)
.insertAdjacentHTML(
"beforeend",
` `
);
}
} else {
}
})
);
}
}
function removeThumbnail(string) {
let aPart = string.match(/\/a\/\d+\/sc\/\d+/),
hPart = string.substring(
string.indexOf("thumbnail") + 10,
string.indexOf("/s/")
);
return `/fileservice/file/download${aPart}/${hPart}`;
}
function createProgress() {
let current = "Шкала не установлена",
currentNUM = 0;
if ($(".xdget-trainingAchievements").length) {
current = $(".xdget-trainingAchievements .badge").text();
currentNUM =
$(".xdget-trainingAchievements .badge").text().match(/\d+/)[0] * 1;
}
let percent =
Math.floor(10000 * (currentNUM / $("body").attr("maximum-progress"))) / 100;
$(".xdget-trainingList").prepend(
``
);
$(".progress-line").animate(
{
width: percent + "%",
},
1000,
function () {
// Animation complete.
}
);
}
function GCtimeToDate(e) {
let t = e.textContent;
t = $.trim(t);
let n = {
Янв: "01",
Фев: "02",
Мар: "03",
Апр: "04",
Май: "05",
Июн: "06",
Июл: "07",
Авг: "08",
Сен: "09",
Окт: "10",
Ноя: "11",
Дек: "12",
Jan: "01",
Feb: "02",
Mar: "03",
Apr: "04",
May: "05",
Jun: "06",
Jul: "07",
Aug: "08",
Sep: "09",
Oct: "10",
Nov: "11",
Dec: "12",
};
if (t.indexOf("только что") > -1) {
let r =
new Date(Date.now()).getHours() +
":" +
new Date(Date.now()).getMinutes(),
a = (t = new Date()).getDate(),
g;
return convertFromStringToDate(
`${a}-${t.getMonth()}-${t.getFullYear()}T${r}:00`
);
}
if (
t.indexOf("минуту") > -1 ||
t.indexOf("минут") > -1 ||
t.indexOf("минуты") > -1
) {
var o = 1 * t.replace(/[^0-9]/g, ""),
l = new Date(Date.now() - 6e4 * o);
let _ = (t = new Date()).getDate(),
i = l.getHours() + ":" + l.getMinutes(),
u;
return convertFromStringToDate(
`${_}-${t.getMonth() + 1}-${t.getFullYear()}T${i}:00`
);
}
if (t.indexOf("сегодня") > -1) {
if (-1 != t.search(/\d/)) {
var l = t.match(/[0-9]{2}.[0-9]{2}/gm);
let D = (t = new Date()).getDate(),
c = l[0],
F;
return convertFromStringToDate(
`${D}-${t.getMonth() + 1}-${t.getFullYear()}T${c}:00`
);
}
{
let m = (t = new Date()).getDate(),
T;
return convertFromStringToDate(
`${m}-${t.getMonth() + 1}-${t.getFullYear()}T00:00:00`
);
}
}
if (t.indexOf("вчера") > -1) {
if (-1 != t.search(/\d/)) {
var l = t.match(/[0-9]{2}.[0-9]{2}/gm);
let s = new Date();
s.setDate(s.getDate() - 1);
let v = l[0],
f = s.getDate(),
w;
return convertFromStringToDate(
`${f}-${s.getMonth() + 1}-${s.getFullYear()}T${v}:00`
);
}
{
let h = new Date();
h.setDate(h.getDate() - 1);
let M = h.getDate(),
S;
return convertFromStringToDate(
`${M}-${h.getMonth() + 1}-${h.getFullYear()}T00:00:00`
);
}
}
if (t.indexOf("завтра") > -1) {
if (-1 != t.search(/\d/)) {
var l = t.match(/[0-9]{2}.[0-9]{2}/gm);
let p = new Date();
p.setDate(p.getDate() + 1);
let d = l[0],
O = p.getDate(),
Y;
return convertFromStringToDate(
`${O}-${p.getMonth() + 1}-${p.getFullYear()}T${d}:00`
);
}
{
let x = new Date();
x.setDate(x.getDate() + 1);
let J = x.getDate(),
A;
return convertFromStringToDate(
`${J}-${x.getMonth() + 1}-${x.getFullYear()}T00:00:00`
);
}
} else {
if (-1 != t.indexOf(":")) {
var l = t.match(
/(Пн|Вт|Ср|Чт|Пт|Сб|Вс)\s[0-9]{2}\s(Янв|Фев|Мар|Апр|Май|Июн|Июл|Авг|Сен|Окт|Ноя|Дек|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s[0-9]{2}.[0-9]{2}/gm
);
let b = l[0].split(" "),
y = b[1],
N = n[b[2]],
C = new Date().getFullYear();
12 == new Date().getMonth() && "01" == N && (C += 1);
let H = b[3];
return convertFromStringToDate(`${y}-${N}-${C}T${H}:00`);
}
{
var l = t.match(
/(Пн|Вт|Ср|Чт|Пт|Сб|Вс)\s[0-9]{2}\s(Янв|Фев|Мар|Апр|Май|Июн|Июл|Авг|Сен|Окт|Ноя|Дек|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/gm
);
let G = l[0].split(" "),
j = G[1],
k = n[G[2]],
q = new Date().getFullYear();
return (
12 == new Date().getMonth() && "01" == k && (q += 1),
(t = convertFromStringToDate(`${j}-${k}-${q}T00:00:00`))
);
}
}
}
function convertFromStringToDate(e) {
let t = e.split("T"),
n = t[0].split("-"),
r = t[1].split(":");
return new Date(n[2], n[1] - 1, n[0], r[0], r[1], r[2]);
}