Search code examples
javascriptgreasemonkeyuserscripts

Userscript GM_addStyle


I am trying to change background color of the bar under profile picture on facebook (Wall, Informations, Photos etc.) with userscript.. I'm trying to do it like that but it's not working:

GM_addStyle("#uiSideNav uiSideNavSection uiFutureSideNavSection{ background-color:#ffffff; }");

Any ideas? thanks!


Solution

  • I'm not a big Facebook user, but the random wall pages I tested had no node with an id of uiSideNav.

    Try a selector of .uiSideNavSection .uiFutureSideNavSection -- which was present on the pages I sampled. So use:

    GM_addStyle(".uiSideNavSection .uiFutureSideNavSection { background-color:#ffffff; }");
    

    Note that you need the dots in front of the class names.

    Also, for just style changes, the Stylish add-on is better and faster.