Guest User

uTube Force Flash

a guest
Jul 31st, 2017
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name uTube Force Flash
  3. // @namespace YT_flash_force
  4. // @description Force Flash player embed. Note, that the code might be buggy, and might cause conflicts with Flashblock. Acknowledgements to Alexander Nartov for providing the code, and to Victor Desfe and JAOOTPYKHA for improvements to it. This userscript requires, that HTML5 playback is switched off in about:config (FF)
  5. // @homepageURL https://github.com/juneyourtech/GM_YT/blob/master/uTube_force_Flash.user.js
  6. // @version 0.2.2m
  7. // @mod for Otter Browser
  8. // @include *.youtube.com/watch*
  9. // @grant GM_addStyle
  10. // ==/UserScript==
  11. // Notes:
  12. //   * is a wildcard character
  13. //   .tld is magic that matches all top-level domains (e.g. .com, .co.uk, .us, etc.)
  14. /* ____80_character_separator________________________________________________ */
  15.  
  16. /* 28.07.2017: Code to enable Flash Player, with huge thanks to Alexander Nartov
  17.    for the bulk of the code, and Victor Desfe for the showinfo/autoplay line.
  18.    Additional credits: JAOOTPYKHA for fixing height/width issues.
  19.    РІР‚Сћ Errata: Make sure you have HTML5 switched off for this to work. */
  20.  
  21. window.setTimeout(function() {
  22.    var embedFrame = document.createElement("iframe");
  23.    embedFrame.src = location.href.replace(/watch\?v=([^&]*).*/, "v/$1");
  24.    embedFrame.src = embedFrame.src + ("?showinfo=0");
  25.    embedFrame.style = "width: 100%; height: 100%;";
  26.    var player = document.getElementById("player-api");
  27.    
  28.    // grab the current dimensions of the player
  29.    var wid = player.clientWidth;
  30.    var hei = player.clientHeight;
  31.    
  32.    player.innerHTML = "";
  33.    
  34.    // set the embedded player's dimensions to proper size
  35.    embedFrame.style.height=hei+'px';
  36.    embedFrame.style.width=wid+'px';
  37.    
  38.    player.appendChild(embedFrame);
  39.    unsafeWindow.spf.dispose();
  40. },
  41. 3000);
  42.  //next to showinfo: &autoplay=1
  43.  
  44. //29.07.2017: disable static in player area (somewhat resource-intensive)
  45. GM_addStyle("DIV.ytp-error CANVAS.ytp-tv-static {display:none;}");
Add Comment
Please, Sign In to add comment