2013-04-08 01:15:04 +02:00
|
|
|
"use strict";
|
|
|
|
define(['app'], function () {
|
|
|
|
|
|
|
|
$.cookie.json = true;
|
|
|
|
|
2013-04-10 05:17:41 +02:00
|
|
|
NzbDrone.Config.SeriesViewStyle = function (value) {
|
|
|
|
var key = 'seriesViewStyle';
|
|
|
|
|
|
|
|
if (value !== undefined) {
|
|
|
|
NzbDrone.Config.SetValue(key, value);
|
2013-04-08 01:15:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
2013-04-10 05:17:41 +02:00
|
|
|
return NzbDrone.Config.GetValue(key, 1);
|
2013-04-08 01:15:04 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
NzbDrone.Config.GetValue = function (key, defaultValue) {
|
|
|
|
var cookie = NzbDrone.Config.GetCookie();
|
|
|
|
|
2013-04-10 05:17:41 +02:00
|
|
|
if (!cookie) {
|
|
|
|
return defaultValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
var value = cookie[key];
|
|
|
|
|
|
|
|
if (value === undefined) {
|
2013-04-08 01:15:04 +02:00
|
|
|
return defaultValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
NzbDrone.Config.SetValue = function (key, value) {
|
|
|
|
var cookie = NzbDrone.Config.GetCookie();
|
2013-04-10 05:17:41 +02:00
|
|
|
|
|
|
|
if (!cookie) {
|
|
|
|
cookie = {};
|
|
|
|
}
|
|
|
|
|
2013-04-08 01:15:04 +02:00
|
|
|
cookie[key] = value;
|
2013-04-10 05:17:41 +02:00
|
|
|
NzbDrone.Config.SetCookie(cookie);
|
2013-04-08 01:15:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
NzbDrone.Config.GetCookie = function () {
|
|
|
|
return $.cookie('NzbDroneConfig');
|
|
|
|
};
|
|
|
|
|
|
|
|
NzbDrone.Config.SetCookie = function (cookie) {
|
2013-04-10 05:17:41 +02:00
|
|
|
$.cookie('NzbDroneConfig', cookie, { expires: 365, path: '/' });
|
2013-04-08 01:15:04 +02:00
|
|
|
};
|
|
|
|
});
|