macheteYeti / LWAF Named SMS Contacts

// ==UserScript==
// @name         LWAF Named SMS Contacts
// @namespace    SUD
// @license MIT
// @include https://inbox.helpwise.io/inboxes/*
// @require http://code.jquery.com/jquery-3.4.1.min.js
// @require     https://cdnjs.cloudflare.com/ajax/libs/arrive/2.4.1/arrive.min.js
// @downloadURL https://openuserjs.org/install/macheteYeti/LWAF_Named_SMS_Contacts.user.js
// @updateURL https://openuserjs.org/install/macheteYeti/LWAF_Named_SMS_Contacts.user.js
// @version 2
// @grant GM_addStyle
// @author       macheteYeti
// @license MIT
// @description  Adds functionality to replace phone numbers with names in Helpwise SMS inbox
// ==/UserScript==

$(document).ready(function(){

	
	phones=$.ajax({type:'GET',url:"https://members.livewellandfully.com/sud/phones.php",async:false,dataType:'json',data:{},fail:function(jqXHR,textStatus,errorThrown){console.log('Could not get items, server response: '+textStatus+': '+errorThrown);}}).responseJSON;
	
	$(document).arrive(".thread-addr-main",function(){
	
		if(typeof phones[$(this).text().trim()]!=typeof undefined)$(this).text(phones[$(this).text().trim()])
	});
	$(document).arrive("#thread-subject",function(){
	
		if(typeof phones[$(this).text().trim()]!=typeof undefined)$(this).text(phones[$(this).text().trim()]);
	});
	$(document).arrive("#broad-thread .text-truncate span",function(){
	
		if(typeof phones[$(this).text().trim()]!=typeof undefined)$(this).text(phones[$(this).text().trim()]);
	});
});

GM_addStyle( `
   
` );