Browse Source

Merge pull request #225 from slr/tasty-notifications-options

added options of desktop notifications, fixed somewhat
master
miguelfreitas 10 years ago
parent
commit
388d6d2804
  1. 39
      css/style.css
  2. 46
      js/interface_common.js
  3. 95
      js/interface_localization.js
  4. 48
      js/mobile_abstract.js
  5. 159
      js/options.js
  6. 12
      js/twister_newmsgs.js
  7. 202
      options.html
  8. 49
      theme_calm/css/style.css
  9. 25
      theme_nin/css/style.css
  10. 5
      theme_nin/sass/_tabs.sass

39
css/style.css

@ -297,11 +297,7 @@ button.disabled:hover
border: solid 1px rgba( 69, 71, 77, .1 ); border: solid 1px rgba( 69, 71, 77, .1 );
background: #fff; background: #fff;
} }
.options .module
{
margin: 5px;
padding: 5px;
}
.messages-qtd .messages-qtd
{ {
position: absolute; position: absolute;
@ -1761,19 +1757,34 @@ ol.toptrends-list {
} }
} }
/* Options */ /*************************************
#playerVol { ****************** OPTIONS ***********
float: right; **************************************/
margin-right: 20px;
.options .module
{
margin: 5px;
padding: 15px;
} }
.volValue {
float: right; .options .container
margin-right: -163px; {
margin: 5px 0px 5px 10px;
}
.options .label-h {
font-weight: 700;
}
.options .module label {
font: 12px "Open Sans", sans-serif; 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 { .suboptions {
margin: 5px 30px; margin: 5px 30px;
border: double 2px rgba( 69, 71, 77, .1 ); border: double 2px rgba( 69, 71, 77, .1 );

46
js/interface_common.js

@ -202,10 +202,12 @@ function updateHashtagModal(postboard,hashtag,timeoutArgs) {
requestHashtag(postboard,hashtag,resource,timeoutArgs); requestHashtag(postboard,hashtag,resource,timeoutArgs);
if( _hashtagPendingPostsUpdated ) { 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() { if (resource != 'mention' && $.Options.getShowDesktopNotifPostsModalOpt() === 'enable') {
$(".postboard-news").hide(); $.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() {
displayHashtagPending($(".hashtag-modal .postboard-posts")); $(".postboard-news").hide();
}, false) displayHashtagPending($(".hashtag-modal .postboard-posts"));
}, false)
}
_hashtagPendingPostsUpdated = 0; _hashtagPendingPostsUpdated = 0;
} }
@ -218,8 +220,10 @@ function updateHashtagModal(postboard,hashtag,timeoutArgs) {
function openMentionsModal(e) function openMentionsModal(e)
{ {
e.stopPropagation(); if (e && e.stopPropagation) {
e.preventDefault(); e.stopPropagation();
e.preventDefault();
}
if(!defaultScreenName) if(!defaultScreenName)
{ {
@ -819,36 +823,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 * unicode convertion list
* k: original string to be replaced * k: original string to be replaced

95
js/interface_localization.js

@ -101,7 +101,7 @@ if(preferredLanguage == "en"){
"Not available": "Not available", // username is not available "Not available": "Not available", // username is not available
"notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "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_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!", "notify_desktop_title": "Watch out, it's twister over here!",
"Number of blocks in block chain:": "Number of blocks in block chain: ", "Number of blocks in block chain:": "Number of blocks in block chain: ",
"Number of CPUs to use": "Number of CPUs to use ", "Number of CPUs to use": "Number of CPUs to use ",
@ -196,6 +196,8 @@ if(preferredLanguage == "en"){
"Notifications": "Notifications", "Notifications": "Notifications",
"Desktop notifications": "Desktop notifications", "Desktop notifications": "Desktop notifications",
"Sound notifications": "Sound notifications", "Sound notifications": "Sound notifications",
"Volume": "Volume",
"Test": "Test",
"Send key": "Send key", "Send key": "Send key",
"Posts display": "Posts display", "Posts display": "Posts display",
"Post editor": "Post editor", "Post editor": "Post editor",
@ -232,6 +234,7 @@ if(preferredLanguage == "en"){
"RTs those are close to original twist": "RTs those are close to original twist", "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", "Show if the original is older than": "Show if the original is older than",
"hour(s)": "hour(s)", "hour(s)": "hour(s)",
"second(s)": "second(s)",
"only numbers are allowed!": "only numbers are allowed!", "only numbers are allowed!": "only numbers are allowed!",
"Show with every user name": "Show with every user name", "Show with every user name": "Show with every user name",
"Show at profile modal only": "Show at profile modal only", "Show at profile modal only": "Show at profile modal only",
@ -342,7 +345,7 @@ if(preferredLanguage == "es"){
"Not available": "No disponible", // username is not available "Not available": "No disponible", // username is not available
"notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "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_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!", "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 blocks in block chain:": "Número de bloques en la cadena de bloques: ",
"Number of CPUs to use": "Número de CPUs para utilizar ", "Number of CPUs to use": "Número de CPUs para utilizar ",
@ -365,7 +368,7 @@ if(preferredLanguage == "es"){
"Retransmits": "Retransmiciones", "Retransmits": "Retransmiciones",
"Retransmitted by": "Retransmitido por", "Retransmitted by": "Retransmitido por",
"search": "search", "search": "search",
"seconds": "%{smart_count} segundos |||| %{smart_count} segundos", "seconds": "%{smart_count} segundo |||| %{smart_count} segundos",
"send": "send", "send": "send",
"Send post with username": "Enviar post con nombre de usuario ", "Send post with username": "Enviar post con nombre de usuario ",
"Sent Direct Message": "Mensaje directo", "Sent Direct Message": "Mensaje directo",
@ -437,6 +440,8 @@ if(preferredLanguage == "es"){
"Notifications": "Notificaciones", "Notifications": "Notificaciones",
"Desktop notifications": "Notificaciones de Escritorio", "Desktop notifications": "Notificaciones de Escritorio",
"Sound notifications": "Notificaciones de Sonido", "Sound notifications": "Notificaciones de Sonido",
"Volume": "Volumen",
"Test": "Prueba",
"Send key": "Send key", "Send key": "Send key",
"Posts display": "Posts display", "Posts display": "Posts display",
"Post editor": "Post editor", "Post editor": "Post editor",
@ -472,7 +477,8 @@ if(preferredLanguage == "es"){
"Postboard displays": "Postboard displays", "Postboard displays": "Postboard displays",
"RTs those are close to original twist": "RTs those are close to original twist", "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", "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!", "only numbers are allowed!": "only numbers are allowed!",
"Show with every user name": "Show with every user name", "Show with every user name": "Show with every user name",
"Show at profile modal only": "Show at profile modal only", "Show at profile modal only": "Show at profile modal only",
@ -581,7 +587,7 @@ if(preferredLanguage == "uk"){
"Not available": "Не доступне", // username is not available "Not available": "Не доступне", // username is not available
"notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "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_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!", "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": "Кількість CPUs до використання ", "Number of CPUs to use": "Кількість CPUs до використання ",
@ -672,9 +678,11 @@ if(preferredLanguage == "uk"){
"Ignore": "Ignore", "Ignore": "Ignore",
"Theme": "Theme", "Theme": "Theme",
"Keys": "Keys", "Keys": "Keys",
"Notifications": "Notifications", "Notifications": "Оповіщення",
"Desktop notifications": "Desktop notifications", "Desktop notifications": "Настільні повідомлення",
"Sound notifications": "Sound notifications", "Sound notifications": "Звукові сповіщення",
"Volume": "Гучність",
"Test": "Випроба",
"Send key": "Send key", "Send key": "Send key",
"Posts display": "Posts display", "Posts display": "Posts display",
"Post editor": "Post editor", "Post editor": "Post editor",
@ -711,6 +719,7 @@ if(preferredLanguage == "uk"){
"RTs those are close to original twist": "RTs those are close to original twist", "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", "Show if the original is older than": "Show if the original is older than",
"hour(s)": "hour(s)", "hour(s)": "hour(s)",
"second(s)": "second(s)",
"only numbers are allowed!": "only numbers are allowed!", "only numbers are allowed!": "only numbers are allowed!",
"Show with every user name": "Show with every user name", "Show with every user name": "Show with every user name",
"Show at profile modal only": "Show at profile modal only", "Show at profile modal only": "Show at profile modal only",
@ -818,7 +827,7 @@ if(preferredLanguage == "zh"){
"Not available": "用户名不可用", // username is not available "Not available": "用户名不可用", // username is not available
"notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "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_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!", "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": "使用CPU数目 ", "Number of CPUs to use": "使用CPU数目 ",
@ -912,6 +921,8 @@ if(preferredLanguage == "zh"){
"Notifications": "Notifications", "Notifications": "Notifications",
"Desktop notifications": "Desktop notifications", "Desktop notifications": "Desktop notifications",
"Sound notifications": "Sound notifications", "Sound notifications": "Sound notifications",
"Volume": "Volume",
"Test": "Test",
"Send key": "Send key", "Send key": "Send key",
"Posts display": "Posts display", "Posts display": "Posts display",
"Post editor": "Post editor", "Post editor": "Post editor",
@ -948,6 +959,7 @@ if(preferredLanguage == "zh"){
"RTs those are close to original twist": "RTs those are close to original twist", "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", "Show if the original is older than": "Show if the original is older than",
"hour(s)": "hour(s)", "hour(s)": "hour(s)",
"second(s)": "second(s)",
"only numbers are allowed!": "only numbers are allowed!", "only numbers are allowed!": "only numbers are allowed!",
"Show with every user name": "Show with every user name", "Show with every user name": "Show with every user name",
"Show at profile modal only": "Show at profile modal only", "Show at profile modal only": "Show at profile modal only",
@ -1055,7 +1067,7 @@ if(preferredLanguage == "nl"){
"Not available": "Niet beschikbaar", // username is not available "Not available": "Niet beschikbaar", // username is not available
"notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "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_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!", "notify_desktop_title": "Watch out, it's twister over here!",
"Number of blocks in block chain:": "Aantal blocks in block chain: ", "Number of blocks in block chain:": "Aantal blocks in block chain: ",
"Number of CPUs to use": "Aantal CPUs om te gebruiken ", "Number of CPUs to use": "Aantal CPUs om te gebruiken ",
@ -1150,6 +1162,8 @@ if(preferredLanguage == "nl"){
"Notifications": "Notifications", "Notifications": "Notifications",
"Desktop notifications": "Desktop notifications", "Desktop notifications": "Desktop notifications",
"Sound notifications": "Sound notifications", "Sound notifications": "Sound notifications",
"Volume": "Volume",
"Test": "Test",
"Send key": "Send key", "Send key": "Send key",
"Posts display": "Posts display", "Posts display": "Posts display",
"Post editor": "Post editor", "Post editor": "Post editor",
@ -1186,6 +1200,7 @@ if(preferredLanguage == "nl"){
"RTs those are close to original twist": "RTs those are close to original twist", "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", "Show if the original is older than": "Show if the original is older than",
"hour(s)": "hour(s)", "hour(s)": "hour(s)",
"second(s)": "seconde(n)",
"only numbers are allowed!": "only numbers are allowed!", "only numbers are allowed!": "only numbers are allowed!",
"Show with every user name": "Show with every user name", "Show with every user name": "Show with every user name",
"Show at profile modal only": "Show at profile modal only", "Show at profile modal only": "Show at profile modal only",
@ -1293,7 +1308,7 @@ if(preferredLanguage == "it"){
"Not available": "Non disponibile", // username is not available "Not available": "Non disponibile", // username is not available
"notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "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_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!", "notify_desktop_title": "Watch out, it's twister over here!",
"Number of blocks in block chain:": "Numero di blocchi nella catena: ", "Number of blocks in block chain:": "Numero di blocchi nella catena: ",
"Number of CPUs to use": "Numero di processori da usare:", "Number of CPUs to use": "Numero di processori da usare:",
@ -1382,9 +1397,11 @@ if(preferredLanguage == "it"){
"Ignore": "Ignore", "Ignore": "Ignore",
"Theme": "Theme", "Theme": "Theme",
"Keys": "Keys", "Keys": "Keys",
"Notifications": "Notifications", "Notifications": "Notifiche",
"Desktop notifications": "Desktop notifications", "Desktop notifications": "Notifiche desktop",
"Sound notifications": "Sound notifications", "Sound notifications": "Notifiche sonore",
"Volume": "Volume",
"Test": "Prova",
"Send key": "Send key", "Send key": "Send key",
"Posts display": "Posts display", "Posts display": "Posts display",
"Post editor": "Post editor", "Post editor": "Post editor",
@ -1421,6 +1438,7 @@ if(preferredLanguage == "it"){
"RTs those are close to original twist": "RTs those are close to original twist", "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", "Show if the original is older than": "Show if the original is older than",
"hour(s)": "hour(s)", "hour(s)": "hour(s)",
"second(s)": "secondo(i)",
"only numbers are allowed!": "only numbers are allowed!", "only numbers are allowed!": "only numbers are allowed!",
"Show with every user name": "Show with every user name", "Show with every user name": "Show with every user name",
"Show at profile modal only": "Show at profile modal only", "Show at profile modal only": "Show at profile modal only",
@ -1529,7 +1547,7 @@ if(preferredLanguage == "fr"){
"Not available": "Non disponible", // username is not available "Not available": "Non disponible", // username is not available
"notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "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_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!", "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 blocks in block chain:": "Nombre de blocs dans la chaîne de blocs: ",
"Number of CPUs to use": "Nombre de processeurs à utiliser", "Number of CPUs to use": "Nombre de processeurs à utiliser",
@ -1622,8 +1640,10 @@ if(preferredLanguage == "fr"){
"Theme": "Theme", "Theme": "Theme",
"Keys": "Keys", "Keys": "Keys",
"Notifications": "Notifications", "Notifications": "Notifications",
"Desktop notifications": "Desktop notifications", "Desktop notifications": "Notifications de bureau",
"Sound notifications": "Sound notifications", "Sound notifications": "Notifications sonores",
"Volume": "Volume",
"Test": "Test",
"Send key": "Send key", "Send key": "Send key",
"Posts display": "Posts display", "Posts display": "Posts display",
"Post editor": "Post editor", "Post editor": "Post editor",
@ -1660,6 +1680,7 @@ if(preferredLanguage == "fr"){
"RTs those are close to original twist": "RTs those are close to original twist", "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", "Show if the original is older than": "Show if the original is older than",
"hour(s)": "hour(s)", "hour(s)": "hour(s)",
"second(s)": "seconde(s)",
"only numbers are allowed!": "only numbers are allowed!", "only numbers are allowed!": "only numbers are allowed!",
"Show with every user name": "Show with every user name", "Show with every user name": "Show with every user name",
"Show at profile modal only": "Show at profile modal only", "Show at profile modal only": "Show at profile modal only",
@ -1761,7 +1782,7 @@ if(preferredLanguage == "ru"){
"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} новых постов",
@ -1770,8 +1791,8 @@ if(preferredLanguage == "ru"){
"nobody": "Анонимно", // used to promote a post without attaching the user "nobody": "Анонимно", // used to promote a post without attaching the user
"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": "Лягушка сказала: 'если не буду квакать — лопну'. Вы нужны нам, берегите себя.", "notify_desktop_test": "Одна лягушка сказала:\n'если не буду квакать — лопну'.\nВы нужны нам, берегите себя.",
"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": "Сколько использовать ядер процессора",
@ -1866,6 +1887,8 @@ if(preferredLanguage == "ru"){
"Notifications": "Уведомления", "Notifications": "Уведомления",
"Desktop notifications": "Уведомления рабочего стола", "Desktop notifications": "Уведомления рабочего стола",
"Sound notifications": "Звуковые уведомления", "Sound notifications": "Звуковые уведомления",
"Volume": "Громкость",
"Test": "Проверка",
"Send key": "Отправка сообщения", "Send key": "Отправка сообщения",
"Posts display": "Отображение сообщений", "Posts display": "Отображение сообщений",
"Post editor": "Редактор сообщения", "Post editor": "Редактор сообщения",
@ -1902,6 +1925,7 @@ if(preferredLanguage == "ru"){
"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)": "секунд(а,ы)",
"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": "Показывать только в окне профиля",
@ -2014,7 +2038,7 @@ if(preferredLanguage == "de"){
"Not available": "Nicht verfügbar", // username is not available "Not available": "Nicht verfügbar", // username is not available
"notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "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_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!", "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 blocks in block chain:": "Anzahl der Blöcke in der Block-Chain: ",
"Number of CPUs to use": "Anzahl der zu benutzenden CPU's ", "Number of CPUs to use": "Anzahl der zu benutzenden CPU's ",
@ -2110,6 +2134,8 @@ if(preferredLanguage == "de"){
"Notifications": "Benachrichtigungen", "Notifications": "Benachrichtigungen",
"Desktop notifications": "Desktophinweisen", "Desktop notifications": "Desktophinweisen",
"Sound notifications": "Audioeinstellungen", "Sound notifications": "Audioeinstellungen",
"Volume": "Lautstärke",
"Test": "Probe",
"Send key": "Send key", "Send key": "Send key",
"Posts display": "Posts display", "Posts display": "Posts display",
"Post editor": "Nachrichten-Editor", "Post editor": "Nachrichten-Editor",
@ -2146,6 +2172,7 @@ if(preferredLanguage == "de"){
"RTs those are close to original twist": "RTs those are close to original twist", "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", "Show if the original is older than": "Show if the original is older than",
"hour(s)": "hour(s)", "hour(s)": "hour(s)",
"second(s)": "Sekunde(n)",
"only numbers are allowed!": "only numbers are allowed!", "only numbers are allowed!": "only numbers are allowed!",
"Show with every user name": "Zeige mit jedem Benutzernamen", "Show with every user name": "Zeige mit jedem Benutzernamen",
"Show at profile modal only": "Show at profile modal only", "Show at profile modal only": "Show at profile modal only",
@ -2253,7 +2280,7 @@ if(preferredLanguage == "ja"){
"Not available": "使用中", // username is not available "Not available": "使用中", // username is not available
"notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "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_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!", "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": "利用するCPUの数", "Number of CPUs to use": "利用するCPUの数",
@ -2345,6 +2372,8 @@ if(preferredLanguage == "ja"){
"Notifications": "Notifications", "Notifications": "Notifications",
"Desktop notifications": "Desktop notifications", "Desktop notifications": "Desktop notifications",
"Sound notifications": "Sound notifications", "Sound notifications": "Sound notifications",
"Volume": "Volume",
"Test": "Test",
"Send key": "Send key", "Send key": "Send key",
"Posts display": "Posts display", "Posts display": "Posts display",
"Post editor": "Post editor", "Post editor": "Post editor",
@ -2381,6 +2410,7 @@ if(preferredLanguage == "ja"){
"RTs those are close to original twist": "RTs those are close to original twist", "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", "Show if the original is older than": "Show if the original is older than",
"hour(s)": "hour(s)", "hour(s)": "hour(s)",
"second(s)": "second(s)",
"only numbers are allowed!": "only numbers are allowed!", "only numbers are allowed!": "only numbers are allowed!",
"Show with every user name": "Show with every user name", "Show with every user name": "Show with every user name",
"Show at profile modal only": "Show at profile modal only", "Show at profile modal only": "Show at profile modal only",
@ -2489,7 +2519,7 @@ if(preferredLanguage == "pt-BR"){
"Not available": "Indisponível", // username is not available "Not available": "Indisponível", // username is not available
"notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "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_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!", "notify_desktop_title": "Watch out, it's twister over here!",
"Number of blocks in block chain:": "Número de blocos: ", "Number of blocks in block chain:": "Número de blocos: ",
"Number of CPUs to use": "Número de CPUs a serem utilizados ", "Number of CPUs to use": "Número de CPUs a serem utilizados ",
@ -2583,9 +2613,11 @@ if(preferredLanguage == "pt-BR"){
"Ignore": "Ignore", "Ignore": "Ignore",
"Theme": "Theme", "Theme": "Theme",
"Keys": "Keys", "Keys": "Keys",
"Notifications": "Notifications", "Notifications": "Notificações",
"Desktop notifications": "Desktop notifications", "Desktop notifications": "Notificações no desktop",
"Sound notifications": "Sound notifications", "Sound notifications": "Notificações sonoras",
"Volume": "Volume",
"Test": "Teste",
"Send key": "Send key", "Send key": "Send key",
"Posts display": "Posts display", "Posts display": "Posts display",
"Post editor": "Post editor", "Post editor": "Post editor",
@ -2622,6 +2654,7 @@ if(preferredLanguage == "pt-BR"){
"RTs those are close to original twist": "RTs those are close to original twist", "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", "Show if the original is older than": "Show if the original is older than",
"hour(s)": "hour(s)", "hour(s)": "hour(s)",
"second(s)": "segundo(s)",
"only numbers are allowed!": "only numbers are allowed!", "only numbers are allowed!": "only numbers are allowed!",
"Show with every user name": "Show with every user name", "Show with every user name": "Show with every user name",
"Show at profile modal only": "Show at profile modal only", "Show at profile modal only": "Show at profile modal only",
@ -2729,7 +2762,7 @@ if(preferredLanguage == "tr"){
"Not available": "Kullanılamaz", // username is not available "Not available": "Kullanılamaz", // username is not available
"notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", "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_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!", "notify_desktop_title": "Watch out, it's twister over here!",
"Number of blocks in block chain:": "Blok zincirindeki blok sayısı: ", "Number of blocks in block chain:": "Blok zincirindeki blok sayısı: ",
"Number of CPUs to use": "Kullanılacak CPU sayısı ", "Number of CPUs to use": "Kullanılacak CPU sayısı ",
@ -2814,6 +2847,8 @@ if(preferredLanguage == "tr"){
"Notifications": "Uyarılar", "Notifications": "Uyarılar",
"Desktop notifications": "Masaüstü uyarılar", "Desktop notifications": "Masaüstü uyarılar",
"Sound notifications": "Sesli uyarılar", "Sound notifications": "Sesli uyarılar",
"Volume": "Hacmi",
"Test": "Deneme",
"Send key": "Gönderme tuşu", "Send key": "Gönderme tuşu",
"Posts display": "Gönderiler", "Posts display": "Gönderiler",
"Post editor": "Gönderi düzenleyici", "Post editor": "Gönderi düzenleyici",
@ -2859,6 +2894,7 @@ if(preferredLanguage == "tr"){
"RTs those are close to original twist": "Orjinal twist'e yakın olan RTler", "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", "Show if the original is older than": "Orjinali yandaki süreden daha eskiyse göster",
"hour(s)": "saat", "hour(s)": "saat",
"second(s)": "saniye",
"only numbers are allowed!": "sadece rakam girilebilir!", "only numbers are allowed!": "sadece rakam girilebilir!",
"Show with every user name": "Tüm kullanıcı adlarının yanında göster", "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", "Show at profile modal only": "Sadece profilinde göster",
@ -2966,7 +3002,7 @@ if(preferredLanguage == "cs"){
"Not available": "Tuto přezdívku již někdo používá", // username is not available "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_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_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!", "notify_desktop_title": "Watch out, it's twister over here!",
"Number of blocks in block chain:": "Počet bloků v blockchainu: ", "Number of blocks in block chain:": "Počet bloků v blockchainu: ",
"Number of CPUs to use": "Kolik jader procesoru použít? ", "Number of CPUs to use": "Kolik jader procesoru použít? ",
@ -3059,6 +3095,8 @@ if(preferredLanguage == "cs"){
"Notifications": "Upozornění", "Notifications": "Upozornění",
"Desktop notifications": "Upozornění na ploše", "Desktop notifications": "Upozornění na ploše",
"Sound notifications": "Zvuková upozornění", "Sound notifications": "Zvuková upozornění",
"Volume": "Hlasitost",
"Test": "Pokus",
"Send key": "Klávesa pro odeslání", "Send key": "Klávesa pro odeslání",
"Posts display": "Zobrazení příspěvků", "Posts display": "Zobrazení příspěvků",
"Post editor": "Editor příspěvků", "Post editor": "Editor příspěvků",
@ -3095,6 +3133,7 @@ if(preferredLanguage == "cs"){
"RTs those are close to original twist": "Přeposlání blízká původnímu příspěvku", "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ž", "Show if the original is older than": "Ukázat pokud je už originál starší než",
"hour(s)": "hodin", "hour(s)": "hodin",
"second(s)": "vteřinou(ami)",
"only numbers are allowed!": "povolena jsou jen čísla!", "only numbers are allowed!": "povolena jsou jen čísla!",
"Show with every user name": "Ukázat u každé přezdívky", "Show with every user name": "Ukázat u každé přezdívky",
"Show at profile modal only": "Ukázat jen v okně profilu", "Show at profile modal only": "Ukázat jen v okně profilu",

48
js/mobile_abstract.js

@ -103,9 +103,11 @@ var MAL = function()
newTweetsBarMenu.text(String(newPosts)); newTweetsBarMenu.text(String(newPosts));
newTweetsBarMenu.addClass("show"); newTweetsBarMenu.addClass("show");
showDesktopNotification(false, polyglot.t('You got')+' '+polyglot.t("new_posts", newPosts)+' '+polyglot.t('in postboard')+'.', false,'twister_notification_new_posts', function() { if ($.Options.getShowDesktopNotifPostsOpt() === 'enable') {
requestTimelineUpdate("latest",postsPerRefresh,followingUsers,promotedPostsOnly); this.showDesktopNotif(false, polyglot.t('You got')+' '+polyglot.t("new_posts", newPosts)+' '+polyglot.t('in postboard')+'.', false,'twister_notification_new_posts', $.Options.getShowDesktopNotifPostsTimerOpt(), function() {
}, false) requestTimelineUpdate("latest",postsPerRefresh,followingUsers,promotedPostsOnly);
}, false)
}
} else { } else {
newTweetsBar.hide(); newTweetsBar.hide();
newTweetsBar.text(""); newTweetsBar.text("");
@ -375,6 +377,46 @@ var MAL = function()
} }
} }
this.showDesktopNotif = function(notifyTitle, notifyBody, notifyIcon, notifyTag, notifyTimer, actionOnClick, actionOnPermDenied) {
function doNotification() {
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 doActionOnClick = false;
if (typeof actionOnClick === 'function') {
doActionOnClick = function() {
actionOnClick();
window.focus();
}
}
var desktopNotification = new Notify(notifyTitle, {
body: notifyBody,
icon: notifyIcon,
tag: notifyTag,
timeout: notifyTimer,
notifyClick: doActionOnClick,
notifyError: function() { alert(polyglot.t('notify_desktop_error')) }
});
desktopNotification.show();
}
if (Notify.needsPermission) {
Notify.requestPermission(false, actionOnPermDenied);
} else {
doNotification();
}
}
this.reqRepAfterCB = function(postLi, postsFromJson) { this.reqRepAfterCB = function(postLi, postsFromJson) {
if ($.hasOwnProperty("mobile")) { if ($.hasOwnProperty("mobile")) {
for( var i = 0; i < postsFromJson.length; i++) { for( var i = 0; i < postsFromJson.length; i++) {

159
js/options.js

@ -90,9 +90,129 @@ var TwisterOptions = function()
player[0].play(); player[0].play();
} }
this.notificationDesktopTest = function() { this.getShowDesktopNotifPostsOpt = function() {
$('#notifications-desktop-test').on('click', function() { return $.Options.getOption('showDesktopNotifPosts','enable');
showDesktopNotification(false, polyglot.t('notify_desktop_test'), false,'twister_notification_test', false, function() { alert(polyglot.t('notify_desktop_perm_denied')) }) }
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, false, function() { alert(polyglot.t('notify_desktop_perm_denied')) })
}) })
} }
@ -307,16 +427,7 @@ var TwisterOptions = function()
this.setHideCloseRTsHourOpt = function () { this.setHideCloseRTsHourOpt = function () {
$('#hideCloseRtsHour')[0].value = this.getHideCloseRTsHourOpt().toString(); $('#hideCloseRtsHour')[0].value = this.getHideCloseRTsHourOpt().toString();
$('#hideCloseRtsHour').on('keyup', function () { $('#hideCloseRtsHour').on('keyup', function () {setElemValNumeric(this, polyglot.t('hour(s)'));});
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!'));
}
});
}; };
this.getIsFollowingMeOpt = function () { this.getIsFollowingMeOpt = function () {
@ -346,10 +457,18 @@ var TwisterOptions = function()
this.InitOptions = function() { this.InitOptions = function() {
this.soundNotifOptions(); this.soundNotifOptions();
this.volumeControl(); this.volumeControl();
this.notificationDesktopTest();
this.keysSend(); this.keysSend();
this.setLang(); this.setLang();
this.setTheme(); this.setTheme();
this.setShowDesktopNotifPostsOpt();
this.setShowDesktopNotifPostsTimerOpt();
this.setShowDesktopNotifPostsModalOpt();
this.setShowDesktopNotifPostsModalTimerOpt();
this.setShowDesktopNotifMentionsOpt();
this.setShowDesktopNotifMentionsTimerOpt();
this.setShowDesktopNotifDMsOpt();
this.setShowDesktopNotifDMsTimerOpt();
this.setTestDesktopNotif();
this.setLineFeedsOpt(); this.setLineFeedsOpt();
this.setShowPreviewOpt(); this.setShowPreviewOpt();
this.setUnicodeConversionOpt(); this.setUnicodeConversionOpt();
@ -366,6 +485,18 @@ var TwisterOptions = function()
this.setIsFollowingMeOpt(); this.setIsFollowingMeOpt();
this.setDMCopySelfOpt(); 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; jQuery.Options = new TwisterOptions;

12
js/twister_newmsgs.js

@ -100,7 +100,9 @@ function requestMentionsCount() {
$.MAL.soundNotifyMentions(); $.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 // was moved here from requestDMsCount() because that is not ticking right
@ -112,9 +114,11 @@ function requestMentionsCount() {
if ( newDMs ) { if ( newDMs ) {
$.MAL.soundNotifyDM(); $.MAL.soundNotifyDM();
showDesktopNotification(false, polyglot.t('You got')+' '+polyglot.t('new_direct_messages', newDMs)+'.', false, 'twister_notification_new_DMs', function() { if ($.Options.getShowDesktopNotifDMsOpt() === 'enable') {
window.location.hash = '#directmessages'; $.MAL.showDesktopNotif(false, polyglot.t('You got')+' '+polyglot.t('new_direct_messages', newDMs)+'.', false, 'twister_notification_new_DMs', $.Options.getShowDesktopNotifDMsTimerOpt(), function() {
}, false) window.location.hash = '#directmessages';
}, false)
}
} }
} }
} }

202
options.html

@ -67,10 +67,9 @@
<div class="tab-content"> <div class="tab-content">
<div class="language"> <div class="language">
<div class="module"> <div class="module">
<p class="label"> Use language </p> <p class="label label-h"> Use language </p>
<div> <div class="container">
<form action="" id="selectLanguage"> <form action="" id="selectLanguage">
<select name="" id="language"> <select name="" id="language">
<option value="auto">Auto</option> <option value="auto">Auto</option>
@ -94,8 +93,8 @@
<div class="theme"> <div class="theme">
<div class="module"> <div class="module">
<p class="label"> Theme </p> <p class="label label-h"> Theme </p>
<div> <div class="container">
<form action="" id="selectTheme"> <form action="" id="selectTheme">
<select name="" id="theme"> <select name="" id="theme">
<option value="original">Original</option> <option value="original">Original</option>
@ -112,12 +111,12 @@
<div class="notifications"> <div class="notifications">
<div class="module"> <div class="module">
<p class="label"> Sound notifications </p> <p class="label label-h"> Sound notifications </p>
<div> <div class="container">
<form action="" id="notifyForm"> <form action="" id="notifyForm">
<div> <div>
<p class="label">Mentions</p> <p class="label">Mentions</p>
<select name="" id="sndMention" class="sndOpt"> <select name="" id="sndMention" class="sndOpt container">
<option value="false">none</option> <option value="false">none</option>
<option value="1">beat</option> <option value="1">beat</option>
<option value="2">pip</option> <option value="2">pip</option>
@ -128,7 +127,7 @@
</div> </div>
<div> <div>
<p class="label">Direct Messages</p> <p class="label">Direct Messages</p>
<select name="" id="sndDM" class="sndOpt"> <select name="" id="sndDM" class="sndOpt container">
<option value="false">none</option> <option value="false">none</option>
<option value="1">beat</option> <option value="1">beat</option>
<option value="2">pip</option> <option value="2">pip</option>
@ -137,26 +136,77 @@
<option value="5">click</option> <option value="5">click</option>
</select> </select>
</div> </div>
<input type="range" name="playerVol" id="playerVol" min="0" max="1" step="0.01"><span class="volValue">0</span> <div>
<p class="label">Volume</p>
<input type="range" name="playerVol" id="playerVol" class="container" min="0" max="1" step="0.01"><span class="volValue container">0</span>
</div>
</form> </form>
<audio id="player"></audio> <audio id="player"></audio>
</div> </div>
</div> </div>
<div class="module"> <div class="module">
<p class="label"> Desktop notifications </p> <p class="label label-h"> Desktop notifications </p>
<div> <div class="container">
<button id="notifications-desktop-test">Test</button> <form action="" id="optionsShowDesktopNotif">
<div>
<p class="label">Mentions</p>
<select id="showDesktopNotifMentions" class="container">
<option value="enable">Enable</option>
<option value="disable">Disable</option>
</select>
<div id="showDesktopNotifMentionsDesc" class="container">
<input name="" id="showDesktopNotifMentionsTimer" maxlength="3" size="1"/> <span class="label">second(s)</span>
</div>
</div>
<div>
<p class="label">Direct Messages</p>
<select id="showDesktopNotifDMs" class="container">
<option value="enable">Enable</option>
<option value="disable">Disable</option>
</select>
<div id="showDesktopNotifDMsDesc" class="container">
<input name="" id="showDesktopNotifDMsTimer" maxlength="3" size="1"/> <span class="label">second(s)</span>
</div>
</div>
<div>
<p class="label">Posts</p>
<div class="container">
<span class="label">in postboard</span>
<select id="showDesktopNotifPosts">
<option value="enable">Enable</option>
<option value="disable">Disable</option>
</select>
<div id="showDesktopNotifPostsDesc" class="container">
<input name="" id="showDesktopNotifPostsTimer" maxlength="3" size="1"/> <span class="label">second(s)</span>
</div>
</div>
<div class="container">
<span class="label">in search result</span>
<select id="showDesktopNotifPostsModal">
<option value="enable">Enable</option>
<option value="disable">Disable</option>
</select>
<div id="showDesktopNotifPostsModalDesc" class="container">
<input name="" id="showDesktopNotifPostsModalTimer" maxlength="3" size="1"/> <span class="label">second(s)</span>
</div>
</div>
</div>
</form>
</div>
<div class="container">
<p class="label">Test</p>
<button id="testDesktopNotif" class="container">notify_desktop_title</button>
</div> </div>
</div> </div>
</div> </div>
<div class="keys"> <div class="keys">
<div class="module"> <div class="module">
<p class="label"> Keys </p> <p class="label label-h"> Keys </p>
<div> <div class="container">
<form action="" id="keysOpt"> <form action="" id="keysOpt">
<p class="label">Send key</p> <p class="label">Send key</p>
<select name="" id="keysSend"> <select name="" id="keysSend" class="container">
<option value="enter">Enter</option> <option value="enter">Enter</option>
<option value="ctrlenter">Ctrl/Cmd+Enter</option> <option value="ctrlenter">Ctrl/Cmd+Enter</option>
</select> </select>
@ -167,128 +217,126 @@
<div class="postboard-display"> <div class="postboard-display">
<div class="module"> <div class="module">
<p class="label"> Postboard displays </p> <p class="label label-h"> Postboard displays </p>
<div> <div class="container">
<form action="" id="hideRepliesOpt"> <form action="" id="hideRepliesOpt">
<p class="label">Posts that begin with mention</p> <p class="label">Posts that begin with mention</p>
<select name="" id="hideReplies"> <select name="" id="hideReplies" class="container">
<option value="disable">Show all</option> <option value="disable">Show all</option>
<option value="only-me">Show only if I am in</option> <option value="only-me">Show only if I am in</option>
<option value="following">Show if it's between users I follow</option> <option value="following">Show if it's between users I follow</option>
</select> </select>
</form> </form>
</div> </div>
<div> <div class="container">
<form action="" id="hideCloseRTsOpt"> <form action="" id="hideCloseRTsOpt">
<p class="label">RTs those are close to original twist</p> <p class="label">RTs those are close to original twist</p>
<select name="" id="hideCloseRTs"> <select name="" id="hideCloseRTs" class="container">
<option value="disable">Show all</option> <option value="disable">Show all</option>
<option value="show-if">Show if the original is older than</option> <option value="show-if">Show if the original is older than</option>
</select> </select>
<div id="hideCloseRTsDesc"> <p id="hideCloseRTsDesc">
<input name="" id="hideCloseRtsHour" maxlength="2" size="3"/> <span class="label">hour(s)</span> <input name="" id="hideCloseRtsHour" class="container" maxlength="2" size="1"/> <span class="label">hour(s)</span>
</div> </p>
</form> </form>
</div> </div>
</div> </div>
<div class="module"> <div class="module">
<p class="label"> Posts display </p> <p class="label label-h"> Posts display </p>
<div> <div class="container">
<form action="" id="lineFeedsOpt"> <form action="" id="lineFeedsOpt">
<p class="label">Line feeds</p> <p class="label">Line feeds</p>
<select name="" id="displayLineFeeds"> <select name="" id="displayLineFeeds" class="container">
<option value="disable">Ignore</option> <option value="disable">Ignore</option>
<option value="enable">Display</option> <option value="enable">Display</option>
</select> </select>
</form> </form>
</div> </div>
<div> <div class="container">
<form action="" id="showPreviewOpt"> <form action="" id="showPreviewOpt">
<p class="label">Inline image preview</p> <p class="label">Inline image preview</p>
<select name="" id="displayPreview"> <select name="" id="displayPreview" class="container">
<option value="disable">Ignore</option> <option value="disable">Ignore</option>
<option value="enable">Display</option> <option value="enable">Display</option>
</select> </select>
</form> </form>
</div> </div>
<div> <div class="container">
<form action="" id="useProxyOpt"> <form action="" id="useProxyOpt">
<p class="label">Use external links behind a proxy</p> <p class="label">Use external links behind a proxy</p>
<select name="" id="useProxy"> <select name="" id="useProxy" class="container">
<option value="disable">none</option> <option value="disable">none</option>
<option value="ssl-proxy-my-addr">ssl-proxy.my-addr.org</option> <option value="ssl-proxy-my-addr">ssl-proxy.my-addr.org</option>
<option value="anonymouse">anonymouse.org</option> <option value="anonymouse">anonymouse.org</option>
</select> </select>
<input name="" id="useProxyForImgOnly" type="checkbox" /> <span class="label">Use proxy for image preview only</span> <input name="" id="useProxyForImgOnly" class="container" type="checkbox" /> <span class="label">Use proxy for image preview only</span>
</form> </form>
</div>
</div> </div>
</div>
<div class="post-editor"> <div class="post-editor">
<div class="module"> <div class="module">
<p class="label"> Post editor</p> <p class="label label-h"> Post editor </p>
<div> <div class="container">
<form action="" id="unicodeConversionOpt"> <form action="" id="unicodeConversionOpt">
<p class="label">Automatic unicode conversion options</p> <p class="label">Automatic unicode conversion options</p>
<select name="" id="unicodeConversion"> <select name="" id="unicodeConversion" class="container">
<option value="disable">Ignore</option> <option value="disable">Ignore</option>
<option value="enable">Convert all</option> <option value="enable">Convert all</option>
<option value="custom">Custom</option> <option value="custom">Custom</option>
</select> </select>
<div class="suboptions unicode-suboptions"> <div class="suboptions unicode-suboptions">
<input name="" id="convertPunctuationsOpt" type="checkbox" /> <span class="label">Convert punctuations to unicode</span><br/> <input name="" id="convertPunctuationsOpt" type="checkbox" /> <span class="label">Convert punctuations to unicode</span><br/>
<div> <div class="container">
<label class="label">Supported punctuations: </label> <label>Supported punctuations: </label>
<span>‥ … ⁇ ⁈ ⁉ ‼ — ⁓</span> <span>‥ … ⁇ ⁈ ⁉ ‼ — ⁓</span>
</div> </div>
<input name="" id="convertEmotionsOpt" type="checkbox" /> <span class="label">Convert emotions codes to unicode symbols</span> <input name="" id="convertEmotionsOpt" type="checkbox" /> <span class="label">Convert emotions codes to unicode symbols</span>
<div> <div class="container">
<label class="label">Supported emotions: </label> <label>Supported emotions: </label>
<span>😃 😇 🍺 😈 ❤ 😕 😢 😞 😎 😊 😊 😗 😆 😛 😉 😉 😮 😱 😐</span> <span>😃 😇 🍺 😈 ❤ 😕 😢 😞 😎 😊 😊 😗 😆 😛 😉 😉 😮 😱 😐</span>
</div> </div>
<input name="" id="convertSignsOpt" type="checkbox" /> <span class="label">Convert common signs to unicode</span><br/> <input name="" id="convertSignsOpt" type="checkbox" /> <span class="label">Convert common signs to unicode</span><br/>
<div> <div class="container">
<label class="label">Supported signs:</label> <label>Supported signs:</label>
<span>℡ ℻</span> <span>℡ ℻</span>
</div> </div>
<input name="" id="convertFractionsOpt" type="checkbox" /> <span class="label">Convert fractions to unicode</span><br/> <input name="" id="convertFractionsOpt" type="checkbox" /> <span class="label">Convert fractions to unicode</span><br/>
<div> <div class="container">
<label class="label">Supported fractions:</label> <label>Supported fractions:</label>
<span>½ ⅓ ⅔ ¼ ¾ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅐ ⅛ ⅜ ⅝ ⅞ ⅑ ⅒</span> <span>½ ⅓ ⅔ ¼ ¾ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅐ ⅛ ⅜ ⅝ ⅞ ⅑ ⅒</span>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<div class="container">
<div>
<form action="" id="splitPostsOpt"> <form action="" id="splitPostsOpt">
<p class="label">Split long posts</p> <p class="label">Split long posts</p>
<select name="" id="splitPosts"> <select name="" id="splitPosts" class="container">
<option value="disable">Don't split</option> <option value="disable">Don't split</option>
<option value="enable">Split all</option> <option value="enable">Split all</option>
<option value="only-new">Split only new post</option> <option value="only-new">Split only new post</option>
</select> </select>
</form> </form>
</div> </div>
<div class="container">
<div> <form action="" id="dmCopySelfOpt">
<form action="" id="dmCopySelfOpt"> <p class="label">Direct Message's copy to self</p>
<p class="label">Direct Message's copy to self</p> <select name="" id="dmCopySelf" class="container">
<select name="" id="dmCopySelf"> <option value="disable">Disable</option>
<option value="disable">Disable</option> <option value="enable">Enable</option>
<option value="enable">Enable</option> </select>
</select> </form>
</form>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="users"> <div class="users">
<div class="module"> <div class="module">
<form action="" id="isFollowingMeOpt"> <form action="" id="isFollowingMeOpt">
<p class="label">Show if a user follows me</p> <p class="label label-h">Show if a user follows me</p>
<select name="" id="isFollowingMe"> <select name="" id="isFollowingMe" class="container">
<option value="in-profile">Show at profile modal only</option> <option value="in-profile">Show at profile modal only</option>
<option value="everywhere">Show with every user name</option> <option value="everywhere">Show with every user name</option>
</select> </select>

49
theme_calm/css/style.css

@ -415,10 +415,6 @@ input.userMenu-search-field:focus::-ms-input-placeholder {
.dashboard .module { .dashboard .module {
border-radius: 6px; border-radius: 6px;
} }
.options .module {
margin: 5px;
padding: 5px;
}
.messages-qtd .messages-qtd
{ {
position: absolute; position: absolute;
@ -2226,24 +2222,35 @@ textarea.splited-post {
left: 2px; left: 2px;
} }
} }
/* Options */
#playerVol { /*************************************
float: right; ****************** OPTIONS ***********
margin-right: 30px; **************************************/
.options .module
{
margin: 5px;
padding: 15px;
} }
.volValue {
float: right; .options .container
margin-right: -160px; {
font: 12px "Open Sans", sans-serif; margin: 5px 0px 5px 10px;
} }
.optionsPage .module h1 {
font-size: 14px; .options .label-h {
margin-bottom: 5px; font-weight: 700;
} }
.optionsPage .module h2 {
margin-top: 10px; .options .module label {
font-size: 12px; font: 12px "Open Sans", sans-serif;
} }
.volValue {
vertical-align: top;
font: 12px "Open Sans", sans-serif;
}
.suboptions { .suboptions {
margin: 5px 30px; margin: 5px 30px;
border: double 2px rgba( 69, 71, 77, .1 ); border: double 2px rgba( 69, 71, 77, .1 );
@ -2255,6 +2262,7 @@ textarea.splited-post {
-o-transition: height 1s linear; -o-transition: height 1s linear;
-ms-transition: height 1s linear; -ms-transition: height 1s linear;
} }
/* Following page */ /* Following page */
.following ol.following-list > li{ .following ol.following-list > li{
display: inline-block; display: inline-block;
@ -2293,11 +2301,6 @@ textarea.splited-post {
float: right; float: right;
vertical-align: middle; vertical-align: middle;
} }
.optionsPage .module label {
font: 12px "Open Sans", sans-serif;
display: block;
float: right;
}
/* Autocomplite*/ /* Autocomplite*/
.textcomplete-wrapper textarea { .textcomplete-wrapper textarea {

25
theme_nin/css/style.css

@ -1659,40 +1659,45 @@ button.disabled:hover, .mini-profile-actions span.disabled:hover, a.button.disab
position: relative; position: relative;
} }
/* line 4, ../sass/_tabs.sass */ /* line 4, ../sass/_tabs.sass */
.options .label { .options .label-h {
font-weight: 700; font-weight: 700;
} }
/* line 7, ../sass/_tabs.sass */ /* line 7, ../sass/_tabs.sass */
.options label { .options label {
cursor: pointer; cursor: pointer;
} }
/* line 14, ../sass/_tabs.sass */
.options .container
{
margin: 5px 0px 5px 10px;
}
/* line 9, ../sass/_tabs.sass */ /* line 9, ../sass/_tabs.sass */
.options input[type=radio] { .options input[type=radio] {
display: none !important; display: none !important;
visibility: hidden; visibility: hidden;
opacity: 0; opacity: 0;
} }
/* line 14, ../sass/_tabs.sass */ /* line 17, ../sass/_tabs.sass */
.options .postboard-display div { .options .postboard-display div {
clear: both; clear: both;
} }
/* line 16, ../sass/_tabs.sass */ /* line 19, ../sass/_tabs.sass */
.options .postboard-display div div { .options .postboard-display div div {
float: left; float: left;
clear: none; clear: none;
padding: 10px; padding: 10px;
} }
/* line 20, ../sass/_tabs.sass */ /* line 23, ../sass/_tabs.sass */
.options .postboard-display div div .label { .options .postboard-display div div .label {
font-weight: 400; font-weight: 400;
} }
/* line 24, ../sass/_tabs.sass */ /* line 27, ../sass/_tabs.sass */
.options .tab-content { .options .tab-content {
background: white; background: white;
position: relative; position: relative;
padding: 20px; padding: 20px;
} }
/* line 29, ../sass/_tabs.sass */ /* line 32, ../sass/_tabs.sass */
.options .tab-content > div { .options .tab-content > div {
position: absolute; position: absolute;
top: 0; top: 0;
@ -1703,14 +1708,14 @@ button.disabled:hover, .mini-profile-actions span.disabled:hover, a.button.disab
opacity: 0; opacity: 0;
visibility: hidden; 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 { .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; position: relative;
z-index: 10; z-index: 10;
opacity: 1; opacity: 1;
visibility: visible; visibility: visible;
} }
/* line 50, ../sass/_tabs.sass */ /* line 53, ../sass/_tabs.sass */
.options label.tabs { .options label.tabs {
text-align: center; text-align: center;
width: auto; width: auto;
@ -1720,11 +1725,11 @@ button.disabled:hover, .mini-profile-actions span.disabled:hover, a.button.disab
color: #aaa; color: #aaa;
background: #f3f2f1; background: #f3f2f1;
} }
/* line 51, ../sass/_tabs.sass */ /* line 54, ../sass/_tabs.sass */
.options label.tabs:hover { .options label.tabs:hover {
color: #66686B; color: #66686B;
} }
/* line 61, ../sass/_tabs.sass */ /* line 64, ../sass/_tabs.sass */
.options input:checked + label.tabs { .options input:checked + label.tabs {
background: white; background: white;
color: #66686B; color: #66686B;

5
theme_nin/sass/_tabs.sass

@ -1,7 +1,7 @@
.options .options
position: relative position: relative
.label .label-h
font-weight: 700 font-weight: 700
label label
@ -11,6 +11,9 @@
visibility: hidden visibility: hidden
opacity: 0 opacity: 0
.container
margin: 5px 0px 5px 10px
.postboard-display div .postboard-display div
clear: both clear: both
div div

Loading…
Cancel
Save