in view ads
by rdillman
HTML
<script src="http://content.everydayhealth.com/Assets/everydayhealth/js/jquery.extensions.js"></script>
<script src="http://content.everydayhealth.com/Assets/everydayhealth/js/jquery.cookie.js"></script>
<script src="http://content.everydayhealth.com/Assets/everydayhealth/js/jquery.cookie.js"></script>
<script src="http://content.everydayhealth.com/Assets/everydayhealth/js/eh.global.js?1.0.16"></script>
<script src="http://content.everydayhealth.com/Assets/everydayhealth/js/eh.settings.js?1.0.16"></script>
<script src="http://content.everydayhealth.com/Assets/everydayhealth/js/eh.utilities.js?1.0.16"></script>
<p>Due to the dart file living on a seperate server the file cannot access the parent.</p>
<div class="ad-container ad-banner">
<div id="adDiv" class="ad-placeholder"
title="ADVERTISEMENT"
data-AdSize="300x250"
data-pos="top"
data-tile="1">
</div>
</div>
CSS
/* ----------------------------
Ads (Adobe)
------------------------------- */
/* all */
.ad-placeholder {
font-size: 0;
line-height: 0;
}
.ad-placeholder div,
.ad-placeholder iframe {
margin: 0 auto;
}
/* ad labels */
.ad-placeholder:after {
position: relative;
display: block;
content: attr(title);
width: 100%;
bottom: -4px;
font-size: 10px;
color: #c1c1c1;
text-align: center;
line-height: 1;
white-space: nowrap;
}
.ad-content {
min-width: 300px;
}
/* banner (728x90, 970x90) */
.ad-banner {
min-height: 90px;
margin: 0 auto 5px;
padding: 10px 0;
text-align: center;
background: #f3f3f3;
border-bottom: 1px solid #dfdfdf;
}
.ad-banner:last-child {
margin-bottom: 10px;
background-color: transparent;
border: 0;
}
/* 1x1 ads*/
.ad-content.ad-collapse,
.ad-container.ad-collapse,
.ad-collapse .ad-placeholder{
height: 0 !important;
min-height: 0 !important;
margin: 0 !important;
padding:0 !important;
}
.ad-collapse .ad-placeholder:after {
content: '';
}
/* debug ad code */
.debugadcode {
margin: 0 0 5px;
border: 1px solid #090;
}
.debugadcode textarea {
width: 95%;
height: 75px;
margin: 0;
resize: none;
}
.debugadcode p {
margin: 0;
font-weight: bold;
color: #090;
text-align: center;
}
JavaScript
/**
* @file EH Dart - Dynamic Advertising, Reporting, and Targeting
* solution or DART using DoubleClick's api. <br>
* Created: 05/03/2013<br>
* Modified: 3/26/2014
* @version 1.0.16
* @requires eh.global.js
* @requires eh.settings.js
* @requires eh.utilities.js
* @requires jquery-1.9.1.min.js
* @requires jquery.cookie.js
*/
/**
* EH
* @namespace
* @type {object}
* @global
* @public
*/
var EH = window.EH || {};
/**
* Immediately-Invoked Function Expression.
*
* @function
* @param {object} $ - Global jQuery object.
* @param {object} w - Global window object.
*/
(function ($, w) {
// strict js
'use strict';
/**
* Creates an instance of DartConstructor.<br>
* Modified: 12/02/2013
*
* @constructor
* @param {string} target - Class name of ad container element.
* @author Richard Dillman <[email protected]>
*/
EH.DartConstructor = function (target) {
/**
* Initial values.
*
* @public
*/
this.$target = $(target);
this.prefix = 'EH Dart';
this.urlQuery = w.location.search;
this.messages = [];
this.log = {
info: this.urlQuery.search(/dartInfo/i),
groupCollapsed: this.urlQuery.search(/dartInfo/i),
groupEnd: this.urlQuery.search(/dartInfo/i),
msg: function (prop, msg) {
if (this[prop] !== -1) {
w.console[prop](msg);
}
}
};
};
/**
* Inheritable methods.
*
* @type {object}
*/
EH.DartConstructor.prototype = {
/**
* Initialization methods.<br>
* Modified: 11/12/2013
*
* @method init
* @param {object} data - The body attributes data array.
* @author Greg Deane <[email protected]>
* @public
*/
init: function (data) {
// Create the data array reference.
this.data = data;
...