prettier formatting

This commit is contained in:
Egor 2017-12-09 19:32:12 -08:00
parent ea6eb4f968
commit b64e19c3fe
13 changed files with 279 additions and 214 deletions

4
.prettierrc Normal file
View file

@ -0,0 +1,4 @@
{
"singleQuote": true,
"printWidth": 140
}

View file

@ -9,6 +9,7 @@ module.exports = {
browser: true
},
rules: {
'no-debugger': 'off'
},
globals: {
chrome: false,

View file

@ -1,15 +1,6 @@
import Ember from 'ember';
const {
Component,
observer,
computed,
on,
isNone,
run: { later },
$,
String: { htmlSafe }
} = Ember;
const { Component, observer, computed, on, isNone, run: { later }, $, String: { htmlSafe } } = Ember;
export default Component.extend({
elementId: 'bridge-finder',
@ -31,17 +22,20 @@ export default Component.extend({
isAuthenticating: computed.notEmpty('bridgePingIntervalHandle'),
// try to authenticate against the bridge here
onBridgeIpChange: on('init', observer('bridgeIp', function () {
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
});
}
})),
})
),
didInsertElement() {
$(document).keypress((event) => {
$(document).keypress(event => {
if (!isNone(this.get('manualBridgeIp')) && event.which === 13) {
this.send('findBridgeByIp');
}
@ -90,10 +84,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) => {
})
.done((result, status) => {
if (!this.isDestroyed) {
if (status === 'success' && !result[0].error) {
this.clearBridgePingIntervalHandle();
@ -101,16 +96,22 @@ export default Component.extend({
this.set('bridgeUsername', result[0].success.username);
}
}
}).fail(() => {
})
.fail(() => {
this.clearBridgePingIntervalHandle();
this.setProperties({
bridgeConnectError: true,
bridgeConnectMessage: htmlSafe('Your network and/or computer security settings are preventing Huegasm from connecting to your Hue bridge.' +
'<br><span>Feel free to contact us at <a href="mailto:huegasm.app@gmail.com">huegasm.app@gmail.com</a> if this is unexpected and you need help debugging the problem.</span>')
})
bridgeConnectMessage: htmlSafe(
'Your network and/or computer security settings are preventing Huegasm from connecting to your Hue bridge.' +
'<br><span>Feel free to contact us at <a href="mailto:huegasm.app@gmail.com">huegasm.app@gmail.com</a> if this is unexpected and you need help debugging the problem.</span>'
)
});
});
this.incrementProperty('bridgeUserNamePingIntervalProgress', this.get('bridgeUsernamePingIntervalTime') / bridgeUsernamePingMaxTime * 100);
this.incrementProperty(
'bridgeUserNamePingIntervalProgress',
this.get('bridgeUsernamePingIntervalTime') / bridgeUsernamePingMaxTime * 100
);
} else {
this.clearBridgePingIntervalHandle();
}
@ -140,18 +141,24 @@ 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(() => {
})
.fail(() => {
this.set('manualBridgeIpNotFound', true);
later(this, function () {
later(
this,
function() {
this.set('manualBridgeIpNotFound', false);
}, 5000);
}).then(() => {
},
5000
);
})
.then(() => {
this.send('chooseBridge', manualBridgeIp);
});
}
}
},
}
});

View file

