Skip to main content

Topic: [Userjs] Enable Flash player on youtube (Read 71 times)

  • fullessness
  • [*]
[Userjs] Enable Flash player on youtube
Hi all,
I have found a script that can disable html5 media player and enable again flash player on youtube to watching video at 1080p, until html5 media supports is complete.
The script can be found here: https://productforums.google.com/d/msg/youtube/CUaTWvKhAuE/q6P1m1kpAwAJ but to works on otter [otter-browser-win32-weekly188 WebKit backend] the script needs for some changes
Code: [Select]
// ==/UserScript==
(function() {
window.setTimeout(function() {
  var embedFrame = document.createElement("iframe");
  //embedFrame.src = location.href.replace("watch?v=", "embed/");
  embedFrame.src = location.href.replace("watch?v=", "v/");
  //embedFrame.style = "width: 100%; height: 100%;";
  embedFrame.setAttribute("width", "100%");
  embedFrame.setAttribute("height", "100%");
  var player = document.getElementById("player-api");
  player.innerHTML = "";
  player.appendChild(embedFrame);
},
3000);
})();
Unfortunately, It brakes the fullscreen mode.

Thanks again to Emdek and all the guys behind this awesome browser!  :D

  • fullessness
  • [*]
Re: [Userjs] Enable Flash player on youtube
Reply #1
Simple updated to have a link to fullscreen version of the video and some other improvements
Code: [Select]
// ==UserScript==
// @name Youtube Html5 Disable
// @homepageURL https://productforums.google.com/forum/#!topic/youtube/CUaTWvKhAuE (original bulk code by Alexander Nartov https://productforums.google.com/d/msg/youtube/CUaTWvKhAuE/q6P1m1kpAwAJ)
// @namespace    
// @description  
// @author       
// @run-at document-start
// @version 1.0
// ==/UserScript==
(function() {
// regex by Nass O https://userstyles.org/styles/117673
if (false || (new RegExp("^https?://apis.google.com/.*/hovercard.*$")).test(document.location.href) || (new RegExp("^https?://www.youtube.(com|([a-z]{2}))(.[a-z]{2})?/((\\?|channel|results|feed|playlist|feature|watch|user|hovercard|upload|my_videos|view_all_playlists|subscription_manager|dashboard|subscribers|c|#|messages|analytics|index).*)$")).test(document.location.href) || (new RegExp("^https?://www.youtube.(com|([a-z]{2}))(.[a-z]{2})?.$")).test(document.location.href) || (new RegExp("^https?://apis.google.com/u/b/.*$")).test(document.location.href)) {

window.setTimeout(function() {
var embedFrame = document.createElement("iframe");
//embedFrame.src = location.href.replace("watch?v=", "embed/");
embedFrame.src = location.href.replace("watch?v=", "v/");
//embedFrame.style = "width: 100%; height: 100%;";
embedFrame.setAttribute("width", "100%");
embedFrame.setAttribute("height", "100%");
var player = document.getElementById("player-api");
if (player != null) {
player.innerHTML = "";
player.appendChild(embedFrame);

var container = document.getElementById("watch7-headline");
var div = document.getElementsByClassName("fullscreen-link");
if (container != null && div.length == 0) {
div = document.createElement("div");
div.className = 'fullscreen-link';
var src = location.href.replace("watch?v=", "v/");
var a = document.createElement("a");
a.setAttribute('href', src);
a.setAttribute('target', '_blank');
a.innerHTML = "fullscreen link";
a.setAttribute("style","color: red !important; float: right");
div.appendChild(a);
container.insertBefore(div, container.firstChild);
}
}
unsafeWindow.spf.dispose();
}, 3000);
}
})();