Created
January 17, 2019 20:01
-
-
Save yongzhihuang/61dc84a7b906d91a1bf4515f94edf02e to your computer and use it in GitHub Desktop.
// source https://jsbin.com
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('https://www.newyorker.com/fonts/AdobeCaslonPro-Regular.woff2') format('woff2'), url('https://www.newyorker.com/fonts/AdobeCaslonPro-Regular.woff') format('woff'); | |
} | |
@font-face { | |
font-family: "Graphik Web"; | |
font-stretch: normal; | |
font-style: normal; | |
font-weight: 500; | |
src: url('https://www.newyorker.com/fonts/Graphik-Medium.eot'); | |
src: url('https://www.newyorker.com/fonts/Graphik-Medium.eot?#iefix') format('embedded-opentype'), url('https://www.newyorker.com/fonts/Graphik-Medium.woff2') format('woff2'), url('https://www.newyorker.com/fonts/Graphik-Medium.woff') format('woff'); | |
} | |
html, | |
body { | |
height: 100%; | |
width: 100%; | |
margin: 0; | |
padding: 0; | |
} | |
body { | |
background: #efb425; | |
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 { | |
width: 500px; | |
margin-top: 10px; | |
} | |
.wrapper { | |
min-width: 520px; | |
min-height: 640px; | |
} | |
.text-wrapper { | |
clear: both; | |
padding: 0 10px 10px; | |
} | |
.header { | |
font-size: 36px; | |
margin-top: 0; | |
margin-bottom: 0; | |
} | |
.subheader { | |
font-size: 24px; | |
margin-top: 10px; | |
margin-bottom: 25px; | |
} | |
.body { | |
font-size: 20px; | |
margin-bottom: 10px; | |
margin-top: 0; | |
} | |
.button, | |
.later, | |
.signUp { | |
font-family: "Graphik Web", "Helvetica Neue", Helvetica, Arial, sans-serif; | |
font-weight: 500; | |
font-size: 13px; | |
} | |
.button { | |
width: 380px; | |
border-radius: 2px; | |
background-color: #000; | |
display: inline-block; | |
color: #fff; | |
text-decoration: none; | |
padding: 18px 0; | |
margin-top: 18px; | |
} | |
.later { | |
color: #121212; | |
display: block; | |
cursor: pointer; | |
margin-top: 15px; | |
text-decoration: none; | |
} | |
.signUp a { | |
color: #121212; | |
} | |
.later:hover { | |
text-decoration: underline; | |
} | |
</style> | |
<div id="paywall"> | |
<div class="Paywall__barrier Paywall__show"> | |
<div class="Paywall__wall"> | |
<div class="Paywall__container"> | |
<button class="Paywall__close"><span class="Paywall__closeText">Close modal</span></button> | |
<div class="wrapper"> | |
<img src="%%FILE:PNG1%%" srcset="%%FILE:PNG1%% 1x, %%FILE:PNG2%% 2x" alt="Print + Digital – 12 weeks for $12."> | |
<div class="text-wrapper"> | |
<h1 class="header">You’ve read half</h1> | |
<h2 class="subheader">of your complimentary articles for the month.</h2> | |
<p class="body">Print + Digital – 12 weeks for $12.</p> | |
<p class="body">Plus a FREE New Yorker Tote.</p> | |
<a class="button" href="%%CLICK_URL_UNESC%%%%DEST_URL%%" target="_blank">Subscribe</a> | |
<a id="noThanks" class="later" href="#">Not today, thanks.</a> | |
<p class="signUp">Already have a login? <a id="signUp" href="#">Sign up</a></p> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script> | |
(function init(window, document) { | |
var paywall = document.getElementById('paywall'); | |
var noThanks = document.getElementById('noThanks'); | |
let signUp = document.getElementById('signUp'); | |
var paywallCloseButton = document.querySelector('.Paywall__close'); | |
// Analytics | |
try { | |
window.parent._satellite.track('barrierhalf'); | |
window.parent.digitalData.articleNumSession = 4; | |
} catch (e) { | |
console.error('Error in barrier ad tracking calls', e); | |
} | |
window.frameElement.style.height = '100%'; | |
window.frameElement.parentNode.style.height = '610px'; | |
// hide half barrier from within the iframe.... | |
noThanks.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`; | |
}); | |
// Close button listener | |
// hide half barrier from within the iframe.... | |
paywallCloseButton.addEventListener('click', function(e) { | |
e.preventDefault(); | |
if (paywall) { | |
paywall.parentNode.removeChild(paywall); | |
} | |
}); | |
})(window, document); | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment