1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-26 09:47:39 +00:00
Sonarr/UI/Config.js
Mark McDowall 35e2e83595 Merge branch 'series-grid' into vnext
Conflicts:
	UI/Config.js
2013-04-09 20:17:41 -07:00

54 lines
1.2 KiB
JavaScript

"use strict";
define(['app'], function () {
$.cookie.json = true;
NzbDrone.Config.SeriesViewStyle = function (value) {
var key = 'seriesViewStyle';
if (value !== undefined) {
NzbDrone.Config.SetValue(key, value);
}
else{
return NzbDrone.Config.GetValue(key, 1);
}
};
NzbDrone.Config.GetValue = function (key, defaultValue) {
var cookie = NzbDrone.Config.GetCookie();
if (!cookie) {
return defaultValue;
}
var value = cookie[key];
if (value === undefined) {
return defaultValue;
}
else {
return value;
}
};
NzbDrone.Config.SetValue = function (key, value) {
var cookie = NzbDrone.Config.GetCookie();
if (!cookie) {
cookie = {};
}
cookie[key] = value;
NzbDrone.Config.SetCookie(cookie);
};
NzbDrone.Config.GetCookie = function () {
return $.cookie('NzbDroneConfig');
};
NzbDrone.Config.SetCookie = function (cookie) {
$.cookie('NzbDroneConfig', cookie, { expires: 365, path: '/' });
};
});