//****************************************************************** //* Copyright (c) 2007 Ford Motor Company. All Rights Reserved. //* //* //* $$Workfile: CookieLegislation.js $$ //* $$Author: grathnas $$ //* $$Date: May 14 2012 16:56:22 $$ //* //* Description: //* Cookie legislation related javascript code //****************************************************************** if(typeof EP2.cookieLegislation == "undefined") EP2.cookieLegislation = new Object(); //name of the cookie //value - true/false EP2.cookieLegislation.cookieName = 'ford_cookie_legislation_seen'; //Expiry in number of days (2 years) EP2.cookieLegislation.cookieExpiryDays = 730; //function to trigger the cookieLe EP2.cookieLegislation.trigger = function(){ if(this.hasSeenCookieLegislation()){ // do nothing..no popup // console.log("cookie present already seen it"); }else{ // User not accepted the cookie legislation // show the pop up this.display(); EP2.cookieLegislation.cookie(EP2.cookieLegislation.cookieExpiryDays); } }; //function to check for engine domain specific cookieLegislation //has the user seen it already EP2.cookieLegislation.hasSeenCookieLegislation = function(){ return readcookie(this.cookieName) == "true" ? true : false; }; //function to display the legislation pop up EP2.cookieLegislation.display = function (){ //$('#cookieAlertBoxID').css('display','block'); $('#cookieAlertBoxID').slideDown(1500); var closCookieAlert = function(){ var closebtn = $('#closeBtnID, #btnLinkID'); var otherBtn = $('#linkID'); closebtn.bind('click', function(e){ e.preventDefault(); EP2.cookieLegislation.cookie(EP2.cookieLegislation.cookieExpiryDays); //$('#cookieAlertBoxID').css('display','none'); $('#cookieAlertBoxID').slideUp(1500); }); otherBtn.bind('click', function(e){ e.preventDefault(); EP2.cookieLegislation.cookie(EP2.cookieLegislation.cookieExpiryDays); var getHREF = $(this).attr('href'); $('#cookieAlertBoxID').css('display','none'); location.href = getHREF; }); }; closCookieAlert(); }; //function to create legislation cookie EP2.cookieLegislation.cookie = function (days){ return document.cookie = this.cookieName+'=true', this.cookieExpiryDays+'='+days; }; //function to append the source tag of the IFrame based on cookie legislation EP2.cookieLegislation.appendIFrameSrc = function(elementId){ var src = $(elementId).attr('src'); if(EP2.cookieLegislation.hasSeenCookieLegislation()){ src = src + "&hc=true"; }else{ src = src + "&hc=false"; } $(elementId).attr('src', src); };