Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

chore: GDPR related changes #1866

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions build/_assets/javascripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -468,6 +483,9 @@ $(function() {
}

function readCookie(name) {
if(!isCategoryActive(3)) {
return null;
}
var nameEQ = name + "=";
var ca = document.cookie.split(';');

Expand Down
99 changes: 58 additions & 41 deletions build/_assets/javascripts/feedback-form.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$(document).ready(function () {

var Feedback = {};

var $window = $(window);

var defaultFormValues = {
email: "",
inaccurateContent: false,
Expand All @@ -25,17 +25,31 @@ $(document).ready(function () {
checkboxArea.find("span.k-tooltip-validation").remove();
checkboxArea.find("textarea").removeClass("k-invalid");
});

var formIsProcessing = false;
//Util functions
var generateUUID = function () {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
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.
Expand All @@ -45,16 +59,19 @@ $(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;
var popupNotification = $("#popupNotification").kendoNotification().data("kendoNotification");
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=/";
Expand All @@ -67,7 +84,7 @@ $(document).ready(function () {
}
document.cookie = name + "=" + value + ";";
};

//Feedback menu controls
var feedbackButtonsContainer = $("#feedback-buttons-container");
var feedbackSubmittedContainer = $("#feedback-submitted-container");
Expand All @@ -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({
Expand Down Expand Up @@ -116,7 +133,7 @@ $(document).ready(function () {
}
return isModelDefault;
};

var isFormModelSatisfied = function (key, formValue) {
var value = formModel[key];
if (value) {
Expand All @@ -139,9 +156,9 @@ $(document).ready(function () {
return !isFormModelEmpty();
}
}

}).data("kendoValidator");

var emailValidator = $("#feedback-email-input").kendoValidator({
validateOnBlur: false,
messages: {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -222,7 +239,7 @@ $(document).ready(function () {
}
}).data("kendoValidator");
};

feedbackForm.submit(function (e) {
e.preventDefault();
//if form is processing do nothing.
Expand All @@ -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())) &&
Expand Down Expand Up @@ -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");
Expand All @@ -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();
Expand All @@ -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);
Expand All @@ -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();
Expand All @@ -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() {
Expand All @@ -392,8 +409,8 @@ $(document).ready(function () {
}
},
// #endregion


// #region feedback bar
pinFeedback: function() {
feedbackPinned = true;
Expand All @@ -409,9 +426,9 @@ $(document).ready(function () {
Feedback.unpinFeedback();
}
// #endregion

});

Feedback.init();

});
14 changes: 12 additions & 2 deletions build/_includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,18 @@
</ul>
</div>
<script>
function getCookie(n) { for (var t = n + "=", e = document.cookie.split(";"), r = 0; r < e.length; r++) { for (var i = e[r]; " " === i.charAt(0);)i = i.substring(1, i.length); if (0 === i.indexOf(t)) return i.substring(t.length, i.length) } return null }
function setCookie(e, t, i) { var o; if (i) { var n = new Date; n.setTime(n.getTime() + 24 * i * 60 * 60 * 1e3), o = "; expires=" + n.toGMTString() } else o = ""; document.cookie = e + "=" + t + o + "; path=/" }
// 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 getCookie(n) { if(!isCategoryActive(1)){ return null; } for (var t = n + "=", e = document.cookie.split(";"), r = 0; r < e.length; r++) { for (var i = e[r]; " " === i.charAt(0);)i = i.substring(1, i.length); if (0 === i.indexOf(t)) return i.substring(t.length, i.length) } return null }
function setCookie(e, t, i) { if(!isCategoryActive(1)){ return; } var o; if (i) { var n = new Date; n.setTime(n.getTime() + 24 * i * 60 * 60 * 1e3), o = "; expires=" + n.toGMTString() } else o = ""; document.cookie = e + "=" + t + o + "; path=/" }
var urlJSON = window.location.origin.concat("/docs_versions.json");
$.getJSON(urlJSON, function (data) {
var varray = data[`versions`].sort((a, b) => parseFloat(a[`version`]) - parseFloat(b[`version`]));
Expand Down
16 changes: 8 additions & 8 deletions build/_layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W58JDD');</script>
<!-- End Google Tag Manager -->
<!-- Optimize Page Hiding Snippet -->
<style>.async-hide { opacity: 0 !important} </style>
<script>(function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
(a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
})(window,document.documentElement,'async-hide','dataLayer',4000,
{'GTM-W58JDD':true});</script>
<!-- Optimize Page Hiding Snippet -->
<style>.async-hide { opacity: 0 !important} </style>
<script>(function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
(a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
})(window,document.documentElement,'async-hide','dataLayer',4000,
{'GTM-W58JDD':true});</script>
<!-- end Optimize Page Hiding Snippet -->
<title>{% if page.titletag %}{{page.titletag}}{% else %}{{page.title}}{% endif %} - NativeScript Docs</title>
<link rel="preload" href="{{site.baseurl}}/{{page.category}}.json" as="script">
Expand All @@ -34,7 +34,7 @@
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.1.221/js/kendo.web.min.js"></script>
<script src="https://da189i1jfloii.cloudfront.net/js/kinvey-html5-sdk-3.10.1.min.js"></script>
<script src="https://cdn.cookielaw.org/consent/dc6bd370-357e-468e-916d-2c0b0f5fba8d.js"></script>
<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" data-language="en" type="text/javascript" charset="UTF-8" data-domain-script="4ec8216a-04c8-4b2d-97b9-dc460cc6e3f3"></script>
{% javascript prism %}
{% javascript app %}
</head>
Expand Down
Loading