jQuery(function(a){if("object"==typeof CF_ENTRY_VIEWER_2_CONFIG){var b=CF_ENTRY_VIEWER_2_CONFIG.formId,c={nonce:CF_ENTRY_VIEWER_2_CONFIG.api.nonce,token:CF_ENTRY_VIEWER_2_CONFIG.api.token},d=new CFAPI(CF_ENTRY_VIEWER_2_CONFIG.api,CF_ENTRY_VIEWER_2_CONFIG.perPage,b,c,a);a.when(d.getForm(),d.getEntries(1)).then(function(a,c){var e=a[0],f=c[0],g=new CFFormStoreFactory(b,e.field_details.order,e.field_details.entry_list),h=new CFEntriesStoreFactory(b,f);h.setPage(1),null!=c[2].getResponseHeader("X-CF-API-TOTAL-PAGES")&&h.setTotalPages(c[2].getResponseHeader("X-CF-API-TOTAL-PAGES")),null!=c[2].getResponseHeader("X-CF-API-TOTAL")&&h.setTotal(c[2].getResponseHeader("X-CF-API-TOTAL"));new CFEntryViewer2(b,g,h,d,CF_ENTRY_VIEWER_2_CONFIG)},function(a){var b="object"==typeof CF_ENTRY_VIEWER_2_CONFIG.targets&&"string"==typeof CF_ENTRY_VIEWER_2_CONFIG.targets.entries?CF_ENTRY_VIEWER_2_CONFIG.targets.entries:"caldera-forms-entries",c="object"==typeof CF_ENTRY_VIEWER_2_CONFIG.targets&&"string"==typeof CF_ENTRY_VIEWER_2_CONFIG.targets.nav?CF_ENTRY_VIEWER_2_CONFIG.targets.nav:"caldera-forms-entries-nav";jQuery("#"+c).remove(),"object"==typeof a&&404==a.status?jQuery("#"+b).html('<div class="alert alert-error">'+CF_ENTRY_VIEWER_2_CONFIG.strings.no_entries+"</div>"):jQuery("#"+b).html('<div class="alert alert-error">'+CF_ENTRY_VIEWER_2_CONFIG.strings.not_allowed+"</div>")})}}); |