1;(function ($) { 2 3 assignPrice = function(PriceWithCurrencyFrom, PriceWithCurrencyInstead, shortcode, item){ 4 $('.pricevalue', shortcode).html(PriceWithCurrencyFrom); 5 6 if (PriceWithCurrencyInstead !== PriceWithCurrencyFrom) { 7 $('.insteadvalue', shortcode).html(PriceWithCurrencyInstead); 8 } 9 else { 10 $('.instead', shortcode).remove(); 11 } 12 if (PriceWithCurrencyFrom) { 13 $('*', shortcode).show(); 14 $('.fallback', shortcode).hide(); 15 } 16 17 shortcode.attr('data-packageslug', item.package_main.slug).attr('data-resawebdone', 'ok').attr('data-pricevalue', item.price_perperson_discounted).attr('data-insteadvalue', 18 item.price_perperson_regular); 19 }; 20 21 22 $('.resaweb-load').each(function (e) { 23 hotel_id = $(this).data('hotelid'); 24 package_id = $(this).data('packageid'); 25 trip_id = $(this).data('tripid'); 26 nights = $(this).data('nights'); 27 $.ajax({ 28 url: 'https://reservation.thalasso-saintmalo.com/fr/api/v1/price-search', 29 method: 'get', 30 dataType: 'json', 31 data: { 32 hotel_id: hotel_id, 33 package_id: [package_id], 34 trip_id: trip_id, 35 duration: nights 36 }, 37 success: function (data) { 38 39 $.each(data, function (i, item) { 40 41 // Format price to i18n 42 var PriceWithCurrencyFrom = Number(item.price_perperson_discounted).toLocaleString(tmsm_resawebintegration_params.locale, {style: "currency", currency: tmsm_resawebintegration_params.options.currency, minimumFractionDigits: 0, maximumFractionDigits: 2}); 43 var PriceWithCurrencyInstead = Number(item.price_perperson_regular).toLocaleString(tmsm_resawebintegration_params.locale, {style: "currency", currency: tmsm_resawebintegration_params.options.currency, minimumFractionDigits: 0, maximumFractionDigits: 2}); 44 45 // Assign prices hotel shortcodes 46 $('.resaweb-price[data-hotelid="' + item.place.codename + '"][data-packageid="' + item.package_main.package_id + '"][data-nights="' + item.nights_nb + '"]').each(function () { 47 var shortcode = $(this); 48 49 assignPrice(PriceWithCurrencyFrom, PriceWithCurrencyInstead, shortcode, item); 50 51 }); 52 53 // Assign prices BEST shortcodes 54 $('.resaweb-price[data-hotelid="BEST"][data-packageid="' + item.package_main.package_id + '"]').each(function () { 55 var shortcode = $(this); 56 57 // Exclude without accommodation 58 if(item.place.codename === 'TMS'){ 59 return true; 60 } 61 62 // Exclude not matching number of nights 63 if(shortcode.attr('data-nights')){ 64 if(shortcode.attr('data-nights') !== item.nights_nb){ 65 return true; 66 } 67 } 68 69 // Compare existing price 70 if(shortcode.attr('data-pricevalue') && parseInt(item.price_perperson_discounted) > parseInt(shortcode.attr('data-pricevalue'))){ 71 return true; 72 } 73 74 assignPrice(PriceWithCurrencyFrom, PriceWithCurrencyInstead, shortcode, item); 75 76 }); 77 78 79 }); 80 81 }, 82 error: function (data, textStatus, errorThrown) { 83 } 84 }); 85 }); 86 87}(jQuery));
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.