PageSourceSearch

https://simonchadwick.net/wp-content/plugins/activitypub/build/follow-me/view.js?ver=d0bd5d2df4ce3ff93b99

js simonchadwick.net collected 2026-10-02 19:23:49 UTC 6,353 bytes, 1 lines download raw bytes

1import*as e from"@wordpress/interactivity";const t=e,o=t.withSyncEvent??(e=>e),n={computedStyles:null,variables:{}};function r(e){if("undefined"==typeof window||!window.getComputedStyle)return!1;if(n.variables.hasOwnProperty(e))return n.variables[e];n.computedStyles||(n.computedStyles=window.getComputedStyle(document.documentElement));const t=n.computedStyles.getPropertyValue(e).trim();return n.variables[e]=""!==t,n.variables[e]}function l(e){if("string"!=typeof e)return null;if(e.match(/^#/))return e.substring(0,7);const[,,t]=e.split("|"),o=`--wp--preset--color--${t}`;return r(o)?`var(${o})`:null}function c(e,t,o=null,n=""){return o?`${e}${n} { ${t}: ${o}; }\n`:""}function i(e,t,o,n){return c(e,"background-color",t)+c(e,"color",o)+c(e,"background-color",n,":hover")+c(e,"background-color",n,":focus")}function s(e){try{return["http:","https:"].includes(new URL(e).protocol)}catch(e){return!1}}!function(){const{actions:e,callbacks:n}=(0,t.store)("activitypub/follow-me",{actions:{openModal(e){const o=(0,t.getContext)();if(o.modal.isOpen=!0,o.modal.isCompact)setTimeout(n.positionModal,0);else{const e=document.getElementById(o.blockId);if(e){const t=e.querySelector(".activitypub-modal__overlay");t&&["top","left","right","bottom"].forEach(e=>{t.style.removeProperty(e)})}setTimeout(()=>{if(e){const t=e.querySelector(".activitypub-modal__frame");t&&n.trapFocus(t)}},50)}"function"==typeof n.onModalOpen&&n.onModalOpen(e)},closeModal(e){const o=(0,t.getContext)();o.modal.isOpen=!1;const r=(0,t.getElement)();if("actions.toggleModal"===r.ref.dataset["wpOn-Click"])r.ref.focus();else{const e=document.getElementById(o.blockId);if(e){const t=e.querySelector('[data-wp-on--click="actions.toggleModal"]');t&&t.focus()}}"function"==typeof n.onModalClose&&n.onModalClose(e)},toggleModal:o(o=>{o?.preventDefault?.();const{modal:n}=(0,t.getContext)();n.isOpen?e.closeModal(o):e.openModal(o)})},callbacks:{_abortController:null,handleModalEffects(){const{modal:e}=(0,t.getContext)();if(e.isOpen&&!e.isCompact?document.body.classList.add("modal-open"):document.body.classList.remove("modal-open"),n._abortController&&(n._abortController.abort(),n._abortController=null),e.isOpen){n._abortController=new AbortController;const{signal:e}=n._abortController;document.addEventListener("keydown",n.documentKeydown,{signal:e}),document.addEventListener("click",n.documentClick,{signal:e})}},documentKeydown(o){const{modal:n}=(0,t.getContext)();n.isOpen&&"Escape"===o.key&&e.closeModal()},documentClick(o){const{blockId:n,modal:r}=(0,t.getContext)();if(!r.isOpen)return;const l=document.getElementById(n);if(!l)return;const c=l.querySelectorAll('[data-wp-on--click="actions.toggleModal"]');for(const e of c)if(e===o.target||e.contains(o.target))return;const i=l.querySelector(".activitypub-modal__frame");i&&!i.contains(o.target)&&e.closeModal()},positionModal(){const{blockId:e}=(0,t.getContext)(),o=document.getElementById(e);if(!o)return;const n=o.querySelector(".activitypub-modal__overlay");if(!n)return;n.style.top="",n.style.left="",n.style.right="",n.style.bottom="";const r=(0,t.getElement)().ref.getBoundingClientRect(),l=window.innerWidth,c=o.getBoundingClientRect(),i={top:r.bottom-c.top+8+"px",left:r.left-c.left-2+"px"};l-r.right<250&&(i.left="auto",i.right=c.right-r.right+"px"),Object.assign(n.style,i)},trapFocus(e){const t=e.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]):not([readonly]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])'),o=t[0],n=t[t.length-1];o&&o.classList.contains("activitypub-modal__close")&&t.length>1?t[1].focus():o.focus(),e.addEventListener("keydown",function(t){if("Tab"!==t.key&&9!==t.keyCode)return;const r=e.ownerDocument.activeElement;t.shiftKey?r===o&&(n.focus(),t.preventDefault()):r===n&&(o.focus(),t.preventDefault())})}}})}();const{actions:a,callbacks:d}=(0,t.store)("activitypub/follow-me",{actions:{copyToClipboard(){const e=(0,t.getContext)(),{i18n:o}=(0,t.getConfig)();navigator.clipboard.writeText(e.webfinger).then(()=>{e.copyButtonText=o.copied,setTimeout(()=>{e.copyButtonText=o.copy},1e3)},e=>{console.error("Could not copy text: ",e)})},updateRemoteProfile(e){const o=(0,t.getContext)();o.remoteProfile=e.target.value,o.isError=!1,o.errorMessage=""},onKeydown:o(e=>{"A"!==(0,t.getElement)().ref.tagName||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),a.toggleModal(e))}),handleKeyDown(e){"Enter"===e.key&&(e.preventDefault(),a.submitRemoteProfile())},*submitRemoteProfile(){const e=(0,t.getContext)(),{namespace:o,i18n:n}=(0,t.getConfig)(),{apiFetch:r}=window.wp,l=e.remoteProfile.trim();if(!l)return e.isError=!0,void(e.errorMessage=n.emptyProfileError);
1if(!d.isHandle(l))return e.isError=!0,void(e.errorMessage=n.invalidProfileError);e.isLoading=!0,e.isError=!1;const c=`/${o}/actors/${e.userId}/remote-follow?resource=${encodeURIComponent(l)}`;try{const t=yield r({path:c});if(e.isLoading=!1,!s(t.url))return e.isError=!0,void(e.errorMessage=n.genericError);window.open(t.url,"_blank","noopener,noreferrer"),a.closeModal(new Event("click"))}catch(t){console.error("Error submitting profile:",t),e.isLoading=!1,e.isError=!0,e.errorMessage=t.message||n.genericError}}},callbacks:{initButtonStyles:()=>{const{buttonStyle:e,backgroundColor:o,blockId:n}=(0,t.getContext)();if(n&&e){const t=document.createElement("style"),c=`#${n}`;t.textContent=function(e,t,o){const n=`${e} .wp-block-button__link`,c=function(e){if("string"==typeof e){const t=`--wp--preset--color--${e}`;return r(t)?`var(${t})`:null}return e?.color?.background||null}(o)||t?.color?.background;return i(n,l(t?.elements?.link?.color?.text),c,l(t?.elements?.link?.[":hover"]?.color?.text))}(c,e,o),document.head.appendChild(t);const s=document.createElement("style");s.textContent=function(e){const t=l(e?.elements?.link?.color?.text)||"var(--wp--preset--color--contrast, var(--wp--preset--color--foreground, #1e1e1e))";return i(".activitypub-dialog__button-group .wp-block-button__link",t,"var(--wp--preset--color--base, var(--wp--preset--color--background, #fff))",l(e?.elements?.link?.[":hover"]?.color?.text)||t)}(e),document.head.appendChild(s)}},isHandle(e){const t=e.replace(/^@/,"").split("@");return 2===t.length&&s(`https://${t[1]}`)},onModalClose(){(0,t.getContext)().isError=!1}}});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.