Skip to content

Instantly share code, notes, and snippets.

@Walexander
Last active November 22, 2016 20:20
Show Gist options
  • Save Walexander/712dc82e6d97265f1249c3e1ff72eae8 to your computer and use it in GitHub Desktop.
Save Walexander/712dc82e6d97265f1249c3e1ff72eae8 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
(function() {
// Handle #OldIE versions which do not contain the `CustomEvent` API
var CustomEvent = typeof window.Event == 'function' ? window.CustomEvent : CustomEventPolyfill
// The event details can contain a `slot_list` property, a space-separated list
// of site/section@size slots to run an auction for. If this property is missing
// or the value is empty, the slots specified in the nucleus element itself are used
var slotList = {
slot_list: "testpub.com/ros@300x250 testpub.com/ros/btf@728x90"
}
// Create the custom event, assigning slot_list to the detail.data property
var event = new CustomEvent('rerunAuction', { detail: { data: slot_list } })
// We dispatch the event directly against the nucleus script element
var el = document.getElementById("cx/nuke")
el.dispatchEvent(event)
function CustomEventPolyFill(event, params) {
var evt = document.createEvent('CustomEvent')
evt.initCustomEvent(event, params['bubbles'], params['cancelable'], params['details'])
return evt
}
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment