Advertisement
jcunews

FoundationProfileFollowersList bookmarklet

Dec 4th, 2021
1,228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript: /* Open Foundation profile followers list in new tab */
  2. ((s, t, w, z) => {
  3.   if ((location.hostname === "foundation.app") && window.__NEXT_DATA__) {
  4.     fetch("https://hasura2.foundation.app/v1/graphql", {
  5.       method: "POST",
  6.       headers: {"Content-Type": "application/json"},
  7.       body: JSON.stringify({
  8.         query: "query UserFollowing($publicKey: String!, $currentUserPublicKey: String!, $offset: Int!, $limit: Int!) {\n user: user_by_pk(publicKey: $publicKey) {\n following(where: {isFollowing: {_eq: true}}, offset: $offset, limit: $limit) {\n id\n user: userByFollowedUser {\n name\n username\n profileImageUrl\n userIndex\n publicKey\n isFollowingUser: follows_aggregate(\n where: {user: {_eq: $currentUserPublicKey}, isFollowing: {_eq: true}}\n) {\n aggregate {\n count\n}\n}\n}\n}\n}\n}\n",
  9.         variables: {publicKey: __NEXT_DATA__.props.pageProps.user.publicKey, currentUserPublicKey: "", limit: 3000, offset: 0}
  10.       })
  11.     }).catch(e => {
  12.       alert("Failed to retrieve followers data.\n" + e)
  13.     }).then(r => {
  14.       r.json().catch(e => {
  15.         alert("Failed to parse followers data.\n" + e)
  16.       }).then(o => {
  17.         s = `<!doctype html><head><meta charset="utf-8"><title>${__NEXT_DATA__.props.pageProps.user.name} followers</title><base href="https://foundation.app/"><style>body{font:14pt/normal sans-serif}ol{column-count:2}img{vertical-align:middle;border-radius:50%;width:2em;height:2em}</style></head><body><ol>`;
  18.         (t = document.createElement("LI")).innerHTML = `<a><img /> <span></span></a>`
  19.         o.data.user.following.forEach(i => {
  20.           t.firstChild.href = `/@${i.user.username}`;
  21.           t.firstChild.firstChild.src = i.user.profileImageUrl;
  22.           t.firstChild.lastChild.textContent = i.user.name;
  23.           s += t.outerHTML
  24.         });
  25.         w = open("about:blank");
  26.         w.document.write(s + "</ol></body></html>");
  27.         w.document.close()
  28.       })
  29.     })
  30.   } else alert("Must be in a Foundation profile page")
  31. })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement