Skip to content

Instantly share code, notes, and snippets.

@juliend2
Created October 2, 2010 15:03
Show Gist options
  • Save juliend2/607702 to your computer and use it in GitHub Desktop.
Save juliend2/607702 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Layout Overlay
// @namespace jdesrosiers
// @include http://localhost/projectname/*
// ==/UserScript==
switch ( window.location.href.match(/([^\/]+\.html)$/i)[0] ) {
case 'index.html':
var mockupImg = 'indexlayout.jpg'; break;
case 'about.html':
var mockupImg = 'About.jpg'; break;
}
var mockupStyles = 'background:url(\'jpegs/'+mockupImg+'\') no-repeat 50% top';
var body = document.getElementsByTagName('body')[0];
body.innerHTML = '<div id="mockup" style="'+mockupStyles+'"></div>' + body.innerHTML;
var mockup = document.getElementById('mockup');
var minSize = '20px';
var maxSize = mockup.style.height;
var toggle = function(e){
if (e.target.style.height == minSize) {
e.target.style.height = maxSize;
} else {
e.target.style.height = minSize;
};
};
if (mockup.addEventListener) {
mockup.addEventListener('click', toggle, false);
} else if (mockup.attachEvent) {
mockup.attachEvent('onclick', toggle);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment