Created
August 24, 2016 17:52
-
-
Save compwright/e022b76da6547f2770df2013fedc4649 to your computer and use it in GitHub Desktop.
ClickTripz Integration Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ctq = _ctq || []; | |
// Create 'compare to' strip object | |
_ctq.push(['newCompareToStrip', 'a']); | |
_ctq.push(['a.setPublisherID', 4]); | |
_ctq.push(['a.setAnchorID', 'ctAnchor']); | |
// Attach the correct API methods to our search form, this is a 'Hotel Citywide' search. | |
_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']); | |
// Add command to force a tabbed window to launch instead of individual advertiser pages. | |
_ctq.push(['a.optForceTabbedMode', 'true']); | |
// 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', 'true']); | |
_ctq.push(['a.optThumbSize', 'small']); | |
_ctq.push(['a.draw']); | |
(function() { | |
var ct = document.createElement('script'); | |
ct.type = 'text/javascript'; | |
ct.async = true; | |
ct.src = ('https:' == document.location.protocol ? 'https://' : 'http://') | |
+ 'static.clicktripz.com/scripts/js/ct.js'; | |
var s = document.getElementsByTagName('script')[0]; | |
s.parentNode.insertBefore(ct, s); | |
})(); | |
// Handler to sync search inputs and launch the ClickTripz Tabbed Window | |
$(function() { | |
var sourceForm = document.getElementById('hotelSmallSearchForm'), | |
ctForm = document.getElementById('ctSearchForm'); | |
function copyForm() { | |
$(ctForm.ctCity).val($(sourceForm.city).val()); | |
$(ctForm.ctDate1).val($(sourceForm.date1).val()); | |
$(ctForm.ctDate2).val($(sourceForm.date2).val()); | |
$(ctForm.ctGuests).val($(sourceForm.guests).val()); | |
$(ctForm.ctRooms).val($(sourceForm.rooms).val()); | |
} | |
// Load initial values | |
copyForm(); | |
// Track changes | |
$(sourceForm).find(':input').on('change', copyForm); | |
// Launch on submit | |
$(sourceForm).on('submit', function() { | |
_ctq.push(['a.processSubmit']); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment