PageSourceSearch

https://www.companisto.com/code/scripts/dashboard/member-connect.js?v=1700034796

js companisto.com collected 2026-10-04 00:28:48 UTC 8,560 bytes, 318 lines download raw bytes

1$(function(){
2
3    $(document).on("click", ".member_connect_button", function(e) {
4
5        var button          = $(this);
6        var receiver_id     = button.attr('data-attr');
7        var http_host       = button.attr('data-http-host');
8        var message_type_id = button.attr('data-message-type-id');
9        var current_route = button.attr('data-current-route');
10
11
12        if(button.hasClass('member-connected')){
13
14
15            if(button.hasClass('start-direct-message')){
16
17
18                var url = http_host + '/dashboard/chat?to=' + receiver_id;
19
20                window.open(url,'_blank');
21
22                return false;
23
24
25            }
26
27
28            if(button.hasClass('member-view-profile')){
29
30                var url2 = http_host + '/angelroom-profile/' + receiver_id;
31
32
33                window.open(url2,'_blank');
34
35                return false;
36            }
37
38
39            return false;
40        } else if(button.hasClass('member-requested')){
41            return false;
42        } else {
43
44
45            $.ajax({
46                type: "POST",
47                url: http_host + '/connect-to-user/show-modal',
48                data: {
49                    receiver_id: receiver_id,
50                    message_type_id: message_type_id,
51                    current_route: current_route
52                },
53                beforeSent: function(){
54                    $('#SecondDefaultModal .modal-content').html('');
55                },
56                success: function(data) {
57                    $('#SecondDefaultModal .modal-content').html(data);
58                    $('#SecondDefaultModal').modal('show');
59                }
60            });
61        }
62
63        return false;
64
65    });
66
67
68
69    $(document).on("click", ".manage_connection", function(e) {
70
71        var type                = $(this).attr('data-type');
72        var connection_id       = $(this).attr('data-id');
73        var sender_id           = $(this).attr('data-sender');
74        var notifiication_id    = $(this).attr('data-notif');
75        var url                 = $(this).attr('href');
76
77
78        $.ajax({
79            type: "POST",
80            url: url,
81            data: {
82                type: type,
83                connection_id: connection_id,
84                sender_id   : sender_id
85            },
86            success: function(data) {
87
88                if(data.status === 'success'){
89                    window.ns.dismiss( $(".ns-notif[data-id="+ notifiication_id +"]") );
90                    setTimeout(function(){ location.reload(); }, 1000);
91                }
92
93                if(data.status == 'failed'){
94
95                    location.reload();
96
97                }
98            }
99        });
100
101
102        return false;
103
104    });
105
106
107
108
109    $(document).on("keyup", "#connect-with-message", function(e) {
110
111        $("#textarea_count").text(( parseInt(500) - parseInt($("#connect-with-message").val().length)) + ' / 500');
112
113        return false;
114
115    });
116
117    $(document).on("click", ".btn-add-note-for-connection", function(e) {
118
119
120        $(this).parent().parent().find('.modal-title.without_message').addClass('hide');
121        $(this).parent().parent().find('.modal-title.with_message').removeClass('hide');
122        $(this).parent().parent().find('.body_with_message').removeClass('hide');
123        $(this).parent().parent().find('.body_without_message').addClass('hide');
124
125
126        $(this).addClass('hide');
127        $('.btn-remove-note-for-connection').removeClass('hide');
128
129
130        return false;
131
132    });
133
134
135
136
137    $(document).on("click", ".btn-remove-note-for-connection", function(e) {
138
139
140        $(this).parent().parent().find('.modal-title.without_message').removeClass('hide');
141        $(this).parent().parent().find('.modal-title.with_message').addClass('hide');
142        $(this).parent().parent().find('.body_with_message').addClass('hide');
143        $(this).parent().parent().find('.body_without_message').removeClass('hide');
144
145        //$('#connect-with-message').val('');
146
147
148        $(this).addClass('hide');
149        $('.btn-add-note-for-connection').removeClass('hide');
150
151
152        return false;
153
154    });
155
156
157    $(document).on("click", ".btn-send-connection-request", function(e) {
158
159
160
161
162
163        var message_box = $('#connect-with-message');
164        var message     = '';
165
166        if($(message_box).is(':visible')){
167            message = message_box.val();
168        }
169
170        var user_alias = $(this).attr('data-alias');
171        var url     = $(this).attr('data-url');
172        var current_route = $(this).attr('data-current-route');
173
174        $.ajax({
175            type: "POST",
176            url: url,
177            data: {
178                receiver_id: user_alias,
179                message: message,
180                current_route: current_route
181            },
182            success: function(data) {
183
184                if(data.status == 'ok'){
185
186                    var button_connect = $('#member-connect-'+ user_alias);
187
188                    changeState(button_connect, 'requested');
189
190
191                    $('#tempalert').find('#tempalertHere').html(data.message + ' ' +  data.profile_url);
192                    //$('.connection-message-row-div').find('a#connection-message-profile-url').attr('href', data.profile_url);
193                    $('#tempalert').delay(1000).slideDown(1000).delay(8000).slideUp(1000);
194
195
196                    //
197                    // $('html, body').animate({
198                    //     scrollTop: $(".navbar").offset().top
199                    // }, 2000);
200
201                    $('#SecondDefaultModal').modal('hide');
202                }
203
204                if(data.status === "limitExceeded") {
205                    alert("You reached your maximum connection limit. Please try again later.");
206                }
207
208            }
209        });
210
211        return false;
212
213    });
214
215
216
217    function changeState(button,state){
218
219        if(button.attr('data-where') == 'list'){
220            button.html(MESSAGE_REQUESTED_TEXT).addClass('member-requested');
221        }else {
222            switch (state) {
223                case "loading":
224                    var loader = $("<i></i>").addClass("fa fa-spinner fa-pulse fa-fw");
225                    button.find(".text").html('Loading').append("&nbsp;").append(loader);
226                    break;
227
228                case "connect": case "canceled":
229                    button.find(".text").removeClass("move").html(MESSAGE_CONNECT_TEXT);
230                    button.find(".plus").removeClass("tick");
231                    break;
232
233                case "requested": case "ignored":
234                    button.find(".text").addClass("move").html(MESSAGE_REQUESTED_TEXT);
235                    button.find(".plus").addClass("tick");
236                    button.attr('data-state', 'requested');
237                    break;
238
239                case "connected":
240                    button.find(".text").addClass("move").html(MESSAGE_CONNECTED_TEXT);
241                    button.find(".plus").addClass("tick");
242                    button.attr('data-state', 'connected');
243                    break;
244
245                case 'requested-list':
246
247                    break;
248
249            }
250        }
251
252        button.show();
253
254    }
255
256
257    $(document).on("click", ".connection-request-view", function(e) {
258
259
260        var alias   = $(this).attr('data-href');
261        var basepath = $(this).attr('data-url');
262        var url     =  basepath +  '/angelroom-profile/'+ alias;
263
264        window.open(url, '_blank');
265
266        return false;
267
268    });
269
270
271    $(document).on("click", ".manage-connection-profile", function(e) {
272
273        var type                = $(this).attr('data-type');
274        var connection_id       = $(this).attr('data-id');
275        var sender_id           = $(this).attr('data-sender');
276        var notification_id     = $(this).attr('data-notif');
277        var url                 = $(this).attr('data-url');
278
279
280        $.ajax({
281            type: "POST",
282            url: url,
283            data: {
284                type: type,
285                connection_id: connection_id,
286                sender_id   : sender_id
287            },
288            success: function(data) {
289
290                if(data.status === 'success'){
291
292                    try {
293                        window.ns.dismiss( $(".ns-notif[data-id="+ notification_id +"]") );
294                    }
295                    catch(err) {
296
297                    }
298
299                    setTimeout(function(){ location.reload(); }, 1000);
300
301                }
302
303                if(data.status == 'failed'){
304
305                    location.reload();
306
307                }
308            }
309        });
310
311
312        return false;
313
314    });
315});
316
317
318

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.