@ -50,7 +50,7 @@
{{/unless}}
{{#if bridgeFindMultiple}}
<p>Huegasm found multiple hue bridges. <br> Please select the one you want to use for Huegasm.</p>
<p>Multiple Hue bridge were found on your network. <br> Please select the one you want to use for Huegasm.</p>
<div id="bridge-button-group">
{{#each multipleBridgeIps as |bridge|}}

View file

@ -51,7 +51,9 @@ export default Component.extend({
// here's a weird way to automatically initialize bootstrap tooltips
let observer = new MutationObserver(function(mutations) {
let haveTooltip = !mutations.every(function(mutation) {
return isEmpty(mutation.addedNodes) || isNone(mutation.addedNodes[0].classList) || mutation.addedNodes[0].classList.contains('tooltip');
return (
isEmpty(mutation.addedNodes) || isNone(mutation.addedNodes[0].classList) || mutation.addedNodes[0].classList.contains('tooltip')
);
});
if (haveTooltip) {
@ -92,7 +94,9 @@ export default Component.extend({
if (isNone(this.get('lightsData'))) {
this.send('clearBridge');
} else if (this.get('displayNextFailure')) {
this.get('notify').warning({ html: '<div class="alert alert-warning" role="alert">Error retrieving data from your lights. Yikes.</div>' });
this.get('notify').warning({
html: '<div class="alert alert-warning" role="alert">Error retrieving data from your lights. Yikes.</div>'
});
this.set('displayNextFailure', false);
later(
@ -174,7 +178,8 @@ export default Component.extend({
},
{
element: $('#playlist md-menu')[0],
intro: '<img src="/assets/images/soundcloudUrl.png" id="soundcloud-tutorial">You can add songs from SoundCloud by copy and pasting the URL shown here'
intro:
'<img src="/assets/images/soundcloudUrl.png" id="soundcloud-tutorial">You can add songs from SoundCloud by copy and pasting the URL shown here'
},
{
element: '#player-area',
@ -196,7 +201,9 @@ export default Component.extend({
},
{
element: '#beat-container',
intro: 'An interactive speaker that will bump when a beat is registered. <br><br>' + '<i><b>TIP</b>: Click on the center of the speaker to simulate a beat.</i>',
intro:
'An interactive speaker that will bump when a beat is registered. <br><br>' +
'<i><b>TIP</b>: Click on the center of the speaker to simulate a beat.</i>',
position: 'top'
},
{

View file

@ -1,10 +1,6 @@
import Ember from 'ember';
const {
Component,
isEmpty,
$
} = Ember;
const { Component, isEmpty, $ } = Ember;
export default Component.extend({
bridgeIp: null,

View file

@ -1,9 +1,6 @@
import Ember from 'ember';
const {
Component,
computed
} = Ember;
const { Component, computed } = Ember;
export default Component.extend({
tagName: 'footer',

View file

@ -1,14 +1,6 @@
import Ember from 'ember';
const {
A,
Component,
computed,
isEmpty,
isNone,
observer,
$
} = Ember;
const { A, Component, computed, isEmpty, isNone, observer, $ } = Ember;
export default Component.extend({
elementId: 'active-lights',
@ -211,7 +203,7 @@ export default Component.extend({
}
},
lightStartHover(id) {
if (!window.matchMedia || (window.matchMedia("(min-width: 768px)").matches)) {
if (!window.matchMedia || window.matchMedia('(min-width: 768px)').matches) {
let activeLights = this.get('activeLights'),
hoveredLight = this.get('lightsList').filter(function(light) {
return light.activeClass !== 'unreachable' && light.id === id[0] && activeLights.indexOf(id) !== -1;
@ -219,7 +211,7 @@ export default Component.extend({
if (!isEmpty(hoveredLight) && this.get('noHover') !== true) {
$.ajax(this.get('apiURL') + '/lights/' + id + '/state', {
data: JSON.stringify({ "alert": "lselect" }),
data: JSON.stringify({ alert: 'lselect' }),
contentType: 'application/json',
type: 'PUT'
});
@ -232,14 +224,14 @@ export default Component.extend({
}
},
lightStopHover(id) {
if (!window.matchMedia || (window.matchMedia("(min-width: 768px)").matches)) {
if (!window.matchMedia || window.matchMedia('(min-width: 768px)').matches) {
let hoveredLight = this.get('lightsList').filter(function(light) {
return light.activeClass !== 'unreachable' && light.id === id[0];
});
if (!isEmpty(hoveredLight) && this.get('noHover') !== true) {
$.ajax(this.get('apiURL') + '/lights/' + id + '/state', {
data: JSON.stringify({ "alert": "none" }),
data: JSON.stringify({ alert: 'none' }),
contentType: 'application/json',
type: 'PUT'
});

View file

@ -1,9 +1,6 @@
import Ember from 'ember';
const {
Component,
$
} = Ember;
const { Component, $ } = Ember;
export default Component.extend({
elementId: 'color-picker',

View file

@ -1,14 +1,6 @@
import Ember from 'ember';
const {
Component,
observer,
computed,
isEmpty,
isNone,
run: { later },
$
} = Ember;
const { Component, observer, computed, isEmpty, isNone, run: { later }, $ } = Ember;
export default Component.extend({
url: null,
@ -27,7 +19,7 @@ export default Component.extend({
}),
didInsertElement: function() {
$(document).keypress((event) => {
$(document).keypress(event => {
if (!this.get('saveDisabled') && event.which === 13) {
this.send('add');
}

View file

@ -17,7 +17,7 @@ export default Component.extend(helperMixin, visualizerMixin, {
title = song.title;
if (song.artist) {
title += (' - ' + song.artist);
title += ' - ' + song.artist;
}
} else {
title = song.fileName;
@ -64,12 +64,14 @@ export default Component.extend(helperMixin, visualizerMixin, {
oldBeatPrefCache = this.get('oldBeatPrefCache'),
newOldBeatPrefCache = null;
if (!isNone(preference)) { // load existing beat prefs
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);
}
@ -106,7 +108,12 @@ export default Component.extend(helperMixin, visualizerMixin, {
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() {
@ -168,20 +175,32 @@ export default Component.extend(helperMixin, visualizerMixin, {
timeToBriOff = 80;
}
later(this, () => {
later(
this,
() => {
stimulateLight(light, brightnessRange[1], true);
later(this, stimulateLight, light, brightnessRange[0], false, color, timeToBriOff);
}, this.get('beatDelay'));
},
this.get('beatDelay')
);
}
this.set('paused', true);
later(this, function () {
later(
this,
function() {
this.set('paused', false);
}, 200);
},
200
);
//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);
},
doAmbience(mag) {
@ -194,7 +213,8 @@ export default Component.extend(helperMixin, visualizerMixin, {
contentType: 'application/json',
type: 'PUT'
});
}, lightIndex = Math.floor(Math.random() * activeLights.length);
},
lightIndex = Math.floor(Math.random() * activeLights.length);
// let's try not to select the same light twice in a row
if (activeLights.length > 1) {
@ -217,7 +237,7 @@ export default Component.extend(helperMixin, visualizerMixin, {
}, 1000);
this.pauseAmbience = true;
let pauseTime = Math.floor(1000 + (2000 / activeLights.length));
let pauseTime = Math.floor(1000 + 2000 / activeLights.length);
setTimeout(() => {
this.pauseAmbience = false;
@ -228,9 +248,15 @@ export default Component.extend(helperMixin, visualizerMixin, {
init() {
this._super(...arguments);
window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame;
window.cancelAnimationFrame = window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.msCancelAnimationFrame;
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
window.requestAnimationFrame =
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.msRequestAnimationFrame;
window.cancelAnimationFrame =
window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.msCancelAnimationFrame;
navigator.getUserMedia =
navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
let dancer = new Dancer(),
storage = this.get('storage'),
@ -241,7 +267,7 @@ export default Component.extend(helperMixin, visualizerMixin, {
this.simulateKick(mag, ratioKickMag);
}
},
offKick: (mag) => {
offKick: mag => {
if (this.get('ambienceMode')) {
this.doAmbience(mag);
}
@ -255,7 +281,25 @@ export default Component.extend(helperMixin, visualizerMixin, {
kick: kick
});
['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'ambienceMode', 'blackoutMode', 'playerBottomDisplayed', 'songBeatPreferences', 'firstVisit', 'currentVisName', 'playQueue', 'playQueuePointer', 'flashingTransitions', 'hueRange', 'brightnessRange', 'beatDelay'].forEach((item) => {
[
'volume',
'shuffle',
'repeat',
'volumeMuted',
'threshold',
'ambienceMode',
'blackoutMode',
'playerBottomDisplayed',
'songBeatPreferences',
'firstVisit',
'currentVisName',
'playQueue',
'playQueuePointer',
'flashingTransitions',
'hueRange',
'brightnessRange',
'beatDelay'
].forEach(item => {
if (!isNone(storage.get('huegasm.' + item))) {
let itemVal = storage.get('huegasm.' + item);
@ -286,7 +330,7 @@ export default Component.extend(helperMixin, visualizerMixin, {
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');
});
@ -295,18 +339,18 @@ export default Component.extend(helperMixin, visualizerMixin, {
event.preventDefault();
});
$(document).keypress((event) => {
$(document).keypress(event => {
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) => {
$('#player-area').on('mousewheel', event => {
if (this.get('playQueueNotEmpty')) {
let scrollSize = 5;
@ -368,8 +412,9 @@ export default Component.extend(helperMixin, visualizerMixin, {
},
handleNewSoundCloudURL(URL) {
if (URL) {
SC.resolve(URL).then((resultObj) => {
let processResult = (result) => {
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') {
@ -384,9 +429,24 @@ export default Component.extend(helperMixin, visualizerMixin, {
$.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 });
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);
@ -418,9 +478,11 @@ export default Component.extend(helperMixin, visualizerMixin, {
this.send('next');
}
}
}, () => {
},
() => {
this.get('notify').alert({ html: this.get('urlNotFoundHtml')(URL) });
});
}
);
}
this.set('isShowingAddSoundCloudModal', false);
@ -435,7 +497,8 @@ export default Component.extend(helperMixin, visualizerMixin, {
this.changePlayerControl('playerBottomDisplayed', !this.get('playerBottomDisplayed'));
},
goToSong(index, playSong, scrollToSong) {
let dancer = this.get('dancer'), playQueue = this.get('playQueue');
let dancer = this.get('dancer'),
playQueue = this.get('playQueue');
if (dancer.audio) {
this.clearCurrentAudio(true);
@ -445,12 +508,12 @@ export default Component.extend(helperMixin, visualizerMixin, {
let audio = new Audio();
audio.src = this.get('playQueue')[index].url;
audio.crossOrigin = "anonymous";
audio.crossOrigin = 'anonymous';
audio.oncanplay = () => {
this.set('timeTotal', Math.floor(audio.duration));
this.set('soundCloudFuckUps', 0);
};
audio.onerror = (event) => {
audio.onerror = event => {
let playQueuePointer = this.get('playQueuePointer'),
song = this.get('playQueue')[playQueuePointer];
@ -514,7 +577,9 @@ export default Component.extend(helperMixin, visualizerMixin, {
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) {
@ -528,12 +593,12 @@ export default Component.extend(helperMixin, visualizerMixin, {
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
on: preMusicLightsDataCache[lightIndex].state.on,
hue: preMusicLightsDataCache[lightIndex].state.hue,
bri: preMusicLightsDataCache[lightIndex].state.bri
}),
contentType: 'application/json',
type: 'PUT'
@ -587,17 +652,19 @@ export default Component.extend(helperMixin, visualizerMixin, {
next(repeatAll) {
let playQueuePointer = this.get('playQueuePointer'),
playQueue = this.get('playQueue'),
nextSong = (playQueuePointer + 1),
nextSong = playQueuePointer + 1,
repeat = this.get('repeat'),
shuffle = this.get('shuffle');
if (repeat === 2) { // repeating one song takes precedence over shuffling
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
@ -631,19 +698,22 @@ export default Component.extend(helperMixin, visualizerMixin, {
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) {
nextSong = shufflePlayed.length - 1;
}
playQueue.some(function (item) { // try to find the previous song id
playQueue.some(function(item) {
// try to find the previous song id
if (item.url === shufflePlayed[nextSong]) {
nextSong = i;
return true;
@ -729,20 +799,20 @@ export default Component.extend(helperMixin, visualizerMixin, {
let self = this,
playQueue = this.get('playQueue'),
updatePlayQueue = function() {
let tags = ID3.getAllTags("local"),
let tags = ID3.getAllTags('local'),
picture = null;
if (tags.picture) {
let base64String = "";
let base64String = '';
for (let i = 0; i < tags.picture.data.length; i++) {
base64String += String.fromCharCode(tags.picture.data[i]);
}
picture = "data:" + tags.picture.format + ";base64," + window.btoa(base64String);
picture = 'data:' + tags.picture.format + ';base64,' + window.btoa(base64String);
}
playQueue.pushObject({
fileName: this.name.replace(/\.[^/.]+$/, ""),
fileName: this.name.replace(/\.[^/.]+$/, ''),
url: URL.createObjectURL(this),
artist: tags.artist,
title: tags.title,
@ -762,7 +832,7 @@ export default Component.extend(helperMixin, visualizerMixin, {
let file = files[key];
if (file.type.startsWith('audio') || file.type.startsWith('video')) {
ID3.loadTags("local", updatePlayQueue.bind(file), {
ID3.loadTags('local', updatePlayQueue.bind(file), {
dataReader: new FileAPIReader(file),
tags: ['title', 'artist', 'album', 'track', 'picture']
});

View file

@ -147,7 +147,9 @@ export default Mixin.create({
'<div class="alert alert-danger" role="alert">The SoundCloud API is not seving the audio properly. More details <a href="https://www.soundcloudcommunity.com/soundcloud/topics/some-soundcloud-cdn-hosted-tracks-dont-have-access-control-allow-origin-header" target="_blank" rel="noopener noreferrer">HERE</a>.</div>',
notStreamableHtml(fileNames) {
let html =
'<div class="alert alert-danger" role="alert">The following file(s) could not be added because they are not allowed to be streamed:<br>' + fileNames.toString().replace(/,/g, '<br>') + '</div>';
'<div class="alert alert-danger" role="alert">The following file(s) could not be added because they are not allowed to be streamed:<br>' +
fileNames.toString().replace(/,/g, '<br>') +
'</div>';
return html;
},
@ -319,7 +321,10 @@ export default Mixin.create({
}
}),
onOptionChange: observer('flashingTransitions', 'playQueue.[]', 'playQueuePointer', 'ambienceMode', 'blackoutMode', function(self, option) {
onOptionChange: observer('flashingTransitions', 'playQueue.[]', 'playQueuePointer', 'ambienceMode', 'blackoutMode', function(
self,
option
) {
option = option.replace('.[]', '');
let value = this.get(option);

View file

@ -1,10 +1,6 @@
import Ember from 'ember';
const {
Mixin,
observer,
$
} = Ember;
const { Mixin, observer, $ } = Ember;
export default Mixin.create({
currentVisName: 'None',
@ -30,7 +26,8 @@ export default Mixin.create({
playerArea = $('#player-area'),
ctx = canvas.getContext('2d'),
spacing = 2,
h = playerArea.height(), w;
h = playerArea.height(),
w;
canvas.height = h;
@ -71,7 +68,7 @@ export default Mixin.create({
ctx.beginPath();
ctx.moveTo(0, h / 2);
for (let i = 0, l = waveform.length; i < l && i < count; i++) {
ctx.lineTo(i * ( spacing + width ), ( h / 2 ) + waveform[i] * ( h / 2 ));
ctx.lineTo(i * (spacing + width), h / 2 + waveform[i] * (h / 2));
}
ctx.stroke();
ctx.closePath();