Simple mp3 player

This commit is contained in:
RainLoop Team 2015-04-10 12:17:49 +04:00
parent 351c12c002
commit 1d943356f5
23 changed files with 336 additions and 121 deletions

View file

@ -170,6 +170,23 @@
this.attachmentsInProcessError = ko.observable(false);
this.attachmentsInErrorError = ko.observable(false);
this.attachmentsErrorTooltip = ko.computed(function () {
var sResult = '';
switch (true)
{
case this.attachmentsInProcessError():
sResult = Translator.i18n('COMPOSE/ATTACHMENTS_UPLOAD_ERROR_DESC');
break;
case this.attachmentsInErrorError():
sResult = Translator.i18n('COMPOSE/ATTACHMENTS_ERROR_DESC');
break;
}
return sResult;
}, this);
this.showCc = ko.observable(false);
this.showBcc = ko.observable(false);
this.showReplyTo = ko.observable(false);
@ -326,6 +343,10 @@
aFlagsCache = []
;
this.attachmentsInProcessError(false);
this.attachmentsInErrorError(false);
this.emptyToError(false);
if (0 < this.attachmentsInProcess().length)
{
this.attachmentsInProcessError(true);
@ -336,11 +357,13 @@
this.attachmentsInErrorError(true);
this.attachmentsPlace(true);
}
else if (0 === sTo.length)
if (0 === sTo.length)
{
this.emptyToError(true);
}
else
if (!this.emptyToError() && !this.attachmentsInErrorError() && !this.attachmentsInProcessError())
{
if (SettingsStore.replySameFolder())
{

View file

@ -11,7 +11,9 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Links = require('Common/Links'),
Events = require('Common/Events'),
AppStore = require('Stores/User/App'),
AccountStore = require('Stores/User/Account'),
MessageStore = require('Stores/User/Message'),
@ -28,6 +30,8 @@
{
AbstractView.call(this, 'Right', 'SystemDropDown');
this.currentAudio = AppStore.currentAudio;
this.accountEmail = AccountStore.email;
this.accounts = AccountStore.accounts;
@ -37,10 +41,25 @@
this.capaAdditionalAccounts = ko.observable(Settings.capa(Enums.Capa.AdditionalAccounts));
this.accountClick = _.bind(this.accountClick, this);
this.accountClick = _.bind(this.accountClick, this);
Events.sub('audio.stop', function () {
AppStore.currentAudio('');
});
Events.sub('audio.start', function (sName) {
AppStore.currentAudio(sName);
});
}
_.extend(AbstractSystemDropDownUserView.prototype, AbstractView.prototype);
AbstractSystemDropDownUserView.prototype.stopPlay = function ()
{
Events.pub('audio.api.stop');
};
AbstractSystemDropDownUserView.prototype.accountClick = function (oAccount, oEvent)
{
if (oAccount && oEvent && !Utils.isUnd(oEvent.which) && 1 === oEvent.which)

View file

@ -18,6 +18,7 @@
Utils = require('Common/Utils'),
Events = require('Common/Events'),
Translator = require('Common/Translator'),
Audio = require('Common/Audio'),
Cache = require('Common/Cache'),
@ -734,6 +735,18 @@
oEvent.stopPropagation();
}
})
.on('click', '.attachmentsPlace .showPreplay', function (oEvent) {
if (oEvent && oEvent.stopPropagation)
{
oEvent.stopPropagation();
}
var oAttachment = ko.dataFor(this);
if (oAttachment && oAttachment.isMp3() && Audio.supported)
{
Audio.playMp3(oAttachment.linkDownload(), oAttachment.fileName);
}
})
.on('click', '.thread-list .more-threads', function (e) {
var oLast = null;