PageSourceSearch

https://essays.discount/wp-content/plugins/wp-coupons-and-deals/assets/js/main.js

js essays.discount collected 2026-10-06 13:17:02 UTC 25,690 bytes, 608 lines download raw bytes

1// all coupons archive nav active
2jQuery(document).ready(function ($) {
3
4    function wpcd_moreLessDescription() {
5        var num_words = Number(wpcd_main_js.word_count);
6        var full_description = $('.wpcd-full-description');
7        var more = $('.wpcd-more-description');
8        var less = $('.wpcd-less-description');
9        full_description.each(function () {
10            $this = $(this);
11
12            var full_content = $this.html();
13            var check = full_content.split(' ').length > num_words;
14            if (check) {
15                var short_content = full_content.split(' ').slice(0, num_words).join(' ');
16                $this.siblings('.wpcd-short-description').html(short_content + '...');
17                $this.hide();
18                $this.siblings('.wpcd-less-description').hide();
19            } else {
20                $(this).siblings('.wpcd-more-description').hide();
21                $(this).siblings('.wpcd-more-description');
22                $(this).siblings('.wpcd-less-description').hide();
23                $(this).siblings('.wpcd-short-description').hide();
24            }
25        });
26        // more and less link
27        more.click(function (e) {
28            e.preventDefault();
29            $(this).siblings('.wpcd-full-description').show();
30            $(this).siblings('.wpcd-less-description').show();
31            $(this).siblings('.wpcd-short-description').hide();
32            $(this).hide();
33
34        });
35        less.click(function (e) {
36            e.preventDefault();
37            $(this).siblings('.wpcd-short-description').show();
38            $(this).siblings('.wpcd-more-description').show();
39            $(this).siblings('.wpcd-full-description').hide();
40            $(this).hide();
41        });
42    };
43    wpcd_moreLessDescription();
44
45
46    $.each($('#wpcd_cat_ul > li'), function () {
47        if ($(this).children('a').attr('href') === window.location.href) {
48            $(this).children('a').addClass('active');
49        }
50    });
51    // $('#wpcd_cat_ul .wpcd_category').on('click', function (e) {
52    //     e.preventDefault();
53    //     if ($(this).attr('data-category') !== 'all') {
54    //         $('.wpcd_item').hide();
55    //         $('.' + $(this).attr('data-category')).fadeIn();
56    //     } else {
57    //         $('.wpcd_item').fadeIn();
58    //     }
59    // });
60    var categories_pagination_set_timeout;
61    var wpcd_js_data_tax = 'data-category';
62    if ( $('#wpcd_cat_ul .wpcd_category').attr( 'data-category' ) ) {
63        wpcd_js_data_tax = 'data-category';
64    } else if ( $('#wpcd_cat_ul .wpcd_category').attr( 'data-vendor' ) ) {
65        wpcd_js_data_tax = 'data-vendor';
66    }
67    function wpcd_ajaxCouponCategoriesPagination( wpcd_page_num, action, wpcd_js_data_tax, wpcd_coupon_taxonomy, search_text ) {
68        var scrollTop = $( '#wpcd_coupon_template' ).offset().top;
69        $( 'html, body' ).animate( { scrollTop: scrollTop }, 300 );
70
71        $( '.wpcd_coupon_loader' ).removeClass( 'wpcd_coupon_hidden_loader' );
72        clearTimeout( categories_pagination_set_timeout );
73        categories_pagination_set_timeout = setTimeout( function () {
74            var coupon_template;
75            var coupon_items_count;
76            var wpcd_data_coupon_page_url;
77            var wpcd_data_category_coupons;
78            var wpcd_data_vendor_coupons;
79            var wpcd_data_ven_cat_id;
80            var wpcd_coupon_taxonomy_category;
81            var wpcd_coupon_taxonomy_vendor;
82            if ( wpcd_js_data_tax == 'data-category' ) {
83                var wpcd_coupon_taxonomy_category = wpcd_coupon_taxonomy;
84            } else if ( wpcd_js_data_tax == 'data-vendor' ) {
85                var wpcd_coupon_taxonomy_vendor = wpcd_coupon_taxonomy;
86            }
87            var wpcd_coupon_template = $( '#wpcd_coupon_template' );
88            if ( wpcd_coupon_template.length > 0 ) {
89                coupon_template = wpcd_coupon_template.attr( 'wpcd-data-coupon_template' );
90                coupon_items_count = wpcd_coupon_template.attr( 'wpcd-data-coupon_items_count' );
91                wpcd_data_coupon_page_url = wpcd_coupon_template.attr( 'wpcd-data-coupon_page_url' );
92                wpcd_data_category_coupons = wpcd_coupon_template.attr( 'wpcd-data_category_coupons' );
93                wpcd_data_vendor_coupons = wpcd_coupon_template.attr( 'wpcd-data_vendor_coupons' );
94                wpcd_data_ven_cat_id = wpcd_coupon_template.attr( 'wpcd-data_ven_cat_id' );
95            }
96            if ( !coupon_template ) {
97                coupon_template = undefined;
98            }
99            if ( !wpcd_page_num ) {
100                wpcd_page_num = undefined;
101            }
102            if ( !search_text ) {
103                search_text = undefined;
104            }
105
106            $.ajax( {
107                type: 'post',
108                dataType: 'json',
109                url: wpcd_object.ajaxurl,
110                data: {
111                    action: action,
112                    security: wpcd_object.security,
113                    wpcd_category: wpcd_coupon_taxonomy_category,
114                    wpcd_vendor: wpcd_coupon_taxonomy_vendor,
115                    coupon_template: coupon_template,
116                    coupon_items_count: coupon_items_count,
117                    wpcd_data_coupon_page_url: wpcd_data_coupon_page_url,
118                    wpcd_data_category_coupons: wpcd_data_category_coupons,
119                    wpcd_data_vendor_coupons: wpcd_data_vendor_coupons,
120                    wpcd_data_ven_cat_id: wpcd_data_ven_cat_id,
121                    wpcd_page_num: wpcd_page_num,
122                    search_text: search_text
123                },
124                success: function ( response ) {
125                    if ( response ) {
126                        var coupon_container = $( '.wpcd_coupon_archive_container' );
127                        if ( coupon_container.length > 0 ) {
128                            coupon_container.html( response );
129                            $( '.wpcd_coupon_loader' ).addClass( 'wpcd_coupon_hidden_loader' );
130                            $( '#wpcd_coupon_pagination_wr a.page-numbers' ).off( 'click' );
131                            $( '#wpcd_coupon_pagination_wr a.page-numbers' ).on( 'click', function ( e ) {
132                                e.preventDefault();
133                                var href = $( this ).attr( 'href' );
134                                var href_arr = wpcd_getUrlVar( href );
135                                var wpcd_page_num = href_arr['wpcd_page_num'];
136                                var search_text = href_arr['search_text'];
137                                var this_parrent = $( this ).parent( '#wpcd_coupon_pagination_wr' );
138                                var action = this_parrent.attr( 'wpcd-data-action' );
139                                wpcd_ajaxCouponCategoriesPagination( wpcd_page_num, action, wpcd_js_data_tax, wpcd_coupon_taxonomy, search_text );
140                            });
141                            wpcd_countDownFun($);
142                            $( '.masterTooltip' ).hover( function () {
143                                var title = $( this ).attr( 'title' );
144                                $( this ).data( 'tipText', title ).removeAttr( 'title' );
145                                $( '<p class="wpcd-copy-tooltip"></p>' )
146                                    .text( title )
147                                    .appendTo( 'body' )
148                                    .fadeIn( 'slow' );
149                            }, function () {
150                                $( this ).attr( 'title', $( this ).data( 'tipText' ) );
151                                $( '.wpcd-copy-tooltip' ).remove();
152                            }).mousemove( function ( e ) {
153                                var mousex = e.pageX + 20;
154                                var mousey = e.pageY + 10;
155                                $( '.wpcd-copy-tooltip' )
156                                    .css( { top: mousey, left: mousex } )
157                            });
158                            $.each( $( '#wpcd_cat_ul  li' ), function () {
159                                if ( $( this ).children( 'a' ).attr( wpcd_js_data_tax ) == wpcd_coupon_taxonomy ) {
160                                    $( this ).children( 'a' ).addClass( 'active' );
161                                } else {
162                                    $( this ).children( 'a' ).removeClass( 'active' );
163                                }
164                            });
165                            wpcd_moreLessDescription();
166                        }
167                    } else {
168                        //$('.wpcd_coupon_loader').addClass('wpcd_coupon_hidden_loader');
169                    }
170                }
171            } );
172        }, 500 );
173
174    };
175
176    // function for generation event
177    function wpcdDocumentEventGenerate( eventName, element, details ) {
178        if( eventName && element ) {
179            if( ! details ) {
180                details = true;
181            }
182            let event = new CustomEvent( eventName, { detail: details, bubbles: true } );
183            element.dispatchEvent( event );
184        }
185    }
186
187    let wpcdCatUl = document.querySelector( '#wpcd_cat_ul' );
188    if( wpcdCatUl ) {
189        //let wpcdDropdownContent = wpcdCatUl.querySelector( '.wpcd_dropdown-content' );
190        let wpcdDropbtn = wpcdCatUl.querySelector( '.wpcd_dropbtn' );
191        // if( wpcdDropdownContent ) {
192        //     wpcdCatUl.addEventListener( 'mouseenter', function() {
193        //         wpcdDropdownContent.style.display = 'block';
194        //     }, false );
195        //
196        //     wpcdCatUl.addEventListener( 'mouseleave', function() {
197        //         wpcdDropdownContent.style.display = 'none';
198        //     }, false );
199        //
200        //     if( wpcdDropbtn && wpcdDropbtn.style.display !== 'none' ) {
201        //         wpcdDropbtn.addEventListener( 'click', function () {
202        //             wpcdDropdownContent.style.display = 'block';
203        //         }, false );
204        //     }
205        // }
206
207        /**
208         * sets the element's style "display" to block
209         *
210         * @param {HTMLElement} wpcdDropdownContent
211         */
212        function dropDownContDisplayBlock () {
213            $(".wpcd_categories_in_dropdown > div").css('display', 'block');
214        }
215
216        /**
217         * sets the element's style "display" to none
218         *
219         * @param {HTMLElement} wpcdDropdownContent
220         */
221        function dropDownContDisplayNone () {
222            $(".wpcd_categories_in_dropdown > div").css('display', 'none');
223        }
224
225        /**
226         * add events handlers for drop down menu
227         */
228        function dropDownMenuHandlersAdd () {
229            wpcdCatUl.addEventListener( 'mouseenter', dropDownContDisplayBlock, false );
230
231            wpcdCatUl.addEventListener( 'mouseleave', dropDownContDisplayNone, false );
232
233            wpcdDropbtn.addEventListener( 'click', dropDownContDisplayBlock, false );
234        }
235
236        /**
237         * remove events handlers for drop down menu
238         */
239        function dropDownMenuHandlersRemove () {
240            wpcdCatUl.removeEventListener( 'mouseenter', dropDownContDisplayBlock, false );
241
242            wpcdCatUl.removeEventListener( 'mouseleave', dropDownContDisplayNone, false );
243
244            wpcdDropbtn.removeEventListener( 'click', dropDownContDisplayBlock, false );
245        }
246
247        $( '#wpcd_cat_ul .wpcd_category' ).on('click', function (e) {
248            e.preventDefault();
249
250            wpcdDocumentEventGenerate( 'mouseleave', wpcdCatUl );
251
252            var wpcd_coupon_taxonomy = $(this).attr( wpcd_js_data_tax );
253
254            wpcd_ajaxCouponCategoriesPagination('', 'wpcd_coupons_category_action', wpcd_js_data_tax, wpcd_coupon_taxonomy);
255        });
256
257        function wpcd_categoriesDropdown() {
258            var sw = jQuery(".wpcd_div_nav_block").width();
259            if (sw < 850) {
260                $(".wpcd_categories_in_dropdown > div").addClass('wpcd_dropdown-content');
261                $(".wpcd_categories_in_dropdown > a").css('display', 'inline');
262                //jQuery(".wpcd_categories_full").css('display', 'none');
263                dropDownMenuHandlersAdd();
264            } else {
265                $(".wpcd_categories_in_dropdown > div").removeClass('wpcd_dropdown-content');
266                $(".wpcd_categories_in_dropdown > a").css('display', 'none');
267                dropDownMenuHandlersRemove();
268            }
269        }
270        wpcd_categoriesDropdown();
271    }
272
273    $('#wpcd_coupon_pagination_wr a.page-numbers').on('click', function (e) {
274        e.preventDefault();
275        var href = $(this).attr('href');
276        var href_arr = wpcd_getUrlVar(href);
277        var wpcd_page_num = href_arr['wpcd_page_num'];
278        var wpcd_coupon_taxonomy = href_arr['wpcd_category'];
279        if ( ! wpcd_coupon_taxonomy ) {
280            wpcd_coupon_taxonomy = href_arr['wpcd_vendor'];
281        }
282        var search_text = href_arr['search_text'];
283        var this_parrent = $(this).parent('#wpcd_coupon_pagination_wr');
284        var action = this_parrent.attr('wpcd-data-action');
285        wpcd_ajaxCouponCategoriesPagination(wpcd_page_num, action, wpcd_js_data_tax, wpcd_coupon_taxonomy, search_text);
286    });
287
288    let delayTimer;
289    $('.wpcd_searchbar_search input').on('input', function (e) {
290        clearTimeout(delayTimer);
291        delayTimer = setTimeout(() => {
292            let search_string = $(this).val();
293
294            // $('.wpcd_item').each(function () {
295            //     let name = $(this).attr('wpcd-data-search').toLowerCase();
296            //     let n = name.indexOf(search_string.toLowerCase());
297            //     if (n != -1) {
298            //         $(this).fadeIn();
299            //     } else {
300            //         $(this).hide();
301            //     }
302            // })
303            wpcd_ajaxCouponCategoriesPagination('1', 'wpcd_coupons_category_action', wpcd_js_data_tax, 'all', search_string);
304        }, 800);
305    })
306
307    function wpcd_getUrlVar(urlVar) {
308        var urlVar = urlVar;
309        var arrayVar = [];
310        var valueAndKey = [];
311        var resultArray = [];
312        arrayVar = (urlVar.substr(1)).split('&');
313        if (arrayVar[0] == "") return false;
314        for (i = 0; i < arrayVar.length; i++) {
315            valueAndKey = arrayVar[i].split('=');
316            resultArray[valueAndKey[0]] = valueAndKey[1];
317        }
318        return resultArray;
319    }
320    /*
321    $('.wpcd_search2 .wpcd_searchbar_search input').hide();
322    $('.wpcd_search2 #wpcd_searchbar_search_close').hide();
323    $('#wpcd_searchbar_search_icon').on('click', function (e) {
324        $('.wpcd_search2 .wpcd_searchbar_search input').fadeIn();
325        $('.wpcd_search2 #wpcd_searchbar_search_close').fadeIn();
326    });
327    $('.wpcd_search2 #wpcd_searchbar_search_close').on('click', function (e) {
328        $('.wpcd_search2 .wpcd_searchbar_search input').fadeOut();
329        $('.wpcd_search2 #wpcd_searchbar_search_close').fadeOut();
330        $('.wpcd_item').fadeIn();
331        $('.wpcd_searchbar_search input').val('');
332    });*/
333
334    // $('#wpcd_searchbar_search_icon').on('click', function (e) {
335    //     $('.wpcd_searchbar_search input').fadeIn();
336    //     $('#wpcd_searchbar_search_close').fadeIn();
337    // });
338    // $('#wpcd_searchbar_search_close').on('click', function (e) {
339    //     $('.wpcd_searchbar_search input').fadeOut();
340    //     $('#wpcd_searchbar_search_close').fadeOut();
341    //     $('.wpcd_item').fadeIn();
342    //     $('.wpcd_searchbar_search input').val('');
343    // });
344
345    function wpcd_countDownFun() {
346        var count_down_span = $('[data-countdown_coupon]');
347        count_down_span.each(function () {
348            var $this = $(this), finalDate = $(this).data('countdown_coupon');
349            $this.countdown(finalDate, function (event) {
350                var format = '%M ' + wpcd_main_js.minutes + ' %S ' + wpcd_main_js.seconds;
351                if (event.offset.hours > 0) {
352                    format = '%H ' + wpcd_main_js.hours + ' %M ' + wpcd_main_js.minutes + ' %S ' + wpcd_main_js.seconds;
353                }
354                if (event.offset.totalDays > 0) {
355                    format = '%-d ' + wpcd_main_js.day + '%!d ' + format;
356                }
357                if (event.offset.weeks > 0) {
358                    format = '%-w ' + wpcd_main_js.week + '%!w ' + format;
359                }
360                if (event.offset.weeks == 0 && event.offset.totalDays == 0 && event.offset.hours == 0 && event.offset.minutes == 0 && event.offset.seconds == 0) {
361                    jQuery(this).parent().addClass('wpcd-countdown-expired').html(wpcd_main_js.expired_text);
362                } else {
363                    jQuery(this).html(event.strftime(format));
364                }
365            }).on('finish.countdown', function (event) {
366                jQuery('.wpcd-coupon-two-countdown-text').hide();
367                jQuery(this).html(wpcd_main_js.expired_text).parent().addClass('disabled');
368            });
369        });
370    }
371    wpcd_countDownFun();
372
373    function wpcd_couponCountingFun() {
374        $('.wpcd-coupon-click-link').click(function (e) {
375            var $this = $(this),
376                coupon_id = $this.data('id');
377
378            var data = {
379                'action': 'wpcd_coupon_clicked_action',
380                'security': wpcd_object.security,
381                'coupon_id': coupon_id,
382            };
383            jQuery.post(wpcd_object.ajaxurl, data, function (response) {
384                console.log('response', response)
385            });
386        });
387    }
388    wpcd_couponCountingFun();
389});
390
391jQuery(document).ready(function ($) {
392
393    // For social share
394    $('.fb-share,.tw-share,.go-share').click(function (e) {
395        e.preventDefault();
396        window.open($(this).attr('href'), 'fbShareWindow', 'height=450, width=550, top='
397                + ($(window).height() / 2 - 275) + ', left=' + ($(window).width() / 2 - 225)
398                + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
399        return false;
400    });
401
402    /*
403     * Vote System
404     */
405    $('a[class^=wpcd-vote]').click(function (e) {
406        e.preventDefault();
407        var $this = $(this),
408            coupon_id = $this.data('id'),
409            meta = "up",
410            el_sibling_percentage = $this.siblings(".wpcd-vote-percent"),
411            el_percentage = $('.wpcd-vote-percent[data-id=' + coupon_id + ']');
412
413        if ($this.hasClass("wpcd-vote-down")) {
414            meta = "down";
415        }
416        var data = {
417            'action': 'wpcd_vote',
418            'security': wpcd_object.security,
419            'meta': meta,
420            'coupon_id': coupon_id,
421        };
422
423        jQuery.post(wpcd_object.ajaxurl, data, function (response) {
424            if (response === "Failed") {
425                wpcd_displayMsg(wpcd_main_js.vote_failed, el_percentage, 2000);
426            } else if (response === "voted") {
427                wpcd_displayMsg(wpcd_main_js.vote_already, el_sibling_percentage, 2000);
428            } else {
429                wpcd_displayMsg(wpcd_main_js.vote_success, el_percentage, 2000);
430                setTimeout(function () {
431                    wpcd_displayMsg(response, el_percentage, 0);
432                }, 2000);
433
434            }
435        });
436
437        /*
438         * This function dispaly msg in a specific element for a little time
439         *
440         * @param string 'Msg' is the message that will be displayed in the element
441         * @param object 'el' is the element
442         * @param int 'Time' is the time in milliSecond or 0 if this will be the text for ever
443         */
444        function wpcd_displayMsg(Msg, el, Time = 0) {
445
446            if (typeof (el) === "object") {
447                if (Time === 0) {
448                    el.html(Msg);
449                } else {
450                    var old_text = el.html();
451                    el.html(Msg);
452                    setTimeout(function () {
453                        el.html(old_text);
454                    }, Time);
455                }
456            }
457        }
458    });
459});
460
461jQuery(document).ready(function ($) {
462    $(document).ready(function () {
463        $('.masterTooltip').hover(function () {
464            var title = $(this).attr('title');
465            $(this).data('tipText', title).removeAttr('title');
466            $('<p class="wpcd-copy-tooltip"></p>')
467                .text(title)
468                .appendTo('body')
469                .fadeIn('slow');
470        }, function () {
471            $(this).attr('title', $(this).data('tipText'));
472            $('.wpcd-copy-tooltip').remove();
473        }).mousemove(function (e) {
474            var mousex = e.pageX + 20;
475            var mousey = e.pageY + 10;
476            $('.wpcd-copy-tooltip')
477                .css({ top: mousey, left: mousex })
478        });
479    });
480
481    
482/* Premium Code Stripped by Freemius */
483
484
485    
486/* Premium Code Stripped by Freemius */
487
488
489});
490
491jQuery(document).ready(function ($) {
492
493    $(window).resize(wpcd_updateCouponClassRan);
494
495    function wpcd_updateCouponClassRan() {
496        wpcd_updateCouponClass('.wpcd-coupon-default', 'wpcd-template-default-mobile', 'wpcd-mobile-mini', 510, 380);
497        wpcd_updateCouponClass('.wpcd-coupon-one', 'wpcd-template-one-mobile', 'wpcd-mobile-mini', 530, 380);
498        wpcd_updateCouponClass('.wpcd-coupon-two', 'wpcd-template-two-mobile', 'wpcd-mobile-mini', 530, 380);
499        wpcd_updateCouponClass('.wpcd-coupon-three', 'wpcd-template-three-mobile', 'wpcd-mobile-mini', 400, 380);
500        wpcd_updateCouponClass('.wpcd-coupon-four', 'wpcd-template-four-mobile', 'wpcd-mobile-mini', 530, 380);
501        wpcd_updateCouponClass('.wpcd-template-five', 'wpcd-template-five-mobile', 'wpcd-mobile-mini', 510, 380);
502        wpcd_updateCouponClass('.wpcd-coupon-six', 'wpcd-template-six-mobile', 'wpcd-mobile-mini', 530, 380);
503        wpcd_updateCouponClass('.wpcd_seven_couponBox', 'wpcd-template-seven-mobile', 'wpcd-mobile-mini', 540, 380);
504        wpcd_updateCouponClass('.wpcd-new-grid-container', 'wpcd-template-eight-mobile', 'wpcd-mobile-mini', 500, 380);
505    }
506
507    function wpcd_updateCouponClass(class_box, class1, class2, width1, width2) {
508        $.each($(class_box), function () {
509            if ($(this).width() > width1) {
510                $(this).removeClass(class1);
511            } else {
512                $(this).addClass(class1);
513            }
514            if ($(this).width() > width2) {
515                $(this).removeClass(class2);
516            } else {
517                $(this).addClass(class2);
518            }
519        });
520    }
521
522    wpcd_updateCouponClassRan();
523});
524
525
526/* Premium Code Stripped by Freemius */
527
528
529function wpcd_copyToClipboard(element) {
530    var $temp = jQuery("<input>");
531    jQuery("body").append($temp);
532    $temp.val(jQuery(jQuery(element)[0]).text()).select();
533    document.execCommand("copy");
534    $temp.remove();
535}
536
537function wpcd_openCouponAffLink(objectThis, CoupenId, wpcd_dataTaxonomy, numCoupon) {
538    var a = jQuery(objectThis);
539    var oldLink = a.attr('href');
540
541    var wpcd_couponTaxonomy;
542    var wpcdPageNum;
543
544    var oldLinkArrPrepare = oldLink.replace("?", "");
545    var oldLinkArr = oldLinkArrPrepare.split('&');
546    for (var i = 0; i < oldLinkArr.length; i++) {
547        if(oldLinkArr[i].indexOf(wpcd_dataTaxonomy + '=') > -1) {
548            wpcd_couponTaxonomy = oldLinkArr[i].split('=')[1];
549        }
550        if(oldLinkArr[i].indexOf('wpcd_page_num=') > -1) {
551            wpcdPageNum = oldLinkArr[i].split('=')[1];
552        }
553    }
554
555    if (window.location.href.indexOf('wpcd_coupon') > -1) { // check if there's wpcd_coupon in the url
556        var wpcd_id = jQuery.wpcd_urlParam('wpcd_coupon');
557        oldLink = window.location.href.replace("wpcd_coupon=" + wpcd_id, "wpcd_coupon=" + CoupenId);
558
559        if (window.location.href.indexOf('wpcd_num_coupon') > -1) {
560            var num_coupon = jQuery.wpcd_urlParam('wpcd_num_coupon');
561            if(numCoupon) {
562                oldLink = oldLink.replace("wpcd_num_coupon=" + num_coupon, "wpcd_num_coupon=" + numCoupon);
563            } else {
564                oldLink = oldLink.replace("&wpcd_num_coupon=" + num_coupon, "");
565            }
566
567        } else if (numCoupon) {
568            oldLink = oldLink + "&wpcd_num_coupon=" + numCoupon;
569        }
570
571        if (window.location.href.indexOf(wpcd_dataTaxonomy) > -1) {
572            var wpcd_coupon_taxonomy = jQuery.wpcd_urlParam(wpcd_dataTaxonomy);
573            if( wpcd_couponTaxonomy ) {
574                oldLink = oldLink.replace(wpcd_dataTaxonomy + "=" + wpcd_coupon_taxonomy, wpcd_dataTaxonomy + "=" + wpcd_couponTaxonomy);
575            } else {
576                oldLink = oldLink.replace("&" + wpcd_dataTaxonomy + "=" + wpcd_coupon_taxonomy, "");
577            }
578
579        } else if ( wpcd_couponTaxonomy ) {
580            oldLink = oldLink + "&" + wpcd_dataTaxonomy + "=" + wpcd_couponTaxonomy;
581        }
582
583        if (window.location.href.indexOf('wpcd_page_num') > -1) {
584            var wpcd_page_num = jQuery.wpcd_urlParam('wpcd_page_num');
585            if(wpcdPageNum) {
586                oldLink = oldLink.replace("wpcd_page_num=" + wpcd_page_num, "wpcd_page_num=" + wpcdPageNum);
587            } else {
588                oldLink = oldLink.replace("&wpcd_page_num=" + wpcd_page_num, "");
589            }
590
591        } else if (wpcdPageNum) {
592            oldLink = oldLink + "&wpcd_page_num=" + wpcdPageNum;
593        }
594
595    }
596    else if (window.location.href.indexOf('?') > -1 && window.location.href.indexOf('?wpcd_coupon') === -1) {// check if there's paramater in the url
597        oldLink = window.location.href + oldLink.replace("?", "&");
598    }
599    a.attr('href', oldLink);
600    //the affiliate link
601    var theLink = a.attr("data-aff-url");
602    window.open(a.attr('href'), '_blank');
603    window.location = theLink;
604    return false;
605}
606
607
608

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.