mirror of
https://bitbucket.org/bellord13/kit.git
synced 2026-11-13 19:06:11 +03:00
fix
This commit is contained in:
+10
-46
@@ -16,44 +16,23 @@ $APPLICATION->ShowHead();
|
||||
|
||||
?>
|
||||
<script>
|
||||
kit.ready(['bsToast', 'testing', 'date'], function () {
|
||||
kit.ready(['bsToastService', 'testing', 'date', ], function () {
|
||||
|
||||
var unit = new kit.testing.Unit();
|
||||
unit.logger.info('Тест bootstrap.Toast 5.1.3');
|
||||
unit.logger.info('Тест service.toast');
|
||||
unit.logger.notice(' ');
|
||||
|
||||
var audio = new Audio('https://issue.megapolis-it.ru/local/media/new_message_tone.mp3');
|
||||
|
||||
|
||||
|
||||
function makeNode(html = '') {
|
||||
var nodeWrap = document.createElement('div');
|
||||
nodeWrap.innerHTML = html;
|
||||
return nodeWrap.firstElementChild;
|
||||
}
|
||||
|
||||
|
||||
var toastContainerTemplate = '<div class="toast-container position-fixed p-3 bottom-0 end-0" style="z-index: 10000;"></div>';
|
||||
|
||||
|
||||
function getToastNode(title, message, time){
|
||||
unit.logger.info(time + ' ' + title, message);
|
||||
var toastTemplate = '<div class="toast fade hide" role="alert" aria-live="assertive" aria-atomic="true"><div class="toast-header"><svg class="bd-placeholder-img rounded me-2" width="20" height="20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" preserveAspectRatio="xMidYMid slice" focusable="false"><rect width="100%" height="100%" fill="#007aff"/></svg><strong class="me-auto">'+title+'</strong><small>' + time+ '</small><button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Закрыть"/></div><div class="toast-body">'+message+'</div></div>';
|
||||
return makeNode(toastTemplate);
|
||||
}
|
||||
var toastContainer = makeNode(toastContainerTemplate);
|
||||
document.body.appendChild(toastContainer);
|
||||
|
||||
var audio = new Audio('https://issue.megapolis-it.ru/local/media/new_message-4.mp3');
|
||||
kit.service.toast.onShow.push(function (toast, node) {
|
||||
unit.logger.info(toast.data.title, toast.data);
|
||||
audio.play();
|
||||
});
|
||||
|
||||
var intervalId = setInterval(function(){
|
||||
|
||||
var toastEl = getToastNode('Новая заявка', 'Заявка от Пупкина на дальний склад. Очень срочно! Нужно еще вчера...', kit.date('H:i:s'));
|
||||
toastContainer.appendChild(toastEl);
|
||||
var toast = new kit.bsToast(toastEl, option = {
|
||||
animation: true,
|
||||
autohide: true,
|
||||
delay: 33000,
|
||||
});
|
||||
toast.show();
|
||||
audio.play();
|
||||
kit.service.toast.info('Новая заявка', 'Заявка от Пупкина на дальний склад. Очень срочно! Нужно еще вчера...', kit.date('H:i:s'));
|
||||
}, 5000);
|
||||
|
||||
|
||||
@@ -67,18 +46,6 @@ $APPLICATION->ShowHead();
|
||||
<div class="kit-logger"></div>
|
||||
</div>
|
||||
<style>
|
||||
.position-fixed {
|
||||
position: fixed!important;
|
||||
}
|
||||
.bottom-0 {
|
||||
bottom: 0!important;
|
||||
}
|
||||
.end-0 {
|
||||
right: 0!important;
|
||||
}
|
||||
.p-3 {
|
||||
padding: 1rem !important;
|
||||
}
|
||||
img, svg {
|
||||
vertical-align: middle;
|
||||
}
|
||||
@@ -95,9 +62,6 @@ $APPLICATION->ShowHead();
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.me-auto {
|
||||
margin-right: auto!important;
|
||||
}
|
||||
</style>
|
||||
<?
|
||||
?>
|
||||
Reference in New Issue
Block a user