// ==UserScript==
// @name Globo Full Tab
// @namespace https://gist.github.com/leonelsr
// @version 0.1.3
// @description Cria um botão para deixar em Tela Cheia (ou "aba cheia") qualquer vídeo em Globo.com (inclusive G1, Globo Play ou Globosat Play).
// @author @leonelsr
// @match *://*.globo.com/*
// @grant none
// @downloadURL https://update.greasyfork.icu/scripts/381467/Globo%20Full%20Tab.user.js
// @updateURL https://update.greasyfork.icu/scripts/381467/Globo%20Full%20Tab.meta.js
// ==/UserScript==
(function() {
'use strict';
console.log('GFT adicionando evento.');
window.addEventListener("load", function () {
console.log('GFT rodou');
function addBtn () {
var btn = document.createElement("button");
//btn.appendChild(document.createTextNode("Full Tab"));
btn.style.bottom = '20px';
btn.style.right = '20px';
btn.style.position = 'fixed';
btn.style.zIndex = 9999;
btn.id = "fulltab";
btn.dataset.function = "open";
btn.innerHTML = '';
btn.style.width = '20px';
btn.style.height = '20px';
btn.style.padding = '0';
btn.style.opacity = '0.07';
btn.onmouseenter = function () {this.style.opacity = '1'; };
btn.onmouseleave = function () {this.style.opacity = '0.07'; };
btn.onclick = function () {
var e = document.querySelector("[data-player]");
var evideo = document.querySelector("[data-player] .master-container video");
var btne = document.querySelector("#fulltab");
if (btne.dataset.function == 'open') {
//e.style.width = "100%";
//e.style.height = "100%";
e.style.setProperty("width", "100%", "important");
e.style.setProperty("height", "100%", "important");
evideo.style.setProperty("height", "100%", "important");
e.style.position = "fixed";
e.style.top = 0;
e.style.left = 0;
e.style.zIndex = 9998;
btne.innerHTML = '';
btne.dataset.function = 'close';
} else {
e.style.position = "";
e.style.top = '';
e.style.left = '';
evideo.style.height = '';
btne.dataset.function = 'open';
btn.innerHTML = '';
}
};
document.body.appendChild(btn);
}
if (document.querySelector("[data-player]")) {
addBtn();
}
});
})();