96
you are viewing a single comment's thread
view the rest of the comments
[-] AshDene@kbin.social 2 points 1 year ago* (last edited 1 year ago)

I went a bit farther and used the built in variable to set color, as well as setting the font weight down to match the "n hours ago" text, and changing " - " to "@" so that the uesrname matched the standard fediverse string that you can put into search boxes

I'll publish this properly as soon as greasyfork sends me an email to authenticate my new account, but in the meantime here's the source. EDIT: Email has yet to arrive 13 hours later, I doubt it's going to. Anyone interested feel free to publish this somewhere it's easier for people to install.

// ==UserScript==
// @name        kbin social add home-instance name to username (modified)
// @namespace   english
// @description  kbin social add home -instance name to username, modified to match style and fediverse formatting
// @include     http*://*kbin.social*
// @version     1.16
// @run-at document-end
// @require       https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
// @license MIT
// @grant       GM_addStyle
// ==/UserScript==

$( document ).ready(function() {
    $( ".user-inline" ).each(function() {
        // get username URL and text, then remove username from URL and paste the instance name after username (not if instance is home-instance of kbin.social

        var homeinstance = $(this).attr('href') ;
        var myname = $(this).text().trim();

        var homeinstance2 =  homeinstance.replace( "/u/@" + myname + "@"  , '');

        if( homeinstance2  !=   "/u/" + myname ){ //show nothing if home-instance kbin
            console.log(homeinstance2 );
            $(this).append( "<span>@" +  homeinstance2 +"</span>" );
        }
    });
}); //end each username a href

var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML =   '#content a.user-inline span{color: var(--kbin-meta-text-color); font-weight: 400}' ;

document.getElementsByTagName('head')[0].appendChild(style);

[-] spiritusmaximus@kbin.social 2 points 1 year ago

This is awesome.

Great work! :)

this post was submitted on 28 Jun 2023
96 points (100.0% liked)

/kbin meta

39 readers
1 users here now

Magazine dedicated to discussions about the kbin itself. Provide feedback, ask questions, suggest improvements, and engage in conversations related to the platform organization, policies, features, and community dynamics. ---- * Roadmap 2023 * m/kbinDevlog * m/kbinDesign

founded 1 year ago