Skip to content

Instantly share code, notes, and snippets.

@jeremybuff
Last active August 29, 2015 14:05

Revisions

  1. jeremybuff revised this gist Aug 18, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion FacebookCommentsPluginBlockingDetection.js
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ var updateFacebookCmnts = function(){
    //if it is not there, we can safely assume the comments haven't loaded and can dispaly a warning.
    if(!$('.fb-comments').hasClass('fb_iframe_widget') ){
    //Custom warning message/html
    var $insertedWarning = '<div id="comments-missing-warning" class="alert alert-danger"><i class="fa fa-exclamation-triangle"></i> Uh oh! Looks like you have the wonderful Disconnect.me, or other social media blocking, plugin installed. This is preventing you from commenting because I use Facebook comments. Whitelist this site to comment.</div>';
    var $insertedWarning = '<div id="comments-missing-warning" class="alert alert-danger"><i class="fa fa-exclamation-triangle"></i> Uh oh! Looks like you have the wonderful Disconnect.me, or other social media blocking, plugin installed. This is preventing you from commenting because I use Facebook comments. Whitelist this site to comment.</div>';

    //Insert the aforementioned string before the .fb-comments element
    $('.fb-comments').before($insertedWarning);
  2. jeremybuff renamed this gist Aug 18, 2014. 1 changed file with 0 additions and 0 deletions.
  3. jeremybuff created this gist Aug 18, 2014.
    20 changes: 20 additions & 0 deletions Facebook Comments Plugin Blocking Detection
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    var updateFacebookCmnts = function(){
    //Give the FB Object a second to update the UI before we work our magic
    setTimeout(function(){
    //The fb_iframe_widget class is added to the .fb-comments element when the iframe loads
    //if it is not there, we can safely assume the comments haven't loaded and can dispaly a warning.
    if(!$('.fb-comments').hasClass('fb_iframe_widget') ){
    //Custom warning message/html
    var $insertedWarning = '<div id="comments-missing-warning" class="alert alert-danger"><i class="fa fa-exclamation-triangle"></i> Uh oh! Looks like you have the wonderful Disconnect.me, or other social media blocking, plugin installed. This is preventing you from commenting because I use Facebook comments. Whitelist this site to comment.</div>';

    //Insert the aforementioned string before the .fb-comments element
    $('.fb-comments').before($insertedWarning);
    } else if($('#comments-missing-warning').length > 0) {
    //If the FB comments are loaded but the warning message element is still present, remove it.
    $('#comments-missing-warning').remove();
    }
    }, 1000)
    }

    //Init the function
    updateFacebookCmnts();