Closed (fixed)
Project:
EU Cookie Compliance (GDPR Compliance)
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
6 Sep 2013 at 07:45 UTC
Updated:
10 Mar 2018 at 15:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
rroblik commentedHum ... first step may be more simple and lightweight :)
Why to not simply trigger a custom jQuery at the end of
Drupal.eu_cookie_compliance.setStatusfunction ?Could look like
And in template javascript (or custom module) we simply add listener to this event :
Working nice for me. What do you think about it ?
Note :
I saw during test that
Drupal.eu_cookie_compliance.setStatusis called twice when user click on agree button when "thanks popup" is disabled in config.I think it's a bug isn't it ?
Comment #2
pbuyle commentedStoring JavaScript code in database and executing it via
eval()is dangerous and error prone. facine's solution encourage bad and dangerous practices, rroblik's solution is far better and cleaner. But I would rather have a singleeu_cookie_compliancewith the set status as an extra argument. Something like$(document).trigger('eu_cookie_compliance', status)and in custom JavaScript$(document).on('eu_cookie_compliance', function(event, status) { ... }).Comment #3
rroblik commentedEven better !
Could you write a patch ?
(eval is not my way !)
Comment #4
gmario commentedHi,
I have write a patch. in attachment.
gmario
Comment #5
svenryen commentedHi @gmario, thanks for your patch on such an old issue.
I reversed the two parts of your event/action name, so that it reads 'eu_cookie_compliance.changeStatus', which to me just sounds better (don't really know why). I also passed the current status which I guess will be useful to know for the function that executes when triggered.
Can you do me the favor of reviewing this patch and give thumbs up if it matches your requirements, and doesn't introduce any bugs, then we can commit this to the dev branch.
Comment #6
svenryen commentedComment #7
svenryen commentedThis was added in commit 430e3009432c77c436efe3a329725b110282a909 on 19 Feb (not referencing this issue).