Browse Source

more merging with twister-calm + fixes

master
Miguel Freitas 11 years ago
parent
commit
f808426c44
  1. 5
      abort.html
  2. 7
      following.html
  3. 14
      home.html
  4. 155
      js/calm.js
  5. 43
      js/interface_common.js
  6. 5
      js/interface_localization.js
  7. 12
      js/jquery.animate-colors-min.js
  8. 15
      js/mobile_abstract.js
  9. 142
      js/options.js
  10. 1
      js/twister_directmsg.js
  11. 35
      js/twister_formatpost.js
  12. 5
      js/twister_newmsgs.js
  13. 2
      js/twister_user.js
  14. 17
      login.html
  15. 5
      network.html
  16. 60
      options.html
  17. 7
      profile-edit.html
  18. BIN
      sound/1.mp3
  19. BIN
      sound/1.ogg
  20. BIN
      sound/2.mp3
  21. BIN
      sound/2.ogg
  22. BIN
      sound/3.mp3
  23. BIN
      sound/3.ogg
  24. BIN
      sound/4.mp3
  25. BIN
      sound/4.ogg
  26. BIN
      sound/5.mp3
  27. BIN
      sound/5.ogg
  28. 1
      tmobile.html

5
abort.html

@ -3,12 +3,13 @@ @@ -3,12 +3,13 @@
<head>
<meta charset="utf-8"/>
<title>Aborting...</title>
<link rel="stylesheet" href="css/style.css" type="text/css"/>
<link id="stylecss" rel="stylesheet" href="css/style.css"/>
<script src="js/jquery.min.js"></script>
<script src="js/jQueryPlugins.js"></script>
<script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.js"></script>
<script src="js/options.js"></script>
<script src="js/mobile_abstract.js"></script>
<script src="js/twister_io.js"></script>
<script src="js/twister_user.js"></script>
@ -17,7 +18,7 @@ @@ -17,7 +18,7 @@
<script src="js/twister_newmsgs.js"></script>
<script src="js/twister_network.js"></script>
<script src="js/interface_common.js"></script>
<script>changeStyle();</script>
<link rel="icon" type="image/png" href="img/twister_mini.png" />
</head>

7
following.html

@ -3,13 +3,14 @@ @@ -3,13 +3,14 @@
<head>
<meta charset="utf-8"/>
<title>Following</title>
<link rel="stylesheet" href="css/style.css" type="text/css"/>
<link rel="stylesheet" href="css/profile.css" type="text/css"/>
<link id="stylecss" rel="stylesheet" href="css/style.css" type="text/css"/>
<link id="profilecss" rel="stylesheet" href="css/profile.css" type="text/css"/>
<script src="js/jquery.min.js"></script>
<script src="js/jQueryPlugins.js"></script>
<script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.js"></script>
<script src="js/options.js"></script>
<script src="js/mobile_abstract.js"></script>
<script src="js/twister_io.js"></script>
<script src="js/polyglot.min.js"></script>
@ -22,11 +23,13 @@ @@ -22,11 +23,13 @@
<script src="js/twister_directmsg.js"></script>
<script src="js/twister_actions.js"></script>
<script src="js/interface_common.js"></script>
<script src="js/calm.js"></script>
<script>
$(document).ready(function()
{
initInterfaceFollowing();
changeStyle();
});
</script>

14
home.html

