/* Minification failed. Returning unminified contents.
(1855,15-16): run-time error JS1010: Expected identifier: .
(1855,15-16): run-time error JS1195: Expected expression: .
(2604,19-20): run-time error JS1010: Expected identifier: .
(2604,19-20): run-time error JS1195: Expected expression: .
(5125,13-14): run-time error JS1010: Expected identifier: .
(5125,13-14): run-time error JS1195: Expected expression: .
*/
(function () {
'use strict';
/*! LAB.js (LABjs :: Loading And Blocking JavaScript)
v2.0.3 (c) Kyle Simpson
MIT License
*/
(function (o) {
var K = o.$LAB,
y = "UseLocalXHR",
z = "AlwaysPreserveOrder",
u = "AllowDuplicates",
A = "CacheBust",
B = "BasePath",
C = /^[^?#]*\//.exec(location.href)[0],
D = /^\w+\:\/\/\/?[^\/]+/.exec(C)[0],
i = document.head || document.getElementsByTagName("head"),
L = o.opera && Object.prototype.toString.call(o.opera) == "[object Opera]" || "MozAppearance" in document.documentElement.style,
q = document.createElement("script"),
E = typeof q.preload == "boolean",
r = E || q.readyState && q.readyState == "uninitialized",
F = !r && q.async === true,
M = !r && !F && !L;function G(a) {
return Object.prototype.toString.call(a) == "[object Function]";
}function H(a) {
return Object.prototype.toString.call(a) == "[object Array]";
}function N(a, c) {
var b = /^\w+\:\/\//;if (/^\/\/\/?/.test(a)) {
a = location.protocol + a;
} else if (!b.test(a) && a.charAt(0) != "/") {
a = (c || "") + a;
}return b.test(a) ? a : (a.charAt(0) == "/" ? D : C) + a;
}function s(a, c) {
for (var b in a) {
if (a.hasOwnProperty(b)) {
c[b] = a[b];
}
}return c;
}function O(a) {
var c = false;for (var b = 0; b < a.scripts.length; b++) {
if (a.scripts[b].ready && a.scripts[b].exec_trigger) {
c = true;a.scripts[b].exec_trigger();a.scripts[b].exec_trigger = null;
}
}return c;
}function t(a, c, b, d) {
a.onload = a.onreadystatechange = function () {
if (a.readyState && a.readyState != "complete" && a.readyState != "loaded" || c[b]) return;a.onload = a.onreadystatechange = null;d();
};
}function I(a) {
a.ready = a.finished = true;for (var c = 0; c < a.finished_listeners.length; c++) {
a.finished_listeners[c]();
}a.ready_listeners = [];a.finished_listeners = [];
}function P(d, f, e, g, h) {
setTimeout(function () {
var a,
c = f.real_src,
b;if ("item" in i) {
if (!i[0]) {
setTimeout(arguments.callee, 25);return;
}i = i[0];
}a = document.createElement("script");if (f.type) a.type = f.type;if (f.charset) a.charset = f.charset;if (h) {
if (r) {
e.elem = a;if (E) {
a.preload = true;a.onpreload = g;
} else {
a.onreadystatechange = function () {
if (a.readyState == "loaded") g();
};
}a.src = c;
} else if (h && c.indexOf(D) == 0 && d[y]) {
b = new XMLHttpRequest();b.onreadystatechange = function () {
if (b.readyState == 4) {
b.onreadystatechange = function () {};e.text = b.responseText + "\n//@ sourceURL=" + c;g();
}
};b.open("GET", c);b.send();
} else {
a.type = "text/cache-script";t(a, e, "ready", function () {
i.removeChild(a);g();
});a.src = c;i.insertBefore(a, i.firstChild);
}
} else if (F) {
a.async = false;t(a, e, "finished", g);a.src = c;i.insertBefore(a, i.firstChild);
} else {
t(a, e, "finished", g);a.src = c;i.insertBefore(a, i.firstChild);
}
}, 0);
}function J() {
var l = {},
Q = r || M,
n = [],
p = {},
m;l[y] = true;l[z] = false;l[u] = false;l[A] = false;l[B] = "";function R(a, c, b) {
var d;function f() {
if (d != null) {
d = null;I(b);
}
}if (p[c.src].finished) return;if (!a[u]) p[c.src].finished = true;d = b.elem || document.createElement("script");if (c.type) d.type = c.type;if (c.charset) d.charset = c.charset;t(d, b, "finished", f);if (b.elem) {
b.elem = null;
} else if (b.text) {
d.onload = d.onreadystatechange = null;d.text = b.text;
} else {
d.src = c.real_src;
}i.insertBefore(d, i.firstChild);if (b.text) {
f();
}
}function S(c, b, d, f) {
var e,
g,
h = function h() {
b.ready_cb(b, function () {
R(c, b, e);
});
},
j = function j() {
b.finished_cb(b, d);
};b.src = N(b.src, c[B]);b.real_src = b.src + (c[A] ? (/\?.*$/.test(b.src) ? "&_" : "?_") + ~~(Math.random() * 1E9) + "=" : "");if (!p[b.src]) p[b.src] = { items: [], finished: false };g = p[b.src].items;if (c[u] || g.length == 0) {
e = g[g.length] = { ready: false, finished: false, ready_listeners: [h], finished_listeners: [j] };P(c, b, e, f ? function () {
e.ready = true;for (var a = 0; a < e.ready_listeners.length; a++) {
e.ready_listeners[a]();
}e.ready_listeners = [];
} : function () {
I(e);
}, f);
} else {
e = g[0];if (e.finished) {
j();
} else {
e.finished_listeners.push(j);
}
}
}function v() {
var e,
g = s(l, {}),
h = [],
j = 0,
w = false,
k;function T(a, c) {
a.ready = true;a.exec_trigger = c;x();
}function U(a, c) {
a.ready = a.finished = true;a.exec_trigger = null;for (var b = 0; b < c.scripts.length; b++) {
if (!c.scripts[b].finished) return;
}c.finished = true;x();
}function x() {
while (j < h.length) {
if (G(h[j])) {
try {
h[j++]();
} catch (err) {}continue;
} else if (!h[j].finished) {
if (O(h[j])) continue;break;
}j++;
}if (j == h.length) {
w = false;k = false;
}
}function V() {
if (!k || !k.scripts) {
h.push(k = { scripts: [], finished: true });
}
}e = { script: function script() {
for (var f = 0; f < arguments.length; f++) {
(function (a, c) {
var b;if (!H(a)) {
c = [a];
}for (var d = 0; d < c.length; d++) {
V();a = c[d];if (G(a)) a = a();if (!a) continue;if (H(a)) {
b = [].slice.call(a);b.unshift(d, 1);[].splice.apply(c, b);d--;continue;
}if (typeof a == "string") a = { src: a };a = s(a, { ready: false, ready_cb: T, finished: false, finished_cb: U });k.finished = false;k.scripts.push(a);S(g, a, k, Q && w);w = true;if (g[z]) e.wait();
}
})(arguments[f], arguments[f]);
}return e;
}, wait: function wait() {
if (arguments.length > 0) {
for (var a = 0; a < arguments.length; a++) {
h.push(arguments[a]);
}k = h[h.length - 1];
} else k = false;x();return e;
} };return { script: e.script, wait: e.wait, setOptions: function setOptions(a) {
s(a, g);return e;
} };
}m = { setGlobalDefaults: function setGlobalDefaults(a) {
s(a, l);return m;
}, setOptions: function setOptions() {
return v().setOptions.apply(null, arguments);
}, script: function script() {
return v().script.apply(null, arguments);
}, wait: function wait() {
return v().wait.apply(null, arguments);
}, queueScript: function queueScript() {
n[n.length] = { type: "script", args: [].slice.call(arguments) };return m;
}, queueWait: function queueWait() {
n[n.length] = { type: "wait", args: [].slice.call(arguments) };return m;
}, runQueue: function runQueue() {
var a = m,
c = n.length,
b = c,
d;for (; --b >= 0;) {
d = n.shift();a = a[d.type].apply(null, d.args);
}return a;
}, noConflict: function noConflict() {
o.$LAB = K;return m;
}, sandbox: function sandbox() {
return J();
} };return m;
}o.$LAB = J();(function (a, c, _b) {
if (document.readyState == null && document[a]) {
document.readyState = "loading";document[a](c, _b = function b() {
document.removeEventListener(c, _b, false);document.readyState = "complete";
}, false);
}
})("addEventListener", "DOMContentLoaded");
})(window);
// Set default LABjs options
window.$LAB.setGlobalDefaults({ AllowDuplicates: false });
/** Utils
* A collection of utility functions.
*/
// Triggers a custom event on the given element.
function emit(el, eventName) {
var event = document.createEvent('Event');
event.initEvent(eventName, true, true);
el.dispatchEvent(event);
}
// Creates and sends an XMLHttpRequest; requires an options object be passed which may include:
// - url (required)
// - method
// - params
// - success
// - error
function ajax(options) {
var opts = Object.assign({
method: 'GET',
params: {}
}, options);
opts.method = opts.method.toUpperCase();
if (opts.method === 'GET') {
// Build query string
var queryString = Object.keys(opts.params).map(function (key) {
return key + '=' + opts.params[key];
}).join('&');
opts.url += '?' + queryString;
}
var request = new XMLHttpRequest();
request.open(opts.method, opts.url, true);
if (opts.success && typeof opts.success === 'function') {
request.addEventListener('load', function () {
if (request.status >= 200 && request.status < 400) {
opts.success(request.responseText);
} else if (opts.error && typeof opts.error === 'function') {
opts.error();
}
});
}
if (opts.error && typeof opts.error === 'function') {
request.addEventListener('error', opts.error);
}
if (opts.contentType) {
request.setRequestHeader('Content-Type', opts.contentType);
}
if (opts.method === 'POST') {
if (!opts.contentType) {
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
}
request.send(opts.params);
} else {
request.send();
}
}
// Find closest ancestor of an element that matches the given selector
function findAncestor(el, selector) {
// eslint-disable-next-line
while ((el = el.parentElement) && !el.matches(selector)) {}
return el;
}
// Loads a stylesheet given a URL
function loadCSS(url) {
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = url;
document.head.appendChild(link);
}
// https://davidwalsh.name/javascript-debounce-function
function debounce(fn, wait, immediate) {
var _this = this;
var timeout = void 0;
return function () {
var context = _this;
var args = [fn, wait, immediate];
var later = function later() {
timeout = null;
if (!immediate) fn.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) fn.apply(context, args);
};
}
function queryAll(node, selector) {
var result = void 0;
if (selector.length && selector[0] === '>') {
var uniqueClass = 'qa-' + Date.now();
node.classList.add(uniqueClass);
result = document.querySelectorAll('.' + uniqueClass + ' ' + selector);
node.classList.remove(uniqueClass);
} else {
result = node.querySelectorAll(selector);
}
return Array.prototype.slice.call(result);
}
function focusOnce(el) {
el.setAttribute('tabindex', -1);
el.focus();
el.addEventListener('blur', function () {
el.removeAttribute('tabindex');
});
}
var easings = {
/* eslint-disable */
linear: function linear(t, b, c, d) {
return c * t / d + b;
},
easeInOutQuad: function easeInOutQuad(t, b, c, d) {
t /= d / 2;
if (t < 1) return c / 2 * t * t + b;
t--;
return -c / 2 * (t * (t - 2) - 1) + b;
},
easeInOutCubic: function easeInOutCubic(t, b, c, d) {
t /= d / 2;
if (t < 1) return c / 2 * t * t * t + b;
t -= 2;
return c / 2 * (t * t * t + 2) + b;
}
/* eslint-enable */
};
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var blazy = createCommonjsModule(function (module, exports) {
(function(root, blazy) {
{
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = blazy();
}
})(commonjsGlobal, function() {
//private vars
var _source, _viewport, _isRetina, _supportClosest, _attrSrc = 'src', _attrSrcset = 'srcset';
// constructor
return function Blazy(options) {
//IE7- fallback for missing querySelectorAll support
if (!document.querySelectorAll) {
var s = document.createStyleSheet();
document.querySelectorAll = function(r, c, i, j, a) {
a = document.all, c = [], r = r.replace(/\[for\b/gi, '[htmlFor').split(',');
for (i = r.length; i--;) {
s.addRule(r[i], 'k:v');
for (j = a.length; j--;) a[j].currentStyle.k && c.push(a[j]);
s.removeRule(0);
}
return c;
};
}
//options and helper vars
var scope = this;
var util = scope._util = {};
util.elements = [];
util.destroyed = true;
scope.options = options || {};
scope.options.error = scope.options.error || false;
scope.options.offset = scope.options.offset || 100;
scope.options.root = scope.options.root || document;
scope.options.success = scope.options.success || false;
scope.options.selector = scope.options.selector || '.b-lazy';
scope.options.separator = scope.options.separator || '|';
scope.options.containerClass = scope.options.container;
scope.options.container = scope.options.containerClass ? document.querySelectorAll(scope.options.containerClass) : false;
scope.options.errorClass = scope.options.errorClass || 'b-error';
scope.options.breakpoints = scope.options.breakpoints || false;
scope.options.loadInvisible = scope.options.loadInvisible || false;
scope.options.successClass = scope.options.successClass || 'b-loaded';
scope.options.validateDelay = scope.options.validateDelay || 25;
scope.options.saveViewportOffsetDelay = scope.options.saveViewportOffsetDelay || 50;
scope.options.srcset = scope.options.srcset || 'data-srcset';
scope.options.src = _source = scope.options.src || 'data-src';
_supportClosest = Element.prototype.closest;
_isRetina = window.devicePixelRatio > 1;
_viewport = {};
_viewport.top = 0 - scope.options.offset;
_viewport.left = 0 - scope.options.offset;
/* public functions
*/
scope.revalidate = function() {
initialize(scope);
};
scope.load = function(elements, force) {
var opt = this.options;
if (elements && elements.length === undefined) {
loadElement(elements, force, opt);
} else {
each(elements, function(element) {
loadElement(element, force, opt);
});
}
};
scope.destroy = function() {
var util = scope._util;
if (scope.options.container) {
each(scope.options.container, function(object) {
unbindEvent(object, 'scroll', util.validateT);
});
}
unbindEvent(window, 'scroll', util.validateT);
unbindEvent(window, 'resize', util.validateT);
unbindEvent(window, 'resize', util.saveViewportOffsetT);
util.count = 0;
util.elements.length = 0;
util.destroyed = true;
};
//throttle, ensures that we don't call the functions too often
util.validateT = throttle(function() {
validate(scope);
}, scope.options.validateDelay, scope);
util.saveViewportOffsetT = throttle(function() {
saveViewportOffset(scope.options.offset);
}, scope.options.saveViewportOffsetDelay, scope);
saveViewportOffset(scope.options.offset);
//handle multi-served image src (obsolete)
each(scope.options.breakpoints, function(object) {
if (object.width >= window.screen.width) {
_source = object.src;
return false;
}
});
// start lazy load
setTimeout(function() {
initialize(scope);
}); // "dom ready" fix
};
/* Private helper functions
*/
function initialize(self) {
var util = self._util;
// First we create an array of elements to lazy load
util.elements = toArray(self.options);
util.count = util.elements.length;
// Then we bind resize and scroll events if not already binded
if (util.destroyed) {
util.destroyed = false;
if (self.options.container) {
each(self.options.container, function(object) {
bindEvent(object, 'scroll', util.validateT);
});
}
bindEvent(window, 'resize', util.saveViewportOffsetT);
bindEvent(window, 'resize', util.validateT);
bindEvent(window, 'scroll', util.validateT);
}
// And finally, we start to lazy load.
validate(self);
}
function validate(self) {
var util = self._util;
for (var i = 0; i < util.count; i++) {
var element = util.elements[i];
if (elementInView(element, self.options) || hasClass(element, self.options.successClass)) {
self.load(element);
util.elements.splice(i, 1);
util.count--;
i--;
}
}
if (util.count === 0) {
self.destroy();
}
}
function elementInView(ele, options) {
var rect = ele.getBoundingClientRect();
if(options.container && _supportClosest){
// Is element inside a container?
var elementContainer = ele.closest(options.containerClass);
if(elementContainer){
var containerRect = elementContainer.getBoundingClientRect();
// Is container in view?
if(inView(containerRect, _viewport)){
var top = containerRect.top - options.offset;
var right = containerRect.right + options.offset;
var bottom = containerRect.bottom + options.offset;
var left = containerRect.left - options.offset;
var containerRectWithOffset = {
top: top > _viewport.top ? top : _viewport.top,
right: right < _viewport.right ? right : _viewport.right,
bottom: bottom < _viewport.bottom ? bottom : _viewport.bottom,
left: left > _viewport.left ? left : _viewport.left
};
// Is element in view of container?
return inView(rect, containerRectWithOffset);
} else {
return false;
}
}
}
return inView(rect, _viewport);
}
function inView(rect, viewport){
// Intersection
return rect.right >= viewport.left &&
rect.bottom >= viewport.top &&
rect.left <= viewport.right &&
rect.top <= viewport.bottom;
}
function loadElement(ele, force, options) {
// if element is visible, not loaded or forced
if (!hasClass(ele, options.successClass) && (force || options.loadInvisible || (ele.offsetWidth > 0 && ele.offsetHeight > 0))) {
var dataSrc = getAttr(ele, _source) || getAttr(ele, options.src); // fallback to default 'data-src'
if (dataSrc) {
var dataSrcSplitted = dataSrc.split(options.separator);
var src = dataSrcSplitted[_isRetina && dataSrcSplitted.length > 1 ? 1 : 0];
var srcset = getAttr(ele, options.srcset);
var isImage = equal(ele, 'img');
var parent = ele.parentNode;
var isPicture = parent && equal(parent, 'picture');
// Image or background image
if (isImage || ele.src === undefined) {
var img = new Image();
// using EventListener instead of onerror and onload
// due to bug introduced in chrome v50
// (https://productforums.google.com/forum/#!topic/chrome/p51Lk7vnP2o)
var onErrorHandler = function() {
if (options.error) options.error(ele, "invalid");
addClass(ele, options.errorClass);
unbindEvent(img, 'error', onErrorHandler);
unbindEvent(img, 'load', onLoadHandler);
};
var onLoadHandler = function() {
// Is element an image
if (isImage) {
if(!isPicture) {
handleSources(ele, src, srcset);
}
// or background-image
} else {
ele.style.backgroundImage = 'url("' + src + '")';
}
itemLoaded(ele, options);
unbindEvent(img, 'load', onLoadHandler);
unbindEvent(img, 'error', onErrorHandler);
};
// Picture element
if (isPicture) {
img = ele; // Image tag inside picture element wont get preloaded
each(parent.getElementsByTagName('source'), function(source) {
handleSource(source, _attrSrcset, options.srcset);
});
}
bindEvent(img, 'error', onErrorHandler);
bindEvent(img, 'load', onLoadHandler);
handleSources(img, src, srcset); // Preload
} else { // An item with src like iframe, unity games, simpel video etc
ele.src = src;
itemLoaded(ele, options);
}
} else {
// video with child source
if (equal(ele, 'video')) {
each(ele.getElementsByTagName('source'), function(source) {
handleSource(source, _attrSrc, options.src);
});
ele.load();
itemLoaded(ele, options);
} else {
if (options.error) options.error(ele, "missing");
addClass(ele, options.errorClass);
}
}
}
}
function itemLoaded(ele, options) {
addClass(ele, options.successClass);
if (options.success) options.success(ele);
// cleanup markup, remove data source attributes
removeAttr(ele, options.src);
removeAttr(ele, options.srcset);
each(options.breakpoints, function(object) {
removeAttr(ele, object.src);
});
}
function handleSource(ele, attr, dataAttr) {
var dataSrc = getAttr(ele, dataAttr);
if (dataSrc) {
setAttr(ele, attr, dataSrc);
removeAttr(ele, dataAttr);
}
}
function handleSources(ele, src, srcset){
if(srcset) {
setAttr(ele, _attrSrcset, srcset); //srcset
}
ele.src = src; //src
}
function setAttr(ele, attr, value){
ele.setAttribute(attr, value);
}
function getAttr(ele, attr) {
return ele.getAttribute(attr);
}
function removeAttr(ele, attr){
ele.removeAttribute(attr);
}
function equal(ele, str) {
return ele.nodeName.toLowerCase() === str;
}
function hasClass(ele, className) {
return (' ' + ele.className + ' ').indexOf(' ' + className + ' ') !== -1;
}
function addClass(ele, className) {
if (!hasClass(ele, className)) {
ele.className += ' ' + className;
}
}
function toArray(options) {
var array = [];
var nodelist = (options.root).querySelectorAll(options.selector);
for (var i = nodelist.length; i--; array.unshift(nodelist[i])) {}
return array;
}
function saveViewportOffset(offset) {
_viewport.bottom = (window.innerHeight || document.documentElement.clientHeight) + offset;
_viewport.right = (window.innerWidth || document.documentElement.clientWidth) + offset;
}
function bindEvent(ele, type, fn) {
if (ele.attachEvent) {
ele.attachEvent && ele.attachEvent('on' + type, fn);
} else {
ele.addEventListener(type, fn, { capture: false, passive: true });
}
}
function unbindEvent(ele, type, fn) {
if (ele.detachEvent) {
ele.detachEvent && ele.detachEvent('on' + type, fn);
} else {
ele.removeEventListener(type, fn, { capture: false, passive: true });
}
}
function each(object, fn) {
if (object && fn) {
var l = object.length;
for (var i = 0; i < l && fn(object[i], i) !== false; i++) {}
}
}
function throttle(fn, minDelay, scope) {
var lastCall = 0;
return function() {
var now = +new Date();
if (now - lastCall < minDelay) {
return;
}
lastCall = now;
fn.apply(scope, arguments);
};
}
});
});
/** Carousel
* Creates instances of Carousel based on a CSS selector.
*
* Example use: Any card landing page on Fusion with a carousel
* e.g. http://www.gallup.com/education/227657/improve-k-12.aspx
*/
var blazyInstance = new blazy();
if (window.gel && window.gel.Carousel) {
queryAll(document, '.c-carousel').forEach(function (el) {
queryAll(el, '.c-carousel__container > .c-item').forEach(function (item) {
return item.classList.add('c-carousel__item');
});
el.classList.add('js-carousel--theme-auto');
// create carousel
if (el.classList.contains('c-carousel--tile')) {
// create carousel with per page breakpoints
new window.gel.Carousel(el, { siemaOptions: { perPage: { 1270: 3, 650: 2 } } }); // eslint-disable-line no-new, max-len
} else {
new window.gel.Carousel(el); // eslint-disable-line no-new
}
});
}
queryAll(document, '.c-carousel').forEach(function (el) {
el.addEventListener('gel.carousel.change', function () {
setTimeout(function () {
blazyInstance.revalidate();
}, 100);
});
});
/** Mosaic (layout)
* Displays child elements in a Carousel on mobile and a Mosaic on non-mobile. See implementations
* of either layout in GEL Bootstrap for more specifics on how they work.
*
* Example use: Gallup.com homepage (http://www.gallup.com/)
*/
var MOBILE_BREAKPOINT = 650;
var mosaicContainers = [];
var carousels = [];
function update(el, index) {
// on mobile, initialize a carousel
if (window.innerWidth < MOBILE_BREAKPOINT && !carousels[index]) {
carousels[index] = new window.gel.Carousel(el.querySelector('.c-carousel'));
queryAll(el, '.c-dot-paging').forEach(function (paging) {
return paging.classList.add('c-dot-paging--dark');
});
// on non-mobile, destroy the carousel
} else if (window.innerWidth >= MOBILE_BREAKPOINT && carousels[index]) {
carousels[index].destroy();
carousels[index] = null;
}
}
function updateAll() {
mosaicContainers.forEach(update);
}
if (window.gel && window.gel.Mosaic) {
queryAll(document, '.l-mosaic').forEach(function (el) {
// create mosaic
new window.gel.Mosaic(el, { // eslint-disable-line no-new
blockSelector: '.l-mosaic__block',
sizes: [{
suffix: 'sm', width: 2, fillLast: 2, maxWidth: 2
}, {
suffix: 'md', width: 2, fillLast: 2, maxWidth: 2
}, {
suffix: 'lg', width: 3, fillLast: 3, maxWidth: 2
}]
});
// do some prep work in case we need to show these items as a carousel on mobile
var carousel = document.createElement('div');
carousel.className = 'c-carousel';
el.appendChild(carousel);
var container = document.createElement('div');
container.className = 'c-carousel__container';
carousel.appendChild(container);
queryAll(el, '.l-mosaic__block').forEach(function (item) {
if (!item.hasAttribute('data-carousel-exclude')) {
item.classList.add('c-carousel__item');
container.appendChild(item);
}
});
mosaicContainers.push(el);
});
if (window.gel.Carousel) {
window.addEventListener('resize', debounce(updateAll, 50));
updateAll();
}
}
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var toConsumableArray = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
} else {
return Array.from(arr);
}
};
/** Masonry (layout)
* Lays out child elements of the specified container element in a masonry layout
* (i.e. grid of items with nonuniform height).
*
* Example use: ÓÅÃÛ´«Ã½News homepage (http://news.gallup.com/)
*/
var DATA_ATTR = 'data-masonry';
var CLS_ACTIVE = 'js-masonry-active';
var CLS_ITEM = 'js-masonry-item';
var CLS_PREPOSITIONED = 'js-masonry-prepositioned';
var CLS_MEASURE = 'js-masonry-measure';
var CLS_SPACER = 'js-masonry-spacer';
var instances = [];
var Masonry = function () {
function Masonry(container) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
classCallCheck(this, Masonry);
this.container = typeof container === 'string' ? document.querySelector(container) : container;
if (!container) {
throw Error('Masonry: Cannot find specified container element.');
}
Object.assign(this, {
itemSelector: '> section',
updateOnResize: true,
columnWidth: 310,
gutter: 0,
useTransforms: true
}, options);
this.cache = {
columnCount: 1
};
this.container.masonry = this;
instances.push(this);
this.update();
}
createClass(Masonry, [{
key: 'getItems',
value: function getItems() {
if (this.itemSelector.length && this.itemSelector[0] === '>') {
var tempCls = 'masonry-container-' + instances.indexOf(this);
this.container.classList.add(tempCls);
var items = queryAll(document, '.' + tempCls + ' ' + this.itemSelector);
this.container.classList.remove(tempCls);
return items;
}
return queryAll(this.container, this.itemSelector);
}
// Returns number of columns that the container can fit
}, {
key: 'getColumnCount',
value: function getColumnCount() {
var available = this.container.offsetWidth + this.gutter;
var perColumn = this.columnWidth + this.gutter;
return Math.max(Math.floor(available / perColumn), 1);
}
// Returns which column an x coordinate would be in
}, {
key: 'xToCol',
value: function xToCol(x) {
return Math.min(Math.floor(x / this.columnWidth), this.cache.columnCount);
}
// Returns number of columns an item spans
}, {
key: 'getColumnsSpanned',
value: function getColumnsSpanned(el) {
return Math.max(Math.ceil(el.offsetWidth / this.columnWidth), 1);
}
// Does the actual positioning of items in masonry layout
}, {
key: 'layout',
value: function layout() {
var items = this.getItems();
// Abort if there aren't any eligible items in the container
if (!items.length) {
return;
}
this.container.classList.add(CLS_ACTIVE);
// Find out how many columns we can fit, make a 0'd array of that length
var cols = [];
for (var i = 0; i < this.cache.columnCount; i++) {
cols.push(0);
}
// Account for prepositioned items
var prepositioned = this.container.querySelectorAll('.masonry-container > .' + CLS_PREPOSITIONED);
for (var _i = 0; _i < prepositioned.length; _i++) {
var el = prepositioned[_i];
var leftCol = this.xToCol(el.offsetLeft);
var rightCol = this.xToCol(el.offsetLeft + el.offsetWidth - 1);
// Add the tile's height to the affected columns
for (var j = leftCol; j <= rightCol; j++) {
cols[j] = Math.max(el.offsetTop + el.offsetHeight, cols[j]);
}
}
// Layout the rest of the items
for (var _i2 = 0; _i2 < items.length; _i2++) {
var _el = items[_i2];
_el.classList.add(CLS_ITEM);
// Ignore prepositioned items
if (!_el.classList.contains(CLS_PREPOSITIONED)) {
// Find the shortest column
var col = 0;
for (var _j = 1; _j < cols.length; _j++) {
if (cols[col] > cols[_j]) {
col = _j;
}
}
// Assume standard width initially
var colsSpanned = 1;
// If it has the `js-masonry-measure` class, actually measure the width
if (_el.classList.contains(CLS_MEASURE)) {
colsSpanned = Math.min(this.getColumnsSpanned(_el), cols.length);
// If it's too wide to fit, place it in the first column
if (colsSpanned > cols.length - col) {
col = 0;
}
}
// Position the tile
_el.style.top = cols[col] + 'px';
_el.style.left = this.columnWidth * col + 'px';
// Account for the space it occupies
for (var _j2 = 0; _j2 < colsSpanned; _j2++) {
cols[col + _j2] += _el.offsetHeight;
}
// Spacer/"clearing" logic
if (_el.classList.contains(CLS_SPACER)) {
(function () {
var clearHeight = Math.max.apply(Math, toConsumableArray(cols));
cols = cols.map(function (currentValue) {
return Math.max(clearHeight, currentValue);
});
})();
}
}
}
// Set appropriate height on the container so all items are visible
this.container.style.height = Math.max.apply(Math, toConsumableArray(cols)) + 'px';
}
// Disables masonry and restores positioning defaults
}, {
key: 'reset',
value: function reset() {
var fullReset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
this.container.classList.remove(CLS_ACTIVE);
this.container.style.height = '';
if (fullReset) {
this.getItems().forEach(function (el) {
el.classList.remove(CLS_ITEM);
el.style.top = '';
el.style.left = '';
});
}
}
// Checks to see if we need to re-layout or disable the masonry
}, {
key: 'update',
value: function update() {
var forceUpdate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var cols = this.getColumnCount();
// Only do update if we're forcing an update or the column count has changed
var doUpdate = forceUpdate === true || this.cache.columnCount !== cols;
// Update cached column count for next update
this.cache.columnCount = cols;
if (doUpdate) {
if (cols > 1) {
this.layout();
} else {
this.reset();
}
}
}
}, {
key: 'destroy',
value: function destroy() {
this.reset(true);
instances.splice(instances.indexOf(this), 1);
}
}]);
return Masonry;
}();
var style = document.createElement('style');
style.innerHTML = '\n .' + CLS_ACTIVE + ' {\n position: relative;\n }\n .' + CLS_ACTIVE + ' .' + CLS_ITEM + ' {\n position: absolute;\n }\n';
style.appendChild(document.createTextNode('')); // Webkit hack
document.head.appendChild(style);
/*
** Event Listeners
*/
var updateAll$1 = function updateAll() {
var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
return instances.forEach(function (i) {
return i.update(force);
});
};
var resetAll = function resetAll() {
return instances.forEach(function (i) {
return i.reset();
});
};
// Update masonry instances on window resize if updateOnResize == true
window.addEventListener('resize', debounce(function () {
instances.forEach(function (i) {
return i.updateOnResize && i.update();
});
}, 50));
// Update masonry instances when TypeKit loads
document.body.addEventListener('typekitLoaded', updateAll$1.bind(null, true));
// Disable masonry (call reset()) on print and re-enable after (call layout())
if ('onbeforeprint' in window) {
window.addEventListener('beforeprint', resetAll);
window.addEventListener('afterprint', updateAll$1.bind(null, false));
} else if (window.matchMedia) {
window.matchMedia('print').addListener(function (mql) {
if (mql.matches) {
resetAll();
} else {
updateAll$1();
}
});
}
/*
** Auto-initialize elements with [data-masonry] attribute
*/
queryAll(document, '[' + DATA_ATTR + ']').forEach(function (el) {
var options = {};
var itemSelector = el.getAttribute(DATA_ATTR);
if (itemSelector) {
options.itemSelector = itemSelector;
}
new Masonry(el, options); // eslint-disable-line no-new
});
window.masonry = instances;
/** Typekit
* Adobe-provided script for loading webfonts from Typekit.
*/
// TypeKit loader script from Adobe
// This has been modified as little as possible to make future upgrades easy
(function (d) {
var kits = {
'en': 'svt7wsh',
'ja': 'wzr4sie',
'zh': 'lsv0hxq'
};
var config = {
kitId: kits[document.documentElement.lang.toLowerCase().split('-')[0] || "en"],
scriptTimeout: 3000,
async: true,
active: function active() {
document.fonts.ready.then(function () {
emit(document.body, 'typekitLoaded');
});
}
},
h = d.documentElement,
t = setTimeout(function () {
h.className = h.className.replace(/\bwf-loading\b/g, "") + " wf-inactive";
}, config.scriptTimeout),
tk = d.createElement("script"),
f = false,
s = d.getElementsByTagName("script")[0],
a;
h.className += " wf-loading";
tk.src = 'https://use.typekit.net/' + config.kitId + '.js';
tk.async = true;
tk.onload = tk.onreadystatechange = function () {
a = this.readyState;
if (f || a && a != "complete" && a != "loaded") return;
f = true;
clearTimeout(t);
try {
Typekit.load(config);
} catch (e) {}
};
s.parentNode.insertBefore(tk, s);
})(document);
/** Max lines
* Essentially implements `text-overflow-y` (if it were a thing) -- prevents text in
* elements with `data-overflow="ellipsis"` from overflowing its container by inserting
* an ellipsis at the clipping point and hiding the remainder of the text.
*
* Example use: tiles on any Fusion site (e.g. ÓÅÃÛ´«Ã½News homepage -- http://news.gallup.com/)
*/
// Looks for elements with the data attribute data-overflow="ellipsis"
// Determines whether that element has text that has been hidden by overflow
// Adds an ellipsis to the end of the text that is visible
// Set update to true if you have new elements on the page to check
var fontCache = {};
function setup() {
// Add temporary styles
var style = document.createElement('style');
// Hack for Webkit -- http://davidwalsh.name/add-rules-stylesheets
style.appendChild(document.createTextNode(''));
document.head.appendChild(style);
style.id = 'maxlines-styles';
style.sheet.insertRule('.font-baseline { visibility: hidden; height: 100px; }', 0);
style.sheet.insertRule('.font-baseline span:after { content: \'\'; height: 100%; display: inline-block; }', 1);
}
function reset() {
// Remove temporary styles
document.head.removeChild(document.getElementById('maxlines-styles'));
}
// Recursively get all textnodes that are children of a node.
// Previously we used the treewalker API but there were some
// browser-specific bugs with the API
function textNodesUnder(node) {
var all = [];
var cursor = node;
for (cursor = cursor.firstChild; cursor; cursor = cursor.nextSibling) {
if (cursor.nodeType === 3) all.push(cursor);else all = all.concat(textNodesUnder(cursor));
}
return all;
}
// Calculate a number of font metrics needed for the work
// Most importantly the baseline and the width of an ellipsis
// for a specific element
function fontMetrics(_container) {
var div = document.createElement('div');
var strut = document.createElement('span');
var lineHeight = void 0;
var container = _container || document.body;
var containerStyle = window.getComputedStyle(container);
var hash = [containerStyle.fontFamily, containerStyle.fontSize, containerStyle.fontWeight, containerStyle.lineHeight, containerStyle.letterSpacing].join('-');
if (fontCache[hash]) {
return fontCache[hash];
} else if (containerStyle.display === 'none') {
return null;
}
// Make an ellipsis for this element offscreen so we can measure it
var ellipsis = document.createElement('div');
ellipsis.setAttribute('aria-hidden', true);
ellipsis.style.position = 'absolute';
ellipsis.style.left = '-99999999px';
ellipsis.innerHTML = '…';
container.appendChild(ellipsis);
// Measure it so we can test if an ellipsis fits in letious spots.
var elipWidth = ellipsis.getBoundingClientRect().width * 2;
container.removeChild(ellipsis);
// Thanks to Alan Stearns for the hack!
// http://blogs.adobe.com/webplatform/2014/08/13/one-weird-trick-to-baseline-align-text/
strut.textContent = 'T';
div.appendChild(strut);
div.classList.add('font-baseline');
container.appendChild(div);
var computedStyle = window.getComputedStyle(strut);
lineHeight = parseInt(computedStyle.lineHeight, 10);
strut.style.lineHeight = 0;
var strutHeight = strut.offsetHeight;
var baselineHeight = strut.offsetTop + strutHeight - div.offsetHeight - div.offsetTop;
lineHeight = lineHeight || strutHeight;
div.parentNode.removeChild(div);
// Cache the result before returning it
fontCache[hash] = {
elipWidth: elipWidth,
offset: (lineHeight - strutHeight) / 2 + baselineHeight
};
return fontCache[hash];
}
function maxLines(update) {
setup();
// We are going to process everything which means removing old ellipses.
if (!update) {
// Clean up previous pass. If we are calling this again something has changed.
queryAll(document, '[data-overflow="ellipsis"] .overflow-ellipsis').forEach(function (el) {
el.parentNode.removeChild(el);
});
}
// We only want to check new items
var els = update ? queryAll(document, '[data-overflow="ellipsis"]:not([data-overflow-checked="1"])') : queryAll(document, '[data-overflow="ellipsis"]');
var range = document.createRange(); // Reusable range object
// For each data-overflow element, check to see
// if we need ellipsis and add one if we do
els.forEach(function (el) {
el.normalize();
// Measure the font metrics so we can find the baseline offset for this text
var metrics = fontMetrics(el);
if (!metrics) {
return;
}
// Do we have any overflowing text?
var elRect = el.getBoundingClientRect();
var elBottom = elRect.bottom;
// Measure the position of the last baseline in the element
// Because scrollHeight is an integer and the clientRect is not
// it could be off by as much as a pixel, so subtract 1 from the scrollHeight
// So that we don't inadvertantly try and ellipsis something that actually fits.
var contentBottom = Math.max(elRect.bottom, elRect.top + el.scrollHeight - 1) - metrics.offset;
range.selectNodeContents(el);
// See if the last baseline is being cropped by a parent
var parentBottom = elBottom;
var parentNode = el.parentNode;
// We could save time by caching this, perhaps?
while (parentNode && parentNode.nodeType === 1) {
if (window.getComputedStyle(parentNode).overflow !== 'visible') {
parentBottom = parentNode.getBoundingClientRect().bottom;
if (parentBottom <= elBottom) {
elBottom = parentBottom;
}
}
parentNode = parentNode.parentNode; // eslint-disable-line prefer-destructuring
}
// Mark the element so we can skip it during update calls later
el.setAttribute('data-overflow-checked', 1);
// If this elment is not overflowing, we are done.
if (elBottom >= contentBottom) {
return;
}
// Go through the text nodes to find the last visible text in the element.
var textNodes = textNodesUnder(el);
textNodes.reverse();
// Stop returning true when we've found our match
textNodes.every(function (tn) {
// Find all the whitespace indices in the element.
var result = [];
tn.textContent.replace(/([.,\s]+)/g, function (a, b, index) {
result.push(index);
});
result.reverse();
// Find all the bounding rectangles for the character preceeding
// whitepsace from last to first.
for (var i = 0; i < result.length; i++) {
// If the whitespace character is the first character in the text node, ignore it
// We don't want to put an ellipsis there anyway
if (result[i] !== 0) {
range.setStart(tn, result[i] - 1);
range.setEnd(tn, result[i]);
// Find the position of this whitespace character on the page
var gapRect = range.getBoundingClientRect();
var gapBottom = gapRect.bottom;
var gapRight = gapRect.right;
// IE uses logical pixels for the dimensions reported by range.getBoundingClientRect
// so we need to convert these to match the dimensions reported by the element version
if (window.screen.deviceXDPI) {
gapBottom /= window.screen.deviceXDPI / window.screen.logicalXDPI;
gapRight /= window.screen.deviceXDPI / window.screen.logicalXDPI;
}
// Find the baseline for this character
gapBottom -= metrics.offset;
// If the whitespace character's baseline is visible and there is room
// to the right for an ellipsis, put a span containing the
// ellipsis and some line breaks right before the whitespace.
// The line breaks push the rest of the text to be outside
// of the visible area so that the ellipsis is the last text.
if (gapBottom <= elBottom && gapRight + metrics.elipWidth < elRect.right) {
var newNode = document.createElement('span');
newNode.className = 'overflow-ellipsis';
newNode.setAttribute('aria-hidden', true);
range.setStart(tn, result[i]);
range.setEnd(tn, result[i]);
range.surroundContents(newNode);
newNode.innerHTML = '\u2026
' + newNode.innerHTML;
return false;
}
}
}
return true;
});
});
reset();
}
// Check for [data-overflow="ellipsis"] and run maxLines() if needed
if (document.querySelector('[data-overflow="ellipsis"]')) {
maxLines();
document.body.addEventListener('typekitLoaded', function () {
return maxLines();
});
}
window.wwwV8 = window.wwwV8 || {};
window.wwwV8.maxLines = maxLines;
/** Tiles
* Encapsulates functionality required by Fusion tiles. Adds lazy loading for
* tile images and vertical text overflow handling.
*
* Example use: ÓÅÃÛ´«Ã½News homepage (http://news.gallup.com/)
*/
// Create bLazy instance to lazy load tile images
var blazyInstance$1 = new blazy();
var tiles = { maxLines: maxLines, blazyInstance: blazyInstance$1 };
/** Scroll to element
* Smoothly scrolls to the specified element. Supports easing functions.
*
* Example use: modules/jump-link
*/
// Easing functions -- http://gizma.com/easing/
var easings$1 = {
/* eslint-disable */
linear: function linear(t, b, c, d) {
return c * t / d + b;
},
easeInOutQuad: function easeInOutQuad(t, b, c, d) {
t /= d / 2;
if (t < 1) return c / 2 * t * t + b;
t--;
return -c / 2 * (t * (t - 2) - 1) + b;
},
easeInOutCubic: function easeInOutCubic(t, b, c, d) {
t /= d / 2;
if (t < 1) return c / 2 * t * t * t + b;
t -= 2;
return c / 2 * (t * t * t + 2) + b;
}
/* eslint-enable */
};
function scrollToElement(el) {
var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 500;
var ease = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : easings$1.easeInOutCubic;
// Start point
var start = document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop;
var distance = el.getBoundingClientRect().top; // Distance to scroll
queryAll(document, '.navbar-sticky-placeholder, .c-gmn-overlay, .item-pinned').forEach(function (item) {
distance -= item.clientHeight;
});
var time = 0; // Current time in ms
var lastDraw = void 0; // Time of last draw
var animate = function animate() {
// Update time
var now = new Date().getTime();
time += now - (lastDraw || now);
lastDraw = now;
// Get next scroll point
var scrollTop = ease(time, start, distance, duration);
// Update scrollTop
document.documentElement.scrollTop = scrollTop;
document.body.parentNode.scrollTop = scrollTop;
document.body.scrollTop = scrollTop;
// If the animation isn't over call animate() for next frame, otherwise run the callback
if (time < duration) {
requestAnimationFrame(animate);
} else if (cb && typeof cb === 'function') {
cb(el);
}
};
// Animate first frame
animate();
// Update focus to first focusable link after animation
if (el.querySelector('a')) {
el.querySelector('a').focus();
}
}
queryAll(document, '[data-scroll-to]').forEach(function (el) {
var target = document.querySelector(el.getAttribute('data-scroll-to'));
if (target) {
el.addEventListener('click', function (e) {
scrollToElement(target);
if (target.tagName === 'A') {
e.preventDefault();
}
});
}
});
window.wwwV8 = window.wwwV8 || {};
window.wwwV8.scrollToElement = scrollToElement;
/** JumpLink
* Basically a fancy anchor -- smoothly scrolls to designated element on page.
* Auto-initializes elements with the `data-jump-target` attribute.
*
* Example use: http://www.gallup.com/workplace/215381/gallup-leadership-development.aspx
*/
var ATTRIBUTE_TARGET = 'data-jump-target';
var ATTRIBUTE_STATUS = 'data-jump-link';
var STATUS_INITIALIZED = 'initialized';
var defaultToLast = !!document.querySelectorAll('body.jump2form, main.jump2form').length;
var eventHandlers = {
click: function click(e) {
this.jump();
e.preventDefault();
}
};
var JumpLink = function () {
function JumpLink(el) {
var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : JumpLink.resolveTarget(el);
var focusOnJump = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
classCallCheck(this, JumpLink);
this.el = el;
this.target = target;
this.focusOnJump = focusOnJump;
this.el.addEventListener('click', eventHandlers.click.bind(this));
this.el.setAttribute(ATTRIBUTE_STATUS, STATUS_INITIALIZED);
}
createClass(JumpLink, [{
key: 'jump',
value: function jump() {
if (this.focusOnJump) {
scrollToElement(this.target, focusOnce);
} else {
scrollToElement(this.target);
}
}
}], [{
key: 'resolveTarget',
value: function resolveTarget(el) {
var card = findAncestor(el, ['.article-cards > *', '.article--cards > *', '.article-cards > .inner > *', '.article--cards > .inner > *'].join(', '));
if (!card) return null;
var attr = el.getAttribute(ATTRIBUTE_TARGET);
var href = el.getAttribute('href') || '';
var anchor = href.indexOf('#') > -1 ? href.substring(href.lastIndexOf('#') + 1) : null;
if (attr) {
if (attr === 'next') {
return card.nextElementSibling;
} else if (attr === 'last') {
return card.parentElement.lastElementChild;
} else if (document.querySelector(attr)) {
return document.querySelector(attr);
}
return null;
} else if (anchor) {
return document.getElementById(anchor);
} else if (defaultToLast) {
return card.parentElement.lastElementChild;
}
return card.nextElementSibling;
}
}]);
return JumpLink;
}();
queryAll(document, '[' + ATTRIBUTE_TARGET + ']').forEach(function (el) {
// Prevent repeat initialization
if (el.getAttribute(ATTRIBUTE_STATUS) !== STATUS_INITIALIZED) {
new JumpLink(el); // eslint-disable-line no-new
}
});
/** Pager
* Automatically paginates the contents of the given container element. Default is
* one child element per page but it is configurable.
*
* Example use: http://www.gallup.com/workplace/215381/gallup-leadership-development.aspx
*/
var Pager = function () {
function Pager(element) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
classCallCheck(this, Pager);
this.element = element;
this.options = Object.assign({
// Default values
itemsPerPage: 1,
itemSelector: null
}, options);
this.pages = [];
this.selectedIndex = -1;
this.create();
}
createClass(Pager, [{
key: 'create',
value: function create() {
var _this = this;
var element = this.element,
options = this.options,
pages = this.pages;
var items = options.itemSelector ? queryAll(element, options.itemSelector) : element.children;
// Make `element` the first page
this.pages.push(this.createPage(element));
this.selectedIndex = 0;
var currentPage = void 0;
for (var i = options.itemsPerPage; i < items.length; i++) {
if (i % options.itemsPerPage === 0) {
currentPage = this.createPage();
this.pages.push(currentPage);
}
currentPage.appendChild(items[i]);
}
this.controls = document.createElement('div');
this.controls.className = 'c-dot-paging c-dot-paging--centered';
this.controls.innerHTML = '\n \n