Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rello committed Jun 30, 2019
2 parents ce9df7b + 2454021 commit 998e10d
Show file tree
Hide file tree
Showing 12 changed files with 449 additions and 415 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.js
Expand Up @@ -6,13 +6,16 @@ module.exports = {
},
'extends': 'eslint:recommended',
'globals': {
'_': 'readonly', // from js/dist/main.js
'OC': 'readonly',
'OCA': 'readonly',
'OCdialogs': 'readonly', // from /js/core/merged-template-prepend.js
't': 'readonly'
},
'parserOptions': {
'ecmaFeatures': 'impliedStrict',
'ecmaVersion': 6,
'sourceType': 'module'
'sourceType': 'script'
},
'rules': {
'brace-style': [
Expand Down
728 changes: 367 additions & 361 deletions js/app.js

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions js/bar-ui.js
Expand Up @@ -846,7 +846,8 @@

onplay: function() {
utils.css.swap(dom.o, 'paused', 'playing');
if ($this.PlaylistContainer.data('playlist') === $this.ActivePlaylist.data('playlist')) {
var ap = soundManager.audiosInstance;
if (ap.PlaylistContainer.data('playlist') === ap.ActivePlaylist.data('playlist')) {
$('.albumwrapper li').removeClass('isActive');
$('.albumwrapper li i.ioc').hide();
$('.albumwrapper li i.icon').show();
Expand All @@ -859,15 +860,17 @@

onpause: function() {
utils.css.swap(dom.o, 'playing', 'paused');
if ($this.PlaylistContainer.data('playlist') === $this.ActivePlaylist.data('playlist')) {
var ap = soundManager.audiosInstance;
if (ap.PlaylistContainer.data('playlist') === ap.ActivePlaylist.data('playlist')) {
$('.albumwrapper li i.icon').eq(playlistController.data.selectedIndex).hide();
$('.albumwrapper li i.ioc').eq(playlistController.data.selectedIndex).removeClass('ioc-volume-up').addClass('ioc-volume-off').show();
}
},

onresume: function() {
utils.css.swap(dom.o, 'paused', 'playing');
if ($this.PlaylistContainer.data('playlist') === $this.ActivePlaylist.data('playlist')) {
var ap = soundManager.audiosInstance;
if (ap.PlaylistContainer.data('playlist') === ap.ActivePlaylist.data('playlist')) {
$('.albumwrapper li i.icon').eq(playlistController.data.selectedIndex).hide();
$('.albumwrapper li i.ioc').eq(playlistController.data.selectedIndex).removeClass('ioc-volume-off').addClass('ioc-volume-up').show();
}
Expand Down Expand Up @@ -962,7 +965,7 @@
// **********************************************************
// Notify Audio Player about next track e.g. for cover updates
// **********************************************************
$this.soundmanagerCallback('onfinish');
soundManager.audiosInstance.soundmanagerCallback('onfinish');

// play next
this.play({
Expand Down Expand Up @@ -1406,7 +1409,7 @@
// **********************************************************
// Notify Audio Player about next track e.g. for cover updates
// **********************************************************
$this.soundmanagerCallback('next');
soundManager.audiosInstance.soundmanagerCallback('next');
}
}
},
Expand All @@ -1425,7 +1428,7 @@
// **********************************************************
// Notify Audio Player about next track e.g. for cover updates
// **********************************************************
$this.soundmanagerCallback('prev');
soundManager.audiosInstance.soundmanagerCallback('prev');
}
}
},
Expand Down Expand Up @@ -1533,7 +1536,7 @@
// **********************************************************
// Notify Audio Player about next track e.g. for cover updates
// **********************************************************
$this.soundmanagerCallback('setVolume');
soundManager.audiosInstance.soundmanagerCallback('setVolume');

return utils.events.preventDefault(e);

Expand Down
2 changes: 2 additions & 0 deletions js/settings/admin.js
Expand Up @@ -8,6 +8,8 @@
* @copyright 2016-2019 Marcel Scherello
*/

'use strict';

$(document).ready(function () {

$('#sonos').on('click', function () {
Expand Down
2 changes: 2 additions & 0 deletions js/settings/personal.js
Expand Up @@ -8,6 +8,8 @@
* @copyright 2016-2019 Marcel Scherello
*/

'use strict';

$(document).ready(function () {
$('#cyrillic_user').on('click', function () {
var user_value;
Expand Down
54 changes: 29 additions & 25 deletions js/settings/settings.js
Expand Up @@ -8,6 +8,11 @@
* @copyright 2016-2019 Marcel Scherello
*/

/* global Audios */
// OK because ./js/app.js is sourced before in html

'use strict';

$(document).ready(function () {

var settings_link;
Expand All @@ -27,12 +32,12 @@ $(document).ready(function () {
});

$(document).on('click', '#scanAudios, #scanAudiosFirst', function () {
myAudios.openScannerDialog();
});
OCA.Audioplayer.audiosInstance.openScannerDialog();
}.bind(OCA.Audioplayer.audiosInstance));

$(document).on('click', '#resetAudios', function () {
myAudios.openResetDialog();
});
OCA.Audioplayer.audiosInstance.openResetDialog();
}.bind(OCA.Audioplayer.audiosInstance));
});

Audios.prototype.openResetDialog = function () {
Expand All @@ -43,23 +48,23 @@ Audios.prototype.openResetDialog = function () {
OCdialogs.YES_NO_BUTTONS,
function (e) {
if (e === true) {
myAudios.resetLibrary();
this.resetLibrary();
}
},
}.bind(this),
true
);
};

Audios.prototype.resetLibrary = function () {
if ($('.sm2-bar-ui').hasClass('playing')) {
myAudios.AudioPlayer.actions.play(0);
myAudios.AudioPlayer.actions.stop();
this.AudioPlayer.actions.play(0);
this.AudioPlayer.actions.stop();
}

$this.showInitScreen();
this.showInitScreen();

$('#category_selector').val('');
$this.setUserValue('category', $this.CategorySelectors[0] + '-');
this.setUserValue('category', this.CategorySelectors[0] + '-');
$('#myCategory').html('');
$('#alben').addClass('active');
$('#individual-playlist').remove();
Expand Down Expand Up @@ -91,30 +96,29 @@ Audios.prototype.openScannerDialog = function () {

Audios.prototype.scanInit = function () {

var $this = this;
$('#audios_import_dialog').ocdialog({
width: 500,
modal: true,
resizable: false,
close: function () {
$this.scanStop();
this.scanStop();
$('#audios_import_dialog').ocdialog('destroy');
$('#audios_import').remove();
}
}.bind(this)
});

$('#audios_import_done_close').click(function () {
$this.percentage = 0;
this.percentage = 0;
$('#audios_import_dialog').ocdialog('close');
});
}.bind(this));

$('#audios_import_progress_cancel').click(function () {
$this.scanStop();
});
this.scanStop();
}.bind(this));

$('#audios_import_submit').click(function () {
$this.processScan();
});
this.processScan();
}.bind(this));

$('#audios_import_progressbar').progressbar({value: 0});
};
Expand All @@ -125,8 +129,8 @@ Audios.prototype.processScan = function () {

this.scanSend();
window.setTimeout(function () {
myAudios.scanUpdate();
}, 1500);
this.scanUpdate();
}.bind(this), 1500);
};

