Project

General

Profile

Bug #11539 » 11539-wsPreviewHeightFix.patch

Tolleiv Nietsch, 2011-01-12 22:26

View differences:

Resources/Private/Templates/Preview/Preview.html (working copy)
<script type="text/javascript">
document.domain = '{backendDomain}';
// @todo redirect to split module if this is opened standalone
// make sure we're in the workspace preview module
if (typeof parent.resize == 'function') {
parent.resize(
Math.max(
Math.max(document.body.scrollHeight, document.documentElement.scrollHeight),
Math.max(document.body.offsetHeight, document.documentElement.offsetHeight),
Math.max(document.body.clientHeight, document.documentElement.clientHeight)
)
);
// having this is very important, otherwise the parent.resize call will fail
document.domain = '{backendDomain}';
var element = document.getElementById('typo3-previewInfo');
element.parentNode.removeChild(element);
var asNumber = function(val) {
return isNaN(val) ? 0 : parseInt(val, 10);
};
var TYPO3 = {};
TYPO3.ready = function () {
// make sure we're in the workspace preview module
if (typeof parent.resize == 'function') {
// try to find the height of the document
var docHeight = Math.max(
asNumber(window.innerHeight),
asNumber(document.height),
asNumber(document.body.scrollHeight),
asNumber(document.body.offsetHeight),
asNumber(document.body.clientHeight),
asNumber(document.documentElement.scrollHeight),
asNumber(document.documentElement.offsetHeight),
asNumber(document.documentElement.clientHeight)
);
parent.resize(docHeight);
// remove the ugly red box if we're in the ws-repview frames
var element = document.getElementById('typo3-previewInfo');
element.parentNode.removeChild(element);
}
};
// trigger this after content is loaded, inspired by jQuery
if (document.addEventListener && !/opera/.test(navigator.userAgent.toLowerCase())) {
document.addEventListener("DOMContentLoaded", TYPO3.ready, false);
} else {
(function() {
if (document.readyState != "loaded" && document.readyState != "complete") {
setTimeout(arguments.callee, 10);
} else {
TYPO3.ready();
}
})();
}
</script>
</script>
(3-3/9)