Skip to content

Instantly share code, notes, and snippets.

@adjohu
Created October 18, 2012 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adjohu/3913224 to your computer and use it in GitHub Desktop.
Save adjohu/3913224 to your computer and use it in GitHub Desktop.
(withJQuery = function withJQuery() {
// Check for jQuery
if (!window.jQuery) {
return setTimeout(withJQuery, 100);
}
var getISODateFor = function (title) {
var selector = ".DtlDetailTbl td:contains('" + title + "') + .ResConfirmValue";
var date = new Date($(selector).text());
return date.toISOString();
};
var new_uv = {
product: {
accomodations: [{
type: "Hotel",
adults: $(".NumGuests").text(),
rooms: $(".DtlDetailTbl td:contains('Number of Rooms') + .ResConfirmValue").text(),
checkin_time: getISODateFor("Check-in"),
checkout_time: getISODateFor("Check-Out")
}]
},
transaction: {
order_id: $("#V29_C1_ird_RDR_ctl00_ConfirmNumberRow .ResConfirmValue").text(),
total: (function () {
var tot = $(".DtlPriceTbl td:contains('Total'):last + .ResConfirmValue").text(); // total
return tot.match(/(\d|\.)+/)[0];
})()
}
};
window.updateOpenTagState(new_uv);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment