Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript I'm trying to make a web extension that reverts youtube to an old layout, but i barely know anything about js or css

dachshund999

New Coder
so im trying to make a web extension that changes the current youtube layout to an old version that i plan on completely writing from scratch im trying to change the background but i think im doing it wrong

this is my manifest script

JavaScript:
{
    "manifest_version": 3,
    "name": "CosmicPandoReloaded",
    "description": "Makes youtube look like an accurate version of Cosmic Panda",
    "version": "1.0",
    "icons": {
        "16": "/images/icons/16.png",
        "48": "/images/icons/48.png",
        "128": "/images/icons/128.png"
    },
    "content_scripts": [
        {
            "matches": ["*://*.youtube.com/*"],
        "js": ["fronts/main.js"],
        "run_at": "document_start"
        }
    ],

    "permissions": [
        "activeTab"
    ]
}

and this is my main script

JavaScript:
function changeYouTubeBackground() {
    document.body.style.backgroundImage = "url('https://web.archive.org/web/20120717011147im_/http://s.ytimg.com/yt/imgbin/www-refreshbg-vflC3wnbM.png')";
}
  changeYouTubeBackground()

idk what i did wrong any help would be great
 
Last edited:
You're trying to change the background image of the body element before it even exists by setting run_at to document_start in your manifest.json.

Try setting it to document_end.
 
You're trying to change the background image of the body element before it even exists by setting run_at to document_start in your manifest.json.

Try setting it to document_end.
tried that, but sadly didn't work, i did hear some where that using
Code:
"host_permissions": ["*://*.youtube.com/*", "https://www.youtube.com/*", "https://*.googlevideo.com/*"]
could get it to work but that also didn't help
 
Are you sure you're the js is in the right place?
Have you tried writing a console.log() in the script and seeing if it prints it in the console? that's if an extension can even print to the console, idk, it's been a while since i made an extension.

Maybe you have to add !important to the CSS, or there's another element in front of the body with a background colour covering the body's bg colour?
 
Are you sure you're the js is in the right place?
Have you tried writing a console.log() in the script and seeing if it prints it in the console? that's if an extension can even print to the console, idk, it's been a while since i made an extension.

Maybe you have to add !important to the CSS, or there's another element in front of the body with a background colour covering the body's bg colour?
yeah, its all in the right place, just doesn't seem to load
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom