Skip to content

Commit

Permalink
Merge pull request #869 from SkillsFundingAgency/CON-1400-radio-butto…
Browse files Browse the repository at this point in the history
…ns-not-showing-due-to-js-error

CON-1400-remove-old-cookie-code
  • Loading branch information
narendranogothu authored Feb 12, 2020
2 parents 7796e70 + c74cdac commit e8f546a
Showing 1 changed file with 0 additions and 65 deletions.
65 changes: 0 additions & 65 deletions src/Employer/Employer.Web/wwwroot/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,69 +68,6 @@ $(window).scroll(function () {
}
});

/* -----------------------
Cookie methods
--------------
Usage:
Setting a cookie:
CookieBanner.init('hobnob', 'tasty', { days: 30 });
Reading a cookie:
CookieBanner.init('hobnob');
Deleting a cookie:
CookieBanner.init('hobnob', null);
-------------------------- */
var CookieBanner = {
init: function (name, value, options) {
if (typeof value !== 'undefined') {
if (value === false || value === null) {
return CookieBanner.setCookie(name, '', { days: -1 })
} else {
return CookieBanner.setCookie(name, value, options)
}
} else {
return CookieBanner.getCookie(name)
}
},
setCookie: function (name, value, options) {
if (typeof options === 'undefined') {
options = {};
}
var cookieString = name + '=' + value + '; path=/';
if (options.days) {
var date = new Date();
date.setTime(date.getTime() + (options.days * 24 * 60 * 60 * 1000));
cookieString = cookieString + '; expires=' + date.toGMTString();
}
if (document.location.protocol === 'https:') {
cookieString = cookieString + '; Secure';
}
document.cookie = cookieString;
},
getCookie: function (name) {
var nameEQ = name + '=';
var cookies = document.cookie.split(';');
for (var i = 0, len = cookies.length; i < len; i++) {
var cookie = cookies[i];
while (cookie.charAt(0) === ' ') {
cookie = cookie.substring(1, cookie.length);
}
if (cookie.indexOf(nameEQ) === 0) {
return decodeURIComponent(cookie.substring(nameEQ.length))
}
}
return null
},
addCookieMessage: function () {
var message = document.querySelector('.js-cookie-banner');
var hasCookieMessage = (message && CookieBanner.init('seen_cookie_message') === null);

if (hasCookieMessage) {
message.style.display = 'block';
CookieBanner.init('seen_cookie_message', 'yes', { days: 28 });
}
}
};

/* -----------------------
Character count behaviour
-------------------------- */
Expand Down Expand Up @@ -287,8 +224,6 @@ function setEditorMaxLength(element, tinyMceEditor) {
}

$(function () {
// Add cookie message
CookieBanner.addCookieMessage();
//Legacy menu script
sfa.navigation.init();
$('ul#global-nav-links').collapsableNav();
Expand Down

0 comments on commit e8f546a

Please sign in to comment.