1/** 2 * 2007-2018 Mondial relay 3 * 4 * NOTICE OF LICENSE 5 * 6 * This source file is subject to the Academic Free License (AFL 3.0) 7 * that is bundled with this package in the file LICENSE.txt. 8 * It is also available through the world-wide-web at this URL: 9 * http://opensource.org/licenses/afl-3.0.php 10 * If you did not receive a copy of the license and are unable to 11 * obtain it through the world-wide-web, please send an email 12 * to Mondial relay so we can send you a copy immediately. 13 * 14 * DISCLAIMER 15 * 16 * Do not edit or add to this file if you wish to upgrade Mondial relay to newer 17 * versions in the future. If you wish to customize Mondial relay for your 18 * needs please refer to Mondial relay for more information. 19 * 20 * @author Mondial relay 21 * @copyright 2007-2018 Mondial relay 22 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 23 * International Registered Trademark & Property of Mondial relay 24 */ 25 $(document).ready(function () { 26 27 $(document).on('mouseover','.PR-List-Item',function(){ 28 replace_class_mr = $(this).attr('onclick'); 29 replace_class_mr2 = replace_class_mr.replace('"#Zone_Widget"', '".fancybox-inner #Zone_Widget"'); 30 $(this).attr('onclick', replace_class_mr2); 31 }); 32 // settimeout utiliser pour la connection de l'utilisateur en opc 33 if(!$('.payment-options').is(':visible')) { 34 showWidgetMr(); 35 } 36 37 $(document).on('click','input[name^=delivery_option]',function(event) { 38 if (typeof PS_MRData != 'undefined') 39 { 40 showWidgetMr(); 41 } 42 43 }); 44 45 $(document).on('click','#checkout-delivery-step .step-title',function(event) { 46 if (typeof PS_MRData != 'undefined') 47 { 48 showWidgetMr(); 49 } 50 51 }); 52 53 }); 54 55 function showWidgetMr() { 56 $("#link_zone_widget").fancybox( 57 { 58 width : 705, 59 height : 620, 60 autoSize : false, 61 autoScale : false, 62 autoDimensions : false, 63 afterShow : function(){ 64 updateBox(); 65 }, 66 onUpdate : function() { 67 $('.fancybox-wrap').css({ 68 top:'10%', 69 bottom:'auto' 70 }) 71 } 72 }); 73 checkToDisplayRelayList(); 74 } 75function getNumeric(val) { 76 var reg = new RegExp("[0-9]+", "g"); 77 var res = reg.exec(val); 78 if (isNaN(res)) 79 return 0; 80 else 81 return res; 82} 83 84function checkToDisplayRelayList() 85{ 86 if (typeof PS_MRData != 'undefined') 87 { 88 //============================================================ 89 // auto display fancybox if radio already check 90 //============================================================ 91 if($('.MR-Widget').is(':visible')) 92 return; 93 PS_MRSelectedRelayPoint['relayPointNum'] = PS_MRData.pre_selected_relay; 94 // PS_VERSION < '1.5' 95 if (PS_MRData.PS_VERSION < '1.5') 96 { 97 // Bind id_carrierX to an ajax call 98 $.each(PS_MRData.carrier_list, function (i, carrier) { 99 PS_MRCarrierMethodList[carrier.id_carrier] = carrier.id_mr_method; 100 if ($('#id_carrier' + carrier.id_carrier).attr('checked')) { 101 PS_MRSelectedRelayPoint['carrier_id'] = carrier.id_carrier; 102 PS_MRDisplayWidget(carrier.id_carrier); 103 setProtectRelaySelected(); 104 } 105 }); 106 107 } 108 else if (PS_MRData.PS_VERSION >= '1.5' 109 && typeof PS_MRData.carrier != 'undefined' 110 ) 111 { // 1.5 way 112 var carrier_selected = $('input[class=delivery_option_radio]:checked').val(); 113 $.each(PS_MRData.carrier_list, function (i, carrier) { 114 PS_MRCarrierMethodList[carrier.id_carrier] = carrier.id_mr_method; 115 if (carrier.id_carrier + ',' == carrier_selected || carrier.id_carrier == carrier_selected) { 116 overrideUpdateExtraCarrier(carrier_selected, id_address); 117 PS_MRSelectedRelayPoint['carrier_id'] = carrier.id_carrier; 118 PS_MRDisplayWidget(carrier.id_carrier); 119 setProtectRelaySelected(); 120 } 121 }); 122 } 123 //============================================================ 124 // Handle input click of the other input to hide the previous relay point list displayed 125 $('input[name=id_carrier], input.delivery_option_radio').click(function (e) { 126 displayPickupPlace(0); 127 }); 128 } 129 //return false;
130} 131 132function isMRCarrier(id_carrier) { 133 var carrier_list = PS_MRData.carrier_list; 134 for (i in carrier_list) { 135 var MR_carrier = carrier_list[i]; 136 if (MR_carrier.id_carrier == id_carrier) { 137 return MR_carrier; 138 } 139 } 140 return false; 141} 142 143function hideRelaySelectedBox(_this) { 144 // Hide MR input if one of them is not selected 145 if (PS_MRCarrierMethodList[_this.val()] == undefined) { 146 // 1.5 way 147 var id = getNumeric(_this.val()); 148 if (PS_MRCarrierMethodList[id] == undefined) { 149 displayPickupPlace(0); 150 PS_MRSelectedRelayPoint['carrier_id'] = 0; 151 PS_MRDisplayWidget(0); 152 PS_MRSelectedRelayPoint['relayPointNum'] = 0; 153 } 154 else { 155 PS_MRSelectedRelayPoint['carrier_id'] = id; 156 PS_MRDisplayWidget(id); 157 } 158 } 159 else { 160 PS_MRSelectedRelayPoint['carrier_id'] = _this.val(); 161 PS_MRDisplayWidget(_this.val()); 162 } 163 return false; 164} 165 166function PS_MRDisplayWidget(carrier_id) { 167 var dlv_mode = ''; 168 $.each(PS_MRData.carrier_list, function (i, carrier) { 169 if (carrier.id_carrier == carrier_id) 170 dlv_mode = carrier.dlv_mode; 171 PS_MRSelectedRelayPoint['relayPointNum'] = -1; 172 PS_MRAddSelectedCarrierInDB(carrier_id); 173 } 174 ); 175 if (carrier_id) { 176 if (dlv_mode != 'LD1' && dlv_mode != 'LDS' && dlv_mode != 'HOM') { 177 loadMR_Map("#Zone_Widget", dlv_mode); 178 $("#link_zone_widget").click(); 179 if (PS_MRSelectedRelayPoint['relayPointNum'] == -1) 180 PS_MRSelectedRelayPoint['relayPointNum'] = 0; 181 } 182 else 183 displayPickupPlace(0); 184 } 185 return false; 186} 187 188 189function overrideUpdateExtraCarrier(id_delivery_option, id_address) 190{ 191 if (PS_MRData.PS_VERSION < '1.5') 192 return false; 193 194 var url = ""; 195 var method = 'updateExtraCarrier'; 196 var params = ''; 197 if (typeof (orderOpcUrl) !== 'undefined') { 198 method = 'updateCarrierAndGetPayments'; 199 params += '&recyclable=' + (($('#recyclable:checked').val() != undefined) ? 1 : 0); 200 params += '&gift=' + (($('#gift:checked').val() != undefined) ? 1 : 0); 201 params += '&gift_message=' + $('#gift_message').val(); 202 params += '&delivery_option[' + id_address + ']=' + id_delivery_option; 203 url = orderOpcUrl; 204 } 205 else 206 url = orderUrl; 207 208 $.ajax({ 209 type: 'POST', 210 headers: {"cache-control": "no-cache"}, 211 url: url + '?rand=' + new Date().getTime(), 212 async: false, 213 cache: false, 214 dataType: "json", 215 data: 'ajax=true' 216 + '&method=' + method 217 + params 218 + '&id_address=' + id_address 219 + '&id_delivery_option=' + id_delivery_option 220 + '&token=' + static_token 221 + '&allow_refresh=1', 222 success: function (jsonData) 223 { 224 //$('#HOOK_EXTRACARRIER_'+id_address).html(jsonData['content']); 225 setProtectRelaySelected(); 226 return false; 227 } 228 }); 229 return false; 230} 231 232function displayPickupPlace(info) { 233 var id = "relay_point_selected_box"; 234 235 if (!info) { 236 $('#' + id).hide(); 237 $('#' + id).remove(); 238 return false; 239 } 240 241 if (PS_MRData.PS_VERSION < '1.5') 242 { 243 var block_carrier = $('#carrierTable'); 244 } 245 else { 246 var block_carrier = $('.delivery_options_address'); 247 } 248 if ($('#' + id).length !== 0) { 249 $('#' + id).html('<h3>' + relay_point_selected_box_label + '</h3>' + info); 250 $('#' + id).show(); 251 } 252 else { 253 $('<div id="' + id + '"><h3>' + relay_point_selected_box_label + '</h3>' + info + '</div>').insertAfter(block_carrier); 254 } 255 return false; 256} 257 258function PS_MRAddSelectedCarrierInDB(id_carrier) 259{ 260 // Make the request 261 $.ajax({ 262 type: 'POST', 263 url: MR_ajax_url, 264 data: {'method': 'addSelectedCarrierToDB', 265 'id_carrier': id_carrier, 266 'id_mr_method': PS_MRCarrierMethodList[id_carrier], 267 'mrtoken': mrtoken}, 268 success: function (json) 269 { 270 return false;
271 } 272 }); 273 return false; 274}
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.