Chris Lutz, February 10th, 2016, answer on robjb, "Faster approach to checking for an all-zero buffer in C?", Stack Overflow, Sep 29 '09, http://stackoverflow.com/a/1493988https://stackoverflow.com/a/1493988.
(function(){
var closeHandler = function(t, n) {
if (t) {
var i = $(t).filter(":not(.popup-stack-hidden)");
if (!i.length) return;
i.each(function(e, t) {
var n = $(t),
a = n.data("_popup"),
r = n.data("_lightbox");
a && (i = i.add(a)), r && (i = i.add(r))
}), i = $($.unique(i.get())), i = i.not(".popup-closing").addClass("popup-closing");
var a = {
"closeTrigger": n
},
r = $.Event("popupClosing", a);
if (i.trigger(r), r.isDefaultPrevented()) return i.removeClass("popup-closing"), void 0;
i = i.not(".popup-closed").addClass("popup-closed"), i.filter(":not(.esc-hide)").fadeOutAndRemove(), i.filter(".esc-hide").fadeOut(function() {
i.removeClass("popup-closing").removeClass("popup-closed")
}), i.trigger("popupClose", a)
}
};
var citeDialogFactory = new function(){
var template = $('<div class="share-tip cite-tip">cite this answer<input type="text" style="display:block; width:292px;" value="httpvalue="https://stackoverflow.com/a/1498741/1026459"><div id="share-icons"></div><a class="close-share-tip" style="float:right">close</a></div>');
this.Create = function(answer){
var dialog = template.clone();
var username = $(answer).closest('.answercell').find('.user-details a:first').text();
var today = new Date().toDateString();
var asker = $('.user-details a','.post-signature.owner').text();
var title = $("#question-header").text().trim();
var askdate = $('.user-action-time span:first','.post-signature.owner').text();
var answerlink = $(answer).closest('.answercell').find('.short-link:first')[0].href;
var citestr = [username,today,asker,'"'+title+'"',askdate,answerlink].join(', ');
dialog.find('input:first').val(citestr);
$('.close-share-tip',dialog).click(function(){ closeHandler('.cite-tip'); });
return dialog;
};
}
var citeLinkFactory = new function(){
var template = $('<a title="citation for this answer" class="cite-link">cite</a><span class="lsep">|</span>');
this.Create = function(){
var link = template.clone();
link.click(function(){
var dialog = citeDialogFactory.Create(link);
$(this.parentNode).append(dialog);
});
return link;
};
};
$('.lsep:first','.answercell').each(function(){
citeLinkFactory.Create().insertAfter(this);
})
})()