PageSourceSearch

https://bilingualbirdies.com/wp-content/plugins/manage-emails/public/javascripts/main_front.js?ver=1.0.0

js bilingualbirdies.com collected 2026-10-04 01:48:59 UTC 5,293 bytes, 134 lines download raw bytes

1
2function stripe_manager_add_notification(t, e) {
3    //var a = arguments.length > 1 && void 0 !== e ? e : "success"
4    var a = e,
5        n = jQuery("body").find(".os-notifications");
6    n.length || (jQuery("body").append('<div class="os-notifications"></div>'), n = jQuery("body").find(".os-notifications")), n.find(".item").length > 0 && n.find(".item:first-child").remove(), n.append('<div class="item item-type-' + a + '">' + t + '<span class="os-notification-close"><i class="latepoint-icon latepoint-icon-x"></i></span></div>')
7}
8
9const validateEmail = (email) => {
10    return String(email)
11      .toLowerCase()
12      .match(
13        /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
14      );
15};
16
17
18jQuery(document).ready(function ($) {
19
20    jQuery("#btn-send-messaje-any").on("click",( function ( ) {
21        
22        let form = jQuery('div.form-send-message-any').find("input, textarea").serializeArray();
23        let errors = [];
24        
25        // validate if input with name email is empty
26        let list_remittances = $('div.secction-list-remittances');                                
27        let items = list_remittances.find('.remittance-item');
28
29        items.each(function (index, item) {
30            let item_ = $(item);            
31            let full_name = item_.find('input')[0].value;
32            let value = item_.find('input')[1].value;
33            
34            if(!validateEmail(value)){
35                errors.push( value + " email is not valid");            
36            }
37
38            if(value == ""){
39                errors.push( "Email is empty");            
40            }
41
42            if(full_name == ""){
43                errors.push( "Full name is empty");            
44            }
45        });
46
47        if(errors.length > 0){
48            alert(errors.join("\n"));
49            return;
50        }
51
52
53        let params = form.map( item =>{             
54            return `${item.name}=${item.value}`; 
55        }).join("&");
56        let e = jQuery(this), 
57        o = {
58             action: "manage_emails_route_call",
59             route_name: "Home__send_message",
60             params: params,
61             return_format: "json"
62         };    
63                  
64
65         return e.addClass("os-loading"), jQuery.ajax({
66            type: "post",
67            dataType: "json",
68            url: manage_email_helper.ajaxurl,
69            data: o,
70            success: function a(o) {                                            
71                e.removeClass("os-loading");
72                if(o.status =="success"){
73                   
74                   latepoint_add_notification(o.message);
75
76                   let list_remittances = jQuery('.secction-list-remittances');
77                   let count_remittances = list_remittances.find('.remittance-item').length;
78                   if(count_remittances > 1){                        
79                    list_remittances.find('.remittance-item').each( (index, item) =>{ if(index >0) item.remove() });                            
80                   }
81
82                   list_remittances.find('.remittance-item').find('input').each( (index, item) => item.value = "" );
83                   
84                }else{
85                    latepoint_add_notification(o.message,"error")
86                }
87            }
88        }),!1;
89
90
91    }));
92
93    $('#btn-add-remittance').on('click', function (e) {
94    
95        //alert('hola');
96        let btn = $(this);
97        let list_remittances = btn.closest('.row').find('.secction-list-remittances');
98        let count_remittances = list_remittances.find('.remittance-item').length;
99        
100
101        let html = `<div class="row remittance-item mb-2">
102                        <div class="col-6">                            
103                            <input type="text"  class="form-control input-group-sm" name="messaje[${count_remittances}][name]" placeholder="Add Teacher's Name">                            
104                        </div>
105                        <div class="col-6 d-flex">                            
106                            <input type="text" class="form-control input-group-sm" name="messaje[${count_remittances}][email]" placeholder="Add Teacher's Email">
107                            <button class="btn btn-danger btn-sm ml-2 bt
107n-remove-remittance-item" type="button" ><i class="a fa-trash"></i></button>
108                        </div>
109                    </div>`;
110
111        list_remittances.append(html).ready(function () {
112            $('button.btn-remove-remittance-item').on('click', function (e) {
113                
114                $(this).closest('.remittance-item').remove();
115
116                // corregir secuencia de remitentes
117                let list_remittances = $('div.secction-list-remittances');                                
118                let items = list_remittances.find('.remittance-item');
119
120                items.each(function (index, item) {
121                    let item_ = $(item);
122                    item_.find('input')[0].name = `messaje[${index}][name]`;
123                    item_.find('input')[1].name = `messaje[${index}][email]`;
124                });     
125
126
127            });
128        });
129
130    });
131    
132    
133
134});

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.