mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-03-12 05:21:18 +00:00
fixed notification handling, added localization lines
This commit is contained in:
parent
3ae61f3f97
commit
028492166f
@ -202,17 +202,10 @@ function updateHashtagModal(postboard,hashtag,timeoutArgs) {
|
|||||||
requestHashtag(postboard,hashtag,resource,timeoutArgs);
|
requestHashtag(postboard,hashtag,resource,timeoutArgs);
|
||||||
|
|
||||||
if( _hashtagPendingPostsUpdated ) {
|
if( _hashtagPendingPostsUpdated ) {
|
||||||
var desktopNotification = new Notify(polyglot.t('notify_desktop_title'), {
|
showDesktopNotification(false, polyglot.t('You got')+' '+polyglot.t("new_posts", _hashtagPendingPostsUpdated)+' '+polyglot.t('in search result')+'.', false,'twister_notification_new_posts_modal', function() {
|
||||||
body: 'You got '+polyglot.t("new_posts", _hashtagPendingPostsUpdated)+' in search result.',
|
|
||||||
icon: '../img/twister_mini.png',
|
|
||||||
tag: 'twister_notification_new_posts_modal',
|
|
||||||
timeout: _desktopNotificationTimeout,
|
|
||||||
notifyClick: function() {
|
|
||||||
$(".postboard-news").hide();
|
$(".postboard-news").hide();
|
||||||
displayHashtagPending($(".hashtag-modal .postboard-posts"));
|
displayHashtagPending($(".hashtag-modal .postboard-posts"));
|
||||||
}
|
}, false)
|
||||||
});
|
|
||||||
desktopNotification.show();
|
|
||||||
|
|
||||||
_hashtagPendingPostsUpdated = 0;
|
_hashtagPendingPostsUpdated = 0;
|
||||||
}
|
}
|
||||||
@ -826,6 +819,36 @@ function replyTextKeypress(e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showDesktopNotification(notifyTitle, notifyBody, notifyIcon, notifyTag, actionOnClick, actionOnPermDenied) {
|
||||||
|
function doNotification(notifyTitle, notifyBody, notifyIcon, notifyTag, actionOnClick) {
|
||||||
|
if (!notifyTitle) {
|
||||||
|
notifyTitle = polyglot.t('notify_desktop_title');
|
||||||
|
}
|
||||||
|
if (!notifyIcon) {
|
||||||
|
notifyIcon = '../img/twister_mini.png';
|
||||||
|
}
|
||||||
|
if (!notifyTag) {
|
||||||
|
notifyTag = 'twister_notification';
|
||||||
|
}
|
||||||
|
|
||||||
|
var desktopNotification = new Notify(notifyTitle, {
|
||||||
|
body: notifyBody,
|
||||||
|
icon: notifyIcon,
|
||||||
|
tag: notifyTag,
|
||||||
|
timeout: _desktopNotificationTimeout,
|
||||||
|
notifyClick: actionOnClick,
|
||||||
|
notifyError: function() { alert(polyglot.t('notify_desktop_error')) }
|
||||||
|
});
|
||||||
|
desktopNotification.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Notify.needsPermission) {
|
||||||
|
Notify.requestPermission(false, actionOnPermDenied);
|
||||||
|
} else {
|
||||||
|
doNotification(notifyTitle, notifyBody, notifyIcon, notifyTag, actionOnClick);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* unicode convertion list
|
* unicode convertion list
|
||||||
* k: original string to be replaced
|
* k: original string to be replaced
|
||||||
|
@ -91,6 +91,9 @@ if(preferredLanguage == "en"){
|
|||||||
"Network status": "Network status",
|
"Network status": "Network status",
|
||||||
"New direct message...": "New direct message...",
|
"New direct message...": "New direct message...",
|
||||||
"New Post...": "New Post...",
|
"New Post...": "New Post...",
|
||||||
|
"You got": "You got",
|
||||||
|
"in postboard": "in postboard",
|
||||||
|
"in search result": "in search result",
|
||||||
"new_posts": "%{smart_count} new post |||| %{smart_count} new posts",
|
"new_posts": "%{smart_count} new post |||| %{smart_count} new posts",
|
||||||
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
||||||
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
||||||
@ -329,6 +332,9 @@ if(preferredLanguage == "es"){
|
|||||||
"Network status": "Estado de la red",
|
"Network status": "Estado de la red",
|
||||||
"New direct message...": "Nuevo mensaje directo...",
|
"New direct message...": "Nuevo mensaje directo...",
|
||||||
"New Post...": "Nuevo Post...",
|
"New Post...": "Nuevo Post...",
|
||||||
|
"You got": "You got",
|
||||||
|
"in postboard": "in postboard",
|
||||||
|
"in search result": "in search result",
|
||||||
"new_posts": "%{smart_count} nuevo post |||| %{smart_count} nuevos posts",
|
"new_posts": "%{smart_count} nuevo post |||| %{smart_count} nuevos posts",
|
||||||
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
||||||
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
||||||
@ -565,6 +571,9 @@ if(preferredLanguage == "uk"){
|
|||||||
"Network status": "Статус мережі",
|
"Network status": "Статус мережі",
|
||||||
"New direct message...": "Нове особисте повідомлення...",
|
"New direct message...": "Нове особисте повідомлення...",
|
||||||
"New Post...": "Нове повідомлення...",
|
"New Post...": "Нове повідомлення...",
|
||||||
|
"You got": "You got",
|
||||||
|
"in postboard": "in postboard",
|
||||||
|
"in search result": "in search result",
|
||||||
"new_posts": "%{smart_count} нове повідомлення |||| %{smart_count} нових повідомлень",
|
"new_posts": "%{smart_count} нове повідомлення |||| %{smart_count} нових повідомлень",
|
||||||
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
||||||
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
||||||
@ -799,6 +808,9 @@ if(preferredLanguage == "zh"){
|
|||||||
"Network status": "网络状态",
|
"Network status": "网络状态",
|
||||||
"New direct message...": "新的即时信息...",
|
"New direct message...": "新的即时信息...",
|
||||||
"New Post...": "新推文...",
|
"New Post...": "新推文...",
|
||||||
|
"You got": "You got",
|
||||||
|
"in postboard": "in postboard",
|
||||||
|
"in search result": "in search result",
|
||||||
"new_posts": "%{smart_count} 新推文",
|
"new_posts": "%{smart_count} 新推文",
|
||||||
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
||||||
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
||||||
@ -1033,6 +1045,9 @@ if(preferredLanguage == "nl"){
|
|||||||
"Network status": "Netwerkstatus",
|
"Network status": "Netwerkstatus",
|
||||||
"New direct message...": "Nieuw privébericht...",
|
"New direct message...": "Nieuw privébericht...",
|
||||||
"New Post...": "Nieuw bericht...",
|
"New Post...": "Nieuw bericht...",
|
||||||
|
"You got": "You got",
|
||||||
|
"in postboard": "in postboard",
|
||||||
|
"in search result": "in search result",
|
||||||
"new_posts": "%{smart_count} nieuw bericht |||| %{smart_count} nieuwe berichten",
|
"new_posts": "%{smart_count} nieuw bericht |||| %{smart_count} nieuwe berichten",
|
||||||
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
||||||
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
||||||
@ -1268,6 +1283,9 @@ if(preferredLanguage == "it"){
|
|||||||
"Network status": "Status della rete",
|
"Network status": "Status della rete",
|
||||||
"New direct message...": "Nuovo messaggio diretto...",
|
"New direct message...": "Nuovo messaggio diretto...",
|
||||||
"New Post...": "Nuovo messaggio...",
|
"New Post...": "Nuovo messaggio...",
|
||||||
|
"You got": "You got",
|
||||||
|
"in postboard": "in postboard",
|
||||||
|
"in search result": "in search result",
|
||||||
"new_posts": "%{smart_count} nuovo messaggio |||| %{smart_count} nuovi messaggi",
|
"new_posts": "%{smart_count} nuovo messaggio |||| %{smart_count} nuovi messaggi",
|
||||||
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
||||||
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
||||||
@ -1501,6 +1519,9 @@ if(preferredLanguage == "fr"){
|
|||||||
"Network status": "État du réseau",
|
"Network status": "État du réseau",
|
||||||
"New direct message...": "Nouveau message privé...",
|
"New direct message...": "Nouveau message privé...",
|
||||||
"New Post...": "Nouveau billets...",
|
"New Post...": "Nouveau billets...",
|
||||||
|
"You got": "You got",
|
||||||
|
"in postboard": "in postboard",
|
||||||
|
"in search result": "in search result",
|
||||||
"new_posts": "%{smart_count} nouveau billet |||| %{smart_count} nouveaux billets",
|
"new_posts": "%{smart_count} nouveau billet |||| %{smart_count} nouveaux billets",
|
||||||
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
||||||
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
||||||
@ -1740,6 +1761,9 @@ if(preferredLanguage == "ru"){
|
|||||||
"Network status": "Состояние сети",
|
"Network status": "Состояние сети",
|
||||||
"New direct message...": "Новое личное сообщение...",
|
"New direct message...": "Новое личное сообщение...",
|
||||||
"New Post...": "Новый пост...",
|
"New Post...": "Новый пост...",
|
||||||
|
"You got": "У вас там",
|
||||||
|
"in postboard": "в ленте",
|
||||||
|
"in search result": "в результатах поиска",
|
||||||
"new_posts": "%{smart_count} новый пост |||| %{smart_count} новых постов",
|
"new_posts": "%{smart_count} новый пост |||| %{smart_count} новых постов",
|
||||||
"new_mentions": "%{smart_count} новое упоминание |||| %{smart_count} новых упоминаний",
|
"new_mentions": "%{smart_count} новое упоминание |||| %{smart_count} новых упоминаний",
|
||||||
"new_direct_messages": "%{smart_count} новое личное сообщение |||| %{smart_count} новых личных сообщений",
|
"new_direct_messages": "%{smart_count} новое личное сообщение |||| %{smart_count} новых личных сообщений",
|
||||||
@ -1747,7 +1771,7 @@ if(preferredLanguage == "ru"){
|
|||||||
"Not available": "Недоступно",
|
"Not available": "Недоступно",
|
||||||
"notify_desktop_error": "Твистер не может выполнить уведомление: произошла неизвестная ошибка.",
|
"notify_desktop_error": "Твистер не может выполнить уведомление: произошла неизвестная ошибка.",
|
||||||
"notify_desktop_perm_denied": "Твистер не может выполниь уведомление: разрешение не получено.\n\nЧтобы получать уведомления, разрешите их для этого домена в настройках вашего браузера.",
|
"notify_desktop_perm_denied": "Твистер не может выполниь уведомление: разрешение не получено.\n\nЧтобы получать уведомления, разрешите их для этого домена в настройках вашего браузера.",
|
||||||
"notify_desktop_test": "All the twisters gonna twist. Now you are welcome too.",
|
"notify_desktop_test": "Лягушка сказала: 'если не буду квакать — лопну'. Вы нужны нам, берегите себя.",
|
||||||
"notify_desktop_title": "Watch out, it's twister over here!",
|
"notify_desktop_title": "Watch out, it's twister over here!",
|
||||||
"Number of blocks in block chain:": "Количество блоков в цепочке: ",
|
"Number of blocks in block chain:": "Количество блоков в цепочке: ",
|
||||||
"Number of CPUs to use": "Сколько использовать ядер процессора",
|
"Number of CPUs to use": "Сколько использовать ядер процессора",
|
||||||
@ -1980,6 +2004,9 @@ if(preferredLanguage == "de"){
|
|||||||
"Network status": "Netzwerkstatus",
|
"Network status": "Netzwerkstatus",
|
||||||
"New direct message...": "Neue Direktnachricht...",
|
"New direct message...": "Neue Direktnachricht...",
|
||||||
"New Post...": "Neuer Post...",
|
"New Post...": "Neuer Post...",
|
||||||
|
"You got": "You got",
|
||||||
|
"in postboard": "in postboard",
|
||||||
|
"in search result": "in search result",
|
||||||
"new_posts": "%{smart_count} neuer Post |||| %{smart_count} neue Posts",
|
"new_posts": "%{smart_count} neuer Post |||| %{smart_count} neue Posts",
|
||||||
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
||||||
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
||||||
@ -2216,6 +2243,9 @@ if(preferredLanguage == "ja"){
|
|||||||
"Network status": "ネットワークステータス",
|
"Network status": "ネットワークステータス",
|
||||||
"New direct message...": "ダイレクトメッセージ...",
|
"New direct message...": "ダイレクトメッセージ...",
|
||||||
"New Post...": "投稿する",
|
"New Post...": "投稿する",
|
||||||
|
"You got": "You got",
|
||||||
|
"in postboard": "in postboard",
|
||||||
|
"in search result": "in search result",
|
||||||
"new_posts": "%{smart_count} 新投稿 |||| %{smart_count} 新投稿",
|
"new_posts": "%{smart_count} 新投稿 |||| %{smart_count} 新投稿",
|
||||||
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
||||||
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
||||||
@ -2449,6 +2479,9 @@ if(preferredLanguage == "pt-BR"){
|
|||||||
"Network status": "Estado da rede",
|
"Network status": "Estado da rede",
|
||||||
"New direct message...": "Nova mensagem direta...",
|
"New direct message...": "Nova mensagem direta...",
|
||||||
"New Post...": "Nova Postagem...",
|
"New Post...": "Nova Postagem...",
|
||||||
|
"You got": "You got",
|
||||||
|
"in postboard": "in postboard",
|
||||||
|
"in search result": "in search result",
|
||||||
"new_posts": "%{smart_count} nova postagem |||| %{smart_count} novas postagens",
|
"new_posts": "%{smart_count} nova postagem |||| %{smart_count} novas postagens",
|
||||||
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
||||||
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
||||||
@ -2686,6 +2719,9 @@ if(preferredLanguage == "tr"){
|
|||||||
"Network status": "Ağ durumu",
|
"Network status": "Ağ durumu",
|
||||||
"New direct message...": "Yeni direk mesaj...",
|
"New direct message...": "Yeni direk mesaj...",
|
||||||
"New Post...": "Yeni gönderi...",
|
"New Post...": "Yeni gönderi...",
|
||||||
|
"You got": "You got",
|
||||||
|
"in postboard": "in postboard",
|
||||||
|
"in search result": "in search result",
|
||||||
"new_posts": "%{smart_count} yeni gönederi |||| %{smart_count} yeni gönderi",
|
"new_posts": "%{smart_count} yeni gönederi |||| %{smart_count} yeni gönderi",
|
||||||
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
||||||
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
||||||
@ -2920,6 +2956,9 @@ if(preferredLanguage == "cs"){
|
|||||||
"Network status": "Stav sítě",
|
"Network status": "Stav sítě",
|
||||||
"New direct message...": "Nová přímá zpráva...",
|
"New direct message...": "Nová přímá zpráva...",
|
||||||
"New Post...": "Nový příspěvek...",
|
"New Post...": "Nový příspěvek...",
|
||||||
|
"You got": "You got",
|
||||||
|
"in postboard": "in postboard",
|
||||||
|
"in search result": "in search result",
|
||||||
"new_posts": "%{smart_count} nový příspěvek |||| %{smart_count} nové příspěvky |||| %{smart_count} nových příspěvků",
|
"new_posts": "%{smart_count} nový příspěvek |||| %{smart_count} nové příspěvky |||| %{smart_count} nových příspěvků",
|
||||||
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
"new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions",
|
||||||
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
"new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages",
|
||||||
|
@ -103,16 +103,9 @@ var MAL = function()
|
|||||||
newTweetsBarMenu.text(String(newPosts));
|
newTweetsBarMenu.text(String(newPosts));
|
||||||
newTweetsBarMenu.addClass("show");
|
newTweetsBarMenu.addClass("show");
|
||||||
|
|
||||||
var desktopNotification = new Notify(polyglot.t('notify_desktop_title'), {
|
showDesktopNotification(false, polyglot.t('You got')+' '+polyglot.t("new_posts", newPosts)+' '+polyglot.t('in postboard')+'.', false,'twister_notification_new_posts', function() {
|
||||||
body: 'You got '+polyglot.t("new_posts", newPosts)+' in postboard.',
|
|
||||||
icon: '../img/twister_mini.png',
|
|
||||||
tag: 'twister_notification_new_postboard',
|
|
||||||
timeout: _desktopNotificationTimeout,
|
|
||||||
notifyClick: function() {
|
|
||||||
requestTimelineUpdate("latest",postsPerRefresh,followingUsers,promotedPostsOnly);
|
requestTimelineUpdate("latest",postsPerRefresh,followingUsers,promotedPostsOnly);
|
||||||
}
|
}, false)
|
||||||
});
|
|
||||||
desktopNotification.show();
|
|
||||||
} else {
|
} else {
|
||||||
newTweetsBar.hide();
|
newTweetsBar.hide();
|
||||||
newTweetsBar.text("");
|
newTweetsBar.text("");
|
||||||
|
20
js/notify.js
20
js/notify.js
@ -41,8 +41,6 @@
|
|||||||
notifyClose: null,
|
notifyClose: null,
|
||||||
notifyClick: null,
|
notifyClick: null,
|
||||||
notifyError: null,
|
notifyError: null,
|
||||||
permissionGranted: null,
|
|
||||||
permissionDenied: null,
|
|
||||||
timeout: null
|
timeout: null
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -80,16 +78,6 @@
|
|||||||
if (isFunction(this.options.notifyError)) {
|
if (isFunction(this.options.notifyError)) {
|
||||||
this.onErrorCallback = this.options.notifyError;
|
this.onErrorCallback = this.options.notifyError;
|
||||||
}
|
}
|
||||||
|
|
||||||
//callback when permission granted after request
|
|
||||||
if (isFunction(this.options.permissionGranted)) {
|
|
||||||
this.onPermissionGrantedCallback = this.options.permissionGranted;
|
|
||||||
}
|
|
||||||
|
|
||||||
//callback when permission denied after request
|
|
||||||
if (isFunction(this.options.permissionDenied)) {
|
|
||||||
this.onPermissionDeniedCallback = this.options.permissionDenied;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,14 +119,6 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Notify.permissionLevel === 'default' ) {
|
|
||||||
Notify.requestPermission(this.onPermissionGrantedCallback, this.onPermissionDeniedCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Notify.needsPermission) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.myNotify = new Notification(this.title, {
|
this.myNotify = new Notification(this.title, {
|
||||||
'body': this.options.body,
|
'body': this.options.body,
|
||||||
'tag' : this.options.tag,
|
'tag' : this.options.tag,
|
||||||
|
@ -2,7 +2,7 @@ $(function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var _desktopNotificationTimeout = 40; // it should be an option
|
var _desktopNotificationTimeout = 10; // it should be an option
|
||||||
|
|
||||||
var TwisterOptions = function()
|
var TwisterOptions = function()
|
||||||
{
|
{
|
||||||
@ -91,19 +91,8 @@ var TwisterOptions = function()
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.notificationDesktopTest = function() {
|
this.notificationDesktopTest = function() {
|
||||||
$('#notifications-desktop-test').on('click', function(){
|
$('#notifications-desktop-test').on('click', function() {
|
||||||
var desktopNotification = new Notify(polyglot.t('notify_desktop_title'), {
|
showDesktopNotification(false, polyglot.t('notify_desktop_test'), false,'twister_notification_test', false, function() { alert(polyglot.t('notify_desktop_perm_denied')) })
|
||||||
body: polyglot.t('notify_desktop_test'),
|
|
||||||
icon: '../img/twister_mini.png',
|
|
||||||
tag: 'twister_notification_test',
|
|
||||||
timeout: _desktopNotificationTimeout,
|
|
||||||
notifyError: function() { alert(polyglot.t('notify_desktop_error')); }
|
|
||||||
});
|
|
||||||
if (Notify.permissionLevel === 'denied') {
|
|
||||||
alert(polyglot.t('notify_desktop_perm_denied'));
|
|
||||||
} else {
|
|
||||||
desktopNotification.show();
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,14 +100,7 @@ function requestMentionsCount() {
|
|||||||
|
|
||||||
$.MAL.soundNotifyMentions();
|
$.MAL.soundNotifyMentions();
|
||||||
|
|
||||||
var desktopNotification = new Notify(polyglot.t('notify_desktop_title'), {
|
showDesktopNotification(false, polyglot.t('You got')+' '+polyglot.t('new_mentions', _newMentions)+'.', false,'twister_notification_new_mentions', openMentionsModal, false)
|
||||||
body: 'You got '+polyglot.t('new_mentions', _newMentions)+'.',
|
|
||||||
icon: '../img/twister_mini.png',
|
|
||||||
tag: 'twister_notification_new_mentions',
|
|
||||||
timeout: _desktopNotificationTimeout,
|
|
||||||
notifyClick: openMentionsModal
|
|
||||||
});
|
|
||||||
desktopNotification.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// was moved here from requestDMsCount() because that is not ticking right
|
// was moved here from requestDMsCount() because that is not ticking right
|
||||||
@ -119,16 +112,9 @@ function requestMentionsCount() {
|
|||||||
if ( newDMs ) {
|
if ( newDMs ) {
|
||||||
$.MAL.soundNotifyDM();
|
$.MAL.soundNotifyDM();
|
||||||
|
|
||||||
var desktopNotification = new Notify(polyglot.t('notify_desktop_title'), {
|
showDesktopNotification(false, polyglot.t('You got')+' '+polyglot.t('new_direct_messages', newDMs)+'.', false, 'twister_notification_new_DMs', function() {
|
||||||
body: 'You got '+polyglot.t('new_direct_messages', newDMs)+'.',
|
|
||||||
icon: '../img/twister_mini.png',
|
|
||||||
tag: 'twister_notification_new_DMs',
|
|
||||||
timeout: _desktopNotificationTimeout,
|
|
||||||
notifyClick: function() {
|
|
||||||
window.location.hash = '#directmessages';
|
window.location.hash = '#directmessages';
|
||||||
}
|
}, false)
|
||||||
});
|
|
||||||
desktopNotification.show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user