Created
October 20, 2011 00:38
-
-
Save joshmcarthur/1300106 to your computer and use it in GitHub Desktop.
Look Busy Bookmarklet
This file contains hidden or 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
// Create a new div tag to contain our image | |
var busy = document.createElement('div'); | |
var body = document.getElementsByTagName('body')[0]; | |
var max_width_cache = body.style.maxWidth; | |
body.style.maxWidth = '100%'; | |
busy.setAttribute('id', 'lookbusy'); | |
// Add a background image, and position the div tag above all other content and make it fill the screen | |
busy.setAttribute('style', 'position: absolute; z-index: 1000; width: 100%; height: 100%; top: 0px; left: 0px; right: 0px; bottom: 0px; background: #FFF url(http://www.1-day.co.nz/images/2010_mission_critical_development_strategy.png) no-repeat 0 0;'); | |
// Add a inconspicuous link to close the image | |
var close = document.createElement('a'); | |
close.setAttribute('class', 'busy close'); | |
close.setAttribute('style', 'position: fixed; z-index: 1001; right: 10px; bottom: 10px; background-color: #FFF; color: #000; font-size:10px'); | |
close.setAttribute('href', '#'); | |
close.innerText = "OK, Clear"; | |
close.setAttribute('onclick', "javascript:body.removeChild(document.getElementById('lookbusy'));body.style.maxWidth = " + (max_width_cache ? max_width_cache : "'auto'")); | |
// Add the close image to the look busy div tag | |
busy.appendChild(close); | |
// Add the look busy div tag to the body of the document | |
body.appendChild(busy); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment