An error has occurred

{{terminalError}}

WAIT! BEFORE YOU GO on about your day, ask yourself: How likely is it that the story you just read would have been produced by a different news outlet if The Intercept hadn’t done it? Consider what the world of media would look like without The Intercept. Who would hold party elites accountable to the values they proclaim to have? How many covert wars, miscarriages of justice, and dystopian technologies would remain hidden if our reporters weren’t on the beat? The kind of reporting we do is essential to democracy, but it is not easy, cheap, or profitable. The Intercept is an independent nonprofit news outlet. We don’t have ads, so we depend on our members to help us hold the powerful to account. Joining is simple and doesn’t need to cost a lot: You can become a sustaining member for as little as $3 or $5 a month. That’s all it takes to support the journalism you rely on.

We’re independent of corporate interests. Will you help us?
(function(src) { window.FLMPiano = window.FLMPiano || {}; window.FLMPiano.onLoad = function(handler) { window.FLMPiano.loadHandlers = window.FLMPiano.loadHandlers || []; window.FLMPiano.loadHandlers.push(handler); }; var script = document.createElement('script'); script.setAttribute('defer', ''); script.setAttribute('src', src); script.setAttribute('type', 'text/javascript'); document.head.appendChild(script); })('https://theintercept.com/wp-content/themes/intercept/js/flmpiano-v4.js'); (function(src) { window.TI = window.TI || {}; window.TI.onLoad = function(handler) { window.TI.loadHandlers = window.TI.loadHandlers || []; window.TI.loadHandlers.push(handler); }; var script = document.createElement('script'); script.setAttribute('data-ti-js', ''); script.setAttribute('defer', ''); script.setAttribute('src', src); script.setAttribute('type', 'text/javascript'); document.head.appendChild(script); })('https://theintercept.com/wp-content/themes/intercept/js/ti-external-v2.js'); $(function() { function parseAmount(input) { var amount; if (typeof input !== 'string' || input.length === 0) { return null; } amount = Number(input); if (isNaN(amount)) { console.error('Unable to parse amount: ' + JSON.stringify(input)); return null; } return amount; } function parseOptions(input, parseItem) { var options; if (typeof input !== 'string' || input.length === 0) { return null; } options = input .split(',') .map(function(option) { return option.trim(); }) .map(parseItem) .filter(function(item) { return item !== null; }); if (options.length === 0) { console.error('Unable to parse options: ' + JSON.stringify(input)); return null; } return options; } function parseRecurringPeriod(input) { if (typeof input !== 'string' || input.length === 0) { return null; } switch (input) { case 'one-time': return 'one-time'; case 'months': return 'months'; case 'years': return 'years'; default: console.error('Unable to parse recurring period: ' + JSON.stringify(input)); return null; } } // config var amountOptions = parseOptions('', parseAmount); var experiencePrefix = '2019_article_footer_donation_ask'; var realmSpeakingId = 'theintercept'; var source = 'web_intercept_20220321_article_longask-monthly'; var originatingReferrer, referrerPostId, referrerUrl; var initialRecurringPeriod = parseRecurringPeriod('months'); var recurringPeriodLabels = { 'one-time': 'One-time', 'months': 'Monthly', 'years': 'Yearly' }; var recurringPeriodOptions = parseOptions('one-time,months', parseRecurringPeriod); var amountFrequencyOrder = 'amount-frequency'; var initialMonthlyAmount = parseAmount('10'); var initialOneTimeAmount = parseAmount('25'); var monthlyAmountOptions = parseOptions('5,8,10,15', parseAmount); var oneTimeAmountOptions = parseOptions('15,25,50,100', parseAmount); var locale = 'en-US'; var initialAmount = (initialRecurringPeriod === 'months') ? initialMonthlyAmount : initialOneTimeAmount; var bodyElement = document.querySelector('body'); var $body = $(bodyElement); var htmlElement = document.querySelector('html'); var $html = $(htmlElement); var donateButton = document.getElementById('donate'); var formElement = document.getElementById('form'); var formFieldsContainer = document.getElementById('form-fields-container'); switch (realmSpeakingId) { case 'theintercept': currency = 'USD'; break; case 'theintercept-brasil': currency = 'BRL'; break; default: throw new Error(JSON.stringify(realmSpeakingId) + ' is not a valid realm speakingId'); } function handleDonateClick() { FLMPiano.dispatchEventToParent('experience:convert', { experiencePrefix: experiencePrefix }); FLMPiano.trackGAEvent({ eventLabel: 'end-of-article ask: click' }); piano.logConversion(realmSpeakingId, 'Donate Click', 1); var amountGroups = document.getElementsByClassName('amount-button-group') for (amountGroup of amountGroups) { if (amountGroup.classList.contains('selected')) { var selectedInput = amountGroup.querySelector('input[checked="checked"]'); updateDonateUrlParams({ amount: selectedInput.value }); } } } function handleLoad() { renderFormFields(); FLMPiano.setUpResponsiveContainer('#Piano', { onResize: handleParentResize }); donateButton.addEventListener('click', handleDonateClick); formElement.addEventListener('submit', handleDonateClick); FLMPiano.waitForParams({ requirements: { customVariables: true } }).then(function(params) { originatingReferrer = params.customVariables.originatingReferrer; referrerUrl = params.url; if (typeof params.customVariables.referrer_post_id === 'string') { referrerPostId = Number(params.customVariables.referrer_post_id); if (isNaN(referrerPostId)) { referrerPostId = undefined; } } updateDonateUrlParams({ amount: initialAmount, originating_referrer: originatingReferrer, recurring_period: initialRecurringPeriod, referrer_post_id: referrerPostId, referrer_url: referrerUrl, source: source }); if (params.preview) { $html.addClass('extraSmall'); $html.addClass('sized'); } $html.addClass('loaded'); }); TI.tracking.parsely.insert(); } function handleParentResize() { $html.addClass('sized'); } function renderGroupAmount(amount, amountOptions, groupLabel, recurringPeriod) { var amountGroup = FLMPiano.dom.renderElement('div', { className: 'button-group amount-button-group ' + groupLabel + (groupLabel === recurringPeriod ? ' selected' : ''), role: 'group', 'aria-label': 'Select donation amount' }); for (amountOption of amountOptions) { var amountInput = FLMPiano.dom.renderElement('input', { name: 'amount', type: 'radio', value: String(amountOption) }); var amountButton = FLMPiano.dom.renderElement( 'label', { className: 'button' }, amountInput, locale === 'pt-BR' ? 'R$ ' + String(amountOption) : '$' + String(amountOption) ); if (amount === amountOption) { amountInput.setAttribute('checked', 'checked'); amountButton.setAttribute('class', 'button selected'); } amountButton.addEventListener('click', function(event) { var amountButtons = amountGroup.querySelectorAll('.amount-button-group .button'); var selectedInput = event.target; var selectedAmount = Number(selectedInput.value); var amountButton, amountInput, index; for (index = 0; index < amountButtons.length; index ++) { amountButton = amountButtons.item(index); amountInput = amountButton.querySelector('input'); if (Number(amountInput.value) === selectedAmount) { amountInput.setAttribute('checked', 'checked'); amountButton.setAttribute('class', 'button selected'); updateDonateUrlParams({ amount: selectedAmount }); } else { amountInput.setAttribute('checked', undefined); amountButton.setAttribute('class', 'button'); } } }); amountGroup.appendChild(amountButton); } return amountGroup; } function renderRecurringPeriodsGroup(recurringPeriodsOptions) { var index; var recurringPeriodsGroup = FLMPiano.dom.renderElement('div', { className: 'button-group recurring-period-button-group', role: 'group', 'aria-label': 'Select recurring period' }); for (index = 0; index < recurringPeriodOptions.length; index ++) { var recurringPeriodInput = FLMPiano.dom.renderElement('input', { name: 'recurring_period', type: 'radio', value: recurringPeriodOptions[index] }); var recurringPeriodOption = recurringPeriodOptions[index] var recurringPeriodLabel = recurringPeriodLabels[recurringPeriodOption] if (locale === 'pt-BR') { if (recurringPeriodOption === 'one-time') { recurringPeriodLabel = 'Única' } if (recurringPeriodOption === 'months') { recurringPeriodLabel = 'Mensal' } } var recurringPeriodButton = FLMPiano.dom.renderElement( 'label', { className: 'button' }, recurringPeriodInput, recurringPeriodLabel ); if (initialRecurringPeriod === recurringPeriodOptions[index]) { recurringPeriodInput.setAttribute('checked', 'checked'); recurringPeriodButton.setAttribute('class', 'button selected'); } recurringPeriodButton.addEventListener('change', function(event) { var recurringPeriodButtons = recurringPeriodsGroup.querySelectorAll('.recurring-period-button-group .button'); var selectedInput = event.target; var selectedRecurringPeriod = selectedInput.value; var index, recurringPeriodButton, recurringPeriodInput, selectedAmount; var amountGroups = document.getElementsByClassName('amount-button-group'); for (amountGroup of amountGroups) { amountGroup.classList.remove('selected'); if (amountGroup.classList.contains(selectedInput.value)) { amountGroup.classList.add('selected'); selectedAmount = Number(amountGroup.querySelector('.button.selected input').value); } } for (index = 0; index < recurringPeriodButtons.length; index ++) { recurringPeriodButton = recurringPeriodButtons.item(index); recurringPeriodInput = recurringPeriodButton.querySelector('input'); if (recurringPeriodInput.value === selectedRecurringPeriod) { recurringPeriodInput.setAttribute('checked', 'checked'); recurringPeriodButton.setAttribute('class', 'button selected'); } else { recurringPeriodInput.setAttribute('checked', undefined); recurringPeriodButton.setAttribute('class', 'button'); } } updateDonateUrlParams({ amount: selectedAmount, recurring_period: selectedRecurringPeriod }); }); recurringPeriodsGroup.appendChild(recurringPeriodButton); } return recurringPeriodsGroup; } function renderFormFields() { if ( !initialOneTimeAmount || !oneTimeAmountOptions || !initialMonthlyAmount || !monthlyAmountOptions || !initialRecurringPeriod || !recurringPeriodOptions ) { return; } if (!oneTimeAmountOptions.indexOf(initialOneTimeAmount) < 0) { console.error('"' + initialOneTimeAmount + '" is not a valid one-time-amount-selection value, it must be included in the configured amount-options to work'); initialOneTimeAmount = null; return; } if (!monthlyAmountOptions.indexOf(initialMonthlyAmount) < 0) { console.error('"' + initialMonthlyAmount + '" is not a valid monthly-amount-selection value, it must be included in the configured amount-options to work'); initialMonthlyAmount = null; return; } if (recurringPeriodOptions.indexOf(initialRecurringPeriod) < 0) { console.error('"' + initialRecurringPeriod + '" is not a valid recurring-period-selection value, it must be included in the configured recurring-period-options to work'); initialRecurringPeriod = null; return; } var amountsGroup = FLMPiano.dom.renderElement('div', { className: 'amount-button-group-items' }); amountsGroup.appendChild(renderGroupAmount( initialOneTimeAmount, oneTimeAmountOptions, 'one-time', initialRecurringPeriod )); amountsGroup.appendChild(renderGroupAmount( initialMonthlyAmount, monthlyAmountOptions, 'months', initialRecurringPeriod )); var recurringPeriodsGroup = renderRecurringPeriodsGroup(recurringPeriodOptions); var amountFrequencyGroup = [ amountsGroup, recurringPeriodsGroup ]; if (amountFrequencyOrder === 'frequency-amount') { amountFrequencyGroup = [ recurringPeriodsGroup, amountsGroup ]; } FLMPiano.dom.appendChildrenToElement(formFieldsContainer, amountFrequencyGroup); } function updateDonateUrlParams(params) { var newUrl = FLMPiano.buildUrl(donateButton.href, params); donateButton.setAttribute('href', newUrl); formElement.setAttribute('action', newUrl); } FLMPiano.onLoad(function() { TI.onLoad(function() { handleLoad(); }); }); });