diff --git a/css/style.css b/css/style.css index 687df3d..ee88096 100644 --- a/css/style.css +++ b/css/style.css @@ -297,11 +297,7 @@ button.disabled:hover border: solid 1px rgba( 69, 71, 77, .1 ); background: #fff; } -.options .module -{ - margin: 5px; - padding: 5px; -} + .messages-qtd { position: absolute; @@ -1761,19 +1757,34 @@ ol.toptrends-list { } } -/* Options */ -#playerVol { - float: right; - margin-right: 20px; +/************************************* +****************** OPTIONS *********** +**************************************/ + +.options .module +{ + margin: 5px; + padding: 15px; } -.volValue { - float: right; - margin-right: -163px; + +.options .container +{ + margin: 5px 0px 5px 10px; +} + +.options .label-h { + font-weight: 700; +} + +.options .module label { font: 12px "Open Sans", sans-serif; } -#notifyForm p, #choseLanguage p, #keysOpt p { - margin-top: 15px; + +.volValue { + vertical-align: top; + font: 12px "Open Sans", sans-serif; } + .suboptions { margin: 5px 30px; border: double 2px rgba( 69, 71, 77, .1 ); diff --git a/js/interface_common.js b/js/interface_common.js index 45e8707..fb0ac0d 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -202,10 +202,12 @@ function updateHashtagModal(postboard,hashtag,timeoutArgs) { requestHashtag(postboard,hashtag,resource,timeoutArgs); if( _hashtagPendingPostsUpdated ) { - showDesktopNotification(false, polyglot.t('You got')+' '+polyglot.t("new_posts", _hashtagPendingPostsUpdated)+' '+polyglot.t('in search result')+'.', false,'twister_notification_new_posts_modal', function() { - $(".postboard-news").hide(); - displayHashtagPending($(".hashtag-modal .postboard-posts")); - }, false) + if ($.Options.getShowDesktopNotifPostsModalOpt() === 'enable') { + $.MAL.showDesktopNotif(false, polyglot.t('You got')+' '+polyglot.t("new_posts", _hashtagPendingPostsUpdated)+' '+polyglot.t('in search result')+'.', false,'twister_notification_new_posts_modal', $.Options.getShowDesktopNotifPostsModalTimerOpt(), function() { + $(".postboard-news").hide(); + displayHashtagPending($(".hashtag-modal .postboard-posts")); + }, false) + } _hashtagPendingPostsUpdated = 0; } @@ -819,36 +821,6 @@ 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 * k: original string to be replaced diff --git a/js/interface_localization.js b/js/interface_localization.js index 04a5ec4..76f3684 100644 --- a/js/interface_localization.js +++ b/js/interface_localization.js @@ -101,7 +101,7 @@ if(preferredLanguage == "en"){ "Not available": "Not available", // username is not available "notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for this domain in settings of your browser.", - "notify_desktop_test": "All the twisters gonna twist. Now you are welcome too.", + "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "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 ", @@ -196,6 +196,7 @@ if(preferredLanguage == "en"){ "Notifications": "Notifications", "Desktop notifications": "Desktop notifications", "Sound notifications": "Sound notifications", + "Test": "Test", "Send key": "Send key", "Posts display": "Posts display", "Post editor": "Post editor", @@ -232,6 +233,7 @@ if(preferredLanguage == "en"){ "RTs those are close to original twist": "RTs those are close to original twist", "Show if the original is older than": "Show if the original is older than", "hour(s)": "hour(s)", + "second(s)": "second(s)", "only numbers are allowed!": "only numbers are allowed!", "Show with every user name": "Show with every user name", "Show at profile modal only": "Show at profile modal only", @@ -342,7 +344,7 @@ if(preferredLanguage == "es"){ "Not available": "No disponible", // username is not available "notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for this domain in settings of your browser.", - "notify_desktop_test": "All the twisters gonna twist. Now you are welcome too.", + "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", "Number of blocks in block chain:": "Número de bloques en la cadena de bloques: ", "Number of CPUs to use": "Número de CPUs para utilizar ", @@ -365,7 +367,7 @@ if(preferredLanguage == "es"){ "Retransmits": "Retransmiciones", "Retransmitted by": "Retransmitido por", "search": "search", - "seconds": "%{smart_count} segundos |||| %{smart_count} segundos", + "seconds": "%{smart_count} segundo |||| %{smart_count} segundos", "send": "send", "Send post with username": "Enviar post con nombre de usuario ", "Sent Direct Message": "Mensaje directo", @@ -437,6 +439,7 @@ if(preferredLanguage == "es"){ "Notifications": "Notificaciones", "Desktop notifications": "Notificaciones de Escritorio", "Sound notifications": "Notificaciones de Sonido", + "Test": "Test", "Send key": "Send key", "Posts display": "Posts display", "Post editor": "Post editor", @@ -472,7 +475,8 @@ if(preferredLanguage == "es"){ "Postboard displays": "Postboard displays", "RTs those are close to original twist": "RTs those are close to original twist", "Show if the original is older than": "Show if the original is older than", - "hour(s)": "hour(s)", + "hour(s)": "hora(s)", + "second(s)": "segundo(s)", "only numbers are allowed!": "only numbers are allowed!", "Show with every user name": "Show with every user name", "Show at profile modal only": "Show at profile modal only", @@ -581,7 +585,7 @@ if(preferredLanguage == "uk"){ "Not available": "Не доступне", // username is not available "notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for this domain in settings of your browser.", - "notify_desktop_test": "All the twisters gonna twist. Now you are welcome too.", + "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", "Number of blocks in block chain:": "Кількість блоків у ланцюгу: ", "Number of CPUs to use": "Кількість CPUs до використання ", @@ -675,6 +679,7 @@ if(preferredLanguage == "uk"){ "Notifications": "Notifications", "Desktop notifications": "Desktop notifications", "Sound notifications": "Sound notifications", + "Test": "Test", "Send key": "Send key", "Posts display": "Posts display", "Post editor": "Post editor", @@ -711,6 +716,7 @@ if(preferredLanguage == "uk"){ "RTs those are close to original twist": "RTs those are close to original twist", "Show if the original is older than": "Show if the original is older than", "hour(s)": "hour(s)", + "second(s)": "second(s)", "only numbers are allowed!": "only numbers are allowed!", "Show with every user name": "Show with every user name", "Show at profile modal only": "Show at profile modal only", @@ -818,7 +824,7 @@ if(preferredLanguage == "zh"){ "Not available": "用户名不可用", // username is not available "notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for this domain in settings of your browser.", - "notify_desktop_test": "All the twisters gonna twist. Now you are welcome too.", + "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", "Number of blocks in block chain:": "块链中的块数:", "Number of CPUs to use": "使用CPU数目 ", @@ -912,6 +918,7 @@ if(preferredLanguage == "zh"){ "Notifications": "Notifications", "Desktop notifications": "Desktop notifications", "Sound notifications": "Sound notifications", + "Test": "Test", "Send key": "Send key", "Posts display": "Posts display", "Post editor": "Post editor", @@ -948,6 +955,7 @@ if(preferredLanguage == "zh"){ "RTs those are close to original twist": "RTs those are close to original twist", "Show if the original is older than": "Show if the original is older than", "hour(s)": "hour(s)", + "second(s)": "second(s)", "only numbers are allowed!": "only numbers are allowed!", "Show with every user name": "Show with every user name", "Show at profile modal only": "Show at profile modal only", @@ -1055,7 +1063,7 @@ if(preferredLanguage == "nl"){ "Not available": "Niet beschikbaar", // username is not available "notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for this domain in settings of your browser.", - "notify_desktop_test": "All the twisters gonna twist. Now you are welcome too.", + "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", "Number of blocks in block chain:": "Aantal blocks in block chain: ", "Number of CPUs to use": "Aantal CPUs om te gebruiken ", @@ -1150,6 +1158,7 @@ if(preferredLanguage == "nl"){ "Notifications": "Notifications", "Desktop notifications": "Desktop notifications", "Sound notifications": "Sound notifications", + "Test": "Test", "Send key": "Send key", "Posts display": "Posts display", "Post editor": "Post editor", @@ -1186,6 +1195,7 @@ if(preferredLanguage == "nl"){ "RTs those are close to original twist": "RTs those are close to original twist", "Show if the original is older than": "Show if the original is older than", "hour(s)": "hour(s)", + "second(s)": "seconde(n)", "only numbers are allowed!": "only numbers are allowed!", "Show with every user name": "Show with every user name", "Show at profile modal only": "Show at profile modal only", @@ -1293,7 +1303,7 @@ if(preferredLanguage == "it"){ "Not available": "Non disponibile", // username is not available "notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for this domain in settings of your browser.", - "notify_desktop_test": "All the twisters gonna twist. Now you are welcome too.", + "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", "Number of blocks in block chain:": "Numero di blocchi nella catena: ", "Number of CPUs to use": "Numero di processori da usare:", @@ -1385,6 +1395,7 @@ if(preferredLanguage == "it"){ "Notifications": "Notifications", "Desktop notifications": "Desktop notifications", "Sound notifications": "Sound notifications", + "Test": "Test", "Send key": "Send key", "Posts display": "Posts display", "Post editor": "Post editor", @@ -1421,6 +1432,7 @@ if(preferredLanguage == "it"){ "RTs those are close to original twist": "RTs those are close to original twist", "Show if the original is older than": "Show if the original is older than", "hour(s)": "hour(s)", + "second(s)": "secondo(i)", "only numbers are allowed!": "only numbers are allowed!", "Show with every user name": "Show with every user name", "Show at profile modal only": "Show at profile modal only", @@ -1529,7 +1541,7 @@ if(preferredLanguage == "fr"){ "Not available": "Non disponible", // username is not available "notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for this domain in settings of your browser.", - "notify_desktop_test": "All the twisters gonna twist. Now you are welcome too.", + "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", "Number of blocks in block chain:": "Nombre de blocs dans la chaîne de blocs: ", "Number of CPUs to use": "Nombre de processeurs à utiliser", @@ -1624,6 +1636,7 @@ if(preferredLanguage == "fr"){ "Notifications": "Notifications", "Desktop notifications": "Desktop notifications", "Sound notifications": "Sound notifications", + "Test": "Test", "Send key": "Send key", "Posts display": "Posts display", "Post editor": "Post editor", @@ -1660,6 +1673,7 @@ if(preferredLanguage == "fr"){ "RTs those are close to original twist": "RTs those are close to original twist", "Show if the original is older than": "Show if the original is older than", "hour(s)": "hour(s)", + "second(s)": "seconde(s)", "only numbers are allowed!": "only numbers are allowed!", "Show with every user name": "Show with every user name", "Show at profile modal only": "Show at profile modal only", @@ -1761,7 +1775,7 @@ if(preferredLanguage == "ru"){ "Network status": "Состояние сети", "New direct message...": "Новое личное сообщение...", "New Post...": "Новый пост...", - "You got": "У вас там", + "You got": "А у вас там", "in postboard": "в ленте", "in search result": "в результатах поиска", "new_posts": "%{smart_count} новый пост |||| %{smart_count} новых постов", @@ -1771,7 +1785,7 @@ if(preferredLanguage == "ru"){ "Not available": "Недоступно", "notify_desktop_error": "Твистер не может выполнить уведомление: произошла неизвестная ошибка.", "notify_desktop_perm_denied": "Твистер не может выполниь уведомление: разрешение не получено.\n\nЧтобы получать уведомления, разрешите их для этого домена в настройках вашего браузера.", - "notify_desktop_test": "Лягушка сказала: 'если не буду квакать — лопну'. Вы нужны нам, берегите себя.", + "notify_desktop_test": "Одна лягушка сказала:\n'если не буду квакать — лопну'.\nВы нужны нам, берегите себя.", "notify_desktop_title": "Watch out, it's twister over here!", "Number of blocks in block chain:": "Количество блоков в цепочке: ", "Number of CPUs to use": "Сколько использовать ядер процессора", @@ -1866,6 +1880,7 @@ if(preferredLanguage == "ru"){ "Notifications": "Уведомления", "Desktop notifications": "Уведомления рабочего стола", "Sound notifications": "Звуковые уведомления", + "Test": "Проверка", "Send key": "Отправка сообщения", "Posts display": "Отображение сообщений", "Post editor": "Редактор сообщения", @@ -1902,6 +1917,7 @@ if(preferredLanguage == "ru"){ "RTs those are close to original twist": "Перепосты сразу после исходного сообщения", "Show if the original is older than": "Показывать если исходное сообщение старше", "hour(s)": "час(ов)", + "second(s)": "секунд(а,ы)", "only numbers are allowed!": "только числа!", "Show with every user name": "Показывать везде около имени пользователя", "Show at profile modal only": "Показывать только в окне профиля", @@ -2014,7 +2030,7 @@ if(preferredLanguage == "de"){ "Not available": "Nicht verfügbar", // username is not available "notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for this domain in settings of your browser.", - "notify_desktop_test": "All the twisters gonna twist. Now you are welcome too.", + "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", "Number of blocks in block chain:": "Anzahl der Blöcke in der Block-Chain: ", "Number of CPUs to use": "Anzahl der zu benutzenden CPU's ", @@ -2110,6 +2126,7 @@ if(preferredLanguage == "de"){ "Notifications": "Benachrichtigungen", "Desktop notifications": "Desktophinweisen", "Sound notifications": "Audioeinstellungen", + "Test": "Test", "Send key": "Send key", "Posts display": "Posts display", "Post editor": "Nachrichten-Editor", @@ -2146,6 +2163,7 @@ if(preferredLanguage == "de"){ "RTs those are close to original twist": "RTs those are close to original twist", "Show if the original is older than": "Show if the original is older than", "hour(s)": "hour(s)", + "second(s)": "Sekunde(n)", "only numbers are allowed!": "only numbers are allowed!", "Show with every user name": "Zeige mit jedem Benutzernamen", "Show at profile modal only": "Show at profile modal only", @@ -2253,7 +2271,7 @@ if(preferredLanguage == "ja"){ "Not available": "使用中", // username is not available "notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for this domain in settings of your browser.", - "notify_desktop_test": "All the twisters gonna twist. Now you are welcome too.", + "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", "Number of blocks in block chain:": "全ブロック数: ", "Number of CPUs to use": "利用するCPUの数", @@ -2345,6 +2363,7 @@ if(preferredLanguage == "ja"){ "Notifications": "Notifications", "Desktop notifications": "Desktop notifications", "Sound notifications": "Sound notifications", + "Test": "Test", "Send key": "Send key", "Posts display": "Posts display", "Post editor": "Post editor", @@ -2381,6 +2400,7 @@ if(preferredLanguage == "ja"){ "RTs those are close to original twist": "RTs those are close to original twist", "Show if the original is older than": "Show if the original is older than", "hour(s)": "hour(s)", + "second(s)": "second(s)", "only numbers are allowed!": "only numbers are allowed!", "Show with every user name": "Show with every user name", "Show at profile modal only": "Show at profile modal only", @@ -2489,7 +2509,7 @@ if(preferredLanguage == "pt-BR"){ "Not available": "Indisponível", // username is not available "notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for this domain in settings of your browser.", - "notify_desktop_test": "All the twisters gonna twist. Now you are welcome too.", + "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", "Number of blocks in block chain:": "Número de blocos: ", "Number of CPUs to use": "Número de CPUs a serem utilizados ", @@ -2586,6 +2606,7 @@ if(preferredLanguage == "pt-BR"){ "Notifications": "Notifications", "Desktop notifications": "Desktop notifications", "Sound notifications": "Sound notifications", + "Test": "Test", "Send key": "Send key", "Posts display": "Posts display", "Post editor": "Post editor", @@ -2622,6 +2643,7 @@ if(preferredLanguage == "pt-BR"){ "RTs those are close to original twist": "RTs those are close to original twist", "Show if the original is older than": "Show if the original is older than", "hour(s)": "hour(s)", + "second(s)": "segundo(s)", "only numbers are allowed!": "only numbers are allowed!", "Show with every user name": "Show with every user name", "Show at profile modal only": "Show at profile modal only", @@ -2729,7 +2751,7 @@ if(preferredLanguage == "tr"){ "Not available": "Kullanılamaz", // username is not available "notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for this domain in settings of your browser.", - "notify_desktop_test": "All the twisters gonna twist. Now you are welcome too.", + "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", "Number of blocks in block chain:": "Blok zincirindeki blok sayısı: ", "Number of CPUs to use": "Kullanılacak CPU sayısı ", @@ -2814,6 +2836,7 @@ if(preferredLanguage == "tr"){ "Notifications": "Uyarılar", "Desktop notifications": "Masaüstü uyarılar", "Sound notifications": "Sesli uyarılar", + "Test": "Test", "Send key": "Gönderme tuşu", "Posts display": "Gönderiler", "Post editor": "Gönderi düzenleyici", @@ -2859,6 +2882,7 @@ if(preferredLanguage == "tr"){ "RTs those are close to original twist": "Orjinal twist'e yakın olan RTler", "Show if the original is older than": "Orjinali yandaki süreden daha eskiyse göster", "hour(s)": "saat", + "second(s)": "saniye", "only numbers are allowed!": "sadece rakam girilebilir!", "Show with every user name": "Tüm kullanıcı adlarının yanında göster", "Show at profile modal only": "Sadece profilinde göster", @@ -2966,7 +2990,7 @@ if(preferredLanguage == "cs"){ "Not available": "Tuto přezdívku již někdo používá", // username is not available "notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for this domain in settings of your browser.", - "notify_desktop_test": "All the twisters gonna twist. Now you are welcome too.", + "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", "Number of blocks in block chain:": "Počet bloků v blockchainu: ", "Number of CPUs to use": "Kolik jader procesoru použít? ", @@ -3059,6 +3083,7 @@ if(preferredLanguage == "cs"){ "Notifications": "Upozornění", "Desktop notifications": "Upozornění na ploše", "Sound notifications": "Zvuková upozornění", + "Test": "Test", "Send key": "Klávesa pro odeslání", "Posts display": "Zobrazení příspěvků", "Post editor": "Editor příspěvků", @@ -3095,6 +3120,7 @@ if(preferredLanguage == "cs"){ "RTs those are close to original twist": "Přeposlání blízká původnímu příspěvku", "Show if the original is older than": "Ukázat pokud je už originál starší než", "hour(s)": "hodin", + "second(s)": "vteřinou(ami)", "only numbers are allowed!": "povolena jsou jen čísla!", "Show with every user name": "Ukázat u každé přezdívky", "Show at profile modal only": "Ukázat jen v okně profilu", diff --git a/js/mobile_abstract.js b/js/mobile_abstract.js index 633b95d..2015327 100644 --- a/js/mobile_abstract.js +++ b/js/mobile_abstract.js @@ -103,9 +103,11 @@ var MAL = function() newTweetsBarMenu.text(String(newPosts)); newTweetsBarMenu.addClass("show"); - showDesktopNotification(false, polyglot.t('You got')+' '+polyglot.t("new_posts", newPosts)+' '+polyglot.t('in postboard')+'.', false,'twister_notification_new_posts', function() { - requestTimelineUpdate("latest",postsPerRefresh,followingUsers,promotedPostsOnly); - }, false) + if ($.Options.getShowDesktopNotifPostsOpt() === 'enable') { + this.showDesktopNotif(false, polyglot.t('You got')+' '+polyglot.t("new_posts", newPosts)+' '+polyglot.t('in postboard')+'.', false,'twister_notification_new_posts', $.Options.getShowDesktopNotifPostsTimerOpt(), function() { + requestTimelineUpdate("latest",postsPerRefresh,followingUsers,promotedPostsOnly); + }, false) + } } else { newTweetsBar.hide(); newTweetsBar.text(""); @@ -375,6 +377,39 @@ var MAL = function() } } + this.showDesktopNotif = function(notifyTitle, notifyBody, notifyIcon, notifyTag, notifyTimer, actionOnClick, actionOnPermDenied) { + function doNotification(notifyTitle, notifyBody, notifyIcon, notifyTag, notifyTimer, actionOnClick) { + if (!notifyTitle) { + notifyTitle = polyglot.t('notify_desktop_title'); + } + if (!notifyIcon) { + notifyIcon = '../img/twister_mini.png'; + } + if (!notifyTag) { + notifyTag = 'twister_notification'; + } + if (!notifyTimer) { + notifyTimer = 3600 * 24 * 30; // one month + } + + var desktopNotification = new Notify(notifyTitle, { + body: notifyBody, + icon: notifyIcon, + tag: notifyTag, + timeout: notifyTimer, + 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, notifyTimer, actionOnClick); + } + } + this.reqRepAfterCB = function(postLi, postsFromJson) { if ($.hasOwnProperty("mobile")) { for( var i = 0; i < postsFromJson.length; i++) { diff --git a/js/options.js b/js/options.js index 6b480d7..cea7f18 100644 --- a/js/options.js +++ b/js/options.js @@ -43,7 +43,7 @@ var TwisterOptions = function() player[0].play(); }); } - + this.volumeControl = function() { var playerVol = $('#playerVol'); playerVol[0].value = $.Options.getOption(playerVol[0].id, 1); @@ -90,9 +90,129 @@ var TwisterOptions = function() player[0].play(); } - this.notificationDesktopTest = function() { - $('#notifications-desktop-test').on('click', function() { - showDesktopNotification(false, polyglot.t('notify_desktop_test'), false,'twister_notification_test', false, function() { alert(polyglot.t('notify_desktop_perm_denied')) }) + this.getShowDesktopNotifPostsOpt = function() { + return $.Options.getOption('showDesktopNotifPosts','enable'); + } + + this.setShowDesktopNotifPostsOpt = function () { + function showDesktopNotifPostsDesc() { + if ($.Options.getShowDesktopNotifPostsOpt() === 'enable') { + $('#showDesktopNotifPostsDesc')[0].style.display= 'inline'; + } else { + $('#showDesktopNotifPostsDesc')[0].style.display= 'none'; + } + } + $('#showDesktopNotifPosts').val(this.getShowDesktopNotifPostsOpt()); + showDesktopNotifPostsDesc(); + $('#showDesktopNotifPosts').on('change', function() { + $.Options.setOption(this.id, this.value); + showDesktopNotifPostsDesc(); + }); + } + + this.getShowDesktopNotifPostsTimerOpt = function () { + return parseInt($.Options.getOption('showDesktopNotifPostsTimer', '6')); + } + + this.setShowDesktopNotifPostsTimerOpt = function () { + $('#showDesktopNotifPostsTimer')[0].value = this.getShowDesktopNotifPostsTimerOpt().toString(); + + $('#showDesktopNotifPostsTimer').on('keyup', function () {setElemValNumeric(this, polyglot.t('second(s)'));}); + } + + this.getShowDesktopNotifPostsModalOpt = function() { + return $.Options.getOption('showDesktopNotifPostsModal','enable'); + } + + this.setShowDesktopNotifPostsModalOpt = function () { + function showDesktopNotifPostsModalDesc() { + if ($.Options.getShowDesktopNotifPostsModalOpt() === 'enable') { + $('#showDesktopNotifPostsModalDesc')[0].style.display= 'inline'; + } else { + $('#showDesktopNotifPostsModalDesc')[0].style.display= 'none'; + } + } + $('#showDesktopNotifPostsModal').val(this.getShowDesktopNotifPostsModalOpt()); + showDesktopNotifPostsModalDesc(); + $('#showDesktopNotifPostsModal').on('change', function() { + $.Options.setOption(this.id, this.value); + showDesktopNotifPostsModalDesc(); + }); + } + + this.getShowDesktopNotifPostsModalTimerOpt = function () { + return parseInt($.Options.getOption('showDesktopNotifPostsModalTimer', '6')); + } + + this.setShowDesktopNotifPostsModalTimerOpt = function () { + $('#showDesktopNotifPostsModalTimer')[0].value = this.getShowDesktopNotifPostsModalTimerOpt().toString(); + + $('#showDesktopNotifPostsModalTimer').on('keyup', function () {setElemValNumeric(this, polyglot.t('second(s)'));}); + } + + this.getShowDesktopNotifMentionsOpt = function() { + return $.Options.getOption('showDesktopNotifMentions','enable'); + } + + this.setShowDesktopNotifMentionsOpt = function () { + function showDesktopNotifMentionsDesc() { + if ($.Options.getShowDesktopNotifMentionsOpt() === 'enable') { + $('#showDesktopNotifMentionsDesc')[0].style.display= 'inline'; + } else { + $('#showDesktopNotifMentionsDesc')[0].style.display= 'none'; + } + } + $('#showDesktopNotifMentions').val(this.getShowDesktopNotifMentionsOpt()); + showDesktopNotifMentionsDesc(); + $('#showDesktopNotifMentions').on('change', function() { + $.Options.setOption(this.id, this.value); + showDesktopNotifMentionsDesc(); + }); + } + + this.getShowDesktopNotifMentionsTimerOpt = function () { + return parseInt($.Options.getOption('showDesktopNotifMentionsTimer', '60')); + } + + this.setShowDesktopNotifMentionsTimerOpt = function () { + $('#showDesktopNotifMentionsTimer')[0].value = this.getShowDesktopNotifMentionsTimerOpt().toString(); + + $('#showDesktopNotifMentionsTimer').on('keyup', function () {setElemValNumeric(this, polyglot.t('second(s)'));}); + } + + this.getShowDesktopNotifDMsOpt = function() { + return $.Options.getOption('showDesktopNotifDMs','enable'); + } + + this.setShowDesktopNotifDMsOpt = function () { + function showDesktopNotifDMsDesc() { + if ($.Options.getShowDesktopNotifDMsOpt() === 'enable') { + $('#showDesktopNotifDMsDesc')[0].style.display= 'inline'; + } else { + $('#showDesktopNotifDMsDesc')[0].style.display= 'none'; + } + } + $('#showDesktopNotifDMs').val(this.getShowDesktopNotifDMsOpt()); + showDesktopNotifDMsDesc(); + $('#showDesktopNotifDMs').on('change', function() { + $.Options.setOption(this.id, this.value); + showDesktopNotifDMsDesc(); + }); + } + + this.getShowDesktopNotifDMsTimerOpt = function () { + return parseInt($.Options.getOption('showDesktopNotifDMsTimer', '60')); + } + + this.setShowDesktopNotifDMsTimerOpt = function () { + $('#showDesktopNotifDMsTimer')[0].value = this.getShowDesktopNotifDMsTimerOpt().toString(); + + $('#showDesktopNotifDMsTimer').on('keyup', function () {setElemValNumeric(this, polyglot.t('second(s)'));}); + } + + this.setTestDesktopNotif = function() { + $('#testDesktopNotif').on('click', function() { + $.MAL.showDesktopNotif(false, polyglot.t('notify_desktop_test'), false,'twister_notification_test', false, function() { alert(polyglot.t('notify_desktop_perm_denied')) }) }) } @@ -104,7 +224,7 @@ var TwisterOptions = function() $.Options.setOption(this.id, this.value); }) } - + this.keyEnterToSend = function() { return $.Options.getOption('keysSend',this.keysSendDefault) == "enter"; } @@ -116,7 +236,7 @@ var TwisterOptions = function() location.reload(); }) } - + this.getTheme = function() { return $.Options.getOption('theme','original'); } @@ -128,11 +248,11 @@ var TwisterOptions = function() location.reload(); }); } - + this.getLineFeedsOpt = function() { return $.Options.getOption('displayLineFeeds',"disable"); } - + this.setLineFeedsOpt = function() { $('#lineFeedsOpt select')[0].value = this.getLineFeedsOpt(); @@ -140,11 +260,11 @@ var TwisterOptions = function() $.Options.setOption(this.id, this.value); }) } - + this.getShowPreviewOpt = function() { return $.Options.getOption('displayPreview',"disable"); } - + this.setShowPreviewOpt = function () { $('#showPreviewOpt select')[0].value = this.getShowPreviewOpt(); @@ -175,7 +295,7 @@ var TwisterOptions = function() this.getConvertPunctuationsOpt = function() { return $.Options.getOption('convertPunctuationsOpt', false); } - + this.setConvertPunctuationsOpt = function () { $('#convertPunctuationsOpt')[0].checked = this.getConvertPunctuationsOpt(); @@ -187,7 +307,7 @@ var TwisterOptions = function() this.getConvertEmotionsOpt = function() { return $.Options.getOption('convertEmotionsOpt', false); } - + this.setConvertEmotionsOpt = function () { $('#convertEmotionsOpt')[0].checked = this.getConvertEmotionsOpt(); @@ -199,7 +319,7 @@ var TwisterOptions = function() this.getConvertSignsOpt = function() { return $.Options.getOption('convertSignsOpt', false); } - + this.setConvertSignsOpt = function () { $('#convertSignsOpt')[0].checked = this.getConvertSignsOpt(); @@ -211,7 +331,7 @@ var TwisterOptions = function() this.getConvertFractionsOpt = function() { return $.Options.getOption('convertFractionsOpt', false); } - + this.setConvertFractionsOpt = function () { $('#convertFractionsOpt')[0].checked = this.getConvertFractionsOpt(); @@ -307,16 +427,7 @@ var TwisterOptions = function() this.setHideCloseRTsHourOpt = function () { $('#hideCloseRtsHour')[0].value = this.getHideCloseRTsHourOpt().toString(); - $('#hideCloseRtsHour').on('keyup', function () { - if (/^\d+$/.test(this.value)) { - this.style.backgroundColor = ''; - $.Options.setOption(this.id, this.value); - $(this).next('span').text(polyglot.t('hour(s)')); - } else { - this.style.backgroundColor = '#f00'; - $(this).next('span').text(polyglot.t('only numbers are allowed!')); - } - }); + $('#hideCloseRtsHour').on('keyup', function () {setElemValNumeric(this, polyglot.t('hour(s)'));}); }; this.getIsFollowingMeOpt = function () { @@ -346,10 +457,18 @@ var TwisterOptions = function() this.InitOptions = function() { this.soundNotifOptions(); this.volumeControl(); - this.notificationDesktopTest(); this.keysSend(); this.setLang(); this.setTheme(); + this.setShowDesktopNotifPostsOpt(); + this.setShowDesktopNotifPostsTimerOpt(); + this.setShowDesktopNotifPostsModalOpt(); + this.setShowDesktopNotifPostsModalTimerOpt(); + this.setShowDesktopNotifMentionsOpt(); + this.setShowDesktopNotifMentionsTimerOpt(); + this.setShowDesktopNotifDMsOpt(); + this.setShowDesktopNotifDMsTimerOpt(); + this.setTestDesktopNotif(); this.setLineFeedsOpt(); this.setShowPreviewOpt(); this.setUnicodeConversionOpt(); @@ -366,6 +485,18 @@ var TwisterOptions = function() this.setIsFollowingMeOpt(); this.setDMCopySelfOpt(); } + + function setElemValNumeric(elem, mes) { + //var elem = $(elem_nm); + if (/^\d+$/.test(elem.value)) { + elem.style.backgroundColor = ''; + $.Options.setOption(elem.id, elem.value); + $(elem).next('span').text(mes); + } else { + elem.style.backgroundColor = '#f00'; + $(elem).next('span').text(polyglot.t('only numbers are allowed!')); + } + }; } jQuery.Options = new TwisterOptions; diff --git a/js/twister_newmsgs.js b/js/twister_newmsgs.js index 4fd1ec7..a078e31 100644 --- a/js/twister_newmsgs.js +++ b/js/twister_newmsgs.js @@ -100,7 +100,9 @@ function requestMentionsCount() { $.MAL.soundNotifyMentions(); - showDesktopNotification(false, polyglot.t('You got')+' '+polyglot.t('new_mentions', _newMentions)+'.', false,'twister_notification_new_mentions', openMentionsModal, false) + if ($.Options.getShowDesktopNotifMentionsOpt() === 'enable') { + $.MAL.showDesktopNotif(false, polyglot.t('You got')+' '+polyglot.t('new_mentions', _newMentions)+'.', false,'twister_notification_new_mentions', $.Options.getShowDesktopNotifMentionsTimerOpt(), openMentionsModal, false) + } } // was moved here from requestDMsCount() because that is not ticking right @@ -112,9 +114,11 @@ function requestMentionsCount() { if ( newDMs ) { $.MAL.soundNotifyDM(); - showDesktopNotification(false, polyglot.t('You got')+' '+polyglot.t('new_direct_messages', newDMs)+'.', false, 'twister_notification_new_DMs', function() { - window.location.hash = '#directmessages'; - }, false) + if ($.Options.getShowDesktopNotifDMsOpt() === 'enable') { + $.MAL.showDesktopNotif(false, polyglot.t('You got')+' '+polyglot.t('new_direct_messages', newDMs)+'.', false, 'twister_notification_new_DMs', $.Options.getShowDesktopNotifDMsTimerOpt(), function() { + window.location.hash = '#directmessages'; + }, false) + } } } } diff --git a/options.html b/options.html index a2775b2..00ade8a 100644 --- a/options.html +++ b/options.html @@ -67,10 +67,9 @@
-
-

