diff --git a/inst/tutorials/Grundlagen/Grundlagen.Rmd b/inst/tutorials/Grundlagen/Grundlagen.Rmd index bb26823..1bcd214 100644 --- a/inst/tutorials/Grundlagen/Grundlagen.Rmd +++ b/inst/tutorials/Grundlagen/Grundlagen.Rmd @@ -85,23 +85,216 @@ $(document).ready(function() { }); - var _paq = window._paq = window._paq || []; - /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ - _paq.push(["setRequestMethod", "POST"]); - _paq.push(['enableHeartBeatTimer', 5]); - _paq.push(['disableAlwaysUseSendBeacon']); - _paq.push(["setDoNotTrack", false]); - _paq.push(["setDomains", ["*.otter.uni-frankfurt.de", "*.otter-test.uni-frankfurt.de", "127.0.0.1"]]); - //_paq.push(["setCookieDomain", "*.otter.uni-frankfurt.de"]); - _paq.push(['trackPageView']); - _paq.push(['enableLinkTracking']); - (function() { - var u="https://otter.uni-frankfurt.de/otterusers/"; - _paq.push(['setTrackerUrl', u+'m.php']); - _paq.push(['setSiteId', '1']); - var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; - g.async=true; g.src=u+'m.js'; s.parentNode.insertBefore(g,s); - })(); + +/*! js-cookie v3.0.1 | MIT */ +; +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, (function () { + var current = global.Cookies; + var exports = global.Cookies = factory(); + exports.noConflict = function () { global.Cookies = current; return exports; }; + }())); +}(this, (function () { 'use strict'; + + /* eslint-disable no-var */ + function assign (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + target[key] = source[key]; + } + } + return target + } + /* eslint-enable no-var */ + + /* eslint-disable no-var */ + var defaultConverter = { + read: function (value) { + if (value[0] === '"') { + value = value.slice(1, -1); + } + return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent) + }, + write: function (value) { + return encodeURIComponent(value).replace( + /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, + decodeURIComponent + ) + } + }; + /* eslint-enable no-var */ + + /* eslint-disable no-var */ + + function init (converter, defaultAttributes) { + function set (key, value, attributes) { + if (typeof document === 'undefined') { + return + } + + attributes = assign({}, defaultAttributes, attributes); + + if (typeof attributes.expires === 'number') { + attributes.expires = new Date(Date.now() + attributes.expires * 864e5); + } + if (attributes.expires) { + attributes.expires = attributes.expires.toUTCString(); + } + + key = encodeURIComponent(key) + .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent) + .replace(/[()]/g, escape); + + var stringifiedAttributes = ''; + for (var attributeName in attributes) { + if (!attributes[attributeName]) { + continue + } + + stringifiedAttributes += '; ' + attributeName; + + if (attributes[attributeName] === true) { + continue + } + + // Considers RFC 6265 section 5.2: + // ... + // 3. If the remaining unparsed-attributes contains a %x3B (";") + // character: + // Consume the characters of the unparsed-attributes up to, + // not including, the first %x3B (";") character. + // ... + stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; + } + + return (document.cookie = + key + '=' + converter.write(value, key) + stringifiedAttributes) + } + + function get (key) { + if (typeof document === 'undefined' || (arguments.length && !key)) { + return + } + + // To prevent the for loop in the first place assign an empty array + // in case there are no cookies at all. + var cookies = document.cookie ? document.cookie.split('; ') : []; + var jar = {}; + for (var i = 0; i < cookies.length; i++) { + var parts = cookies[i].split('='); + var value = parts.slice(1).join('='); + + try { + var foundKey = decodeURIComponent(parts[0]); + jar[foundKey] = converter.read(value, foundKey); + + if (key === foundKey) { + break + } + } catch (e) {} + } + + return key ? jar[key] : jar + } + + return Object.create( + { + set: set, + get: get, + remove: function (key, attributes) { + set( + key, + '', + assign({}, attributes, { + expires: -1 + }) + ); + }, + withAttributes: function (attributes) { + return init(this.converter, assign({}, this.attributes, attributes)) + }, + withConverter: function (converter) { + return init(assign({}, this.converter, converter), this.attributes) + } + }, + { + attributes: { value: Object.freeze(defaultAttributes) }, + converter: { value: Object.freeze(converter) } + } + ) + } + + var api = init(defaultConverter, { path: '/' }); + /* eslint-enable no-var */ + + return api; + +}))); + +var _paq = window._paq = window._paq || []; +jQuery(document).ready(function() { + const cookiebanner = ``; + + const loadScripts = function() { + /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ + _paq.push(["setRequestMethod", "POST"]); + _paq.push(['enableHeartBeatTimer', 5]); + _paq.push(['disableAlwaysUseSendBeacon']); + _paq.push(["setDoNotTrack", false]); + _paq.push(["setDomains", ["*.otter.uni-frankfurt.de", "*.otter-test.uni-frankfurt.de", "127.0.0.1"]]); + //_paq.push(["setCookieDomain", "*.otter.uni-frankfurt.de"]); + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + (function() { + var u="https://otter.uni-frankfurt.de/otterusers/"; + _paq.push(['setTrackerUrl', u+'m.php']); + _paq.push(['setSiteId', '1']); + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; + g.async=true; g.src=u+'m.js'; s.parentNode.insertBefore(g,s); + })(); + }; + + const consent = Cookies.get('cnsnt'); + if(consent == undefined || consent == "0") { + jQuery("body").append(jQuery(cookiebanner)); + jQuery('#cookie-okay').on("click", function() { + Cookies.set('cnsnt', '1', { expires: 180, sameSite: 'strict' }); + loadScripts(); + + jQuery('#staticBackdrop').modal("hide"); + }); + + jQuery('#cookie-nokay').on("click", function() { + Cookies.set('cnsnt', '0', { expires: 30, sameSite: 'strict' }); + }); + + jQuery('#staticBackdrop').on('hidden.bs.show', function (event) { + jQuery(this).css('display', 'flex'); + }); + + jQuery('#staticBackdrop').modal({backdrop: false, show: true, keyboard: false}); + } else if(consent == "1" || consent === 1) { + loadScripts(); + } +}); + + diff --git a/inst/tutorials/Grundlagen/Grundlagen.html b/inst/tutorials/Grundlagen/Grundlagen.html index e281d37..dabd93e 100644 --- a/inst/tutorials/Grundlagen/Grundlagen.html +++ b/inst/tutorials/Grundlagen/Grundlagen.html @@ -182,23 +182,216 @@ }); - var _paq = window._paq = window._paq || []; - /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ - _paq.push(["setRequestMethod", "POST"]); - _paq.push(['enableHeartBeatTimer', 5]); - _paq.push(['disableAlwaysUseSendBeacon']); - _paq.push(["setDoNotTrack", false]); - _paq.push(["setDomains", ["*.otter.uni-frankfurt.de", "*.otter-test.uni-frankfurt.de", "127.0.0.1"]]); - //_paq.push(["setCookieDomain", "*.otter.uni-frankfurt.de"]); - _paq.push(['trackPageView']); - _paq.push(['enableLinkTracking']); - (function() { - var u="https://otter.uni-frankfurt.de/otterusers/"; - _paq.push(['setTrackerUrl', u+'m.php']); - _paq.push(['setSiteId', '1']); - var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; - g.async=true; g.src=u+'m.js'; s.parentNode.insertBefore(g,s); - })(); + +/*! js-cookie v3.0.1 | MIT */ +; +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, (function () { + var current = global.Cookies; + var exports = global.Cookies = factory(); + exports.noConflict = function () { global.Cookies = current; return exports; }; + }())); +}(this, (function () { 'use strict'; + + /* eslint-disable no-var */ + function assign (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + target[key] = source[key]; + } + } + return target + } + /* eslint-enable no-var */ + + /* eslint-disable no-var */ + var defaultConverter = { + read: function (value) { + if (value[0] === '"') { + value = value.slice(1, -1); + } + return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent) + }, + write: function (value) { + return encodeURIComponent(value).replace( + /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, + decodeURIComponent + ) + } + }; + /* eslint-enable no-var */ + + /* eslint-disable no-var */ + + function init (converter, defaultAttributes) { + function set (key, value, attributes) { + if (typeof document === 'undefined') { + return + } + + attributes = assign({}, defaultAttributes, attributes); + + if (typeof attributes.expires === 'number') { + attributes.expires = new Date(Date.now() + attributes.expires * 864e5); + } + if (attributes.expires) { + attributes.expires = attributes.expires.toUTCString(); + } + + key = encodeURIComponent(key) + .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent) + .replace(/[()]/g, escape); + + var stringifiedAttributes = ''; + for (var attributeName in attributes) { + if (!attributes[attributeName]) { + continue + } + + stringifiedAttributes += '; ' + attributeName; + + if (attributes[attributeName] === true) { + continue + } + + // Considers RFC 6265 section 5.2: + // ... + // 3. If the remaining unparsed-attributes contains a %x3B (";") + // character: + // Consume the characters of the unparsed-attributes up to, + // not including, the first %x3B (";") character. + // ... + stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; + } + + return (document.cookie = + key + '=' + converter.write(value, key) + stringifiedAttributes) + } + + function get (key) { + if (typeof document === 'undefined' || (arguments.length && !key)) { + return + } + + // To prevent the for loop in the first place assign an empty array + // in case there are no cookies at all. + var cookies = document.cookie ? document.cookie.split('; ') : []; + var jar = {}; + for (var i = 0; i < cookies.length; i++) { + var parts = cookies[i].split('='); + var value = parts.slice(1).join('='); + + try { + var foundKey = decodeURIComponent(parts[0]); + jar[foundKey] = converter.read(value, foundKey); + + if (key === foundKey) { + break + } + } catch (e) {} + } + + return key ? jar[key] : jar + } + + return Object.create( + { + set: set, + get: get, + remove: function (key, attributes) { + set( + key, + '', + assign({}, attributes, { + expires: -1 + }) + ); + }, + withAttributes: function (attributes) { + return init(this.converter, assign({}, this.attributes, attributes)) + }, + withConverter: function (converter) { + return init(assign({}, this.converter, converter), this.attributes) + } + }, + { + attributes: { value: Object.freeze(defaultAttributes) }, + converter: { value: Object.freeze(converter) } + } + ) + } + + var api = init(defaultConverter, { path: '/' }); + /* eslint-enable no-var */ + + return api; + +}))); + +var _paq = window._paq = window._paq || []; +jQuery(document).ready(function() { + const cookiebanner = ``; + + const loadScripts = function() { + /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ + _paq.push(["setRequestMethod", "POST"]); + _paq.push(['enableHeartBeatTimer', 5]); + _paq.push(['disableAlwaysUseSendBeacon']); + _paq.push(["setDoNotTrack", false]); + _paq.push(["setDomains", ["*.otter.uni-frankfurt.de", "*.otter-test.uni-frankfurt.de", "127.0.0.1"]]); + //_paq.push(["setCookieDomain", "*.otter.uni-frankfurt.de"]); + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + (function() { + var u="https://otter.uni-frankfurt.de/otterusers/"; + _paq.push(['setTrackerUrl', u+'m.php']); + _paq.push(['setSiteId', '1']); + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; + g.async=true; g.src=u+'m.js'; s.parentNode.insertBefore(g,s); + })(); + }; + + const consent = Cookies.get('cnsnt'); + if(consent == undefined || consent == "0") { + jQuery("body").append(jQuery(cookiebanner)); + jQuery('#cookie-okay').on("click", function() { + Cookies.set('cnsnt', '1', { expires: 180, sameSite: 'strict' }); + loadScripts(); + + jQuery('#staticBackdrop').modal("hide"); + }); + + jQuery('#cookie-nokay').on("click", function() { + Cookies.set('cnsnt', '0', { expires: 30, sameSite: 'strict' }); + }); + + jQuery('#staticBackdrop').on('hidden.bs.show', function (event) { + jQuery(this).css('display', 'flex'); + }); + + jQuery('#staticBackdrop').modal({backdrop: false, show: true, keyboard: false}); + } else if(consent == "1" || consent === 1) { + loadScripts(); + } +}); + + @@ -5142,16 +5335,16 @@

R Chunk (freies Üben)

@@ -5171,17 +5364,17 @@

R Chunk (freies Üben)

@@ -5421,16 +5614,16 @@

R Chunk (freies Üben)

@@ -5449,22 +5642,22 @@

R Chunk (freies Üben)

@@ -8103,16 +8296,16 @@

R Chunk (freies Üben)

@@ -8166,22 +8359,22 @@

R Chunk (freies Üben)

@@ -12246,7 +12439,7 @@

R Chunk (freies Üben)

diff --git a/inst/tutorials/Grundlagen/css/style.css b/inst/tutorials/Grundlagen/css/style.css index 976ed21..ece2439 100644 --- a/inst/tutorials/Grundlagen/css/style.css +++ b/inst/tutorials/Grundlagen/css/style.css @@ -584,4 +584,11 @@ h2.tutorialTitle, margin-bottom: 1em; } +/*-------Cookie banner stuff ------*/ +.modal-open .modal { + display: flex !important; +} +.modal-open { + overflow: unset !important; +}