[TASK] Merge submodule version into core
[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 = 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 if (element) {
30 element.parentNode.removeChild(element);
31 }
32 }
33 };
34 // trigger this after content is loaded, inspired by jQuery
35 if (document.addEventListener && !/opera/.test(navigator.userAgent.toLowerCase())) {
36 document.addEventListener("DOMContentLoaded", TYPO3.ready, false);
37 } else {
38 (function() {
39 if (document.readyState != "loaded" && document.readyState != "complete") {
40 setTimeout(arguments.callee, 10);
41 } else {
42 TYPO3.ready();
43 }
44 })();
45 }
46
47 </script>