blob: bb804bf59ce0f1b7c398695da6ebfdb2db1b0e54 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
( function ( $ ) {
'use strict';
var cssNudge = {
init: function () {
this.clickifyNavigateToButtons();
},
clickifyNavigateToButtons: function () {
var navButton = document.querySelector( '.navigate-to' );
if ( ! navButton ) {
return;
}
navButton.addEventListener( 'click', function () {
// Get destination.
var destination = this.getAttribute( 'data-navigate-to-page' );
if ( ! destination ) {
return;
}
// Fire Tracks click event.
window._tkq = window._tkq || [];
window._tkq.push( [
'recordEvent',
'calypso_upgrade_nudge_cta_click',
{
cta_name: 'customizer_css',
},
] );
// Navigate to a different page.
if (
window.location.search.match( /calypso=true/ ) &&
window.parent.location !== window.location
) {
// Calypso.
window.top.postMessage(
JSON.stringify( {
calypso: true,
command: 'navigateTo',
destination: destination,
} ),
'*'
);
} else {
// Non-Calypso.
window.location = 'https://wordpress.com' + destination;
}
} );
},
};
$( document ).ready( function () {
cssNudge.init();
} );
} )( jQuery );
|