PageSourceSearch

https://bakersfieldschoice.com/wp-content/themes/listingpro-child-theme/js/reward-script.js?ver=1790253511

js bakersfieldschoice.com collected 2026-09-24 12:40:26 UTC 7,286 bytes, 251 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3
4    $("body").on("click", ".listingedit", function(){
5        var listing_id=$(this).attr('data-id');
6        //console.log(listing_id);
7        $(".pop-outer").hide();
8        $("#pop_outer_"+listing_id).show();
9
10    });
11    $("body").on("click", ".listingdelete", function(){
12        var listing_id=$(this).attr('data-id');
13        //console.log(listing_id);
14        $(".pop-outerdelete").hide();
15        $("#pop_outerdelete_"+listing_id).show();
16
17    });
18
19
20    $("body").on("click", ".notify_button", function(){
21        $(".pop-outer").hide();
22         $(".pop-outerdelete").hide();
23    });
24
25
26    $("body").on("click", ".listingreward", function(){
27        var listing_id=$(this).attr('data-pid');
28        console.log(listing_id);
29        $(".pop-reward").hide();
30        $("#pop_outer_reward_"+listing_id).show();
31
32    }); 
33    $("body").on("click", "#close_popup", function(){
34        $(".pop-reward").hide();
35    }); 
36
37    $("body").on("click", ".rewards_conatiner #listing_category li a", function(){
38        var selcted_cat = $(this).attr("data-id");
39
40        var get_html=$(this).html();
41        var action_filter= "action_cats";
42        $("#selected_category").attr('data-id', selcted_cat).html(get_html + "<span class='caret'></span>");
43        var search_input= $('.search-Rew input').val();
44        var page_info=$("#paginator").val();
45        if(selcted_cat==""){
46            var action_filter= "action_search";
47        }
48        send_ajax(search_input, action_filter, selcted_cat, page_info);
49    });
50
51    $('.search-Rew input').keyup(function(){
52        var search_input = $(this).val();
53        var action_filter= "action_search";
54        var selcted_cat= $("#selected_category").attr('data-id');
55        var page_info=$("#paginator").val();
56        if(search_input==""){
57            var action_filter= "action_cats";
58        }
59        send_ajax(search_input, action_filter, selcted_cat, page_info);
60    });
61
62
63    $("#switch--custom").click(function(){
64
65        if($(this).prop("checked") == true){
66        var checked = true;
67        }else if($(this).prop("checked") == false){
68        var checked = false;
69        }
70
71        $.ajax({
72
73        url: window.location.origin+'/wp-admin/admin-ajax.php', 
74              type: 'POST',
75               dataType: "json",
76                data:{
77
78                    'action' : 'update_cheked_status',
79                    'checked':checked
80
81                },
82                success: function(data){    
83                        window.location = '';
84                },
85                error:function(){
86                     window.location = '';
87                }
88
89           });
90        });
91
92
93        $("#switch--rewards").click(function(){
94
95        if($(this).prop("checked") == true){
96        var checkedreward = true;
97        }else if($(this).prop("checked") == false){
98        var checkedreward = false;
99        }
100        
101        $.ajax({
102
103        url: window.location.origin+'/wp-admin/admin-ajax.php', 
104              type: 'POST',
105               dataType: "json",
106                data:{
107
108                    'action' : 'update_rewards_program',
109                    'checkedreward':checkedreward
110
111                },
112                success: function(data){    
113                        window.location = '';
114                },
115                error:function(){
116                     window.location = '';
117                }
118
119        });
120
121    });
122
123
124
125    function send_ajax(search_input, action_filter, selcted_cat, page_info){
126        var ajax_url = rewards.ajax_url;
127        
128        $.ajax({
129            type : "POST",
130            dataType : "json",
131            url : ajax_url,
132            data : {
133                action: "rewards_filter",
134                action_filter: action_filter,
135                search_input: search_input,
136                selcted_cat: selcted_cat,
137                pagination: page_info
138            },
139            beforeSend: function() {
140                $(".filter_resp .ajax_loader").show();
141                $(".filter_resp #ajax_resp").hide();
142                $(".filter_pagination").hide();
143            },
144            success: function(resp){
145                $(".filter_resp .ajax_loader").hide();
146                $(".filter_resp #ajax_resp").show();
147
148                if(resp.code==200){
149                    $("#listing_resp").html(resp.data);
150                } else {
151                    $(".filter_resp .ajax_loader").hide();
152                    $(".filter_resp #ajax_resp").show();
153                    $("#listing_resp").html("<p class='text-red'>No Result Found.</p>");
154                }
155                
156            }, error: function(){
157                $(".filter_resp .ajax_loader").hide();
158                $(".filter_resp #ajax_resp").hide();
159                $("#listing_resp").html("<p class='text-red'>No Result Found.</p>");
160            }
161        }); 
162    }
163
164    $("#discount_type").change(function() {
165
166        if ($(this).val() === 'custom'){ 
167            $('#fn').show(); 
168            $('#reward_discount_val').hide();  
169        } else {
170            $('#fn').hide(); 
171            $('#reward_discount_val').show();
172        }
173    });
174
175
176   $(".discountcustom").change(function(){
177         if ($(this).val() === 'custom'){ 
178            //alert('fdfdf');
179            $('#fn_custom').show();
180            $('#fn_custom_ab').hide();
181            $('#reward_discount_hide').hide();   
182        } else {
183    
184            $('#fn_custom').hide();
185            $('#fn_custom_ab').hide();
186            $('#reward_discount_hide').show();
187        }
188        if ($(this).val() === '1' || $(this).val() === '2')
189        {
190            $('#fn_custom_ab').hide();
191            $('#reward_discount_hide').show();
192        }
193        else {
194            $('#fn_custom_ab').show();
195            $('#reward_discount_hide').hide();
196        }
197    });
198
199
200
201    $("body").on("click", ".filter_resp .filter_pagination a", function(event){
202        event.preventDefault();
203        $("#pagination_cats .ajax_loader").show();
204        $('#ajax_resp').html('');
205        var link = $(this).attr('href');
206        $('#ajax_resp').load(link + ' #ajax_resp', function() {
207            $("#pagination_cats .ajax_loader").hide();
208            $('#ajax_resp').fadeIn(1000);
209        });
210    });
211
212    $("body").on("click", ".filter_resp .ajax_pagination a", function(event){
213        event.preventDefault();
214        var search_input= $('.search-Rew input').val();
215        var selcted_cat= $("#selected_category").attr('data-id');
216        var get_link=$(this).attr('href');
217        var page_info= get_query(get_link).paged;
218        console.log("est: "+page_info);
219        if(typeof page_info === 'undefined'){
220            page_info=1;
221        }
222
223        if(selcted_cat==""){
224            var action_filter= "action_search";
225        } else if(search_input==""){
226            var action_filter= "action_cats";
227        }
228        send_ajax(search_input, action_filter, selcted_cat, page_info);
229    });
230
231
232    function get_query(url){
233        var qs = url.substring(url.indexOf('?') + 1).split('&');
234        for(var i = 0, result = {}; i < qs.length; i++){
235            qs[i] = qs[i].split('=');
236            result[qs[i][0]] = decodeURIComponent(qs[i][1]);
237        }
238        return result;
239    }
240
241});
242
243
244
245
246
247
248
249
250
251

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.