I presently have a module on http://hitechwolf.com that creates a welcome overlay upon a person’s first go to, This could work by using a jquery created cookie and displaying Drupal Development Service overlay based mostly on its existence. Drupal Developer jquery works, Drupal Development Service cookie is created, however for nameless customers Drupal Development Service cookie is ignored and Drupal Development Service overlay exhibits on each web page. I’ve applied jquery.cookie however it nonetheless utterly ignores Drupal Development Service cookie for nameless customers. I am at Drupal Development Service finish of my rope, any assist or alternate options would actually be appreciated.
welcome-overlay.js
/** * @file * Toggles Welcome Overlay, upon first button * clicks toggles totally different content material, second toggles overlay */ (operate ($, Drupal) { Drupal.behaviors.welcomeOverlay = { connect: operate () { var cookieName = 'firstWelcome'; cookieValue = 'returning'; cookieDays = 60; /** Create Cookie Creation Perform **/ operate createCookie(identify, worth, days) { if (days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); expires = "; expires=" + date.toGMTString(); } else { var expires = ""; } doc.cookie = identify + "=" + worth + expires + "; path=/"; } /** Examine for Specfic Cookie **/ operate readCookie(identify) { var nameEQ = identify + "="; ca = doc.cookie.break up(';'); for (var i = 0; i < ca.size; i++) { var c = ca[i]; whereas (c.charAt(0) == ' ') { c = c.substring(1, c.size); if (c.indexOf(nameEQ) === 0) { return c.substring(nameEQ.size, c.size); } } } return null; } /** Units worth equivalent to cookie existance **/ var visited = readCookie(cookieName); visited2 = doc.cookie.search(cookieName); /** If Non-existant Create Cookie and Present Content material **/ if (visited === null || visited2 < 0) { // $(doc).prepared(operate () { // Seconds Earlier than Overlay Slides Over Content material setTimeout(operate () { overlay.slideToggle('800', 'linear', operate () { appearFirst.fadeTo('800', 1, 'linear'); }); }, 1500); createCookie(cookieName, cookieValue, cookieDays); } } } })(jQuery, Drupal);
welcome-overlay.module
operate welcome_overlay_preprocess_page(&$variables) { /** Embody Drupal Development Service jquery.cookie plugin **/ drupal_add_library('system', 'jquery.cookie'); /** Connect jquery/css to module **/ $path = drupal_get_path('module', 'welcome_overlay'); drupal_add_css($path . '/welcome_overlay.css'); drupal_add_js($path . '/welcome_overlay.js'); }