diff --git a/mirzaev/site/rules/system/controllers/index_controller.php b/mirzaev/site/rules/system/controllers/index_controller.php index 4139fa8..53d1f70 100755 --- a/mirzaev/site/rules/system/controllers/index_controller.php +++ b/mirzaev/site/rules/system/controllers/index_controller.php @@ -15,57 +15,23 @@ use mirzaev\site\rules\controllers\core; */ final class index_controller extends core { - /** - * Главная страница - * - * @param array $parameters Параметры запроса - */ - public function index(array $parameters = []): ?string - { - // Инициализация загружаемых категорий - $this->variables['include'] = [ - 'head' => ['self'], - 'body' => ['self'] - ]; + /** + * Главная страница + * + * @param array $parameters Параметры запроса + */ + public function index(array $parameters = []): ?string + { + // Инициализация шутника + $this->variables['troller'] = [ + 'instasamka' => rand(1, 11), + 'vk' => (bool) rand(0, 1), + 'whatsapp' => (bool) rand(0, 1), + 'iphone' => (bool) rand(0, 1), + ]; - // Инициализация бегущей строки - $this->variables['hotline'] = [ - 'id' => $this->variables['request']['id'] ?? 'hotline' - ]; - // Инициализация параметров бегущей строки - $this->variables['hotline']['parameters'] = [ - // 'step' => 2 - ]; - - // Инициализация аттрибутов бегущей строки - $this->variables['hotline']['attributes'] = [ - - ]; - - // Инициализация элементов бегущей строки - $this->variables['hotline']['elements'] = [ - ['content' => '1'], - [ - 'tag' => 'article', - 'content' => '2' - ], - ['content' => '3'], - ['content' => '4'], - ['content' => '5'], - ['content' => '6'], - ['content' => '7'], - ['content' => '8'], - ['content' => '9'], - ['content' => '10'], - ['content' => '11'], - ['content' => '12'], - ['content' => '13'], - ['content' => '14'], - ['content' => '15'] - ]; - - // Генерация представления - return $this->view->render(DIRECTORY_SEPARATOR . 'index.html', $this->variables); - } + // Генерация представления + return $this->view->render(DIRECTORY_SEPARATOR . 'index.html', $this->variables); + } } diff --git a/mirzaev/site/rules/system/public/css/trolling.css b/mirzaev/site/rules/system/public/css/troller.css similarity index 100% rename from mirzaev/site/rules/system/public/css/trolling.css rename to mirzaev/site/rules/system/public/css/troller.css diff --git a/mirzaev/site/rules/system/public/js/trolling.js b/mirzaev/site/rules/system/public/js/troller.js similarity index 65% rename from mirzaev/site/rules/system/public/js/trolling.js rename to mirzaev/site/rules/system/public/js/troller.js index 102dcd6..0b531b1 100755 --- a/mirzaev/site/rules/system/public/js/trolling.js +++ b/mirzaev/site/rules/system/public/js/troller.js @@ -20,24 +20,24 @@ class troller { }, start() { // Отображение изображения - document.getElementById("what_image").classList.add("active"); + document.getElementById("troller_image_what").classList.add("active"); // Проигрывание звука troller.what.play(); }, end() { // Сокрытие изображения - document.getElementById("what_image").classList.remove("active"); + document.getElementById("troller_image_what").classList.remove("active"); // Остановка звука - document.getElementById("what_sound").pause(); + document.getElementById("troller_sound_what").pause(); }, single(event = "onmouseleave") { if (typeof event === "string") { // Получены обязательные входные параметры // Отображение изображения - document.getElementById("what_image").classList.add("active"); + document.getElementById("troller_image_what").classList.add("active"); // Проигрывание звука troller.what.play(); @@ -51,7 +51,7 @@ class troller { }, play() { // Инициализация элемента со звуком - const what_sound = document.getElementById("what_sound"); + const what_sound = document.getElementById("troller_sound_what"); // Воспроизведение звука what_sound.currentTime = 0; @@ -61,7 +61,7 @@ class troller { static vk() { setInterval(function () { - const sound = document.getElementById("sound_vk"); + const sound = document.getElementById("troller_sound_vk"); if (Math.random() > 0.95) { // 5% @@ -75,7 +75,7 @@ class troller { static whatsapp() { setInterval(function () { - const sound = document.getElementById("sound_whatsup"); + const sound = document.getElementById("troller_sound_whatsup"); if (Math.random() > 0.97) { // 3% @@ -89,7 +89,7 @@ class troller { static iphone() { setInterval(function () { - const sound = document.getElementById("sound_iphone"); + const sound = document.getElementById("troller_sound_iphone"); if (Math.random() > 0.98) { // 2% @@ -102,9 +102,9 @@ class troller { } static instasamka = { - play(track, time) { + play(time) { // Инициализация элемента со звуком - const sound = document.querySelectorAll('[data-instasamka]')[track]; + const sound = document.getElementById("troller_sound_instasamka"); if (sound instanceof HTMLElement) { // Найден звук @@ -112,34 +112,17 @@ class troller { // Воспроизведение звука sound.currentTime = time ?? Math.random() * 100; sound.play(); - - return; + } else { + // Не найден звук (подразумевается) + + console.log('[mirzaev] [troller] Не удалось найти песню инстасамки'); } - - console.log('[mirzaev] [troller] Не удалось найти песню инстасамки под идентификатором ' + track); - - // Не найден звук (подразумевается) - troller.instasamka.play(1, time); }, }; } -troller.what.enable(); - -if (Math.random() > 0.60) { - // 40% - - troller.vk(); -} - -if (Math.random() > 0.60) { - // 40% - - troller.whatsapp(); -} - -if (Math.random() > 0.60) { - // 40% - - troller.iphone(); -} +document.dispatchEvent( + new CustomEvent("troller.loaded", { + detail: { troller }, + }), +); diff --git a/mirzaev/site/rules/system/views/index.html b/mirzaev/site/rules/system/views/index.html index d0cbc77..9013497 100755 --- a/mirzaev/site/rules/system/views/index.html +++ b/mirzaev/site/rules/system/views/index.html @@ -1,20 +1,20 @@ {% extends "core.html" %} {% use "core.html" with css as core_css, body as core_body, js as core_js, js_init as core_js_init %} -{% use "trolling.html" with css as trolling_css, body as trolling_body, js as trolling_js %} +{% use "troller.html" with css as troller_css, body as troller_body, js as troller_js, js_init as troller_js_init %} {% use "popups/rules.html" with css as popup_rules_css, body as popup_rules_body %} {% use "header.html" with css as header_css, body as header_body, js as header_js, js_init as header_js_init %} {% block css %} {{ block('core_css') }} -{{ block('trolling_css') }} +{{ block('troller_css') }} {{ block('popup_rules_css') }} {{ block('header_css') }} {% endblock %} {% block body %} {{ block('core_body') }} -{{ block('trolling_body') }} +{{ block('troller_body') }} {{ block('popup_rules_body') }} {{ block('header_body') }} @@ -30,11 +30,12 @@ {% block js %} {{ block('core_js') }} -{{ block('trolling_js') }} +{{ block('troller_js') }} {{ block('header_js') }} {% endblock %} {% block js_init %} {{ block('core_js_init') }} {{ block('header_js_init') }} +{{ block('troller_js_init') }} {% endblock %} diff --git a/mirzaev/site/rules/system/views/popups/rules.html b/mirzaev/site/rules/system/views/popups/rules.html index dacc8f6..89dd468 100644 --- a/mirzaev/site/rules/system/views/popups/rules.html +++ b/mirzaev/site/rules/system/views/popups/rules.html @@ -14,7 +14,7 @@
+ onclick="troller.instasamka.play(); this.parentElement.parentElement.parentElement.remove();">Прочитал
diff --git a/mirzaev/site/rules/system/views/troller.html b/mirzaev/site/rules/system/views/troller.html new file mode 100755 index 0000000..cdc2ada --- /dev/null +++ b/mirzaev/site/rules/system/views/troller.html @@ -0,0 +1,57 @@ +{% block css %} + +{% endblock %} + +{% block body %} + + +{% if troller.vk %} + + +{% endif %} +{% if troller.whatsapp %} + + +{% endif %} +{% if troller.iphone %} + + +{% endif %} + +{% endblock %} + +{% block js %} + +{% endblock %} + +{% block js_init %} + +{% endblock %} diff --git a/mirzaev/site/rules/system/views/trolling.html b/mirzaev/site/rules/system/views/trolling.html deleted file mode 100755 index 36485de..0000000 --- a/mirzaev/site/rules/system/views/trolling.html +++ /dev/null @@ -1,26 +0,0 @@ -{% block css %} - -{% endblock %} - -{% block body %} - - - - - - - - - - - - - - - - -{% endblock %} - -{% block js %} - -{% endblock %}