kolyan22region Posted February 16, 2016 Report Share Posted February 16, 2016 Десктопные оповещения в браузере для Vii Engine. Открываем файл, который отвечает за оповещения (обычно это /templates/Default/js/push.js) И после: function GoPage(event, p){ var oi = (event.target) ? event.target.id: ((event.srcElement) ? event.srcElement.id : null); if(oi == 'no_ev' || oi == 'update_close' || oi == 'update_close2') return false; else { pattern = new RegExp(/photo[0-9]/i); pattern2 = new RegExp(/video[0-9]/i); if(pattern.test(p)) Photo.Show(p); else if(pattern2.test(p)){ vid = p.replace('/video', ''); vid = vid.split('_'); videos.show(vid[1], p, location.href); } else Page.Go(p); } } Вставляем: //HTML5 NOTIFICATION if (("Notification" in window)) { Notification.requestPermission(); } function sendNotification(title, options) { if(!("Notification" in window)) { alert('Ваш браузер не поддерживает оповещения'); } else if(Notification.permission === "granted") { var notification = new Notification(title, options); function clickFunc() { console.log("Юзверь кликнул на уведомление."); } notification.onclick = clickFunc; } else if(Notification.permission !== 'denied') { Notification.requestPermission(function (permission) { if(permission === "granted") { var notification = new Notification(title, options); } else { console.log("Юзверь запретил уведомления."); } }); } else { console.log("Юзверь запретил уведомления."); } } После: $('#updates').html($('#updates').html()+temp); Вставляем: sendNotification(row[1], { body: row[3], icon: row[5], dir: 'auto' }); ВРОДЕ ВСЁ. Жмякни по ! 6 Quote Link to comment Share on other sites More sharing options...
orlov22region Posted February 16, 2016 Report Share Posted February 16, 2016 Спасибо, работает Quote Link to comment Share on other sites More sharing options...
wenjiro Posted February 16, 2016 Report Share Posted February 16, 2016 У меня нету такого файла. Quote Link to comment Share on other sites More sharing options...
kolyan22region Posted February 16, 2016 Author Report Share Posted February 16, 2016 У меня нету такого файла. ищи в main.tpl Quote Link to comment Share on other sites More sharing options...
wenjiro Posted February 16, 2016 Report Share Posted February 16, 2016 ищи в main.tpl код? или директорию к файлу? Quote Link to comment Share on other sites More sharing options...
kolyan22region Posted February 16, 2016 Author Report Share Posted February 16, 2016 код? или директорию к файлу? Код! Короче, в вк в лс vk.com/kolyan22region Quote Link to comment Share on other sites More sharing options...
wenjiro Posted February 16, 2016 Report Share Posted February 16, 2016 ищи в main.tpl А. нашел. Quote Link to comment Share on other sites More sharing options...
masi4ka Posted February 16, 2016 Report Share Posted February 16, 2016 а как сделать что бы на самом сайте не выводило а на других вкладках было Quote Link to comment Share on other sites More sharing options...
viiprogrammer Posted February 17, 2016 Report Share Posted February 17, 2016 а как сделать что бы на самом сайте не выводило а на других вкладках было Надо проверять активность в вкладке Quote Link to comment Share on other sites More sharing options...
Василий Posted March 26, 2016 Report Share Posted March 26, 2016 У меня работает .. скажите как сделать чтоб оповещение само закрывалось ? Quote Link to comment Share on other sites More sharing options...
kolyan22region Posted March 28, 2016 Author Report Share Posted March 28, 2016 У меня работает .. скажите как сделать чтоб оповещение само закрывалось ? Оно само должно закрыться, через пару секунд. Зависит от браузера. Quote Link to comment Share on other sites More sharing options...
Василий Posted March 28, 2016 Report Share Posted March 28, 2016 Оно само должно закрыться, через пару секунд. Зависит от браузера. у меня не закрывается Quote Link to comment Share on other sites More sharing options...
kolyan22region Posted March 29, 2016 Author Report Share Posted March 29, 2016 у меня не закрывается хз. должно. повторяю, это от браузера зависит Quote Link to comment Share on other sites More sharing options...
Василий Posted April 2, 2016 Report Share Posted April 2, 2016 Как сделать чтоб оповещение приходило когда страница либо свернутая либо браузер свернут , просто не очень удобно что оповещение приходил от браузера и одновременно от сайта ... Quote Link to comment Share on other sites More sharing options...
kolyan22region Posted April 2, 2016 Author Report Share Posted April 2, 2016 Как сделать чтоб оповещение приходило когда страница либо свернутая либо браузер свернут , просто не очень удобно что оповещение приходил от браузера и одновременно от сайта ... Можно было в гугле вбить http://ru.stackoverflow.com/questions/208624/%D0%9A%D0%B0%D0%BA-%D1%83%D0%B7%D0%BD%D0%B0%D1%82%D1%8C-%D0%B0%D0%BA%D1%82%D0%B8%D0%B2%D0%BD%D0%B0-%D0%BB%D0%B8-%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0-%D0%B2%D0%BA%D0%BB%D0%B0%D0%B4%D0%BA%D0%B0-%D0%B1%D1%80%D0%B0%D1%83%D0%B7%D0%B5%D1%80%D0%B0 Quote Link to comment Share on other sites More sharing options...
m4ks Posted April 11, 2016 Report Share Posted April 11, 2016 Вроде бы все правильно сделал. Но уведомление не появляется... Quote Link to comment Share on other sites More sharing options...
viiprogrammer Posted April 11, 2016 Report Share Posted April 11, 2016 Вроде бы все правильно сделал. Но уведомление не появляется... А в браузере разрешаешь уведомления от сайта? Quote Link to comment Share on other sites More sharing options...
m4ks Posted April 12, 2016 Report Share Posted April 12, 2016 А в браузере разрешаешь уведомления от сайта? Да, разрешил! Но уведомление так и не появлялось. Quote Link to comment Share on other sites More sharing options...
viiprogrammer Posted April 12, 2016 Report Share Posted April 12, 2016 Да, разрешил! Но уведомление так и не появлялось. А что в консоли пишет? Какой браузер? Надеюсь не IE...?) Quote Link to comment Share on other sites More sharing options...
omega_zero Posted June 27, 2019 Report Share Posted June 27, 2019 не работает,сборка Qumetic Vii-Engine-2 Quote Link to comment Share on other sites More sharing options...
omega_zero Posted June 29, 2019 Report Share Posted June 29, 2019 Пардон,я тупанул. Надо htttps что бі они работали. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.