PageSourceSearch

https://promasters.store/wp-content/plugins/getcid-generator/includes/js/gcid-public.js?ver=1791591541

js promasters.store collected 2026-10-10 00:20:08 UTC 28,449 bytes, 895 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3    function setCookie(name, value, minutes) {
4
5        var date = new Date();
6
7        date.setTime(date.getTime() + (minutes * 60 * 1000));
8
9        var expires = "expires=" + date.toUTCString();
10
11        document.cookie = name + "=" + value + ";" + expires + ";path=/";
12    }
13
14    function getCookie(name) {
15
16        var nameEQ = name + "=";
17
18        var ca = document.cookie.split(';');
19
20        for (var i = 0; i < ca.length; i++) {
21
22            var c = ca[i];
23
24            while (c.charAt(0) == ' ') c = c.substring(1, c.length);
25
26            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
27
28        }
29
30        return null;
31    }
32
33    function deleteCookie(name) {
34        document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/";
35    }
36
37    $('#gcid_user_cid_request_table').dataTable({
38        "bSort": false
39    });
40
41    function gcid_format_iid(iid) {
42
43        var formattedInput = '';
44
45        iid = iid.replace(/[^0-9]/g, '');
46
47        if (iid.length > 63) {
48            iid = iid.substring(0, 63);
49        }
50
51        if (iid.length === 63) {
52
53            for (var i = 0; i < iid.length; i++) {
54                formattedInput += iid[i];
55                if ((i + 1) % 7 === 0 && i + 1 !== iid.length) {
56                    formattedInput += '-';
57                }
58            }
59
60        } else if (iid.length === 54) {
61
62            for (var i = 0; i < iid.length; i++) {
63                formattedInput += iid[i];
64                if ((i + 1) % 6 === 0 && i + 1 !== iid.length) {
65                    formattedInput += '-';
66                }
67            }
68
69        }
70        else {
71            formattedInput = iid;
72        }
73
74        return formattedInput;
75
76    }
77
78    function is_valid_installation_iid(gcid_install_id) {
79
80        var is_valid_installation_iid = true;
81
82        var gcid_regex7x9 = /^[0-9]{7}-[0-9]{7}-[0-9]{7}-[0-9]{7}-[0-9]{7}-[0-9]{7}-[0-9]{7}-[0-9]{7}-[0-9]{7}$/i;
83
84        var gcid_regex6x9 = /^[0-9]{6}-[0-9]{6}-[0-9]{6}-[0-9]{6}-[0-9]{6}-[0-9]{6}-[0-9]{6}-[0-9]{6}-[0-9]{6}$/i;
85
86        var gcid_regex7x9_new = /^[0-9]{7} [0-9]{7} [0-9]{7} [0-9]{7} [0-9]{7} [0-9]{7} [0-9]{7} [0-9]{7} [0-9]{7}$/i;
87
88        var gcid_regex6x9_new = /^[0-9]{6} [0-9]{6} [0-9]{6} [0-9]{6} [0-9]{6} [0-9]{6} [0-9]{6} [0-9]{6} [0-9]{6}$/i;
89
90        $('.gcid_inst_error').html("");
91
92        if (gcid_install_id === '') {
93            is_valid_installation_iid = false;
94
95            $('.gcid_inst_error').html("Installation ID is required");
96        }
97        else if ((!gcid_regex7x9.test(gcid_install_id) && !gcid_regex7x9_new.test(gcid_install_id)) && (!gcid_regex6x9.test(gcid_install_id) && !gcid_regex6x9_new.test(gcid_install_id))) {
98            is_valid_installation_iid = false;
99
100            $('.gcid_inst_error').html("Invalid Installation ID format. Please use 7x9 or 6x9 format.");
101        }
102
103        return is_valid_installation_iid;
104
105    }
106
107    function gcid_submitInstallID_Ajax(installID) {
108
109        $('.gcid_loaderdiv .gcid_loader').css('display', 'block');
110
111        $('#gcid_confirmation_result').attr('placeholder', 'Getting CID, wait for few seconds');
112
113        $('#gcid_confirmation_result').val('');
114
115        $.ajax({
116            url: Gcid.ajax_url,
117            method: 'POST',
118            data: {
119                action: 'gcid_install_submit_data',
120                gcid_install_id: installID
121            },
122            success: function (response) {
123
124                var res = JSON.parse(response);
125
126                $('.gcid_loaderdiv .gcid_loader').css('display', 'none');
127
128                $('#gcid_confirmation_result').attr('placeholder', 'CID Result will be shown here.....');
129
130                if (res.success) {
131
132                    deleteCookie('gcid_previous_requested_iid');
133
134                    $('#gcid_confirmation_result').val(res.gcid_cid);
135
136                    iscu_fill_cid_blocks(res.gcid_cid);
137
138                }
139                else {
140                    if (res.error == 'IID added to queue.') {
141                        $('.gcid_loaderdiv .gcid_loader').css('display', 'block');
142
143                        setTimeout(() => {
144
145                            deleteCookie('gcid_previous_requested_iid');
146
147                            $(document).find('.gcid_conf_submit_btn').trigger('click', { update_credit: true })
148
149                        }, 30000);
150
151                    }
152                    else {
153                        if (res.error == 'Wrong IID') deleteCookie('gcid_previous_requested_iid');
154
155                        $('.gcid_inst_error').html(res.error);
156                    }
157                }
158
159            }
160
161        });
162    }
163
164    function is_valid_second_form_installation_iid(gcid_second_form_install_id) {
165
166        var is_valid_installation_iid = true;
167
168        var gcid_regex7x9 = /^[0-9]{7}-[0-9]{7}-[0-9]{7}-[0-9]{7}-[0-9]{7}-[0-9]{7}-[0-9]{7}-[0-9]{7}-[0-9]{7}$/i;
169
170        var gcid_regex6x9 = /^[0-9]{6}-[0-9]{6}-[0-9]{6}-[0-9]{6}-[0-9]{6}-[0-9]{6}-[0-9]{6}-[0-9]{6}-[0-9]{6}$/i;
171
172        var gcid_regex7x9_new = /^[0-9]{7} [0-9]{7} [0-9]{7} [0-9]{7} [0-9]{7} [0-9]{7} [0-9]{7} [0-9]{7} [0-9]{7}$/i;
173
174        var gcid_regex6x9_new = /^[0-9]{6} [0-9]{6} [0-9]{6} [0-9]{6} [0-9]{6} [0-9]{6} [0-9]{6} [0-9]{6} [0-9]{6}$/i;
175
176        $('.gcid_second_form_inst_error').html("");
177
178        if (gcid_second_form_install_id === '') {
179            is_valid_installation_iid = false;
180
181            $('.gcid_second_form_inst_error').html("Installation ID is required");
182        }
183        else if ((!gcid_regex7x9.test(gcid_second_form_install_id) && !gcid_regex7x9_new.test(gcid_second_form_install_id)) && (!gcid_regex6x9.test(gcid_second_form_install_id) && !gcid_regex6x9_new.test(gcid_second_form_install_id))) {
184            is_valid_installation_iid = false;
185
186            $('.gcid_second_form_inst_error').html("Invalid Installation ID format. Please use 7x9 or 6x9 format.");
187        }
188
189        return is_valid_installation_iid;
190
191    }
192
193    function gcid_second_form_submitInstallID_Ajax(installID) {
194
195        $('.gcid_second_form_loader').css('display', 'block');
196
197        $('#gcid_second_form_confirmation_result').attr('placeholder', 'Getting CID, wait for few seconds');
198
199        $('#gcid_second_form_confirmation_result').val('');
200
201        $.ajax({
202            url: Gcid.ajax_url,
203            method: 'POST',
204            data: {
205                action: 'gcid_second_form_install_submit_data',
206                gcid_second_form_install_id: installID
207            },
208            success: function (response) {
209
210                var res = JSON.parse(response);
211
212                $('.gcid_second_form_loader').css('display', 'none');
213
214                $('#gcid_second_form_confirmation_result').attr('placeholder', 'CID Result will be shown here.....');
215
216                if (res.success) {
217                    $('#gcid_second_form_confirmation_result').val(res.gcid_cid);
218                }
219                else {
220                    if (res.error == 'IID added to queue.') {
221                        $('.gcid_second_form_loader').css('display', 'block');
222
223                        setTimeout(() => {
224                            $(document).find('.gcid_second_form_conf_submit_btn').trigger('click', { update_credit: true })
225                        }, 30000);
226
227                    }
228                    else {
229                        if (res.error == 'Wrong IID') deleteCookie('gcid_previous_requested_iid');
230
231                        $('.gcid_second_form_inst_error').html(res.error);
232                    }
233                }
234
235            }
236
237        });
238
239    }
240
241    $('#gcid_install_id, #gcid_second_form_install_id').on('input', function () {
242
243        this.value = this.value.replace(/[^0-9]/g, '');
244
245    });
246
247    $(document).on('click', '.gcid_inst_submit_btn', function (e) {
248
249        e.preventDefault();
250
251        if (Gcid.gcid_login_check == 'false') {
252            $('.gcid_user_login_check_section').html('<a href="' + Gcid.gcid_my_account_url + '" class="gcid_login_error">You need to login to Get CID.</a>');
253        }
254        else {
255
256            var gcid_install_id = $('#gcid_install_id').val().trim();
257
258            var formattedInput = gcid_format_iid(gcid_install_id);
259
260            gcid_install_id = formattedInput;
261
262            var gcid_previous_requested_iid = getCookie('gcid_previous_requested_iid');
263
264            if (gcid_previous_requested_iid == gcid_install_id && gcid_install_id != '') {
265                $('.gcid_inst_error').html(Gcid.already_requested_error_message);
266            }
267            else {
268
269                setCookie('gcid_previous_requested_iid', gcid_install_id, 0.5);
270
271                $('#gcid_install_id').val(gcid_install_id);
272
273                if (is_valid_installation_iid(gcid_install_id)) {
274                    gcid_submitInstallID_Ajax(gcid_install_id);
275                }
276            }
277
278        }
279
280
281    });
282
283    $('.gcid_conf_submit_btn').on('click', function (e, data) {
284
285        e.preventDefault();
286
287        var update_credit = data ? data.update_credit : false;
288
289        if (Gcid.gcid_login_check == 'false') {
290            $('.gcid_user_login_check_section').html('<a href="' + Gcid.gcid_my_account_url + '" class="gcid_login_error">You need to login to Get CID.</a>');
291        }
292        else {
293
294            $('#gcid_confirmation_result').val('');
295
296            var gcid_install_id = $('#gcid_install_id').val().trim();
297
298            var formattedInput = gcid_format_iid(gcid_install_id);
299
300            gcid_install_id = formattedInput;
301
302            var gcid_previous_requested_iid = getCookie('gcid_previous_requested_iid');
303
304            if (gcid_previous_requested_iid == gcid_install_id && gcid_install_id != '') {
305                $('.gcid_inst_error').html(Gcid.already_requested_error_message);
306            }
307            else {
308
309                setCookie('gcid_previous_requested_iid', gcid_install_id, 0.5);
310
311                $('#gcid_install_id').val(gcid_install_id);
312
313                if (is_valid_installation_iid(gcid_install_id)) {
314                    $('.gcid_loaderdiv .gcid_loader').css('display', 'block');
315
316                    $.ajax({
317                        url: Gcid.ajax_url,
318                        method: 'POST',
319                        data: {
320                            action: 'gcid_confirm_submit_data',
321                            gcid_install_id: gcid_install_id,
322                            update_credit: update_credit,
323                        },
324                        success: function (response) {
325
326                            var res = JSON.parse(response);
327
328                            $('.gcid_loaderdiv .gcid_loader').css('display', 'none');
329
330                            if (res.success) {
331
332                                deleteCookie('gcid_previous_requested_iid');
333
334                                $('#gcid_confirmation_result').val(res.gcid_cid);
335
336                                iscu_fill_cid_blocks(res.gcid_cid);
337
338                            }
339                            else {
340                                if (res.error == 'IID added to queue.') {
341                                    $('.gcid_loaderdiv .gcid_loader').css('display', 'block');
342
343                                    setTimeout(() => {
344                                        $(document).find('.gcid_conf_submit_btn').trigger('click', { update_credit: true })
345                                    }, 30000);
346
347                                }
348                                else {
349                                    if (res.error == 'Wrong IID') deleteCookie('gcid_previous_requested_iid');
350
351                                    $('.gcid_inst_error').html(res.error);
352                                }
353                            }
354
355                        }
356
357                    });
358
359                }
360            }
361
362
363        }
364
365    });
366
367    $(document).on('click', '.gcid_second_inst_submit_btn', function (e) {
368
369        e.preventDefault();
370
371        var gcid_second_form_install_id = $('#gcid_second_form_install_id').val().trim();
372
373        gcid_second_form_install_id = gcid_format_iid(gcid_second_form_install_id);
374
375        $('#gcid_second_form_install_id').val(gcid_second_form_install_id);
376
377        if (is_valid_second_form_installation_iid(gcid_second_form_install_id)) {
378            gcid_second_form_submitInstallID_Ajax(gcid_second_form_install_id);
379        }
380
381    });
382
383    $('.gcid_second_form_conf_submit_btn').on('click', function (e, data) {
384
385        e.preventDefault();
386
387        var update_credit = data ? data.update_credit : false;;
388
389        $('#gcid_second_form_confirmation_result').val('');
390
391        var gcid_second_form_install_id = $('#gcid_second_form_install_id').val().trim();
392
393        gcid_second_form_install_id = gcid_format_iid(gcid_second_form_install_id);
394
395        $('#gcid_second_form_install_id').val(gcid_second_form_install_id);
396
397        if (is_valid_second_form_installation_iid(gcid_second_form_install_id)) {
398            $('.gcid_second_form_loader').css('display', 'block');
399
400            $.ajax({
401                url: Gcid.ajax_url,
402                method: 'POST',
403                data: {
404                    action: 'gcid_second_form_confirm_submit_data',
405                    gcid_second_form_install_id: gcid_second_form_install_id,
406                    update_credit: update_credit,
407                },
408                success: function (response) {
409
410                    var res = JSON.parse(response);
411
412                    $('.gcid_second_form_loader').css('display', 'none');
413
414                    if (res.success) {
415                        $('#gcid_second_form_confirmation_result').val(res.gcid_cid);
416                    }
417                    else {
418                        if (res.error == 'IID added to queue.') {
419                            $('.gcid_second_form_loader').css('display', 'block');
420
421                            setTimeout(() => {
422                                $(document).find('.gcid_second_form_conf_submit_btn').trigger('click', { update_credit: true })
423                            }, 30000);
424
425                        }
426                        else {
427                            if (res.error == 'Wrong IID') deleteCookie('gcid_previous_requested_iid');
428
429                            $('.gcid_second_form_inst_error').html(res.error);
430                        }
431                    }
432
433                }
434
435            });
436
437        }
438
439    });
440
441    $(document).on('click', '.gcid_second_form_cid_copy_submit', function () {
442
443        var copyText = $('#gcid_second_form_confirmation_result');
444
445        copyText.select();
446
447        document.execCommand("copy");
448    });
449
450    $(document).on('click', '.gcid_cid_copy_submit', function () {
451
452        var copyText = $('#gcid_confirmation_result');
453
454        copyText.select();
455
456        document.execCommand("copy");
457    });
458
459    $('.copy-cid-button').on('click', function () {
460
461        var cid = $(this).data('cid');
462
463        var $tempInput = $('<input>');
464
465        $('body').append($tempInput);
466
467        $tempInput.val(cid).select();
468
469        document.execCommand('copy');
470
471        $tempInput.remove();
472
473        var $button = $(this);
474
475        $button.text('Copied');
476
477        setTimeout(function () {
478
479            $button.text('Copy');
480
481        }, 2000);
482    });
483
484
485    $(document).on('click', '#gcid_il_check_btn', function (e) {
486
487        e.preventDefault();
488
489        var gcid_lc_check88_api_keys    = $("#gcid_lc_check88_text").val().trim();
490
491        var gcid_just_get_description   = $("#gcid_lc_check88_checkbox").prop("checked") ? 1 : 0;
492
493        $('.gcid_inst_error').html("");
494
495        $("#gcid_lc_response_field").val('');
496
497        if (gcid_lc_check88_api_keys === '') 
498        {
499            $('.gcid_inst_error').html('Keys is not emptied!');
500            return;
501        }
502
503        $('.gcid_lice_check_loader').show();
504        $('#gcid_lc_check88_text').prop('readonly', true);
505        $('#gcid_il_check_btn').prop('disabled', true);
506        $('#gcid_lc_response_field').prop('readonly', true);
507
508        $.ajax({
509            url: Gcid.ajax_url,
510            type: 'POST',
511            data: {
512                action: 'gcid_LC_Check88',
513                keys: gcid_lc_check88_api_keys,
514                just_get_description: gcid_just_get_description
515            },
516            success: function ( response ) {
517
518                var res = JSON.parse(response);
519
520                if (res.success === true) 
521                {
522                    var gcid_formatted_response = '';
523
524                    res.results.forEach(function (item) {
525
526                        var gcid_response_text = `Key         : ${item.keyname_with_dash} \n`;
527
528                        if ( item.prd != 'N/A' ) gcid_response_text += `Description : ${item.prd} \n`;
529                        
530                        if ( item.sub != 'N/A' ) gcid_response_text += `Sub type    : ${item.sub} \n`;
531
532                        if ( item.err_code != 'N/A' ) gcid_response_text += `Error code  : ${item.err_code} \n`;
533
534                        if ( item.remaining != 'N/A' ) gcid_response_text += `Remaining   : ${item.remaining} \n`;
535
536                        gcid_response_text += `Time        : ${item.datetime_checked_done} \n\n`;
537
538                        if ( item.prd == 'N/A' && item.sub == 'N/A' && item.err_code == 'N/A' && item.remaining == 'N/A' ) 
539                        {
540                            var gcid_response_text = `Key         : ${item.keyname_with_dash} \n`;
541
542                            gcid_response_text += `The Key is invalid, or is unsupported by pidms \n\n`;
543                        }
544
545                        gcid_formatted_response += gcid_response_text;
546
547                    });
548
549                    $('#gcid_lc_response_field').val(gcid_formatted_response);
550
551                    $('#gcid_lc_check88_text').prop('readonly', false);
552                    $('#gcid_il_check_btn').prop('disabled', false);
553                    $('#gcid_lc_response_field').prop('readonly', false);
554                }
555                else 
556                {
557                    var gcid_error_message = res.error || 'Error: Could not retrieve data.';
558
559                    $('.gcid_inst_error').html(gcid_error_message);
560
561                    $('#gcid_lc_check88_text').prop('readonly', false);
562                    $('#gcid_il_check_btn').prop('disabled', false);
563                    $('#gcid_lc_response_field').prop('readonly', false);
564                }
565                $('.gcid_lice_check_loader').hide();
566
567            },
568            error: function (xhr, status, error) {
569
570                var errorMessage = "Error: " + error;
571
572                $("#gcid_lc_response_field").val(errorMessage);
573
574                $('.gcid_inst_error').html(errorMessage);
575            }
576        });
577    });
578
579    $('.gcid_his_modal_close_btn').on('click', function () {
580        $('#gcid_errorModal').hide();
581    });
582
583    $('.gcid_modal_ok_btn').on('click', function () {
584        $('#gcid_errorModal').hide();
585    });
586
587
588
589    var is_ctrl_down    = false;
590
591    var iscu_ctrl_key   = 17, iscu_v_key = 86, iscu_backspace_key = 8;
592
593    $('.gcid_confirmation_id_form_field').on("input", function (e) {
594
595        var iscu_char_code = ( e.which ) ? e.which : e.keyCode;
596
597        if ( iscu_char_code == iscu_ctrl_key ) is_ctrl_down = true;
598
599        if ( is_ctrl_down == true && iscu_char_code == iscu_v_key ) return true;
600
601        if ( iscu_char_code == iscu_backspace_key ) return true;
602
603        if ( iscu_char_code > 31 && !( ( iscu_char_code >= 48 && iscu_char_code <= 57 ) || ( iscu_char_code >= 96 && iscu_char_code <= 105 ) ) ) return false;
604
605        return true;
606
607    }).keyup(function (e) {
608
609        var iscu_char_code = (e.which) ? e.which : e.keyCode;
610
611        if (iscu_char_code == iscu_ctrl_key) is_ctrl_down = false;
612
613    }).on("input", function () {
614
615        var $this             = $(this);
616
617        $this.val($this.val().replace(/[^0-9]/g, ''));
618
619        var iscu_max_length   = 7;
620        var iscu_min_length   = 0;
621        var iscu_first_field  = $('#gcid_confirmation_field_1').val();
622        var iscu_second_field = $('#gcid_confirmation_field_2').val();
623
624        if ( iscu_second_field != '' && iscu_first_field.length == 6 ) iscu_max_length = 6;
625
626        if ( $this.val().length > iscu_max_length ) $this.val($this.val().substring(0, iscu_max_length));
627
628        if ( $this.val().length === iscu_max_length ) 
629        {
630            var iscu_next_field = $this.parent().next().children()[0];
631
632            if ( iscu_next_field !== undefined ) iscu_next_field.focus();
633        }
634
635        if ( $this.val().length === iscu_min_length ) 
636        {
637            var iscu_prev_field = $this.parent().prev().children()[0];
638
639            if (iscu_prev_field !== undefined) iscu_prev_field.focus();
640        }
641
642        var value = '';
643
644        $('.gcid_confirmation_id_form_field').each((i, input) => {
645            value += $(input).val() !== '' ? $(input).val() : '';
646        });
647
648        $('#gcid_install_id').val(value);
649
650    });
651
652
653    $(document).find('.gcid_confirmation_id_form_field').each((index, field) => {
654
655        $(field).on('paste', (e) => {
656
657            e.preventDefault();
658
659            var pastedData      = e.originalEvent.clipboardData.getData('text').replace(/-/g, '');
660            var totalLength     = pastedData.length;
661            var charPerField    = totalLength <= 54 ? 6 : 7;
662
663            var cursor = 0;
664
665            $('.gcid_confirmation_id_form_field').each((i, input) => {
666
667                if (cursor < pastedData.length) {
668                    $(input).val(pastedData.substring(cursor, cursor + charPerField));
669                    cursor += charPerField;
670                } else {
671                    $(input).val('');
672                }
673            });
674
675            var value = '';
676
677            $('.gcid_confirmation_id_form_field').each((i, input) => {
678                value += $(input).val() !== '' ? $(input).val() : '';
679            });
680
681            $('#gcid_install_id').val(value);
682
683        });
684
685    });
686
687    $(document).on('click', '.gcid_formatted_view_field', async function () {
688
689        var $this = $(this);
690
691        var current_val = $this.val();
692
693        await navigator.clipboard.writeText(current_val);
694
695        $this.val('Copied!');
696
697        setTimeout(() => { $this.val(current_val); }, 700);
698
699    });
700
701    function iscu_fill_cid_blocks(cid) {
702
703        $('.gcid_formatted_view_field').each((index, field) => {
704
705            var values = cid.split('-');
706
707            if (values[index]) $(field).val(values[index]);
708        });
709
710    }
711
712    
713    function gcid_upload_image(gcid_image_to_upload) {
714
715        var formData = new FormData();
716
717        formData.append('file', gcid_image_to_upload);
718
719        formData.append('action', 'gcis_upload_image_to_ocr');
720    
721        $.ajax({
722            url: Gcid.ajax_url,
723            type: 'POST',
724            data: formData,
725            processData: false,
726            contentType: false,
727            success: function (response) {
728                var res = JSON.parse(response);
729    
730                $(document).find('#gcid_iid_upload').removeClass('gcid_ajaxing');
731    
732                if (res.success) 
733                {
734                    $(document).find('#gcid_install_id, #gcid_second_form_install_id').val(res.message);
735                    $(document).find('.gcid_inst_submit_btn, .gcid_second_inst_submit_btn').click();
736                } 
737                else 
738                {
739                    $('.gcid_inst_error, .gcid_second_form_inst_error').html(res.message);
740                }
741            },
742            error: function () {
743                $('.gcid_inst_error, .gcid_second_form_inst_error').html("An error occurred while uploading the image.");
744                $(document).find('#gcid_iid_upload').removeClass('gcid_ajaxing');
745            }
746        });
747    }
748    
749    $(document).on('change', '#gcid_iid_image', function () {
750
751        $('.gcid_inst_error, .gcid_second_form_inst_error').html('');
752    
753        $(document).find('#gcid_iid_upload').addClass('gcid_ajaxing');
754    
755        var gcid_iid_image = this.files[0];
756
757        var gcid_valid_extensions = ['image/png', 'image/jpeg', 'image/jpg'];
758    
759        if (gcid_iid_image) 
760        {
761            if ($.inArray(gcid_iid_image.type, gcid_valid_extensions) === -1) 
762            {
763
764                $('.gcid_inst_error, .gcid_second_form_inst_error').html("Please upload a valid image file (PNG, JPG, JPEG).");
765    
766                $('#gcid_iid_image').val('');
767    
768                $(document).find('#gcid_iid_upload').removeClass('gcid_ajaxing');
769    
770                return false;
771            }
772    
773            var file_size = gcid_iid_image.size;
774
775            var file_size_mb = file_size / (1024 * 1024);
776    
777            if (file_size_mb <= 1) 
778            {
779                gcid_upload_image(gcid_iid_image);
780            } 
781            else 
782            {
783                new Compressor(gcid_iid_image, {
784                    quality: 0.6,
785                    maxWidth: 800,
786                    maxHeight: 800,
787                    success: function (compressedImage) {
788                        gcid_upload_image(compressedImage);
789                    },
790                    error: function (err) {
791                        console.error('Compression error:', err.message);
792                        $('.gcid_inst_error, .gcid_second_form_inst_error').html("Error compressing the image.");
793                        $(document).find('#gcid_iid_upload').removeClass('gcid_ajaxing');
794                    }
795                });
796            }
797        }
798    });
799
800    // $(document).on('paste', '#gcid_install_id', function(e) {
801
802    //     $('.gcid_inst_error, .gcid_second_form_inst_error').html('');
803
804    //     var gcid_pasted_items   = e.originalEvent.clipboardData.items;
805        
806    //     var gcid_image_count    = 0;
807    
808    //     for ( var i = 0; i < gcid_pasted_items.length; i++ ) {
809
810    //         var gcid_pasted_item = gcid_pasted_items[i];
811    
812    //         if ( gcid_pasted_item.type.indexOf('image') == 0 ) 
813    //         {
814    //             gcid_image_count++;
815                
816    //             if (gcid_image_count > 1) 
817    //             {
818    //                 $('.gcid_inst_error, .gcid_second_form_inst_error').html("You can only paste one image at a time.");
819    //                 return;
820    //             }
821    
822    //             var gcid_pasted_file = gcid_pasted_item.getAsFile();
823    
824    //             var gcid_file_reader = new FileReader();
825    
826    //             gcid_file_reader.onload = function (event) {
827    
828    //                 var gcid_iid_image = $('#gcid_iid_image')[0];
829    
830    //                 var dataTransfer = new DataTransfer(); 
831    
832    //                 dataTransfer.items.add(gcid_pasted_file); 
833                    
834    //                 gcid_iid_image.files = dataTransfer.files;
835    
836    //             };
837                
838    //             gcid_file_reader.readAsDataURL(gcid_pasted_file);
839    
840    //         }
841    //     }
842    
843    //     if ( gcid_image_count > 0 )
844    //     {
845    //         e.preventDefault();
846
847    //         $('#gcid_iid_image').trigger('change');
848
849    //     }
850    // });
851
852
853    $(document).on( 'paste', '#gcid_install_id, #gcid_second_form_install_id', function(e){
854    
855        var gciid_pasted_items = e.originalEvent.clipboardData.items;
856
857        if( gciid_pasted_items != undefined )
858        {
859            for (var i = 0; i < gciid_pasted_items.length; i++) {
860    
861                var gciid_pasted_item = gciid_pasted_items[i];
862    
863                if (gciid_pasted_item.type.indexOf('image') === 0) {
864    
865                    e.preventDefault();
866    
867                    var gciid_pasted_file = gciid_pasted_item.getAsFile();
868    
869                    var gcid_file_reader = new FileReader();
870    
871                    gcid_file_reader.onload = function (event) {
872    
873                        var gcid_iid_image = $('#gcid_iid_image')[0];
874    
875                        var dataTransfer = new DataTransfer(); 
876    
877                        dataTransfer.items.add(gciid_pasted_file); 
878                        
879                        gcid_iid_image.files = dataTransfer.files;
880    
881                        $('#gcid_iid_image').trigger('change')
882    
883                    };
884                    
885                    gcid_file_reader.readAsDataURL(gciid_pasted_file);
886    
887                    break
888                }
889            }
890        }
891
892    });
893    
894
895});

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.