diff --git a/abort.html b/abort.html index 2be87a2..f7145b8 100644 --- a/abort.html +++ b/abort.html @@ -3,12 +3,13 @@ Aborting... - + + @@ -17,7 +18,7 @@ - + diff --git a/following.html b/following.html index 1c3eed1..7ff99bf 100644 --- a/following.html +++ b/following.html @@ -3,13 +3,14 @@ Following - - + + + @@ -22,11 +23,13 @@ + diff --git a/home.html b/home.html index 4e598af..bbe66c5 100644 --- a/home.html +++ b/home.html @@ -3,13 +3,14 @@ twister - - + + + @@ -26,8 +27,10 @@ - - + @@ -377,7 +380,7 @@
  •  Following
  •  Followers
  • - + @@ -448,5 +451,6 @@ + diff --git a/js/calm.js b/js/calm.js index d32d5cb..c6fde20 100644 --- a/js/calm.js +++ b/js/calm.js @@ -6,29 +6,35 @@ $(function(){ $('.post-text').on('click', 'a', function(e){ e.stopPropagation(); }); - $('#showqr').on('click', function(){ - if($('#qrcode img')[0]) return; - var skey = document.getElementById('skey').innerText; - new QRCode(document.getElementById("qrcode"), skey); - }); + if($('#qrcode img')[0]) return; + var skey = document.getElementById('skey').innerText; + new QRCode(document.getElementById("qrcode"), skey); + }); + $('.tox-ctc').on('click', function(){ + window.prompt('Press Ctrl/Cmd+C to copy then Enter to close', $(this).attr('data')) + }) + $('.bitmessage-ctc').on('click', function(){ + window.prompt('Press Ctrl/Cmd+C to copy then Enter to close', $(this).attr('data')) + }) +}) + function dhtIndicatorBg(){ var bgcolor = ''; - if(twisterDhtNodes <= 10){bgcolor = '#770900' - }else if(twisterDhtNodes <= 20){bgcolor = '#773400' - }else if(twisterDhtNodes <= 30){bgcolor = '#774c00' - }else if(twisterDhtNodes <= 40){bgcolor = '#776400' - }else if(twisterDhtNodes <= 50){bgcolor = '#707500' - }else if(twisterDhtNodes <= 60){bgcolor = '#3f6900' - }else if(twisterDhtNodes <= 70){bgcolor = '#005f15' - }else if(twisterDhtNodes >= 71){bgcolor = '#009922' + if(twisterDhtNodes <= 20){bgcolor = '#770900' + }else if(twisterDhtNodes <= 60){bgcolor = '#773400' + }else if(twisterDhtNodes <= 90){bgcolor = '#774c00' + }else if(twisterDhtNodes <= 120){bgcolor = '#776400' + }else if(twisterDhtNodes <= 150){bgcolor = '#707500' + }else if(twisterDhtNodes <= 180){bgcolor = '#3f6900' + }else if(twisterDhtNodes <= 210){bgcolor = '#005f15' + }else if(twisterDhtNodes >= 250){bgcolor = '#009922' } $('.userMenu-dhtindicator').animate({'background-color': bgcolor }); }; setTimeout(dhtIndicatorBg, 300); setTimeout(function() {setInterval(dhtIndicatorBg, 2000)}, 400); -}) function modalDMIntr() { $(".cancel").on('click', function(event){ @@ -42,96 +48,13 @@ function modalDMIntr() { $(".modal-content").removeAttr("style"); }); }; -//sound notifications - -function soundNotifOptions() { - if(!localStorage['sndDM']) localStorage['sndDM'] = false; - if(!localStorage['sndMention']) localStorage['sndMention'] = false; - $('#notifyForm select').each(function(){ - this.value = localStorage[this.id]; - }); - - var player = $('#player'); - player[0].pause(); - $('#player').empty(); - - - $('form#notifyForm').on('change','select',function(){ - localStorage.setItem(this.id, this.value); - - if(this.value == false) {player[0].pause(); return;} - if (player[0].canPlayType('audio/mpeg;')) { - player.attr('type', 'audio/mpeg'); - player.attr('src', 'sound/'+this.value+'.mp3'); - } else { - player.attr('type', 'audio/ogg'); - player.attr('src', 'sound/'+this.value+'.ogg'); - } - - player[0].play(); - }); -} - -function volumeControl () { - var playerVol = $('#playerVol'); - playerVol[0].value = localStorage[playerVol[0].id] ? localStorage[playerVol[0].id] : 100; - $('.volValue').text((localStorage[playerVol[0].id] * 100).toFixed()); - - playerVol.on('change',function(){ - localStorage.setItem(this.id, this.value); - $('#player')[0].volume = (this.value); - $('.volValue').text((this.value * 100).toFixed()); - }); -} - -function DMsNotif() { - if(localStorage['sndDM'] == "false") return; - var player = $('#player'); - $('#player').empty(); - - if (player[0].canPlayType('audio/mpeg;')) { - player.attr('type', 'audio/mpeg'); - player.attr('src', 'sound/'+localStorage['sndDM']+'.mp3'); - } else { - player.attr('type', 'audio/ogg'); - player.attr('src', 'sound/'+localStorage['sndDM']+'.ogg'); - } - player[0].volume = localStorage['playerVol']; - player[0].play(); -} - -function mensNotif() { - if(localStorage['sndMention'] == "false") return; - var player = $('#player'); - $('#playerSec').empty(); - - if (player[0].canPlayType('audio/mpeg;')) { - player.attr('type', 'audio/mpeg'); - player.attr('src', 'sound/'+localStorage['sndMention']+'.mp3'); - } else { - player.attr('type', 'audio/ogg'); - player.attr('src', 'sound/'+localStorage['sndMention']+'.ogg'); - } - player[0].volume = localStorage['playerVol']; - player[0].play(); -}; - -function keysSend() { - if(!localStorage['keysSend']) localStorage['keysSend'] = 1; - $('#keysOpt select')[0].value = localStorage['keysSend']; - - $('#keysOpt select').on('change', function(){ - localStorage[this.id] = this.value; - - }) -} function mensAutocomplete() { - var storFollArr = JSON.parse(localStorage[localStorage.defaultScreenName]), suggests = []; + var suggests = []; - for(var i = 0; i < storFollArr.followingUsers.length; i++){ - if(storFollArr.followingUsers[i] == localStorage.defaultScreenName) continue; - suggests.push(storFollArr.followingUsers[i]); + for(var i = 0; i < followingUsers.length; i++){ + if(followingUsers[i] == localStorage.defaultScreenName) continue; + suggests.push(followingUsers[i]); } suggests.reverse(); $('textarea').textcomplete([ @@ -151,20 +74,26 @@ function mensAutocomplete() { ]) } -function setLang() { - - $('#language').val(localStorage['locLang'] || 'auto') - $('#language').on('change', function(){ - localStorage['locLang'] = $(this).val(); - }) +function changeStyle() { + var style, profile, menu; + var theme = $.Options.getTheme(); + if(theme == 'original') + { + style = 'css/style.css'; + profile = 'css/profile.css'; + menu = '.original_menu'; + $(".userMenu-dhtindicator").hide(); + }else + { + style = 'css/calm/style.css'; + profile = 'css/calm/profile.css'; + menu = '.calm_menu'; + } + $('#stylecss').attr('href', style); + $('#profilecss').attr('href', profile); + setTimeout(function(){$(menu).removeAttr('style')}, 0); } -function InitOptions () { - soundNotifOptions(); - volumeControl(); - keysSend(); - setLang(); -} function homeIntInit () { modalDMIntr (); setTimeout(mensAutocomplete, 800); diff --git a/js/interface_common.js b/js/interface_common.js index 8e85051..a92f4b5 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -30,7 +30,7 @@ function openModal( modalClass ) //fecha o modal removendo o conteúdo por detach function closeModal($this) -{ +{ var $body = $( "body" ); var $modalWindows = $( "body" ).children( ".modal-blackout" ); @@ -93,7 +93,6 @@ function newProfileModal(username) { var profileModalContent = $( "#profile-modal-template" ).children().clone(true); updateProfileData(profileModalContent, username); - return profileModalContent; } @@ -113,6 +112,17 @@ function openProfileModal(e) //título do modal $( "."+profileModalClass + " h3" ).text( polyglot.t("users_profile", { username: username }) ); + + //hed//add dinamic follow button in profile modal window + if(followingUsers.indexOf(username) != -1){ + $('.profile-card button.followButton').first().removeClass('follow').addClass('profileUnfollow').text(polyglot.t('Unfollow')).on('click', function(){ + unfollow(username); + }); + }; + $mc = $('.modal-content'); + $mch = parseInt($('.modal-content').css('height'));// + $pch = parseInt($('.profile-card').css('height'));// + $mc.css('height', $mch - ($pch + Math.floor($mch/50)));//hed//fix .modal-content height } function newHashtagModal(hashtag) { @@ -386,14 +396,20 @@ function replyTextKeypress(e) { $.MAL.disableButton(tweetAction); } - if (e.keyCode === 13) { - if (!e.ctrlKey) { + if( $.Options.keyEnterToSend() && $('.dropdown-menu').css('display') == 'none'){ + if (e.keyCode === 13 && (!e.metaKey && !e.ctrlKey)) { + $this.val($this.val().trim()); + if( !tweetAction.hasClass("disabled")) { + tweetAction.click(); + } + } + }else if( !$.Options.keyEnterToSend() ){ + if (e.keyCode === 13 && (e.metaKey || e.ctrlKey)) { + $this.val($this.val().trim()); if( !tweetAction.hasClass("disabled") ) { tweetAction.click(); } - } else { - $this.val($this.val() + "\r"); } } } @@ -411,7 +427,7 @@ var postSubmit = function(e) if (!$postOrig.length) { $postOrig = $this.closest(".modal-content").find(".post-data"); } - + newPostMsg($replyText.val(), $postOrig); $replyText.val(""); @@ -421,6 +437,10 @@ var postSubmit = function(e) remainingCount.text(140); $replyText.attr("placeholder", "Your message was sent!"); closeModal($this); + if($this.closest('.post-area,.post-reply-content')){ + $('.post-area-new').removeClass('open').find('textarea').blur(); + }; + setTimeout('requestTimelineUpdate("latest",postsPerRefresh,followingUsers,promotedPostsOnly)', 1000); } @@ -440,13 +460,15 @@ var retweetSubmit = function(e) function initInterfaceCommon() { - $( "body" ).on( "click", ".cancel" , function() { closeModal($(this)); } ); + $( "body" ).on( "click", function(event) { + if($(event.target).hasClass('cancel')) closeModal($(this)); + }); $( ".post-reply" ).bind( "click", postReplyClick ); $( ".post-propagate" ).bind( "click", reTwistPopup ); $( ".userMenu-config-dropdown" ).bind( "click", dropDownMenu ); $( ".config-menu" ).clickoutside( closeThis ); $( ".module.post" ).bind( "click", function(e) { - postExpandFunction(e,$(this)); }); + if(window.getSelection() == 0)postExpandFunction(e,$(this)); }); $( ".post-area-new" ).bind( "click", function(e) { composeNewPost(e,$(this));} ); $( ".post-area-new" ).clickoutside( unfocusThis ); @@ -454,10 +476,11 @@ function initInterfaceCommon() { $( ".modal-propagate").click( retweetSubmit ); var $replyText = $( ".post-area-new textarea" ); - $replyText.keyup( replyTextKeypress ); + $replyText.on("keyup", replyTextKeypress ); $( ".open-profile-modal").bind( "click", openProfileModal ); $( ".open-hashtag-modal").bind( "click", openHashtagModal ); $( ".open-following-modal").bind( "click", openFollowingModal ); $( ".userMenu-connections a").bind( "click", openMentionsModal ); + } diff --git a/js/interface_localization.js b/js/interface_localization.js index 79d9dc6..43a9101 100644 --- a/js/interface_localization.js +++ b/js/interface_localization.js @@ -6,8 +6,7 @@ // translators: add your language code here such as "es" for Spanish, "ru" for Russian var knownLanguages = ["en","es","nl","it","fr","ru","de","zh","ja","pt-BR","tr"]; -if(!localStorage['locLang'] || localStorage['locLang'] == 'auto'){ - if(!localStorage['locLang']) localStorage['locLang'] = 'auto'; +if( $.Options.getOption('locLang','auto') == 'auto'){ // detect language with JavaScript preferredLanguage = window.navigator.userLanguage || window.navigator.language || "en"; if(knownLanguages.indexOf(preferredLanguage) > -1){ @@ -23,7 +22,7 @@ if(!localStorage['locLang'] || localStorage['locLang'] == 'auto'){ preferredLanguage = "en"; } }else{ - preferredLanguage = localStorage['locLang']; + preferredLanguage = $.Options.getOption('locLang','en'); } // set up Polyglot polyglot = new Polyglot(); diff --git a/js/jquery.animate-colors-min.js b/js/jquery.animate-colors-min.js new file mode 100644 index 0000000..b2ab9cd --- /dev/null +++ b/js/jquery.animate-colors-min.js @@ -0,0 +1,12 @@ +/* + Color animation 1.6.0 + http://www.bitstorm.org/jquery/color-animation/ + Copyright 2011, 2013 Edwin Martin + Released under the MIT and GPL licenses. +*/ +'use strict';(function(d){function h(a,b,e){var c="rgb"+(d.support.rgba?"a":"")+"("+parseInt(a[0]+e*(b[0]-a[0]),10)+","+parseInt(a[1]+e*(b[1]-a[1]),10)+","+parseInt(a[2]+e*(b[2]-a[2]),10);d.support.rgba&&(c+=","+(a&&b?parseFloat(a[3]+e*(b[3]-a[3])):1));return c+")"}function f(a){var b;return(b=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(a))?[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],16),1]:(b=/#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(a))?[17*parseInt(b[1],16),17*parseInt(b[2], +16),17*parseInt(b[3],16),1]:(b=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(a))?[parseInt(b[1]),parseInt(b[2]),parseInt(b[3]),1]:(b=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9\.]*)\s*\)/.exec(a))?[parseInt(b[1],10),parseInt(b[2],10),parseInt(b[3],10),parseFloat(b[4])]:l[a]}d.extend(!0,d,{support:{rgba:function(){var a=d("script:first"),b=a.css("color"),e=!1;if(/^rgba/.test(b))e=!0;else try{e=b!=a.css("color","rgba(0, 0, 0, 0.5)").css("color"), +a.css("color",b)}catch(c){}return e}()}});var k="color backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor outlineColor".split(" ");d.each(k,function(a,b){d.Tween.propHooks[b]={get:function(a){return d(a.elem).css(b)},set:function(a){var c=a.elem.style,g=f(d(a.elem).css(b)),m=f(a.end);a.run=function(a){c[b]=h(g,m,a)}}}});d.Tween.propHooks.borderColor={set:function(a){var b=a.elem.style,e=[],c=k.slice(2,6);d.each(c,function(b,c){e[c]=f(d(a.elem).css(c))});var g=f(a.end); +a.run=function(a){d.each(c,function(d,c){b[c]=h(e[c],g,a)})}}};var l={aqua:[0,255,255,1],azure:[240,255,255,1],beige:[245,245,220,1],black:[0,0,0,1],blue:[0,0,255,1],brown:[165,42,42,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgrey:[169,169,169,1],darkgreen:[0,100,0,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkviolet:[148,0,211,1],fuchsia:[255, +0,255,1],gold:[255,215,0,1],green:[0,128,0,1],indigo:[75,0,130,1],khaki:[240,230,140,1],lightblue:[173,216,230,1],lightcyan:[224,255,255,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],magenta:[255,0,255,1],maroon:[128,0,0,1],navy:[0,0,128,1],olive:[128,128,0,1],orange:[255,165,0,1],pink:[255,192,203,1],purple:[128,0,128,1],violet:[128,0,128,1],red:[255,0,0,1],silver:[192,192,192,1],white:[255,255,255,1],yellow:[255,255, +0,1],transparent:[255,255,255,0]}})(jQuery); diff --git a/js/mobile_abstract.js b/js/mobile_abstract.js index 81f2927..9c98ef4 100644 --- a/js/mobile_abstract.js +++ b/js/mobile_abstract.js @@ -350,6 +350,21 @@ var MAL = function() window.location.href = "home.html"; } } + + this.soundNotifyMentions = function() { + if( $.hasOwnProperty("mobile") ) { + } else { + $.Options.mensNotif(); + } + } + + this.soundNotifyDM = function() { + if( $.hasOwnProperty("mobile") ) { + } else { + $.Options.DMsNotif(); + } + } + } jQuery.MAL = new MAL; diff --git a/js/options.js b/js/options.js index d9286d5..45f9103 100644 --- a/js/options.js +++ b/js/options.js @@ -1,3 +1,145 @@ $(function() { }); + +var TwisterOptions = function() +{ + this.getOption = function(optionName, defaultValue) { + var keyName = "options:" + optionName; + if( $.localStorage.isSet(keyName) ) + return $.localStorage.get(keyName); + else + return defaultValue; + } + + this.setOption = function(optionName, value) { + var keyName = "options:" + optionName; + $.localStorage.set(keyName, value); + } + + this.soundNotifOptions = function() { + $('#notifyForm select').each(function(){ + this.value = $.Options.getOption(this.id, "false"); + }); + + var player = $('#player'); + player[0].pause(); + $('#player').empty(); + + $('form#notifyForm').on('change','select',function(){ + $.Options.setOption(this.id, this.value); + + if(this.value == false) {player[0].pause(); return;} + if (player[0].canPlayType('audio/mpeg;')) { + player.attr('type', 'audio/mpeg'); + player.attr('src', 'sound/'+this.value+'.mp3'); + } else { + player.attr('type', 'audio/ogg'); + player.attr('src', 'sound/'+this.value+'.ogg'); + } + + player[0].play(); + }); + } + + this.volumeControl = function() { + var playerVol = $('#playerVol'); + playerVol[0].value = $.Options.getOption(playerVol[0].id, 100); + $('.volValue').text((playerVol[0].value * 100).toFixed()); + + playerVol.on('change',function(){ + $.Options.setOption(this.id, this.value); + $('#player')[0].volume = (this.value); + $('.volValue').text((this.value * 100).toFixed()); + }); + } + + this.DMsNotif = function() { + var sndDM = $.Options.getOption('sndDM', "false"); + if( sndDM == "false") return; + var player = $('#player'); + $('#player').empty(); + + if (player[0].canPlayType('audio/mpeg;')) { + player.attr('type', 'audio/mpeg'); + player.attr('src', 'sound/'+sndDM+'.mp3'); + } else { + player.attr('type', 'audio/ogg'); + player.attr('src', 'sound/'+sndDM+'.ogg'); + } + player[0].volume = $.Options.getOption('playerVol',100); + player[0].play(); + } + + this.mensNotif = function() { + var sndMention = $.Options.getOption('sndMention', "false"); + if(sndMention == "false") return; + var player = $('#player'); + $('#playerSec').empty(); + + if (player[0].canPlayType('audio/mpeg;')) { + player.attr('type', 'audio/mpeg'); + player.attr('src', 'sound/'+sndMention+'.mp3'); + } else { + player.attr('type', 'audio/ogg'); + player.attr('src', 'sound/'+sndMention+'.ogg'); + } + player[0].volume = $.Options.getOption('playerVol',100); + player[0].play(); + } + + this.keysSend = function() { + $('#keysOpt select')[0].value = $.Options.getOption('keysSend',"enter"); + + $('#keysOpt select').on('change', function(){ + $.Options.setOption(this.id, this.value); + }) + } + + this.keyEnterToSend = function() { + return $.Options.getOption('keysSend',"enter") == "enter"; + } + + this.setLang = function() { + $('#language').val($.Options.getOption('locLang','auto')) + $('#language').on('change', function(){ + $.Options.setOption('locLang', $(this).val()); + }) + } + + this.getTheme = function() { + return $.Options.getOption('theme','original'); + } + + this.setTheme = function() { + $('#theme').val(this.getTheme()) + $('#theme').on('change', function(){ + $.Options.setOption('theme', $(this).val()); + location.reload(); + }); + } + + this.getLineFeedsOpt = function() { + return $.Options.getOption('displayLineFeeds',"disable"); + } + + this.setLineFeedsOpt = function() { + $('#lineFeedsOpt select')[0].value = this.getLineFeedsOpt(); + + $('#lineFeedsOpt select').on('change', function(){ + $.Options.setOption(this.id, this.value); + }) + } + + this.InitOptions = function() { + this.soundNotifOptions(); + this.volumeControl(); + this.keysSend(); + this.setLang(); + this.setTheme(); + this.setLineFeedsOpt(); + } +} + +jQuery.Options = new TwisterOptions; + diff --git a/js/twister_directmsg.js b/js/twister_directmsg.js index e9e1bbb..a96e79a 100644 --- a/js/twister_directmsg.js +++ b/js/twister_directmsg.js @@ -120,6 +120,7 @@ function directMessagesPopup() $( ".directMessages h3" ).text( polyglot.t("Direct Messages") ); requestDMsnippetList($(".directMessages").find(".direct-messages-list")); + $('.modal-back').css('display','inline'); } diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index ed2124f..eeb857c 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -157,7 +157,7 @@ function htmlFormatMsg( msg, output, mentions ) { if( match ) { index = (match[0] === match[1]) ? match.index : match.index + 1; if( match[1] == "@" ) { - output.append(msg.substr(0, index)); + output.append(_formatText(msg.substr(0, index))); tmp = msg.substr(index+1); var username = _extractUsername(tmp); if( username.length ) { @@ -177,27 +177,28 @@ function htmlFormatMsg( msg, output, mentions ) { } if( reHttp.exec(match[1]) ) { - output.append(msg.substr(0, index)); + output.append(_formatText(msg.substr(0, index))); tmp = msg.substring(index); - var space = tmp.indexOf(" "); + var space = tmp.search(/[ \n\t]/); var url; if( space != -1 ) url = tmp.substring(0,space); else url = tmp; if( url.length ) { + msg = tmp.substr(String(url).length); + url = url.replace('&', '&'); var extLinkTemplate = $("#external-page-link-template").clone(true); extLinkTemplate.removeAttr("id"); extLinkTemplate.attr("href",url); extLinkTemplate.text(url); extLinkTemplate.attr("title",url); output.append(extLinkTemplate); - msg = tmp.substr(String(url).length); continue; } } if( reEmail.exec(match[1]) ) { - output.append(msg.substr(0, index)); + output.append(_formatText(msg.substr(0, index))); tmp = msg.substring(index); - var space = tmp.indexOf(" "); + var space = tmp.search(/[ \n\t]/); var email; if( space != -1 ) email = tmp.substring(0,space); else email = tmp; if( email.length ) { @@ -213,13 +214,18 @@ function htmlFormatMsg( msg, output, mentions ) { } if( match[1] == "#" ) { - output.append(msg.substr(0, index)); + output.append(_formatText(msg.substr(0, index))); tmp = msg.substr(index+1); var hashtag = _extractHashtag(tmp); if( hashtag.length ) { + var hashtag_lc=''; + for( var i = 0; i < hashtag.length; i++ ) { + var c = hashtag[i]; + hashtag_lc += (c >= 'A' && c <= 'Z') ? c.toLowerCase() : c; + } var hashtagLinkTemplate = $("#hashtag-link-template").clone(true); hashtagLinkTemplate.removeAttr("id"); - hashtagLinkTemplate.attr("href",$.MAL.hashtagUrl(hashtag.toLowerCase())); + hashtagLinkTemplate.attr("href",$.MAL.hashtagUrl(hashtag_lc)); hashtagLinkTemplate.text("#"+hashtag); output.append(hashtagLinkTemplate); msg = tmp.substr(String(hashtag).length); @@ -231,12 +237,21 @@ function htmlFormatMsg( msg, output, mentions ) { } } - output.append(msg); + output.append(_formatText(msg)); msg = ""; } } // internal function for htmlFormatMsg +function _formatText(msg) +{ + // TODO: add options for emotions and linefeeds + //msg = $.emotions(msg); + if( $.Options.getLineFeedsOpt() == "enable" ) + msg = msg.replace(/\n/g, '
    '); + return msg; +} + function _extractUsername(s) { var username = ""; for( var i = 0; i < s.length; i++ ) { @@ -267,6 +282,6 @@ function _extractHashtag(s) { } function escapeHtmlEntities(str) { - return str.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, '''); + return str.replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"').replace("'", '''); } diff --git a/js/twister_newmsgs.js b/js/twister_newmsgs.js index c1c1fad..c899ee1 100644 --- a/js/twister_newmsgs.js +++ b/js/twister_newmsgs.js @@ -18,16 +18,21 @@ function processMention(user, mentionTime, data) { if( mentionTime > curTime + 3600 ) { console.log("mention from the future will be ignored"); } else { + var newMentionsUpdated = false; if( !(key in _knownMentions) ) { // mention must be somewhat recent compared to last known one to be considered new if( mentionTime + 3600 > _lastMentionTime ) { _newMentions++; + newMentionsUpdated = true; _lastMentionTime = mentionTime; } _knownMentions[key] = {mentionTime:mentionTime, data:data}; purgeOldMentions(); saveMentionsToStorage(); } + if( newMentionsUpdated ) { + $.MAL.soundNotifyMentions(); + } } } diff --git a/js/twister_user.js b/js/twister_user.js index 78b4d23..6755a80 100644 --- a/js/twister_user.js +++ b/js/twister_user.js @@ -171,7 +171,7 @@ function sendNewUserTransaction(username, cbFunc) { function importSecretKeypress() { var secretKey = $(".secret-key-import").val(); - var username = $(".username-import").val(); + var username = $(".username-import").val().toLowerCase(); var $importButton = $(".import-secret-key"); if( secretKey.length == 52 && username.length ) { diff --git a/login.html b/login.html index 4c9c168..b743d46 100644 --- a/login.html +++ b/login.html @@ -3,12 +3,13 @@ twister login - + + @@ -17,12 +18,14 @@ + @@ -53,7 +56,7 @@

    twister login

    - Existing local users +

    Existing local users

    @@ -61,10 +64,10 @@
    - Or... +
    - Create a new user +

    Create a new user

    @@ -75,15 +78,15 @@
    - Or... +
    - Import secret key +

    Import secret key

    - With nickname +

    With nickname

    diff --git a/network.html b/network.html index 9c86c51..e374fb8 100644 --- a/network.html +++ b/network.html @@ -3,12 +3,13 @@ Network status - + + @@ -19,12 +20,14 @@ + diff --git a/options.html b/options.html index e4860d1..628e64e 100644 --- a/options.html +++ b/options.html @@ -2,13 +2,14 @@ - twister login - + Options + + @@ -18,10 +19,10 @@ - @@ -53,16 +54,34 @@

    Use language

    -
    + +
    +
    +
    +
    +
    + +
    +

    Theme

    +
    +
    +
    @@ -107,14 +126,29 @@

    Send key

    - + +
    +
    +

    Posts display

    +
    +
    +

    Line feeds

    + +
    +
    +
    +
    + diff --git a/profile-edit.html b/profile-edit.html index a8d4275..fce8f48 100644 --- a/profile-edit.html +++ b/profile-edit.html @@ -2,13 +2,14 @@ Edit profile - - + + + @@ -19,12 +20,14 @@ + diff --git a/sound/1.mp3 b/sound/1.mp3 new file mode 100644 index 0000000..3d8d927 Binary files /dev/null and b/sound/1.mp3 differ diff --git a/sound/1.ogg b/sound/1.ogg new file mode 100644 index 0000000..019d974 Binary files /dev/null and b/sound/1.ogg differ diff --git a/sound/2.mp3 b/sound/2.mp3 new file mode 100644 index 0000000..7a9816b Binary files /dev/null and b/sound/2.mp3 differ diff --git a/sound/2.ogg b/sound/2.ogg new file mode 100644 index 0000000..28d62bf Binary files /dev/null and b/sound/2.ogg differ diff --git a/sound/3.mp3 b/sound/3.mp3 new file mode 100644 index 0000000..8594640 Binary files /dev/null and b/sound/3.mp3 differ diff --git a/sound/3.ogg b/sound/3.ogg new file mode 100644 index 0000000..cbad4a9 Binary files /dev/null and b/sound/3.ogg differ diff --git a/sound/4.mp3 b/sound/4.mp3 new file mode 100644 index 0000000..113c94a Binary files /dev/null and b/sound/4.mp3 differ diff --git a/sound/4.ogg b/sound/4.ogg new file mode 100644 index 0000000..65fcc37 Binary files /dev/null and b/sound/4.ogg differ diff --git a/sound/5.mp3 b/sound/5.mp3 new file mode 100644 index 0000000..df4efa3 Binary files /dev/null and b/sound/5.mp3 differ diff --git a/sound/5.ogg b/sound/5.ogg new file mode 100644 index 0000000..a3b4c0a Binary files /dev/null and b/sound/5.ogg differ diff --git a/tmobile.html b/tmobile.html index f51eaeb..a419a52 100644 --- a/tmobile.html +++ b/tmobile.html @@ -27,6 +27,7 @@ +