Created
January 2, 2014 11:21
-
-
Save 5310/8217837 to your computer and use it in GitHub Desktop.
Greasemonkey script that implements a shortcut to maximize Hangout's central region taken up by videos or "full" apps, in order to cover the entire page. #theme #userscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @id greasemonkey-1b827958-e057-4e8c-83b6-eed2a66af1f5-hangout-maximizer | |
// @name Hangout Maximizer | |
// @version 0.1 | |
// @namespace https://plus.google.com/hangouts/* | |
// @author Sayantan Chaudhuri | |
// @description This script implements a shortcut (ctrl+shift+f by default) that maximizes the central area of the Google Hangout web-app. Hangouts has no useful full-screen option to speak of, which is especially a problem while using apps like Screenshare or Roll20. This script simply hides every element other than the central area to maximize videos or apps being used. Doing so also hides the user pictures/videos, but that is expected behavior. The class-based selectors used in this script have been last checked to work on 2014/01/02. | |
// @include https://plus.google.com/hangouts/* | |
// @run-at document-end | |
// ==/UserScript== | |
/* Config and Settings */ | |
// The shortcut key used with ctrl+shift to toggle maximization. | |
// Defaults to f, for ctrl+shift+f, same as in Google Drive. | |
var keycode = 70; | |
// The elements to hide for maximization. | |
// Comment out any to not hide that. | |
// Google's apps are the most extension unfriendly, as you'd expect from them, so these selectors may change in the future, requiring fixes. | |
// Last checked on 2014/01/02. | |
var maximizingCss = ''; | |
maximizingCss += '.Za-ma-R.Za-R { display: none; } '; // Top bar. | |
maximizingCss += '.Za-R.Za-Yc-m { display: none; } '; // Bottom bar. | |
maximizingCss += '.Za-Ha-ya.Za-fd-J.Za-jf { display: none; } '; // Left bar. | |
maximizingCss += '.Za-fd-J.Za-ya-J { display: none; } '; // Right bar. | |
maximizingCss += '.g-gb-T.j-Lb-Qc.g-gb { padding-left: 0; } '; // Center area container margined for the right bar. | |
/* Functionality */ | |
var maximizingCssId = "greasemonkey-1b827958-e057-4e8c-83b6-eed2a66af1f5-hangout-maximizer"; | |
function maximize() { | |
var css = maximizingCss; | |
var head = document.getElementsByTagName('head')[0]; | |
if ( !head || document.getElementById(maximizingCssId) ) { return; } | |
var style = document.createElement('style'); | |
style.id = maximizingCssId; | |
style.type = 'text/css'; | |
style.innerHTML = css; | |
head.appendChild(style); | |
} | |
function unmaximize() { | |
var style = document.getElementById(maximizingCssId); | |
style.parentNode.removeChild(style); | |
} | |
var maximized = false; | |
function toggleMaximize(e) { | |
if ( ( e.ctrlKey && e.shiftKey ) && e.keyCode == 70 ) { | |
console.log("Toggling Hangout maximization."); | |
if (!maximized) { | |
maximize(); | |
maximized = true; | |
} else { | |
unmaximize(); | |
maximized = false; | |
} | |
e.preventDefault(); | |
return false; | |
}; | |
} | |
document.addEventListener('keydown', function(e){toggleMaximize(e)}, false); |
Bug: Apps intercept short-cuts. Hangout cannot be unmaximized if app interfects ctrl+shift+f.
Example: Roll20! :|
Planned solution: Adding a discrete little overlay button to toggle maximization on click.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Submitted to Userstyles.org: http://userscripts.org/scripts/show/187402