// ==UserScript== // @name Assign Interactions add Formal Full Name // @namespace https://jamesriver.fellowshiponego.com // @version 1.1 // @description Adds Formal Full Name Assign Interactions search dropdown // @author Caleb Rankin + Nate Kean // @icon https://www.google.com/s2/favicons?sz=64&domain=fellowshiponego.com\ // @match https://jamesriver.fellowshiponego.com/members/view/* // @grant none // @license MIT // @downloadURL https://update.greasyfork.icu/scripts/555548/Assign%20Interactions%20add%20Formal%20Full%20Name.user.js // @updateURL https://update.greasyfork.icu/scripts/555548/Assign%20Interactions%20add%20Formal%20Full%20Name.meta.js // ==/UserScript== (function() { 'use strict'; /****************************************************************** * SECTION 1: Make Search Bar Profiles Clickable ******************************************************************/ document.head.insertAdjacentHTML("beforeend", ` `); function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } async function waitForElement(selector, pollingRateMs = 100, parent = document) { let el; while (true) { el = parent.querySelector(selector); if (el) return el; await delay(pollingRateMs); } } function formatDate(dateStr) { if (!dateStr) return ''; const parts = dateStr.split('-'); return parts.length === 3 ? `${parts[1]}-${parts[2]}-${parts[0]}` : dateStr; } function calculateExactAge(dateStr) { if (!dateStr) return ''; const birthDate = new Date(dateStr); if (isNaN(birthDate)) return ''; const today = new Date(); let years = today.getFullYear() - birthDate.getFullYear(); let months = today.getMonth() - birthDate.getMonth(); let days = today.getDate() - birthDate.getDate(); if (days < 0) { months--; days += new Date(today.getFullYear(), today.getMonth(), 0).getDate(); } if (months < 0) { years--; months += 12; } let parts = []; if (years > 0) parts.push(`${years} yr${years > 1 ? 's' : ''}`); if (months > 0) parts.push(`${months} mo${months > 1 ? 's' : ''}`); if (days > 0 || parts.length === 0) parts.push(`${days} day${days !== 1 ? 's' : ''}`); return parts.join(' '); } function parseGender(maleValue) { if (maleValue === 1 || maleValue === true) return 'Male'; if (maleValue === 0 || maleValue === false) return 'Female'; return 'Unknown'; } async function fetchAndDisplay(uid, container) { console.log('Fetching UID:', uid); const apiUrl = `https://jamesriver.fellowshiponego.com:443/api/people/${uid}`; try { const response = await fetch(apiUrl, { headers: { "Accept": "application/json" } }); if (!response.ok) throw new Error(`HTTP ${response.status}`); const jsonData = await response.json(); const data = jsonData?.data?.person || jsonData?.data || jsonData; const formalFullName = data.formalFullName; const infoDiv = document.createElement("div"); infoDiv.classList.add("gt-week-info"); infoDiv.innerHTML = `