Use language

-
+

Use language

+
@@ -112,12 +111,12 @@
-

Sound notifications

-
+

Sound notifications

+

Mentions

- @@ -128,7 +127,7 @@

Direct Messages

- @@ -137,26 +136,77 @@
- 0 +
+

Volume

+ 0 +
-

Desktop notifications

-
- +

Desktop notifications

+
+
+
+

Mentions

+ +
+ second(s) +
+
+
+

Direct Messages

+ +
+ second(s) +
+
+
+

Posts

+
+ in postboard + +
+ second(s) +
+
+
+ in search result + +
+ second(s) +
+
+
+
+
+
+

Test

+
-

Keys

-
+

Keys

+

Send key

- @@ -167,128 +217,126 @@
-

Postboard displays

-
+

Postboard displays

+

Posts that begin with mention

-
-
+

RTs those are close to original twist

- -
- hour(s) -
+

+ hour(s) +

-

Posts display

-
+

Posts display

+

Line feeds

-
-
-
-

Inline image preview

- -
-
-
-
-

Use external links behind a proxy

- - Use proxy for image preview only -
+
+
+

Inline image preview

+ +
+
+
+
+

Use external links behind a proxy

+ + Use proxy for image preview only +
+
-
+
-

Post editor

-
+

Post editor

+

Automatic unicode conversion options

-
Convert punctuations to unicode
-
- +
+ ‥ … ⁇ ⁈ ⁉ ‼ — ⁓
Convert emotions codes to unicode symbols -
- +
+ 😃 😇 🍺 😈 ❤ 😕 😢 😞 😎 😊 😊 😗 😆 😛 😉 😉 😮 😱 😐
Convert common signs to unicode
-
- +
+ ℡ ℻
Convert fractions to unicode
-
- +
+ ½ ⅓ ⅔ ¼ ¾ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅐ ⅛ ⅜ ⅝ ⅞ ⅑ ⅒
-
- -
+
+

Split long posts

- -
-
- -
-
-

Direct Message's copy to self

- -
-
- + +
+
+
+

Direct Message's copy to self

+ +
+
-

Show if a user follows me

- diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css index c68bb90..4546742 100644 --- a/theme_calm/css/style.css +++ b/theme_calm/css/style.css @@ -415,10 +415,6 @@ input.userMenu-search-field:focus::-ms-input-placeholder { .dashboard .module { border-radius: 6px; } -.options .module { - margin: 5px; - padding: 5px; -} .messages-qtd { position: absolute; @@ -2226,24 +2222,35 @@ textarea.splited-post { left: 2px; } } -/* Options */ -#playerVol { - float: right; - margin-right: 30px; + +/************************************* +****************** OPTIONS *********** +**************************************/ + +.options .module +{ + margin: 5px; + padding: 15px; } -.volValue { - float: right; - margin-right: -160px; - font: 12px "Open Sans", sans-serif; + +.options .container +{ + margin: 5px 0px 5px 10px; } -.optionsPage .module h1 { - font-size: 14px; - margin-bottom: 5px; + +.options .label-h { + font-weight: 700; } -.optionsPage .module h2 { - margin-top: 10px; - font-size: 12px; + +.options .module label { + font: 12px "Open Sans", sans-serif; } + +.volValue { + vertical-align: top; + font: 12px "Open Sans", sans-serif; +} + .suboptions { margin: 5px 30px; border: double 2px rgba( 69, 71, 77, .1 ); @@ -2255,6 +2262,7 @@ textarea.splited-post { -o-transition: height 1s linear; -ms-transition: height 1s linear; } + /* Following page */ .following ol.following-list > li{ display: inline-block; @@ -2293,11 +2301,6 @@ textarea.splited-post { float: right; vertical-align: middle; } -.optionsPage .module label { - font: 12px "Open Sans", sans-serif; - display: block; - float: right; -} /* Autocomplite*/ .textcomplete-wrapper textarea { diff --git a/theme_nin/css/style.css b/theme_nin/css/style.css index 35fbe2c..bca39aa 100644 --- a/theme_nin/css/style.css +++ b/theme_nin/css/style.css @@ -1659,40 +1659,45 @@ button.disabled:hover, .mini-profile-actions span.disabled:hover, a.button.disab position: relative; } /* line 4, ../sass/_tabs.sass */ -.options .label { +.options .label-h { font-weight: 700; } /* line 7, ../sass/_tabs.sass */ .options label { cursor: pointer; } +/* line 14, ../sass/_tabs.sass */ +.options .container +{ + margin: 5px 0px 5px 10px; +} /* line 9, ../sass/_tabs.sass */ .options input[type=radio] { display: none !important; visibility: hidden; opacity: 0; } -/* line 14, ../sass/_tabs.sass */ +/* line 17, ../sass/_tabs.sass */ .options .postboard-display div { clear: both; } -/* line 16, ../sass/_tabs.sass */ +/* line 19, ../sass/_tabs.sass */ .options .postboard-display div div { float: left; clear: none; padding: 10px; } -/* line 20, ../sass/_tabs.sass */ +/* line 23, ../sass/_tabs.sass */ .options .postboard-display div div .label { font-weight: 400; } -/* line 24, ../sass/_tabs.sass */ +/* line 27, ../sass/_tabs.sass */ .options .tab-content { background: white; position: relative; padding: 20px; } -/* line 29, ../sass/_tabs.sass */ +/* line 32, ../sass/_tabs.sass */ .options .tab-content > div { position: absolute; top: 0; @@ -1703,14 +1708,14 @@ button.disabled:hover, .mini-profile-actions span.disabled:hover, a.button.disab opacity: 0; visibility: hidden; } -/* line 39, ../sass/_tabs.sass */ +/* line 42, ../sass/_tabs.sass */ .options input#tab_language:checked ~ .tab-content .language, .options input#t-2:checked ~ .tab-content .theme, .options input#t-3:checked ~ .tab-content .notifications, .options input#t-4:checked ~ .tab-content .keys, .options input#t-5:checked ~ .tab-content .postboard-display, .options input#t-6:checked ~ .tab-content .users { position: relative; z-index: 10; opacity: 1; visibility: visible; } -/* line 50, ../sass/_tabs.sass */ +/* line 53, ../sass/_tabs.sass */ .options label.tabs { text-align: center; width: auto; @@ -1720,11 +1725,11 @@ button.disabled:hover, .mini-profile-actions span.disabled:hover, a.button.disab color: #aaa; background: #f3f2f1; } -/* line 51, ../sass/_tabs.sass */ +/* line 54, ../sass/_tabs.sass */ .options label.tabs:hover { color: #66686B; } -/* line 61, ../sass/_tabs.sass */ +/* line 64, ../sass/_tabs.sass */ .options input:checked + label.tabs { background: white; color: #66686B; diff --git a/theme_nin/sass/_tabs.sass b/theme_nin/sass/_tabs.sass index b1cdea9..9c163e3 100644 --- a/theme_nin/sass/_tabs.sass +++ b/theme_nin/sass/_tabs.sass @@ -1,7 +1,7 @@ .options position: relative - .label + .label-h font-weight: 700 label @@ -11,6 +11,9 @@ visibility: hidden opacity: 0 + .container + margin: 5px 0px 5px 10px + .postboard-display div clear: both div