Greasy Fork is available in English.

Youtube Embed Tweak HTML5 (16 February 2018)

Forces all emdedded Youtube videos to the new player. With options for: Video size, https, hide annotations and hide related and hide controls

< Feedback on Youtube Embed Tweak HTML5 (16 February 2018)

Review: Good - script works

woxxomMod
§
Posted: 22. 08. 2014
Edited: 22. 08. 2014

Stretch to container width

It'd be awesome if the script will stretch the embeds proportionally to the actual width (element.offsetWidth) of a container element. In other words setting the size in % would activate this mode, so 75% will use 75% of the container width, etc:

var videosize = '100%';
//////////////////////////////////
if (vsm = videosize.match(/^\s*(\d+)%\s*$/)) {
video_link.width = bad_elements[i].parentNode.offsetWidth * vsm[1] / 100;
video_link.height = Math.floor(video_link.width / 16 * 9);
}


P.S.
Regarding the HD playback issue mentioned on the info page: http://stackoverflow.com/a/10480294

jason37Author
§
Posted: 29. 08. 2014

Hi i tried to add that code to the script with the var but it does not change the size of this example video.

http://forums.overclockers.co.uk/showpost.php?p=26815783&postcount=1420

Do you have an example url where that code changes the size?

This approach you have suggested may be the solution to a known problem where the video can sometimes overlap below other elements on the page.

woxxomMod
§
Posted: 29. 08. 2014
Edited: 01. 09. 2014

This works:

    if (vsm = videosize.match(/^\s*(\d+)%\s*$/)) { // '=' is intentional
      var parent = bad_elements[i].parentNode;
      while (parent) {
        available_width = parent.offsetWidth || parent.clientWidth;
        if (available_width > 0) {
          video_link.width = available_width * vsm[1] / 100;
          video_link.height = Math.floor(video_link.width / 16 * 9);
          break;
        }
        parent = parent.parentNode;
      }
    }

Post reply

Sign in to post a reply.