Advertisement

Proud Boys

Latest Stories





















© Copyright 2022 The Washington Times, LLC
3600 New York Avenue NE, Washington, DC 20002

Switch to Desktop version

function pianoReadCustomVariableCookie(specificName) { var cookieValue; try { // Try to get the cookie value with regexp var match = document.cookie.match(new RegExp('(^| )__pcvc=([^;]+)')); if (match) { // If cookie with this name was found - try to parse the JSON value cookieValue = JSON.parse(match[2]); } } catch (e) { // By default - set value as empty object cookieValue = {}; } if (!cookieValue) { // By default - set value as empty object cookieValue = {}; } if (typeof specificName != "undefined") { // Get the specific value from the set if (typeof cookieValue[specificName] != "undefined") { return cookieValue[specificName]; } return null; } return cookieValue; } function pianoSetCustomVariableCookie(name, value) { // Get all existing values from the cookie var cookieValue = pianoReadCustomVariableCookie(); // Set the value cookieValue[name] = value; // Get cookie expiration date in 3 years var d = new Date(); d.setTime(d.getTime() + (94608000000)); var expires = "expires=" + d.toUTCString(); // Write the cookie value document.cookie = "__pcvc=" + JSON.stringify(cookieValue) + ";" + expires + ";path=/"; tp.push(["setCustomVariable", name, value]); } function showPianoLogin() { tp = window.tp || []; tp.push(["init", function () { tp.pianoId.show({ screen: 'login', loggedIn: function (data) { console.log('user ', data.user, ' logged in with token', data.token); //hide Subscribe button var name = tp.pianoId.getUser().given_name; if (!name) { name = "Account"; } $('#piano-login').html('' + name + ''); $('.leftSignin').hide(); $('.leftWelcome').css('display', 'table-cell'); $('#anonUserMenu').removeClass('dropdown-content').css('display', 'none'); $('#memberMenu').addClass('dropdown-content').removeAttr('style'); $('.rightSignin').removeClass('rightSignin').addClass('accountButton'); $('#nav_root_subscribe').css('display', 'none'); $('#nav_root_signin a').text(name); $('#nav_root_signin').css('display', 'inline-block').css('margin-left', '10px'); // set Piano presence cookie, for use by ads exclusion var d = new Date(); d.setTime(d.getTime() + 60 * 60 * 24 * 30 * 1000); document.cookie = "onaip_=; expires=" + d.toUTCString() + "; path=/"; } }); $('.tp-modal').css('z-index', '2000000000'); }]); } function pianoLogout() { console.log('logout'); tp = window.tp || []; tp.pianoId.logout(function () { $('#memberMenu').css('display', 'none'); $('#anonUserMenu').addClass('dropdown-content').removeAttr('style'); $('#memberMenu').removeClass('dropdown-content').css('display', 'none'); $('#piano-login').html('Sign In'); $('.leftSignin').show(); $('.leftWelcome').hide(); $('.accountButton').removeClass('accountButton').addClass('rightSignin'); //unset Piano presence cookie document.cookie = "onaip_=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;" }); } //set initial user account state tp = window.tp || []; _cbq = window._cbq = (window._cbq || []); tp.push(["init", function() { if (tp.pianoId.isUserValid()) { var name = tp.pianoId.getUser().given_name; if (!name) { name = "Account"; } $('#piano-login').html('' + name + ''); //hide Subscribe button $('.leftSignin').hide(); $('.leftWelcome').css('display', 'table-cell'); $('.rightSignin').removeClass('rightSignin').addClass('accountButton'); $('#anonUserMenu').removeClass('dropdown-content').css('display', 'none'); $('#memberMenu').addClass('dropdown-content').removeAttr('style'); // set Piano presence cookie, for use by ads exclusion var d = new Date(); d.setTime(d.getTime() + 60 * 60 * 24 * 30 * 1000); document.cookie = "onaip_=; expires=" + d.toUTCString() + "; path=/"; tp.api.callApi('/access/check', { rid: "RV0Z0NV" }, function (response) { var hasAccess = response.access.granted; // From here we can send either a user or subscriber level to Chartbeat if (hasAccess) { _cbq.push(['_acct', 'paid']); } else { _cbq.push(['_acct', 'lgdin']); } }); } else { $('#anonUserMenu').addClass('dropdown-content').removeAttr('style'); $('#memberMenu').removeClass('dropdown-content').css('display', 'none'); _cbq.push(['_acct', 'anon']); } }]); //newsletter signup handler tp.push(["addHandler", "customEvent", function(event, b, c, d) { switch (event.eventName) { case 'submit': var email = ''; var boomtrain_id = ''; var newsletter_source = ''; if ((typeof event.params.email != 'undefined') && (event.params.email.length > 0)) { email = event.params.email; } if ((typeof event.params.boomtrain != 'undefined') && (event.params.boomtrain.length > 0)) { boomtrain_id = event.params.boomtrain; } if ((typeof event.params.newsletterSource != 'undefined') && (event.params.newsletterSource.length > 0)) { newsletter_source = event.params.newsletterSource; } var data = { email: email, newsletter_source: newsletter_source }; data[boomtrain_id] = 'on'; $.post('/newsletters/boomtrain/subscribe/', data, function(){ // If the email was added successfully set a cookie for Composer tracking. pianoSetCustomVariableCookie(boomtrain_id, 'true'); tp.push(["setCustomVariable", boomtrain_id, "true"]); //We can close the offer now. (Commented out per Piano's request) // tp.offer.close(); }); break; } }]); // Read all values from cookie var cookieValues = pianoReadCustomVariableCookie(); for (var i in cookieValues) { // Set custom variables from cookie tp.push(['setCustomVariable', i, cookieValues[i]]); } tp.push(["addHandler", "checkoutComplete", function(conversion){ var checkoutPixel = document.createElement("img"); checkoutPixel.src = "https://r.turn.com/r/beacon?b2=IUyCvJTSsOG4y6AIMUOFZhfOHusEkTIx_oTF_HtdfM5VPVedEV-mju3OcbMMcMNBXl-ulRU5bjHDPnr8dCYv8g&cid="; document.body.append(checkoutPixel); }]);