File indexing completed on 2024-12-29 04:51:02
0001 /* 0002 SPDX-FileCopyrightText: 2020 Vitaliy Ry vit@ntcsys.ru 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 function main(content) { 0007 var res = JsonLd.newLodgingReservation(); 0008 0009 var bookingRef = content.eval("//span[@id='lblBookingIdData']"); 0010 var arrivalDate = content.eval("//span[@id='lblCheckInData']"); 0011 var arrivalTime = content.eval("//span[@id='lblHotelCheckInData']"); 0012 var departureDate = content.eval("//span[@id='lblCheckOutData']"); 0013 var departureTime = content.eval("//span[@id='lblHotelCheckOutData']"); 0014 var hotelName = content.eval("//span[@id='lblHotelNameData']"); 0015 var hotelAddress = content.eval("//span[@id='lblHotelAddressData']"); 0016 var hotelCoordinates = content.eval("//a[@id='linkMap']/@href"); 0017 0018 var gpsCoordinates = hotelCoordinates[0].content.match(/(\d+\.\d+,\d+\.\d+)/)[0].split(","); 0019 var d1 = arrivalDate[0].content.match(/(.*\d{4})/)[0] + arrivalTime[0].content.match(/(\d{2}:\d{2})/)[0]; 0020 var d2 = departureDate[0].content.match(/(.*\d{4})/)[0] + departureTime[0].content.match(/(\d{2}:\d{2})/)[0]; 0021 0022 res.reservationNumber = bookingRef[0].content; 0023 res.reservationFor.name = hotelName[0].content; 0024 res.reservationFor.address.streetAddress = hotelAddress[0].content; 0025 res.checkinTime = JsonLd.toDateTime(d1, "dd MMMM yyyyhh:mm", "ru"); 0026 res.checkoutTime = JsonLd.toDateTime(d2, "dd MMMM yyyyhh:mm", "ru"); 0027 res.reservationFor.geo.latitude = gpsCoordinates[0]; 0028 res.reservationFor.geo.longitude = gpsCoordinates[1]; 0029 0030 return res; 0031 } 0032