Advertisement
Dotsarecool

BlueSky Profile Override

Sep 5th, 2024 (edited)
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 2.87 KB | Source Code | 0 0
  1. // ==UserScript==
  2. // @name         BlueSky Profile Override
  3. // @namespace    http://tampermonkey.net/
  4. // @version      2024-09-05
  5. // @description  Override accounts' profile pictures and display names.
  6. // @author       @isofrieze.art
  7. // @match        http*://bsky.app/*
  8. // @icon         https://www.google.com/s2/favicons?sz=64&domain=bsky.app
  9. // @require      http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
  10. // @grant        none
  11. // ==/UserScript==
  12.  
  13. // accounts to modify
  14. let data = [
  15.     {
  16.         "account": "account.bsky.social", // the account handle to override
  17.         "newPfp": "https://example.com/img/icon.png", // url to new profile picture
  18.         "newName": "New Name" // new name
  19.     },
  20.     {
  21.         "account": "account2.bsky.social", // must define account handle
  22.         // if you leave out newPfp, the profile picture is just hidden
  23.         // if you leave out the newName, the name turns into webdings
  24.     }
  25. ];
  26.  
  27. ///////////////////////////////
  28. // dont change anything below this unless you know what you're doing
  29. ///////////////////////////////
  30.  
  31. let textReplace = [];
  32.  
  33. (function() {
  34.     'use strict';
  35.  
  36.     $("html").append("<style id='accountoverride' type='text/css'></style>");
  37.  
  38.     for (let p of data) {
  39.         if (p.newPfp) {
  40.             $("#accountoverride").append("a[href$=\"" + p.account + "\"] div[style*=\"background-image: url\"] { background-image: url('" + p.newPfp + "') !important; }");
  41.             $("#accountoverride").append("div[aria-label$=\"" + p.account + "'s avatar\"] div[style*=\"background-image: url\"] { background-image: url('" + p.newPfp + "') !important; }");
  42.         } else {
  43.             $("#accountoverride").append("a[href$=\"" + p.account + "\"] div[style*=\"background-image: url\"] { background-image: none !important; }");
  44.             $("#accountoverride").append("div[aria-label$=\"" + p.account + "'s avatar\"] div[style*=\"background-image: url\"] { background-image: none !important; }");
  45.         }
  46.  
  47.         if (p.newName) {
  48.             textReplace.push(p);
  49.         } else {
  50.             $("#accountoverride").append("a[href^=\"/profile/" + p.account + "\"][style*=\"font-weight: 700\"] { font-family: Webdings !important; }");
  51.             $("#accountoverride").append("div:has(button[aria-label*=\"similar to " + p.account + "\"]) + div div[data-testid=\"profileHeaderDisplayName\"] { font-family: Webdings !important; }");
  52.         }
  53.     }
  54.  
  55.     setInterval(function() {
  56.         for (let p of textReplace) {
  57.             $("a[href^=\"/profile/" + p.account + "\"][style*=\"font-weight: 700\"]").html(p.newName);
  58.             $("div:has(button[aria-label*=\"similar to " + p.account + "\"]) + div div[data-testid=\"profileHeaderDisplayName\"]").html(p.newName);
  59.             $("div[data-testid*=\"" + p.account + "\"] a[href*=\"" + p.account + "\"]:not(:has(*)").html(p.newName);
  60.         }
  61.     }, 200);
  62. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement