Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'wp_footer', function() {
- ?>
- <script type="text/javascript">
- jQuery(document).ready(function($) {
- $( 'body' ) .on( 'click', '.coupon-button-type .coupon-button, .coupon-title a.coupon-link, .coupon-link', function ( e ) {
- e.preventDefault();
- var current_url, coupon_id, aff_url, t;
- current_url = $( this ).attr( 'href' );
- if ( $( this).hasClass( 'coupon-button' ) ) {
- coupon_id = $(this).data('coupon-id') || undefined;
- aff_url = $(this).attr('data-aff-url');
- current_url = $( this ).attr( 'href' );
- t = $(this).attr('data-type') || '';
- if (
- ( t == 'print' && ST.print_prev_tab != 1 )
- || ( t == 'code' && ST.code_prev_tab != 1 )
- || ( t == 'sale' && ST.sale_prev_tab != 1 )
- ) {
- window.open( current_url, '_self');
- } else {
- if ( ST.coupon_click_action === 'next' ) {
- window.open( aff_url, '_blank');
- window.open( current_url, '_self');
- } else {
- window.open( current_url, '_blank');
- window.open( aff_url, '_self');
- }
- }
- return false;
- } else if ( $(e.target).hasClass( 'coupon-link' ) ) {
- current_url = $( this ).attr( 'href' );
- window.open( current_url, '_self' );
- } else {
- coupon_id = $(this).data('coupon-id') || undefined;
- if ( typeof coupon_id == "undefined") {
- return false;
- }
- // Copy code to clipboard
- var code = $(this).attr('data-code') || '';
- if (code && code != '') {
- copyText(code);
- }
- t = $(this).attr('data-type') || '';
- // Track print coupon clicked
- if ( t === 'print' ) {
- track_coupon( coupon_id );
- }
- if (
- ( t == 'print' && ST.print_prev_tab != 1 )
- || ( t == 'code' && ST.code_prev_tab != 1 )
- || ( t == 'sale' && ST.sale_prev_tab != 1 )
- ) {
- //aff_url = $(this).attr('data-aff-url');
- //window.open( current_url, '_self' );
- openCouponModal( coupon_id );
- } else {
- aff_url = $(this).attr('data-aff-url');
- current_url = $(this).attr('href');
- if ( ST.coupon_click_action === 'next' ) {
- window.open( aff_url, '_blank');
- window.open( current_url, '_self');
- } else {
- window.open( current_url, '_blank');
- window.open( aff_url, '_self');
- }
- return false;
- }
- }
- } );
- });
- </script>
- <?php
- } );
Advertisement
Add Comment
Please, Sign In to add comment