aboutsummaryrefslogtreecommitdiff
path: root/js/document/templates/preview/banner.html
blob: 5838ec9172d43e497f5a81f752b01f7b496bff83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<!-- <copyright>
 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
 (c) Copyright 2011 Motorola Mobility, Inc.  All Rights Reserved.
 </copyright> -->
 
<html>

	<head>
        
       	<style type="text/css">
       		
       		html, body {
       			width: 100%;
       			height: 100%;
       			margin: 0;
       			padding: 0;
       			background: #333;
       		}
       		
       		.preview {
       			position: absolute;
       			top: 50%;
       			left: 50%;
       			margin: 0;
       			padding: 0;
       			border: 1px solid #000;
       			background: #FFF;
       			-webkit-box-shadow: 0 0 16px #000;
       		}
       		
        </style>
        
        <script type="text/javascript">
        	//
        	window.addEventListener('load', loadBanner, false);
        	//
        	function loadBanner (e) {
        		var iframe = document.getElementsByTagName('iframe')[0];
        		iframe.src = qs('url');
        		iframe.style.width = qs('width')+'px';
        		iframe.style.height = qs('height')+'px';
        		iframe.style.marginLeft = -1*qs('width')/2+'px';
        		iframe.style.marginTop = -1*qs('height')/2+'px';
        	}
        	/*
        	Taken from:
        	http://stackoverflow.com/questions/7731778/jquery-get-query-string-parameters
        	*/
        	function qs(key) {
    			key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars
    			var match = location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)"));
		    	return match && decodeURIComponent(match[1]);
			}
        </script>

	</head>

	<body>
		<iframe class="preview"></iframe>
	</body>

</html>