Ignore:
Timestamp:
08/19/08 19:20:49 (4 years ago)
Author:
hverton
Message:

updated the codeblock resize code, so that the blocks always will fit, even inside serveral nested quote blocks
fixed added tab at the start of news.php and at the end of _header.tpl causing a PHP warning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/templates/forum.viewthread.tpl

    r1651 r1659  
    2121</script> 
    2222{include file="_opentable.tpl" name=$_name title=$locale.500 state=$_state style=$_style} 
    23 <table id='width_check' cellspacing='0' cellpadding='0' width='100%'> 
     23<table cellspacing='0' cellpadding='0' width='100%'> 
    2424    <tr> 
    2525        <td class='smallalt'> 
     
    199199    if (_timer) clearInterval(_timer); 
    200200 
    201     // calculate the width of a code block 
    202     var blockwidth = document.getElementById("width_check").offsetWidth-141; 
    203     var block_a = 0; 
    204     var block_b = 0; 
     201    // needed inside the loop 
     202    var parent_left = 0; 
     203    var parent_width = 0; 
     204    var obj = 1; 
     205    var i = 1; 
    205206 
    206207    // loop through all blocks found, and set the width correctly 
    207     var i = 1; 
    208208    while (document.getElementById("codeblock"+i+"a") != null && document.getElementById("codeblock"+i+"b") != null) { 
    209         // need to check and do something dynamic with margins and padding here... 
    210         block_a = blockwidth - 40 + "px"; 
    211         block_b = blockwidth - 50 + "px"; 
    212         document.getElementById("codeblock"+i+"a").style.width = block_a; 
    213         document.getElementById("codeblock"+i+"b").style.width = block_b; 
     209        // get the info about the objects parent 
     210        obj = document.getElementById("codeblock"+i+"a").parentNode; 
     211        // fall back gracefully if the parentNode can not be found 
     212        if (obj == null) obj = document.getElementById("codeblock"+i+"a").offsetParent; 
     213        parent_left = findPosX(obj); 
     214        parent_width = obj.offsetWidth; 
     215//      alert(parent_left + " : " + parent_width); 
     216        // calculate the new width of the block, leave plenty of space to handle browser subtleties  
     217        block_width = parent_left + parent_width - findPosX(document.getElementById("codeblock"+i+"a")) - 30; 
     218        // adjust the width of the code blocks 
     219        document.getElementById("codeblock"+i+"a").style.width = block_width + "px"; 
     220        document.getElementById("codeblock"+i+"b").style.width = block_width - 10 + "px"; 
    214221        i++; 
    215222    } 
Note: See TracChangeset for help on using the changeset viewer.