/** * v1.0 - Copyright 2014 Madden Media - All rights reserved. * * Advanced Google Analytics tracking script that tracks starting reading, 25%, * 50%, 75% and completion. This is otherwise a duplicate of: * * madden-ga-track-start-end-v1.0.js * * This duplication is in place to reduce configuration work for callers. * * Requires Google Analytics and jQuery. This script will determine which analytics * object (universal, legacy, etc.) seems to be present and will adjust tracking * calls based on this. */ // safe console log if (typeof console == "undefined"){console={};console.log = function(){return;}} jQuery(function($) { // Debug flags var debugMode = false; var logOutput = false; // Default time delay before checking location var callBackTime = 100; // percent of the page where reader events fire // at (use decimals < 1 - i.e. .25) - use .0001 for "start of page" var readerLocationPercents = [.0001, .25, .5, .75]; // # px before tracking a reader (will be assigned based on readerLocationPercents) var readerLocations = [ ]; // how far have they made it (this will be managed by the script) var readerLastPassed = 0; // Set some flags for tracking & execution var timer = 0; var isScrolling = false; var endContent = false; var didComplete = false; // Set some time variables to calculate reading time var startTime = new Date(); var beginning = startTime.getTime(); var totalTime = 0; // Check the location and track user function trackLocation () { // positions var curWinBottom = ($(window).height() + $(window).scrollTop()); var height = $(document).height(); // figure out scroll time var currentTime = new Date(); var timeToScroll = Math.round((currentTime.getTime() - beginning) / 1000); // If user starts to scroll send an event (if it's at a tracking point) for (i=readerLastPassed; i < readerLocations.length; i++) { // run location test if ( (curWinBottom >= readerLocations[i]) && (timeToScroll > 0) ) { // set label var label = makeReadingEventLabel(readerLocationPercents[i]); // send the event sendEvent('Reading', label, timeToScroll, location.pathname); // log it log('READING: ' + readerLocations[i] + " / " + label + " / " + timeToScroll); // note what they've tracked readerLastPassed = (i + 1); } } // if user has hit the bottom of page send an event if ( (curWinBottom >= height) && (! didComplete) ) { currentTime = new Date(); // figure out scroll time var currentTime = new Date(); var timeToScroll = Math.round((currentTime.getTime() - beginning) / 1000); // set label var label = makeReadingEventLabel(1); // send the event sendEvent('Reading', label, timeToScroll, location.pathname); // log it log('READING: ' + label + " / " + timeToScroll); didComplete = true; } } // figure out how tall our page is and adjust reader location to be a percent of that function adjustReaderLocation (percent) { var docHeight = $(document).height(); var adjHeight = Math.floor(docHeight * percent); return adjHeight; } // util function to make a pretty reading label string function makeReadingEventLabel (raw) { var lbl = ""; if (raw < .001) { lbl = "StartReading"; } else if (raw == 1) { lbl = "ContentBottom"; } else { lbl = ("Reading " + (raw * 100) + "%"); } return lbl; } // a log wrapper to check if we want it logged first function log (msg) { if (logOutput) { console.log(msg); } } // sends the event to whichever object we seem to have found function sendEvent (eventCategory, eventAction, eventValue, page) { if (debugMode) { // MAY EXIT THIS BLOCK return; } // test for any given analytics type if (typeof _gaq != "undefined") { // legacy analytics if (typeof pageTracker != "undefined") { // "traditional syntax" pageTracker._trackEvent(eventCategory, eventAction, page, eventValue); } else { // "asynchronous syntax" _gaq.push(['_trackEvent', eventCategory, eventAction, page, eventValue]); _gaq.push(['pageTracker._trackEvent', eventCategory, eventAction, page, eventValue]); } } else if (typeof ga != "undefined") { // universal analytics ga('send', { 'hitType': 'event', 'eventCategory': eventCategory, 'eventAction': eventAction, 'eventLabel': page, 'eventValue': eventValue }); } } // determine reader % locations function determineReaderLocations () { for (i=0; i < readerLocationPercents.length; i++) { readerLocations[i] = adjustReaderLocation(readerLocationPercents[i]); // log it log('LOCATION: ' + readerLocationPercents[i] + ' (' + readerLocations[i] + ' / ' + $(document).height() + ')'); } } // assign all percent sizes based on height of page $(window).load(function() { determineReaderLocations(); }); // reassign all percent sizes based on height of page $(window).resize(function() { determineReaderLocations(); }); // Track the scrolling and track location $(window).scroll(function() { if (timer) { clearTimeout(timer); } // Use a buffer so we don't call trackLocation too often. timer = setTimeout(trackLocation, callBackTime); }); }); /* * v1.2 * * Automatically track outbound links in Google Analytics. Any link that you do not want tracked * can be assigned a "noGA" class and it will not be skipped here. Includes support for GA and GAQ * * CREDIT: http://www.sitepoint.com/track-outbound-links-google-analytics/ * * Modified to support ability for links to open in new window w/o triggering a popup warning */ (function($) { "use strict"; // default no tracking class var defaultNoTrackClass = "noGA"; // current page host var baseURI = window.location.host; // click event on body $("body").on("click", function(e) { // abandon if link already aborted or analytics is not available if ( (e.isDefaultPrevented()) || ( (typeof _gaq === "undefined") && (typeof ga === "undefined") ) ) { return; } // abandon if no active link or link within domain var link = $(e.target).closest("a"); // if (link.length != 1 || baseURI == link[0].host) return; if (link.length != 1) return; // check the link to see if it should not be tracked if ( (link.attr("class") !== undefined) && (link.attr("class").indexOf(defaultNoTrackClass) != -1) ) { return; } // cancel event and record outbound link e.preventDefault(); var href = link[0].href; var target = link[0].target; if (target != "") { // gets us around popup blocking $(link[0]).on("click", function(){ var w = window.open(href, target); trackEvent(href, false); return false; }); $(link[0]).click(); } else { trackEvent(href, true); // in case hit callback bogs down setTimeout(function() { self.location.href = href; }, 1000); } // track the event function trackEvent (href, runHitCallback) { // test for any given analytics type if (typeof _gaq != "undefined") { // legacy analytics if (typeof pageTracker != "undefined") { // "traditional syntax" pageTracker._trackEvent('Presentation Layer', 'Outbound Click', href); } else { // "asynchronous syntax" var redirect = function (runHitCallback) { if (runHitCallback) { self.location.href = href; } else { return false; } }; _gaq.push(['_set','hitCallback', redirect(runHitCallback)]); _gaq.push(['_trackEvent', 'Presentation Layer', 'Outbound Click', href]); _gaq.push(['pageTracker._trackEvent', 'Presentation Layer', 'Outbound Click', href]); } } else if (typeof ga != "undefined") { // universal analytics ga('send', { 'hitType': 'event', 'eventCategory': 'Presentation Layer', 'eventAction': 'Outbound Click', 'eventLabel': href, 'hitCallback': (runHitCallback) ? function() { self.location.href = href; } : function() { return false; } }); } } }); })(jQuery); /** * v1.2 - Copyright 2015 Madden Media - All rights reserved. * * A set of parallax design functionality. */ !function(a){"use strict";a.fn.parallaxBG=function(b){var c=a(window).height(),d=0,e=a(window).scrollTop(),f=0,g=0,h=a.extend({adjustX:0,adjustY:0,bgXOffset:0,bgYOffset:0,bgXPosition:"100%",bgYPosition:"100%"},b);return this.each(function(){var b=a(this);a(window).scroll(function(){var i=h.bgXAdjust,j=b.css("backgroundPosition").split(" ");parseInt(j[0]);if(e=a(window).scrollTop(),f=b.offset().top,g=b.outerHeight(),e=e+c)){var l=0==h.adjustX?h.bgXPosition:Math.round((f-e)*h.adjustX)+0+h.bgXOffset+"px",m=0==h.adjustY?h.bgYPosition:Math.round((f-e)*h.adjustY)+0+h.bgYOffset+"px";b.css("background-position",l+" "+m)}})})},a.fn.parallaxLockElement=function(b){var c=!1,d=a.extend({parentEl:"",offsetTop:0,additionalCSS:void 0,onLock:void 0,onRelease:void 0},b);return this.each(function(){var b=a(this),e=a(d.parentEl);a(window).scroll(function(){var f=parseInt(e.offset().top-a(window).scrollTop()-d.offsetTop),g=e.offset().top+e.outerHeight(),i=(parseInt(b.outerHeight()),e.offset().top+e.outerHeight()-(b.offset().top+b.outerHeight()));f<=0?g+i<=a(window).scrollTop()+a(window).innerHeight()?c&&(c=!1,b.css({position:"absolute",top:"inherit",bottom:i+"px"}),"function"==typeof d.onRelease&&d.onRelease(this)):(b.css({position:"fixed",top:d.offsetTop+"px",bottom:"auto"}),"function"==typeof d.onLock&&d.onLock(this),c=!0):(b.css({position:"relative",top:"auto"}),"function"==typeof d.onRelease&&d.onRelease(this),c=!1),void 0!=d.additionalCSS&&b.css(d.additionalCSS)})})},a.fn.parallaxAnimateElement=function(b){var c=new Array,d=0,e=0,f=!1,g=a.extend({frames:1,elementClass:"floatingElement",elementFrameClassRoot:"frame",startOffset:null,endOffset:null,showWhenCentered:!1,centerOffsetAnimationRange:null,lock:!1,parentEl:"",offsetTop:0,additionalCSS:void 0,onLock:void 0,onRelease:void 0},b);g.lock?a(this).parallaxLockElement({parentEl:g.parentEl,offsetTop:g.offsetTop,additionalCSS:g.additionalCSS,onLock:g.onLock,onRelease:g.onRelease}):f=!0;var h=parseInt(a(this).parent().height());if(g.showWhenCentered)null==g.centerOffsetAnimationRange?g.centerOffsetAnimationRange=1:g.centerOffsetAnimationRange.indexOf("%")!=-1?g.centerOffsetAnimationRange=parseInt(g.centerOffsetAnimationRange)/100:g.centerOffsetAnimationRange=1;else{if(null!=g.startOffset)if(g.startOffset.indexOf("%")!=-1){var i=parseInt(g.startOffset)/100;d=Math.floor(h*i)}else{var i=parseInt(g.startOffset);d=i}if(null!=g.endOffset)if(g.endOffset.indexOf("%")!=-1){var i=parseInt(g.endOffset)/100;e=Math.floor(h-h*i)}else{var i=parseInt(g.endOffset);e=i}0==d&&0==e||(h=h-e-d);for(var j=h/g.frames,k=1;k<=g.frames;k++)c.push(Math.floor(d+j*k));f&&void 0!=g.additionalCSS&&a(this).css(g.additionalCSS)}return this.each(function(){var b=a(this),d=c.length,e=g.showWhenCentered?a(this).height()*g.centerOffsetAnimationRange:a(this).height();a(window).scroll(function(){var f=b.offset().top,h=!(f+b.outerHeight()<=a(window).scrollTop()||f>=a(window).scrollTop()+a(window).height());if(h){if(g.showWhenCentered){var i=parseInt(b.offset().top-a(window).scrollTop()),j=parseInt(i+e/2),k=parseInt(a(window).innerHeight()/2),l=parseInt(j-e),m=parseInt(j+e);if(k=l&&k<=m){var n=Math.max(0,Math.min(1,1-(l+(j-k))/j));d=Math.ceil(g.frames*n)}else d=g.frames}else for(var o=parseInt(b.parent().offset().top-a(window).scrollTop()),p=o*-1+e/2,q=0;q(a||r.height())},_setFocus:function(){(n.st.focus?n.content.find(n.st.focus).eq(0):n.wrap).focus()},_onFocusIn:function(b){if(b.target!==n.wrap[0]&&!a.contains(n.wrap[0],b.target))return n._setFocus(),!1},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),y(f,[b,c,d]),a.each(c,function(a,c){if(c===undefined||c===!1)return!0;e=a.split("_");if(e.length>1){var d=b.find(j+"-"+e[0]);if(d.length>0){var f=e[1];f==="replaceWith"?d[0]!==c[0]&&d.replaceWith(c):f==="img"?d.is("img")?d.attr("src",c):d.replaceWith(''):d.attr(e[1],c)}}else b.find(j+"-"+a).html(c)})},_getScrollbarSize:function(){if(n.scrollbarSize===undefined){var a=document.createElement("div");a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),n.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return n.scrollbarSize}},a.magnificPopup={instance:null,proto:o.prototype,modules:[],open:function(b,c){return A(),b?b=a.extend(!0,{},b):b={},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'',tClose:"Close (Esc)",tLoading:"Loading..."}},a.fn.magnificPopup=function(b){A();var c=a(this);if(typeof b=="string")if(b==="open"){var d,e=p?c.data("magnificPopup"):c[0].magnificPopup,f=parseInt(arguments[1],10)||0;e.items?d=e.items[f]:(d=c,e.delegate&&(d=d.find(e.delegate)),d=d.eq(f)),n._openClick({mfpEl:d},c,e)}else n.isOpen&&n[b].apply(n,Array.prototype.slice.call(arguments,1));else b=a.extend(!0,{},b),p?c.data("magnificPopup",b):c[0].magnificPopup=b,n.addGroup(c,b);return c};var C="inline",D,E,F,G=function(){F&&(E.after(F.addClass(D)).detach(),F=null)};a.magnificPopup.registerModule(C,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){n.types.push(C),w(b+"."+C,function(){G()})},getInline:function(b,c){G();if(b.src){var d=n.st.inline,e=a(b.src);if(e.length){var f=e[0].parentNode;f&&f.tagName&&(E||(D=d.hiddenClass,E=x(D),D="mfp-"+D),F=e.after(E).detach().removeClass(D)),n.updateStatus("ready")}else n.updateStatus("error",d.tNotFound),e=a("
");return b.inlineElement=e,e}return n.updateStatus("ready"),n._parseMarkup(c,{},b),c}}});var H="ajax",I,J=function(){I&&a(document.body).removeClass(I)},K=function(){J(),n.req&&n.req.abort()};a.magnificPopup.registerModule(H,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'The content could not be loaded.'},proto:{initAjax:function(){n.types.push(H),I=n.st.ajax.cursor,w(b+"."+H,K),w("BeforeChange."+H,K)},getAjax:function(b){I&&a(document.body).addClass(I),n.updateStatus("loading");var c=a.extend({url:b.src,success:function(c,d,e){var f={data:c,xhr:e};y("ParseAjax",f),n.appendContent(a(f.data),H),b.finished=!0,J(),n._setFocus(),setTimeout(function(){n.wrap.addClass(k)},16),n.updateStatus("ready"),y("AjaxContentAdded")},error:function(){J(),b.finished=b.loadError=!0,n.updateStatus("error",n.st.ajax.tError.replace("%url%",b.src))}},n.st.ajax.settings);return n.req=a.ajax(c),""}}});var L,M=function(b){if(b.data&&b.data.title!==undefined)return b.data.title;var c=n.st.image.titleSrc;if(c){if(a.isFunction(c))return c.call(n,b);if(b.el)return b.el.attr(c)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'
',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'The image could not be loaded.'},proto:{initImage:function(){var c=n.st.image,d=".image";n.types.push("image"),w(g+d,function(){n.currItem.type==="image"&&c.cursor&&a(document.body).addClass(c.cursor)}),w(b+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),r.off("resize"+j)}),w("Resize"+d,n.resizeImage),n.isLowIE&&w("AfterChange",n.resizeImage)},resizeImage:function(){var a=n.currItem;if(!a||!a.img)return;if(n.st.image.verticalFit){var b=0;n.isLowIE&&(b=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",n.wH-b)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(n.content&&n.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var b=0,c=a.img[0],d=function(e){L&&clearInterval(L),L=setInterval(function(){if(c.naturalWidth>0){n._onImageHasSize(a);return}b>200&&clearInterval(L),b++,b===3?d(10):b===40?d(50):b===100&&d(500)},e)};d(1)},getImage:function(b,c){var d=0,e=function(){b&&(b.img[0].complete?(b.img.off(".mfploader"),b===n.currItem&&(n._onImageHasSize(b),n.updateStatus("ready")),b.hasSize=!0,b.loaded=!0,y("ImageLoadComplete")):(d++,d<200?setTimeout(e,100):f()))},f=function(){b&&(b.img.off(".mfploader"),b===n.currItem&&(n._onImageHasSize(b),n.updateStatus("error",g.tError.replace("%url%",b.src))),b.hasSize=!0,b.loaded=!0,b.loadError=!0)},g=n.st.image,h=c.find(".mfp-img");if(h.length){var i=document.createElement("img");i.className="mfp-img",b.el&&b.el.find("img").length&&(i.alt=b.el.find("img").attr("alt")),b.img=a(i).on("load.mfploader",e).on("error.mfploader",f),i.src=b.src,h.is("img")&&(b.img=b.img.clone()),i=b.img[0],i.naturalWidth>0?b.hasSize=!0:i.width||(b.hasSize=!1)}return n._parseMarkup(c,{title:M(b),img_replaceWith:b.img},b),n.resizeImage(),b.hasSize?(L&&clearInterval(L),b.loadError?(c.addClass("mfp-loading"),n.updateStatus("error",g.tError.replace("%url%",b.src))):(c.removeClass("mfp-loading"),n.updateStatus("ready")),c):(n.updateStatus("loading"),b.loading=!0,b.hasSize||(b.imgHidden=!0,c.addClass("mfp-loading"),n.findImageSize(b)),c)}}});var N,O=function(){return N===undefined&&(N=document.createElement("p").style.MozTransform!==undefined),N};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a=n.st.zoom,d=".zoom",e;if(!a.enabled||!n.supportsTransition)return;var f=a.duration,g=function(b){var c=b.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+a.duration/1e3+"s "+a.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,c.css(e),c},h=function(){n.content.css("visibility","visible")},i,j;w("BuildControls"+d,function(){if(n._allowZoom()){clearTimeout(i),n.content.css("visibility","hidden"),e=n._getItemToZoom();if(!e){h();return}j=g(e),j.css(n._getOffset()),n.wrap.append(j),i=setTimeout(function(){j.css(n._getOffset(!0)),i=setTimeout(function(){h(),setTimeout(function(){j.remove(),e=j=null,y("ZoomAnimationEnded")},16)},f)},16)}}),w(c+d,function(){if(n._allowZoom()){clearTimeout(i),n.st.removalDelay=f;if(!e){e=n._getItemToZoom();if(!e)return;j=g(e)}j.css(n._getOffset(!0)),n.wrap.append(j),n.content.css("visibility","hidden"),setTimeout(function(){j.css(n._getOffset())},16)}}),w(b+d,function(){n._allowZoom()&&(h(),j&&j.remove(),e=null)})},_allowZoom:function(){return n.currItem.type==="image"},_getItemToZoom:function(){return n.currItem.hasSize?n.currItem.img:!1},_getOffset:function(b){var c;b?c=n.currItem.img:c=n.st.zoom.opener(n.currItem.el||n.currItem);var d=c.offset(),e=parseInt(c.css("padding-top"),10),f=parseInt(c.css("padding-bottom"),10);d.top-=a(window).scrollTop()-e;var g={width:c.width(),height:(p?c.innerHeight():c[0].offsetHeight)-f-e};return O()?g["-moz-transform"]=g.transform="translate("+d.left+"px,"+d.top+"px)":(g.left=d.left,g.top=d.top),g}}});var P="iframe",Q="//about:blank",R=function(a){if(n.currTemplate[P]){var b=n.currTemplate[P].find("iframe");b.length&&(a||(b[0].src=Q),n.isIE8&&b.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(P,{options:{markup:'
',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){n.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(b+"."+P,function(){R()})},getIframe:function(b,c){var d=b.src,e=n.st.iframe;a.each(e.patterns,function(){if(d.indexOf(this.index)>-1)return this.id&&(typeof this.id=="string"?d=d.substr(d.lastIndexOf(this.id)+this.id.length,d.length):d=this.id.call(this,d)),d=this.src.replace("%id%",d),!1});var f={};return e.srcAction&&(f[e.srcAction]=d),n._parseMarkup(c,f,b),n.updateStatus("ready"),c}}});var S=function(a){var b=n.items.length;return a>b-1?a-b:a<0?b+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=n.st.gallery,d=".mfp-gallery",e=Boolean(a.fn.mfpFastClick);n.direction=!0;if(!c||!c.enabled)return!1;u+=" mfp-gallery",w(g+d,function(){c.navigateByImgClick&&n.wrap.on("click"+d,".mfp-img",function(){if(n.items.length>1)return n.next(),!1}),s.on("keydown"+d,function(a){a.keyCode===37?n.prev():a.keyCode===39&&n.next()})}),w("UpdateStatus"+d,function(a,b){b.text&&(b.text=T(b.text,n.currItem.index,n.items.length))}),w(f+d,function(a,b,d,e){var f=n.items.length;d.counter=f>1?T(c.tCounter,e.index,f):""}),w("BuildControls"+d,function(){if(n.items.length>1&&c.arrows&&!n.arrowLeft){var b=c.arrowMarkup,d=n.arrowLeft=a(b.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(m),f=n.arrowRight=a(b.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(m),g=e?"mfpFastClick":"click";d[g](function(){n.prev()}),f[g](function(){n.next()}),n.isIE7&&(x("b",d[0],!1,!0),x("a",d[0],!1,!0),x("b",f[0],!1,!0),x("a",f[0],!1,!0)),n.container.append(d.add(f))}}),w(h+d,function(){n._preloadTimeout&&clearTimeout(n._preloadTimeout),n._preloadTimeout=setTimeout(function(){n.preloadNearbyImages(),n._preloadTimeout=null},16)}),w(b+d,function(){s.off(d),n.wrap.off("click"+d),n.arrowLeft&&e&&n.arrowLeft.add(n.arrowRight).destroyMfpFastClick(),n.arrowRight=n.arrowLeft=null})},next:function(){n.direction=!0,n.index=S(n.index+1),n.updateItemHTML()},prev:function(){n.direction=!1,n.index=S(n.index-1),n.updateItemHTML()},goTo:function(a){n.direction=a>=n.index,n.index=a,n.updateItemHTML()},preloadNearbyImages:function(){var a=n.st.gallery.preload,b=Math.min(a[0],n.items.length),c=Math.min(a[1],n.items.length),d;for(d=1;d<=(n.direction?c:b);d++)n._preloadItem(n.index+d);for(d=1;d<=(n.direction?b:c);d++)n._preloadItem(n.index-d)},_preloadItem:function(b){b=S(b);if(n.items[b].preloaded)return;var c=n.items[b];c.parsed||(c=n.parseEl(b)),y("LazyLoad",c),c.type==="image"&&(c.img=a('').on("load.mfploader",function(){c.hasSize=!0}).on("error.mfploader",function(){c.hasSize=!0,c.loadError=!0,y("LazyLoadError",c)}).attr("src",c.src)),c.preloaded=!0}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=n.st.retina,b=a.ratio;b=isNaN(b)?b():b,b>1&&(w("ImageHasSize."+U,function(a,c){c.img.css({"max-width":c.img[0].naturalWidth/b,width:"100%"})}),w("ElementParse."+U,function(c,d){d.src=a.replaceSrc(d,b)}))}}}}),function(){var b=1e3,c="ontouchstart"in window,d=function(){r.off("touchmove"+f+" touchend"+f)},e="mfpFastClick",f="."+e;a.fn.mfpFastClick=function(e){return a(this).each(function(){var g=a(this),h;if(c){var i,j,k,l,m,n;g.on("touchstart"+f,function(a){l=!1,n=1,m=a.originalEvent?a.originalEvent.touches[0]:a.touches[0],j=m.clientX,k=m.clientY,r.on("touchmove"+f,function(a){m=a.originalEvent?a.originalEvent.touches:a.touches,n=m.length,m=m[0];if(Math.abs(m.clientX-j)>10||Math.abs(m.clientY-k)>10)l=!0,d()}).on("touchend"+f,function(a){d();if(l||n>1)return;h=!0,a.preventDefault(),clearTimeout(i),i=setTimeout(function(){h=!1},b),e()})})}g.on("click"+f,function(){h||e()})})},a.fn.destroyMfpFastClick=function(){a(this).off("touchstart"+f+" click"+f),c&&r.off("touchmove"+f+" touchend"+f)}}(),A()}) /** * v1.3 - Copyright 2015 Madden Media - All rights reserved. * * Global frameworks functions for all content. */ "undefined"!=typeof console&&console.log("%c NOTICE: madden-content-frameworks-v1.3.js is deprecated - please use the latest version.","background:orange; color:black");var _stickyTopBarHeight=0,_stickyTopBarOffset=0,_chapterTops=new Array,_onChapter=0,_setChapterLinkCallback,_chapterSetCompleteCallback,_stickyTopBarEl="#topBar",_stickyTopBarProgressBarEl,_mobileMenuEl="#mobileMenu",_socialMenuTriggerEl="#socialLinksTrigger",_topAndMobileMenuControl="#controlsTrigger",_chapterEl=".chapter",_chapterLinkEl=".chapterLink",_chapterElPrefix="#c",_multiSizeImageEl=".multiSize",_readMoreEl=void 0,DEFAULT_MOBILE_TEST_EL="#isMobile",DEFAULT_TABLET_TEST_EL="#isTablet",DEFAULT_PARALLAX_TEST_EL="#doParallax",IS_RESPONSIVE=document.addEventListener,_isMobile=!1,_isTablet=!1,_doParallax=!1;frameworksOnReady=function(a,b,c){initViewTypes(),initLayout(a,b,c)},frameworksOnScroll=function(){adjustScrollProgress()},frameworksOnTouchMove=function(){adjustScrollProgress()},frameworksOnResize=function(){initViewTypes(),adjustLayoutAfterResize()},initViewTypes=function(){_isMobile=0!=$(DEFAULT_MOBILE_TEST_EL).length&&"none"!=$(DEFAULT_MOBILE_TEST_EL).css("float"),_isTablet=0!=$(DEFAULT_TABLET_TEST_EL).length&&"none"!=$(DEFAULT_TABLET_TEST_EL).css("float"),_doParallax=0!=$(DEFAULT_PARALLAX_TEST_EL).length&&"none"!=$(DEFAULT_PARALLAX_TEST_EL).css("float")},initLayout=function(a,b,c){if(void 0!=a&&(_setChapterLinkCallback=a.setChapterLinkCallback||_setChapterLinkCallback,_chapterSetCompleteCallback=a.chapterSetCompleteCallback||_chapterSetCompleteCallback),void 0!=b&&(_stickyTopBarEl=b.topBar||_stickyTopBarEl,_mobileMenuEl=b.mobileMenuEl||_mobileMenuEl,_socialMenuTriggerEl=b.socialMenuTriggerEl||_socialMenuTriggerEl,_topAndMobileMenuControl=b.topAndMobileMenuControl||_topAndMobileMenuControl,_chapterEl=b.chapterEl||_chapterEl,_chapterLinkEl=b.chapterLinkEl||_chapterLinkEl,_chapterElPrefix=b.chapterElPrefix||_chapterElPrefix,_multiSizeImageEl=b.multiSizeImageEl||_multiSizeImageEl,_readMoreEl=b.readMoreEl||_readMoreEl),$(_mobileMenuEl).length){var d=$(_mobileMenuEl),e=d.data("chapters"),f=d.data("top-link"),g=d.data("close-trigger");try{$(g).click(function(){toggleMobileMenu(_mobileMenuEl,_topAndMobileMenuControl)}),$(f).click(function(){toTop(),toggleMobileMenu(_mobileMenuEl,_topAndMobileMenuControl)}),$(e).children("div").each(function(a){$(this).click(function(){toggleMobileMenu(_mobileMenuEl,_topAndMobileMenuControl);var b=$(this).data("chapter");"undefined"==typeof b?goToChapter(a+1):goToChapter(parseInt(b))})})}catch(a){console.log(a)}}if($(_socialMenuTriggerEl).length){var h=$(_socialMenuTriggerEl),i=h.data("social-links"),j=h.data("social-links-class-off"),k=h.data("social-links-class-on"),l=h.data("trigger-class-off"),m=h.data("trigger-class-on");try{var n=$(i);getIsDesktop()?n.on("mouseenter",function(a){h.attr("class",m)}).on("mouseleave",function(a){h.attr("class",l)}):$(document).on("touchstart",i,function(a){n.attr("class",k),h.attr("class",m)}).on("touchend",function(){n.attr("class",j),h.attr("class",l)}).on("touchcancel",function(){n.attr("class",j),h.attr("class",l)})}catch(a){console.log(a)}}$(".socialShare").each(function(){var a=$(this).attr("class"),b="#";if(a.indexOf("pinterest")!=-1){var c=$(this).data("ogimage");b=buildSocialShareLink("PINTEREST",c)}else a.indexOf("twitter")!=-1?b=buildSocialShareLink("TWITTER",null):a.indexOf("facebook")!=-1&&(b=buildSocialShareLink("FACEBOOK",null));$(this).attr("href",b)}),$(_stickyTopBarEl).length&&(_stickyTopBarHeight=$(_stickyTopBarEl).height(),void 0!=$(_stickyTopBarEl).data("offset-el")&&0!=$($(_stickyTopBarEl).data("offset-el")).length&&(_stickyTopBarOffset=$($(_stickyTopBarEl).data("offset-el")).offset().top),void 0!=$(_stickyTopBarEl).data("progress-bar-el")&&0!=$($(_stickyTopBarEl).data("progress-bar-el")).length&&(_stickyTopBarProgressBarEl=$(_stickyTopBarEl).data("progress-bar-el"))),void 0!=_readMoreEl&&($.isArray(_readMoreEl)||(_readMoreEl=[_readMoreEl]),$.each(_readMoreEl,function(a,b){$(b).click(function(){var a=0;void 0!=$(b).data("offset-el")&&0!=$($(b).data("offset-el")).length&&(a=$($(b).data("offset-el")).offset().top),$("html, body").animate({scrollTop:a-_stickyTopBarHeight},300)})})),adjustMultiSizedImages(),c&&initChapterTops(!0),$(_chapterLinkEl).click(function(){var a=$(this).data("chapter");if("undefined"!=typeof a)goToChapter(parseInt(a));else{$(this.hash);goToChapter(this.hash.substr(1))}return!1})},initChapterTops=function(a){var b=new Array;$(_chapterEl).each(function(a){b[a]=Math.floor($(this).offset().top-_stickyTopBarHeight)}),_chapterTops=b,a&&adjustScrollProgress()},buildSocialShareLink=function(a,b){var c="",d=[location.protocol,"//",location.host,location.pathname].join(""),e=encodeURIComponent(d),f=encodeURIComponent(document.title),g=encodeURIComponent(b);switch(a){case"FACEBOOK":c="https://www.facebook.com/sharer/sharer.php?u="+e;break;case"PINTEREST":c="https://www.pinterest.com/pin/create/button/?description="+f+"&url="+e+"&media="+g;break;case"TWITTER":c="https://twitter.com/intent/tweet?text="+f+"%3A%20"+e+"&source=webclient"}return c},getCurrentChapter=function(){return _onChapter},getVisibleViewport=function(a){return a?window.innerHeight-_stickyTopBarHeight+"px":parseInt(window.innerHeight-_stickyTopBarHeight)},getViewportOffset=function(a,b){return b?$(a).offset().top-$(window).scrollTop()-_stickyTopBarHeight+"px":parseInt($(a).offset().top-$(window).scrollTop()-_stickyTopBarHeight)},getItemInViewport=function(a){var b=$(a).offset().top;return!(b+$(a).outerHeight()<=$(window).scrollTop()||b>=$(window).scrollTop()+$(window).height())},getItemInViewportCenter=function(a,b){var c=$(a).offset().top,d=$(window).height()/2;return b=b||0,!(c>=$(window).scrollTop()+d+b||c<=$(window).scrollTop()+d-b)},getStickyTopBarHeight=function(){return _stickyTopBarHeight},getIsMobile=function(){return _isMobile},getIsTablet=function(){return _isTablet},getDoParallax=function(){return _doParallax},getIsDesktop=function(){return!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},getIsIPad=function(){return navigator.userAgent.match(/iPad;.*CPU.*OS/i)},getIsResponsive=function(){return IS_RESPONSIVE},adjustLayoutAfterResize=function(){initChapterTops(!0),adjustMultiSizedImages()},adjustChapterLinksArtHeight=function(a,b){$(a).css("height",$(b).outerHeight())},adjustSizeToParentAndViewport=function(a,b){$(a).css("height",getVisibleViewport(!0)),$(a).css("width",$(b).width())},adjustScrollProgress=function(){if(0!=$(_stickyTopBarProgressBarEl).length){var e,a=-1,b=$(document).height(),c=$("body").height(),d=b-c-_stickyTopBarOffset;e=Math.round(($(document).scrollTop()-_stickyTopBarOffset)/d*100),$(_stickyTopBarProgressBarEl).css("width",e+"%");for(var f=_chapterTops.length-1;f>=0;f--)if($(document).scrollTop()>=_chapterTops[f]){a=f+1;break}return a!=-1&&adjustChapterLinks(a),a}},adjustChapterLinks=function(a){$(_chapterLinkEl).each(function(){$(this).attr("href")!="#"+a?"function"==typeof _setChapterLinkCallback&&_setChapterLinkCallback(this,!1):("function"==typeof _setChapterLinkCallback&&_setChapterLinkCallback(this,!0),_onChapter=a)})},adjustMultiSizedImages=function(){var a=$(_multiSizeImageEl);a.length&&a.each(function(){getIsResponsive()||void 0==$(this).data("src-legacy")?getIsMobile()&&void 0!=$(this).data("src-small")?$(this).attr("src",$(this).data("src-small")):getIsTablet()&&void 0!=$(this).data("src-medium")?$(this).attr("src",$(this).data("src-medium")):void 0!=$(this).data("src")&&$(this).attr("src",$(this).data("src")):$(this).attr("src",$(this).data("src-legacy"))})},toTop=function(){$("html, body").animate({scrollTop:0},600)},runTopMenuControl=function(){getIsMobile()?toggleMobileMenu(_mobileMenuEl,_topAndMobileMenuControl):toTop()},toggleMobileMenu=function(a,b){getIsMobile()&&($(a).toggle("fast"),$(b).toggle("fast"))},goToChapter=function(a){var b=$(_chapterElPrefix+a),c=b.offset().top-_stickyTopBarHeight+1,d=_onChapter>a?_onChapter-a:a-_onChapter,e=Math.floor(1e3/(_chapterTops.length-(_chapterTops.length-d)));$("html, body").animate({scrollTop:c},e,function(){adjustChapterLinks(a),"function"==typeof _chapterSetCompleteCallback&&_chapterSetCompleteCallback(a)}),_onChapter=a},animateOverflowContent=function(a,b,c,d,e){if(e==_onChapter){var f=$(a).css("background-position").split(" "),g=isNaN(b)?b:b+parseInt(f[0])+"px",h=isNaN(c)?c:c+parseInt(f[1])+"px";$(a).css({"background-position":g+" "+h})}window.setTimeout(function(){animateOverflowContent(a,b,c,d,e)},d)},cycleImages=function(a,b){var c=$(a+" .active"),d=c.next().length>0?c.next():$(a+" img:first");d.css("z-index",2),c.fadeOut(b,function(){c.css("z-index",1).show().removeClass("active"),d.css("z-index",3).addClass("active")})}; /** * v1.0 - Copyright 2014 Madden Media - All rights reserved. * * Content-specific layout functionality. These functions * make many assumptions about content contained in the page. * * NOTE: Assumes that madden-content-frameworks-v1.0.js has been loaded and * that the initial view types (mobile, tablet, etc.) have been defined. */ // for the link gatherer (the directory where the story is housed) var me = "foodies"; // mobile can call resize during scroll - we can cache width // and check if an actual resize happens var _winWidth = 0; ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // STOCK EVENT FUNCTIONS ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // // Called on document ready // contentOnReady = function () { // set the window width _winWidth = $(window).width(); // parallax effects if (getDoParallax()) { // parallax bgs $("#ci0").parallaxBG({ adjustY: .16, bgXPosition: 'center' }); $("#ci3").parallaxBG({ adjustY: .12, bgXPosition: 'center' }); $("#ci4").parallaxBG({ adjustY: .16, bgXPosition: 'center' }); // bunch of fades $("#c1Float").parallaxAnimateElement({ frames: 8, startOffset: "-30%", endOffset: "140%", lock: false, parentEl: "#c1Text", elementClass: "floatingElement floatRight" }); $("#c1Pull").parallaxAnimateElement({ frames: 8, startOffset: "-20%", endOffset: "150%", lock: false, parentEl: "#c1Text", elementClass: "pullQuote multiSize" }); $("#c2Float").parallaxAnimateElement({ frames: 8, startOffset: "-40%", endOffset: "150%", lock: false, parentEl: "#c2Text", elementClass: "floatingElement floatRight" }); $("#c2Pull").parallaxAnimateElement({ frames: 8, startOffset: "-20%", endOffset: "150%", lock: false, parentEl: "#c2Text", elementClass: "pullQuote multiSize" }); $("#c3Float1").parallaxAnimateElement({ frames: 8, startOffset: "-60%", endOffset: "150%", lock: false, parentEl: "#c3Text", elementClass: "floatingElement floatRight" }); $("#c3Float2").parallaxAnimateElement({ frames: 8, startOffset: "-30%", endOffset: "150%", lock: false, parentEl: "#c3Text", elementClass: "floatingElement floatRight" }); $("#c3Pull").parallaxAnimateElement({ frames: 8, startOffset: "0%", endOffset: "150%", lock: false, parentEl: "#c3Text", elementClass: "pullQuote multiSize" }); $("#c4Pull1").parallaxAnimateElement({ frames: 8, startOffset: "-80%", endOffset: "150%", lock: false, parentEl: "#c4Text", elementClass: "pullQuote multiSize" }); $("#c4Float1").parallaxAnimateElement({ frames: 8, startOffset: "-60%", endOffset: "150%", lock: false, parentEl: "#c4Text", elementClass: "floatingElement floatRight" }); $("#c4Pull2").parallaxAnimateElement({ frames: 8, startOffset: "-40%", endOffset: "150%", lock: false, parentEl: "#c4Text", elementClass: "pullQuote multiSize" }); $("#c4Float2").parallaxAnimateElement({ frames: 8, startOffset: "-20%", endOffset: "150%", lock: false, parentEl: "#c4Text", elementClass: "floatingElement floatRight" }); // exit link for faded item $("#c4Pull").click(function () { self.location.href = 'http://www.visitomaha.com/things-to-do/nightlife/?utm_source=madden&utm_medium=content&utm_campaign=cmneomaha15&utm_content=nightlife'; }); // listen to the end of the video $("#v0").on("ended", function(){ // and fade it out $("#v0").fadeOut(); // and fade in the next step $("#ci0Title").fadeIn(); $("#readMore").fadeIn(); }); } // get the links for this story from the related // madden content omaha linker script that was imported var total = (getIsMobile()) ? 3 : 4; var links = returnAlsoLinkLinks(me, total); // populate if (links.length == 0) { // something went wrong $("#alsoLike").css("display", "none"); $("#alsoLikeLinkWrap").css("display", "none"); } else { for (var link in links) { $("#alsoLikeLinkWrap").append( '' ); } } // prep the carousel if ( (! getIsTablet()) && (! getIsMobile()) ) { var carousel = $("#carousel"); var panelCount = 5; var theta = 0; var showing = 1; var move = 1; // ie can't do the css3 schmancy - give them a lightbox slideshow instead if (customBrowserIsIE()) { $("#carouselWrapper").css("display", "none"); $("#lightbox").css("display", "block"); $("#lightbox").magnificPopup({ items: [ { src: '//maddencdn.com/content/images/2015/omaha/nightlife/ch3-slideshow1-lg.jpg' }, { src: '//maddencdn.com/content/images/2015/omaha/nightlife/ch3-slideshow2-lg.jpg' }, { src: '//maddencdn.com/content/images/2015/omaha/nightlife/ch3-slideshow3-lg.jpg' }, { src: '//maddencdn.com/content/images/2015/omaha/nightlife/ch3-slideshow4-lg.jpg' }, { src: '//maddencdn.com/content/images/2015/omaha/nightlife/ch3-slideshow5-lg.jpg' } ], gallery: { enabled: true }, type: 'image' }); } else { // start off with some styles customAdjustCarouselPanelStyles(showing); // nav listeners $(".carouselNav").bind("click touchstart", function (e) { // rotate the carousel var increment = (move * parseInt($(this).data("increment"))); theta += ((360 / panelCount ) * increment * -1); carousel.css("transform", ("rotateY(" + theta + "deg)")); // which one are we on? showing += (move * increment); // at start or end? showing = (showing == 0) ? panelCount : showing; showing = (showing > panelCount) ? 1 : showing; // adjust panel styles customAdjustCarouselPanelStyles(showing); }); } } else { // time crunch - mobile will get lightbox :-/ $("#lightbox").magnificPopup({ items: [ { src: '//maddencdn.com/content/images/2015/omaha/nightlife/ch3-slideshow1-lg.jpg' }, { src: '//maddencdn.com/content/images/2015/omaha/nightlife/ch3-slideshow2-lg.jpg' }, { src: '//maddencdn.com/content/images/2015/omaha/nightlife/ch3-slideshow3-lg.jpg' }, { src: '//maddencdn.com/content/images/2015/omaha/nightlife/ch3-slideshow4-lg.jpg' }, { src: '//maddencdn.com/content/images/2015/omaha/nightlife/ch3-slideshow5-lg.jpg' } ], gallery: { enabled: true }, type: 'image' }); } // adjust the layout customAdjustLayout(true); // restore analytics url param order by removing extraneous cms hash addition var badHashRegEx = /#\..*\?/; $("a").each(function () { var attr = $(this).attr("href"); if (attr.indexOf("#.") != -1) { $(this).attr("href", attr.replace(badHashRegEx, "?")); } }); // add the complete class to the loader $('#loading').addClass('complete'); } // // Called on document scroll // contentOnScroll = function () { // hide and pause the video if we don't need it showing (improves performance/layout) if (getDoParallax()) { if ($("#v0").length) { // this one fades once after playing, so if they scroll, they just miss it if (! getItemInViewport("#ci0")) { $("#v0").css("display", "none"); } else { // make sure this stuff appears $("#ci0Title").fadeIn(); $("#readMore").fadeIn(); } } } } // // Called on a touch move on mobile // contentOnTouchMove = function () { } // // Called on document resize // contentOnResize = function () { customAdjustLayout(); } ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // CUSTOM FUNCTIONS ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // // The frameworks was given this function to handle setting chapter buttons // when the chapter is set // // chapterEl: The chapter link DOM element // on: Is it being turned on? (true|false) // customChapterLinkAdjust = function (chapterEl, on) { $(chapterEl).attr("class", ((on) ? "navLink chapterLink noGA on" : "navLink chapterLink noGA")); } // // Adjust this specific layout after a load or resize event // // isLoad: Is this being called by a load or resize event? // customAdjustLayout = function (isLoad) { var localNotJustTouchScroll = isLoad; var pWidth = $("#c1Text > p:first-of-type").css("width"); // is it really a resize? if ($(window).width() != _winWidth) { // yes localNotJustTouchScroll = true; _winWidth = $(window).width(); } if ( (localNotJustTouchScroll) && (getIsMobile()) ) { // adjust inline images to text width $(".mobileImage").css("width", pWidth); } // some logic for the video if (getDoParallax()) { // if we're showing the video, set that src here (avoids unnecessary loading) if ($("#v0").length) { if (isLoad) { $("#v0").attr("src", "https://maddencdn.com/content/multimedia/2015/omaha/foodies/foodies.mp4"); $("#v0")[0].play(); } } else { $("#v0").css("display", "none"); } } } // // Adjusts the carousel as the user uses it // customAdjustCarouselPanelStyles = function (showing) { var carousel = $("#carousel"); var transformOnClass = "on"; carousel.children().each(function (c) { // adjust fade for item we're not on var fade = 1.0; var transform = transformOnClass; // which one is it? if ( (showing == 1) && ((c + 1) == carousel.children().length) ) { // on the first one - fade the last one fade = 0.3; transform = ""; } else if ( (showing == carousel.children().length) && (c == 0) ) { // on the last one - fade the first one fade = 0.3; transform = ""; } else if ( (c == showing) || ((c + 2) == showing) ) { // one to the left or right fade = 0.3; transform = ""; } else if ((c + 1) != showing) { // the rest fade = 0.0; } // apply transform $(this).removeClass(transformOnClass); if (transform != "") { $(this).addClass(transform); } $(this).delay(100).fadeTo("slow", fade); }); } // // The carousel uses this. Don't like it, but let's not deny non-ie users a cool galery // customBrowserIsIE = function () { return ( (navigator.userAgent.indexOf("MSIE ") > -1) || (navigator.userAgent.indexOf("Trident/") > -1) || (navigator.userAgent.indexOf("Edge/") > -1) ); } /** * v1.0 - Copyright 2015 Madden Media - All rights reserved. * * Custom script to return "you may also like" footer links per story */ var ALSO_LIKE_DATA = [ { "key": "animal_adventures", "links": [ { "img": "5-ways-related-stories.png", "link": "http://www.midwestliving.com/blog/travel/5-ways-to-enjoy-omahas-new-garden-under-glass" }, { "img": "activities-kids-related-stories.png", "link": "http://www.momentsthattake.com/2014/09/activities-for-kids-in-omaha-visiting.html" }, { "img": "cityguide-related-stories.png", "link": "http://youmeandcharlie.com/explore/cityguideymc-omaha/" }, { "img": "durham-museum-related-stories.png", "link": "http://smslwithheidi.com/2014/10/durham-museum.html" } ] }, { "key": "love_walk", "links": [ { "img": "animal-adventures.png", "link": "http://www.visitomaha.com/things-to-do/stories/animal-adventures/" }, { "img": "10-reasons-nebraska.png", "link": "https://www.goeatgive.com/10-reasons-to-visit-nebraska-the-new-midwest/" }, { "img": "cityguide-related-stories.png", "link": "http://youmeandcharlie.com/explore/cityguideymc-omaha/" }, { "img": "omaha-craft-brewery-tour.png", "link": "http://www.iowafoodie.com/home/2014/10/21/omaha-craft-brewery-tour-upstream-and-borgata.html" } ] }, { "key": "hiking_biking", "links": [ { "img": "animal-adventures.png", "link": "http://www.visitomaha.com/things-to-do/stories/animal-adventures/" }, { "img": "love-walk.png", "link": "http://www.visitomaha.com/things-to-do/stories/love-walk/" }, { "img": "10-reasons-nebraska.png", "link": "https://www.goeatgive.com/10-reasons-to-visit-nebraska-the-new-midwest/" }, { "img": "cityguide-related-stories.png", "link": "http://youmeandcharlie.com/explore/cityguideymc-omaha/" } ] }, { "key": "girlfriend_getaway", "links": [ { "img": "animal-adventures.png", "link": "http://www.visitomaha.com/things-to-do/stories/animal-adventures/" }, { "img": "love-walk.png", "link": "http://www.visitomaha.com/things-to-do/stories/love-walk/" }, { "img": "10-reasons-nebraska.png", "link": "https://www.goeatgive.com/10-reasons-to-visit-nebraska-the-new-midwest/" }, { "img": "cityguide-related-stories.png", "link": "http://youmeandcharlie.com/explore/cityguideymc-omaha/" } ] }, { "key": "nightlife", "links": [ { "img": "animal-adventures.png", "link": "http://www.visitomaha.com/things-to-do/stories/animal-adventures/" }, { "img": "love-walk.png", "link": "http://www.visitomaha.com/things-to-do/stories/love-walk/" }, { "img": "10-reasons-nebraska.png", "link": "https://www.goeatgive.com/10-reasons-to-visit-nebraska-the-new-midwest/" }, { "img": "cityguide-related-stories.png", "link": "http://youmeandcharlie.com/explore/cityguideymc-omaha/" } ] }, { "key": "foodies", "links": [ { "img": "midtown.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/midtown/" }, { "img": "old-market.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/old-market/" }, { "img": "love-walk.png", "link": "http://www.visitomaha.com/things-to-do/stories/love-walk/" }, { "img": "hiking-biking.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/hiking-biking" }, ] }, { "key": "craftbeer", "links": [ { "img": "old-market.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/old-market/" }, { "img": "midtown.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/midtown/" }, { "img": "foodies.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/foodies" }, { "img": "love-walk.png", "link": "http://www.visitomaha.com/things-to-do/stories/love-walk/" } ] }, { "key": "benson", "links": [ { "img": "foodies.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/foodies" }, { "img": "midtown.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/midtown/" }, { "img": "animal-adventures.png", "link": "http://www.visitomaha.com/things-to-do/stories/animal-adventures/" }, { "img": "love-walk.png", "link": "http://www.visitomaha.com/things-to-do/stories/love-walk/" } ] }, { "key": "historic-omaha", "links": [ { "img": "animal-adventures.png", "link": "http://www.visitomaha.com/things-to-do/stories/animal-adventures/" }, { "img": "related-stories-benson.png", "link": "http://www.visitomaha.com/things-to-do/stories/benson/" }, { "img": "old-market.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/old-market/" }, { "img": "hiking-biking.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/hiking-biking" } ] }, { "key": "historic", "links": [ { "img": "animal-adventures.png", "link": "http://www.visitomaha.com/things-to-do/stories/animal-adventures/" }, { "img": "hiking-biking.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/hiking-biking" }, { "img": "related-stories-benson.png", "link": "http://www.visitomaha.com/things-to-do/stories/benson/" }, { "img": "love-walk.png", "link": "http://www.visitomaha.com/things-to-do/stories/love-walk/" } ] }, { "key": "art", "links": [ { "img": "animal-adventures.png", "link": "http://www.visitomaha.com/things-to-do/stories/animal-adventures/" }, { "img": "hiking-biking.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/hiking-biking" }, { "img": "related-stories-benson.png", "link": "http://www.visitomaha.com/things-to-do/stories/benson/" }, { "img": "love-walk.png", "link": "http://www.visitomaha.com/things-to-do/stories/love-walk/" } ] }, { "key": "holidays", "links": [ { "img": "old-market.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/old-market/" }, { "img": "foodies.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/foodies" }, { "img": "related-stories-benson.png", "link": "http://www.visitomaha.com/things-to-do/stories/benson/" }, { "img": "art.jpg", "link": "http://www.visitomaha.com/things-to-do/stories/omaha-arts/" }, ] } ]; var IMG_URL_PREFIX = "//maddencdn.com/content/images/2015/omaha/global/"; var UTM_TAGS = "utm_source=madden&utm_medium=content&utm_campaign=cmneomaha15&utm_content=hub"; // // Goes through the data and returns the links for the given key // // key: The key to match up to // returnTotal: the number of links to return // returnAlsoLinkLinks = function (key, returnTotal) { var rhett = []; var count = 0; for (var ad in ALSO_LIKE_DATA) { if (ALSO_LIKE_DATA[ad]["key"] == key) { // loop and update the image path (lazy) for (var ld in ALSO_LIKE_DATA[ad]["links"]) { var img = (IMG_URL_PREFIX + ALSO_LIKE_DATA[ad]["links"][ld]["img"]); var link = ALSO_LIKE_DATA[ad]["links"][ld]["link"]; // add utm tags link += (link.indexOf("?") == -1) ? "?" : "&"; link += UTM_TAGS; // add it to the list rhett.push({ "img": img, "link": link }); // count count++; if (count == returnTotal) { break; } } break; } } return rhett; }