mirror of
https://github.com/IrosTheBeggar/mStream.git
synced 2025-10-27 07:31:02 +00:00
Store volume in cookies
This commit is contained in:
parent
7765187eb5
commit
cf166f7f01
@ -127,8 +127,6 @@ var VUEPLAYER = function () {
|
||||
jukeStats = JUKEBOX.stats
|
||||
}
|
||||
|
||||
|
||||
// TODO: Get volume from cookies
|
||||
new Vue({
|
||||
el: '#mstream-player',
|
||||
data: {
|
||||
@ -141,6 +139,12 @@ var VUEPLAYER = function () {
|
||||
lastVol: 100,
|
||||
isViz: false
|
||||
},
|
||||
created: function () {
|
||||
if(Cookies && Cookies.get('volume')) {
|
||||
this.curVol = Cookies.get('volume');
|
||||
MSTREAMPLAYER.changeVolume(parseInt(this.curVol));
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
curVol: function () {
|
||||
// TODO: Convert to log scale before sening to mstream
|
||||
@ -156,6 +160,10 @@ var VUEPLAYER = function () {
|
||||
// var scale = (maxv-minv) / (maxp-minp);
|
||||
//
|
||||
// var solution = Math.exp(minv + scale*(this.curVol-minp))
|
||||
if (Cookies) {
|
||||
Cookies.set('volume', parseInt(this.curVol));
|
||||
}
|
||||
|
||||
MSTREAMPLAYER.changeVolume(parseInt(this.curVol));
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user