diff options
Diffstat (limited to 'js/document/templates/preview')
-rwxr-xr-x | js/document/templates/preview/banner.html | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/js/document/templates/preview/banner.html b/js/document/templates/preview/banner.html index 1860e314..12376795 100755 --- a/js/document/templates/preview/banner.html +++ b/js/document/templates/preview/banner.html | |||
@@ -31,58 +31,58 @@ POSSIBILITY OF SUCH DAMAGE. | |||
31 | 31 | ||
32 | <html> | 32 | <html> |
33 | 33 | ||
34 | <head> | 34 | <head> |
35 | 35 | ||
36 | <style type="text/css"> | 36 | <style type="text/css"> |
37 | 37 | ||
38 | html, body { | 38 | html, body { |
39 | width: 100%; | 39 | width: 100%; |
40 | height: 100%; | 40 | height: 100%; |
41 | margin: 0; | 41 | margin: 0; |
42 | padding: 0; | 42 | padding: 0; |
43 | background: #333; | 43 | background: #333; |
44 | } | 44 | } |
45 | 45 | ||
46 | .preview { | 46 | .preview { |
47 | position: absolute; | 47 | position: absolute; |
48 | top: 50%; | 48 | top: 50%; |
49 | left: 50%; | 49 | left: 50%; |
50 | margin: 0; | 50 | margin: 0; |
51 | padding: 0; | 51 | padding: 0; |
52 | border: 1px solid #000; | 52 | border: 1px solid #000; |
53 | background: #FFF; | 53 | background: #FFF; |
54 | -webkit-box-shadow: 0 0 16px #000; | 54 | -webkit-box-shadow: 0 0 16px #000; |
55 | } | 55 | } |
56 | 56 | ||
57 | </style> | 57 | </style> |
58 | 58 | ||
59 | <script type="text/javascript"> | 59 | <script type="text/javascript"> |
60 | // | 60 | // |
61 | window.addEventListener('load', loadBanner, false); | 61 | window.addEventListener('load', loadBanner, false); |
62 | // | 62 | // |
63 | function loadBanner (e) { | 63 | function loadBanner (e) { |
64 | var iframe = document.getElementsByTagName('iframe')[0]; | 64 | var iframe = document.getElementsByTagName('iframe')[0]; |
65 | iframe.src = qs('url'); | 65 | iframe.src = qs('url'); |
66 | iframe.style.width = qs('width')+'px'; | 66 | iframe.style.width = qs('width')+'px'; |
67 | iframe.style.height = qs('height')+'px'; | 67 | iframe.style.height = qs('height')+'px'; |
68 | iframe.style.marginLeft = -1*qs('width')/2+'px'; | 68 | iframe.style.marginLeft = -1*qs('width')/2+'px'; |
69 | iframe.style.marginTop = -1*qs('height')/2+'px'; | 69 | iframe.style.marginTop = -1*qs('height')/2+'px'; |
70 | } | 70 | } |
71 | /* | 71 | /* |
72 | Taken from: | 72 | Taken from: |
73 | http://stackoverflow.com/questions/7731778/jquery-get-query-string-parameters | 73 | http://stackoverflow.com/questions/7731778/jquery-get-query-string-parameters |
74 | */ | 74 | */ |
75 | function qs(key) { | 75 | function qs(key) { |
76 | key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars | 76 | key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars |
77 | var match = location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)")); | 77 | var match = location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)")); |
78 | return match && decodeURIComponent(match[1]); | 78 | return match && decodeURIComponent(match[1]); |
79 | } | 79 | } |
80 | </script> | 80 | </script> |
81 | 81 | ||
82 | </head> | 82 | </head> |
83 | 83 | ||
84 | <body> | 84 | <body> |
85 | <iframe class="preview"></iframe> | 85 | <iframe class="preview"></iframe> |
86 | </body> | 86 | </body> |
87 | 87 | ||
88 | </html> | 88 | </html> |