Fixed bug #11539: Split view
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Resources / Private / Templates / Preview / Preview.html
1 <script type="text/javascript">
2
3 // @todo redirect to split module if this is opened standalone
4
5 // having this is very important, otherwise the parent.resize call will fail
6 document.domain = '{backendDomain}';
7
8 var asNumber = function(val) {
9 return isNaN(val) ? 0 : parseInt(val, 10);
10 };
11 var TYPO3 = {};
12 TYPO3.ready = function () {
13 // make sure we're in the workspace preview module
14 if (typeof parent.resize == 'function') {
15 // try to find the height of the document
16 var docHeight = Math.max(
17 asNumber(window.innerHeight),
18 asNumber(document.height),
19 asNumber(document.body.scrollHeight),
20 asNumber(document.body.offsetHeight),
21 asNumber(document.body.clientHeight),
22 asNumber(document.documentElement.scrollHeight),
23 asNumber(document.documentElement.offsetHeight),
24 asNumber(document.documentElement.clientHeight)
25 );
26 parent.resize(docHeight);
27 // remove the ugly red box if we're in the ws-repview frames
28 var element = document.getElementById('typo3-previewInfo');
29 element.parentNode.removeChild(element);
30 }
31 };
32 // trigger this after content is loaded, inspired by jQuery
33 if (document.addEventListener && !/opera/.test(navigator.userAgent.toLowerCase())) {
34 document.addEventListener("DOMContentLoaded", TYPO3.ready, false);
35 } else {
36 (function() {
37 if (document.readyState != "loaded" && document.readyState != "complete") {
38 setTimeout(arguments.callee, 10);
39 } else {
40 TYPO3.ready();
41 }
42 })();
43 }
44
45 </script>