Skip to content

Instantly share code, notes, and snippets.

@salsalabs
Created June 20, 2014 20:08
Show Gist options
  • Save salsalabs/b1b3b8add59b82e7d148 to your computer and use it in GitHub Desktop.
Save salsalabs/b1b3b8add59b82e7d148 to your computer and use it in GitHub Desktop.
Javascript for ticket #91172
<script type="text/javascript">
// SalsaStaff 91172 - set the designation code if this is the event checkout
// page for one of the seminar events.
//
$(document).ready(function() {
//
// Make a new line that is formatted exactly like this
//
// 'event_KEY': 'Designation_Code',
//
// for each seminar. Insert them at the *top* of this list, please!
//
var designationCodeMap = {
'1167': 'Testing event'
}
m = RegExp('checkout\\.sjs\\?event_KEY=(\\d+)').exec(window.location.href)
if (m != null) {
var eventKey = m[1];
console.log("The event key is " + eventKey);
var designationCode = designationCodeMap[eventKey];
console.log("The designation code is " + designationCode);
if (designationCode != null && typeof(designationCode) != 'undefined') {
$('*[name=event_KEY]').after('<input type="hidden" name="Designation_Code" value="' + designationCode + '">')
} else {
console.log("Error: event key '" + eventKey + "' does not map to a designation code!");
}
}
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment