PageSourceSearch

https://www.elplace.com/modules/chronopost/views/js/chronordv.js

js elplace.com collected 2026-10-06 06:52:15 UTC 4,821 bytes, 121 lines download raw bytes

1/**
2  * MODULE PRESTASHOP OFFICIEL CHRONOPOST
3  * 
4  * LICENSE : All rights reserved - COPY AND REDISTRIBUTION FORBIDDEN WITHOUT PRIOR CONSENT FROM OXILEO
5  * LICENCE : Tous droits réservés, le droit d'auteur s'applique - COPIE ET REDISTRIBUTION INTERDITES
6* SANS ACCORD EXPRES D'OXILEO
7  *
8  * @author    Oxileo SAS <[email protected]>
9  * @copyright 2001-2018 Oxileo SAS
10  * @license   Proprietary - no redistribution without authorization
11  */
12
13function toggleRDVpane(cust_address, codePostal, city, e) {
14    if(typeof rdv_carrierIntID === "undefined" || typeof rdv_carrierID === "undefined") {
15        return false;
16    }
17    if ($("input.delivery_option_radio:checked").val() == rdv_carrierID + "," || $("input[name=id_carrier]:checked").val() == rdv_carrierIntID) {
18        if (typeof e != "undefined") {
19            e.stopPropagation();
20        }
21
22        var tellMeWhere = $("input.delivery_option_radio:checked").parent().parent().parent().parent().parent();
23        if (!tellMeWhere.parent().hasClass('delivery_option')) {
24            tellMeWhere = tellMeWhere.parent().parent();
25        }
26
27        $('#chronordv_container').insertAfter(tellMeWhere);
28
29        if ($('input[name="chronoRDVSlot"]:checked').length === 0) {
30            $('input[name="chronoRDVSlot"]:first').click();
31        }
32
33        if ($.fn.uniform) {
34            $('#chronordv_container input').uniform();
35        }
36
37        $('#chronordv_container').show();
38        return false;
39    }
40
41    // Hide controls
42    $('#chronordv_container').hide();
43}
44
45function associateCreneau(rank, deliveryDate, deliveryDateEnd, slotCode, tariffLevel, transactionID, fee) {
46    $.ajax({
47        url: path + '/async/storeCreneau.php?rank=' + rank + '&deliveryDate=' + encodeURIComponent(deliveryDate) + '&deliveryDateEnd=' + encodeURIComponent(deliveryDateEnd) + '&slotCode=' + encodeURIComponent(slotCode) + '&tariffLevel=' + tariffLevel + '&transactionID=' + encodeURIComponent(transactionID) + '&fee=' + fee + '&cartID=' + cartID
48    });
49}
50
51$(document).ready(function () {
52    // Listener for selection of the chronordv carrier radio button
53    $('.delivery_options span.custom-radio > input[type=radio], input[name*="delivery_option"]').click(function (e) {
54        toggleRDVpane(cust_address_clean, cust_codePostal, cust_city, e);
55
56        if (typeof rdv_carrierID != 'undefined' && parseInt($(this).val()) == rdv_carrierID) {
57            $('html, body').animate({
58                scrollTop: $('#chronordv_container').offset().top
59            }, 1500);
60        }
61    });
62
63    $('input[name="chronoRDVSlot"]').change(function (e) {
64        var rank = $('input[name="chronoRDVSlot"]:checked').val();
65        var fee = $('input[name="chronoRDVSlot"]:checked').attr('data-fee');
66        var deliveryDate = $('input[name="chronoRDVSlot"]:checked').attr('data-delivery-date');
67        var deliveryDateEnd = $('input[name="chronoRDVSlot"]:checked').attr('data-delivery-date-end');
68        var slotCode = $('input[name="chronoRDVSlot"]:checked').attr('data-slot-code');
69        var tariffLevel = $('input[name="chronoRDVSlot"]:checked').attr('data-tariff-level');
70        associateCreneau(rank, deliveryDate, deliveryDateEnd, slotCode, tariffLevel, transactionID, fee);
71    });
72
73    $('#nextWeek').on('click', function (e) {
74        e.preventDefault();
75        if (current_content < max_content) {
76            $('#content' + current_content).hide();
77            current_content++;
78            $('#content' + current_content).show();
79        }
80    });
81
82    $('#previousWeek').on('click', function (e) {
83        e.preventDefault();
84        if (current_content !== 1) {
85            $('#content' + current_content).hide();
86            current_content--;
87            $('#content' + current_content).show();
88        }
89    });
90
91    if(typeof rdv_carrierIntID === "undefined" && typeof rdv_carrierID === "undefined") {
92        return;
93    }
94
95    // Init
96    chronoCleanupExtraCarrierHook();
97    // toggle on load
98    toggleRDVpane(cust_address_clean, cust_codePostal, cust_city);
99});
100
101// Prevent compatibility issues with Common Services' modules
102function chronoCleanupExtraCarrierHook() {
103    if(typeof rdv_carrierIntID === "undefined" && typeof rdv_carrierID === "undefined") {
104        console.log('early bail cleanup');
105        return;
106    }
107    if ($("#chronordv_container").length > 0) {
108        $('#chronordv_dummy_container').remove();
109    } else {
110        $('#chronordv_dummy_container').attr('id', 'chronordv_container').hide();
111    }
112}
113
114$(document).ajaxSuccess(function (event, xhr, settings) {
115    if(typeof rdv_carrierIntID === "undefined" && typeof rdv_carrierID === "undefined") {
116        return;
117    }
118    if (typeof settings.data !== 'undefined' && settings.data.match(/method=updateExtraCarrier/)) {
119        chronoCleanupExtraCarrierHook();
120    }
121});

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.