Каталог файловtilda-members-courses-lectureslist.js
1/**2 * Файл создает страницу со списоком лекций в курсе3 */4 5/* exported tma__courses__initLecturesList */6 7/**8 * Устанавливает список лекций в курсе9 */10function tma__courses__initLecturesList() {11 var rootElem = tma__checkContainerDiv('tlk-courses');12 var objProfile = tma__getProfileObjFromLS();13
История файла и сравнение версий
var path = tma__getPath();
15 tma__onFuncLoad('tma__userbar__drawWidget', function () { 16 tma__userbar__drawWidget(); 19 var formData = JSON.stringify({ 21 projectid: objProfile.projectid, 22 token: objProfile.token, 23 tzoffset: new Date().getTimezoneOffset(), 26 tma__request('/api/getlectures/', formData, '', function (response) { 27 if (response.status === 'ok' && typeof response.data === 'object') { 28 window.tildaMembers.courseLectures = response.data; 30 tma__courses__addHeaderFooter(); 32 var breadcrumbs = [{ label: tma__translate('{{personal_account}}', 'courses_dict'), href: '/members/' }]; 34 if (response.data.course && response.data.course.name) { 36 label: response.data.course.name, 37 href: '/members/courses/' + response.data.course.alias, 41 tma__initBreadcrumbsCssVariables(); 43 var html = tma__courses__getLecturesListHtml(response.data, breadcrumbs); 45 rootElem.innerHTML = tma__translate(html, 'courses_dict'); 46 document.title = response.data.course.name; 48 tma__courses__addTooltipEvents(); 49 tma__showDocumentReady(); 51 document.location.replace('/members/'); 57 * Находит и возвращает лекцию, которую необходимо пройти для открытия следующей лекции 59 * @param {string} id - id лекции 62function tma__courses__getLecturesListAfterLecture(id) { 63 var partitions = window.tildaMembers.courseLectures.course.partitions; 66 for (var i = 0; i < partitions.length; i++) { 67 var lectures = partitions[i].lectures; 69 if (objLecture) break; 71 for (var j = 0; j < lectures.length; j++) { 72 var lecture = lectures[j]; 74 if (Number(id) === Number(lecture.id)) { 85 * Функция получает строку с временем и склоняемым к нему словом 87 * @param {string} timeType - тип времени 88 * @param {number} time - время 89 * @returns {string} - возвращает время 91function tma__courses__getLecturesListAfterOffsetLecture(timeType, time) { 92 var text = time + ' '; 95 if (timeType === 'hours') { 97 tma__translate('{{lectures_has_after_offset_lecture_hour_1}}', 'courses_dict'), 98 tma__translate('{{lectures_has_after_offset_lecture_hour_2}}', 'courses_dict'), 99 tma__translate('{{lectures_has_after_offset_lecture_hour_3}}', 'courses_dict'),