function getParameterByName(name, url) { if (!url) { url = window.location.href; } name = name.replace(/[\[\]]/g, "\\$&"); var regex = new RegExp("[?&]" + name + "(=([^]*)|&|#|$)", "i"), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, " ")); } function copyTextToClipboard(text) { if (!navigator.clipboard) { fallbackCopyTextToClipboard(text); return; } navigator.clipboard.writeText(text).then(function() { console.log('Async: Copying to clipboard was successful!'); }, function(err) { console.error('Async: Could not copy text: ', err); }); } /* Re-define from DMCA-ContentMonitoring to change address */ function createCaseCaseView(token, status, type, subject, description, infringingWebsiteIp, infringingUrl, originUrl, infringingEmail, caseContent, callBefore, callAfter) { var caseData = JSON.stringify({ status: status, type: type, subject: subject, description: description, infringingWebsiteIp: infringingWebsiteIp, infringingUrl: infringingUrl, infringingEmail: infringingEmail, caseContent: caseContent, originUrl: originUrl }); if (typeof callBefore !== 'undefined') { callBefore(); } $.ajax({ type: "POST", url: location.origin + "/Monitoring/Takedowns.aspx/CreateCase", data: caseData, contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { console.log(data); if (typeof callAfter !== 'undefined') { callAfter(data); } }, error: function (e) { console.log(e); } }); } /* Re-define from DMCA-ContentMonitoring for better error-handling */ function getDomainIPNoError(domain, callBack){ $.ajax({ type: "GET", contentType: 'application/json', url: "//case-analysis20240914121809.azurewebsites.net/api/ResolveAddress?domain=" + domain, data: null, //dataType: "json", crossDomain: true, context: this, /*beforeSend: function (xhr) { xhr.setRequestHeader('token', token); },*/ success: function (response) { if (typeof callBack !== 'undefined') { callBack(response); } return response; }, error: function (response) { if (typeof callBack !== 'undefined') { callBack(''); } return ''; } }); } function getCaseXARF(caseID, callBackSuccess, callBackError){ $.ajax({ type: "GET", contentType: 'application/json', url: "https://dmca-xarf.azurewebsites.net/api/GenerateXarfReport?code=5oHdbn48uEFrZ5Pnx2LuzJ7mwytl-tQJQZJN-Ecf2ikUAzFubljQKA==&caseId=" + caseID, dataType: "json", crossDomain: true, context: this, success: function(response) { if (typeof callBackSuccess !== 'undefined') { callBackSuccess(response); } return response; }, error: function(response) { if (typeof callBackError !== 'undefined') { callBackError(response); } return response; } }); } function submitErrorRecord(errorObj, callBackSuccess){ $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", //dataType: "json", /* endpoint is not returning JSON, causing the success callbacks to not fire */ url: "//dmcascannerapp.azurewebsites.net/api/crm/RecordError", crossDomain: true, context: this, data: JSON.stringify({ "ErrorName": errorObj.ErrorName, "ErrorLocation": errorObj.ErrorLocation, "FailedEndpointUrl": errorObj.FailedEndpointUrl, "ErrorDetails": errorObj.ErrorDetails, "UserIdWhoReportedError": (errorObj.UserIdWhoReportedError != null && errorObj.UserIdWhoReportedError != '' ? errorObj.UserIdWhoReportedError : null ) }), beforeSend: function (xhr) { xhr.setRequestHeader('token', window.APIToken); }, success: function (response) { if (typeof callBackSuccess !== 'undefined') { callBackSuccess(response); } //return response; }, error: function(response) { if (typeof callBackError !== 'undefined') { callBackError(response); } } }); } function webContentCompare(infringing, source, callBackSuccess){ $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "json", url: "//dmca-dev-image-comparison.azurewebsites.net/api/WebContentCompare", crossDomain: true, context: this, data: JSON.stringify({ "Infringing_Url": infringing, "Source_Url": source }), beforeSend: function (xhr) { xhr.setRequestHeader('token', window.APIToken); }, success: function (response) { if (typeof callBackSuccess !== 'undefined') { callBackSuccess(response); } //return response; }, error: function(response) { if (typeof callBackError !== 'undefined') { callBackError(response); } } }); } function submitProtectedItem(url, title, status, description, contentType, badgeID, callBackSuccess, callBackError){ $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "json", url: "//api.dmca.com/addProtectedItem", crossDomain: true, context: this, data: JSON.stringify({ "URL": url, "TITLE": title, "STATUS": status, "DESCRIPTION": description, "TYPE": contentType, "BADGEID": badgeID }), beforeSend: function (xhr) { $(".status .ready").html('Indexing site... this will take one moment '); xhr.setRequestHeader('token', window.APIToken); }, success: function (response) { if (typeof callBackSuccess !== 'undefined') { callBackSuccess(response); } return response; }, error: function(response) { if (typeof callBackError !== 'undefined') { callBackError(response); } } }); } function uploadSource(name, type, description, title, image, location, legalReference, legalID, URL, callBack){ var formData = new FormData(); if(window.sourceFile){ $.each(window.sourceFile, function(key, value){ formData.append(key, value); }); } else if(window.uploadSourceGeneralMode){ return } var category = ''; var data = JSON.stringify({ NAME: name, CONTENT_CATEGORY: category, CONTENT_TYPE: type, CONTENT_DESCRIPTION: description, CONTENT_TITLE: title, CONTENT_IMAGE: image, CONTENT_LOCATION: location, CONTENT_LEGAL_REFERENCE: legalReference, CONTENT_LEGAL_ID: legalID, URL: URL }); formData.append('Data', data); console.log(data); $("#uploadSourceModal .upload-source-body").slideUp(); $("#uploadSourceModal .upload-waiting-body").slideDown(); $("#uploadSourceModal #begin-source-upload").addClass('disabled'); $.ajax({ xhr: function() { var xhr = new window.XMLHttpRequest(); xhr.upload.addEventListener("progress", function(evt) { if (evt.lengthComputable) { var percentComplete = ((evt.loaded / evt.total) * 100).toFixed(0); if(percentComplete == 100){ $("#uploadSourceModal .upload-waiting").html(' Processing your upload...'); } else { $("#uploadSourceModal .uploadPercentageIndicator").text(percentComplete + '%'); } } }, false); xhr.addEventListener("progress", function(evt) { if (evt.lengthComputable) { var percentComplete = ((evt.loaded / evt.total) * 100).toFixed(0); if(percentComplete == 100){ $("#uploadSourceModal .upload-waiting").html(' Processing your upload...'); } else { $("#uploadSourceModal .uploadPercentageIndicator").text(percentComplete + '%'); } } }, false); return xhr; }, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, type: "POST", contentType: false, url: "https://dmcascannerapp.azurewebsites.net/api/TakedownTracker/UploadSourceContent", data: formData, cache: false, crossDomain: true, context: this, processData: false, success: function (response) { if(typeof ga !== 'undefined'){ ga('send', 'event', 'view.aspx (case view)', 'Uploaded source content'); } $("#uploadSourceModal .upload-waiting-body").slideUp(); $("#uploadSourceModal .upload-complete-body").slideDown(); $("#uploadSourceModal .source-upload-timestamp").text(moment().format('MMMM Do YYYY, h:mm:ss a')); $("#uploadSourceModal .source-uploaded-timestamp").show(); if (typeof callBack !== 'undefined') { callBack(response); } }, error: function (response) { if(typeof ga !== 'undefined'){ ga('send', 'event', 'view.aspx (case view)', 'Error uploading attachment', response.toString()); } $("#uploadSourceModal .upload-error-detail").text(JSON.stringify(response)); $("#uploadSourceModal .upload-waiting-body").slideUp(); $("#uploadSourceModal .upload-failed-body").slideDown(); } }); } /* deprecated? /active-monitoring-contractor/issues/25 function uploadRemoteSource(ContentTitle, InfringementContentUrl, callBackSuccess, callBackError){ $.ajax({ type: "POST", contentType: 'application/json', url: "https://dmca-active-monitoring.azurewebsites.net/api/StoreInfringementContentAsSource?code=DrcV2ypRDP8eVO8wBtk9kysB1RXYpADnNDsNY-PXkK6RAzFuVSQbWA==", data: JSON.stringify({ ContentTitle: ContentTitle, InfringementContentUrl: InfringementContentUrl }), //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, success: function (response) { if(typeof callBackSuccess !== 'undefined'){ callBackSuccess(response); } }, error: function (response) { if (typeof callBackError !== 'undefined') { callBackError(response); } } }); }*/ function uploadRemoteSource(InfringementContentUrlArray, callBackSuccess, callBackError){ $.ajax({ type: "POST", contentType: 'application/json', url: "https://dmca-contractor.azurewebsites.net/api/UploadMultipleCaseContent?code=dmUfwVJRD-U-ODAnl4Q-TcF33BLfdAMYoehHgzR5uCEaAzFuN_ea2Q==", data: JSON.stringify({ "userID": window.contactID, "accountID": window.accountID, "sourceContents": InfringementContentUrlArray }), //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, success: function (response) { if(typeof callBackSuccess !== 'undefined'){ callBackSuccess(response); } }, error: function (response) { if (typeof callBackError !== 'undefined') { callBackError(response); } } }); } function deleteSourceContent(contentID, callBack){ $.ajax({ type: "GET", contentType: 'application/json', url: "//dmcascannerapp.azurewebsites.net/api/TakedownTracker/DeleteSourceContent?sourceContentId=" + contentID, data: null, //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, success: function (response) { callBack(response); }, error: function (response) { errorModal(response, "Error deleting content", true); /* Try to proceed anyway? */ if (typeof callBack !== 'undefined') { callBack(response); } } }); } function getSourceContent(callBack){ $.ajax({ type: "GET", contentType: 'application/json', url: "//dmcascannerapp.azurewebsites.net/api/TakedownTracker/GetSourceContentByAccount", data: null, //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, success: function (response) { callBack(response); if(typeof window.clientContentProfileCachingEnabled != 'undefined' && window.clientContentProfileCachingEnabled){ window.clientContentProfileCache = response; } }, error: function (response) { errorModal(response, "Error getting my account uploads", true); /* Try to proceed anyway? */ if (typeof callBack !== 'undefined') { callBack(response); } } }); } function getExcelIngestionProgress(callBack){ $.ajax({ type: "GET", contentType: 'application/json', url: "//dmcascannerapp.azurewebsites.net/api/integration/GetInProgressSourceAndInfringementJob?caseId=" + window.caseID, data: null, //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, success: function (response) { callBack(response); }, error: function (xmlhttprequest, textstatus, message) { /* fail gracefully for excel check issues errorModal(response, "Error loading excel process jobs"); */ /* Try to proceed anyway? */ if (typeof callBack !== 'undefined') { callBack(null); } submitErrorRecord({ ErrorName: 'Excel Ingestion Progress: ' + textstatus, ErrorLocation: window.location.href, FailedEndpointUrl: "//dmcascannerapp.azurewebsites.net/api/integration/GetInProgressSourceAndInfringementJob?caseId=" + window.caseID, ErrorDetails: message, UserIdWhoReportedError: window.contactID }, function(successResponse){ }); } }); } function remoteCaseAnalysis(callBackSuccess, callBackError){ if(typeof window.RCAinProgress != 'undefined' && window.RCAinProgress){ setTimeout(function(){ console.log('prior Case Analysis request in progress, deferring until cache available'); remoteCaseAnalysis(callBackSuccess, callBackError); }, 1500, callBackSuccess, callBackError); return } if(typeof window.RCAcache != 'undefined' && window.RCAcache != null && typeof window.RCAcacheTime != 'undefined' && Date.now() < (window.RCAcacheTime + 180000) ){ console.log('Referred to review cache, saved request to case review'); callBackSuccess(window.RCAcache); } else { console.log('new case review request, uncached'); window.RCAinProgress = true; $.ajax({ type: "GET", contentType: 'application/json', url: "https://dmca-contractor.azurewebsites.net/api/GetCaseReview/" + window.caseID + "/PostReply=false/ValidRequest=true", //url: "//dmca-case-processing.azurewebsites.net/api/Function/" + window.caseID + "/PostReply=false/ValidRequest=true", data: null, //dataType: "json", crossDomain: true, context: this, /*beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); },*/ success: function (response) { window.RCAinProgress = false; if(typeof callBackSuccess !== 'undefined'){ window.RCAcacheTime = Date.now(); window.RCAcache = response; callBackSuccess(response); } }, error: function (xmlhttprequest, textstatus, message) { // no error modal window.RCAinProgress = false; submitErrorRecord({ ErrorName: 'Case Review: ' + textstatus, ErrorLocation: window.location.href, FailedEndpointUrl: "//dmca-contractor.azurewebsites.net/api/GetCaseReview/" + window.caseID, ErrorDetails: message, UserIdWhoReportedError: window.contactID }, function(successResponse){ }); /* proceed anyway */ if (typeof callBackError !== 'undefined') { callBackError(message); } } }); } } function caseReviewFncCount(callBackSuccess, callBackError){ $.ajax({ type: "GET", contentType: 'application/json', url: "https://dmca-case-processing.azurewebsites.net/api/CaseReviewFncCount?caseid=" + window.caseID, data: null, //dataType: "json", crossDomain: true, context: this, /*beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); },*/ success: function (response) { if(typeof callBackSuccess !== 'undefined'){ callBackSuccess(response); } }, error: function (xmlhttprequest, textstatus, message) { //errorModal('Error getting case analysis', 'Case unavailable', false); /* Try to proceed anyway? */ if (typeof callBackError !== 'undefined') { callBackError(response); } submitErrorRecord({ ErrorName: 'Case Review FNC Count: ' + textstatus, ErrorLocation: window.location.href, FailedEndpointUrl: "https://dmca-case-processing.azurewebsites.net/api/CaseReviewFncCount?caseid=" + window.caseID, ErrorDetails: message, UserIdWhoReportedError: window.contactID }, function(successResponse){ }); } }); } function getCaseDetails(caseID, callBack){ $.ajax({ type: "GET", contentType: 'application/json', url: "//dmcascannerapp.azurewebsites.net/api/crm/GetCaseDetails?CaseId=" + caseID, data: null, //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, success: function (response) { if (response.ViewableByClientC) { if(typeof callBack !== 'undefined'){ callBack(response); } } else { errorModal('User does not have required permission (not viewable)', 'Case unavailable', false); $.ajaxQ.abortAll(); /* shutitdown */ return false } }, error: function (response) { console.log('getCaseDetails error: ', response.responseText); if(response.responseText == '"You do not have access to the requested resource."'){ errorModal('User does not have required permission (not viewable)', 'Case unavailable', true); return; } else { errorModal(response, "Error loading case details"); /* Try to proceed anyway? */ if (typeof callBack !== 'undefined') { callBack(response); } } } }); } /* infringing/source JSON data */ function getCaseData(callBack){ $.ajax({ type: "GET", contentType: 'application/json', url: "//dmca-contractor.azurewebsites.net/api/GetCaseData?Caseid=" + window.caseID + "&AccountId=" + window.accountID, data: null, //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, success: function (response) { if(typeof callBack !== 'undefined'){ callBack(response); if(response !== null){ window.caseDataID = response.Id; window.latestCaseData = JSON.parse(response.DescriptionWorkC); } } else { errorModal('Error getting case data (source/infringement details)', 'Case data unavailable', true); $.ajaxQ.abortAll(); /* shutitdown */ return false } }, error: function (response) { errorModal(response, "Error loading case details"); /* Try to proceed anyway? */ if (typeof callBack !== 'undefined') { callBack(response); } } }); } function updateCaseData(caseDataID, caseData, callBack){ $.ajax({ type: "POST", contentType: 'application/json', url: "//dmcascannerapp.azurewebsites.net/api/crm/UpdateCaseData?Caseid=" + window.caseID + "&AccountId=" + window.accountID, data: JSON.stringify({ Id: caseDataID, caseID: window.caseID, Deleted: false, AccountId: window.accountID, DescriptionWorkC: JSON.stringify(caseData) }), //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, success: function (response) { if(typeof callBack !== 'undefined'){ callBack(response); } else { errorModal('Error updating case data (source/infringement details)', 'Case data unavailable', true); $.ajaxQ.abortAll(); /* shutitdown */ return false } }, error: function (response) { errorModal(response, "Error loading case data"); /* Try to proceed anyway? */ if (typeof callBack !== 'undefined') { callBack(response); } } }); } function resetCaseData(caseDataID, callBack){ $.ajax({ type: "POST", contentType: 'application/json', url: "//dmcascannerapp.azurewebsites.net/api/crm/UpdateCaseData?Caseid=" + window.caseID + "&AccountId=" + window.accountID, data: JSON.stringify({ Id: caseDataID, caseID: window.caseID, Deleted: false, AccountId: window.accountID, DescriptionWorkC: JSON.stringify({ caseID: window.caseID, clientEngagement: false, readyForReview: false, finalNoticePreStatement: "", infringingSourcePairs: {} }) }), //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, success: function (response) { if(typeof callBack !== 'undefined'){ callBack(response); } else { errorModal('Error updating case data (source/infringement details)', 'Case data unavailable', true); $.ajaxQ.abortAll(); /* shutitdown */ return false } }, error: function (response) { errorModal(response, "Error loading case data"); /* Try to proceed anyway? */ if (typeof callBack !== 'undefined') { callBack(response); } } }); } function createCaseData(caseID, caseData, callBack){ $.ajax({ type: "POST", contentType: 'application/json', url: "//dmca-contractor.azurewebsites.net/api/CreateCaseData?Caseid=" + caseID + "&AccountId=" + window.accountID, data: JSON.stringify(JSON.stringify(caseData)), //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, success: function (response) { if(typeof callBack !== 'undefined'){ callBack(response); } }, error: function (response) { errorModal('Error creating case data (source/infringement details)', 'Case data unavailable', true); /* Try to proceed anyway? */ if (typeof callBack !== 'undefined') { callBack(response); } } }); } function getNumberOfUnreadComments(callBack) { $.ajax({ type: "GET", contentType: 'application/json', url: "//dmcascannerapp.azurewebsites.net/api/crm/GetNumberOfCaseCommentsSinceDate?CaseId=" + window.caseID, data: null, //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, success: function (response) { console.log('Comments: ', response); if (typeof callBack !== 'undefined') { callBack(response); } window.commentsQuantity = response.length; }, error: function (response) { if(response.readyState == 0 && response.status == 0 && response.statusText == "error"){ /* This one tends to occur when the session times out and we can't poll for comments */ errorModal(response, "Your login session has expired, unable to check for new comments", false); } else { errorModal(response, "Error loading unread comments"); } if (typeof callBack !== 'undefined') { callBack(response); } } }); } function getCaseComments(callBack){ $.ajax({ type: "GET", contentType: 'application/json', url: "//dmcascannerapp.azurewebsites.net/api/crm/GetCaseComments?CaseId=" + window.caseID, data: null, //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, success: function (response) { console.log('Comments: ', response); if (typeof callBack !== 'undefined') { callBack(response); } window.commentsQuantity = response.length; }, error: function (response) { errorModal(response, "Error loading case comments"); if (typeof callBack !== 'undefined') { callBack(response); } } }); } function sendCaseComment(comment, callBack){ var data = JSON.stringify({ caseID: window.caseID, Title: comment, IsSticky: false, IsPrivate: false, DescriptionHtml: comment, ModifiedUserId: window.contactID }); $.ajax({ type: "POST", contentType: 'application/json', url: "https://dmcascannerapp.azurewebsites.net/api/crm/CreateCaseComment", data: data, //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, success: function (response) { if (typeof callBack !== 'undefined') { callBack(response); } }, error: function (response) { errorModal(response, "Error sending case comment"); if (typeof callBack !== 'undefined') { callBack(response); } } }); } function editCaseDetails(caseID, fieldName, fieldNewValue, callBack){ var dataObj = { FieldName: fieldName, FieldNewValue: fieldNewValue }; var dataArr = "[" + JSON.stringify(dataObj) + "]"; $.ajax({ type: "POST", contentType: 'application/json', url: "https://dmcascannerapp.azurewebsites.net/api/crm/EditCase?CaseId=" + caseID, data: dataArr, //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + window.APIToken); }, success: function (response) { if (typeof callBack !== 'undefined') { callBack(response); } }, error: function (response) { errorModal(response, "Error saving case details"); if (typeof callBack !== 'undefined') { callBack(response); } } }); } function testURL(WebPageUrl, callBackSuccess, callBackError){ $.ajax({ type: "GET", contentType: 'application/json', url: "//case-analysis20240914121809.azurewebsites.net/api/FetchAs?url=" + encodeURIComponent(WebPageUrl), data: null, //dataType: "json", crossDomain: true, context: this, beforeSend: function (xhr) { $("input.URLFieldInfringing[value='"+ WebPageUrl +"']").siblings('.infringingCheckIndicator').attr('class', '').addClass('infringingCheckIndicator fa fa-spinner fa-spin active'); }, success: function (response, status, xhr) { var contentType = xhr.getResponseHeader("content-type") || ""; var pageAccessible = 'success'; if (typeof callBackSuccess !== 'undefined') { callBackSuccess(response, pageAccessible, contentType); } return response; }, error: function (response, status, xhr) { //var contentType = xhr.getResponseHeader("content-type") || ""; var pageAccessible = 'error'; if (typeof callBackError !== 'undefined') { callBackError(response, pageAccessible); } return response; } }); } function getAllCommTemplates(callBack){ $.ajax({ type: "GET", contentType: 'application/json', url: "https://dmca-workflow.azurewebsites.net/api/getCommTemplates", data: null, crossDomain: true, context: this, beforeSend: function (xhr) { xhr.setRequestHeader('InternalToken', 'kbh34ijy4jkhbuesfo8h34o87btobQQWQW'); }, success: function (response) { window.commTemplatesTest = response; if(typeof callBack !== 'undefined'){ /* gotta transform CommTemplates to something we can reference freely */ var newResponse = {}; $.each(JSON.parse(response), function(key, value){ newResponse[value.ID] = value; newResponse[value.ID].SUBJECT = (value.SUBJECT !== null ? value.SUBJECT.trim() : '' ); newResponse[value.ID].BODY_HTML = (value.BODY_HTML !== null ? value.BODY_HTML .replace('