lavkach3

Форк
0
94 строки · 2.7 Кб
1
var userSettings = {
2
    Layout: "vertical", // vertical | horizontal
3
    SidebarType: "mini-sidebar", // full | mini-sidebar
4
    BoxedLayout: true, // true | false
5
    Direction: "ltr", // ltr | rtl
6
    Theme: "light", // light | dark
7
    ColorTheme: "Cyan_Theme", // Blue_Theme | Aqua_Theme | Purple_Theme | Green_Theme | Cyan_Theme | Orange_Theme
8
    cardBorder: true, // true | false
9
    locale: "en"
10
};
11

12
function getCookieValue(name) {
13
    const nameString = name + "="
14

15
    const values = document.cookie.split(";").filter(item => {
16
        return item.includes(nameString)
17
    })
18
    if (values.length) {
19
        let value = []
20
        for (let val in values) {
21
            let is_value = values[val].split('=').filter(item => {
22
                return item.replace(' ', '') === name
23
            })
24
            if (is_value.length) {
25
                value = values[val]
26
                break
27
            }
28
        }
29
        if (value.length) {
30
            return value.substring(nameString.length, value.length).replace('=', '')
31
        }
32
    } else {
33
        return null
34
    }
35
}
36

37
function initUserSettings() {
38
    var Layout = getCookieValue("Layout");
39
    if (Layout) {
40
        userSettings.Layout = Layout;
41
    } else {
42
        document.cookie = "Layout="+userSettings.Layout+";path=/;"
43
    }
44

45
    var SidebarType = getCookieValue("SidebarType");
46
    if (SidebarType) {
47
        userSettings.SidebarType = SidebarType;
48
    } else {
49
        document.cookie = "SidebarType="+userSettings.SidebarType+";path=/;"
50
    }
51

52
    var BoxedLayout = getCookieValue("BoxedLayout");
53
    if (BoxedLayout) {
54
        userSettings.BoxedLayout = BoxedLayout;
55
    } else {
56
      document.cookie = "BoxedLayout="+userSettings.BoxedLayout+";path=/;"
57
    }
58

59
    var Direction = getCookieValue("Direction");
60
    if (Direction) {
61
        userSettings.Direction = Direction;
62
    } else {
63
        document.cookie = "Direction="+userSettings.Direction+";path=/;"
64
    }
65

66
    var Theme = getCookieValue("Theme");
67
    if (Theme) {
68
        userSettings.Theme = Theme;
69
    } else {
70
        document.cookie = "Theme="+userSettings.Theme+";path=/;"
71
    }
72

73
    var ColorTheme = getCookieValue("ColorTheme");
74
    if (ColorTheme) {
75
        userSettings.ColorTheme = ColorTheme;
76
    } else {
77
        document.cookie = "ColorTheme="+userSettings.ColorTheme+";path=/;"
78
    }
79

80
    var cardBorder = getCookieValue("cardBorder");
81
    if (cardBorder) {
82
        userSettings.cardBorder = cardBorder;
83
    } else {
84
        document.cookie = "cardBorder="+userSettings.cardBorder+";path=/;"
85
    }
86
    var locale = getCookieValue("locale");
87
    if (locale) {
88
        userSettings.locale = locale;
89
    } else {
90
        document.cookie = "locale="+userSettings.locale+";path=/;"
91
    }
92

93
}
94
initUserSettings()
95

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.