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