Skip to content

Commit

Permalink
Switch from JS to CSS animation
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaursu committed Jan 3, 2015
1 parent 50200d8 commit 0fb6767
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 58 deletions.
4 changes: 2 additions & 2 deletions jsxc.css
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ div#jsxc_roster .jsxc_wait {
z-index: 60;
}

div#jsxc_roster .jsxc_wait img {
#jsxc_roster .jsxc_wait img {
padding: 5px;
}

div#jsxc_roster .jsxc_wait h3 {
#jsxc_roster .jsxc_wait h3 {
margin-bottom: 5px;
font-size: 1.13em;
font-weight: bold;
Expand Down
63 changes: 7 additions & 56 deletions jsxc.lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -2015,16 +2015,6 @@ var jsxc;
jsxc.gui.toggleList.call($(this));
});

if (jsxc.storage.getUserItem('roster') === 'hidden') {
$('#jsxc_roster').css('right', '-200px');
$('#jsxc_windowList > ul').css('paddingRight', '22px');
$('#jsxc_toggleRoster_text').addClass('entypo chevron-thin-left');
$('body > .container').addClass('chat-roster-hidden');
} else {
$('#jsxc_toggleRoster_text').addClass('entypo chevron-thin-right');
$('body > .container').addClass('chat-roster-shown');
}

var pres = jsxc.storage.getUserItem('presence') || 'online';
$('#jsxc_presence > span').text($('#jsxc_presence > ul .jsxc_' + pres).text());
jsxc.gui.updatePresence('own', pres);
Expand Down Expand Up @@ -2238,41 +2228,6 @@ var jsxc;
jsxc.storage.updateUserItem('buddy', bid, 'name', newname);
jsxc.gui.update(bid);
},

/**
* Toogle complete roster
*
* @param {Integer} d Duration in ms
*/
toggle: function(d) {
var duration = d || 500;

var roster = $('#jsxc_roster');
var wl = $('#jsxc_windowList');

var roster_width = roster.innerWidth();
var roster_right = parseFloat($('#jsxc_roster').css('right'));
var state = (roster_right < 0) ? 'shown' : 'hidden';
var iconToDisplay = (roster_right < 0) ? 'right' : 'left';

jsxc.storage.setUserItem('roster', state);

// remove toggle icon
$('#jsxc_toggleRoster_text').removeClass('entypo chevron-thin-left chevron-thin-right');
// set class of the diaspora* container
$('body > .container').removeClass('chat-roster-shown chat-roster-hidden')
.addClass('chat-roster-'+state);
roster.animate({
right: ((roster_width + roster_right) * -1) + 'px'
}, duration);
wl.animate({
right: (10 - roster_right) + 'px'
}, duration);

$(document).trigger('toggle.roster.jsxc', [ state, duration ]);
$('#jsxc_toggleRoster_text').addClass('entypo chevron-thin-' + iconToDisplay);
},

/**
* Shows a text with link to a login box that no connection exists.
*/
Expand Down Expand Up @@ -3034,9 +2989,12 @@ var jsxc;
</div>\
</div>\
</li>',
roster: '<div id="jsxc_roster">\
<ul id="jsxc_buddylist"></ul>\
<div class="jsxc_bottom jsxc_presence" data-bid="own">\
roster: '<input type="checkbox" id="jsxc_toggleRoster_text">\
<div id="jsxc_roster">\
<label id="jsxc_toggleRoster" for="jsxc_toggleRoster_text"></label>\
<span class="entypo"></span>\
<ul id="jsxc_buddylist"></ul>\
<div class="jsxc_bottom jsxc_presence" data-bid="own">\
<div id="jsxc_avatar">\
<div class="jsxc_avatar">☺</div>\
</div>\
Expand Down Expand Up @@ -3066,10 +3024,7 @@ var jsxc;
<!-- <li data-pres="offline" class="jsxc_offline">%%Offline%%</li> -->\
</ul>\
</div>\
</div>\
<div id="jsxc_toggleRoster">\
<span id="jsxc_toggleRoster_text"></span>\
</div>\
</div>\
</div>',
windowList: '<div id="jsxc_windowList">\
<ul></ul>\
Expand Down Expand Up @@ -4530,10 +4485,6 @@ var jsxc;
jsxc.xmpp.addBuddy(n.username, n.alias);
}*/

if (key === 'roster') {
jsxc.gui.roster.toggle();
}

if (jsxc.master && key.match(new RegExp('^vcard' + jsxc.storage.SEP)) && e.newValue !== null && e.newValue.match(/^request:/)) {

jsxc.xmpp.loadVcard(bid, function(stanza) {
Expand Down

0 comments on commit 0fb6767

Please sign in to comment.