HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

You tube default width

This discussion is related to the Mediator addon.

Great plug-in. Have a small question. How can i change the default width of embedded YouTube videos? (by editing the css file)

Comments

  • hgtonighthgtonight ∞ · New Moderator

    @PRAB AFAIK, you can't change the embeded videos through CSS. However, in mediator.js, the lines 44-49 set the width up conditionally.

    function Mediator () {
      var mlist = $('.MessageList .Message');
      if (mlist.width() < 640) {
        width = mlist.width() - 40;
        height = width * 0.5625;
      } else {
        width = 640;
        height = 360;
      }
    

    You change this to:

    function Mediator () {
      //var mlist = $('.MessageList .Message');
      //if (mlist.width() < 640) {
      //  width = mlist.width() - 40;
      //  height = width * 0.5625;
      //} else {
      //  width = 640;
      //  height = 360;
      //}
      width = 1280;
      height = 720;
    

    changing the last numbers to whatever you want.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

    peregrine422vrijvlinderPRAB
  • Thanks a lot @hgtonight!

    @PRAB, the above solution should work indeed. Do let me know if it doesn't, and I'll figure out a fix.

    PRAB
  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited April 2013

    @hgtonight

    You can use css to control the embedded content , if the embedded content is an iframe you would just add iframe to the list below. I use this all the time to keep everything the size I want regardless of what they embed and how big. This would go in your custom.css file of your theme.

    .Preview .Message, .MessageList .Message .Video object embed {
    width: 680px;
    height: 420px;
    }
    

    here is screens of it.I made the embed object here very wide so it reaches to the other side under the panel. in the first image the second I made the embed object the width of the content only with css and overriding any size the embed may contain.

    PRAB
Sign In or Register to comment.