KEEP MIAMI NEW TIMES FREE…
Since we started Miami New Times, it has been defined as the free, independent voice of Miami, and we’d like to keep it that way. With local media under siege, it’s more important than ever for us to rally support behind funding our local journalism. You can help by participating in our “I Support” program, allowing us to keep offering readers access to our incisive coverage of local news, food and culture with no paywalls.
‘, ‘fetching’) },
success: function (data) {
// console.log(data.result, data.error, data)
if (data) {
if (data.error) {
// presentResult(‘Trouble loading content.’, ‘error’)
}
else if (data.result) {
presentResult(data.result, ‘remove’, function () {
cmInstance.queue.push(function () {
if (typeof apntag === ‘object’) {
apntag.anq.push(function() {
if (typeof Foundation.ApnAds.fillAds === ‘function’) {
Foundation.ApnAds.fillAds()
}
})
}
})
cmInstance.queue.push(reflowRightColumnItems)
})
}
else {
// presentResult(‘How did we get here?’, ‘error’)
}
}
else {
// presentResult(‘No result or error returned from content request.’, ‘error’)
}
},
complete: function () {
fireEvent(‘foundation:multiitem:itemLoaded’, { objId: contentOid })
cmInstance.queue.push(fetchUnloadedItems)
},
error: function (error) {
// presentResult(‘Ajax request error.’, ‘error’)
}
})
}
}
cmInstance.queue.push(reflowRightColumnItems)
cmInstance.queue.push(fetchUnloadedItems)
var reflowSensor = new ResizeSensor(cmInstance.items[0], reflowRightColumnItems)
jQuery(document).on(‘scroll resize’, function () {
// Prevent rapid firing of event stuff
clearTimeout(onScrollTimeout)
onScrollTimeout = setTimeout(function() {
// console.log(‘Foundation.MultiItem onScroll event’)
updateFurthestDownInView()
}, 100);
})
jQuery(document).on(‘foundation:multiitem:itemchange’, function () {
// Prevent rapid firing of event stuff
clearTimeout(onItemChangeTimeout)
onItemChangeTimeout = setTimeout(function() {
// console.log(‘Foundation.MultiItem foundation:multiitem:itemchange event ‘)
cmInstance.onItemChange()
}, 100);
})
};
Foundation.MultiItems = Foundation.MultiItems || {
add: function (multiItem) {
Foundation.MultiItems[multiItem.id] = multiItem;
}
};
Foundation.MultiItems.add(new Foundation.MultiItem({
id: ‘ContentRowMultiple’,
onItemChange: function () {
if (this.currentPermaLink) {
var state = {}
var title = ”
var url = this.currentPermaLink
history.pushState(state, title, url)
}
if (this.currentCanonical) {
document.querySelector(‘meta[property*=og\:url]’).href = this.currentCanonical
document.querySelector(‘link[rel*=canonical]’).href = this.currentCanonical
}
if (this.currentThumb) {
document.querySelector(‘link[rel*=image_src]’).href = this.currentThumb
document.querySelector(‘meta[name*=thumbnail]’).content = this.currentThumb
document.querySelector(‘meta[property*=og\:image]’).content = this.currentThumb
document.querySelector(‘meta[name*=twitter\:image]’).content = this.currentThumb
}
if (this.currentTitle) {
document.querySelector(‘title’).text = this.currentTitle
}
// Google track pageview
if (typeof ga === ‘function’) {
ga(‘set’, ‘location’, window.location.href)
for (let i = 2; i <= 10; i++) {
let currentDimension = jQuery(Foundation.MultiItems[“ContentRowMultiple”].currentItem).attr(‘ga-dimension’+i)
if (typeof currentDimension === ‘string’) {
ga(‘set’, ‘dimension’ + i, currentDimension)
}
else {
ga(‘set’, ‘dimension’ + i, ”)
}
}
ga(‘send’, ‘pageview’)
// // Track when scrolling to another item
// const multiItemIndex = jQuery(Foundation.MultiItems[“ContentRowMultiple”].currentItem).attr(‘fdn-content-multi-item-index’)
// if (multiItemIndex.match(/[23456789]/) !== null) {
// ga(“send”, “event”, “Article”, “ArticleScrolled”, multiItemIndex);
// /* console.log(`sending ArticleScrolled ${multiItemIndex}`); */
// }
}
// Chartbeat track pageview
if (typeof pSUPERFLY === ‘object’) {
pSUPERFLY.virtualPage({
sections: jQuery(Foundation.MultiItems[“ContentRowMultiple”].currentItem).attr(‘ga-dimension2’) || ”,
authors: jQuery(Foundation.MultiItems[“ContentRowMultiple”].currentItem).attr(‘ga-dimension6’) || ”,
path: window.location.path,
title: Foundation.MultiItems[“ContentRowMultiple”].currentTitle || ”
})
}
}
}))
// // Track the first item on load.
// jQuery(() => {
// if (typeof ga === ‘function’) {
// const multiItemIndex = jQuery(Foundation.MultiItems[“ContentRowMultiple”].currentItem).attr(‘fdn-content-multi-item-index’)
// if (multiItemIndex.match(/d/) !== null) {
// ga(“send”, “event”, “Article”, “ArticleScrolled”, multiItemIndex)
// }
// }
// })
//
if (typeof Foundation.Content !== ‘object’) {
//
function throwInExtraInsertions (oid) {
var startIndex = 16;
var objId = oid;
var myBodyElement = jQuery(`[fdn-content-multi-item=”${objId}”] .fdn-content-body`);
var myParagraphTool = new window.Foundation.ParagraphTool(myBodyElement)
// console.log(event, myBodyElement, myParagraphTool);
if (typeof apntag === ‘object’) {
apntag.anq.push(function() {
// Throw in a placeholder after every 5th usable paragraph ending
for (var i = startIndex; i < myParagraphTool.paragraphEndNodes.length; i++) {
if (i % 4 === 0) {
let currentNode = myParagraphTool.getNodeAtIndex(i);
let myElement = jQuery(‘
`)
if (myParagraphTool.isBrParagraphBreakBeforeBlockElement(currentNode)) {
myElement.find(‘> div’).css({
width: ‘100%’,
minHeight:’30px’,
margin: ’30px 0 30px 0′,
});
}
else {
myElement.find(‘> div’).css({
width: ‘100%’,
minHeight:’30px’,
margin: ‘0 0 30px 0’,
});
}
myParagraphTool.insertElemenAtIndex(myElement, i);
}
}
});
apntag.anq.push(function() {
if (typeof Foundation.ApnAds.fillAds === ‘function’) {
Foundation.ApnAds.fillAds()
}
})
}
}
throwInExtraInsertions(17198756);
jQuery(document).on(‘foundation:multiitem:itemLoaded’, function (event) {
throwInExtraInsertions(event.objId);
})
}
//
if (typeof window.apntag === ‘object’ && typeof window.apntag.onEvent === ‘function’) {
window.apntag.onEvent(‘adLoaded’, reflowRightColumnItems)
}
//
if (typeof twttr === ‘object’ && typeof twttr.ready === ‘object’ && typeof twttr.events === ‘object’) {
twttr.events.bind(‘rendered’, reflowRightColumnItems)
}
//
jQuery(window).on(‘scroll’, reflowRightColumnItems)