1// ÐаÑвки на кÑÑÑÑ (classID == 487) 2document.addEventListener("DOMContentLoaded", () => { 3 document.querySelectorAll('.form--course-register').forEach((form) => { 4 form.addEventListener("submit", (e) => { 5 e.preventDefault(); 6 const buttonSubmit = form.closest(".popup__dialog").querySelector(".popup__footer input[type=\"submit\"]"); 7 buttonSubmit.disabled = true; 8 9 if (form.classList.contains('invalid')) { 10 buttonSubmit.disabled = false; 11 return false; 12 } 13 14 form.closest(".popup").querySelectorAll(".alert").forEach((alert) => alert.remove()); 15 16 fetch(e.target.action, { 17 method: "POST", 18 body: new FormData(e.target), 19 }) 20 .then((response) => response.json()) 21 .then((data) => { 22 let alertType = 'error'; 23 if (data.success) { 24 e.target.reset(); 25 alertType = 'success'; 26 window.Popup.close(); 27 window.Popup.open('#popup-success-cources-487'); 28 } 29 30 // console.log(data.message); 31 buttonSubmit.disabled = false; 32 33 let alert = document.createElement("div"); 34 alert.classList.add("alert"); 35 alert.classList.add("alert--" + alertType); 36 37 let message = document.createElement("span"); 38 message.textContent = data.message; 39 40 alert.appendChild(message); 41 const submitContainer = buttonSubmit.closest(".popup__dialog").querySelector(".popup__header"); 42 if (!submitContainer) return; 43 44 submitContainer.insertAdjacentElement("afterend", alert); 45 }); 46 }); 47 }); 48}); 49 50 51 52 53document.addEventListener('DOMContentLoaded', function () { 54 55 document.querySelectorAll('.show_all_in_section_btn').forEach(el => { 56 el.addEventListener('click', e => { 57 showAllItemsInSection(e.target); 58 e.preventDefault(); 59 }); 60 }); 61 62 document.querySelectorAll('.definitions-list [name="format"], .definitions-list [name="edu-on_base"]').forEach(el => { 63 el.addEventListener('change', e => { 64 toggleFormatInformation(e); 65 }); 66 }); 67 68 //по ÑмолÑÐ°Ð½Ð¸Ñ Ð¿Ð¾ÐºÐ°Ð·Ð°ÑÑ Ð´Ð°Ð½Ð½Ñе 69 document.querySelector('.definitions-list [name="format"]')?.dispatchEvent(new Event("change")); 70 71}); 72 73 74 75// ÐÑобÑÐ°Ð¶Ð°ÐµÑ Ð²Ñе ÑлеменÑÑ Ð² section, коÑоÑÑе изнаÑалÑно ÑкÑÑÑÑ ÐºÐ»Ð°ÑÑом hidden_item и hidden. Ex: пÑогÑаммÑ, ÑоÑÑÑдники, каÑедÑÑ Ð² каÑÑоÑке ÑакÑлÑÑеÑа 76function showAllItemsInSection(target) { 77 let hidden_items = target.closest('section').querySelectorAll('.hidden_item'); 78 if (!hidden_items.length) return false; 79 80 hidden_items.forEach(item => { 81 item.classList.remove('hidden'); 82 }); 83 84 target.closest('section').querySelector('.show_all_in_section_btn').remove(); 85} 86 87// обновиÑÑ Ð¸Ð½ÑоÑÐ¼Ð°Ð¸Ñ Ð² блоке "РнапÑавлении" по ÑÑоимоÑÑи и меÑÑам 88function toggleFormatInformation(event) { 89 let container = event.target.closest('.edu_info_continer'); 90 if (!container) return; 91 92 let containerItems = container.querySelector('.definitions-list-edu'); 93 94 let eduData = JSON.parse(container.dataset.edu); 95 let selectedFormat = container.querySelector('[name="format"]')?.value ?? 0; 96 let selectedBase = container.querySelector('[name="edu-on_base"]')?.value ?? 0; 97 let isNoData = true; 98 99 containerItems.innerHTML = ''; 100 101 Object.entries(eduData).forEach(function ([key, item]) { 102 if (item.StudyFormId == selectedFormat 103 && 104 item.OnBaseId == selectedBase 105 ) { 106 containerItems.append(renderEduInfoBlock(item)); 107 isNoData = false; 108 } 109 }); 110 111 if (isNoData) { 112 let elNoItems = document.createElement('div'); 113 elNoItems.classList.add('definitions-list', 'definition__label', 'text-center'); 114 elNoItems.textContent = 'ÐÐµÑ Ð¸Ð½ÑоÑмаÑии'; 115 containerItems.append(elNoItems); 116 } 117 118 initTooltips(); 119 120 return false;
121} 122 123function renderEduInfoBlock(item) { 124 let el = document.createElement('div'); 125 el.classList.add('definitions-list'); 126 127 // let lastYear = (new Date().getFullYear()) - 1; 128 let lastYear = (new Date().getFullYear()); 129 let curMonth = (new Date().getMonth()); 130 if (curMonth < 8) { 131 lastYear--; 132 } 133 if (item.Year) { 134 lastYear = item.Year; 135 } 136 137 /* 138 if (item.PassScoreInLastYear && item.PassScoreInLastYear > 0) { 139 if (item.PassScoreInLastYearBudget && item.PassScoreInLastYearBudget > 0) { 140 let passCore = item.PassScoreInLastYear.replace(".", ","); 141 let passCoreBudget = item.PassScoreInLastYearBudget.replace(".", ","); 142 el.appendChild(renderEduInfoRow('ÐÑÐ¾Ñ Ð¾Ð´Ð½Ð¾Ð¹ балл в ' + lastYear + ' годÑ', passCoreBudget + ' (бÑджеÑ)<br>' + passCore + ' (конÑÑакÑ)')); // .replace(".", ",") 143 } else { 144 el.appendChild(renderEduInfoRow('ÐÑÐ¾Ñ Ð¾Ð´Ð½Ð¾Ð¹ балл в ' + lastYear + ' годÑ', item.PassScoreInLastYear.replace(".", ","))); // .replace(".", ",") 145 } 146 } 147 */ 148 149 if (item.PassScoreInLastYear > 0 || item.PassScoreInLastYearBudget > 0) { 150 let passText = ''; 151 if (item.PassScoreInLastYearBudget > 0) { 152 let passCoreBudget = item.PassScoreInLastYearBudget.replace(".", ","); 153 passText += passCoreBudget + ' (бÑджеÑ)<br>'; 154 } 155 if (item.PassScoreInLastYear > 0) { 156 let passCore = item.PassScoreInLastYear.replace(".", ","); 157 passText += passCore + ' (конÑÑакÑ)'; 158 } 159 el.appendChild(renderEduInfoRow('ÐÑÐ¾Ñ Ð¾Ð´Ð½Ð¾Ð¹ балл в ' + lastYear + ' годÑ', passText)); 160 } 161 162 //let costTooltipText = 'СÑоимоÑÑÑ'; 163 //if(item.CostFC){ 164 //costTooltipText = 'СÑоимоÑÑÑ Ð´Ð»Ñ Ð¸Ð½Ð¾ÑÑÑаннÑÑ Ð³Ñаждан ' + item.CostFC; 165 //} 166 167 168 el.appendChild(renderEduInfoRow('ÐÑджеÑнÑе меÑÑа', item.BudgetPlaces)); 169 el.appendChild(renderEduInfoRow('ÐонÑÑакÑнÑе меÑÑа', item.ContractPlaces)); 170 171 if (item.StudyDuration) { 172 el.appendChild(renderEduInfoRow('СÑок обÑÑениÑ', item.StudyDuration)); 173 } 174 175 if (item.CostRF) { 176 let otherValues = []; 177 if (item.CostFC) { 178 otherValues.push('ÐÐ»Ñ Ð¸Ð½Ð¾ÑÑÑаннÑÑ Ð³Ñаждан - ' + item.CostFC); 179 } 180 181 182 el.appendChild(renderEduInfoRow('СÑоимоÑÑÑ ' + item.Year + ' год', 'ÐÐ»Ñ Ð³Ñаждан РФ и СÐÐ - ' + item.CostRF, '', otherValues)); 183 } 184 185 186 return el; 187} 188 189function renderEduInfoRow(lable, value, tooltipText, otherValues = []) { 190 191 192 let el = document.createElement('div'); 193 el.classList.add('definition'); 194 // el.classList.add('definition--about'); 195 el.style.whiteSpace = 'nowrap'; 196 197 198 let elLabel = document.createElement('div'); 199 elLabel.classList.add('definition__label'); 200 elLabel.textContent = lable; 201 el.appendChild(elLabel); 202 203 let elText = document.createElement('div'); 204 elText.classList.add('definition__text'); 205 elText.innerHTML = value; 206 207 208 if (tooltipText) { 209 let tooltip = document.createElement('button'); 210 tooltip.classList.add('tip-btn'); 211 tooltip.dataset.tooltip = tooltipText; 212 tooltip.type = 'button'; 213 214 let tooltipSpan = document.createElement('span'); 215 tooltipSpan.classList.add('icon', 'icon--info'); 216 tooltipSpan.innerHTML = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M12 3.75a8.25 8.25 0 100 16.5 8.25 8.25 0 000-16.5zM2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm8.95-4a.75.75 0 01.75-.75h.1a.75.75 0 01.75.75v.1a.75.75 0 01-.749.75h-.1a.75.75 0 01-.75-.75V8zm.8 2.25a.75.75 0 01.75.75v5a.75.75 0 01-1.5 0v-5a.75.75 0 01.75-.75z"></path></svg>`; 217 tooltip.appendChild(tooltipSpan); 218 219 elText.appendChild(tooltip); 220 } 221 222 el.appendChild(elText); 223 224 if (otherValues.length > 0) { 225 for (let i = 0; i < otherValues.length; i++) { 226 let elText = document.createElement('div'); 227 elText.classList.add('definition__text'); 228 elText.textContent = otherValues[i]; 229 230 el.appendChild(elText); 231 } 232 } 233 234 return el; 235} 236 237 238
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.