Created
January 24, 2019 21:26
-
-
Save yongzhihuang/c9fc05e4e949dd4cd58f15d516e636a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
@font-face { | |
font-family: "Adobe Caslon"; | |
font-style: normal; | |
font-weight: normal; | |
src: url('/fonts/AdobeCaslonPro-Regular.woff2') format('woff2'), url('/fonts/AdobeCaslonPro-Regular.woff') format('woff'); | |
} | |
@font-face { | |
font-family: "Graphik Web"; | |
font-stretch: normal; | |
font-style: normal; | |
font-weight: 500; | |
src: url('/fonts/Graphik-Medium.eot'); | |
src: url('/fonts/Graphik-Medium.eot?#iefix') format('embedded-opentype'), url('/fonts/Graphik-Medium.woff2') format('woff2'), url('/fonts/Graphik-Medium.woff') format('woff'); | |
} | |
html, | |
body { | |
height: 100%; | |
width: 100%; | |
margin: 0; | |
padding: 0; | |
} | |
body { | |
text-align: center; | |
font-family: "Adobe Caslon", Georgia, "Times New Roman", Times, serif; | |
overflow: hidden; | |
} | |
h1, h2, h3, h4, h5, h6, time, div, p, span, a { | |
-webkit-font-smoothing: antialiased; | |
-moz-osx-font-smoothing: grayscale; | |
text-rendering: geometricPrecision; | |
} | |
h1, | |
h2 { | |
font-weight: normal; | |
} | |
img { | |
margin-top: 30px; | |
} | |
.wrapper { | |
width: 100%; | |
height: 100%; | |
padding: 20px; | |
box-sizing: border-box; | |
display: -webkit-box; | |
display: -ms-flexbox; | |
display: flex; | |
-webkit-box-orient: vertical; | |
-webkit-box-direction: normal; | |
-ms-flex-direction: column; | |
flex-direction: column; | |
-webkit-box-align: center; | |
-ms-flex-align: center; | |
align-items: center; | |
-webkit-box-pack: center; | |
-ms-flex-pack: center; | |
justify-content: center; | |
} | |
.header { | |
font-size: 32px; | |
padding-top: 5px; | |
margin-top: 10px; | |
margin-bottom: 0; | |
} | |
.white { | |
color: #fff; | |
} | |
.body, .sign-up { | |
font-size: 14px; | |
margin-bottom: 10px; | |
margin-top: 0; | |
line-height: 12px; | |
} | |
.body, | |
.button, | |
.sign-up { | |
font-family: "Graphik Web", "Helvetica Neue", Helvetica, Arial, sans-serif; | |
font-weight: 500; | |
} | |
.top { | |
margin-top: 20px; | |
margin-bottom: 15px; | |
width: 100%; | |
} | |
.bottom { | |
margin-bottom: 0; | |
position: relative; | |
left: 0; | |
width: 100%; | |
} | |
.button { | |
width: 80%; | |
border-radius: 2px; | |
background-color: #000; | |
display: inline-block; | |
color: #fff; | |
text-decoration: none; | |
padding: 14px 0; | |
margin-top: 18px; | |
font-size: 14px; | |
} | |
.sign-up { | |
padding-top: 20px; | |
} | |
.sign-up a { | |
color: #121212; | |
} | |
.barrier { | |
background: rgba(0,0,0,.6); | |
display: none; | |
height: 100%; | |
left: 0; | |
position: fixed; | |
top: 0; | |
width: 100%; | |
z-index: 9999999; | |
} | |
.wrapper { | |
width: 100%; | |
height: 100%; | |
padding: 20px; | |
box-sizing: border-box; | |
display: flex; | |
flex-direction: column; | |
align-items: center; | |
justify-content: start; | |
} | |
.show{ | |
display: block; | |
} | |
.wall { | |
background-color: #26baef; | |
/* display: -ms-flexbox; */ | |
display: flex; | |
/* -ms-flex-direction: column; */ | |
flex-direction: column; | |
height: 100%; | |
position: relative; | |
width: 100%; | |
} | |
.container { | |
flex: 1 1 100%; | |
width: 100%; | |
} | |
.close { | |
cursor: pointer; | |
height: 24px; | |
position: absolute; | |
width: 24px; | |
background: none; | |
border: none; | |
left: 20px; | |
top: 10px; | |
} | |
.close::before{ | |
background-color: #000; | |
content: ' '; | |
height: 24px; | |
left: 24px / 2; | |
position: absolute; | |
top: 0; | |
width: 1px; | |
transform: rotate(45deg); | |
} | |
.close::after{ | |
background-color: #000; | |
content: ' '; | |
height: 24px; | |
left: 24px / 2; | |
position: absolute; | |
top: 0; | |
width: 1px; | |
transform: rotate(-45deg); | |
} | |
.closeText { | |
border: 0; | |
clip: rect(0,0,0,0); | |
height: 1px; | |
margin: -1px; | |
overflow: hidden; | |
padding: 0; | |
position: absolute; | |
width: 1px; | |
line-height: 1.15; | |
font-size: 20px | |
} | |
#paywall { | |
display: none; | |
} | |
</style> | |
<div id="paywall"> | |
<div class="barrier show"> | |
<div class="wall"> | |
<div class="container"> | |
<button class="close"><span class="closeText">Close modal</span></button> | |
<div class="wrapper"> | |
<img src="https://tpc.googlesyndication.com/pagead/imgad?id=CICAgKC7lPOBNRABGAEyCCt2iSj9j1Ty" alt="Print + Digital – 12 weeks for $12."> | |
<!-- <img src="%%FILE:PNG1%%" srcset="%%FILE:PNG1%% 1x, %%FILE:PNG2%% 2x" alt="Print + Digital – 12 weeks for $12."> --> | |
<div class="top"> | |
<h1 class="header"><span class="white">You have read half</span> your complimentary articles for this month.</h1> | |
</div> | |
<div class="bottom"> | |
<p class="body">Print JS+ Digital—12 weeks for $12.</p> | |
<p class="body">Plus, get a free tote bag.</p> | |
<a class="button" href="%%CLICK_URL_UNESC%%%%DEST_URL%%" target="_blank">Subscribe</a> | |
<p class="sign-up">Already have a login? <a id="signUp" href="#">Sign up</a></p> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script> | |
(function init(window, document) { | |
window.onload = function () { | |
window.frameElement.style.cssText += 'height:100vw;width:100vw;min-height:200%'; | |
window.frameElement.parentNode.style.minWidth = ''; | |
window.frameElement.parentNode.parentNode.style.cssText += 'position:fixed;top:0;left:0;widht:100%;'; | |
window.frameElement.parentNode.parentNode.parentNode.style.overflow = 'visible'; | |
paywall.style.display = 'block'; | |
} | |
// Analytics | |
try { | |
window.top._satellite.track('barrierhalf'); | |
window.top.dataLayer.push({'event': 'barrier-half'}); | |
window.top.digitalData.articleNumSession = 4; | |
} catch (e) { | |
console.error('Error in barrier ad tracking calls', e); | |
} | |
let signUp = document.getElementById('signUp'); | |
let paywallCloseButton = document.querySelector('.close'); | |
// Close button listener | |
// hide half barrier from within the iframe.... | |
paywallCloseButton.addEventListener('click', function(e) { | |
e.preventDefault(); | |
if (paywall) { | |
paywall.parentNode.removeChild(paywall); | |
} | |
}); | |
// redirect the user to accounts passing the current url | |
signUp.addEventListener('click', function (e) { | |
window.top.location.href = (`https://account.newyorker.com/?retURL=${window.top.location.href}?reload=true`); | |
}); | |
})(window, document); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment