Red Hat Summit logo Red Hat logo
  • May 10-11, 2022

  • Session catalog
  • Tracks
    • Automation
    • Cloud services
    • Culture & people
    • Developers
    • Digital transformation
    • Edge
    • Emerging technologies
    • Platforms
    • Security
  • Expo
    • Red Hat
    • Sponsors
    • View all
  • Lounge
    • A/V club
    • Fun & games
  • Log out Log out
Red Hat logo
/** * options: { * enableLogs: Boolean, * intervalFrequency: Number, * logIdentifier: String, * maxIterations: Number, * onSuccess: () => void, * successCheck: () => Boolean, * } */ function waitForX(options) { var log = function log() { if (options.enableLogs) console.log.apply(console, arguments) } var logSuffix = options.logIdentifier ? ' -- [' + options.logIdentifier + ']' : '' var intervalFrequency = options.intervalFrequency || 100 var maxIterations = options.maxIterations || 100 // Do 1 immediate check before the interval starts. if (options.successCheck()) { log('SUCCESS (immediate), no interval needed' + logSuffix) options.onSuccess() return; } log('every ' + intervalFrequency + 'ms, for ' + intervalFrequency * maxIterations + 'ms' + logSuffix) var iterations = 0 var waitTimer = window.setInterval(function () { if (options.successCheck.apply(options)) { log('SUCCESS, waited: ' + ((iterations + 1) * intervalFrequency) + 'ms (' + (iterations + 1) + ' iterations)' + logSuffix) options.onSuccess.apply(options) window.clearInterval(waitTimer); log('cleared interval' + logSuffix) } if (iterations >= maxIterations) { log('TIMED OUT' + logSuffix) // Safety net to ensure this interval won't run forever. window.clearInterval(waitTimer) log('cleared interval' + logSuffix) } iterations++ }, options.intervalFrequency) } var autocompleteScript = document.createElement('script') autocompleteScript.src = 'https://api.demandbase.com/autocomplete/widget.js' document.body.appendChild(autocompleteScript)
var DEMANDBASE_FORM_SCRIPT_ID = 'demandbaseFormScript' if (data.page === 'attendeeInfo') { waitForX({ intervalFrequency: 100, maxIterations: 150, onSuccess: function () { if (!document.querySelector('#' + DEMANDBASE_FORM_SCRIPT_ID)) { var formScript = document.createElement('script') formScript.src = 'https://events.rainfocus.com/pages/redhat/global/demandbaseform' formScript.id = DEMANDBASE_FORM_SCRIPT_ID document.body.appendChild(formScript) } else { // This is terrible, but it's the only way to re-initialize the autocomplete on a SPA. // Fortunately, it is an uncommon use case. window.Demandbase.CompanyAutocomplete.setup = false window.Demandbase.CompanyAutocomplete.initialized = false window.DemandbaseForm.formConnector.form = document.querySelector('#myDynamicForm') window.DemandbaseForm.formConnector.init() } }, successCheck: function () { return document.querySelector('#formAttendee-companyname'); }, }); }
// v2 var INTERVAL_DELAY = 100; var MAX_INTERVAL_ITERATIONS = 150; // 15s at 100ms intervals var FORM_ID = 'myDynamicForm'; var rfLocale = window.rfLocale || { lang: 'en', region: 'US' }; // Only set the initial NC value once. var initialNCValueSet = false //updated and verified based on IBM Optin Country list, Nov 2021 // opt-out means the checkbox is checked var countryOptInMap = { AF: { email: 'opt-out', }, AX: { email: 'opt-in', }, AL: { email: 'opt-in', }, DZ: { email: 'opt-in', }, AS: { email: 'opt-out', }, AD: { email: 'opt-in', }, AO: { email: 'opt-in', }, AR: { email: 'opt-in', }, AM: { email: 'opt-in', }, AU: { email: 'opt-in', }, AT: { email: 'opt-in', }, AZ: { email: 'opt-in', }, BH: { email: 'opt-out', }, BD: { email: 'opt-out', }, BY: { email: 'opt-in', }, BE: { email: 'opt-in', }, BZ: { email: 'opt-out', }, BJ: { email: 'opt-in', }, BT: { email: 'opt-out', }, BO: { email: 'opt-out', }, BA: { email: 'opt-in', }, BW: { email: 'opt-in', }, BV: { email: 'opt-in', }, BR: { email: 'opt-in', }, IO: { email: 'opt-in', }, BN: { email: 'opt-out', }, BG: { email: 'opt-in', }, BF: { email: 'opt-in', }, BI: { email: 'opt-in', }, KH: { email: 'opt-out', }, CM: { email: 'opt-in', }, CA: { email: 'opt-in', }, CV: { email: 'opt-in', }, CF: { email: 'opt-in', }, TD: { email: 'opt-in', }, CL: { email: 'opt-out', }, CN: { email: 'opt-in', }, CX: { email: 'opt-out', }, CC: { email: 'opt-out', }, CO: { email: 'opt-in', }, KM: { email: 'opt-in', }, CG: { email: 'opt-in', }, CD: { email: 'opt-in', }, CK: { email: 'opt-out', }, CR: { email: 'opt-out', }, HR: { email: 'opt-in', }, CY: { email: 'opt-in', }, CZ: { email: 'opt-in', }, DK: { email: 'opt-in', }, DJ: { email: 'opt-in', }, DO: { email: 'opt-out', }, EC: { email: 'opt-out', }, EG: { email: 'opt-out', }, SV: { email: 'opt-out', }, GQ: { email: 'opt-in', }, ER: { email: 'opt-in', }, EE: { email: 'opt-in', }, ET: { email: 'opt-out', }, FK: { email: 'opt-in', }, FO: { email: 'opt-in', }, FJ: { email: 'opt-out', }, FI: { email: 'opt-in', }, FR: { email: 'opt-in', }, GF: { email: 'opt-out', }, PF: { email: 'opt-in', }, TF: { email: 'opt-out', }, GA: { email: 'opt-in', }, GM: { email: 'opt-in', }, GE: { email: 'opt-in', }, DE: { email: 'opt-in', }, GH: { email: 'opt-in', }, GI: { email: 'opt-in', }, GR: { email: 'opt-in', }, GL: { email: 'opt-in', }, GP: { email: 'opt-out', }, GU: { email: 'opt-out', }, GT: { email: 'opt-out', }, GG: { email: 'opt-in', }, GN: { email: 'opt-in', }, GW: { email: 'opt-in', }, HT: { email: 'opt-out', }, HM: { email: 'opt-out', }, VA: { email: 'opt-in', }, HN: { email: 'opt-out', }, HK: { email: 'opt-out', }, HU: { email: 'opt-in', }, IS: { email: 'opt-in', }, IN: { email: 'opt-out', }, ID: { email: 'opt-in', }, IR: { email: 'opt-in', }, IQ: { email: 'opt-out', }, IE: { email: 'opt-in', }, IM: { email: 'opt-in', }, IL: { email: 'opt-in', }, IT: { email: 'opt-in', }, CI: { email: 'opt-out', }, JM: { email: 'opt-out', }, JP: { email: 'opt-in', }, JE: { email: 'opt-in', }, JO: { email: 'opt-out', }, KZ: { email: 'opt-in', }, KE: { email: 'opt-in', }, KI: { email: 'opt-out', }, KR: { email: 'opt-in', }, KW: { email: 'opt-out', }, KG: { email: 'opt-in', }, LA: { email: 'opt-out', }, LV: { email: 'opt-in', }, LB: { email: 'opt-out', }, LS: { email: 'opt-in', }, LR: { email: 'opt-in', }, LY: { email: 'opt-in', }, LI: { email: 'opt-in', }, LT: { email: 'opt-in', }, LU: { email: 'opt-in', }, MO: { email: 'opt-out', }, MK: { email: 'opt-in', }, MG: { email: 'opt-in', }, MW: { email: 'opt-in', }, MY: { email: 'opt-in', }, MV: { email: 'opt-out', }, ML: { email: 'opt-in', }, MT: { email: 'opt-in', }, MH: { email: 'opt-out', }, MQ: { email: 'opt-out', }, MR: { email: 'opt-in', }, MU: { email: 'opt-out', }, YT: { email: 'opt-in', }, MX: { email: 'opt-out', }, FM: { email: 'opt-out', }, MD: { email: 'opt-in', }, MC: { email: 'opt-out', }, MN: { email: 'opt-out', }, ME: { email: 'opt-in', }, MA: { email: 'opt-in', }, MZ: { email: 'opt-in', }, MM: { email: 'opt-out', }, NA: { email: 'opt-in', }, NR: { email: 'opt-out', }, NP: { email: 'opt-out', }, NL: { email: 'opt-in', }, NC: { email: 'opt-in', }, NZ: { email: 'opt-in', }, NI: { email: 'opt-out', }, NE: { email: 'opt-in', }, NG: { email: 'opt-in', }, NU: { email: 'opt-out', }, NF: { email: 'opt-out', }, MP: { email: 'opt-out', }, NO: { email: 'opt-in', }, OM: { email: 'opt-out', }, PK: { email: 'opt-in', }, PW: { email: 'opt-out', }, PS: { email: 'opt-out', }, PA: { email: 'opt-out', }, PG: { email: 'opt-out', }, PY: { email: 'opt-out', }, PE: { email: 'opt-in', }, PH: { email: 'opt-in', }, PN: { email: 'opt-in', }, PL: { email: 'opt-in', }, PT: { email: 'opt-in', }, PR: { email: 'opt-out', }, QA: { email: 'opt-in', }, RE: { email: 'opt-out', }, RO: { email: 'opt-in', }, RU: { email: 'opt-in', }, RW: { email: 'opt-in', }, ST: { email: 'opt-in', }, SH: { email: 'opt-in', }, LC: { email: 'opt-out', }, PM: { email: 'opt-out', }, WS: { email: 'opt-out', }, SM: { email: 'opt-in', }, SA: { email: 'opt-in', }, SN: { email: 'opt-in', }, RS: { email: 'opt-in', }, SC: { email: 'opt-in', }, SL: { email: 'opt-in', }, SG: { email: 'opt-in', }, SK: { email: 'opt-in', }, SI: { email: 'opt-in', }, SB: { email: 'opt-out', }, SO: { email: 'opt-in', }, ZA: { email: 'opt-in', }, GS: { email: 'opt-in', }, ES: { email: 'opt-in', }, LK: { email: 'opt-out', }, SJ: { email: 'opt-in', }, SZ: { email: 'opt-in', }, SE: { email: 'opt-in', }, CH: { email: 'opt-in', }, TW: { email: 'opt-out', }, TJ: { email: 'opt-in', }, TZ: { email: 'opt-out', }, TH: { email: 'opt-in', }, TL: { email: 'opt-out', }, TG: { email: 'opt-in', }, TK: { email: 'opt-out', }, TO: { email: 'opt-out', }, TN: { email: 'opt-in', }, TR: { email: 'opt-in', }, TM: { email: 'opt-in', }, TV: { email: 'opt-out', }, UG: { email: 'opt-in', }, UA: { email: 'opt-in', }, AE: { email: 'opt-out', }, GB: { email: 'opt-in', }, US: { email: 'opt-out', }, UY: { email: 'opt-out', }, UZ: { email: 'opt-in', }, VU: { email: 'opt-in', }, VE: { email: 'opt-out', }, VN: { email: 'opt-in', }, VI: { email: 'opt-out', }, WF: { email: 'opt-in', }, EH: { email: 'opt-in', }, YE: { email: 'opt-out', }, ZM: { email: 'opt-in', }, ZW: { email: 'opt-in', }, }; function setCheckbox(box, value) { if ((box.checked && !value) || (!box.checked && value)) box.click() } function applyNoticeChoice(e) { var selectedCountry = e.target.value; var notifyMeBox = document.getElementById('1603837935923001pcr7'); var doNotNotifyMeBox = document.getElementById('1603837935923002p7c8'); var countryDefaults = countryOptInMap[selectedCountry] || { email: '', phone: '', }; //opt-in means do not contact me is chosen by default. opt-out means you can contact me is chosen by default setTimeout(function () { switch (countryDefaults.email) { case 'opt-in': setCheckbox(notifyMeBox, false); setCheckbox(doNotNotifyMeBox, true); break; case 'opt-out': setCheckbox(notifyMeBox, true); setCheckbox(doNotNotifyMeBox, false); break; } }) } /** * options: { * enableLogs: Boolean, * intervalFrequency: Number, * logIdentifier: String, * maxIterations: Number, * onSuccess: () => void, * successCheck: () => Boolean, * } */ function waitForX(options) { var log = function log() { if (options.enableLogs) console.log.apply(console, arguments) } var logSuffix = options.logIdentifier ? ' -- [' + options.logIdentifier + ']' : '' var intervalFrequency = options.intervalFrequency || 100 var maxIterations = options.maxIterations || 100 // Do 1 immediate check before the interval starts. if (options.successCheck()) { log('SUCCESS (immediate), no interval needed' + logSuffix) options.onSuccess() return; } log('every ' + intervalFrequency + 'ms, for ' + intervalFrequency * maxIterations + 'ms' + logSuffix) var iterations = 0 var waitTimer = window.setInterval(function () { if (options.successCheck.apply(options)) { log('SUCCESS, waited: ' + ((iterations + 1) * intervalFrequency) + 'ms (' + (iterations + 1) + ' iterations)' + logSuffix) options.onSuccess.apply(options) window.clearInterval(waitTimer); log('cleared interval' + logSuffix) } if (iterations >= maxIterations) { log('TIMED OUT' + logSuffix) // Safety net to ensure this interval won't run forever. window.clearInterval(waitTimer) log('cleared interval' + logSuffix) } iterations++ }, options.intervalFrequency) } //Script Created/modified by Robbie D 2-FEB-22 //Opt-in list modified by Joshua Wright 4-FEB-2022
if (data.page !== null) { //Modified so this will run for all places in which the Global Opt-In attribute will run. //(data.page === 'contactInfo' || data.page === 'createaccount' || data.page === 'attendeeInfo' ||data.page ==='attendeepage2') { waitForX({ intervalFrequency: INTERVAL_DELAY, maxIterations: MAX_INTERVAL_ITERATIONS, onSuccess: function () { var countrySelectBox = document.querySelector('#formAttendee-countryId'); if (countrySelectBox) { if (!initialNCValueSet) { initialNCValueSet = true applyNoticeChoice({ target: countrySelectBox }) } countrySelectBox.addEventListener('change', applyNoticeChoice); } }, successCheck: function () { return document.querySelector('#' + FORM_ID); }, }); }
Red Hat Summit
  • Home
  • Session catalog
  • Terms and conditions
  • Code of behavior
Tracks
  • Automation
  • Cloud services
  • Culture & people
  • Developers
  • Digital transformation
  • Edge
  • Emerging technologies
  • Platforms
  • Security
Expo
  • Red Hat
  • Sponsors
  • View all
Lounge
  • A/V club
  • Fun & games
Red Hat Summit

Red Hat Summit is the premier enterprise open source event for IT professionals to learn, collaborate, and innovate on technologies from the datacenter and public cloud to the edge and beyond.

  • Follow
Copyright ©2022 Red Hat, Inc.
  • Privacy statement
  • Terms of use
  • All policies and guidelines
  • |
Red Hat Summit