function renderStatus(url, tabs) {
  var host = url.match(/^(.*?:\/{2,3})?(.+?)(\/|$)/)[2];
  var result = $.grep(supported_sites, function (elem) {
    return elem.url === host;
  });

  if (result.length == 0) {
    $("#siteStatus")
      .text("Current site not supported")
      .addClass("notSupported");
  } else if (result.length == 1) {
    var siteObj = result[0]; // Get specific siteObject from supported_sites
    switch (siteObj.name) {
      case "Office Ally":
      case "Office Ally Demo":
      case "United Health Care Dev":
      case "United Health Care":
        enableForm();
        showOAOptions(tabs[0].id);
        $("#siteStatus")
          .text(siteObj.name + " is supported!")
          .addClass("supported");
        $("#fillForm").on("click", function () {
          fillFormHandler(siteObj, tabs[0].id);
        });
        // Submit form after hitting enter
        $("#datesForm").keydown(function (event) {
          if (event.which == 13) {
            event.preventDefault();
            fillFormHandler(siteObj, tabs[0].id);
          }
        });
        $("#undoForm")
          .prop("disabled", false)
          .on("click", function () {
            chrome.tabs.sendMessage(
              tabs[0].id,
              {
                message: "undoForm",
                siteObj: JSON.stringify(siteObj),
              },
              function (response) {
                ResponseHandler(response);
              }
            );
          });

        chrome.tabs.sendMessage(
          tabs[0].id,
          { message: "getDiagnoses", siteName: siteObj.name },
          function (diagObj) {
            if (diagObj) {
              if (diagObj.length > 4) {
                $("#statusBarMsg")
                  .text(
                    "More than 4 diagnoses detected. Column 24.E will not be filled due to site limitations."
                  )
                  .addClass("warning");
                return;
              }
              $("#statusBarMsg")
                .text(
                  diagObj.length +
                    " diagnosis code(s) detected, Enter CPT Codes."
                )
                .addClass("supported");
            } else {
              $("#statusBarMsg").text(
                "No diagnosis detected in section 21. You will enter diagnosis pointers manually for each row."
              );
            }
          }
        );
        break;
      default:
        $("#siteStatus")
          .text(siteObj.name + " is not yet supported")
          .addClass("notSupported");
        break;
    }
  }
}
// Each site will be treated individually until it has been shown otherwise.
Each site will be treated individually until it has been shown otherwise.
Each site will be treated individually until it has been shown otherwise .
function renderStatus(url, tabs) {
  var host = url.match(/^(.*?:\/{2,3})?(.+?)(\/|$)/)[2];
  var result = $.grep(supported_sites, function (elem) {
    return elem.url === host;
  });
  if (result.length == 0) {
    $("#siteStatus")
      .text("Current site not supported")
      .addClass("notSupported");
  } else if (result.length == 1) {
    var siteObj = result[0]; 
    switch (siteObj.name) {
      case "Office Ally":
      case "Office Ally Demo":
      case "United Health Care Dev":
      case "United Health Care":
        enableForm();
        showOAOptions(tabs[0].id);
        $("#siteStatus")
          .text(siteObj.name + " is supported!")
          .addClass("supported");
        $("#fillForm").on("click", function () {
          fillFormHandler(siteObj, tabs[0].id);
        });
        $("#datesForm").keydown(function (event) {
          if (event.which == 13) {
            event.preventDefault();
            fillFormHandler(siteObj, tabs[0].id);
          }
        });
        $("#undoForm")
          .prop("disabled", false)
          .on("click", function () {
            chrome.tabs.sendMessage(
              tabs[0].id,
              {
                message: "undoForm",
                siteObj: JSON.stringify(siteObj),
              },
              function (response) {
                ResponseHandler(response);
              }
            );
          });
        chrome.tabs.sendMessage(
          tabs[0].id,
          { message: "getDiagnoses", siteName: siteObj.name },
          function (diagObj) {
            if (diagObj) {
              if (diagObj.length > 4) {
                $("#statusBarMsg")
                  .text(
                    "More than 4 diagnoses detected. Column 24.E will not be filled due to site limitations."
                  )
                  .addClass("warning");
                return;
              }
              $("#statusBarMsg")
                .text(
                  diagObj.length +
                    " diagnosis code(s) detected, Enter CPT Codes."
                )
                .addClass("supported");
            } else {
              $("#statusBarMsg").text(
                "No diagnosis detected in section 21. You will enter diagnosis pointers manually for each row."
              );
            }
          }
        );
        break;
      default:
        $("#siteStatus")
          .text(siteObj.name + " is not yet supported")
          .addClass("notSupported");
        break;
    }
  }
}
function renderStatus ( url , tabs ) { var host = url . match ( / ^(.*?:\/{2,3})?(.+?)(\/|$) / ) [ 2 ] ; var result = $ . grep ( supported_sites , function ( elem ) { return elem . url === host ; } ) ; if ( result . length == 0 ) { $ ( "#siteStatus" ) . text ( "Current site not supported" ) . addClass ( "notSupported" ) ; } else if ( result . length == 1 ) { var siteObj = result [ 0 ] ; switch ( siteObj . name ) { case "Office Ally" : case "Office Ally Demo" : case "United Health Care Dev" : case "United Health Care" : enableForm ( ) ; showOAOptions ( tabs [ 0 ] . id ) ; $ ( "#siteStatus" ) . text ( siteObj . name + " is supported!" ) . addClass ( "supported" ) ; $ ( "#fillForm" ) . on ( "click" , function ( ) { fillFormHandler ( siteObj , tabs [ 0 ] . id ) ; } ) ; $ ( "#datesForm" ) . keydown ( function ( event ) { if ( event . which == 13 ) { event . preventDefault ( ) ; fillFormHandler ( siteObj , tabs [ 0 ] . id ) ; } } ) ; $ ( "#undoForm" ) . prop ( "disabled" , false ) . on ( "click" , function ( ) { chrome . tabs . sendMessage ( tabs [ 0 ] . id , { message : "undoForm" , siteObj : JSON . stringify ( siteObj ) , } , function ( response ) { ResponseHandler ( response ) ; } ) ; } ) ; chrome . tabs . sendMessage ( tabs [ 0 ] . id , { message : "getDiagnoses" , siteName : siteObj . name } , function ( diagObj ) { if ( diagObj ) { if ( diagObj . length > 4 ) { $ ( "#statusBarMsg" ) . text ( "More than 4 diagnoses detected. Column 24.E will not be filled due to site limitations." ) . addClass ( "warning" ) ; return ; } $ ( "#statusBarMsg" ) . text ( diagObj . length + " diagnosis code(s) detected, Enter CPT Codes." ) . addClass ( "supported" ) ; } else { $ ( "#statusBarMsg" ) . text ( "No diagnosis detected in section 21. You will enter diagnosis pointers manually for each row." ) ; } } ) ; break ; default : $ ( "#siteStatus" ) . text ( siteObj . name + " is not yet supported" ) . addClass ( "notSupported" ) ; break ; } } }
Each site will be treated individually until it has been shown otherwise.
Each site will be treated individually until it has been shown otherwise .
// Get specific siteObject from supported_sites // Submit form after hitting enter