diff --git a/mobile/app/pods/components/bridge-finder/component.js b/mobile/app/pods/components/bridge-finder/component.js index bb165f2..08c90f0 100644 --- a/mobile/app/pods/components/bridge-finder/component.js +++ b/mobile/app/pods/components/bridge-finder/component.js @@ -28,12 +28,11 @@ export default Component.extend({ manualBridgeIp: null, manualBridgeIpNotFound: false, multipleBridgeIps: [], - error: false, isAuthenticating: computed.notEmpty('bridgePingIntervalHandle'), // try to authenticate against the bridge here - onBridgeIpChange: on('init', observer('bridgeIp', function(){ - if(!this.get('trial') && !this.get('isAuthenticating')) { + onBridgeIpChange: on('init', observer('bridgeIp', function () { + if (!this.get('trial') && !this.get('isAuthenticating')) { this.setProperties({ bridgePingIntervalHandle: setInterval(this.pingBridgeUser.bind(this), this.get('bridgeUsernamePingIntervalTime')), bridgeUserNamePingIntervalProgress: 0 @@ -42,14 +41,14 @@ export default Component.extend({ })), didInsertElement() { - $(document).keypress((event)=>{ - if(!isNone(this.get('manualBridgeIp')) && event.which === 13) { + $(document).keypress((event) => { + if (!isNone(this.get('manualBridgeIp')) && event.which === 13) { this.send('findBridgeByIp'); } }); document.addEventListener('resume', () => { - if(this.get('error') || this.get('trial') || this.get('bridgeFindFail')) { + if (this.get('trial') || this.get('bridgeFindFail')) { this.send('tryAgain'); } }, false); @@ -59,11 +58,11 @@ export default Component.extend({ init() { this._super(...arguments); - if(this.get('bridgeIp') === null) { + if (this.get('bridgeIp') === null) { $.ajax('https://www.meethue.com/api/nupnp', { timeout: 30000 }) - .done((result, status)=> { + .done((result, status) => { let bridgeFindStatus = 'fail'; if (status === 'success' && result.length === 1) { @@ -84,9 +83,9 @@ export default Component.extend({ this.set('bridgeFindStatus', bridgeFindStatus); }) - .fail(()=>{ + .fail(() => { this.set('bridgeFindStatus', 'fail'); - }); + }); } }, @@ -97,11 +96,11 @@ export default Component.extend({ if (bridgeIp !== null && bridgeUserNamePingIntervalProgress < 100) { $.ajax('http://' + bridgeIp + '/api', { - data: JSON.stringify({"devicetype": "huegasm"}), + data: JSON.stringify({ "devicetype": "huegasm" }), contentType: 'application/json', type: 'POST' - }).done((result, status)=>{ - if(!this.isDestroyed){ + }).done((result, status) => { + if (!this.isDestroyed) { this.set('bridgeAuthenticateReachedStatus', status); if (status === 'success' && !result[0].error) { @@ -110,18 +109,15 @@ export default Component.extend({ this.set('bridgeUsername', result[0].success.username); } } - }).fail(()=>{ - this.clearBridgePingIntervalHandle(); - this.set('error', true); }); - this.incrementProperty('bridgeUserNamePingIntervalProgress', this.get('bridgeUsernamePingIntervalTime')/bridgeUsernamePingMaxTime*100); + this.incrementProperty('bridgeUserNamePingIntervalProgress', this.get('bridgeUsernamePingIntervalTime') / bridgeUsernamePingMaxTime * 100); } else { this.clearBridgePingIntervalHandle(); } }, - clearBridgePingIntervalHandle(){ + clearBridgePingIntervalHandle() { clearInterval(this.get('bridgePingIntervalHandle')); this.set('bridgePingIntervalHandle', null); }, @@ -131,11 +127,12 @@ export default Component.extend({ this.get('storage').clear(); location.reload(); }, - retry(){ + retry() { this.onBridgeIpChange(); }, - chooseBridge(bridge){ + chooseBridge(bridge) { this.set('bridgeIp', bridge); + this.get('storage').set('huegasm.bridgeIp', bridge); }, findBridgeByIp() { let manualBridgeIp = this.get('manualBridgeIp'); @@ -148,12 +145,12 @@ export default Component.extend({ }); } else { $.ajax('http://' + manualBridgeIp + '/api', { - data: JSON.stringify({"devicetype": "huegasm"}), + data: JSON.stringify({ "devicetype": "huegasm" }), contentType: 'application/json', type: 'POST' }).fail(() => { this.set('manualBridgeIpNotFound', true); - later(this, function() { + later(this, function () { this.set('manualBridgeIpNotFound', false); }, 5000); }).then(() => { diff --git a/mobile/app/pods/components/bridge-finder/template.hbs b/mobile/app/pods/components/bridge-finder/template.hbs index af20754..3e3fa23 100644 --- a/mobile/app/pods/components/bridge-finder/template.hbs +++ b/mobile/app/pods/components/bridge-finder/template.hbs @@ -1,23 +1,15 @@

Huegasm encountered a critical error while trying to connect to your bridge.
- TRY AGAIN
-
- {{paper-progress-linear warn=true value=bridgeUserNamePingIntervalProgress}}
-
- {{#if isAuthenticating}}
- Your bridge IP is {{bridgeIp}}
-
- Press the button on your bridge to authenticate this application.
- {{else}}
- You failed to press the button in time. RETRY
- {{/if}}
-
{{paper-progress-linear warn=true value=bridgeUserNamePingIntervalProgress}}
+
+ {{#if isAuthenticating}}
+ Your bridge IP is {{bridgeIp}}
+
Press the button on your bridge to authenticate this application.
+ {{else}}
+ You failed to press the button in time. RETRY
+ {{/if}}
+
Found multiple hue bridges.
- Please select the one you want to use for this application.
Huegasm found multiple hue bridges.
Please select the one you want to use for this application.
A hue bridge could not be automatically found on your network.
- Enter one manually?
- ( or type offline to look around )
+
A hue bridge could not be automatically found on your network.
Enter one manually?
( or type offline to look around )
Brightness
- {{paper-slider flex=true min=1 max=254 value=lightsBrightness disabled=brightnessControlDisabled}} +Brightness
+ {{paper-slider class="flex" discrete=true step="10" min="1" max="254" value=lightsBrightness disabled=brightnessControlDisabled}} {{/paper-item}} - {{#paper-item class="color-row"}} + {{#paper-item class="color-row" }} {{paper-icon "color-lens" class=dimmerOnClass}}Color
{{#paper-menu offset="0 -100" as |menu|}} diff --git a/mobile/app/pods/components/music-tab/component.js b/mobile/app/pods/components/music-tab/component.js index 8de110c..a987c71 100644 --- a/mobile/app/pods/components/music-tab/component.js +++ b/mobile/app/pods/components/music-tab/component.js @@ -12,17 +12,17 @@ const { } = Ember; export default Component.extend(helperMixin, visualizerMixin, { - updatePageTitle: observer('playQueuePointer', function(){ + updatePageTitle: observer('playQueuePointer', function () { let title = 'Huegasm', playQueuePointer = this.get('playQueuePointer'), playQueue = this.get('playQueue'); - if(playQueuePointer !== -1){ + if (playQueuePointer !== -1) { let song = playQueue[playQueuePointer]; - if(song.title){ + if (song.title) { title = song.title; - if(song.artist){ + if (song.artist) { title += (' - ' + song.artist); } } else { @@ -35,14 +35,14 @@ export default Component.extend(helperMixin, visualizerMixin, { document.title = title; }), - changePlayerControl(name, value, saveBeatPrefs){ + changePlayerControl(name, value, saveBeatPrefs) { this.set(name, value); - if(name === 'threshold'){ - this.get('kick').set({threshold: value}); + if (name === 'threshold') { + this.get('kick').set({ threshold: value }); } - if(saveBeatPrefs && this.get('playQueuePointer') !== -1){ + if (saveBeatPrefs && this.get('playQueuePointer') !== -1) { this.saveSongBeatPreferences(); } @@ -51,11 +51,11 @@ export default Component.extend(helperMixin, visualizerMixin, { saveSongBeatPreferences() { let song = this.get('playQueue')[this.get('playQueuePointer')]; - if(song) { + if (song) { let title = isEmpty(song.artist) ? song.fileName : song.artist + '-' + song.title, songBeatPreferences = this.get('songBeatPreferences'); - songBeatPreferences[title] = {threshold: this.get('threshold')}; + songBeatPreferences[title] = { threshold: this.get('threshold') }; this.set('usingBeatPreferences', true); this.get('storage').set('huegasm.songBeatPreferences', songBeatPreferences); @@ -70,12 +70,12 @@ export default Component.extend(helperMixin, visualizerMixin, { oldBeatPrefCache = this.get('oldBeatPrefCache'), newOldBeatPrefCache = null; - if(!isNone(preference)) { // load existing beat prefs - newOldBeatPrefCache = {threshold: this.get('threshold')}; + if (!isNone(preference)) { // load existing beat prefs + newOldBeatPrefCache = { threshold: this.get('threshold') }; this.changePlayerControl('threshold', preference.threshold); this.set('usingBeatPreferences', true); - } else if(!isNone(oldBeatPrefCache)) { // revert to using beat prefs before the remembered song + } else if (!isNone(oldBeatPrefCache)) { // revert to using beat prefs before the remembered song this.changePlayerControl('threshold', oldBeatPrefCache.threshold); this.set('usingBeatPreferences', false); } @@ -86,11 +86,11 @@ export default Component.extend(helperMixin, visualizerMixin, { clearCurrentAudio(resetPointer) { let dancer = this.get('dancer'); - if(dancer.audio.pause) { + if (dancer.audio.pause) { dancer.pause(); } - if(resetPointer){ + if (resetPointer) { this.set('playQueuePointer', -1); } @@ -108,19 +108,19 @@ export default Component.extend(helperMixin, visualizerMixin, { transitiontime = this.get('flashingTransitions'), brightnessRange = this.get('brightnessRange'), stimulateLight = (light, brightness, hue) => { - let options = {'bri': brightness}; + let options = { 'bri': brightness }; - if(transitiontime) { + if (transitiontime) { options['transitiontime'] = 0; } else { options['transitiontime'] = 1; } - if(!isNone(hue)) { + if (!isNone(hue)) { options.hue = hue; } - if(lightsData[light].state.on === false){ + if (lightsData[light].state.on === false) { options.on = true; } @@ -132,7 +132,7 @@ export default Component.extend(helperMixin, visualizerMixin, { }, timeToBriOff = 100; - if(activeLights.length > 0){ + if (activeLights.length > 0) { let lastLightBopIndex = this.get('lastLightBopIndex'), lightBopIndex, light; @@ -140,8 +140,8 @@ export default Component.extend(helperMixin, visualizerMixin, { lightBopIndex = Math.floor(Math.random() * activeLights.length); // let's try not to select the same light twice in a row - if(activeLights.length > 1) { - while(lightBopIndex === lastLightBopIndex) { + if (activeLights.length > 1) { + while (lightBopIndex === lastLightBopIndex) { lightBopIndex = Math.floor(Math.random() * activeLights.length); } } @@ -149,13 +149,13 @@ export default Component.extend(helperMixin, visualizerMixin, { light = activeLights[lightBopIndex]; this.set('lastLightBopIndex', lightBopIndex); - if(!this.get('colorloopMode')) { - let hueRange = this.get('hueRange'); + if (!this.get('colorloopMode')) { + let hueRange = this.get('hueRange'); - color = Math.floor(Math.random()*(hueRange[1] - hueRange[0] + 1)+hueRange[0]); + color = Math.floor(Math.random() * (hueRange[1] - hueRange[0] + 1) + hueRange[0]); } - if(transitiontime){ + if (transitiontime) { timeToBriOff = 80; } @@ -164,13 +164,15 @@ export default Component.extend(helperMixin, visualizerMixin, { } this.set('paused', true); - later(this, function(){{ - this.set('paused', false); - }}, 150); + later(this, function () { + { + this.set('paused', false); + } + }, 150); //work the music beat area - simulate the speaker vibration by running a CSS animation on it - $('#beat-speaker-center-outer').velocity({blur: 3}, 100).velocity({blur: 0}, 100); - $('#beat-speaker-center-inner').velocity({scale: 1.05}, 100).velocity({scale: 1}, 100); + $('#beat-speaker-center-outer').velocity({ blur: 3 }, 100).velocity({ blur: 0 }, 100); + $('#beat-speaker-center-inner').velocity({ scale: 1.05 }, 100).velocity({ scale: 1 }, 100); }, init() { @@ -198,11 +200,11 @@ export default Component.extend(helperMixin, visualizerMixin, { kick: kick }); - ['shuffle', 'repeat', 'threshold', 'playerBottomDisplayed', 'audioMode', 'songBeatPreferences', 'firstVisit', 'currentVisName', 'playQueue', 'playQueuePointer', 'flashingTransitions', 'colorloopMode', 'hueRange', 'brightnessRange'].forEach((item)=>{ + ['shuffle', 'repeat', 'threshold', 'playerBottomDisplayed', 'audioMode', 'songBeatPreferences', 'firstVisit', 'currentVisName', 'playQueue', 'playQueuePointer', 'flashingTransitions', 'colorloopMode', 'hueRange', 'brightnessRange'].forEach((item) => { if (!isNone(storage.get('huegasm.' + item))) { let itemVal = storage.get('huegasm.' + item); - if(isNone(this.actions[item+'Changed'])){ + if (isNone(this.actions[item + 'Changed'])) { this.set(item, itemVal); } else { this.send(item + 'Changed', itemVal); @@ -217,7 +219,7 @@ export default Component.extend(helperMixin, visualizerMixin, { this.set('oldPlayQueueLength', this.get('playQueue.length')); document.addEventListener('stop', () => { - if(this.get('playing')){ + if (this.get('playing')) { this.send('play'); } }, false); @@ -234,29 +236,29 @@ export default Component.extend(helperMixin, visualizerMixin, { }); // file input code - $('#file-input').on('change', function() { + $('#file-input').on('change', function () { let files = this.files; self.send('handleNewFiles', files); this.value = null; // reset in case upload the second file again }); - $(document).on('click', '.alert', (event)=>{ + $(document).on('click', '.alert', (event) => { $(event.target).addClass('removed'); }); // prevent space/text selection when the user repeatedly clicks on the center - $('#beat-container').on('mousedown', '#beat-speaker-center-inner', function(event) { + $('#beat-container').on('mousedown', '#beat-speaker-center-inner', function (event) { event.preventDefault(); }); $(document).keypress((event) => { - if(event.which === 32 && event.target.type !== 'text'){ + if (event.which === 32 && event.target.type !== 'text') { this.send('play'); } }); - // demo tracks - if(this.get('firstVisit')){ + // demo tracks + if (this.get('firstVisit')) { this.send('handleNewSoundCloudURL', 'https://soundcloud.com/mrsuicidesheep/candyland-speechless-feat-rkcb'); this.send('handleNewSoundCloudURL', 'https://soundcloud.com/dillistone/dillistone-lili-n-rude'); this.send('handleNewSoundCloudURL', 'https://soundcloud.com/mrsuicidesheep/vallis-alps-young-feki-remix'); @@ -268,86 +270,87 @@ export default Component.extend(helperMixin, visualizerMixin, { this.send('handleNewSoundCloudURL', 'https://soundcloud.com/mrsuicidesheep/90-pounds-of-pete-waited-too-long-feat-devon-baldwin'); this.send('handleNewSoundCloudURL', 'https://soundcloud.com/mrsuicidesheep/draper-eyes-open'); this.send('handleNewSoundCloudURL', 'https://soundcloud.com/itspapaya/sunny'); + this.send('handleNewSoundCloudURL', 'https://soundcloud.com/stonesthrow/nxworries-anderson-paak-knxwledge-suede'); this.get('storage').set('huegasm.firstVisit', false); this.sendAction(); } - if(!this.get('playerBottomDisplayed')) { + if (!this.get('playerBottomDisplayed')) { $('#player-bottom').hide(); } }, actions: { - setVisName(name){ + setVisName(name) { this.set('currentVisName', name); }, - gotoSCURL(URL){ + gotoSCURL(URL) { // need to pause the music since soundcloud is going to start playing this song anyways - if(this.get('playing')){ + if (this.get('playing')) { this.send('play'); } this.send('gotoURL', URL); }, - gotoURL(URL){ + gotoURL(URL) { window.open(URL, '_blank'); }, - handleNewSoundCloudURL(URL){ - if(URL) { - SC.resolve(URL).then((resultObj)=>{ - let processResult = (result)=>{ - if(result.kind === 'user'){ - this.get('notify').alert({html: this.get('scUserNotSupportedHtml')}); - } else if(result.kind === 'track') { - if(result.streamable === true){ - let picture = null; + handleNewSoundCloudURL(URL) { + if (URL) { + SC.resolve(URL).then((resultObj) => { + let processResult = (result) => { + if (result.kind === 'user') { + this.get('notify').alert({ html: this.get('scUserNotSupportedHtml') }); + } else if (result.kind === 'track') { + if (result.streamable === true) { + let picture = null; - if(result.artwork_url){ - picture = result.artwork_url.replace('large', 't67x67'); - } else if(result.user.avatar_url){ - picture = result.user.avatar_url; - } + if (result.artwork_url) { + picture = result.artwork_url.replace('large', 't67x67'); + } else if (result.user.avatar_url) { + picture = result.user.avatar_url; + } - $.get(picture) - .done(()=>{ - this.get('playQueue').pushObject({url: result.stream_url + '?client_id=' + this.get('SC_CLIENT_ID'), fileName: result.title + ' - ' + result.user.username, artist: result.user.username, scUrl: result.permalink_url, title: result.title, picture: picture }); - }).fail(()=>{ // no picture - this.get('playQueue').pushObject({url: result.stream_url + '?client_id=' + this.get('SC_CLIENT_ID'), fileName: result.title + ' - ' + result.user.username, artist: result.user.username, scUrl: result.permalink_url, title: result.title }); + $.get(picture) + .done(() => { + this.get('playQueue').pushObject({ url: result.stream_url + '?client_id=' + this.get('SC_CLIENT_ID'), fileName: result.title + ' - ' + result.user.username, artist: result.user.username, scUrl: result.permalink_url, title: result.title, picture: picture }); + }).fail(() => { // no picture + this.get('playQueue').pushObject({ url: result.stream_url + '?client_id=' + this.get('SC_CLIENT_ID'), fileName: result.title + ' - ' + result.user.username, artist: result.user.username, scUrl: result.permalink_url, title: result.title }); }); - } else { - failedSongs.push(result.title); - } - } else if(result.kind === 'playlist'){ - if(result.streamable === true){ - result.tracks.forEach(processResult); - } else { - failedSongs.push(result.title); - } + } else { + failedSongs.push(result.title); } - }, + } else if (result.kind === 'playlist') { + if (result.streamable === true) { + result.tracks.forEach(processResult); + } else { + failedSongs.push(result.title); + } + } + }, failedSongs = []; - if(resultObj instanceof Array){ + if (resultObj instanceof Array) { resultObj.forEach(processResult); } else { processResult(resultObj); } - if(failedSongs.length > 0) { - this.get('notify').alert({html: this.get('notStreamableHtml')(failedSongs)}); + if (failedSongs.length > 0) { + this.get('notify').alert({ html: this.get('notStreamableHtml')(failedSongs) }); } - if(this.get('playQueuePointer') === -1){ - if(this.get('firstVisit')){ + if (this.get('playQueuePointer') === -1) { + if (this.get('firstVisit')) { this.send('goToSong', 0); } else { this.send('next'); } } }, () => { - this.get('notify').alert({html: this.get('urlNotFoundHtml')(URL)}); + this.get('notify').alert({ html: this.get('urlNotFoundHtml')(URL) }); }); } @@ -356,57 +359,57 @@ export default Component.extend(helperMixin, visualizerMixin, { toggleIsShowingAddSoundCloudModal() { this.toggleProperty('isShowingAddSoundCloudModal'); }, - slideTogglePlayerBottom(){ + slideTogglePlayerBottom() { let elem = this.$('#player-bottom'); elem.velocity(elem.is(':visible') ? 'slideUp' : 'slideDown', { duration: 300 }); this.changePlayerControl('playerBottomDisplayed', !this.get('playerBottomDisplayed')); }, - goToSong(index, playSong, scrollToSong){ + goToSong(index, playSong, scrollToSong) { let dancer = this.get('dancer'), playQueue = this.get('playQueue'); - if(dancer.audio) { + if (dancer.audio) { this.clearCurrentAudio(true); } - if(!isNone(playQueue[index])) { + if (!isNone(playQueue[index])) { let audio = new Audio(); audio.src = this.get('playQueue')[index].url; audio.crossOrigin = "anonymous"; - audio.oncanplay = ()=>{ + audio.oncanplay = () => { this.set('timeTotal', Math.floor(audio.duration)); this.set('soundCloudFuckUps', 0); }; - audio.onerror = (event)=>{ - let playQueuePointer =this.get('playQueuePointer'), + audio.onerror = (event) => { + let playQueuePointer = this.get('playQueuePointer'), song = this.get('playQueue')[playQueuePointer]; - if(this.get('soundCloudFuckUps') >= this.get('maxSoundCloudFuckUps')) { - this.get('notify').alert({html: this.get('tooManySoundCloudFuckUps')}); + if (this.get('soundCloudFuckUps') >= this.get('maxSoundCloudFuckUps')) { + this.get('notify').alert({ html: this.get('tooManySoundCloudFuckUps') }); this.send('play'); this.set('soundCloudFuckUps', 0); } else { - if(song.local){ + if (song.local) { this.send('removeAudio', playQueuePointer); } else { this.send('next', true); } - if(event.target.error.code === 2){ - this.get('notify').alert({html: this.get('failedToDecodeFileHtml')(song.fileName)}); + if (event.target.error.code === 2) { + this.get('notify').alert({ html: this.get('failedToDecodeFileHtml')(song.fileName) }); } else { - this.get('notify').alert({html: this.get('failedToPlayFileHtml')(song.fileName)}); + this.get('notify').alert({ html: this.get('failedToPlayFileHtml')(song.fileName) }); } this.set('usingBeatPreferences', false); this.incrementProperty('soundCloudFuckUps'); } }; - audio.ontimeupdate = ()=>{ + audio.ontimeupdate = () => { this.set('timeElapsed', Math.floor(audio.currentTime)); }; - audio.onended = ()=> { + audio.onended = () => { this.send('next'); }; @@ -416,29 +419,29 @@ export default Component.extend(helperMixin, visualizerMixin, { this.loadSongBeatPreferences(); - if(playSong){ + if (playSong) { this.send('play'); } - if(scrollToSong){ - next(this, ()=>{ - $('.track'+index).velocity('scroll', { container: $('#play-list-area'), duration: 200 }); + if (scrollToSong) { + next(this, () => { + $('.track' + index).velocity('scroll', { container: $('#play-list-area'), duration: 200 }); }); } } }, - removeAudio(index){ + removeAudio(index) { this.get('playQueue').removeAt(index); - if(index === this.get('playQueuePointer')) { + if (index === this.get('playQueuePointer')) { this.send('goToSong', index, true, true); } }, - playerAreaPlay(){ - if(isEmpty($('#player-controls:hover')) && this.get('playQueuePointer') !== -1 ){ + playerAreaPlay() { + if (isEmpty($('#player-controls:hover')) && this.get('playQueuePointer') !== -1) { this.send('play'); - $('#play-notification').velocity({opacity: 1, scale: 1}, 0).velocity({opacity: 0, scale: 3}, 500); + $('#play-notification').velocity({ opacity: 1, scale: 1 }, 0).velocity({ opacity: 0, scale: 3 }, 500); } }, play(replayPause) { @@ -447,22 +450,22 @@ export default Component.extend(helperMixin, visualizerMixin, { playing = this.get('playing'), lightsData = this.get('lightsData'); - if(playQueuePointer !== -1 ) { + if (playQueuePointer !== -1) { if (playing) { dancer.pause(); - let preMusicLightsDataCache = this.get('preMusicLightsDataCache'), - updateLight = (lightIndex)=> { + let preMusicLightsDataCache = this.get('preMusicLightsDataCache'), + updateLight = (lightIndex) => { $.ajax(this.get('apiURL') + '/lights/' + lightIndex + '/state', { - data: JSON.stringify({ - 'on': preMusicLightsDataCache[lightIndex].state.on, - 'hue': preMusicLightsDataCache[lightIndex].state.hue, - 'bri': preMusicLightsDataCache[lightIndex].state.bri - }), - contentType: 'application/json', - type: 'PUT' - }); - }; + data: JSON.stringify({ + 'on': preMusicLightsDataCache[lightIndex].state.on, + 'hue': preMusicLightsDataCache[lightIndex].state.hue, + 'bri': preMusicLightsDataCache[lightIndex].state.bri + }), + contentType: 'application/json', + type: 'PUT' + }); + }; for (let key in lightsData) { if (lightsData.hasOwnProperty(key)) { @@ -470,14 +473,14 @@ export default Component.extend(helperMixin, visualizerMixin, { } } - if(!replayPause){ + if (!replayPause) { this.set('timeElapsed', Math.floor(dancer.getTime())); } } else { let timeTotal = this.get('timeTotal'); // replay song - if(this.get('timeElapsed') === timeTotal && timeTotal !== 0){ + if (this.get('timeElapsed') === timeTotal && timeTotal !== 0) { this.send('next', true); return; } @@ -500,17 +503,17 @@ export default Component.extend(helperMixin, visualizerMixin, { repeat = this.get('repeat'), shuffle = this.get('shuffle'); - if(repeat === 2){ // repeating one song takes precedence over shuffling - if(playQueuePointer === -1 && playQueue.length > 0) { + if (repeat === 2) { // repeating one song takes precedence over shuffling + if (playQueuePointer === -1 && playQueue.length > 0) { nextSong = 0; } else { nextSong = playQueuePointer; } - } else if(shuffle){ // next shuffle song + } else if (shuffle) { // next shuffle song let shufflePlayed = this.get('shufflePlayed'); // played all the song in shuffle mode - if(shufflePlayed.length === playQueue.length){ + if (shufflePlayed.length === playQueue.length) { shufflePlayed.clear(); this.send('play', true); return; @@ -519,11 +522,11 @@ export default Component.extend(helperMixin, visualizerMixin, { // we're going to assume that the song URL is the id do { nextSong = Math.floor(Math.random() * playQueue.length); - } while(shufflePlayed.includes(playQueue[nextSong].url)); + } while (shufflePlayed.includes(playQueue[nextSong].url)); shufflePlayed.pushObject(playQueue[nextSong].url); - } else if(nextSong > playQueue.length-1){ - if(repeat === 1 || repeatAll){ + } else if (nextSong > playQueue.length - 1) { + if (repeat === 1 || repeatAll) { nextSong = nextSong % playQueue.length; } else { this.send('play', true); @@ -534,26 +537,26 @@ export default Component.extend(helperMixin, visualizerMixin, { this.send('goToSong', nextSong, true, true); }, previous() { - if(this.get('timeElapsed') > 5) { + if (this.get('timeElapsed') > 5) { this.send('seekChanged', 0); } else { let nextSong = this.get('playQueuePointer'), playQueue = this.get('playQueue'); - if(this.get('shuffle') && !isNone(playQueue[nextSong])) { // go to the previously shuffled song + if (this.get('shuffle') && !isNone(playQueue[nextSong])) { // go to the previously shuffled song let shufflePlayed = this.get('shufflePlayed'), shuffledSongIndx = this.get('shufflePlayed').indexOf(playQueue[nextSong].url), i = 0; - if(shufflePlayed.length > 0 && shuffledSongIndx !== -1){ // only if there was one + if (shufflePlayed.length > 0 && shuffledSongIndx !== -1) { // only if there was one nextSong = shuffledSongIndx - 1; - if(nextSong < 0){ + if (nextSong < 0) { nextSong = shufflePlayed.length - 1; } - playQueue.some(function(item){ // try to find the previous song id - if(item.url === shufflePlayed[nextSong]){ + playQueue.some(function (item) { // try to find the previous song id + if (item.url === shufflePlayed[nextSong]) { nextSong = i; return true; } @@ -565,7 +568,7 @@ export default Component.extend(helperMixin, visualizerMixin, { } else { nextSong--; - if(nextSong < 0) { + if (nextSong < 0) { nextSong = playQueue.length - 1; } } @@ -576,7 +579,7 @@ export default Component.extend(helperMixin, visualizerMixin, { seekChanged(position) { let dancer = this.get('dancer'); - if(dancer.audio){ + if (dancer.audio) { dancer.audio.currentTime = Math.floor(this.get('timeTotal') * position / 100); } }, @@ -601,20 +604,20 @@ export default Component.extend(helperMixin, visualizerMixin, { hueRangeChanged(value) { this.changePlayerControl('hueRange', value); }, - playQueuePointerChanged(value){ + playQueuePointerChanged(value) { this.send('goToSong', value, false, true); }, - clickSpeaker(){ + clickSpeaker() { this.simulateKick(1); }, - handleNewFiles(files){ + handleNewFiles(files) { let self = this, playQueue = this.get('playQueue'), - updatePlayQueue = function(){ + updatePlayQueue = function () { let tags = ID3.getAllTags("local"), picture = null; - if(tags.picture){ + if (tags.picture) { let base64String = ""; for (let i = 0; i < tags.picture.data.length; i++) { base64String += String.fromCharCode(tags.picture.data[i]); @@ -634,7 +637,7 @@ export default Component.extend(helperMixin, visualizerMixin, { ID3.clearAll(); - if(self.get('playQueuePointer') === -1){ + if (self.get('playQueuePointer') === -1) { self.send('next'); } }; @@ -643,8 +646,8 @@ export default Component.extend(helperMixin, visualizerMixin, { if (files.hasOwnProperty(key)) { let file = files[key]; - if(file.type.startsWith('audio')) { - ID3.loadTags("local", updatePlayQueue.bind(file),{ + if (file.type.startsWith('audio')) { + ID3.loadTags("local", updatePlayQueue.bind(file), { dataReader: new FileAPIReader(file), tags: ['title', 'artist', 'album', 'track', 'picture'] }); diff --git a/mobile/app/styles/hue-controls.scss b/mobile/app/styles/hue-controls.scss index 02e98a2..580277f 100644 --- a/mobile/app/styles/hue-controls.scss +++ b/mobile/app/styles/hue-controls.scss @@ -4,9 +4,6 @@ .paper-icon { line-height: 0.8 !important; } - md-slider { - width: 50%; - } } #hue-controls { diff --git a/mobile/app/styles/music-tab.scss b/mobile/app/styles/music-tab.scss index 080237c..b61830a 100644 --- a/mobile/app/styles/music-tab.scss +++ b/mobile/app/styles/music-tab.scss @@ -244,10 +244,10 @@ margin: 0; } .option-description { - font-size: 18px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + display: inline-flex; + font-size: 20px; + justify-content: center; + flex-direction: column; } button { margin-top: 0; @@ -359,4 +359,7 @@ #sensitivity-settings .noUi-value-vertical { display: none; } + .option-description { + height: 55px; + } } \ No newline at end of file diff --git a/mobile/app/styles/paper.scss b/mobile/app/styles/paper.scss index 2af5034..d8766ab 100644 --- a/mobile/app/styles/paper.scss +++ b/mobile/app/styles/paper.scss @@ -48,3 +48,7 @@ md-switch.md-default-theme.md-checked .md-thumb { md-list-item { margin-bottom: 2vh; } + +.md-thumb-text { + user-select: none; +} diff --git a/web/app/pods/components/bridge-finder/component.js b/web/app/pods/components/bridge-finder/component.js index b3f8e5b..4f69cd7 100644 --- a/web/app/pods/components/bridge-finder/component.js +++ b/web/app/pods/components/bridge-finder/component.js @@ -31,8 +31,8 @@ export default Component.extend({ isAuthenticating: computed.notEmpty('bridgePingIntervalHandle'), // try to authenticate against the bridge here - onBridgeIpChange: on('init', observer('bridgeIp', function(){ - if(!this.get('trial') && !this.get('isAuthenticating')) { + onBridgeIpChange: on('init', observer('bridgeIp', function () { + if (!this.get('trial') && !this.get('isAuthenticating')) { this.setProperties({ bridgePingIntervalHandle: setInterval(this.pingBridgeUser.bind(this), this.get('bridgeUsernamePingIntervalTime')), bridgeUserNamePingIntervalProgress: 0 @@ -41,8 +41,8 @@ export default Component.extend({ })), didInsertElement() { - $(document).keypress((event)=>{ - if(!isNone(this.get('manualBridgeIp')) && event.which === 13) { + $(document).keypress((event) => { + if (!isNone(this.get('manualBridgeIp')) && event.which === 13) { this.send('findBridgeByIp'); } }); @@ -52,11 +52,11 @@ export default Component.extend({ init() { this._super(...arguments); - if(this.get('bridgeIp') === null) { + if (this.get('bridgeIp') === null) { $.ajax('https://www.meethue.com/api/nupnp', { timeout: 30000 }) - .done((result, status)=> { + .done((result, status) => { let bridgeFindStatus = 'fail'; if (status === 'success' && result.length === 1) { @@ -77,9 +77,9 @@ export default Component.extend({ this.set('bridgeFindStatus', bridgeFindStatus); }) - .fail(()=>{ + .fail(() => { this.set('bridgeFindStatus', 'fail'); - }); + }); } }, @@ -90,11 +90,11 @@ export default Component.extend({ if (bridgeIp !== null && bridgeUserNamePingIntervalProgress < 100) { $.ajax('http://' + bridgeIp + '/api', { - data: JSON.stringify({"devicetype": "huegasm"}), + data: JSON.stringify({ "devicetype": "huegasm" }), contentType: 'application/json', type: 'POST' - }).done((result, status)=>{ - if(!this.isDestroyed){ + }).done((result, status) => { + if (!this.isDestroyed) { this.set('bridgeAuthenticateReachedStatus', status); if (status === 'success' && !result[0].error) { @@ -105,23 +105,24 @@ export default Component.extend({ } }); - this.incrementProperty('bridgeUserNamePingIntervalProgress', this.get('bridgeUsernamePingIntervalTime')/bridgeUsernamePingMaxTime*100); + this.incrementProperty('bridgeUserNamePingIntervalProgress', this.get('bridgeUsernamePingIntervalTime') / bridgeUsernamePingMaxTime * 100); } else { this.clearBridgePingIntervalHandle(); } }, - clearBridgePingIntervalHandle(){ + clearBridgePingIntervalHandle() { clearInterval(this.get('bridgePingIntervalHandle')); this.set('bridgePingIntervalHandle', null); }, actions: { - retry(){ + retry() { this.onBridgeIpChange(); }, - chooseBridge(bridge){ + chooseBridge(bridge) { this.set('bridgeIp', bridge); + this.get('storage').set('huegasm.bridgeIp', bridge); }, findBridgeByIp() { let manualBridgeIp = this.get('manualBridgeIp'); @@ -134,12 +135,12 @@ export default Component.extend({ }); } else { $.ajax('http://' + manualBridgeIp + '/api', { - data: JSON.stringify({"devicetype": "huegasm"}), + data: JSON.stringify({ "devicetype": "huegasm" }), contentType: 'application/json', type: 'POST' }).fail(() => { this.set('manualBridgeIpNotFound', true); - later(this, function(){ + later(this, function () { this.set('manualBridgeIpNotFound', false); }, 5000); }).then(() => { diff --git a/web/app/pods/components/bridge-finder/template.hbs b/web/app/pods/components/bridge-finder/template.hbs index 8a44e3b..ee0852a 100644 --- a/web/app/pods/components/bridge-finder/template.hbs +++ b/web/app/pods/components/bridge-finder/template.hbs @@ -1,17 +1,15 @@
- {{paper-progress-linear warn=true value=bridgeUserNamePingIntervalProgress}}
+
{{paper-progress-linear warn=true value=bridgeUserNamePingIntervalProgress}}
{{#if isAuthenticating}}
- Your bridge IP is {{bridgeIp}}
-
- Press the button on your bridge to authenticate this application.
+ Your bridge IP is {{bridgeIp}}
+
Press the button on your bridge to authenticate this application.
You failed to press the button in time. RETRY
+You failed to press the button in time. RETRY
{{/if}} {{else}} {{#unless bridgeFindStatus}} @@ -20,8 +18,7 @@ {{/unless}} {{#if bridgeFindMultiple}} -Found multiple hue bridges.
- Please select the one you want to use for this application.
Huegasm found multiple hue bridges.
Please select the one you want to use for this application.
A hue bridge could not be automatically found on your network.
- Enter one manually?
- ( or type offline to look around )
+
A hue bridge could not be automatically found on your network.
Enter one manually?
( or type offline to look around )
diff --git a/web/app/pods/components/huegasm-app/component.js b/web/app/pods/components/huegasm-app/component.js index 0e286df..653d3d3 100644 --- a/web/app/pods/components/huegasm-app/component.js +++ b/web/app/pods/components/huegasm-app/component.js @@ -13,7 +13,7 @@ export default Component.extend({ ready: false, elementId: 'huegasm', - init(){ + init() { this._super(...arguments); let storage = this.get('storage'); @@ -27,15 +27,15 @@ export default Component.extend({ }, actions: { - toggleDimmer(){ + toggleDimmer() { this.sendAction('toggleDimmer'); }, - toggleLightsIcons(){ + toggleLightsIcons() { this.sendAction('toggleLightsIcons'); }, - isReady(){ + isReady() { this.set('ready', true); $('html, body').velocity('scroll'); } diff --git a/web/app/pods/components/huegasm-app/template.hbs b/web/app/pods/components/huegasm-app/template.hbs index 0cd3b0f..08a1c56 100644 --- a/web/app/pods/components/huegasm-app/template.hbs +++ b/web/app/pods/components/huegasm-app/template.hbs @@ -1,5 +1,6 @@ {{#if bridgeUsername}} - {{hue-controls bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial dimmerOn=dimmerOn lightsIconsOn=lightsIconsOn storage=storage toggleDimmer="toggleDimmer" toggleLightsIcons="toggleLightsIcons"}} + {{hue-controls bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial dimmerOn=dimmerOn lightsIconsOn=lightsIconsOn + storage=storage toggleDimmer="toggleDimmer" toggleLightsIcons="toggleLightsIcons"}} {{else}} {{#if ready}} {{bridge-finder bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial storage=storage}} @@ -13,7 +14,7 @@ Your lights meet your music.
- Huegasm is a free web application for managing and synchronizing your Philips Hue lights with the beat of your music. + Huegasm is a free web application for managing and synchronizing your Philips Hue lights with the beat of your music.
- {{paper-button raised=true primary=true onClick=(action "isReady") class="go-button center-block" label="Go!"}} + {{paper-button raised=true primary=true warn=true onClick=(action "isReady") class="go-button center-block" label="START"}} {{/if}} {{/if}} \ No newline at end of file diff --git a/web/app/pods/components/lights-tab/component.js b/web/app/pods/components/lights-tab/component.js index 713fda6..5086f2c 100644 --- a/web/app/pods/components/lights-tab/component.js +++ b/web/app/pods/components/lights-tab/component.js @@ -5,7 +5,7 @@ const { observer, computed, on, - run: { later }, + run: { later, once }, $ } = Ember; @@ -21,45 +21,45 @@ export default Component.extend({ // COLOR LOOP related stuff colorLoopOn: false, - lightsOnTxt: computed('lightsOn', function(){ + lightsOnTxt: computed('lightsOn', function () { return this.get('lightsOn') ? 'On' : 'Off'; }), - colorloopOnTxt: computed('colorLoopOn', function(){ + colorloopOnTxt: computed('colorLoopOn', function () { return this.get('colorLoopOn') ? 'On' : 'Off'; }), // determines the average brightness of the hue system for the brightness slider - lightsBrightness: computed('lightsData', function(){ + lightsBrightness: computed('lightsData', function () { let lightsData = this.get('lightsData'), activeLights = this.get('activeLights'), lightsBrightness = 0; - activeLights.forEach(function(light){ + activeLights.forEach(function (light) { lightsBrightness += lightsData[light].state.bri; }); - return lightsBrightness/activeLights.length; + return lightsBrightness / activeLights.length; }), brightnessControlDisabled: computed.not('lightsOn'), - onColorLoopOnChange: observer('colorLoopOn', function(){ + onColorLoopOnChange: observer('colorLoopOn', function () { let lightsData = this.get('lightsData'), activeLights = this.get('activeLights'), colorLoopsOn = this.get('colorLoopOn'), effect = colorLoopsOn ? 'colorloop' : 'none'; - let colorLoopsOnSystem = activeLights.some(function(light) { + let colorLoopsOnSystem = activeLights.some(function (light) { return lightsData[light].state.effect === 'colorloop'; }); // if the internal lights state is different than the one from lightsData ( user manually toggled the switch ), send the request to change the bulbs state - if(colorLoopsOn !== colorLoopsOnSystem){ - activeLights.forEach((light)=>{ - if(this.get('lightsData')[light].state.effect !== effect) { + if (colorLoopsOn !== colorLoopsOnSystem) { + activeLights.forEach((light) => { + if (this.get('lightsData')[light].state.effect !== effect) { $.ajax(this.get('apiURL') + '/lights/' + light + '/state', { - data: JSON.stringify({'effect': effect }), + data: JSON.stringify({ 'effect': effect }), contentType: 'application/json', type: 'PUT' }); @@ -68,7 +68,7 @@ export default Component.extend({ } }), - rgbPreview: observer('rgb', function() { + rgbPreview: observer('rgb', function () { let rgb = this.get('rgb'), xy = this.rgbToXy(rgb[0], rgb[1], rgb[2]); @@ -76,7 +76,7 @@ export default Component.extend({ this.get('activeLights').forEach((light) => { $.ajax(this.get('apiURL') + '/lights/' + light + '/state', { - data: JSON.stringify({"xy": xy}), + data: JSON.stringify({ "xy": xy }), contentType: 'application/json', type: 'PUT' }); @@ -87,9 +87,9 @@ export default Component.extend({ }), // determines whether the lights are on/off for the lights switch - lightsOnChange: on('init', observer('lightsData.@each.state.on', 'activeLights.[]', function(){ - if(!this.get('strobeOn')){ - let lightsData = this.get('lightsData'), lightsOn = this.get('activeLights').some(function(light) { + lightsOnChange: on('init', observer('lightsData.@each.state.on', 'activeLights.[]', function () { + if (!this.get('strobeOn')) { + let lightsData = this.get('lightsData'), lightsOn = this.get('activeLights').some(function (light) { return lightsData[light].state.on === true; }); @@ -97,20 +97,20 @@ export default Component.extend({ } })), - onLightsOnChange: observer('lightsOn', function(){ + onLightsOnChange: observer('lightsOn', function () { let lightsData = this.get('lightsData'), activeLights = this.get('activeLights'), lightsOn = this.get('lightsOn'); - let lightsOnSystem = activeLights.some(function(light) { + let lightsOnSystem = activeLights.some(function (light) { return lightsData[light].state.on === true; }); // if the internal lights state is different than the one from lightsData ( user manually toggled the switch ), send the request to change the bulbs state - if(lightsOn !== lightsOnSystem){ - activeLights.forEach((light)=>{ + if (lightsOn !== lightsOnSystem) { + activeLights.forEach((light) => { $.ajax(this.get('apiURL') + '/lights/' + light + '/state', { - data: JSON.stringify({"on": lightsOn}), + data: JSON.stringify({ "on": lightsOn }), contentType: 'application/json', type: 'PUT' }); @@ -118,32 +118,34 @@ export default Component.extend({ } }), - onBrightnessChanged: observer('lightsBrightness', function(){ - let lightsData = this.get('lightsData'), - lightsBrightnessSystem = false, - lightsBrightness = this.get('lightsBrightness'), - activeLights = this.get('activeLights'); + onBrightnessChanged: observer('lightsBrightness', function () { + once(this, function () { + let lightsData = this.get('lightsData'), + lightsBrightnessSystem = false, + lightsBrightness = this.get('lightsBrightness'), + activeLights = this.get('activeLights'); - activeLights.forEach(function(light){ - lightsBrightnessSystem += lightsData[light].state.bri; - }); - - lightsBrightnessSystem /= activeLights.length; - - // if the internal lights state is different than the one from lightsData ( user manually toggled the switch ), send the request to change the bulbs state - if(lightsBrightness !== lightsBrightnessSystem){ - activeLights.forEach((light)=>{ - $.ajax(this.get('apiURL') + '/lights/' + light + '/state', { - data: JSON.stringify({"bri": lightsBrightness}), - contentType: 'application/json', - type: 'PUT' - }); + activeLights.forEach(function (light) { + lightsBrightnessSystem += lightsData[light].state.bri; }); - } + + lightsBrightnessSystem /= activeLights.length; + + // if the internal lights state is different than the one from lightsData ( user manually toggled the switch ), send the request to change the bulbs state + if (lightsBrightness !== lightsBrightnessSystem) { + activeLights.forEach((light) => { + $.ajax(this.get('apiURL') + '/lights/' + light + '/state', { + data: JSON.stringify({ "bri": lightsBrightness }), + contentType: 'application/json', + type: 'PUT' + }); + }); + } + }); }), // sync the current light settings to the newly added light - onaActiveLightsChange: observer('syncLight', function(){ + onaActiveLightsChange: observer('syncLight', function () { let options = { on: this.get('lightsOn'), bri: this.get('lightsBrightness'), @@ -151,7 +153,7 @@ export default Component.extend({ }, rgb = this.get('rgb'), syncLight = this.get('syncLight'); - if(rgb[0] !== 255 && rgb[1] !== 255 && rgb[2] !== 255) { + if (rgb[0] !== 255 && rgb[1] !== 255 && rgb[2] !== 255) { options['xy'] = this.rgbToXy(rgb[0], rgb[1], rgb[2]); } @@ -168,9 +170,8 @@ export default Component.extend({ strobeOn: false, strobeOnInervalHandle: null, - strobeSat: 0, preStrobeOnLightsDataCache: null, - lastStrobeLight: 0, + nextLightIdx: 0, onStrobeOnChange: observer('strobeOn', function () { let lightsData = this.get('lightsData'), @@ -178,7 +179,7 @@ export default Component.extend({ if (strobeOn) { this.set('preStrobeOnLightsDataCache', lightsData); - let stobeInitRequestData = {'sat': this.get('strobeSat'), 'transitiontime': 0}; + let stobeInitRequestData = { transitiontime: 0 }; for (let key in lightsData) { if (lightsData.hasOwnProperty(key)) { @@ -196,11 +197,11 @@ export default Component.extend({ this.set('strobeOnInervalHandle', setInterval(this.strobeStep.bind(this), 500)); } else { // revert the light system to pre-strobe - let preStrobeOnLightsDataCache = this.get('preStrobeOnLightsDataCache'), updateLight = (lightIndex)=> { + let preStrobeOnLightsDataCache = this.get('preStrobeOnLightsDataCache'), updateLight = (lightIndex) => { $.ajax(this.get('apiURL') + '/lights/' + lightIndex + '/state', { data: JSON.stringify({ - 'on': preStrobeOnLightsDataCache[lightIndex].state.on, - 'sat': preStrobeOnLightsDataCache[lightIndex].state.sat + on: preStrobeOnLightsDataCache[lightIndex].state.on, + sat: preStrobeOnLightsDataCache[lightIndex].state.sat }), contentType: 'application/json', type: 'PUT' @@ -221,51 +222,52 @@ export default Component.extend({ }), strobeStep() { - let lastStrobeLight = (this.get('lastStrobeLight') + 1) % (this.get('activeLights').length + 1), - turnOnOptions = {'on': true, 'transitiontime': 0, 'alert': 'select'}; + let nextLightIdx = this.get('nextLightIdx') % this.get('activeLights').length, + nextStrobeLight = this.get('activeLights')[nextLightIdx], + turnOnOptions = { on: true, transitiontime: 0, alert: 'select' }; // random light if in cololoop mode - if(this.get('colorLoopOn')) { + if (this.get('colorLoopOn')) { turnOnOptions.hue = Math.floor(Math.random() * 65535); } - $.ajax(this.get('apiURL') + '/lights/' + lastStrobeLight + '/state', { + $.ajax(this.get('apiURL') + '/lights/' + nextStrobeLight + '/state', { data: JSON.stringify(turnOnOptions), contentType: 'application/json', type: 'PUT' }); - $.ajax(this.get('apiURL') + '/lights/' + lastStrobeLight + '/state', { - data: JSON.stringify({'on': false, 'transitiontime': 0}), + $.ajax(this.get('apiURL') + '/lights/' + nextStrobeLight + '/state', { + data: JSON.stringify({ 'on': false, 'transitiontime': 0 }), contentType: 'application/json', type: 'PUT' }); - this.set('lastStrobeLight', lastStrobeLight); + this.set('nextLightIdx', ++nextLightIdx); }, strobeOnTxt: computed('strobeOn', function () { return this.get('strobeOn') ? 'On' : 'Off'; }), - dimmerOnClass: computed('dimmerOn', function(){ + dimmerOnClass: computed('dimmerOn', function () { return this.get('dimmerOn') ? 'dimmerOn' : null; }), actions: { - toggleDimmer(){ + toggleDimmer() { this.sendAction('toggleDimmer'); } }, // **************** STROBE LIGHT FINISH **************** // http://www.developers.meethue.com/documentation/color-conversions-rgb-xy - rgbToXy(red, green, blue){ + rgbToXy(red, green, blue) { let X, Y, Z, x, y; // normalize - red = Number((red/255)); - green = Number((green/255)); - blue = Number((blue/255)); + red = Number((red / 255)); + green = Number((green / 255)); + blue = Number((blue / 255)); // gamma correction red = (red > 0.04045) ? Math.pow((red + 0.055) / (1.0 + 0.055), 2.4) : (red / 12.92); @@ -280,10 +282,10 @@ export default Component.extend({ x = X / (X + Y + Z); y = Y / (X + Y + Z); - return [x,y]; + return [x, y]; }, - xyToRgb(x, y){ + xyToRgb(x, y) { let r, g, b, X, Y = 1.0, Z; X = (Y / y) * x; diff --git a/web/app/pods/components/lights-tab/template.hbs b/web/app/pods/components/lights-tab/template.hbs index acd9e25..552a9d8 100644 --- a/web/app/pods/components/lights-tab/template.hbs +++ b/web/app/pods/components/lights-tab/template.hbs @@ -7,11 +7,11 @@ {{#paper-item}} {{paper-icon "brightness-4" class=dimmerOnClass}} -Brightness
- {{paper-slider flex=true min=1 max=254 value=lightsBrightness disabled=brightnessControlDisabled}} +Brightness
+ {{paper-slider class="flex" discrete=true step="10" min="1" max="254" value=lightsBrightness disabled=brightnessControlDisabled}} {{/paper-item}} - {{#paper-item elementId="color-row"}} + {{#paper-item elementId="color-row" }} {{paper-icon "color-lens" class=dimmerOnClass}}Color
diff --git a/web/app/pods/components/music-tab/component.js b/web/app/pods/components/music-tab/component.js index 715bfec..92dc0b4 100644 --- a/web/app/pods/components/music-tab/component.js +++ b/web/app/pods/components/music-tab/component.js @@ -12,17 +12,17 @@ const { } = Ember; export default Component.extend(helperMixin, visualizerMixin, { - updatePageTitle: observer('playQueuePointer', function(){ + updatePageTitle: observer('playQueuePointer', function () { let title = 'Huegasm', playQueuePointer = this.get('playQueuePointer'), playQueue = this.get('playQueue'); - if(playQueuePointer !== -1){ + if (playQueuePointer !== -1) { let song = playQueue[playQueuePointer]; - if(song.title){ + if (song.title) { title = song.title; - if(song.artist){ + if (song.artist) { title += (' - ' + song.artist); } } else { @@ -35,14 +35,14 @@ export default Component.extend(helperMixin, visualizerMixin, { document.title = title; }), - changePlayerControl(name, value, saveBeatPrefs){ + changePlayerControl(name, value, saveBeatPrefs) { this.set(name, value); - if(name === 'threshold'){ - this.get('kick').set({threshold: value}); + if (name === 'threshold') { + this.get('kick').set({ threshold: value }); } - if(saveBeatPrefs && this.get('playQueuePointer') !== -1){ + if (saveBeatPrefs && this.get('playQueuePointer') !== -1) { this.saveSongBeatPreferences(); } @@ -51,11 +51,11 @@ export default Component.extend(helperMixin, visualizerMixin, { saveSongBeatPreferences() { let song = this.get('playQueue')[this.get('playQueuePointer')]; - if(song) { + if (song) { let title = isEmpty(song.artist) ? song.fileName : song.artist + '-' + song.title, songBeatPreferences = this.get('songBeatPreferences'); - songBeatPreferences[title] = {threshold: this.get('threshold')}; + songBeatPreferences[title] = { threshold: this.get('threshold') }; this.set('usingBeatPreferences', true); this.get('storage').set('huegasm.songBeatPreferences', songBeatPreferences); @@ -70,12 +70,12 @@ export default Component.extend(helperMixin, visualizerMixin, { oldBeatPrefCache = this.get('oldBeatPrefCache'), newOldBeatPrefCache = null; - if(!isNone(preference)) { // load existing beat prefs - newOldBeatPrefCache = {threshold: this.get('threshold')}; + if (!isNone(preference)) { // load existing beat prefs + newOldBeatPrefCache = { threshold: this.get('threshold') }; this.changePlayerControl('threshold', preference.threshold); this.set('usingBeatPreferences', true); - } else if(!isNone(oldBeatPrefCache)) { // revert to using beat prefs before the remembered song + } else if (!isNone(oldBeatPrefCache)) { // revert to using beat prefs before the remembered song this.changePlayerControl('threshold', oldBeatPrefCache.threshold); this.set('usingBeatPreferences', false); } @@ -86,11 +86,11 @@ export default Component.extend(helperMixin, visualizerMixin, { clearCurrentAudio(resetPointer) { let dancer = this.get('dancer'); - if(dancer.audio.pause) { + if (dancer.audio.pause) { dancer.pause(); } - if(resetPointer){ + if (resetPointer) { this.set('playQueuePointer', -1); } @@ -110,31 +110,31 @@ export default Component.extend(helperMixin, visualizerMixin, { } }, - dragLeave(){ + dragLeave() { // need to delay the dragLeave notification to avoid flickering ( hovering over some page elements causes this event to be sent ) - this.set('dragLeaveTimeoutHandle', setTimeout(()=>{ this.set('dragging', false); }, 500)); + this.set('dragLeaveTimeoutHandle', setTimeout(() => { this.set('dragging', false); }, 500)); }, simulateKick(/*mag, ratioKickMag*/) { let activeLights = this.get('activeLights'), lightsData = this.get('lightsData'), color = null, - + transitiontime = this.get('flashingTransitions'), stimulateLight = (light, brightness, hue) => { - let options = {'bri': brightness}; + let options = { 'bri': brightness }; - if(transitiontime) { + if (transitiontime) { options['transitiontime'] = 0; } else { options['transitiontime'] = 1; } - if(!isNone(hue)) { + if (!isNone(hue)) { options.hue = hue; } - if(lightsData[light].state.on === false){ + if (lightsData[light].state.on === false) { options.on = true; } @@ -146,7 +146,7 @@ export default Component.extend(helperMixin, visualizerMixin, { }, timeToBriOff = 100; - if(activeLights.length > 0){ + if (activeLights.length > 0) { let lastLightBopIndex = this.get('lastLightBopIndex'), lightBopIndex, brightnessRange = this.get('brightnessRange'), @@ -155,8 +155,8 @@ export default Component.extend(helperMixin, visualizerMixin, { lightBopIndex = Math.floor(Math.random() * activeLights.length); // let's try not to select the same light twice in a row - if(activeLights.length > 1) { - while(lightBopIndex === lastLightBopIndex) { + if (activeLights.length > 1) { + while (lightBopIndex === lastLightBopIndex) { lightBopIndex = Math.floor(Math.random() * activeLights.length); } } @@ -164,13 +164,13 @@ export default Component.extend(helperMixin, visualizerMixin, { light = activeLights[lightBopIndex]; this.set('lastLightBopIndex', lightBopIndex); - if(!this.get('colorloopMode')) { - let hueRange = this.get('hueRange'); + if (!this.get('colorloopMode')) { + let hueRange = this.get('hueRange'); - color = Math.floor(Math.random()*(hueRange[1] - hueRange[0] + 1)+hueRange[0]); + color = Math.floor(Math.random() * (hueRange[1] - hueRange[0] + 1) + hueRange[0]); } - if(transitiontime){ + if (transitiontime) { timeToBriOff = 80; } @@ -179,13 +179,13 @@ export default Component.extend(helperMixin, visualizerMixin, { } this.set('paused', true); - later(this, function(){ + later(this, function () { this.set('paused', false); }, 150); //work the music beat area - simulate the speaker vibration by running a CSS animation on it - $('#beat-speaker-center-outer').velocity({blur: 3}, 100).velocity({blur: 0}, 100); - $('#beat-speaker-center-inner').velocity({scale: 1.05}, 100).velocity({scale: 1}, 100); + $('#beat-speaker-center-outer').velocity({ blur: 3 }, 100).velocity({ blur: 0 }, 100); + $('#beat-speaker-center-inner').velocity({ scale: 1.05 }, 100).velocity({ scale: 1 }, 100); }, init() { @@ -213,11 +213,11 @@ export default Component.extend(helperMixin, visualizerMixin, { kick: kick }); - ['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'playerBottomDisplayed', 'songBeatPreferences', 'firstVisit', 'currentVisName', 'playQueue', 'playQueuePointer', 'flashingTransitions', 'colorloopMode', 'hueRange', 'brightnessRange'].forEach((item)=>{ + ['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'playerBottomDisplayed', 'songBeatPreferences', 'firstVisit', 'currentVisName', 'playQueue', 'playQueuePointer', 'flashingTransitions', 'colorloopMode', 'hueRange', 'brightnessRange'].forEach((item) => { if (!isNone(storage.get('huegasm.' + item))) { let itemVal = storage.get('huegasm.' + item); - if(isNone(this.actions[item+'Changed'])){ + if (isNone(this.actions[item + 'Changed'])) { this.set(item, itemVal); } else { this.send(item + 'Changed', itemVal); @@ -238,37 +238,37 @@ export default Component.extend(helperMixin, visualizerMixin, { let self = this; // file input code - $('#file-input').on('change', function() { + $('#file-input').on('change', function () { let files = this.files; self.send('handleNewFiles', files); this.value = null; // reset in case upload the second file again }); - $(document).on('click', '.alert', (event)=>{ + $(document).on('click', '.alert', (event) => { $(event.target).addClass('removed'); }); // prevent space/text selection when the user repeatedly clicks on the center - $('#beat-container').on('mousedown', '#beat-speaker-center-inner', function(event) { + $('#beat-container').on('mousedown', '#beat-speaker-center-inner', function (event) { event.preventDefault(); }); $(document).keypress((event) => { - if(event.which === 32 && event.target.type !== 'text'){ + if (event.which === 32 && event.target.type !== 'text') { this.send('play'); } }); - this.$().on('drop', '#play-list-area', (event)=>{ + this.$().on('drop', '#play-list-area', (event) => { this.send('dropFiles', event.dataTransfer.files); }); // control the volume by scrolling up/down - $('#player-area').on('mousewheel', (event)=>{ - if(this.get('playQueueNotEmpty')) { + $('#player-area').on('mousewheel', (event) => { + if (this.get('playQueueNotEmpty')) { let scrollSize = 5; - if(event.deltaY < 0) { + if (event.deltaY < 0) { scrollSize *= -1; } let newVolume = this.get('volume') + scrollSize; @@ -278,8 +278,8 @@ export default Component.extend(helperMixin, visualizerMixin, { } }); - // demo tracks - if(this.get('firstVisit')){ + // demo tracks + if (this.get('firstVisit')) { this.send('handleNewSoundCloudURL', 'https://soundcloud.com/mrsuicidesheep/candyland-speechless-feat-rkcb'); this.send('handleNewSoundCloudURL', 'https://soundcloud.com/dillistone/dillistone-lili-n-rude'); this.send('handleNewSoundCloudURL', 'https://soundcloud.com/mrsuicidesheep/vallis-alps-young-feki-remix'); @@ -291,93 +291,94 @@ export default Component.extend(helperMixin, visualizerMixin, { this.send('handleNewSoundCloudURL', 'https://soundcloud.com/mrsuicidesheep/90-pounds-of-pete-waited-too-long-feat-devon-baldwin'); this.send('handleNewSoundCloudURL', 'https://soundcloud.com/mrsuicidesheep/draper-eyes-open'); this.send('handleNewSoundCloudURL', 'https://soundcloud.com/itspapaya/sunny'); + this.send('handleNewSoundCloudURL', 'https://soundcloud.com/stonesthrow/nxworries-anderson-paak-knxwledge-suede'); this.get('storage').set('huegasm.firstVisit', false); this.sendAction(); } - if(!this.get('playerBottomDisplayed')) { + if (!this.get('playerBottomDisplayed')) { $('#player-bottom').hide(); } }, actions: { - clearPlaylist(){ + clearPlaylist() { this.get('playQueue').clear(); }, - setVisName(name){ + setVisName(name) { this.set('currentVisName', name); }, - hideTooltip(){ + hideTooltip() { $('.bootstrap-tooltip').tooltip('hide'); }, - gotoSCURL(URL){ + gotoSCURL(URL) { // need to pause the music since soundcloud is going to start playing this song anyways - if(this.get('playing')){ + if (this.get('playing')) { this.send('play'); } this.send('gotoURL', URL); }, - gotoURL(URL){ + gotoURL(URL) { $('.tooltip').remove(); window.open(URL, '_blank'); }, - handleNewSoundCloudURL(URL){ - if(URL) { - SC.resolve(URL).then((resultObj)=>{ - let processResult = (result)=>{ - if(result.kind === 'user'){ - this.get('notify').alert({html: this.get('scUserNotSupportedHtml')}); - } else if(result.kind === 'track') { - if(result.streamable === true){ - let picture = null; + handleNewSoundCloudURL(URL) { + if (URL) { + SC.resolve(URL).then((resultObj) => { + let processResult = (result) => { + if (result.kind === 'user') { + this.get('notify').alert({ html: this.get('scUserNotSupportedHtml') }); + } else if (result.kind === 'track') { + if (result.streamable === true) { + let picture = null; - if(result.artwork_url){ - picture = result.artwork_url.replace('large', 't67x67'); - } else if(result.user.avatar_url){ - picture = result.user.avatar_url; - } + if (result.artwork_url) { + picture = result.artwork_url.replace('large', 't67x67'); + } else if (result.user.avatar_url) { + picture = result.user.avatar_url; + } - $.get(picture) - .done(()=>{ - this.get('playQueue').pushObject({url: result.stream_url + '?client_id=' + this.get('SC_CLIENT_ID'), fileName: result.title + ' - ' + result.user.username, artist: result.user.username, scUrl: result.permalink_url, title: result.title, picture: picture }); - }).fail(()=>{ // no picture - this.get('playQueue').pushObject({url: result.stream_url + '?client_id=' + this.get('SC_CLIENT_ID'), fileName: result.title + ' - ' + result.user.username, artist: result.user.username, scUrl: result.permalink_url, title: result.title }); + $.get(picture) + .done(() => { + this.get('playQueue').pushObject({ url: result.stream_url + '?client_id=' + this.get('SC_CLIENT_ID'), fileName: result.title + ' - ' + result.user.username, artist: result.user.username, scUrl: result.permalink_url, title: result.title, picture: picture }); + }).fail(() => { // no picture + this.get('playQueue').pushObject({ url: result.stream_url + '?client_id=' + this.get('SC_CLIENT_ID'), fileName: result.title + ' - ' + result.user.username, artist: result.user.username, scUrl: result.permalink_url, title: result.title }); }); - } else { - failedSongs.push(result.title); - } - } else if(result.kind === 'playlist'){ - if(result.streamable === true){ - result.tracks.forEach(processResult); - } else { - failedSongs.push(result.title); - } + } else { + failedSongs.push(result.title); } - }, + } else if (result.kind === 'playlist') { + if (result.streamable === true) { + result.tracks.forEach(processResult); + } else { + failedSongs.push(result.title); + } + } + }, failedSongs = []; - if(resultObj instanceof Array){ + if (resultObj instanceof Array) { resultObj.forEach(processResult); } else { processResult(resultObj); } - if(failedSongs.length > 0) { - this.get('notify').alert({html: this.get('notStreamableHtml')(failedSongs)}); + if (failedSongs.length > 0) { + this.get('notify').alert({ html: this.get('notStreamableHtml')(failedSongs) }); } - if(this.get('playQueuePointer') === -1){ - if(this.get('firstVisit')){ + if (this.get('playQueuePointer') === -1) { + if (this.get('firstVisit')) { this.send('goToSong', 0); } else { this.send('next'); } } }, () => { - this.get('notify').alert({html: this.get('urlNotFoundHtml')(URL)}); + this.get('notify').alert({ html: this.get('urlNotFoundHtml')(URL) }); }); } @@ -386,57 +387,57 @@ export default Component.extend(helperMixin, visualizerMixin, { toggleIsShowingAddSoundCloudModal() { this.toggleProperty('isShowingAddSoundCloudModal'); }, - slideTogglePlayerBottom(){ + slideTogglePlayerBottom() { let elem = this.$('#player-bottom'); elem.velocity(elem.is(':visible') ? 'slideUp' : 'slideDown', { duration: 300 }); this.changePlayerControl('playerBottomDisplayed', !this.get('playerBottomDisplayed')); }, - goToSong(index, playSong, scrollToSong){ + goToSong(index, playSong, scrollToSong) { let dancer = this.get('dancer'), playQueue = this.get('playQueue'); - if(dancer.audio) { + if (dancer.audio) { this.clearCurrentAudio(true); } - if(!isNone(playQueue[index])) { + if (!isNone(playQueue[index])) { let audio = new Audio(); audio.src = this.get('playQueue')[index].url; audio.crossOrigin = "anonymous"; - audio.oncanplay = ()=>{ + audio.oncanplay = () => { this.set('timeTotal', Math.floor(audio.duration)); this.set('soundCloudFuckUps', 0); }; - audio.onerror = (event)=>{ - let playQueuePointer =this.get('playQueuePointer'), + audio.onerror = (event) => { + let playQueuePointer = this.get('playQueuePointer'), song = this.get('playQueue')[playQueuePointer]; - if(this.get('soundCloudFuckUps') >= this.get('maxSoundCloudFuckUps')) { - this.get('notify').alert({html: this.get('tooManySoundCloudFuckUps')}); + if (this.get('soundCloudFuckUps') >= this.get('maxSoundCloudFuckUps')) { + this.get('notify').alert({ html: this.get('tooManySoundCloudFuckUps') }); this.send('play'); this.set('soundCloudFuckUps', 0); } else { - if(song.local){ + if (song.local) { this.send('removeAudio', playQueuePointer); } else { this.send('next', true); } - if(event.target.error.code === 2){ - this.get('notify').alert({html: this.get('failedToDecodeFileHtml')(song.fileName)}); + if (event.target.error.code === 2) { + this.get('notify').alert({ html: this.get('failedToDecodeFileHtml')(song.fileName) }); } else { - this.get('notify').alert({html: this.get('failedToPlayFileHtml')(song.fileName)}); + this.get('notify').alert({ html: this.get('failedToPlayFileHtml')(song.fileName) }); } this.set('usingBeatPreferences', false); this.incrementProperty('soundCloudFuckUps'); } }; - audio.ontimeupdate = ()=>{ + audio.ontimeupdate = () => { this.set('timeElapsed', Math.floor(audio.currentTime)); }; - audio.onended = ()=> { + audio.onended = () => { this.send('next'); }; @@ -446,33 +447,33 @@ export default Component.extend(helperMixin, visualizerMixin, { this.loadSongBeatPreferences(); - if(playSong){ + if (playSong) { this.send('play'); } - if(scrollToSong){ + if (scrollToSong) { // this is just a bad workaround to make sure that the track has been rendered to the playlist - next(this, ()=>{ - $('.track'+index).velocity('scroll', { container: $('#play-list-area'), duration: 200 }); + next(this, () => { + $('.track' + index).velocity('scroll', { container: $('#play-list-area'), duration: 200 }); }); } } }, - removeAudio(index){ + removeAudio(index) { this.get('playQueue').removeAt(index); // need to manually remove the tooltip $('body .tooltip').remove(); - if(index === this.get('playQueuePointer')) { + if (index === this.get('playQueuePointer')) { this.send('goToSong', index, true, true); } }, - playerAreaPlay(){ - if(isEmpty($('#player-controls:hover')) && this.get('playQueuePointer') !== -1 ){ + playerAreaPlay() { + if (isEmpty($('#player-controls:hover')) && this.get('playQueuePointer') !== -1) { this.send('play'); - $('#play-notification').velocity({opacity: 0.8, scale: 1}, 0).velocity({opacity: 0, scale: 3}, 500); + $('#play-notification').velocity({ opacity: 0.8, scale: 1 }, 0).velocity({ opacity: 0, scale: 3 }, 500); } }, play(replayPause) { @@ -481,22 +482,22 @@ export default Component.extend(helperMixin, visualizerMixin, { playing = this.get('playing'), lightsData = this.get('lightsData'); - if(playQueuePointer !== -1 ) { + if (playQueuePointer !== -1) { if (playing) { dancer.pause(); let preMusicLightsDataCache = this.get('preMusicLightsDataCache'), - updateLight = (lightIndex)=> { + updateLight = (lightIndex) => { $.ajax(this.get('apiURL') + '/lights/' + lightIndex + '/state', { - data: JSON.stringify({ - 'on': preMusicLightsDataCache[lightIndex].state.on, - 'hue': preMusicLightsDataCache[lightIndex].state.hue, - 'bri': preMusicLightsDataCache[lightIndex].state.bri - }), - contentType: 'application/json', - type: 'PUT' - }); - }; + data: JSON.stringify({ + 'on': preMusicLightsDataCache[lightIndex].state.on, + 'hue': preMusicLightsDataCache[lightIndex].state.hue, + 'bri': preMusicLightsDataCache[lightIndex].state.bri + }), + contentType: 'application/json', + type: 'PUT' + }); + }; for (let key in lightsData) { if (lightsData.hasOwnProperty(key)) { @@ -504,20 +505,20 @@ export default Component.extend(helperMixin, visualizerMixin, { } } - if(!replayPause){ + if (!replayPause) { this.set('timeElapsed', Math.floor(dancer.getTime())); } } else { let timeTotal = this.get('timeTotal'); - if(this.get('volumeMuted')) { + if (this.get('volumeMuted')) { dancer.setVolume(0); } else { - dancer.setVolume(this.get('volume')/100); + dancer.setVolume(this.get('volume') / 100); } // replay song - if(this.get('timeElapsed') === timeTotal && timeTotal !== 0){ + if (this.get('timeElapsed') === timeTotal && timeTotal !== 0) { this.send('next', true); return; } @@ -535,11 +536,11 @@ export default Component.extend(helperMixin, visualizerMixin, { }, volumeChanged(value) { this.changePlayerControl('volume', value); - if(this.get('playing')) { - this.get('dancer').setVolume(value/100); + if (this.get('playing')) { + this.get('dancer').setVolume(value / 100); } - if(this.get('volume') > 0 && this.get('volumeMuted')){ + if (this.get('volume') > 0 && this.get('volumeMuted')) { this.changePlayerControl('volumeMuted', false); } }, @@ -550,17 +551,17 @@ export default Component.extend(helperMixin, visualizerMixin, { repeat = this.get('repeat'), shuffle = this.get('shuffle'); - if(repeat === 2){ // repeating one song takes precedence over shuffling - if(playQueuePointer === -1 && playQueue.length > 0) { + if (repeat === 2) { // repeating one song takes precedence over shuffling + if (playQueuePointer === -1 && playQueue.length > 0) { nextSong = 0; } else { nextSong = playQueuePointer; } - } else if(shuffle){ // next shuffle song + } else if (shuffle) { // next shuffle song let shufflePlayed = this.get('shufflePlayed'); // played all the song in shuffle mode - if(shufflePlayed.length === playQueue.length){ + if (shufflePlayed.length === playQueue.length) { shufflePlayed.clear(); this.send('play', true); return; @@ -569,11 +570,11 @@ export default Component.extend(helperMixin, visualizerMixin, { // we're going to assume that the song URL is the id do { nextSong = Math.floor(Math.random() * playQueue.length); - } while(shufflePlayed.includes(playQueue[nextSong].url)); + } while (shufflePlayed.includes(playQueue[nextSong].url)); shufflePlayed.pushObject(playQueue[nextSong].url); - } else if(nextSong > playQueue.length-1){ - if(repeat === 1 || repeatAll){ + } else if (nextSong > playQueue.length - 1) { + if (repeat === 1 || repeatAll) { nextSong = nextSong % playQueue.length; } else { this.send('play', true); @@ -584,26 +585,26 @@ export default Component.extend(helperMixin, visualizerMixin, { this.send('goToSong', nextSong, true, true); }, previous() { - if(this.get('timeElapsed') > 5) { + if (this.get('timeElapsed') > 5) { this.send('seekChanged', 0); } else { let nextSong = this.get('playQueuePointer'), playQueue = this.get('playQueue'); - if(this.get('shuffle') && !isNone(playQueue[nextSong])) { // go to the previously shuffled song + if (this.get('shuffle') && !isNone(playQueue[nextSong])) { // go to the previously shuffled song let shufflePlayed = this.get('shufflePlayed'), shuffledSongIndx = this.get('shufflePlayed').indexOf(playQueue[nextSong].url), i = 0; - if(shufflePlayed.length > 0 && shuffledSongIndx !== -1){ // only if there was one + if (shufflePlayed.length > 0 && shuffledSongIndx !== -1) { // only if there was one nextSong = shuffledSongIndx - 1; - if(nextSong < 0){ + if (nextSong < 0) { nextSong = shufflePlayed.length - 1; } - playQueue.some(function(item){ // try to find the previous song id - if(item.url === shufflePlayed[nextSong]){ + playQueue.some(function (item) { // try to find the previous song id + if (item.url === shufflePlayed[nextSong]) { nextSong = i; return true; } @@ -615,7 +616,7 @@ export default Component.extend(helperMixin, visualizerMixin, { } else { nextSong--; - if(nextSong < 0) { + if (nextSong < 0) { nextSong = playQueue.length - 1; } } @@ -626,7 +627,7 @@ export default Component.extend(helperMixin, visualizerMixin, { seekChanged(position) { let dancer = this.get('dancer'); - if(dancer.audio){ + if (dancer.audio) { dancer.audio.currentTime = Math.floor(this.get('timeTotal') * position / 100); } }, @@ -636,11 +637,11 @@ export default Component.extend(helperMixin, visualizerMixin, { this.changePlayerControl('volumeMuted', volumeMuted); - if(this.get('playing')){ - if(volumeMuted){ + if (this.get('playing')) { + if (volumeMuted) { dancer.setVolume(0); } else { - dancer.setVolume(this.get('volume')/100); + dancer.setVolume(this.get('volume') / 100); } } }, @@ -665,33 +666,33 @@ export default Component.extend(helperMixin, visualizerMixin, { hueRangeChanged(value) { this.changePlayerControl('hueRange', value); }, - playQueuePointerChanged(value){ + playQueuePointerChanged(value) { this.send('goToSong', value, false, true); }, - clickSpeaker(){ + clickSpeaker() { this.simulateKick(1); }, - dropFiles(files){ + dropFiles(files) { this.setProperties({ dragging: false, draggingOverPlayListArea: false }); this.send('handleNewFiles', files); }, - playerListAreaDragOver(){ + playerListAreaDragOver() { this.set('draggingOverPlayListArea', true); }, - playerListAreaDragLeave(){ + playerListAreaDragLeave() { this.set('draggingOverPlayListArea', false); }, - handleNewFiles(files){ + handleNewFiles(files) { let self = this, playQueue = this.get('playQueue'), - updatePlayQueue = function(){ + updatePlayQueue = function () { let tags = ID3.getAllTags("local"), picture = null; - if(tags.picture){ + if (tags.picture) { let base64String = ""; for (let i = 0; i < tags.picture.data.length; i++) { base64String += String.fromCharCode(tags.picture.data[i]); @@ -711,7 +712,7 @@ export default Component.extend(helperMixin, visualizerMixin, { ID3.clearAll(); - if(self.get('playQueuePointer') === -1){ + if (self.get('playQueuePointer') === -1) { self.send('next'); } }; @@ -720,8 +721,8 @@ export default Component.extend(helperMixin, visualizerMixin, { if (files.hasOwnProperty(key)) { let file = files[key]; - if(file.type.startsWith('audio')) { - ID3.loadTags("local", updatePlayQueue.bind(file),{ + if (file.type.startsWith('audio')) { + ID3.loadTags("local", updatePlayQueue.bind(file), { dataReader: new FileAPIReader(file), tags: ['title', 'artist', 'album', 'track', 'picture'] }); @@ -729,7 +730,7 @@ export default Component.extend(helperMixin, visualizerMixin, { } } }, - toggleDimmer(){ + toggleDimmer() { this.sendAction('toggleDimmer'); } } diff --git a/web/app/styles/bridge-finder.scss b/web/app/styles/bridge-finder.scss index e8f71c0..f6ef407 100644 --- a/web/app/styles/bridge-finder.scss +++ b/web/app/styles/bridge-finder.scss @@ -70,7 +70,4 @@ width: 100px; height: 100px; font-size: 28px; - &:hover { - background: darken(#3f51b5, 10%) !important; - } } diff --git a/web/app/styles/hue-controls.scss b/web/app/styles/hue-controls.scss index 48db329..e517619 100644 --- a/web/app/styles/hue-controls.scss +++ b/web/app/styles/hue-controls.scss @@ -4,9 +4,6 @@ .paper-icon { line-height: 0.8 !important; } - md-slider { - width: 50%; - } } .lights-control-tooltip + .tooltip { diff --git a/web/app/styles/paper.scss b/web/app/styles/paper.scss index 8fe3bf2..901c2b4 100644 --- a/web/app/styles/paper.scss +++ b/web/app/styles/paper.scss @@ -40,6 +40,10 @@ md-slider { cursor: pointer; } +.md-thumb-text { + user-select: none; +} + md-slider.md-default-theme .md-thumb:after { border-color: $secondaryThemeColor; background-color: $secondaryThemeColor; diff --git a/web/package.json b/web/package.json index b47db18..2f98722 100644 --- a/web/package.json +++ b/web/package.json @@ -44,4 +44,4 @@ "ember-source": "^2.11.0", "loader.js": "^4.0.7" } -} +} \ No newline at end of file