Skip to content

Dispatch custom event when user accepts the policy#6

Merged
a6software merged 2 commits intodevelopfrom
dispatch-custom-event-when-user-accepts-policy
Feb 8, 2019
Merged

Dispatch custom event when user accepts the policy#6
a6software merged 2 commits intodevelopfrom
dispatch-custom-event-when-user-accepts-policy

Conversation

@a6software
Copy link

Copy of upstream PR - trewknowledge#245

Dispatch a custom event so we can do "interesting things" from elsewhere when the user accepts the policy.

In my example I want to redirect the user to the same page, but with a cache buster on the end of the URL:

jQuery( document )
	.on(
		"updatedPrivacyPreferences",
		function() {
			"use strict";

			var current_url = encodeURI( window.location.href );
			var qs_concat = current_url.indexOf( "?" ) > -1 ? "&" : "?";

			window.location = encodeURI( current_url + qs_concat + "ts=" + new Date().getTime() );
		}
	);

$(window).scrollTop(Math.abs( parseInt( scrollDistance, 10 ) ) );
$('.gdpr.gdpr-privacy-preferences .gdpr-wrapper').fadeOut();
$('.gdpr-privacy-bar').fadeOut();
$( document ).trigger( "updatedPrivacyPreferences" );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor prefer single quotes as per the existing style of this file.

@a6software a6software merged commit fdf7f4d into develop Feb 8, 2019
@a6software a6software deleted the dispatch-custom-event-when-user-accepts-policy branch February 8, 2019 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants