1jQuery(function($) { 2 couponDB.myList.init(); 3 couponDB.lists.init(); 4}); 5 6/* Submission creation */ 7jQuery(function($) { 8 $('#cdb-submission-form').on('submit', function() { 9 var $form = $(this), 10 ajaxRequest; 11 12 couponDB.main.loader(); 13 14 ajaxRequest = $.ajax({ 15 type: $form.attr('method'), 16 cache: false, 17 url: $form.attr('action'), 18 data: $form.serialize(), 19 dataType: 'json' 20 }); 21 22 ajaxRequest.done(function(data) { 23 if (data.success) { 24 showMessage('success', data.data); 25 } else { 26 showMessage('error', data.data); 27 } 28 grecaptcha.reset(); // update for recaptcha2 29 }); 30 31 ajaxRequest.fail(function(jqXHR, textStatus) { 32 console.log(textStatus); 33 }); 34 35 ajaxRequest.always(function() { 36 couponDB.main.loader(); 37 }); 38 39 return false; 40 }); 41 42 function showMessage(type, msg) { 43 $('._cdb_submission_form_notify').addClass(type).text(msg).show(); 44 } 45}); 46/* END Submission creation */ 47 48jQuery(function($) { 49 // pagination 50 $('.cdb-pagination').on('click', '.cdb-next', function() { 51 if (!$(this).hasClass('cdb-disabled')) { 52 couponDB.coupons.pagination('next'); 53 } 54 return false; 55 }); 56 57 $('.cdb-pagination').on('click', '.cdb-prev', function() { 58 if (!$(this).hasClass('cdb-disabled')) { 59 couponDB.coupons.pagination('prev'); 60 } 61 return false; 62 }); 63 64 // order 65 $('.cdb-th-title a').on('click', function() { 66 var $this = $(this), 67 order = $this.data('order'), 68 orderby = $this.data('orderby'); 69 70 if ($('.cdb-active').find('.cdb-active-coupon').length < 2) { 71 return false; 72 } 73 74 $('.cdb-th-title a').removeClass('active'); 75 $this.addClass('active'); 76 77 if (orderby == $('._cdb_orderby').val()) { // same order, change direction 78 var current_order = $('._cdb_order').val(); 79 order = current_order == 'DESC' ? 'ASC' : 'DESC'; 80 } 81 82 if (order == 'DESC') { 83 $this.addClass('desc').removeClass('asc'); 84 } else { 85 $this.addClass('asc').removeClass('desc'); 86 } 87 88 console.log('orderby = ' + orderby + ', order = ' + order); 89 $('._cdb_order').val(order); 90 $('._cdb_orderby').val(orderby); 91 92 couponDB.coupons.pagination('reset'); 93 94 return false; 95 }); 96 97 // search 98 $('#cdb-search').on('submit', function() { 99 couponDB.coupons.enableSearch(this); 100 couponDB.coupons.search($(this)); 101 return false; 102 }); 103 104 $('.cdb-search-clear').on('click', function() { 105 couponDB.coupons.disableSearch(this); 106 couponDB.coupons.pagination('reset'); 107 return false; 108 }); 109}); 110 111jQuery(function($) { 112 $('.cdb-report-coupon-popup').modalWindow({ 113 close: '.cdb-report-coupon-popup-close', 114 onOpen: function() { 115 $(this).find('.cdb-select').trigger('render'); 116 } 117 }); 118 119 $('.cdb-active').on('click', '.cdb-report', function() { 120 var $modal = $('.cdb-report-coupon-popup'), 121 $coupon = $(this).closest('.cdb-active-coupon'), 122 coupon_id = $coupon.data('id'), 123 coupon_name = $coupon.find('._cdb_col_name').text(); 124 125 couponDB.main.log('coupon_id = ' + coupon_id + '; coupon_name = ' + coupon_name); 126 127 $modal.find('.cdb-report-coupon-message').removeClass('cdb-success cdb-error').text(''); 128 $modal.find('.cdb-report-coupon-name').text(coupon_name); 129 $modal.find('input[name=id]').val(coupon_id); 130 $modal.modalWindow('show'); 131 132 return false; 133 }); 134 135 $('.cdb-select').customSelect({customClass: 'cdb-custom-select'}); 136 137 $('._cdb_expiration_date').datepicker({ 138 dateFormat: 'yy-mm-dd' 139 }); 140 141 $('#cdb-report-coupon').on('submit', function() { 142 couponDB.coupons.report(this); 143 return false;
144 }); 145}); 146 147/** 148 * Tooltips 149 * @todo create jquery plugin? 150 */ 151jQuery(function($) { 152 var $tooltip, 153 timeout, 154 tooltip_selector; 155 156 $('body').on('mouseover', '.cdb-editor-tooltip', function() { 157 var $this = $(this), 158 line_height = parseInt($this.css('line-height')), 159 item_pos = $this.offset(), 160 item_width = $this.width(), 161 tooltip_text = $this.data('cdb_tooltip'), 162 tooltip_top = item_pos.top + (isNaN(line_height) ? 0 : line_height), 163 tooltip_left, 164 $parent = $('body'), 165 tooltip_class = 'cdb-tooltip'; 166 167 tooltip_selector = $this.data('cdb_tooltip_selector'); 168 169 if (tooltip_selector) { 170 tooltip_class += ' cdb-fixed-tooltip'; 171 tooltip_text = $(tooltip_selector).html(); 172 if (typeof timeout != 'undefined') { 173 clearTimeout(timeout); 174 $tooltip.remove(); 175 } 176 } 177 178 $tooltip = $('<div class="' + tooltip_class + '"></div>'); 179 $tooltip.html(tooltip_text); 180 $parent.append($tooltip); 181 182 if (tooltip_selector) { 183 tooltip_top = item_pos.top - $tooltip.height(); 184 } 185 186 tooltip_left = item_pos.left + (item_width / 2) - ($tooltip.width() / 2); 187 188 $tooltip.offset({top: tooltip_top, left: tooltip_left}); 189 190 console.log(item_pos); 191 }); 192 193 $('body').on('mouseout', '.cdb-editor-tooltip', function() { 194 if (tooltip_selector) { 195 timeout = setTimeout(function () { 196 $tooltip.remove(); 197 }, 500); 198 } else { 199 $tooltip.remove(); 200 } 201 }); 202 203 $('body').on('mouseenter', '.cdb-tooltip', function() { 204 clearTimeout(timeout); 205 }); 206 207 $('body').on('mouseleave', '.cdb-tooltip', function() { 208 $tooltip.remove(); 209 }); 210}); 211 212jQuery(function($) { 213 $('.plists-popup-disclosure').on('click', function() { 214 return false; 215 }); 216});
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.