diff --git a/build/_assets/javascripts/app.js b/build/_assets/javascripts/app.js index 008843c83..69d1c3540 100644 --- a/build/_assets/javascripts/app.js +++ b/build/_assets/javascripts/app.js @@ -455,7 +455,22 @@ $(function(){ $(function() { 'use strict'; + + // categories: + // 1 - strictly neccessary + // 2 - performance cookies + // 3 - targeting cookies + // 4 - functional cookies + function isCategoryActive(category) { + if (!window.OptanonActiveGroups) return false; + const groupMatchKey = ',' + category + ','; + return window.OptanonActiveGroups.indexOf(groupMatchKey) !== -1; + } + function createCookie(name,value,days) { + if(!isCategoryActive(3)) { + return; + } if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); @@ -468,6 +483,9 @@ $(function() { } function readCookie(name) { + if(!isCategoryActive(3)) { + return null; + } var nameEQ = name + "="; var ca = document.cookie.split(';'); diff --git a/build/_assets/javascripts/feedback-form.js b/build/_assets/javascripts/feedback-form.js index 990ff58a4..b5d4cec84 100644 --- a/build/_assets/javascripts/feedback-form.js +++ b/build/_assets/javascripts/feedback-form.js @@ -1,9 +1,9 @@ $(document).ready(function () { - + var Feedback = {}; - + var $window = $(window); - + var defaultFormValues = { email: "", inaccurateContent: false, @@ -25,7 +25,7 @@ $(document).ready(function () { checkboxArea.find("span.k-tooltip-validation").remove(); checkboxArea.find("textarea").removeClass("k-invalid"); }); - + var formIsProcessing = false; //Util functions var generateUUID = function () { @@ -33,9 +33,23 @@ $(document).ready(function () { var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); - }; - + }; + + // categories: + // 1 - strictly neccessary + // 2 - performance cookies + // 3 - targeting cookies + // 4 - functional cookies + var isCategoryActive = function(category) { + if (!window.OptanonActiveGroups) return !explicit; + const groupMatchKey = ',' + category + ','; + return window.OptanonActiveGroups.indexOf(groupMatchKey) !== -1; + } + var getCookieByName = function (name) { + if(!isCategoryActive(1)) { + return null; + } //This is very crude, but necessary because currently there is some kind of url rewriting going on //so the cookies are set for a base path but then additional navigation is done with url rewriting //so we set the cookie name as complete path to avoid a problem where the cookie is set for multiple pages. @@ -45,7 +59,7 @@ $(document).ready(function () { var match = document.cookie.match(new RegExp(name + '=([^;]+)')); if (match) return match[1]; }; - + //Init utility variables var rawLocationObject = $(location); var currentPath = rawLocationObject[0].origin + rawLocationObject[0].pathname; @@ -53,8 +67,11 @@ $(document).ready(function () { var formPopupNotification = $("#feedback-form-popup-container").kendoNotification({ appendTo: "#feedback-form-window" }).data("kendoNotification"); - + var setCookieByName = function (name, value) { + if(!isCategoryActive(1)) { + return; + } var cookieUUID = getCookieByName("uuid"); if (!cookieUUID) { document.cookie = "uuid=" + generateUUID() + "; path=/"; @@ -67,7 +84,7 @@ $(document).ready(function () { } document.cookie = name + "=" + value + ";"; }; - + //Feedback menu controls var feedbackButtonsContainer = $("#feedback-buttons-container"); var feedbackSubmittedContainer = $("#feedback-submitted-container"); @@ -80,13 +97,13 @@ $(document).ready(function () { feedbackSubmittedContainer.show(); } }; - + if (getCookieByName("yesNoFeedback")) { toggleFeedbackButtons(false); } else { toggleFeedbackButtons(true); } - + //FORM //Init the form popup window var win = $("#feedback-form-window").kendoWindow({ @@ -116,7 +133,7 @@ $(document).ready(function () { } return isModelDefault; }; - + var isFormModelSatisfied = function (key, formValue) { var value = formModel[key]; if (value) { @@ -139,9 +156,9 @@ $(document).ready(function () { return !isFormModelEmpty(); } } - + }).data("kendoValidator"); - + var emailValidator = $("#feedback-email-input").kendoValidator({ validateOnBlur: false, messages: { @@ -175,7 +192,7 @@ $(document).ready(function () { } } }).data("kendoValidator"); - + // text validation is disabled for the new design of the form. In order to enable it // it must be reworked!!! var textAreaValidator = function (selector, formModelKey) { @@ -222,7 +239,7 @@ $(document).ready(function () { } }).data("kendoValidator"); }; - + feedbackForm.submit(function (e) { e.preventDefault(); //if form is processing do nothing. @@ -237,7 +254,7 @@ $(document).ready(function () { formIsProcessing = false; return; } - + if ((!formModel.outdatedSample || (formModel.outdatedSample && textAreaValidator("#feedback-code-sample-text-input", "outdatedSample").validate())) && (!formModel.otherMoreInformation || (formModel.otherMoreInformation && textAreaValidator("#feedback-more-information-text-input", "otherMoreInformation").validate())) && (!formModel.textErrors || (formModel.textErrors && textAreaValidator("#feedback-text-errors-text-input", "textErrors").validate())) && @@ -269,17 +286,17 @@ $(document).ready(function () { formIsProcessing = false; } }); - + //Attach to close button inside form window $("#form-close-button").click(function () { win.close(); }); - + //Attach to submit button inside form window $("#form-submit-button").click(function () { feedbackForm.submit(); }); - + //Init buttons $("#yesButton").click(function () { setCookieByName("yesNoFeedback", "Yes"); @@ -305,7 +322,7 @@ $(document).ready(function () { var showingFeedbackBar = false; var scrollFold = $window.scrollTop() + windowHeight; var feedbackPinned = false; - + function updateVariables() { windowHeight = $window.height(); headerHeight = $(".TK-Hat").outerHeight() + $(".ns-navigation").outerHeight(); @@ -314,30 +331,30 @@ $(document).ready(function () { feedbackOffsetTop = document.body.scrollHeight - footerHeight; scrollFold = $window.scrollTop() + windowHeight; } - + Feedback = $.extend(Feedback, { - + init: function() { - + Feedback._events(); - + Feedback.adjustArticleHeight(); Feedback.adjustNavigationPosition(); if (shouldOverlayFeedback) { - + showingFeedbackBar = true; - + window.setTimeout(function() { showingFeedbackBar = false; Feedback.toggleFeedback(); Feedback.adjustNavigationPosition(); }, 30000); } - + }, - - + + // #region events _events: function() { $window.scroll(Feedback._window_scroll); @@ -346,15 +363,15 @@ $(document).ready(function () { }, _window_scroll: function() { updateVariables(); - + scrollFold = $window.scrollTop() + windowHeight; - + Feedback.toggleFeedback(); Feedback.adjustNavigationPosition(); }, _window_resize: function() { updateVariables(); - + Feedback.adjustArticleHeight(); Feedback.toggleFeedback(); Feedback.adjustNavigationPosition(); @@ -364,16 +381,16 @@ $(document).ready(function () { Feedback.adjustNavigationPosition(); }, // #endregion - - + + // #region adjusters adjustNavigationPosition: function() { var bottom = 0; - + if (!window.matchMedia('(max-width: 1200px)').matches) { bottom = Math.max(feedbackPinned ? $("#feedback-section").outerHeight() : 0, scrollFold - feedbackOffsetTop ); } - + $("#page-nav").css("bottom", bottom); }, adjustArticleHeight: function() { @@ -392,8 +409,8 @@ $(document).ready(function () { } }, // #endregion - - + + // #region feedback bar pinFeedback: function() { feedbackPinned = true; @@ -409,9 +426,9 @@ $(document).ready(function () { Feedback.unpinFeedback(); } // #endregion - + }); Feedback.init(); - + }); diff --git a/build/_includes/header.html b/build/_includes/header.html index e10b50009..9df6cf665 100644 --- a/build/_includes/header.html +++ b/build/_includes/header.html @@ -71,8 +71,18 @@ - - - + + + {% if page.titletag %}{{page.titletag}}{% else %}{{page.title}}{% endif %} - NativeScript Docs @@ -34,7 +34,7 @@ - + {% javascript prism %} {% javascript app %} diff --git a/build/_layouts/landing.html b/build/_layouts/landing.html index 1165f41e9..ae3b36aa5 100644 --- a/build/_layouts/landing.html +++ b/build/_layouts/landing.html @@ -11,14 +11,14 @@ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-W58JDD'); - - - - + + + + {{page.title}} @@ -33,7 +33,7 @@ - + {% javascript prism %} {% javascript app %} @@ -44,7 +44,7 @@ height="0" width="0" style="display:none;visibility:hidden"> - +
{% include header.html %}