
Facebook’s headquarters in Menlo Park, California, on Oct. 29, 2015
Credit:
Martyn Williams
People as far away as the the UK and the U.S. received notifications
$(‘#” + slotName + “‘).responsiveAd(screenSize:’971 1115’, scriptTags: []);if (Object.keys(IDG.GPT.companions).length > 0) IDG.GPT.refreshAd(‘” + slotName + “‘);”;
var adDivString = “
” + adString + “
“;
}
placementDiff = applyInsert($(this), adDivString);
if (debug)
console.log(“Just placed an ad and the placementDiff is: ” + placementDiff);
placementTarget = cumulativeHeight + placementDiff + interModuleHeight + adHeightBuffer;
}
else
var moduleDivString = “”;
var elementId = “drr-mod-“+moduleCounter;
moduleDivString = “”;
modules.push(elementId);
placementDiff = applyInsert($(this), moduleDivString);
if (debug)
console.log(“Just placed a module and the placementDiff is: ” + placementDiff);
placementTarget = cumulativeHeight + placementDiff + interModuleHeight + moduleHeightBuffer;
moduleCounter++;
loopCounter++;
}
// Avoid placing elements too soon due to non-large figures inflating the cumulative height
if ($(this).is(“figure”) && !$(this).is(“figure.large”))
cumulativeHeight += grafHeight;
else
cumulativeHeight += $(this).height() + grafHeight;
}
});
// clone Related Stories module to come in after eighth para in article body for mobile breakpoint display
var $relatedStories = $(‘.related-promo-wrapper’);
if ($relatedStories.length)
var $relatedStoriesClone = $relatedStories.clone();
$relatedStoriesClone.insertAfter( “#drr-container > p:eq(7)”);
// For mobile only, place ad after second paragraph.
if (firstMobileAdHtml)
$(firstMobileAdHtml).insertAfter(“#drr-container > p:eq(1)”);
var $insiderPromo = $(‘.insider-promo-wrapper’);
if ($insiderPromo.length)
var $insiderPromoClone = $insiderPromo.clone();
$insiderPromoClone.insertAfter( “#drr-container > p:eq(1)”);
//place left side element
cumulativeHeight = 0;
var leftPlacementTarget = tagHeight = leftPlacementTarget) {
if (debug)
console.log(“congratulations… we’ve passed the initial start point”);
if (leftPlacementIndex == null)
//it’s not good enough to not be a left avoid - it also shouldn’t be a
with an immediately preceding small or medium image left avoid.
if (!isLeftAvoid($(this)) && noPrevFigures($(this)) )
leftPlacementIndex = $(this).index();
$leftPlacementElement = $(this);
leftPlacementLookaheadStart = cumulativeHeight;
if (debug)
console.log(“is not a left avoid and no prev figures. ########## set placementIndex (“+leftPlacementIndex+”) and lookaheadStart (“+leftPlacementLookaheadStart+”) ##########”);
else
if (debug)
console.log(“is a left avoid or has previous figures. continue”);
else
if (debug)
console.log(“#### leftPlacementIndex already set to “+leftPlacementIndex+”. looking ahead…”);
//not null; has been set
if ((cumulativeHeight - leftPlacementLookaheadStart) > leftIntervalHeight)
if (debug)
console.log(“###### THRESHOLD REACHED. LOOKAHEAD COMPLETE. END ###### (cumulativeHeight - leftPlacementLookaheadStart) (“+(cumulativeHeight-leftPlacementLookaheadStart)+”) > leftIntervalHeight (“+leftIntervalHeight+”).”);
return false;
else
if (debug) $(this).hasClass(‘apart’) )))
cumulativeHeight += $(this).height() + grafHeight;
if (debug)
console.log(“——————- set cumulativeHeight(“+cumulativeHeight+”) —————“);
console.log(“”);
);
if (leftPlacementIndex != null && elementNotNearEnd($leftPlacementElement, leftPixelWindow))
if (debug)
console.log(” insert into index “+leftPlacementIndex);
$(“#drr-container”).children().eq(leftPlacementIndex).before(“
“);
IDG.GPT.trackOmniture();
// Add Right rail module content
for (var i=0; i
“;
}
function getEpoParams()
/**
* @param jqo Original jquery object target
* @param divString The div to be inserted.
* @return Difference in height between original placement target and final target.
* Checks first 6 elements for an allowable placement (600 pixel window).
* If none, check nearby for elements that are not right avoids.
* If none, place element before current target.
*/
function applyInsert(jqo, divString)
if (debug)
console.log(“applyInsert at top and jqo index is: ” + jqo.index());
for (var i=0; i 0)
children = $(“#drr-container”).children().slice(jqo.index(), allowElement.index() );
else
children = $(“#drr-container”).children().slice(allowElement.index(), jqo.index());
if (children != null)
children.each(function(i)
if (debug)
console.log(“About to add this element’s height to heigh diff offset”);
console.log($(this));
height += $(this).height() + grafHeight;
);
if (offset 300)
if (debug)
console.log(“isRightAvoid: found pre. return true”);
return true;
if (jqo.is(“figure”) && jqo.hasClass(‘large’))
if (debug)
console.log(“isRightAvoid: found figure.large return true”);
return true;
if (jqo.is(“figure”) && jqo.hasClass(‘medium’) && jqo.hasClass(‘inline’))
if (debug)
console.log(“isRightAvoid: found figure has class medium and inline.”);
return true;
if (jqo.is(‘div’) && jqo.hasClass(‘table-wrapper’))
if (debug)
console.log(“isRightAvoid: found div with class table-wrapper”);
return true;
if (jqo.is(‘aside’))
if (jqo.hasClass(‘sidebar’) && !jqo.hasClass(‘medium’))
if (debug)
console.log(“isRightAvoid: found aside with class sidebar, without class medium”);
return true;
if (jqo.hasClass(‘statsTable’))
if (debug)
console.log(“isRightAvoid: found aside with class statsTable”);
return true;
if (jqo.hasClass(‘download-asset’))
if (debug)
console.log(“isRightAvoid: found class download-asset return true”);
return true;
if (jqo.hasClass(‘tableLarge’))
if (debug)
console.log(“isRightAvoid: found class tableLarge return true”);
return true;
if (jqo.hasClass(‘reject’))
if (debug)
console.log(“isRightAvoid: found class reject. return true”);
return true;
if (jqo.is(‘table’) && jqo.hasClass(‘scorecard’))
if (debug)
console.log(“isRightAvoid: found div with class scorecard”);
return true;
return false;
}
// Return true if element has class ‘reject’: will not place drr modules/ads next to these elements
function isRightReject(jqo)
console.log(“in isRightReject”);
if (jqo != null)
if (jqo.hasClass(“reject”))
if (debug)
console.log(“isRightReject: found ‘reject’ class”);
return true;
return false;
return false;
// Returns true if height of all elements after this one is more than 500; false otherwise
function elementNotNearEnd(element, pixelWindow)
if (pixelWindow == null)
pixelWindow = 500;
if (element == null)
return false;
var remainingHeight = 0;
var children = $(“#drr-container”).children().slice(element.index());
if (children == null)
return false;
children.each(function(i)
remainingHeight += $(this).height();
);
if ( remainingHeight > pixelWindow)
return true;
else
if (debug)
console.log(“Element too close to end. Remaining height is: ” + remainingHeight + ” and window is ” + pixelWindow);
return false;
/**
* Return true if need to avoid this element when placing left module.
*/
function isLeftAvoid(jqo)
if (jqo.is(“figure”))
if (debug)
console.log(“isLeftAvoid: found figure. return true”);
return true;
if (jqo.is(“aside.pullquote”))
if (debug)
console.log(“isLeftAvoid: found pullquote. return true”);
return true;
if (jqo.is(“pre”))
if (debug)
console.log(“isLeftAvoid: found pre. return true”);
return true;
if (jqo.is(“div.gist”))
if (debug)
console.log(“isLeftAvoid: found github code block. return true”);
return true;
if (jqo.is(“aside”) && jqo.hasClass(“sidebar”) && jqo.hasClass(“medium”))
if (debug)
console.log(“isLeftAvoid: found medium sidebar. return true”);
return true;
if (jqo.hasClass(“statsTable”))
if (debug)
console.log(“isLeftAvoid: found class statsTable. return true”);
return true;
return false;
/**
* return true if there are no figures before the target placement that might bleed down into placement element
*/
function noPrevFigures($originalTarget) {
var targetIndex = $originalTarget.index();
var numElementsLookBack = 5;
var figureIndex = null;
var figureHeight = null;
var startIndex = targetIndex - numElementsLookBack
Facebook designed its Safety Check to find out about people who are close to an affected area during an emergency.
On Sunday, after a terror attack in Lahore, Pakistan, killed around 65 and injured over 300 people, a bug in the tool made it contact people in locations like the U.S., India and U.K. far removed from the explosion.
Some users got text messages on their mobile phones that simply asked: “Facebook Safety Check: Are you affected by the explosion? Reply SAFE if you’re ok or OUT if you aren’t in the area,” without mentioning where the explosion had happened. Others got more specific messages asking them if they were in the area affected by the explosion in Gulshan-i-Iqbal Park in Lahore. Facebook later apologized for the error by the tool.
“We activated Safety Check today in Lahore, Pakistan, after a bombing that took place there,” a company spokeswoman said in a statement. “Unfortunately, many people not affected by the crisis received a notification asking if they were okay. We worked to resolve the issue and we apologize to anyone who mistakenly received the notification.”
Facebook did not specify what had caused the bug and how many people were affected. It said in a post on the social networking site that many people that were not affected by the crisis received a notification asking if they were okay. “This kind of bug is counter to our intent,” it added.
The social network has activated the Safety Check feature several times, which checks with people it detects are in the vicinity of a disaster whether they are safe or not, and alerts friends. It was most recently activated last week after deadly terror attacks in Brussels. In 2015, more than 950 million people are said to have received a notification that a friend or loved one was safe in a crisis.
The apparent geolocation error in the Safety Check tool on Sunday is not the first time it has attracted controversy. After Facebook turned on the tool after the terror attack in Paris in November last year, the first time it was being used after an emergency other than a natural disaster, the company was criticized for not using it after earlier terror attacks in Beirut and other locations.
CEO Mark Zuckerberg assured users in November that the tool would be turned on more frequently in the future during human disasters. “Many people have rightfully asked why we turned on Safety Check for Paris but not for bombings in Beirut and other places,” Zuckerberg wrote at the time on his Facebook page.
BYOD isn’t going away, so set a real strategy
Copyright © 1994 - 2016 Computerworld, Inc. All rights reserved.
Explore the IDG Network descend
Source link