I have come up with some javascript that automatically re-sizes, manager: iframe and textarea elements to the height of the available browser canvas area.
I have personally implemented this in:
resource -> templates/snippets/chunks management [textarea]
content -> edit [textarea] (I don't use an editor)
content -> preview [iframe]
The changes have been tested in Firefox 2.0.0.2/Win and IE6/Win.
The code is essentially the same, apart from minor differences addressing the iframe and textarea elements and adjustments to the x-factor (an allowance for top frame)
The code politely handles existing onloads (this is probably unnecessary at the moment)
This is the javascript for a textarea:
<script type="text/javascript">
// 2007/03/09 ~sl - Dynamically Resize textarea
// handle onload
var nowOnload = window.onload; // save any existing assignment
window.onload = function () {
resizer();
if(nowOnload != null && typeof(nowOnload) == 'function') {
nowOnload();
}
}
// handle browser resize
onresize=resizer;
function resizer() {
scrollTo(0,0);
var x = 27 // allowance
var y = window.innerHeight ? window.innerHeight : document.body.clientHeight;
var t = document.mutate.post; // the textarea
var o = y-findTop(t)-x;
t.style.height=Math.max(1,o);
}
function findTop(obj) {
curtop = 0;
if (obj.offsetParent) {
curtop = obj.offsetTop
while (obj = obj.offsetParent) {
curtop += obj.offsetTop
}
}
return curtop;
}
</script>
Instructions:
To implement for resource -> templates/snippets/chunks management [textarea], add the code to these three files:
/manager/actions/dynamic/mutate_snippet.dynamic.action.php
/manager/actions/dynamic/mutate_templates.dynamic.action.php
/manager/actions/dynamic/mutate_htmlsnippet.dynamic.action.php
_____________________________________________________
To implement for content -> edit [textarea], add the code to:
/manager/actions/dynamic/mutate_content.dynamic.action.php
There is 1 other change required to this file.
Replace:
20 var t = document.mutate.post; // the textarea
With:
20 var t = document.mutate.ta; // the textarea
** NOTE ** I do not use an editor and have not tested this with an editor ! **
_____________________________________________________
To implement for content -> preview [iframe], add the code to:
/manager/actions/static/document_data.static.action.php
Then:
Replace:
18 var x = 27 // allowance
20 var t = document.mutate.post; // the textarea
With:
18 var x = 42 // allowance
20 var t = document.getElementById("preview"); // the iframe
Finally, an id needs to be added to the iframe -> id="preview".
_____________________________________________________
I am sure the code could be streamlined somewhat, and perhaps implemented at a higher level, but at least it is a start.
Good Luck.
Sean












