I can’t hide the SCM Music Player on Tumblr

Asked

Viewed 355 times

4

I’m trying to hide the SCM Music Player and expand the main container to 100% (because the player reduced it a bit at the bottom) on my Tumblr blog but my code doesn’t work.

The Javascript code:

setTimeout(function () {
    $(function(){
        $('body').contents().find('iframe').contents().find('#contentW').css({top: 0px; bottom: 0px; right: 0px;});
        $('body').contents().find('iframe').contents().find('#playerW').css({display: none;})
    });
}, 5000);

The page structure already loaded (note that I omitted some unnecessary parts):

<html>
    <head>
        // algumas tags do Tumblr
    </head>
    <body>
        <iframe> // Iframe desnecessário gerado pelo SCM
            <html>
                <head>
                    // algumas tags do SCM
                </head>
                <body>
                    <div id="contentW" style="top: 0px; bottom: 25px; right: 0px;">
                        // O CONTAINER PRINCIPAL DO BLOG ESTÁ AQUI
                    </div>
                    <div id="playerW" style="top: auto; bottom: 0px; height: 25px;">
                        // O PLAYER QUE EU QUERO OCULTAR
                    </div>
                </body>
            </html>
        </iframe>
    </body>
</html>

What’s wrong with it?

  • Try to do something direct: $("playerW").css("display", "none!important");. Two questions regarding your question: 1 - Why use Jquery? Does Tumblr not allow you to modify CSS directly? 2 - Why are you doing this inside a setTimeout, some specific reason?

  • 1-) Yes, but I’ve tried and it doesn’t work (maybe because it’s inside an iframe). 2-) In fact it is to wait for the site to fully load before executing the code (I know the correct is Document.ready, but I was just testing like this).

  • But I will test this code you passed...

1 answer

2

I finally got it (without JS and Jquery). I created a CSS file, uploaded it pro Tumblr and used the link as a 'custom skin' on the SCM site.

CSS code:

#playerW {display: none !important;}
#contentW {top: 0 !important; bottom: 0 !important; right: 0 !important;}
  • Good thing I got it this way, because via JS I would not notice violating CORS security rules. I was making an example to show you... stay here: http://jsfiddle.net/kh8e1bfj/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.