Browse Source

fixes and improves

improved post submit keys combination;
removed theme selector;
improved options internal mechanism;
master
Hedgehog 11 years ago
parent
commit
319ed4737e
  1. BIN
      css/orange/OpenSans-Bold.ttf
  2. BIN
      css/orange/OpenSans-Italic.ttf
  3. BIN
      css/orange/OpenSans-Regular.ttf
  4. BIN
      css/orange/OpenSansCondensed300.ttf
  5. 238
      css/orange/profile.css
  6. 1574
      css/orange/style.css
  7. 13
      css/style.css
  8. 45
      following.html
  9. 79
      home.html
  10. BIN
      img/wrapperBg.png
  11. 7
      js/calm.js
  12. 25
      js/interface_common.js
  13. 5
      js/interface_localization.js
  14. 16
      js/mobile_abstract.js
  15. 129
      js/options.js
  16. 11
      js/twister_formatpost.js
  17. 8
      js/twister_newmsgs.js
  18. 30
      login.html
  19. 49
      network.html
  20. 53
      options.html
  21. 6
      profile-edit.html

BIN
css/orange/OpenSans-Bold.ttf

Binary file not shown.

BIN
css/orange/OpenSans-Italic.ttf

Binary file not shown.

BIN
css/orange/OpenSans-Regular.ttf

Binary file not shown.

BIN
css/orange/OpenSansCondensed300.ttf

Binary file not shown.

238
css/orange/profile.css

@ -1,238 +0,0 @@
/**************************************
********************* PROFILE PHOTO ***
***************************************/
.profile-card
{
padding: 7px;
background: rgba( 255, 255, 255, .5 );
border: solid 1px rgba( 69, 71, 77, .05 );
position: relative;
}
.profile-card-main
{
width: 540px;
text-align: center;
position: relative;
transition: all .2s linear;
}
.profile-card-main:before
{
content: "";
border: solid 0px #fff;
transition: all .2s linear;
position: absolute;
left: 1px;
top: 1px;
right: 1px;
bottom: 1px;
z-index: 0;
}
.profile-card-main *
{
position: relative;
z-index: 1;
}
.profile-card-photo
{
width: 74px;
height: 74px;
border: solid 6px #45474d;
border-radius: 40%;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
box-sizing: content-box;
float:left;
top: 50%;
background-color: #a12a28;
}
.profile-card-main h1
{
font-size: 24px;
font-weight: bold;
color: #fff;
}
.profile-card-main h2
{
color: #fff;
}
.profile-card .direct-messages,
.profile-card .direct-messages-with-user,
.profile-card .follow
{
display: block;
position: absolute;
bottom: 20px;
right: 10px;
padding: 10px;
font-size: 12px;
width: 120px;
text-align: center;
color: rgba( 0, 0, 0, .7 );
background: rgba( 0, 0, 0, .1 );
border: none;
transition: all .2s linear;
}
.profile-card .follow
{
right: 135px;
}
.profile-card .direct-messages:hover,
.profile-card .direct-messages-with-user:hover,
.profile-card .follow:hover
{
background: rgba( 0, 0, 0, .3 );
}
.profile-card.forEdition
{
margin: 0 auto;
width: 540px;
}
.forEdition .profile-card-photo
{
border: solid 2px #fff;
position: relative;
cursor: pointer;
transition: all .2s linear;
}
.forEdition .profile-card-main:hover:after,
.forEdition .profile-card-photo:after
{
content: "";
width: 36px;
height: 36px;
position: absolute;
top: 10px;
right: 10px;
background: url(../img/edit.png) no-repeat right top;
}
.forEdition .profile-card-main:hover:before
{
border: solid 5px #fff;
}
.forEdition .profile-card-main h2
{
margin-bottom: 8px;
}
.forEdition .profile-card-main input
{
display: block;
margin: 0 auto;
background: rgba( 0, 0, 0, .1 );
border: none;
padding: 6px 4px;
color: #fff;
margin-bottom: 4px;
text-align: center;
transition: all .2s linear;
}
.forEdition .profile-card-main input:hover,
.forEdition .profile-card-main input:focus,
.forEdition .profile-card-photo:hover
{
background: rgba( 0, 0, 0, .3 );
}
.input-description
{
width: 90%;
}
.input-name
{
font-size: 20px;
}
.forEdition .profile-card-main .input-website,
.forEdition .profile-card-main .input-city
{
display: inline-block;
}
.profile-edition-buttons
{
padding: 10px;
text-align: right;
}
/*************************************
****************** PROFILE MODAL
**************************************/
.profile-modal .modal-wrapper
{
width: 580px;
border-radius: 5px;
overflow: hidden;
position: absolute;
top:10%;
height: 80%;
margin-left: -300px;
}
.profile-modal .modal-content
{
padding: 3px;
height: 90%;
}
.profile-modal .profile-data
{
display: inline-block;
margin-left: -4px;
border-bottom: 0;
}
.profile-modal .postboard
{
margin-left: 0;
padding: 5px 0 5px 0;
height: 75%;
}
.profile-modal .postboard h2
{
width: auto;
}
.profile-modal .postboard-posts
{
display: block;
height: 90%;
overflow: auto;
}
.profile-modal .profile-card-main
{
background: #45474d;
color: white;
width:100%;
}
.profile-modal .profile-card-main a {
color: #8bb9e0;
}
.profile-modal .postboard-posts .post
{
padding: 0;
}
.profile-modal .post-interactions
{
margin: 2px 10px 3px 60px;
}
.profile-modal .profile-card
{
margin: 0;
padding: 0;
}
/*
.profile-card-main
{
height: 200px;
}
*/
.profile-modal .direct-messages,
.profile-modal .direct-messages-with-user,
.profile-modal .follow
{
bottom: 10px;
}
h1.profile-name {
display: inline;
}
h2.profile-screen-name {
display: inline;
}
.profile-modal .modal-buttons {
display: none;
}