@ -3,13 +3,14 @@ @@ -3,13 +3,14 @@
<head>
<meta charset="utf-8"/>
<title>twister</title>
<link rel="stylesheet" href="css/style.css" type="text/css"/>
<link rel="stylesheet" href="css/profile.css" type="text/css"/>
<link id="stylecss" rel="stylesheet" href="css/style.css" type="text/css"/>
<link id="profilecss" rel="stylesheet" href="css/profile.css" type="text/css"/>
<script src="js/jquery.min.js"></script>
<script src="js/jQueryPlugins.js"></script>
<script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.js"></script>
<script src="js/options.js"></script>
<script src="js/mobile_abstract.js"></script>
<script src="js/twister_io.js"></script>
<script src="js/polyglot.min.js"></script>
@ -26,8 +27,10 @@ @@ -26,8 +27,10 @@
<script src="js/interface_home.js"></script>
<script src="js/jquery.textcomplete.js"></script>
<script src="js/calm.js"></script>
<script src="js/options.js"></script>
<script>$(function(){setTimeout(mensAutocomplete, 800);})</script> <!-- calm init for autocomplete -->
<script>
$(function(){setTimeout(mensAutocomplete, 800);})
changeStyle();
</script> <!-- calm init for autocomplete -->
<link rel="icon" type="image/png" href="img/twister_mini.png" />
</head>
@ -377,7 +380,7 @@ @@ -377,7 +380,7 @@
<li><a href="#" class="open-following-modal"><span class="following-count">&nbsp;</span><span class="label">Following</span></a></li>
<li><a href="#"><span class="followers-count">&nbsp;</span><span class="label">Followers</span></a></li>
</ul>
<button class="follow" href="#">Follow</button>
<button class="followButton follow" href="#">Follow</button>
<button class="direct-messages-with-user" href="#">Direct Messages</button>
</div>
@ -448,5 +451,6 @@ @@ -448,5 +451,6 @@
<!-- TEMPLATES END -->
<audio id="player"></audio>
<audio id="playerSec"></audio>
<!-- hide elements -->
</body>
</html>

155
js/calm.js

@ -6,29 +6,35 @@ $(function(){ @@ -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() { @@ -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() { @@ -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);

43
js/interface_common.js

@ -30,7 +30,7 @@ function openModal( modalClass ) @@ -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) { @@ -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) @@ -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) { @@ -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) @@ -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) @@ -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) @@ -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() { @@ -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 );
}

5
js/interface_localization.js

@ -6,8 +6,7 @@ @@ -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'){ @@ -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();

