-
Notifications
You must be signed in to change notification settings - Fork 0
/
ThemeOptions.js
43 lines (37 loc) · 1.26 KB
/
ThemeOptions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// DVZ Theme Options
function ThemeOptions(themeId)
{
try {
themeOptionCases = JSON.parse(themeOptionCases);
this.active = true;
} catch (e) {
this.active = false;
}
this.setOptionCase = function(option, optionCase)
{
// set manually to save name with sqaure brackets
document.cookie = cookiePrefix + 'theme_options[' + themeId + '][' + option + ']=' + optionCase + '; ' +
(cookieDomain !== '' ? 'domain=' + cookieDomain + '; ' : '') +
'path=' + cookiePath + '; ' +
'max-age=31536000; ' +
(cookieSecureFlag == true ? 'secure; ' : '');
themeOptionCases[option] = optionCase;
};
this.getOptionCase = function(option)
{
return themeOptionCases[option];
};
this.fetchApplyProperties = function(callback)
{
$.getJSON(rootpath + '/xmlhttp.php', {
action: 'theme_options_get_properties',
}, function (data) {
$('head link[rel="stylesheet"][data-theme-options="true"]').remove();
$('head').append(data['stylesheetsRendered']);
themeOptionCases = data['optionCases'];
if (typeof callback === 'function') {
callback(data);
}
});
};
};