1574
css/orange/style.css

File diff suppressed because it is too large Load Diff

13
css/style.css

@ -378,6 +378,19 @@ input.userMenu-search-field:focus::-ms-input-placeholder {
z-index: 1; z-index: 1;
min-height: 100%; min-height: 100%;
} }
.optionsPage:after, .profileEditPage:after, .loginPage:after
{
content: '';
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: .05;
z-index: -1;
background: url('../img/wrapperBg.png') repeat;
}
.dashboard .dashboard
{ {
width: 320px; width: 320px;

45
following.html

@ -13,6 +13,7 @@
<script src="js/jquery.storageapi.js"></script> <script src="js/jquery.storageapi.js"></script>
<script src="js/jquery.a-tools-1.4.1.js"></script> <script src="js/jquery.a-tools-1.4.1.js"></script>
<script src="js/jquery.asuggest.js"></script> <script src="js/jquery.asuggest.js"></script>
<script src="js/options.js"></script>
<script src="js/mobile_abstract.js"></script> <script src="js/mobile_abstract.js"></script>
<script src="js/twister_io.js"></script> <script src="js/twister_io.js"></script>
<script src="js/polyglot.min.js"></script> <script src="js/polyglot.min.js"></script>
@ -39,8 +40,7 @@
<body> <body>
<!-- MENU SUPERIOR INIT Calm--> <!-- MENU SUPERIOR INIT-->
<div style="display:none" class="calm_menu">
<nav class="userMenu"> <nav class="userMenu">
<ul> <ul>
<li class="userMenu-home"><a href="home.html"></a></li> <li class="userMenu-home"><a href="home.html"></a></li>
@ -59,44 +59,9 @@
<!-- BUSCA --> <!-- BUSCA -->
</ul> </ul>
</nav> </nav>
</div> <!-- MENU SUPERIOR END-->
<!-- MENU SUPERIOR END Calm -->
<!-- MENU SUPERIOR INIT Original--> <div class="wrapper followingPage">
<div style="display:none" class="original_menu">
<nav class="userMenu">
<ul>
<li class="userMenu-home"><a href="home.html">Home</a></li>
<li class="userMenu-network"><a href="network.html">Network</a></li>
<li class="userMenu-profile"><a href="profile-edit.html">Profile</a></li>
<li class="userMenu-config current">
<a class="userMenu-config-dropdown" href="#">
<div class="config-menu dialog-modal">
<div class="mini-profile-info">
<div class="mini-profile-photo"><img src="img/grayed_avatar_placeholder_24.png" alt="user-photo"/></div>
<a href="#" class="mini-profile-name">Fulano da Silva</a>
<span class="mini-profile-view">View</span>
</div>
<a class="dropdown-menu-item" href="profile-edit.html">Setup account</a>
<a class="dropdown-menu-item" href="following.html">Following users</a>
<a class="dropdown-menu-item" href="network.html">Network config</a>
<a class="dropdown-menu-item" href="login.html">Change user</a>
<a class="direct-messages" href="#">Direct Messages</a>
</div>
</a>
</li>
<li class="userMenu-connections">
<a href="#">
<span class="messages-qtd" style="display:none;">12</span>
</a>
</li>
<li class="userMenu-messages">
<a href="#">
<span class="messages-qtd" style="display:none;">12</span>
</a>
</li>
</div>
<!-- MENU SUPERIOR END Original -->
<div class="wrapper">
<!-- LADO ESQUERDO DE MÓDULOS INIT --> <!-- LADO ESQUERDO DE MÓDULOS INIT -->
<div class="following"> <div class="following">

79
home.html

@ -13,6 +13,7 @@
<script src="js/jquery.storageapi.js"></script> <script src="js/jquery.storageapi.js"></script>
<script src="js/jquery.a-tools-1.4.1.js"></script> <script src="js/jquery.a-tools-1.4.1.js"></script>
<script src="js/jquery.asuggest.js"></script> <script src="js/jquery.asuggest.js"></script>
<script src="js/options.js"></script>
<script src="js/mobile_abstract.js"></script> <script src="js/mobile_abstract.js"></script>
<script src="js/twister_io.js"></script> <script src="js/twister_io.js"></script>
<script src="js/polyglot.min.js"></script> <script src="js/polyglot.min.js"></script>
@ -29,14 +30,11 @@
<script src="js/interface_home.js"></script> <script src="js/interface_home.js"></script>
<script src="js/jquery.animate-colors-min.js"></script> <script src="js/jquery.animate-colors-min.js"></script>
<script src="js/calm.js"></script> <script src="js/calm.js"></script>
<script src="js/options.js"></script>
<script src="jquery-emotions/jquery.emotions.js"></script> <script src="jquery-emotions/jquery.emotions.js"></script>
<script src="js/sjcl.js"></script> <script src="js/sjcl.js"></script>
<script src="js/img.bi.js"></script> <script src="js/img.bi.js"></script>
<script> <script>
$(function(){setInterval("networkUpdate()", 2000); homeIntInit();}) $(function(){setInterval("networkUpdate()", 2000); homeIntInit();})
changeStyle();
InitOptionsforHome();
</script> </script>
<link rel="icon" type="image/png" href="img/twister_mini.png" /> <link rel="icon" type="image/png" href="img/twister_mini.png" />
@ -44,8 +42,7 @@
<body> <body>
<!-- MENU SUPERIOR INIT CALM--> <!-- MENU SUPERIOR INIT-->
<div style="display:none" class="calm_menu">
<nav class="userMenu"> <nav class="userMenu">
<ul> <ul>
<li class="userMenu-home"><a href="#"></a></li> <li class="userMenu-home"><a href="#"></a></li>
@ -95,82 +92,10 @@
</li> </li>
</ul> </ul>
</div> </div>
</li> </li>
</ul> </ul>
</nav> </nav>
</div>
<!-- MENU SUPERIOR END --> <!-- MENU SUPERIOR END -->
<!-- MENU SUPERIOR INIT ORIGINAL-->
<div style="display:none" class="original_menu">
<nav class="userMenu">
<ul>
<li class="userMenu-home current"><a href="#">Home</a></li>
<li class="userMenu-network"><a href="network.html">Network</a></li>
<li class="userMenu-profile"><a href="profile-edit.html">Profile</a></li>
<li class="userMenu-config">
<a class="userMenu-config-dropdown" href="#">
<div class="config-menu dialog-modal">
<div class="mini-profile-info">
<div class="mini-profile-photo"><img src="img/grayed_avatar_placeholder_24.png" alt="user-photo"/></div>
<a href="#" class="mini-profile-name">Fulano da Silva</a>
<span class="mini-profile-view">View</span>
</div>
<a class="dropdown-menu-item" href="options.html">Options</a>
<a class="dropdown-menu-item" href="profile-edit.html">Setup account</a>
<a class="dropdown-menu-item" href="following.html">Following users</a>
<a class="dropdown-menu-item" href="network.html">Network config</a>
<a class="dropdown-menu-item" href="login.html">Change user</a>
<a class="dropdown-menu-item promoted-posts-only" href="#">Switch to Promoted posts</a>
<a class="direct-messages dropdown-menu-item" href="#">Direct Messages</a>
</div>
</a>
</li>
<li class="userMenu-connections">
<a href="#">
<span class="messages-qtd" style="display:none;">12</span>
</a>
</li>
<li class="userMenu-messages">
<a href="#">
<span class="messages-qtd" style="display:none;">12</span>
</a>
</li>
<!-- BUSCA -->
<li class="userMenu-search">
<input type="text" class="userMenu-search-field" placeholder="search"/>
<div class="search-results dialog-modal">
<ul class="userMenu-search-sugestions" style="display: none;">
<li><a href="#">Fulano</a></li>
<li><a href="#">Outro Fulano</a></li>
<li><a href="#">Mais outro</a></li>
</ul>
<ul class="userMenu-search-profiles">
<li id="search-profile-template" style="display: none;">
<div class="mini-profile-info" data-screen-name="">
<a href="#" class="open-profile-modal">
<img class="mini-profile-photo" src="img/grayed_avatar_placeholder_24.png" alt="user-photo"/>
<span class="mini-screen-name">@<b></b></span>
<span class="mini-profile-name"></span>
</a>
<button class="follow">Follow</button>
</div>
</li>
</ul>
</div>
</li>
</ul>
</nav></div>
<!-- MENU SUPERIOR END ORIGINAL-->
<div class="wrapper"> <div class="wrapper">

BIN
img/wrapperBg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

7
js/calm.js

@ -1,10 +1,15 @@
$(function(){ $(function(){
$('.post-text, #descWrap').on('click', 'a', function(e){e.stopPropagation();}); $('.post-text, #descWrap').on('click', 'a', function(e){e.stopPropagation();});
$('#showqr').on('click', function(){ $('#showqr').on('click', function(){
if($('#qrcode img')[0]) return; if($('#qrcode img')[0]) {
$('#qrcode').empty();
return;
};
var skey = document.getElementById('skey').innerText; var skey = document.getElementById('skey').innerText;
new QRCode(document.getElementById("qrcode"), skey); new QRCode(document.getElementById("qrcode"), skey);
}); });
$('.tox-ctc').on('click', function(){ $('.tox-ctc').on('click', function(){
window.prompt('Press Ctrl/Cmd+C to copy then Enter to close', $(this).attr('data')) window.prompt('Press Ctrl/Cmd+C to copy then Enter to close', $(this).attr('data'))
}) })

25
js/interface_common.js

@ -400,7 +400,7 @@ var unfocusThis = function()
} }
function replyTextKeypress(e) { function replyTextKeypress(e) {
e = e || event; var e = e || event;
var $this = $( this ); var $this = $( this );
var tweetForm = $this.parents("form"); var tweetForm = $this.parents("form");
if( tweetForm != undefined ) { if( tweetForm != undefined ) {
@ -418,24 +418,32 @@ function replyTextKeypress(e) {
} else { } else {
$.MAL.disableButton(tweetAction); $.MAL.disableButton(tweetAction);
} }
}
}
var replyTextSendKeys = function(e) {
var $this = $(this);
var tweetAction = $this.parents("form").find('.post-submit');
if(localStorage['keysSend'] == 1 && $('.dropdown-menu').css('display') == 'none'){ if($.Options.getOption('keysSend', 2) === 1){
if (e.keyCode === 13 && (!e.metaKey && !e.ctrlKey)) { if (!(e.metaKey || e.ctrlKey) && e.keyCode === 13) {
$this.val($this.val().trim()); $this.val($this.val().trim());
if( !tweetAction.hasClass("disabled")) { if( !tweetAction.hasClass("disabled")) {
tweetAction.click(); tweetAction.click();
} }
}else if((e.metaKey || e.ctrlKey) && e.keyCode === 13){
e.preventDefault();
var val = $this.val();
$this.val(val += '\r')
} }
}else if(localStorage['keysSend'] == 2){ }else if($.Options.getOption('keysSend', 2) === 2){
if (e.keyCode === 13 && (e.metaKey || e.ctrlKey)) { if ((e.metaKey || e.ctrlKey) && e.keyCode === 13) {
$this.val($this.val().trim()); $this.val($this.val().trim());
if( !tweetAction.hasClass("disabled") ) { if( !tweetAction.hasClass("disabled") ) {
tweetAction.click(); tweetAction.click();
} }
} }
} }
}
} }
var postSubmit = function(e) var postSubmit = function(e)
@ -499,7 +507,8 @@ function initInterfaceCommon() {
$( ".modal-propagate").click( retweetSubmit ); $( ".modal-propagate").click( retweetSubmit );
var $replyText = $( ".post-area-new textarea" ); var $replyText = $( ".post-area-new textarea" );
$replyText.on("keyup", replyTextKeypress ); $replyText.on('keyup', replyTextKeypress );
$replyText.on('keydown', replyTextSendKeys);
$( ".open-profile-modal").bind( "click", openProfileModal ); $( ".open-profile-modal").bind( "click", openProfileModal );
$( ".open-hashtag-modal").bind( "click", openHashtagModal ); $( ".open-hashtag-modal").bind( "click", openHashtagModal );

5
js/interface_localization.js

@ -6,8 +6,7 @@
// translators: add your language code here such as "es" for Spanish, "ru" for Russian // 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","uk"], preferredLanguage; var knownLanguages = ["en","es","nl","it","fr","ru","de","zh","ja","pt-BR","tr","uk"], preferredLanguage;
if(!localStorage['locLang'] || localStorage['locLang'] == 'auto'){ if($.Options.getOption('locLang', 'auto') === 'auto'){
if(!localStorage['locLang']) localStorage['locLang'] = 'auto';
// detect language with JavaScript // detect language with JavaScript
preferredLanguage = window.navigator.userLanguage || window.navigator.language || "en"; preferredLanguage = window.navigator.userLanguage || window.navigator.language || "en";
if(knownLanguages.indexOf(preferredLanguage) > -1){ if(knownLanguages.indexOf(preferredLanguage) > -1){
@ -23,7 +22,7 @@ if(!localStorage['locLang'] || localStorage['locLang'] == 'auto'){
preferredLanguage = "en"; preferredLanguage = "en";
} }
}else{ }else{
preferredLanguage = localStorage['locLang']; preferredLanguage = $.Options.getOption('locLang', 'en');
} }
// set up Polyglot // set up Polyglot
polyglot = new Polyglot(); polyglot = new Polyglot();

16
js/mobile_abstract.js

@ -94,7 +94,7 @@ var MAL = function()
newTweetsBar.text("Refresh"); newTweetsBar.text("Refresh");
} }
} else { } else {
var newTweetsBar = $(".postboard-news"); var newTweetsBar = $(".wrapper").find(".postboard-news");
if( newPosts ) { if( newPosts ) {
document.title = "(" + String(newPosts) + ") twister"; document.title = "(" + String(newPosts) + ") twister";
newTweetsBar.text(String(newPosts) + " new posts"); newTweetsBar.text(String(newPosts) + " new posts");
@ -351,6 +351,20 @@ var MAL = function()
window.location.href = "home.html"; 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; jQuery.MAL = new MAL;

129
js/options.js

@ -1,12 +1,23 @@
$(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() {
function soundNotifOptions() {
if(!localStorage['sndDM']) localStorage['sndDM'] = false;
if(!localStorage['sndMention']) localStorage['sndMention'] = false;
$('.sndOpt').each(function(){ $('.sndOpt').each(function(){
this.value = localStorage[this.id]; this.value = $.Options.getOption(this.id, 'false');
}); });
var player = $('#player'); var player = $('#player');
@ -15,7 +26,7 @@ function soundNotifOptions() {
$('.sndOpt').on('change',function(){ $('.sndOpt').on('change',function(){
localStorage.setItem(this.id, this.value); $.Options.setOption(this.id, this.value);
if(this.value == false) {player[0].pause(); return;} if(this.value == false) {player[0].pause(); return;}
if (player[0].canPlayType('audio/mpeg;')) { if (player[0].canPlayType('audio/mpeg;')) {
@ -28,23 +39,24 @@ function soundNotifOptions() {
player[0].play(); player[0].play();
}); });
} }
function volumeControl () { this.volumeControl = function() {
var playerVol = $('#playerVol'); var playerVol = $('#playerVol');
if(!localStorage[playerVol[0].id]) localStorage[playerVol[0].id] = 1;
playerVol[0].value = localStorage[playerVol[0].id]; playerVol[0].value = $.Options.getOption(playerVol[0].id, 1)
$('.volValue').text((localStorage[playerVol[0].id] * 100).toFixed());
$('.volValue').text((playerVol[0].value * 100).toFixed());
playerVol.on('change',function(){ playerVol.on('change',function(){
localStorage.setItem(this.id, this.value); $.Options.setOption(this.id, this.value)
$('#player')[0].volume = (this.value); $('#player')[0].volume = (this.value);
$('.volValue').text((this.value * 100).toFixed()); $('.volValue').text((this.value * 100).toFixed());
}); });
} }
function DMsNotif() { this.DMsNotif = function() {
if(localStorage['sndDM'] == "false") return; if($.Options.getOption('sndDM', 'false') === "false") return;
var player = $('#player'); var player = $('#player');
$('#player').empty(); $('#player').empty();
@ -55,12 +67,13 @@ function DMsNotif() {
player.attr('type', 'audio/ogg'); player.attr('type', 'audio/ogg');
player.attr('src', 'sound/'+localStorage['sndDM']+'.ogg'); player.attr('src', 'sound/'+localStorage['sndDM']+'.ogg');
} }
player[0].volume = localStorage['playerVol']; player[0].volume = $.Options.getOption('playerVol', 1);
player[0].play(); player[0].play();
} }
this.mensNotif = function() {
if($.Options.getOption('sndMention', 'false' === 'false')) return;
function mensNotif() {
if(localStorage['sndMention'] == "false") return;
var player = $('#player'); var player = $('#player');
$('#playerSec').empty(); $('#playerSec').empty();
@ -71,58 +84,44 @@ function mensNotif() {
player.attr('type', 'audio/ogg'); player.attr('type', 'audio/ogg');
player.attr('src', 'sound/'+localStorage['sndMention']+'.ogg'); player.attr('src', 'sound/'+localStorage['sndMention']+'.ogg');
} }
player[0].volume = localStorage['playerVol']; player[0].volume = $.Options.getOption('playerVol', 1);
player[0].play(); player[0].play();
}; };
function keysSend() { this.keysSend = function() {
if(!localStorage['keysSend']) localStorage['keysSend'] = 1;
$('#keysSend')[0].value = localStorage['keysSend']; $('#keysSend')[0].value = $.Options.getOption('keysSend', 2)
$('#keysSend').on('change', function(){ $('#keysSend').on('change', function(){
localStorage[this.id] = this.value; $.Options.setOption(this.id, this.value);
}) })
} }
function setLang() {
$('#language').val(localStorage['locLang'] || 'auto') this.locLang = function() {
$('#language').on('change', function(){ $('#locLang').val($.Options.getOption('locLang', 'auto'))
localStorage['locLang'] = $(this).val(); $('#locLang').on('change', function(){
$.Options.setOption(this.id, this.value);
location.reload(); location.reload();
}) })
} }
function setTheme() {
if(!localStorage['theme']) localStorage['theme'] = 'calm';
$('#theme').val(localStorage['theme']).on('change', function(){
localStorage['theme'] = $(this).val();
location.reload();
});
}
function setShowPreviewOpt(){ this.showPreviewOpt = function() {
if(!localStorage['imagesPreview']) localStorage['imagesPreview'] = 'enable';
if(!localStorage['imagesPreviewGif']) localStorage['imagesPreviewGif'] = 'true';
if(!localStorage['youtubePreview']) localStorage['youtubePreview'] = 'enable';
if(!localStorage['vimeoPreview']) localStorage['vimeoPreview'] = 'enable';
$('.previewOpt').each(function() { $('.previewOpt').each(function() {
this.value = localStorage[this.id]; this.value = $.Options.getOption(this.id, 'enable');
}) })
$('.gifCheckBox').prop('checked', localStorage['imagesPreviewGif'] === 'true') $('.gifCheckBox').prop('checked', $.Options.getOption('imagesPreviewGif', 'true'))
if(localStorage['imagesPreview'] == 'disable'){ if($.Options.getOption('imagesPreview', 'enable') === 'disable'){
$('input[type="checkbox"]').prop('disabled', localStorage['imagesPreviewGif']) $('input[type="checkbox"]').prop('disabled', 'true')
} }
$('.previewOpt').on('change', function(){ $('.previewOpt').on('change', function(){
localStorage[this.id] = $(this).val(); $.Options.setOption(this.id, this.value)
if (this.id === 'imagesPreview'){ if (this.id === 'imagesPreview'){
switch($(this).val()){ switch(this.value){
case 'enable': $('.gifCheckBox').prop('disabled', false); break; case 'enable': $('.gifCheckBox').prop('disabled', false); break;
case 'disable': $('.gifCheckBox').prop('disabled', true); break; case 'disable': $('.gifCheckBox').prop('disabled', true); break;
} }
@ -130,18 +129,18 @@ function setShowPreviewOpt(){
}) })
$('input[type="checkbox"]').on('click', function(){ $('input[type="checkbox"]').on('click', function(){
localStorage[$(this).attr('name')] = $(this).prop('checked') $.Options.setOption(this.name, this.checked)
}) })
} }
this.initOptions = function() {
this.soundNotifOptions();
this.volumeControl();
this.keysSend();
this.locLang();
this.showPreviewOpt();
}
function InitOptions() {
soundNotifOptions();
volumeControl();
keysSend();
setLang();
setTheme();
setShowPreviewOpt();
}
function InitOptionsforHome() {
setShowPreviewOpt();
} }
jQuery.Options = new TwisterOptions;

11
js/twister_formatpost.js

@ -107,15 +107,15 @@ function postToElem( post, kind ) {
var ytRegExp = /(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?/i; var ytRegExp = /(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?/i;
var vimeoRegExp = /http[s]?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/i; var vimeoRegExp = /http[s]?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/i;
if (postLink && localStorage['imagesPreview'] == 'enable' && (/(\.jpg)|(\.gif)|(\.png)|(\.jpeg)|(\.jpe)/i.test(postLink) || /https:\/\/img.bi/i.test(postLink))){ if (postLink && $.Options.getOption('imagesPreview', 'enable') === 'enable' && (/(\.jpg)|(\.gif)|(\.png)|(\.jpeg)|(\.jpe)/i.test(postLink) || /https:\/\/img.bi/i.test(postLink))){
previewContainer.show(); previewContainer.show();
previewContainer.append(imagePreview(postLink)); previewContainer.append(imagePreview(postLink));
}else if(postLink && ytRegExp.test(postLink) && localStorage['youtubePreview'] === 'enable'){ }else if(postLink && ytRegExp.test(postLink) && $.Options.getOption('youtubePreview', 'enable') === 'enable'){
var ytid = postLink.match(ytRegExp) ? RegExp.$1 : false; var ytid = postLink.match(ytRegExp) ? RegExp.$1 : false;
previewContainer.show(); previewContainer.show();
previewContainer.attr('data-youtube-id', ytid); previewContainer.attr('data-youtube-id', ytid);
previewContainer.append(getYoutubePreview(postLink, ytid)); previewContainer.append(getYoutubePreview(postLink, ytid));
}else if(postLink && vimeoRegExp.test(postLink) && localStorage['vimeoPreview'] === 'enable'){ }else if(postLink && vimeoRegExp.test(postLink) && $.Options.getOptions('vimeoPreview', 'enable') === 'enable'){
var vimid = postLink.match(vimeoRegExp) ? RegExp.$2 : false; var vimid = postLink.match(vimeoRegExp) ? RegExp.$2 : false;
previewContainer.show(); previewContainer.show();
previewContainer.attr('data-vimeo-id', vimid); previewContainer.attr('data-vimeo-id', vimid);
@ -314,8 +314,9 @@ function imagePreview(link) {
return '<img data-imgbi="'+link+'" class="image-preview" />'; return '<img data-imgbi="'+link+'" class="image-preview" />';
//imgBiJS(); //imgBiJS();
}else{ }else{
var cleanLink = link.replace(/^http[s]?:\/\//i, ''); var cleanLink;
if(/\.gif\b/i.test(cleanLink) && localStorage['imagesPreviewGif'] == 'false') return; if(/\.gif\b/i.test(cleanLink) && $.Options.getOption('imagesPreviewGif', 'true') === 'false') return;
cleanLink = link.replace(/^http[s]?:\/\//i, '');
return '<img src="'+linkAnon+cleanLink+'" class="image-preview" />'; return '<img src="'+linkAnon+cleanLink+'" class="image-preview" />';
} }
} }

8
js/twister_newmsgs.js

@ -18,17 +18,21 @@ function processMention(user, mentionTime, data) {
if( mentionTime > curTime + 3600 ) { if( mentionTime > curTime + 3600 ) {
console.log("mention from the future will be ignored"); console.log("mention from the future will be ignored");
} else { } else {
var newMentionsUpdated = false;
if( !(key in _knownMentions) ) { if( !(key in _knownMentions) ) {
mensNotif(); // sound notification
// mention must be somewhat recent compared to last known one to be considered new // mention must be somewhat recent compared to last known one to be considered new
if( mentionTime + 3600 > _lastMentionTime ) { if( mentionTime + 3600 > _lastMentionTime ) {
_newMentions++; _newMentions++;
newMentionsUpdated = true;
_lastMentionTime = mentionTime; _lastMentionTime = mentionTime;
} }
_knownMentions[key] = {mentionTime:mentionTime, data:data}; _knownMentions[key] = {mentionTime:mentionTime, data:data};
purgeOldMentions(); purgeOldMentions();
saveMentionsToStorage(); saveMentionsToStorage();
} }
if(newMentionsUpdated){
$.MAL.soundNotifyMentions();
}
} }
} }
@ -158,7 +162,7 @@ function getNewDMsCount() {
} }
} }
for (key in _newDMsPerUser){if(_newDMsPerUser[key] * 1)reslt = true}; for (key in _newDMsPerUser){if(_newDMsPerUser[key] * 1)reslt = true};
if(newDMs > 0 && reslt) DMsNotif(); //sound notification if(newDMs > 0 && reslt) $.MAL.soundNotifyDM();
return newDMs; return newDMs;
} }

30
login.html

@ -11,6 +11,7 @@
<script src="js/jquery.json-2.4.js"></script> <script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script> <script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.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/mobile_abstract.js"></script>
<script src="js/twister_io.js"></script> <script src="js/twister_io.js"></script>
<script src="js/twister_network.js"></script> <script src="js/twister_network.js"></script>
@ -19,7 +20,6 @@
<script src="js/interface_login.js"></script> <script src="js/interface_login.js"></script>
<script src="js/polyglot.min.js"></script> <script src="js/polyglot.min.js"></script>
<script src="js/interface_localization.js"></script> <script src="js/interface_localization.js"></script>
<script src="js/options.js"></script>
<script src="js/calm.js"></script> <script src="js/calm.js"></script>
<script> <script>
@ -32,8 +32,7 @@
<body> <body>
<!-- MENU SUPERIOR INIT CALM --> <!-- MENU SUPERIOR INIT-->
<div style="display:none" class="calm_menu">
<nav class="userMenu"> <nav class="userMenu">
<ul> <ul>
<li class="userMenu-home"><a href="home.html"></a></li> <li class="userMenu-home"><a href="home.html"></a></li>
@ -49,32 +48,11 @@
</div> </div>
</a> </a>
</li> </li>
</ul>
</nav>
</div>
<!-- MENU SUPERIOR END CALM-->
<!-- MENU SUPERIOR INIT Original-->
<div style="display:none" class="original_menu">
<nav class="userMenu">
<ul>
<li class="userMenu-home"><a href="home.html">Home</a></li>
<li class="userMenu-network"><a href="network.html">Network</a></li>
<li class="userMenu-profile current"><a href="login.html">Login</a></li>
<li class="userMenu-config">
</li>
</ul> </ul>
</nav> </nav>
</div> <!-- MENU SUPERIOR END-->
<!-- MENU SUPERIOR END Original-->
<div class="wrapper"> <div class="wrapper loginPage">
<!-- LADO ESQUERDO DE MÓDULOS INIT --> <!-- LADO ESQUERDO DE MÓDULOS INIT -->
<div class="login"> <div class="login">

49
network.html

@ -11,6 +11,7 @@
<script src="js/jquery.json-2.4.js"></script> <script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script> <script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.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/mobile_abstract.js"></script>
<script src="js/twister_io.js"></script> <script src="js/twister_io.js"></script>
<script src="js/twister_user.js"></script> <script src="js/twister_user.js"></script>
@ -33,8 +34,7 @@
<body> <body>
<!-- MENU SUPERIOR INIT Calm --> <!-- MENU SUPERIOR INIT-->
<div style="display:none" class="calm_menu">
<nav class="userMenu"> <nav class="userMenu">
<ul> <ul>
<li class="userMenu-home"><a href="home.html"></a></li> <li class="userMenu-home"><a href="home.html"></a></li>
@ -52,50 +52,7 @@
</li> </li>
</ul> </ul>
</nav> </nav>
</div> <!-- MENU SUPERIOR END-->
<!-- MENU SUPERIOR END CALM-->
<!-- MENU SUPERIOR INIT -->
<div style="display:none" class="original_menu">
<nav class="userMenu">
<ul>
<li class="userMenu-home"><a href="home.html">Home</a></li>
<li class="userMenu-network current"><a href="network.html">Network</a></li>
<li class="userMenu-profile"><a href="profile-edit.html">Profile</a></li>
<li class="userMenu-config">
<a class="userMenu-config-dropdown" href="#">
<div class="config-menu dialog-modal">
<div class="mini-profile-info">
<div class="mini-profile-photo"><img src="img/grayed_avatar_placeholder_24.png" alt="user-photo"/></div>
<a href="#" class="mini-profile-name">Fulano da Silva</a>
<span class="mini-profile-view">View</span>
</div>
<a class="dropdown-menu-item" href="options.html">Options</a>
<a class="dropdown-menu-item" href="profile-edit.html">Setup account</a>
<a class="dropdown-menu-item" href="following.html">Following users</a>
<a class="dropdown-menu-item" href="network.html">Network config</a>
<a class="dropdown-menu-item" href="login.html">Change user</a>
<a class="direct-messages" href="#">Direct Messages</a>
</div>
</a>
</li>
<li class="userMenu-connections">
<a href="#">
<span class="messages-qtd" style="display:none;">12</span>
</a>
</li>
<li class="userMenu-messages">
<a href="#">
<span class="messages-qtd" style="display:none;">12</span>
</a>
</li>
<li class="userMenu-search">
<input type="text" class="userMenu-search-field" placeholder="search"/>
</li>
</ul>
</nav>
</div>
<!-- MENU SUPERIOR END -->
<div class="wrapper"> <div class="wrapper">

53
options.html

@ -11,6 +11,7 @@
<script src="js/jquery.json-2.4.js"></script> <script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script> <script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.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/mobile_abstract.js"></script>
<script src="js/twister_io.js"></script> <script src="js/twister_io.js"></script>
<script src="js/twister_network.js"></script> <script src="js/twister_network.js"></script>
@ -20,17 +21,17 @@
<script src="js/polyglot.min.js"></script> <script src="js/polyglot.min.js"></script>
<script src="js/interface_localization.js"></script> <script src="js/interface_localization.js"></script>
<script src="js/calm.js"></script> <script src="js/calm.js"></script>
<script src="js/options.js"></script>
<script> <script>
$(function(){initInterfaceCommon(); InitOptions()}); $(function(){
changeStyle(); initInterfaceCommon();
$.Options.initOptions()
});
</script> </script>
</head> </head>
<body> <body>
<!-- MENU SUPERIOR INIT Calm--> <!-- MENU SUPERIOR INIT-->
<div style="display:none" class="calm_menu">
<nav class="userMenu"> <nav class="userMenu">
<ul> <ul>
<li class="userMenu-home"><a href="home.html"></a></li> <li class="userMenu-home"><a href="home.html"></a></li>
@ -48,36 +49,14 @@
</li> </li>
</ul> </ul>
</nav> </nav>
</div> <!-- MENU SUPERIOR END-->
<!-- MENU SUPERIOR END Calm-->
<!-- MENU SUPERIOR INIT Original-->
<div style="display:none" class="original_menu">
<nav class="userMenu">
<ul>
<li class="userMenu-home"><a href="home.html"></a></li>
<li class="userMenu-options current"><a href="options.html">Options</a></li>
<li class="userMenu-config">
<a class="userMenu-config-dropdown" href="#">
<div class="config-menu dialog-modal">
<a class="dropdown-menu-item" href="options.html">Options</a>
<a class="dropdown-menu-item" href="network.html">Network config</a>
<a class="dropdown-menu-item" href="profile-edit.html">Setup account</a>
<a class="dropdown-menu-item" href="following.html">Following users</a>
<a class="dropdown-menu-item" href="login.html">Change user</a>
</div>
</a>
</li>
</ul>
</nav>
</div>
<!-- MENU SUPERIOR END Original-->
<div class="wrapper optionsPage"> <div class="wrapper optionsPage">
<div class="module"> <div class="module">
<h1>Use language</h1> <h1>Use language</h1>
<div> <div>
<select name="" id="language"> <select name="" id="locLang">
<option value="auto">Auto</option> <option value="auto">Auto</option>
<option value="pt-BR">Braz. Portuguese</option> <option value="pt-BR">Braz. Portuguese</option>
<option value="zh">Chinese</option> <option value="zh">Chinese</option>
@ -94,16 +73,6 @@
</div> </div>
</div> </div>
<div class="module">
<h1>Theme</h1>
<div>
<select name="" id="theme">
<option value="calm">Calm</option>
<option value="original">Original</option>
</select>
</div>
</div>
<div class="module"> <div class="module">
<h1>Sound notifications</h1> <h1>Sound notifications</h1>
<h2>Mentions</h2> <h2>Mentions</h2>
@ -141,19 +110,19 @@
<h1>Media links preview</h1> <h1>Media links preview</h1>
<h2>Images preview</h2> <h2>Images preview</h2>
<select name="" id="imagesPreview" class="previewOpt"> <select name="" id="imagesPreview" class="previewOpt">
<option value="disable">Disable</option>
<option value="enable">Enable</option> <option value="enable">Enable</option>
<option value="disable">Disable</option>
</select> </select>
<label><span>Display GIF images</span><input class="gifCheckBox" type="checkbox" name="imagesPreviewGif"></label> <label><span>Display GIF images</span><input class="gifCheckBox" type="checkbox" name="imagesPreviewGif"></label>
<h2>Youtube links preview</h2> <h2>Youtube links preview</h2>
<select name="" id="youtubePreview" class="previewOpt"> <select name="" id="youtubePreview" class="previewOpt">
<option value="disable">Disable</option>
<option value="enable">Enable</option> <option value="enable">Enable</option>
<option value="disable">Disable</option>
</select> </select>
<h2>Vimeo links preview</h2> <h2>Vimeo links preview</h2>
<select name="" id="vimeoPreview" class="previewOpt"> <select name="" id="vimeoPreview" class="previewOpt">
<option value="disable">Disable</option>
<option value="enable">Enable</option> <option value="enable">Enable</option>
<option value="disable">Disable</option>
</select> </select>
</div> </div>

6
profile-edit.html

@ -11,6 +11,7 @@
<script src="js/jquery.json-2.4.js"></script> <script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script> <script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.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/mobile_abstract.js"></script>
<script src="js/twister_io.js"></script> <script src="js/twister_io.js"></script>
<script src="js/polyglot.min.js"></script> <script src="js/polyglot.min.js"></script>
@ -54,7 +55,7 @@
<!-- MENU SUPERIOR END --> <!-- MENU SUPERIOR END -->
<div class="wrapper"> <div class="wrapper profileEditPage">
<!-- ÁREA DE PROFILE PHOTO INIT --> <!-- ÁREA DE PROFILE PHOTO INIT -->
<div class="profile-card forEdition"> <div class="profile-card forEdition">
@ -78,9 +79,10 @@
<div style="font-size:80%;text-align: center;" class="secret-key-container"> <div style="font-size:80%;text-align: center;" class="secret-key-container">
<span class="label">Secret key:</span> <div id="skey"><span class="secret-key"></span></div> <span class="label">Secret key:</span> <div id="skey"><span class="secret-key"></span></div>
<button href="#" id="showqr">Show QR code</button> <button href="#" id="showqr">Show QR code</button>
<div align="center" id="qrcode"></div>
</div> </div>
<div align="center" id="qrcode"></div>
</div> </div>

Loading…
Cancel
Save