PageSourceSearch

https://premiumbuces.com/wp-content/plugins/affs/assets/js/frontend/dashboard.js

js premiumbuces.com collected 2026-10-05 01:27:11 UTC 11,727 bytes, 255 lines download raw bytes

1/* global fs_affiliates_dashboard_params */
2
3jQuery( function ( $ ) {
4
5    //File Upload
6    if ( $( '.fs_affiliates_file_upload' ).length ) {
7        $( '.fs_affiliates_file_upload' ).each( function ( e ) {
8
9            var data = [ {
10                    name : 'action' ,
11                    value : 'fs_affiliates_file_upload' ,
12                } ,
13                {
14                    name : 'key' ,
15                    value : $( this ).attr( 'name' )
16                } ] ;
17            $( this ).fileupload( {
18                url : fs_affiliates_dashboard_params.ajax_url ,
19                type : 'POST' ,
20                async : false ,
21                formData : function ( form ) {
22                    return data ;
23                } ,
24                dataType : 'json' ,
25                done : function ( e , data ) {
26                    if ( data.result.success === true ) {
27                        var html ;
28                        html = '<p class="fs_affiliates_uploaded_file_name"><b>' + data.files[0].name + '</b>' ;
29                        html += '<span class="fs_affiliates_delete_uploaded_file" style="color:red;margin-left:10px;cursor: pointer;">[x]' ;
30                        html += '<input type="hidden" class="fs_affiliates_remove_file" value=' + data.files[0].name + ' /></span></p>' ;
31
32                        $( this ).closest( 'div' ).find( '.fs_affiliates_display_file_names' ).append( html ) ;
33                    } else {
34                        $( '.fs_affiliates_display_file_names' ).html( '<span class="fs_affiliates_error_msg_for_upload" style="color:red;">' + data.result.data.content + '</span>' ) ;
35                        $( '.fs_affiliates_error_msg_for_upload' ).delay( 3000 ).fadeOut( ) ;
36                    }
37                }
38            } ) ;
39        } ) ;
40    }
41
42    var FS_Dashboard = {
43        init : function () {
44            this.trigger_on_page_load() ;
45
46            $( document ).on( 'change' , '#aff_change_slug' , this.modifiy_slug ) ;
47            $( document ).on( 'change' , '#fs_affiliates_payment_method' , this.payment_method_change ) ;
48            $( document ).on( 'click' , '#fs_affiliates_form_save' , this.affiliates_form_save ) ;
49            $( document ).on( 'click' , '#fs_affiliates_form_send_mail' , this.affiliates_form_send_mail ) ;
50            $( document ).on( 'click' , '.fs_affiliates_delete_uploaded_file' , this.remove_uploaded_file ) ;
51            $( document ).on( 'click' , '.fs_affiliates_delete_table_uploaded_file' , this.remove_table_uploaded_file ) ;
52            $( document ).on( 'click' , '.fs_request_unpaid_commission' , this.get_unpaid_commissions ) ;
53        } , trigger_on_page_load : function () {
54            FS_Dashboard.aff_payment_method_common( '#fs_affiliates_payment_method' ) ;
55            this.show_or_hide_for_modifiy_slug() ;
56
57        } , payment_method_change : function ( event ) {
58            event.preventDefault() ;
59            var $this = $( event.currentTarget ) ;
60            FS_Dashboard.aff_payment_method_common( $this ) ;
61        } , aff_payment_method_common : function ( $this ) {
62            $( '.fs_affiliates_validation_error' ).hide() ;
63            $( '.affiliate-pay' ).hide() ;
64            var selected_val = $( $this ).val() ;
65            if ( selected_val == 'paypal' ) {
66                $( '.affiliate-paypal-pay' ).show() ;
67            } else if ( selected_val == 'direct' ) {
68                $( '.affiliate-direct-pay' ).show() ;
69            } else if ( selected_val == 'wallet' ) {
70                $( '.affiliate-wallet-pay' ).show() ;
71            }
72        } , remove_uploaded_file : function ( event ) {
73            event.preventDefault() ;
74            var $this = $( event.currentTarget ) ;
75
76            var data = {
77                action : 'fs_affiliates_remove_uploaded_file' ,
78                key : $( $this ).closest( 'div' ).find( '.fs_affiliates_uploaded_file_key' ).val() ,
79                file_name : $( $this ).find( '.fs_affiliates_remove_file' ).val() ,
80            } ;
81            $.post( fs_affiliates_dashboard_params.ajax_url , data , function ( response ) {
82                if ( true === response.success ) {
83                    $( $this ).closest( 'p.fs_affiliates_uploaded_file_name' ).remove() ;
84                } else {
85                    window.alert( response.data.error ) ;
86                }
87            } ) ;
88        } ,
89        remove_table_uploaded_file : function ( event ) {
90            event.preventDefault() ;
91            var $this = $( event.currentTarget ) ;
92
93            var data = {
94                action : 'fs_affiliates_remove_uploaded_file' ,
95                key : $( $this ).find( '.fs_affiliates_uploaded_file_key' ).val() ,
96                file_name : $( $this ).find( '.fs_affiliates_remove_file' ).val() ,
97            } ;
98            $.post( fs_affiliates_dashboard_params.ajax_url , data , function ( response ) {
99                if ( true === response.success ) {
100                    $( $this ).closest( 'tr' ).remove() ;
101                } else {
102                    window.alert( response.data.error ) ;
103                }
104            } ) ;
105        } , affiliates_form_save : function ( event ) {
106            var affilate_id = $( '#fs_affiliates_current_id' ).val() ;
107            var pay_method = $( '#fs_affiliates_payment_method' ).val() ;
108            var paypal_email = $( '#fs_affiliates_paypal_email' ).val() ;
109            var paypal_bank = $( '#fs_affiliates_bank_details' ).val() ;
110            var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/ ;
111
112            $( '.fs_affiliates_validation_error' ).hide() ;
113
114            if ( pay_method == 'direct' ) {
115                if ( paypal_bank === '' ) {
116                    $( '.fs_affiliates_detail_validate' ).show() ;
117                    return false ;
118                }
119            } else if ( pay_method == 'paypal' ) {
120                if ( paypal_email == '' || ! emailReg.test( paypal_email ) ) {
121                    $( '.fs_affiliates_email_validate' ).show() ;
122                    return false ;
123                }
124            }
125
126            var data = {
127                action : "fs_affiliates_pay_method_change" ,
128                fs_affiliate_current_id : affilate_id ,
129                fs_affiliates_payment_method : pay_method ,
130                fs_affiliates_paypal_email : paypal_email ,
131                fs_affiliates_bank_details : paypal_bank ,
132                fs_security : fs_affiliates_dashboard_params.pay_save_nonce ,
133
134            }
135            jQuery.post( fs_affiliates_dashboard_params.ajax_url , data ,
136                    function ( response ) {
137                        if ( true === response.success ) {
138                            if ( response.data.content == 'success' ) {
139                                $( '#fs_affiliates_msg_success' ).remove() ;
140                                $( '#fs_affiliates_pay_msg_wraper' ).append( '<span id="fs_affiliates_msg_success" class="fs_affiliates_msg_success"><i class="fa fa-check"></i>Success!!!</span>' ) ;
141                                $( '#fs_affiliates_pay_msg_wraper' ).show() ;
142                            }
143                        } else {
144                            window.alert( response.data.error ) ;
145                        }
146                    }
147            ) ;
148        } ,
149        modifiy_slug : function () {
150            FS_Dashboard.show_or_hide_for_modifiy_slug() ;
151        } ,
152        show_or_hide_for_modifiy_slug : function () {
153            if ( jQuery( '#aff_change_slug' ).is( ':checked' ) == true ) {
154                jQuery( '#aff_new_slug' ).closest( 'p' ).show() ;
155            } else {
156                jQuery( '#aff_new_slug' ).closest( 'p' ).hide() ;
157            }
158        } , affiliates_form_send_mail : function ( event ) {
159
160            var refer_mails = $( '#fs_affiliates_refer_mails' ).val() ;
161            var refer_mail_subject = $( '#fs_affiliates_refer_mail_subject' ).val() ;
162            var refer_mail_content = $( '#fs_affiliates_refer_mail_content' ).val() ;
163            var hidden_id = $( '#fs_affiliates_hidden_id' ).val() ;
164
165            var splited = refer_mails.split( '|' ) ;
166            var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/ ;
167
168            $( '.fs_affiliates_msg_success' ).hide() ;
169
170            $( '.fs_affiliates_msg_fails' ).hide() ;
171
172            $( '.fs_affiliates_refer_friend_validation_error' ).hide() ;
173
174            if ( refer_mails == '' ) {
175                $( '.fs_affiliates_refer_mail_validate' ).show() ;
176                return false ;
177            } else {
178                $.each( splited , function ( key , value ) {
179                    if ( ! emailReg.test( value ) ) {
180                        $( '.fs_affiliates_refer_mail_validate' ).show() ;
181                        return false ;
182                    }
183                } ) ;
184            }
185
186
187            if ( refer_mail_subject === '' ) {
188                $( '.fs_affiliates_refer_subject_validate' ).show() ;
189                return false ;
190            }
191
192            if ( refer_mail_content === '' ) {
193                $( '.fs_affiliates_refer_content_validate' ).show() ;
194                return false ;
195            }
196
197
198
199            var data = {
200                action : "fs_affiliates_referafriend_mails" ,
201                refer_mails : refer_mails ,
202                refer_mail_subject : refer_mail_subject ,
203                refer_mail_content : refer_mail_content ,
204                hidden_id : hidden_id ,
205                fs_security : fs_affiliates_dashboard_params.pay_save_nonce ,
206
207            }
208            jQuery.post( fs_affiliates_dashboard_params.ajax_url , data ,
209                    function ( response ) {
210                        var trimmed_response = Number( jQuery.trim( response ) ) ;
211                        $( '.fs_affiliates_refer_friend_validation_error' ).hide() ;
212                        if ( trimmed_response > 0 ) {
213                            $( '.fs_affiliates_refer_mail_success' ).show() ;
214                        } else {
215                            $( '.fs_affiliates_refer_mail_fails' ).show() ;
216                        }
217                    }
218            ) ;
219        } , get_unpaid_commissions : function () {
220            if ( confirm( fs_affiliates_dashboard_params.request_submit_confirm ) ) {
221                var data = {
222                    action : "fsunpaidcommission" ,
223                    affiliateid : $( this ).attr( 'data-affiliateid' ) ,
224                    fs_security : fs_affiliates_dashboard_params.unpaid_commission ,
225
226                }
227                $.post( fs_affiliates_dashboard_params.ajax_url , data , function ( response ) {
228                    if ( true === response.success ) {
229                        $( "<div><span class='fs_affiliates_msg_success'><i class='fa fa-check'> " + response.data.content + " !!!</i></span></div>" ).insertBefore( '.fs_affiliates_form' ) ;
230                    } else {
231                        $( "<div><span class='fs_affiliates_msg_fails_post'><i class='fa fa-exclamation-triangle'> " + response.data.error + "</i></span></div>" ).insertBefore( '.fs_affiliates_form' ) ;
232                    }
233                } ) ;
234            }
235            return false ;
236        } ,
237
238    } ;
239    FS_Dashboard.init() ;
240
241    if ( $( '.fs_affiliates_frontend_dashboard' ).length ) {
242
243        $( 'ul.submenu' ).hide() ;
244        $( 'ul > li, ul.submenu > li' ).hover( function () {
245            if ( $( '> ul.submenu' , this ).length > 0 ) {
246                $( '> ul.submenu' , this ).stop().slideDown( 'slow' ) ;
247            }
248        } , function () {
249            if ( $( '> ul.submenu' , this ).length > 0 ) {
250                $( '> ul.submenu' , this ).stop().slideUp( 'slow' ) ;
251            }
252        } ) ;
253    }
254
255} ) ;

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.