Browse code

Update

Benjamin Roth authored on17/03/2023 09:52:56
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,98 @@
1
+function setupFunctions() {
2
+    initFrames();
3
+    InitBasefeatures()
4
+}
5
+
6
+
7
+function initFrames() {
8
+    if (Cookies.get('cookie_iframes')) {
9
+        $('iframe[data-source],embed[data-source]').each(function (index) {
10
+            $(this).attr('src', $(this).data("source"));
11
+        });
12
+
13
+        $('.video-link').colorbox({
14
+            iframe: true,
15
+            width: '95%',
16
+            height: '95%',
17
+            maxWidth: '1024px',
18
+            maxHeight: '576px',
19
+            href: function () {
20
+                var videoId = new RegExp('[\\?&]v=([^&#]*)').exec(this.href);
21
+                if (videoId && videoId[1]) {
22
+                    return 'https://www.youtube-nocookie.com/embed/' + videoId[1] + '?rel=0&wmode=transparent&autoplay=1';
23
+                }
24
+            }
25
+        });
26
+    } else {
27
+        $('iframe[data-source],embed[data-source]').each(function (index) {
28
+            $(this).attr('src', 'iframe.php');
29
+        });
30
+
31
+        $('.video-link').colorbox({
32
+            iframe: true,
33
+            width: '95%',
34
+            height: '95%',
35
+            maxWidth: '1024px',
36
+            maxHeight: '576px',
37
+            href: function () {
38
+                var videoId = new RegExp('[\\?&]v=([^&#]*)').exec(this.href);
39
+                if (videoId && videoId[1]) {
40
+                    return 'iframe.php';
41
+                }
42
+            }
43
+        });
44
+    }
45
+}
46
+
47
+function InitBasefeatures() {
48
+    if (Cookies.get('cookie_basefeatures')) {
49
+
50
+    }
51
+}
52
+
53
+
54
+window.addEventListener('cookiebar_save', function (e) {
55
+    setupFunctions()
56
+}, false);
57
+
58
+
59
+setupFunctions()
60
+
61
+
62
+const btn = document.querySelector(".reset-cookies");
63
+
64
+if (btn) {
65
+    btn.addEventListener("click", function (e) {
66
+        e.preventDefault();
67
+
68
+
69
+        if (confirm('Dadurch werden alle Cookies gelöscht und die Seite wird neu geladen, fortfahren?')) {
70
+            window.localStorage.clear();
71
+
72
+
73
+            var cookies = document.cookie.split("; ");
74
+            for (var c = 0; c < cookies.length; c++) {
75
+                var d = window.location.hostname.split(".");
76
+                while (d.length > 0) {
77
+                    var cookieBase = encodeURIComponent(cookies[c].split(";")[0].split("=")[0]) + '=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=' + d.join('.') + ' ;path=';
78
+                    var p = location.pathname.split('/');
79
+                    document.cookie = cookieBase + '/';
80
+                    while (p.length > 0) {
81
+                        document.cookie = cookieBase + p.join('/');
82
+                        p.pop();
83
+                    }
84
+                    d.shift();
85
+                }
86
+            }
87
+
88
+            Object.keys(Cookies.get()).forEach(function (cookieName) {
89
+                var neededAttributes = {};
90
+                Cookies.remove(cookieName, neededAttributes);
91
+            });
92
+
93
+            window.location.reload();
94
+        } else {
95
+
96
+        }
97
+    });
98
+}
0 99
\ No newline at end of file