Skip to content

Instantly share code, notes, and snippets.

@dam13n
Created November 24, 2015 01:01
Show Gist options
  • Save dam13n/1488119b23b6e53159b3 to your computer and use it in GitHub Desktop.
Save dam13n/1488119b23b6e53159b3 to your computer and use it in GitHub Desktop.
var _ctq = _ctq || [];
// Create 'compare to' strip object
_ctq.push(['newCompareToStrip', 'a']);
_ctq.push(['a.setPublisherID', 4]);
_ctq.push(['a.setAnchorID', 'ctAnchor']);
_ctq.push(['a.setFormID', 'ctSearchForm']);
// TODO: Attach the correct API methods to our search form, this is a 'Hotel Citywide' search.
// Attach the "Compare To" object to elements of your HTML form.
_ctq.push(['a.setFormID', 'ctSearchForm']);
_ctq.push(['a.setCityNameID', 'ctCity']);
_ctq.push(['a.setCheckInID', 'ctDate1']);
_ctq.push(['a.setCheckOutID', 'ctDate2']);
_ctq.push(['a.setGuestsID', 'ctGuests']);
_ctq.push(['a.setRoomsID', 'ctRooms']);
_ctq.push(['a.setReferralURL', 'http://www.clicktripz.com/oneliner_applicant_test.php']);
_ctq.push(['a.optMaxChecked', 1]);
_ctq.push(['a.optMaxAdvertisers', 7]);
_ctq.push(['a.optMaxSearchesPerDay', 9999]);
_ctq.push(['a.optHardLimitSearchesPerSeconds', '9999:1']);
_ctq.push(['a.optForceTabbedMode', 'true']);
// TODO: Add command to force a tabbed window to launch instead of individual advertiser pages.
function myFunc() {
_ctq.push(['a.processSubmit']);
}
// TODO: Add command(s) to force tabbed window to launch as a popunder on IE/FF/Chrome and a popover on Safari
// _ctq.push(['a.optPopUnder', 'false']);
_ctq.push(['a.optThumbSize', 'small']);
_ctq.push(['a.draw']);
(function() {
var ct = document.createElement('script'); ct.type = 'text/javascript'; ct.async = true;
ct.src = '//static.clicktripz.com/scripts/js/ct.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ct, s);
})();
// TODO: Add handler to sync search inputs and launch the ClickTripz Tabbed Window
$( "#hotelSmallSearchForm" ).submit(function( event ) {
event.preventDefault();
$('#ctCity').val($('#city').val())
$('#ctDate1').val($('#date1').val())
$('#ctDate2').val($('#date2').val())
$('#ctGuests').val($('#guests').val())
$('#ctRooms').val($('#rooms').val())
myFunc();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment