Skip to content

Instantly share code, notes, and snippets.

@archagon
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save archagon/80cc2c8cbb4d990987ee to your computer and use it in GitHub Desktop.
Save archagon/80cc2c8cbb4d990987ee to your computer and use it in GitHub Desktop.
If you have a lot of browser windows open that you're not currently using, open this page and type in a title. Now your browser windows will be annotated. Especially useful if you use OSX spaces.
<style>
input {
margin-top: auto;
margin-bottom: auto;
background-color: transparent;
font-size: 150px;
width: 100%;
height: 100%;
text-align: center;
border: none;
}
input:focus {
outline-width: 0;
}
</style>
<input id="title_input" onKeyPress="onKeyPress()" onKeyUp="onKeyPress()" type="text" />
<script>
var defaultTitle = "(enter a title)";
function onKeyPress() {
if (window.event.keyCode == 13) {
var input = document.getElementById("title_input");
var value = input.value;
if (!value) {
document.title = defaultTitle;
}
else {
document.title = value;
}
window.location.hash = encodeURIComponent(value)
}
}
document.title = defaultTitle;
var encodedTitle = window.location.hash.substring(1);
if (encodedTitle) {
var decodedTitle = decodeURIComponent(encodedTitle)
document.getElementById("title_input").value = decodedTitle
}
document.getElementById("title_input").focus();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment