Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Search Gists
Sign in Sign up

Instantly share code, notes, and snippets.

@NiceAesth
Last activeJanuary 25, 2025 04:20
    • Star(1)You must be signed in to star a gist
    • Fork(1)You must be signed in to fork a gist
    Save NiceAesth/1ff313dc60bec626bceffecc9c509382 to your computer and use it in GitHub Desktop.
    // ==UserScript==
    //@name osuAvatarOpen
    //@namespace https://aesth.dev/
    //@version 0.3
    //@updateURL https://gist.githubusercontent.com/NiceAesth/1ff313dc60bec626bceffecc9c509382/raw
    //@downloadURL https://gist.githubusercontent.com/NiceAesth/1ff313dc60bec626bceffecc9c509382/raw
    //@description Opens a user's osu! avatar on click
    //@author NiceAesth
    //@match https://osu.ppy.sh/users/*
    //@icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
    //@require https://gist.githubusercontent.com/NiceAesth/eec6a9fd695ea6c3574b21fe05b8aef8/raw
    //@resource IMPORTED_CSS https://gist.githubusercontent.com/NiceAesth/e0c2378e2ef2b88e5d9c6d3547dcff0b/raw
    //@grant GM_getResourceText
    //@grant GM_addStyle
    // ==/UserScript==
    functiononModalClick(){
    varmodal=document.querySelector(".avatar-modal");
    modal.style.display="none";
    }
    functiononAvatarClick(event){
    varavatarImg=event.target||event.srcElement;
    varmodal=document.querySelector(".avatar-modal");
    varmodalImg=document.querySelector(".avatar-modal-content");
    varavatarImgStyle=avatarImg.currentStyle||window.getComputedStyle(avatarImg,false)
    varavatarImgUrl=avatarImgStyle.backgroundImage.slice(4,-1).replace(/"/g,"");
    modal.style.display="block";
    modalImg.src=avatarImgUrl;
    }
    functionloadListener(){
    varpage=document.querySelector(".osu-layout");
    varavatar=document.querySelector(".profile-info__avatar");
    // Ignore if on own profile
    if(avatar.href){
    return;
    }
    varmodal=document.createElement("div");
    modal.setAttribute("class","avatar-modal");
    varmodalContent=document.createElement("img");
    modalContent.setAttribute("class","avatar-modal-content");
    modal.appendChild(modalContent);
    page.appendChild(modal);
    avatar.addEventListener("click",onAvatarClick);
    modal.addEventListener("click",onModalClick);
    }
    waitForKeyElements(".profile-info__avatar",loadListener);
    constcustomcss=GM_getResourceText("IMPORTED_CSS");
    console.log(GM_addStyle(customcss));
    Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

    [8]ページ先頭

    ©2009-2025 Movatter.jp