PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Fri Jan 24, 2020 12:58 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Jun 08, 2009 9:27 pm 
Offline
DevNet Resident
User avatar

Joined: Wed Apr 01, 2009 1:31 pm
Posts: 1532
Edit: This issue has been resolved with recent forum software updates.

I noticed that the Expand/Contract links above code blocks in posts do not work (subsilver2 theme), so I tracked down the problem.

The HTML for posts has this structure. As you can see, the max-height style is applied to the "codeholder" div.
Syntax: [ Download ] [ Hide ]
<div class="postbody">
    <div class="codebox">
        <div class="codeheader"></div>
        <div class="codeholder" style="max-height: 300px;">
            <div id="cb99999" class="php"></div>
        </div>
    </div>
</div>

The Expand/Contract link calls the expandCode() Javascript function.
Syntax: [ Download ] [ Hide ]
<a onclick="expandCode('cb99999'); return false;" href="#">Expand/Contract</a>

And the expandCode() function is defined as
Syntax: [ Download ] [ Hide ]
function expandCode(id){
    var parent = document.getElementById(id);
 
    if ((typeof parent.style.maxHeight != 'undefined') && parent.style.maxHeight == ''){
        parent.style.maxHeight = '300px';
    } else {
        parent.style.maxHeight = '';
    }
}

As it is currently defined, the expandCode() function tries to change the max-height style of
Syntax: [ Download ] [ Hide ]
<div id="cb99999" class="php">

instead of its parent
Syntax: [ Download ] [ Hide ]
<div class="codeholder" style="max-height: 300px;">

Because the code block is still restrained by its parent which has a max-height of 300px, the Expand/Contract button is non-functional.

This can be fixed by adding ".parentNode" to the expandCode() function (line 2).
Syntax: [ Download ] [ Hide ]
function expandCode(id){
    var parent = document.getElementById(id).parentNode;
 
    if ((typeof parent.style.maxHeight != 'undefined') && parent.style.maxHeight == ''){
        parent.style.maxHeight = '300px';
    } else {
        parent.style.maxHeight = '';
    }
}

Edit: This post was recovered from search engine cache.


Last edited by McInfo on Tue Jun 15, 2010 10:38 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Tue Jun 09, 2009 11:33 am 
Offline
Site Administrator
User avatar

Joined: Sun May 19, 2002 10:24 pm
Posts: 6887
We are working on getting the code base into SVN. Once that's done we will be able to start working on changes.

_________________
Image


Top
 Profile  
 
PostPosted: Tue Jun 30, 2009 12:46 am 
Offline
DevNet Resident
User avatar

Joined: Wed Apr 01, 2009 1:31 pm
Posts: 1532
Until then, for a temporary fix, I will be using my .

Edit: This post was recovered from search engine cache.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group