Муниципальное бюджетное общеобразовательное учреждение «Средняя общеобразовательная школа №24» г. Альметьевска Республики Татарстан
Визитная карточка
Адрес: | 423455, РТ, Альметьевский район, г. Альметьевск, ул. Шевченко, д. 136 |
Телефон: | +7(855)-333-00-77 |
E-Mail: | Shkola-24.Alm@tatar.ru |
Министерство: | Министерство образования и науки Республики Татарстан |
Короткое название: | МБОУ "СОШ №24" |
Руководитель: | Ягафарова Олеся Михайловна |
Год основания учреждения: | 2001 |
У нас учатся: | 1319 учащихся |
У нас учат: | 75 учителя Язык обучения: русский Форм обучения: очная |
ms_preview_click_and_keypress
(()=>{
"use strict";
console.clear();
// let lessons_table_rows = document.querySelectorAll("#lessons-grid > div > div.lessons-table-row > div.tt-lessons-table-col > div.lessons-table > div.lessons-table-row");
let row;
let str = '';
let index;
let arrContainerFooterSelectedGroups = [];
let count_key_down_up = -1;
clickMe();
function clickMe() {
document.onclick = ( event ) => {
// console.clear();
// console.log("event =", event);
let target = event.target;
console.log( "target:", target );
// console.log( "lessons_table_rows:", lessons_table_rows );
if (target.classList.contains("lessons-lesson-title") ) {
let row_number = target.parentElement.parentElement.parentElement.previousElementSibling.innerText;
if ( isNaN(row_number) ) {
console.log( "isNaN row_number:", row_number );
alert('Мы достигли предела дневного расписания.');
} else {
console.log( "isNaN not row_number:", row_number );
row = +row_number;
console.log( "row:", row );
let lessons_table_rows = document.querySelectorAll("#lessons-grid > div > div.lessons-table-row > div.tt-lessons-table-col > div.lessons-table > div.lessons-table-row");
let lessons_table_row = lessons_table_rows[row];
console.log( "lessons_table_row:", lessons_table_row );
let lesson_titles = [...lessons_table_row.querySelectorAll(".lessons-lesson-title")];
index = lesson_titles.findIndex( elem => elem == target );
// console.log( "lesson_titles:", lesson_titles );
console.log( "Строка \"row\":", row );
console.log( "Столбец \"index\":", index );
}
}
if (target.classList.contains("lessons-empty-lesson-title") ) {
// let count = 0;
// let parents = target.parentElement.parentElement;
row = +target.parentElement.parentElement.parentElement.parentElement.previousElementSibling.innerText;
// console.log( "parents:", parents );
// console.log( "lessons_table_rows[row]:", lessons_table_rows[row] );
let lessons_table_rows = document.querySelectorAll("#lessons-grid > div > div.lessons-table-row > div.tt-lessons-table-col > div.lessons-table > div.lessons-table-row");
let lessons_table_row = lessons_table_rows[row];
console.log( "lessons_table_row:", lessons_table_row );
let lesson_titles = [...lessons_table_row.querySelectorAll(".lessons-empty-lesson-title")];
index = lesson_titles.findIndex( elem => elem == target );
// console.log( "lesson_titles:", lesson_titles );
console.log( "Строка \"row\":", row );
console.log( "Столбец \"index\":", index );
}
};
}
document.onkeyup = callback;
document.onkeydown = (event) => event.preventDefault();
function callback(event) {
// console.clear();
event.preventDefault();
console.log("event =", event);
console.log("event.keyCode =", event.keyCode);
console.log("event.charCode =", event.charCode);
console.log("onkeyup event.key =", event.key);
console.log("onkeyup event.code =", event.code);
if (event.key.length > 1) {
if (event.key == "Escape" ) {
// document.querySelector("body > ui-view > div > main > div.b-right__sidebar > schedule-class > div.b-container__wrap-footer.schedule-class-fixed-pos > schedules-item-editor > div > div.close-schedule-items-editor._19jEP")
clearClassGroupsListSpan();
str = "";
}
// Кнопка "ВНИЗ"
if(event.key == "ArrowDown") {
// console.log(`You click key "${event.key}"`);
console.log("count_key_down_up:", count_key_down_up);
pressKeyDOWNAndkeyUP(++count_key_down_up);
}
// Кнопка "ВВЕРХ"
if(event.key == "ArrowUp") {
// console.log(`You click key "${event.key}"`);
console.log("count_key_down_up:", count_key_down_up);
pressKeyDOWNAndkeyUP(--count_key_down_up);
}
if (event.code == "Enter" ) {
console.log("count_key_down_up:", count_key_down_up);
// console.log("arrContainerFooterSelectedGroups[count_key_down_up]:", arrContainerFooterSelectedGroups[count_key_down_up]);
let arr = getCollectionSpan();
console.log("arrContainerFooterSelectedGroups[count_key_down_up]:", arr[count_key_down_up]);
arr[count_key_down_up].click();
str = "";
}
if(event.key == "Tab") {
// document.onclick = () => {};
row++;
setActiveCell(row, index);
// clickMe();
// document.onkeyup = () => {};
// alert('Мы достигли предела дневного расписания.');
}
// if(event.key == "Delete") {
// document.querySelector("#lessons-grid > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(10) > div.tt-lessons-slider-wrapper > div > div:nth-child(2) > div > div > ng-transclude > button").click();
// }
} else {
let letter = event.key;
// console.log(`You click key "${letter}"`);
if (/[а-яё .-]/i.test(letter) ) {
str += letter;
console.log(str);
showTooltip(`"${str}"`, "green");
let res = getWord(str);
console.log("[а-яё.-]:", res);
if (res.length == 1) {
console.log("ES");
let span = res[0];
console.log("span:", span);
span.click();
str = "";
}
// else {
// clearClassGroupsListSpan();
// setTimeout( () => {
// alert(`Искомый предмет: "${str}" не найден.`);
// }, 2000);
// str = "";
// }
} else if (/[a-z]/i.test(letter) ) {
showTooltip(`"${letter}"`, "red");
// setTimeout( () => {
// alert(`Вы пытаетесь ввести английские буквы. Переключитись на русскую раскладку.`);
// }, 1000);
}
}
}
function setActiveCell(row, index) {
try {
if ( row && index !== -1 ) {
let lessons_table_rows = document.querySelectorAll("#lessons-grid > div > div.lessons-table-row > div.tt-lessons-table-col > div.lessons-table > div.lessons-table-row");
let next_row = lessons_table_rows[row];
console.log('next_row:', next_row);
if ( next_row !== undefined ) {
let element_six = next_row.querySelectorAll(".six");
let next_elem_six = element_six[index];
console.log('next_elem_six:', next_elem_six);
let next_elem_six_lesson_titles = next_elem_six.querySelector(".lessons-empty-lesson-title");
let next_lesson_titles = next_elem_six.querySelector(".lessons-lesson-title");
if ( next_elem_six_lesson_titles ) {
next_elem_six_lesson_titles.click();
} else if (next_lesson_titles) {
next_lesson_titles.click();
} else {
alert('Здесь невозможно вставить урок!');
}
// let next_lesson_titles = next_row.querySelectorAll(".lessons-empty-lesson-title");
// console.log('next_lesson_titles:', next_lesson_titles);
// console.log('index:', index);
// console.log('next_lesson_titles[index]:', next_lesson_titles[index]);
// let next_elem = next_lesson_titles[index];
// console.log('next_elem:', next_elem);
// next_elem.click();
} else {
console.log('next_row === undefined:', next_row);
console.log('FINISHED.');
// document.onkeydown = function() {};
alert('Мы достигли предела дневного расписания.');
}
} else {
console.log('not row && index:', row, index);
alert("Функция вышла за пределы выбранного расписания. Кликните на нужную ячейку.");
}
} catch (error) {
console.log('catch (error):', error);
row = 1;
index++;
console.log('row:', row);
console.log('index:', index);
alert('Мы достигли предела дневного расписания.');
// console.log('next_elem:', next_elem);
// if (next_elem) {
// setActiveCell(row, index);
// }
}
}
function getCollectionSpan() {
let collection = document.querySelectorAll("body > ui-view > div > main > div.b-right__sidebar > schedule-class > div.b-container__wrap-footer.schedule-class-fixed-pos > schedules-item-editor > div > div.b-container-footer__body > div > div.b-container-footer__body_table.schedule-class-groups-list > div > span");
let arr = [...collection].filter( span => span.parentElement.style.display !== "none");
console.log("arr:", arr);
return arr;
}
function pressKeyDOWNAndkeyUP(count) {
let arr = getCollectionSpan();
console.log("arr:", arr);
let key = count;
arr.forEach( span => span.style = "" );
if (key < 0) {
key = 0;
count_key_down_up = key;
} else if (key > arr.length - 1) {
key = arr.length - 1;
count_key_down_up = key;
}
arr[key].style.borderBottom = "#E91E63 dashed 3px";
// return key;
// console.log("arr[key]:", key, arr[key]);
// arr[key].parentElement.style.borderBottom = "#E91E63 dashed 3px";
}
function clearClassGroupsListSpan() {
let collection = document.querySelectorAll("body > ui-view > div > main > div.b-right__sidebar > schedule-class > div.b-container__wrap-footer.schedule-class-fixed-pos > schedules-item-editor > div > div.b-container-footer__body > div > div.b-container-footer__body_table.schedule-class-groups-list > div > span");
collection.forEach( span => {
span.style = "";
span.parentElement.style = "";
});
}
function getWord(word) {
// document.querySelector("body > ui-view > div > main > div.b-right__sidebar > schedule-class > div.b-container__wrap-footer.schedule-class-fixed-pos > schedules-item-editor > div > div.b-container-footer__body > div:nth-child(2) > div.b-container-footer__body_table.schedule-class-groups-list").style.border = "green dashed 3px";
// let collection = document.querySelectorAll("body > ui-view > div > main > div.b-right__sidebar > schedule-class > div.b-container__wrap-footer.schedule-class-fixed-pos > schedules-item-editor > div > div.b-container-footer__body > div > div.b-container-footer__body_table.schedule-class-groups-list > div > span");
// let arr = [...collection];
let arr = getCollectionSpan();
let reg = new RegExp("^" + word, "i");
let res = arr.filter( f => {
if ( reg.test(f.innerText) ) {
return f;
} else if (f.parentElement.classList.contains("b-container-footer__table-column") ) {
f.parentElement.style.display = "none";
f.parentElement.dataset.hidden = "true";
// f.parentElement.remove();
// f.parentElement.style.visibility = "hidden";
}
});
console.log(res);
if ( res.length == 0 ) {
console.log("Такого предмета нет!");
showTooltip(`Такого предмета, начинающегося на: "${word}" нет!`, "red");
clearClassGroupsListSpan();
str = "";
} else {
console.log(`Такой предмет "${word}" есть.`);
// showTooltip(`Такого предмета: "${word}" есть.`, "green");
}
return res;
}
function clickSubjectList(subject) {
let collection = document.querySelectorAll("body > ui-view > div > main > div.b-right__sidebar > schedule-class > div.b-container__wrap-footer.schedule-class-fixed-pos > schedules-item-editor > div > div.b-container-footer__body > div > div.b-container-footer__body_table.schedule-class-groups-list > div > span");
for (let span of collection) {
let text = span.innerText;
let title_exec = /([а-яё-]+\s?)*/ig.exec( text );
console.log(`Идёт сравнение:\n"${subject}" и \n"${text}"\nРезультат сравнения: "${title_exec[0]}"`);
if ( title_exec !== null ) {
let title_exec_0 = title_exec[0].trim();
// console.log('title_exec:', title_exec);
// console.log(`title_exec_0: "${title_exec_0}"`);
if ( subject == title_exec_0 ) {
console.log(`Мы нашли предмет: "${title_exec_0}"`);
span.click();
return true;
}
} else {
return false;
}
}
}
function lessonsSliderContent( element, count ) {
// console.log( "Start lessonsSliderContent() =>" );
if ( element !== null ) {
if ( element.classList.contains("lessons-slider-content") ) {
alert("Finish!");
return count;
} else {
if ( element.classList.contains("six") ) {
count++;
// console.log( "six:", element.previousElementSibling );
if ( element.previousElementSibling !== null ) {
lessonsSliderContent( element.previousElementSibling, count );
} else {
alert(count);
return count;
}
} else {
// console.log( "No six:", element.previousElementSibling );
if ( element.previousElementSibling !== null ) {
lessonsSliderContent( element.previousElementSibling, count );
} else {
alert(count);
return count;
}
}
}
} else {
alert(count);
return count;
}
}
// Функция по созданию всплывающей подсказки
function showTooltip(text, color = 'grey', delay = 3000 ) {
console.log(text, color, delay);
let backgroundColorStyle = {
red: '#F44336',
grey: '#585858',
green: '#4CAF50'
};
let target = document.querySelector('.notify__you_for_message');
if(target == null) {
createElementNotify();
setTimeout(() => {
showTooltip(text, color = 'grey', delay = 3000 );
}, 1000);
return;
}
let div = document.createElement('div');
div.setAttribute("id", "myTooltip_MS");
div.className = "notify__you_for_message__message__deco-tooltip_shown";
// let html = `${text}<div class="notify__you_for_message__close"></div></div>`;
// let html = `${text}<div class="notify__you_for_message__close" onclick="this.parentNode.remove()" >`;
div.style.backgroundColor = backgroundColorStyle[color];
console.log("target.children:", target.children);
console.log("#myTooltip_MS:", document.querySelector("#myTooltip_MS") );
if (target.children.length > 0) {
console.log("ES");
// document.querySelector("#myTooltip_MS").style = "";
let elem = document.querySelector("#myTooltip_MS");
elem.innerHTML = `${text}<div class="notify__you_for_message__close" onclick="this.parentNode.remove()" >`;
elem.style.backgroundColor = backgroundColorStyle[color];
} else {
console.log("NO");
// let html = `${text}<div class="notify__you_for_message__close" onclick="this.parentNode.remove()" >`;
div.innerHTML = `${text}<div class="notify__you_for_message__close" onclick="this.parentNode.remove()" >`;
target.append(div);
}
let btn_close = document.querySelector('.notify__you_for_message__close');
btn_close.onclick = () => div.remove();
setTimeout(() => div.remove(), delay);
}
function createElementNotify() {
let notify_html = `
<style>
.notify__you_for_message {
font: 16px YSTextRegular,Arial,Helvetica,sans-serif;
color: #222;
padding: 0;
margin: 0;
position: fixed;
/* left: 50%; */
left: 10px;
/* transform: translateX(-50%); */
z-index: 102;
bottom: 10px;
}
.notify__you_for_message__message__deco-tooltip_shown {
font: 16px YSTextRegular,Arial,Helvetica,sans-serif;
color: #fff;
max-width: 100%;
/* width: fit-content; */
margin: 0 auto 4px;
position: relative;
padding: 6px 40px 6px 12px;
border-radius: 3px;
display: block;
transition: .1s linear;
opacity: 1;
background-color: #585858;
border-color: transparent;
}
.notify__you_for_message__close {
font: 16px YSTextRegular,Arial,Helvetica,sans-serif;
color: #fff;
padding: 0;
margin: 0;
background: 50% no-repeat;
background-size: 100%;
position: absolute;
right: 12px;
top: 50%;
width: 22px;
margin-top: -11px;
height: 22px;
display: block;
cursor: pointer;
content: "";
background-image: url(https://music.yandex.ru/node_modules/@yandex-music-int/music-ui/blocks/d-icon/black/cross-medium.svg);
}
.notify__you_for_message-a {
font: 16px YSTextRegular,Arial,Helvetica,sans-serif;
padding: 0;
margin: 0;
color: #fff;
text-decoration: underline;
cursor: pointer;
}
</style>
<div class="notify__you_for_message"></div>
`;
document.body.insertAdjacentHTML('beforeend', notify_html);
}
})();