12
js/jquery.animate-colors-min.js vendored

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
/*
Color animation 1.6.0
http://www.bitstorm.org/jquery/color-animation/
Copyright 2011, 2013 Edwin Martin <edwin@bitstorm.org>
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);

15
js/mobile_abstract.js

@ -350,6 +350,21 @@ var MAL = function() @@ -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;

142
js/options.js

@ -1,3 +1,145 @@ @@ -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;

1
js/twister_directmsg.js

@ -120,6 +120,7 @@ function directMessagesPopup() @@ -120,6 +120,7 @@ function directMessagesPopup()
$( ".directMessages h3" ).text( polyglot.t("Direct Messages") );
requestDMsnippetList($(".directMessages").find(".direct-messages-list"));
$('.modal-back').css('display','inline');
}

35
js/twister_formatpost.js

@ -157,7 +157,7 @@ function htmlFormatMsg( msg, output, mentions ) { @@ -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 ) { @@ -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('&amp;', '&');
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 ) { @@ -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 ) { @@ -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, '<br />');
return msg;
}
function _extractUsername(s) {
var username = "";
for( var i = 0; i < s.length; i++ ) {
@ -267,6 +282,6 @@ function _extractHashtag(s) { @@ -267,6 +282,6 @@ function _extractHashtag(s) {
}
function escapeHtmlEntities(str) {
return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;');
return str.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;').replace('"', '&quot;').replace("'", '&apos;');
}

5
js/twister_newmsgs.js

@ -18,16 +18,21 @@ function processMention(user, mentionTime, data) { @@ -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();
}
}
}

2
js/twister_user.js

@ -171,7 +171,7 @@ function sendNewUserTransaction(username, cbFunc) { @@ -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 ) {

17
login.html

@ -3,12 +3,13 @@ @@ -3,12 +3,13 @@
<head>
<meta charset="utf-8"/>
<title>twister login</title>
<link rel="stylesheet" href="css/style.css" type="text/css"/>
<link id="stylecss" rel="stylesheet" href="css/style.css" type="text/css"/>
<script src="js/jquery.min.js"></script>
<script src="js/jQueryPlugins.js"></script>
<script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.js"></script>
<script src="js/options.js"></script>
<script src="js/mobile_abstract.js"></script>
<script src="js/twister_io.js"></script>
<script src="js/twister_network.js"></script>
@ -17,12 +18,14 @@ @@ -17,12 +18,14 @@
<script src="js/interface_login.js"></script>
<script src="js/polyglot.min.js"></script>
<script src="js/interface_localization.js"></script>
<script src="js/calm.js"></script>
<script>
$(document).ready(function()
{
initInterfaceLogin();
});
changeStyle();
</script>
<link rel="icon" type="image/png" href="img/twister_mini.png" />
@ -53,7 +56,7 @@ @@ -53,7 +56,7 @@
<h2> twister login </h2>
<div class="module">
<span> Existing local users </span>
<p> Existing local users </p>
<div>
<select class="local-usernames login-user">
</select>
@ -61,10 +64,10 @@ @@ -61,10 +64,10 @@
</div>
</div>
<span> Or... </span>
<!-- <span> Or... </span> -->
<div class="module">
<span> Create a new user </span>
<p> Create a new user </p>
<div>
<input class="new-username" type="textbox" placeholder="Type nickname here" cols="16" rows="1"></input>
<button class="check-availability">Check availability</button>
@ -75,15 +78,15 @@ @@ -75,15 +78,15 @@
</div>
</div>
<span> Or... </span>
<!-- <span> Or... </span> -->
<div class="module">
<div>
<span> Import secret key </span>
<p> Import secret key </p>
<input class="secret-key-import" type="textbox" placeholder="52-characters secret" size="52" rows="1"></input>
</div>
<div>
<span> With nickname </span>
<p class="with-nickname"> With nickname </p>
<input class="username-import" type="textbox" placeholder="Type nickname here" size="16" rows="1"></input>
</div>
<div>

5
network.html

@ -3,12 +3,13 @@ @@ -3,12 +3,13 @@
<head>
<meta charset="utf-8"/>
<title>Network status</title>
<link rel="stylesheet" href="css/style.css" type="text/css"/>
<link id="stylecss" rel="stylesheet" href="css/style.css" type="text/css"/>
<script src="js/jquery.min.js"></script>
<script src="js/jQueryPlugins.js"></script>
<script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.js"></script>
<script src="js/options.js"></script>
<script src="js/mobile_abstract.js"></script>
<script src="js/twister_io.js"></script>
<script src="js/twister_user.js"></script>
@ -19,12 +20,14 @@ @@ -19,12 +20,14 @@
<script src="js/interface_localization.js"></script>
<script src="js/twister_network.js"></script>
<script src="js/interface_common.js"></script>
<script src="js/calm.js"></script>
<script>
$(document).ready(function()
{
initInterfaceNetwork();
});
changeStyle();
</script>
<link rel="icon" type="image/png" href="img/twister_mini.png" />

60
options.html

@ -2,13 +2,14 @@ @@ -2,13 +2,14 @@
<html>
<head>
<meta charset="utf-8"/>
<title>twister login</title>
<link rel="stylesheet" href="css/style.css" type="text/css"/>
<title>Options</title>
<link id="stylecss" rel="stylesheet" href="css/style.css" type="text/css"/>
<script src="js/jquery.min.js"></script>
<script src="js/jQueryPlugins.js"></script>
<script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.js"></script>
<script src="js/options.js"></script>
<script src="js/mobile_abstract.js"></script>
<script src="js/twister_io.js"></script>
<script src="js/twister_network.js"></script>
@ -18,10 +19,10 @@ @@ -18,10 +19,10 @@
<script src="js/polyglot.min.js"></script>
<script src="js/interface_localization.js"></script>
<script src="js/calm.js"></script>
<script src="js/options.js"></script>
<script>$(function(){
initInterfaceCommon();
InitOptions();})
$.Options.InitOptions();})
changeStyle();
</script>
</head>
@ -53,16 +54,34 @@ @@ -53,16 +54,34 @@
<div class="module">
<p> Use language </p>
<div>
<form action="" id="choseLanguage">
<form action="" id="selectLanguage">
<select name="" id="language">
<option value="auto">Auto</option>
<option value="pt-BR">Brazilian Portuguese</option>
<option value="zh">Chinese</option>
<option value="nl">Dutch</option>
<option value="en">English</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ru">Russian</option>
<option value="zh">Chinese</option>
<option value="de">German</option>
<option value="fr">French</option>
<option value="it">Italian</option>
<option value="nl">Dutch</option>
<option value="es">Spanish</option>
<option value="tr">Turkish</option>
</select>
</form>
</div>
</div>
</div>
<div class="language">
<div class="module">
<p> Theme </p>
<div>
<form action="" id="selectTheme">
<select name="" id="theme">
<option value="original">Original</option>
<option value="calm">Calm</option>
</select>
</form>
</div>
@ -107,14 +126,29 @@ @@ -107,14 +126,29 @@
<form action="" id="keysOpt">
<p>Send key</p>
<select name="" id="keysSend">
<option value="1">Enter</option>
<option value="2">Ctrl/Cmd+Enter</option>
<option value="enter">Enter</option>
<option value="ctrlenter">Ctrl/Cmd+Enter</option>
</select>
</form>
</div>
</div>
</div>
</div>
<div class="posts-display">
<div class="module">
<p> Posts display </p>
<div>
<form action="" id="lineFeedsOpt">
<p>Line feeds</p>
<select name="" id="displayLineFeeds">
<option value="disable">Ignore</option>
<option value="enable">Display</option>
</select>
</form>
</div>
</div>
</div>
</div>
</body>
</html>

7
profile-edit.html

@ -2,13 +2,14 @@ @@ -2,13 +2,14 @@
<head>
<meta charset="utf-8">
<title>Edit profile</title>
<link rel="stylesheet" href="css/style.css" type="text/css">
<link rel="stylesheet" href="css/profile.css" type="text/css">
<link id="stylecss" rel="stylesheet" href="css/style.css" type="text/css">
<link id="profilecss" rel="stylesheet" href="css/profile.css" type="text/css">
<script src="js/jquery.min.js"></script>
<script src="js/jQueryPlugins.js"></script>
<script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.js"></script>
<script src="js/options.js"></script>
<script src="js/mobile_abstract.js"></script>
<script src="js/twister_io.js"></script>
<script src="js/polyglot.min.js"></script>
@ -19,12 +20,14 @@ @@ -19,12 +20,14 @@
<script src="js/twister_newmsgs.js"></script>
<script src="js/interface_common.js"></script>
<script src="js/interface_profile-edit.js"></script>
<script src="js/calm.js"></script>
<script>
$(document).ready(function()
{
initProfileEdit();
});
changeStyle()
</script>
<link rel="icon" type="image/png" href="img/twister_mini.png" />

BIN
sound/1.mp3

Binary file not shown.

BIN
sound/1.ogg

Binary file not shown.

BIN
sound/2.mp3

Binary file not shown.

BIN
sound/2.ogg

Binary file not shown.

BIN
sound/3.mp3

Binary file not shown.

BIN
sound/3.ogg

Binary file not shown.

BIN
sound/4.mp3

Binary file not shown.

BIN
sound/4.ogg

Binary file not shown.

BIN
sound/5.mp3

Binary file not shown.

BIN
sound/5.ogg

Binary file not shown.

1
tmobile.html

@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
<script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.js"></script>
<script src="js/options.js?vr=10"></script>
<script src="js/mobile_abstract.js?vr=10"></script>
<script src="js/twister_io.js?vr=10"></script>
<script src="js/polyglot.min.js?vr=10"></script>

Loading…
Cancel
Save