NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name blindwavellc maximize // @namespace http://tampermonkey.net/ // @version 0.5 // @description Makes the video inside the website maximized on click. // @author You // @license MIT // @copyright 2019, akuma06 (https://openuserjs.org//users/akuma06) // @match https://*.blindwavellc.com/* // @grant none // ==/UserScript== (function () { 'use strict'; let isMaximized = false; const video = document.querySelector(".body-content iframe"); if (video !== null) { const parentNode = video.parentNode; const popup = document.createElement("div"); popup.style.cssText = ` position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; margin: 0; padding: 0; background: rgba(0,0,0,0.8); overflow: hidden; z-index: 10; `; const oldStyle = Object.assign({}, { width: video.width, height: video.height }); const buttonFS = document.createElement("button"); const buttonLeave = document.createElement("button"); let lastScrollTop = 0; buttonFS.innerText = "Maximiser"; buttonFS.style.cssText = ` float: right; `; buttonFS.addEventListener("click", (e) => { if (isMaximized) { leaveMaximized(); } else { enterMaximized(); } }); buttonLeave.innerHTML = "×"; buttonLeave.style.cssText = ` position: absolute; top: 0px; right: 0px; opacity: 0.7; z-index: 11; color: white; font: 2em bold; `; buttonLeave.addEventListener("click", (e) => { if (isMaximized) { leaveMaximized(); } }); popup.appendChild(buttonLeave); document.addEventListener("keyup", (e) => { console.log(e); if (e.key === "Escape" && isMaximized) { leaveMaximized(); } }); document.querySelector(".single-title.entry-title").appendChild(buttonFS); function leaveMaximized() { video.height = oldStyle.height; video.width = oldStyle.width; parentNode.appendChild(video); document.body.removeChild(popup); document.documentElement.style.overflow = ""; document.querySelector('html').scrollTop = lastScrollTop; isMaximized = false; lastScrollTop = 0; } function enterMaximized() { parentNode.removeChild(video); popup.appendChild(video); video.height = "100%"; video.width = "100%"; lastScrollTop = document.querySelector('html').scrollTop; document.body.appendChild(popup); document.documentElement.style.overflow = "hidden"; document.querySelector('html').scrollTop = 0; isMaximized = true; } } })();