Audios.prototype.scanSend = function () {
Expand All @@ -136,7 +140,7 @@ Audios.prototype.scanSend = function () {
$('#audios_import_process').css('display', 'none');
$('#audios_import_done').css('display', 'block');
$('#audios_import_done_message').html(data.message);
$this.init();
this.init();
} else {
$('#audios_import_progressbar').progressbar('option', 'value', 100);
$('#audios_import_done_message').html(data.message);
Expand All @@ -145,7 +149,7 @@ Audios.prototype.scanSend = function () {
};

Audios.prototype.scanStop = function () {
$this.percentage = 0;
this.percentage = 0;
$.ajax({
type: 'POST',
url: OC.generateUrl('apps/audioplayer/scanforaudiofiles'),
Expand All @@ -168,8 +172,8 @@ Audios.prototype.scanUpdate = function () {
$('#audios_import_process_message').text(data.msg);
if (data.percent < 100) {
window.setTimeout(function () {
myAudios.scanUpdate();
}, 1500);
this.scanUpdate();
}.bind(this), 1500);
} else {
$('#audios_import_process').css('display', 'none');
$('#audios_import_done').css('display', 'block');
Expand Down
2 changes: 2 additions & 0 deletions js/sharing/sharing.js
Expand Up @@ -10,6 +10,8 @@
* @copyright 2015 Sebastian Doell
*/

'use strict';

$(document).ready(function () {
if ($('#header').hasClass('share-file')) {
var mime_array = ['audio/mpeg', 'audio/mp4', 'audio/m4b', 'audio/ogg', 'audio/wav', 'audio/flac'];
Expand Down
12 changes: 7 additions & 5 deletions js/sidebar.js
Expand Up @@ -58,7 +58,9 @@ OCA.Audioplayer.Sidebar = {

var starIcon = $('#sidebarFavorite').attr({'data-trackid': trackid});
starIcon.off();
starIcon.on('click', $this.favoriteUpdate.bind($this));
starIcon.on('click',
OCA.Audioplayer.audiosInstance.favoriteUpdate.bind(OCA.Audioplayer.audiosInstance)
);

if ($appsidebar.data('trackid') === '') {
$('#sidebarClose').on('click', OCA.Audioplayer.Sidebar.hideSidebar);
Expand Down Expand Up @@ -222,7 +224,7 @@ OCA.Audioplayer.Sidebar = {
'data-listid': audioinfo[m].playlist_id,
'data-trackid': trackid,
'title': t('audioplayer', 'Remove')
}).on('click', $this.removeSongFromPlaylist.bind($this));
}).on('click', OCA.Audioplayer.audiosInstance.removeSongFromPlaylist.bind(OCA.Audioplayer.audiosInstance));

tablerow = $('<div>').css('display', 'table-row').attr({'data-id': audioinfo[m].playlist_id});
tablekey = $('<div>').addClass('key').append(spanDelete);
Expand Down Expand Up @@ -258,8 +260,8 @@ OCA.Audioplayer.Sidebar = {
},

resetView: function () {
$('.tabHeader.selected').removeClass('selected')
$('.tab').addClass('hidden')
$('.tabHeader.selected').removeClass('selected');
$('.tab').addClass('hidden');
},

removeSongFromPlaylist: function (evt) {
Expand Down Expand Up @@ -311,7 +313,7 @@ OCA.Audioplayer.Sidebar = {
},
SONOSTabView: function () {
var trackid = $('#app-sidebar').data('trackid');
$this.resetView();
OCA.Audioplayer.audiosInstance.resetView();
$('#tabHeaderSONOS').addClass('selected');

var html = '<div style="margin-left: 2em; background-position: initial;" class="icon-info">';
Expand Down
25 changes: 15 additions & 10 deletions js/sonos.js
Expand Up @@ -8,13 +8,18 @@
* @copyright 2016-2019 Marcel Scherello
*/

/* global Audios */
// OK because ./js/app.js is sourced before in html

'use strict';

Audios.prototype.PlaySonos = function (liIndex) {

var playIndicator = $('#sonos_play');
var trackids = [];

$( '.albumwrapper li' ).each(function() {
trackid = $(this).data('trackid');
var trackid = $(this).data('trackid');
trackids.push(trackid);
});

Expand All @@ -27,12 +32,12 @@ Audios.prototype.PlaySonos = function (liIndex) {
},
success: function (jsondata) {
if (jsondata === false) {
myAudios.SonosGone();
OCA.Audioplayer.audiosInstance.SonosGone();
}
playIndicator.addClass('playing');
},
error: function(){
myAudios.SonosGone();
OCA.Audioplayer.audiosInstance.SonosGone();
},
timeout: 3000
});
Expand All @@ -53,12 +58,12 @@ Audios.prototype.SonosAction = function (action) {
},
success: function (jsondata) {
if (jsondata === false) {
myAudios.SonosGone();
OCA.Audioplayer.audiosInstance.SonosGone();
}
return true;
},
error: function(){
myAudios.SonosGone();
OCA.Audioplayer.audiosInstance.SonosGone();
},
timeout: 3000
});
Expand All @@ -75,23 +80,23 @@ $(document).ready(function () {
} else {
action = 'play';
}
if(myAudios.SonosAction(action)) playIndicator.addClass('playing');
if(OCA.Audioplayer.audiosInstance.SonosAction(action)) playIndicator.addClass('playing');
});

$('#sonos_prev').on('click', function () {
myAudios.SonosAction('previous');
OCA.Audioplayer.audiosInstance.SonosAction('previous');
});

$('#sonos_next').on('click', function () {
myAudios.SonosAction('next');
OCA.Audioplayer.audiosInstance.SonosAction('next');
});

$('#sonos_up').on('click', function () {
myAudios.SonosAction('up');
OCA.Audioplayer.audiosInstance.SonosAction('up');
});

$('#sonos_down').on('click', function () {
myAudios.SonosAction('down');
OCA.Audioplayer.audiosInstance.SonosAction('down');
});

});
2 changes: 2 additions & 0 deletions js/viewer/search.js
@@ -1,3 +1,5 @@
'use strict';

(function() {
/**
* Construct a new FileActions instance
Expand Down
5 changes: 5 additions & 0 deletions js/viewer/viewer.js
Expand Up @@ -10,6 +10,11 @@
* @copyright 2015 Sebastian Doell
*/

/* global soundManager */
// OK because ./js/soundmanager2.js is sourced before in html

'use strict';

var audioPlayer = {
mime: null,
file: null,
Expand Down

0 comments on commit 998e10d

Please sign in to comment.