Audio By Carbonatix
`,
``,
``,
``,
``,
``,
``,
``,
``,
``
];
[
{
"name": "Air - MediumRectangle - Inline Content - Mobile Display Size",
"component": "19274298",
"insertPoint": "2",
"requiredCountToDisplay": "2",
"watchElement": ".fdn-content-body",
"astAdList": [
{
"adType": "rectangle",
"displayTargets": "mobile"
}
]
},{
"name": "Editor Picks",
"component": "17482312",
"insertPoint": "4",
"requiredCountToDisplay": "1",
"watchElement": ".fdn-content-body",
"astAdList": [
{
"adType": "rectangle",
"displayTargets": "desktop|tablet"
},{
"adType": "rectangle",
"displayTargets": "desktop|tablet|mobile"
}
]
},{
"name": "Inline Links",
"component": "18711090",
"insertPoint": "8th",
"startingPoint": 8,
"requiredCountToDisplay": "7",
"maxInsertions": 25
},{
"name": "Air - MediumRectangle - Combo - Inline Content",
"component": "17482310",
"insertPoint": "8th",
"startingPoint": 8,
"requiredCountToDisplay": "7",
"maxInsertions": 25,
"watchElement": ".fdn-content-body",
"astAdList": [
{
"adType": "rectangle",
"displayTargets": "desktop|tablet"
},{
"adType": "rectangle",
"displayTargets": "desktop|tablet|mobile"
}
]
},{
"name": "Inline Links",
"component": "18711090",
"insertPoint": "8th",
"startingPoint": 12,
"requiredCountToDisplay": "11",
"maxInsertions": 25
},{
"name": "Air - Leaderboard Tower - Combo - Inline Content",
"component": "17482313",
"insertPoint": "8th",
"startingPoint": 12,
"requiredCountToDisplay": "12",
"maxInsertions": 25,
"watchElement": ".fdn-content-body",
"astAdList": [
{
"adType": "leaderboardInlineContent",
"displayTargets": "desktop|tablet"
},{
"adType": "tower",
"displayTargets": "mobile"
}
]
}
]
')
let lineHeight = jQuery('[line-height-check]').get(0).clientHeight;
jQuery('[line-height-check]').remove()
if (jQuery(element).prop('tagName').match(/HIDDEN/i) !== null) {
jQuery(element).children('div').last().css({ marginBottom: `${lineHeight*2}px` });
}
else {
jQuery(element).css({
marginTop: `${lineHeight*2}px`,
marginBottom: `${lineHeight}px`
});
}
//
const insertionBlockClass = `fdn-paragraph-insertion-block`;
const styleElementHook = `fdn-paragraph-insertion-styles`;
jQuery(element).addClass(insertionBlockClass);
if (jQuery(`[${styleElementHook}]`).length === 0) {
jQuery('div.fdn-content-body, div #storyBody').append('')
const paragraphLineHeight = jQuery('[line-height-check]').get(0).clientHeight;
jQuery('[line-height-check]').remove()
const styleElement = jQuery(``);
const styleText = `
div.fdn-content-body br+.${insertionBlockClass}:not([hidden]),
div #storyBody br+.${insertionBlockClass}:not([hidden]) {
margin-top: ${paragraphLineHeight*2}px;
margin-bottom: ${paragraphLineHeight}px;
}
div.fdn-content-body br+.${insertionBlockClass}[hidden] > div:last-of-type,
div #storyBody br+.${insertionBlockClass}[hidden] > div:last-of-type {
margin-bottom: ${paragraphLineHeight*2}px;
}
`
styleElement.text(styleText);
jQuery('head').append(styleElement);
}
//
}
}
jQuery(element).insertBefore(this.paragraphEndNodes[index]);
}
else {
console.warn('Foundation.ParagraphTool.insertElemenAt: invalid insertion index', index);
}
}
this.insertElemenAtEnd = function (element) {
if (this.paragraphEndNodes.length) {
let lastNode = this.getNodeAtIndex(this.paragraphEndNodes.length -1);
if (this.isDoubleBrParagraphBreak(lastNode)
|| this.isBrParagraphBreakBeforeBlockElement(lastNode)) {
if (jQuery(element).get(0).tagName.match(/SCRIPT/i) !== null) {
jQuery('').insertAfter(this.paragraphEndNodes[index]);
jQuery('').insertAfter(this.paragraphEndNodes[index]);
}
else {
jQuery('div.fdn-content-body, div #storyBody').append('')
let lineHeight = jQuery('[line-height-check]').get(0).clientHeight;
jQuery('[line-height-check]').remove()
if (jQuery(element).prop('tagName').match(/HIDDEN/i) !== null) {
jQuery(element).children('div').last().css({ marginBottom: `${lineHeight*2}px` });
}
else {
jQuery(element).css({
marginTop: `${lineHeight*2}px`,
marginBottom: `${lineHeight}px`
});
}
}
}
}
this.bodyContainer.append(element);
}
this.getNodeAtIndex = function (index) {
return this.paragraphEndNodes[index];
}
}
`);
}
var paragraphCount = myParagraphTool.getParagraphEndNodeCount();
// No need to insert if there aren't enough paragaphs
if (paragraphCount >= parseInt(item.requiredCountToDisplay)) {
// Matches specific paragraph insertion indexes
if (item.insertPoint.match(/^\d+$/) !== null) {
var insertIndex = parseInt(item.insertPoint) - 1;
// Insert within content
if (insertIndex {
const insertionPointPlaceholder = jQuery(`
`)
myParagraphTool.insertElemenAtIndex(insertionPointPlaceholder, index);
});
return 'Paragraph insertion placeholders applied.';
}