From aafd604f05c8bf15119ff1c8b88301a230e20003 Mon Sep 17 00:00:00 2001 From: Dmitry Fedyuk Date: Wed, 3 Jul 2019 19:01:16 +0600 Subject: [PATCH] 0.0.2 --- composer.json | 4 ++-- view/frontend/templates/popup.phtml | 30 ++--------------------- view/frontend/web/main.js | 37 +++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 30 deletions(-) create mode 100644 view/frontend/web/main.js diff --git a/composer.json b/composer.json index e09a651..37eb41a 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "kingpalm/adult" - ,"version": "0.0.1" + ,"version": "0.0.2" ,"description": "An adult confirmation module for kingpalm.com" ,"type": "magento2-module" ,"homepage": "https://github.com/kingpalm-com/adult" @@ -11,7 +11,7 @@ ,"homepage": "https://mage2.pro/users/dmitry_fedyuk" ,"role": "Developer" }] - ,"require": {"mage2pro/core": ">=4.8.8"} + ,"require": {"mage2pro/core": ">=4.8.9"} ,"autoload": {"files": ["registration.php"], "psr-4": {"KingPalm\\Adult\\": ""}} ,"keywords": ["Magento 2"] } \ No newline at end of file diff --git a/view/frontend/templates/popup.phtml b/view/frontend/templates/popup.phtml index 36e533c..edbd06d 100644 --- a/view/frontend/templates/popup.phtml +++ b/view/frontend/templates/popup.phtml @@ -6,35 +6,9 @@
  • Adult signature required upon delivery.
  • All products for tobacco and legal herbs use only.
  • - orExit - \ No newline at end of file + \ No newline at end of file diff --git a/view/frontend/web/main.js b/view/frontend/web/main.js new file mode 100644 index 0000000..9f11ef9 --- /dev/null +++ b/view/frontend/web/main.js @@ -0,0 +1,37 @@ +// 2019-07-03 +define(['jquery'], function($) {return ( +/** + * 2019-06-02 + * @param {Object} c + * @param {HTMLDivElement} e + */ +function(c, e) { + var $e = $(e); + $('button', $e).click(function() { + var days = 14; //number of days until they must go through the age checker again. + var date = new Date; + date.setTime (date.getTime() + days * 24 * 60 * 60 * 1000); + var expires = "; expires=" + date.toGMTString (); + document.cookie = 'isAnAdult=true;' + expires + "; path=/"; + location.reload(); + }); + (function() { + var readCookie = function() { + var nameEQ = 'isAnAdult='; + var ca = document.cookie.split(';'); + for (var i = 0; i < ca.length; i++) { + var c = ca[i]; + while (c.charAt (0) == ' ') { + c = c.substring (1, c.length); + } + if (c.indexOf (nameEQ) == 0) { + return c.substring (nameEQ.length, c.length); + } + } + return null; + }; + if (readCookie()) { + $e.hide(); + } + })(); +});}); \ No newline at end of file