Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _satellite.pushAsyncScript(function(event, target, $variables){
- // Include the questionnaire for first time visits: https://github.com/CondeNast/atp-oab-questionnaire
- function injectQuestionnaire() {
- "use strict";!function(e){function t(){var t=m[e.location.hostname]||m.base;return t}function o(){var t=e.createElement("div"),o=e.querySelector(d.target);t.id="atpContainer",o.parentNode.insertBefore(t,o.nextSibling),t.innerHTML=h,s()}function a(e){var t=e.target.parentElement.parentElement.children[0];return t.checked=!1,e.target.value.length&&(t.checked=!0),t.checked}function n(){e.querySelector("#atpContainer .modal").className="modal",e.querySelector("#atpContainer .jotform-form").style.display="none"}function i(){var t=e.querySelector("#atpContainer");t&&(window.jQuery?window.jQuery(t).slideUp(500):t.parentNode.removeChild(t))}function r(){for(var t=e.querySelectorAll("input[type=checkbox]"),o=t.length,a=0;o>a;a++)if(t[a].checked)return!0;return!1}function l(){return r()?n():c()}function c(){var t=e.querySelector(".error");t.className="form-line error"}function s(){var t,o=e.querySelector("#atpContainer .close"),n=e.querySelector("#atpContainer .form-submit-button"),r=e.querySelectorAll("#atpContainer .form-checkbox-other-input");e.getElementById("simple_spc").value=p.formId+"-"+p.formId,e.querySelector("#atpContainer .site").value=e.location.hostname;var c=r.length;for(t=0;c>t;t++)r[t].addEventListener("blur",a),r[t].addEventListener("keyup",a);o.addEventListener("click",i),n.addEventListener("click",l)}var p={header:"Ads support our content! We see that your Ad Blocker is on...",subHead:"Help us make your experience better!",formId:"52524722738155",q1:{title:"Why do you use an ad blocker?",id1:"q12_reason1[]",text1:"They're distracting.",id2:"q13_reason2[]",text2:"They slow down the site.",id3:"q14_reason3[]",text3:"I'm concerned about my privacy.",id4:"q20_reason4[]",text4:"They're not relevant to me.",id5:"q15_reasonOther",text5:"Anything Else?"},q2:{title:"Ads help us bring you content. But in place of ads, would you prefer to...",id1:"q16_payment1[]",text1:"Buy a monthly subscription?",id2:"q17_payment2[]",text2:"Make a micro-payment?",id3:"q18_payment3[]",text3:"Do a survey?",id4:"q21_payment4[]",text4:"Watch or interact with a lengthier one-time ad?",id5:"q19_paymentOther",text5:"Make a suggestion."}},m={"arstechnica.com":{headingFont:'"BebasNeue",sans-serif',textFont:"Arial,sans-serif",backgroundColor:"#e0ded7",fontColor:"#263034",brandColor:"#FF5B00",buttonTextcolor:"white",target:"#masthead, #mobile-masthead"},base:{headingFont:"Verdana, Geneva, sans-serif",textFont:"Arial, 'Helvetica Neue', Helvetica, sans-serif",backgroundColor:"gray",fontColor:"black",brandColor:"blue",buttonTextcolor:"white",target:"body > *:first-child"}},d=t(),b=" #atpContainer {padding: 10px; position: relative;font-size: 14px;background-color: "+d.backgroundColor+";font-family: "+d.textFont+";min-height: 263px;z-index: 10;}#atpContainer * {box-sizing: border-box;}#atpContainer form{ margin: 0; }#atpContainer .form-all {max-width: 700px;margin: 0 auto auto; text-align: center;min-width: 300px;}#atpContainer .form-checkbox {margin: 0; padding: 0;vertical-align: middle;}#atpContainer .form-checkbox-item {float: left; margin-top: 5px; }#atpContainer .form-single-column {display: inline-block; width: 50%;float: left; }#atpContainer .form-checkbox-item label {line-height: 1.714em;margin-left: 0;text-align: left;text-indent: 38px; float: left; color: "+d.fontColor+";font-weight: normal; }#atpContainer input[type=text] {line-height: 1.714em;text-indent: 10px; color: "+d.fontColor+";font-weight: normal; width: 282px }#atpContainer .form-header {margin: 0 30px 0 0; font-family: "+d.headingFont+";}#atpContainer .form-subHeader {font-style: italic;margin: 0; }#atpContainer .header-text {width: 100%; text-align: left;}#atpContainer .form-line {position: relative;display: inline-block; clear: both; margin: 0 20px 0 0;padding: 0;zoom: 1; width: 100%; }#atpContainer .form-checkbox-item {padding-bottom: 0.714em !important;}#atpContainer .form-checkbox-item:last-child {padding-bottom: 0; }.form-checkbox-item {box-sizing: border-box;width: 100%; max-width: 600px;}#atpContainer .form-single-column .form-checkbox-item {width: 100%; }#atpContainer .button {font-size: 1em;overflow: visible; width: auto; margin: 0; font-weight: normal; color: "+d.buttonTextcolor+";border: 0 solid; background: "+d.brandColor+";box-shadow: none;text-shadow: none; }#atpContainer .form-submit-button {width: 100px;padding: 9px 15px; }#atpContainer .close {padding: 2px 6px 6px;position: absolute;top: 10px; right: 10px; z-index: 10; }#atpContainer .form-header {font-size: 1.714em;line-height: 1.618em;}#atpContainer .form-subHeader {font-size: 1.071em;line-height: 1.5em;}#atpContainer .form-line::after {clear: both; }#atpContainer .form-header {color: "+d.fontColor+";}#atpContainer .form-subHeader {margin-bottom: 20px;}#atpContainer label {cursor: pointer; }#atpContainer .question {margin: 0;font-weight: bold;text-align: left;min-height: 2.5em;}#atpContainer .form-subHeader {color: "+d.fontColor+";}#atpContainer .form-checkbox-item {position: relative;margin-bottom: 0;}#atpContainer .form-checkbox-item label::before {position: absolute;left: 4px; content: '';cursor: pointer; border: 1px solid "+d.fontColor+";width: 24px; height: 24px;background-color: "+d.buttonTextcolor+";}#atpContainer .form-checkbox-item label::after {z-index: 10; top: 8px;left: 12px;width: 10px; height: 10px;content: '';opacity: 0;background-color: "+d.brandColor+";cursor: pointer; position: absolute;}#atpContainer .form-checkbox-item input:checked + label::after {opacity: 1;}#atpContainer .form-checkbox { opacity: 0;position: absolute;top: -9999px;left: -9999pxl;}#atpContainer .error p {color: red;line-height: 1;margin: 0 0 4px 0;}#atpContainer .form-textbox {background-color: "+d.buttonTextcolor+";width: 250px;padding: 4px;height: 32px;}#atpContainer .modal {transition: all .75s;width: 50%;height: 80px;overflow: auto;margin: auto;position: absolute;top: 0;left: 0;bottom: 0;right: 0;}#atpContainer .container {display: table-cell; text-align: center;margin-top: 100px;}#atpContainer .content {text-align: center; }#atpContainer .hide {display: none; }@media only screen and (max-width: 667px) {#atpContainer .form-single-column {width: 100%; float: none; }} ",h="<style>"+b+'</style><button class="button close">×</button><iframe class="hide" frameborder="0" id="thankyou" name="thankyou"></iframe><form accept-charset="utf-8" action="http://submit.jotformpro.com/submit/'+p.formId+'/" class="jotform-form" id="'+p.formId+' " method="post" name="form_'+p.formId+' " target="thankyou" novalidate="true"><div class="form-all"><div class="header-text"><h2 class="form-header">'+p.header+'</h2><p class="form-subHeader">'+p.subHead+'</p></div><div class="form-single-column"><p class="question">'+p.q1.title+'</p><span class="form-checkbox-item" ><input class="form-checkbox" id="q1a"name="'+p.q1.id1+'" type="checkbox" value="'+p.q1.text1+'"><label for="q1a">'+p.q1.text1+'</label></span><span class="form-checkbox-item" ><input class="form-checkbox" id="q1b" name="'+p.q1.id2+'" type="checkbox" value="'+p.q1.text2+'"><label for="q1b">'+p.q1.text2+'</label></span><span class="form-checkbox-item" ><input class="form-checkbox" id="q1c" name="'+p.q1.id3+'" type="checkbox" value="'+p.q1.text3+'"><label for="q1c">'+p.q1.text3+'</label></span><span class="form-checkbox-item" ><input class="form-checkbox" id="q1d" name="'+p.q1.id4+'" type="checkbox" value="'+p.q1.text4+'"><label for="q1d">'+p.q1.text4+'</label></span><span class="form-checkbox-item" ><input class="form-checkbox" id="q1e" type="checkbox" value="other"><label for="q1e"><textarea class="form-checkbox-other-input form-textbox" name="'+p.q1.id5+'" placeholder="'+p.q1.text5+'"></textarea></label></span></div><div class="form-single-column"><p class="question">'+p.q2.title+'</p><span class="form-checkbox-item"><input class="form-checkbox" id="q2a" name="'+p.q2.id1+'" type="checkbox" value="'+p.q2.text1+'"><label for="q2a">'+p.q2.text1+'</label></span><span class="form-checkbox-item" ><input class="form-checkbox" id="q2b" name="'+p.q2.id2+'" type="checkbox" value="'+p.q2.text2+'"><label for="q2b">'+p.q2.text2+'</label></span><span class="form-checkbox-item" ><input class="form-checkbox" id="q2c" name="'+p.q2.id3+'" type="checkbox" value="'+p.q2.text3+'"><label for="q2c">'+p.q2.text3+'</label></span><span class="form-checkbox-item" ><input class="form-checkbox" id="q2d" name="'+p.q2.id4+'" type="checkbox" value="'+p.q2.text4+'"><label for="q2d">'+p.q2.text4+'</label></span><span class="form-checkbox-item" ><input class="form-checkbox" id="q2e" type="checkbox" value="other"><label for="q2e"><textarea class="form-checkbox-other-input form-textbox" name="'+p.q2.id5+'" placeholder="'+p.q2.text5+'"></textarea></label></span></div><div class="form-line hide"><input type="hidden" name="formID" value="'+p.formId+'"><input type="hidden" class="site" form-textbox" id="input_8" name="q8_site" size="20" value=""><input type="text" name="website" type="text" value=""><input type="hidden" id="simple_spc" name="simple_spc" value="'+p.formId+'" /></div><div class="form-line error hide"><p>You must select at least one item.</p></div><div class="form-line"><button class="button form-submit-button" id="submit" type="submit">Submit</button></div> </div> </form><div class="modal hide"><div class="content"><h1>Thank you!</h1><p>Your submissions has been received.</p></div></div></div>';o()}(document);
- }
- /*!
- The MIT License (MIT)
- Copyright (c) 2015 FuckAdBlock
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
- /* globals jQuery */
- (function(window) {
- if (window.sniffAdBlock !== undefined) {
- return;
- }
- function SniffAdBlock(options) {
- var self = this;
- if (options !== undefined) {
- this.setOption(options);
- }
- function eventCallback() {
- setTimeout(function() {
- if (self._options.checkOnLoad === true) {
- if (self._var.bait === null) {
- self._creatBait();
- }
- setTimeout(function() {
- self.check();
- }, 1);
- }
- }, 1);
- };
- if (window.addEventListener) {
- window.addEventListener('load', eventCallback, false);
- } else {
- window.attachEvent('onload', eventCallback);
- }
- }
- SniffAdBlock.prototype._options = {
- checkOnLoad: true,
- resetOnEnd: true,
- loopCheckTime: 50,
- loopMaxNumber: 5,
- baitClass: 'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links',
- baitStyle: 'width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;'
- };
- SniffAdBlock.prototype._var = {
- version: '3.0.1',
- bait: null,
- checking: false,
- loop: null,
- loopNumber: 0,
- event: {
- detected: [],
- notDetected: []
- }
- };
- SniffAdBlock.prototype._bait = null;
- SniffAdBlock.prototype.setOption = function(options, value) {
- if (value !== undefined) {
- var key = options;
- options = {};
- options[key] = value;
- }
- for (var option in options) {
- if (options.hasOwnProperty(option)) {
- this._options[option] = options[option];
- }
- }
- return this;
- };
- SniffAdBlock.prototype._creatBait = function() {
- var bait = document.createElement('div');
- bait.setAttribute('class', this._options.baitClass);
- bait.setAttribute('style', this._options.baitStyle);
- this._var.bait = window.document.body.appendChild(bait);
- this._var.bait.offsetParent;
- this._var.bait.offsetHeight;
- this._var.bait.offsetLeft;
- this._var.bait.offsetTop;
- this._var.bait.offsetWidth;
- this._var.bait.clientHeight;
- this._var.bait.clientWidth;
- };
- SniffAdBlock.prototype._destroyBait = function() {
- window.document.body.removeChild(this._var.bait);
- this._var.bait = null;
- };
- SniffAdBlock.prototype.check = function(loop) {
- if (loop === undefined) {
- loop = true;
- }
- if (this._var.checking === true) {
- return false;
- }
- this._var.checking = true;
- if (this._var.bait === null) {
- this._creatBait();
- }
- var self = this;
- this._var.loopNumber = 0;
- if (loop === true) {
- this._var.loop = setInterval(function() {
- self._checkBait(loop);
- }, this._options.loopCheckTime);
- }
- this._checkBait(loop);
- return true;
- };
- SniffAdBlock.prototype._checkBait = function _checkBait(loop) {
- var detected = false;
- if (this._var.bait === null) {
- this._creatBait();
- }
- if (window.document.body.getAttribute('abp') !== null || this._var.bait
- .offsetParent === null || this._var.bait.offsetHeight === 0 || this._var
- .bait.offsetLeft === 0 || this._var.bait.offsetTop === 0 || this._var.bait
- .offsetWidth === 0 || this._var.bait.clientHeight === 0 || this._var.bait
- .clientWidth === 0) {
- detected = true;
- }
- if (window.getComputedStyle !== undefined) {
- var baitTemp = window.getComputedStyle(this._var.bait, null);
- if (baitTemp.getPropertyValue('display') === 'none' || baitTemp.getPropertyValue('visibility') === 'hidden') {
- detected = true;
- }
- }
- if (loop === true) {
- this._var.loopNumber++;
- if (this._var.loopNumber >= this._options.loopMaxNumber) {
- clearInterval(this._var.loop);
- this._var.loop = null;
- this._var.loopNumber = 0;
- }
- }
- if (detected === true) {
- if (loop === true) {
- this._var.checking = false;
- }
- this._destroyBait();
- this.emitEvent(true);
- } else if (this._var.loop === null || loop === false) {
- if (loop === true) {
- this._var.checking = false;
- }
- this._destroyBait();
- this.emitEvent(false);
- }
- };
- SniffAdBlock.prototype.emitEvent = function emitEvent(detected) {
- var fns = this._var.event[detected === true ? 'detected' : 'notDetected'];
- for (var i in fns) {
- if (fns.hasOwnProperty(i)) {
- fns[i]();
- }
- }
- if (this._options.resetOnEnd === true) {
- this.clearEvent();
- }
- return this;
- };
- SniffAdBlock.prototype.clearEvent = function clearEvent() {
- this._var.event.detected = [];
- this._var.event.notDetected = [];
- };
- SniffAdBlock.prototype.on = function on(detected, fn) {
- this._var.event[detected === true ? 'detected' : 'notDetected'].push(
- fn);
- return this;
- };
- SniffAdBlock.prototype.onDetected = function onDetected(fn) {
- return this.on(true, fn);
- };
- SniffAdBlock.prototype.onNotDetected = function onDetected(fn) {
- return this.on(false, fn);
- };
- window.sniffAdBlock = new SniffAdBlock();
- // Cookie setter and getter functions
- // We only want to count daily unique ad blocks
- // Taken from www.w3schools.com/js/js_cookies.asp
- function setCookie(cname, cvalue, exdays) {
- var d = new Date();
- d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
- var expires = 'expires=' + d.toUTCString();
- document.cookie = cname + '=' + cvalue + '; ' + expires + ';' + 'path=/';
- }
- /**
- * ## getCookie
- *
- *@param {String} cname The cookie to retrieve.
- *@returns {String} The value of the cookie or empty string.
- */
- function getCookie(cname) {
- var match = document.cookie.match('(^|;)\\s*' + cname + '\\s*=\\s*([^;]+)');
- return match ? match.pop() : '';
- }
- /**
- * ## browserCheck
- *
- *@returns {String} The simplified user agent.
- */
- function browserCheck() {
- var N = navigator.appName;
- var ua = navigator.userAgent;
- var tem = ua.match(/version\/([\.\d]+)/i);
- var M = ua.match(/(opera|chrome|safari|firefox|msie|trident)\/?\s*(\.?\d+(\.\d+)*)/i);
- if (M && tem !== null) {
- M[2] = tem[1];
- }
- M = M ? [M[1], M[2]] : [N, navigator.appVersion, '-?'];
- return M.toString();
- }
- /**
- * ## buildParams
- * build the parameters of the tracking pixel URL
- *
- *@param {String} blockString The string signifying if this pages blocked status and if it was a first view.
- *@returns {String} The simplified user agent.
- */
- function buildParams(blockString) {
- var params = {
- 'e0_id': document.location.host + '/' + blockString,
- 'e0_ec': 'adblock',
- 'e0_env': 'dart',
- 'e0_sc': getSiteCode(),
- 'e0_tit': browserCheck(),
- 'e0_url': document.location.href
- };
- return jQuery.param(params);
- }
- /**
- * ## getSiteCode
- * Get the correct 3 character site code.
- *
- *@returns {String} The 3 character site code for this site, or FIX so we know to fix it..
- */
- function getSiteCode() {
- var arr = [
- ['allure.com', 'alr'],
- ['architecturaldigest.com', 'arc'],
- ['arstechnica.com', 'ars'],
- ['bonappetit.com', 'bon'],
- ['brides.com', 'brd'],
- ['cntraveler.com', 'cnt'],
- ['details.com', 'dtl'],
- ['epicurious.com', 'epi'],
- ['glamour.com', 'gla'],
- ['golfdigest.com', 'glf'],
- ['gq.com', 'gq'],
- ['newyorker.com', 'tny'],
- ['self.com', 'slf'],
- ['style.com', 'stl'],
- ['teenvogue.com', 'tvg'],
- ['thescene.com', 'sn'],
- ['vanityfair.com', 'vfr'],
- ['vogue.com', 'vge'],
- ['wired.com', 'wrd'],
- ['wmagazine.com', 'wmg'],
- ['localhost', 'LOC'],
- ['.', 'FIX'],
- ['', 'FILE']
- ].filter(siteFind);
- return arr[0][1];
- }
- /**
- * ## filterSite
- * Used to filter the site array to a single matching site.
- *
- *@returns {Boolean} Do we have a match?
- */
- function siteFind(i) {
- var str = i[0];
- return document.location.hostname.indexOf(str) !== -1;
- }
- /**
- * ## track
- * build the parameters of the tracking pixel URL
- *
- *@param {String} blockString The string signifying if this pages blocked status and if it was a first view.
- *@returns {XHRF} A request for a tracking pixel.
- */
- function track(blockString) {
- jQuery.ajax({
- type: 'GET',
- url: '//event.condenastdigital.com/images/event.gif?' + buildParams(blockString),
- cache: false
- });
- }
- /**
- * ## trackETF
- * Setup the blocked status string and send a tracking request.
- *
- *@param {Boolean} blocked Is their an adBlocker?
- *@param {Boolean} newVisit Is this the first visit?
- *@returns {XHRF} A request for a tracking pixel.
- */
- function trackETF(blocked, newVisit) {
- var _blocked = 'blocked';
- var not = blocked ? '' : 'not_';
- var pageview = newVisit ? '' : '_pageview';
- var ext = /iPhone|iPad/i.test(navigator.userAgent) ? '/iOS' : '';
- _blocked = not + _blocked + pageview + ext;
- track(_blocked);
- }
- var newVisit;
- // Set a BlockerSniffer cookie to ensure that we only count 1 detection event per user per day
- var host = document.location.host.split('.');
- var blockerCookie = 'BlockerSniffer_' + host[host.length - 2];
- if (getCookie(blockerCookie).length) {
- newVisit = false;
- } else {
- setCookie(blockerCookie, 1, 1);
- newVisit = true;
- }
- // Apply SniffAdBlocker (must include SniffAdBlocker.js (https://github.com/veeracs/SniffAdBlock)
- // Adapted from http://wiki.conde-dev.com/pages/viewpage.action?pageId=20188075
- if (!sniffAdBlock) { // if the sniffer is blocked by AdBlock
- setCookie('AdHt', 1, 365);
- setCookie('__adblocker', 'true', 30);
- if (typeof _satellite !== 'undefined') {
- _satellite.track('adBlock');
- }
- if (newVisit) {
- trackETF(true, true);
- trackETF(true, false);
- //injectQuestionnaire();
- } else {
- trackETF(true, false);
- }
- } else {
- sniffAdBlock.onDetected(function() {
- setCookie('AdHt', 1, 365);
- setCookie('__adblocker', 'true', 30);
- document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
- if (typeof _satellite !== 'undefined') {
- _satellite.track('adBlock');
- }
- if (newVisit) {
- trackETF(true, true);
- trackETF(true, false);
- //injectQuestionnaire();
- } else {
- trackETF(true, false);
- }
- });
- sniffAdBlock.onNotDetected(function() {
- if (getCookie('AdCv') === '' && getCookie('AdHt') === '1') {
- window.optimizely = window.optimizely || [];
- window.optimizely.push(['trackEvent', 'blockerConversion']);
- setCookie('AdCv', 1, 365);
- }
- setCookie('__adblocker', 'false', 30);
- if (newVisit) {
- trackETF(false, true);
- trackETF(false, false);
- } else {
- trackETF(false, false);
- }
- });
- }
- // Optionally, invoke a manual check if the onDetected callback never fires
- setTimeout(function timer3() {
- sniffAdBlock.check();
- }, 10);
- })(window);
- });
Advertisement
Add Comment
Please, Sign In to add comment