vForums Support > Programming & Coding :: Code Requests & Support :: > Expand / Collapse Profile Options

Expand / Collapse Profile Options - Posted By Jedi Slayer (jedislayer) on 21st Apr 09 at 2:17pm
Since our site is RPG based we have alot of stats added into the mini profile, that makes each post really long due to all the information there.  Is it possible to code so that it would collapsed and clickable to open if someone wanted to look at it. (or even a rollover)

Re: Expand / Collapse Profile Options - Posted By Dreg[Bot] (dregondrahl) on 21st Apr 09 at 2:21pm
got a forum link? are you using any custom template for the miniprofile ?

Re: Expand / Collapse Profile Options - Posted By Jedi Slayer (jedislayer) on 21st Apr 09 at 2:36pm
Sorry about that

http://swlounge.virtualforums.co.uk/

Not currently using any mini profile hacks, just using the additional profile options, the are curently 18 editable fields but only becasue I have not populated them all which cold end up being as many as  30-35

Re: Expand / Collapse Profile Options - Posted By Nick (nickb) on 21st Apr 09 at 5:06pm
If you want it to stay closed then someone is going to have to edit my code:


Code:
 
  1. <script type="text/javascript">
  2.  
  3. var rowVisible = true;
  4.  
  5. function toggleDisplay(tbl) {
  6. var tblRows = tbl.rows;
  7. for (i = 0; i < tblRows.length; i++) {
  8. if (tblRows[i].className != "headerRow") {
  9. tblRows[i].style.display = (rowVisible) ? "none" : "";
  10. }
  11. }
  12. rowVisible = !rowVisible;
  13. }
  14.  
  15. </script>
  16.  
  17. <table id="theTable"  align="center">
  18. <tr class="headerRow">
  19. <th class="title1" width=700></th>  
  20. <tr>
  21. <td class=window2>
  22. -----CONTENT HERE-------
  23. </td>
  24. </tr>
  25. </table>
  26.  
  27. <input type="button" value="Open/Close" onclick="toggleDisplay(document.getElementById('theTable'))" />
  28. </center>
  29.  
 


I don't know much JS, but I do know this much.

Re: Expand / Collapse Profile Options - Posted By Jedi Slayer (jedislayer) on 21st Apr 09 at 10:00pm
does that go in my forum template area, how can i capture just the addtioanl profile options, I looked ofr that but did not see it.

Re: Expand / Collapse Profile Options - Posted By Nick (nickb) on 23rd Apr 09 at 4:08am
Are you using the default template?

Re: Expand / Collapse Profile Options - Posted By Jedi Slayer (jedislayer) on 24th Apr 09 at 3:09pm
I have not made any changes to it, I have my template set with my skin.

Re: Expand / Collapse Profile Options - Posted By Nick (nickb) on 24th Apr 09 at 4:29pm
Alright, I can set it up for you. Just give me some time.

Re: Expand / Collapse Profile Options - Posted By Jedi Slayer (jedislayer) on 24th Apr 09 at 4:50pm
Your awesome thank you very much for your assistance!

Re: Expand / Collapse Profile Options - Posted By Nick (nickb) on 24th Apr 09 at 4:51pm
Your welcome. I have actually gotten it, but I am having a bit of trouble with it in FireFox 3.0.9 at the moment, not sure about IE yet.

edit:

I have tested it in IE7 and it does not work at all. I will have to get help on this.\

edit 2:

If anyone want's to help me out with this, they are more than welcome to!

Code:
 
  1. <center>
  2. <script type="text/javascript">
  3. var rowVisible = false;
  4. function toggleDisplay(tbl) {
  5. var tblRows = tbl.rows;
  6. for (i = 0; i < tblRows.length; i++) {
  7. if (tblRows.className != "headerRow") {
  8. tblRows.style.display = (rowVisible) ? "none" : "table-row";
  9. }
  10. }
  11. alert(tblRows.length);
  12. rowVisible = !rowVisible;
  13. }
  14. </script>
  15. <style type="text/css">
  16. table#theTable tr {
  17. display:none;
  18. }
  19. table#theTable tr.headerRow {
  20. display:table-row;
  21. }
  22. </style>
  23. <table id="theTable" border=1>
  24. <tr class="headerRow">
  25. <tr>
  26. <td>----CONTENT HERE----</td>
  27. </tr>
  28. </table>
  29. <input type="button" value="Open/Close" onclick="toggleDisplay(document.getElementById('theTable'))" />
  30. </center>
 




Now the code works, but a pop up shows up when clicking the button and shows a number 2 on it.

This:
Image

And the code does not work in IE at all.

Re: Expand / Collapse Profile Options - Posted By dog199200 (dog199200) on 26th Apr 09 at 12:35am
{Tongue Out} if that one doesn't work then i have a perfectly working one you can use, but you have to edit the mini-profile template and add something to the global header of your forum

to see it in action here: http://digimondynamics.vforums.co.uk/action/view_profile/user/admin

you just need to click where it says Digimon Data to view the info

Re: Expand / Collapse Profile Options - Posted By Nick (nickb) on 26th Apr 09 at 4:12am
Posted By dog199200 on 26th Apr 09 at 12:35am
 
{Tongue Out} if that one doesn't work then i have a perfectly working one you can use, but you have to edit the mini-profile template and add something to the global header of your forum

to see it in action here: http://digimondynamics.vforums.co.uk/action/view_profile/user/admin

you just need to click where it says Digimon Data to view the info

Well you should have told me about that. >_> lol.

I may know of a source that can help me with this. They helped me out before, with a code, and I am sure they can help me out with this. {Tongue Out}

Re: Expand / Collapse Profile Options - Posted By dog199200 (dog199200) on 26th Apr 09 at 4:59am
dude you never asked {Tongue Out} i was just waiting for the right time to tell you i already have a drop down code, if you want we can talk more baout it in a Pm, mean while we don't need to high jack this thread

Re: Expand / Collapse Profile Options - Posted By Dreg[Bot] (dregondrahl) on 26th Apr 09 at 10:18am
ermmm

why not just replace

Code:
 
  1. {additional_info}  
 






with

Code:
 
  1. <div style="height:15px;overflow-y:auto;" onclick="this.style.cssText=''"><a>View +</a><br/>{additional_info}</div>
 


im sure similar could be done using classnames for show/hide.

Re: Expand / Collapse Profile Options - Posted By Jedi Slayer (jedislayer) on 26th Apr 09 at 10:30pm
So what I want to do is what you have going on on the Digimon site there, since mine tends to be very long, so if one of the codes would work I would appreciate it.

Thanks

Re: Expand / Collapse Profile Options - Posted By dog199200 (dog199200) on 26th Apr 09 at 11:06pm
Dregond Rahl's might work, but I'm not for sure, but here is my code:

Mini-Profile Template Fragment:
Code:
 
  1. <table width=130  id="border" class="border" cellpadding="1" cellspacing="1" border=0>
  2. <tbody>
  3. <tr>
  4. <th onclick="moo(this);" align="center" class="title1">*DATE AREA'S NAME HERE*</th>
  5. </tr>
  6. <tr class='mp_hide'>
  7. <td class="window1">
  8. {additional_info}   
  9. </td>
  10. </tr>
  11. </tbody>
  12. </table>
  13.  
 


With the part above, just find where it says "{additional_info}" in your Mini-Profile Template and replace it with the code above.


Global Footer Code Fragment:
Code:
 
  1. <style>
  2. .mp_hide {
  3. display:none;
  4. }
  5. </style>
  6. <script>
  7. function moo(s){
  8. if(s.parentNode.nextSibling.className == 'mp_show'){  
  9. s.parentNode.nextSibling.className = 'mp_hide' } else {  s.parentNode.nextSibling.className = 'mp_show';
  10. }
  11. }
  12. </script>
 


And then to add the toggle effect, just copy the javascript fragment right above this and paste it anywhere within your global footer.

Re: Expand / Collapse Profile Options - Posted By Jedi Slayer (jedislayer) on 27th Apr 09 at 5:01pm
so I do not know if i did this right because it does not seem to be working, I put the code in my footer as is, deleted the additional profile option and added the code.  T


This is what my mini profile looks like now

Edit:  I thought I might have misunderstood and was suppose to delete everything after additional profile options, but that did not work either.

Code:
 
  1. <font size="2">
  2. <center>
  3. {display_name}
  4. <br />
  5. {rank}
  6. {if:warning}<br />{warning}{/if:warning}
  7. {if:custom_title}<br />{custom_title}<br />{/if:custom_title}
  8. </center>
  9. {if:avatar}<center><br />{avatar}</center>{/if:avatar}
  10. {if:personal_text}<center><br />{personal_text}</center>{/if:personal_text}
  11. <br />
  12. Posts: {posts}
  13. <br />
  14. {if:online}
  15. Status: <b>Online</b>
  16. {/if:online}
  17. {ifnot:online}
  18. Status: Offline
  19. {/ifnot:online}
  20. {if:gender}<br />Gender: {gender}{/if:gender}
  21. {if:location}<br />Location: {location}{/if:location}
  22. <br />
  23. Joined: {joined}
  24. <br />
  25. {if:contact}
  26. <br /><center>{contact}</center>
  27. {/if:contact}
  28. <table width=130  id="border" class="border" cellpadding="1" cellspacing="1" border=0>  
  29. <tbody>  
  30. <tr>  
  31. <th onclick="moo(this);" align="center" class="title1">My Character Stats</th>  
  32. </tr>  
  33. <tr class='mp_hide'>  
  34. <td class="window1">  
  35. {additional_info}    
  36. </td>  
  37. </tr>  
  38. </tbody>  
  39. </table>  
  40. <br />
  41. <table cellpadding="0" cellspacing="0">
  42. <tr>
  43. <td colspan="2"><font size="2">Reputation: {reputation}  </font></td>
  44. </tr>
  45. <tr>
  46. <td rowspan="2">
  47. <div style="clear: both;">
  48. {foreach:reputation}
  49. <div style="height: 8px; width: 8px; background-color: #009900; float: left; margin: 3px;"></div>
  50. {/foreach:reputation}
  51. {foreach:negative_reputation}
  52. <div style="height: 8px; width: 8px; background-color: #CC0000; float: left; margin: 3px;"></div>
  53. {/foreach:negative_reputation}
  54. <br style="clear: both;">
  55. </div>
  56. </td>
  57. <td align="center"><font size="1">{reputation_give}</font></td>
  58. </tr>
  59. <tr>
  60. <td align="center"><font size="1">{reputation_take}</font></td>
  61. </tr>
  62. </table>
  63. </font>
  64.  
 



http://swlounge.virtualforums.co.uk/action/view_profile/user/admin

Re: Expand / Collapse Profile Options - Posted By dog199200 (dog199200) on 28th Apr 09 at 1:58am
well it seems to be working to me, but i also dont got a clue what it looke dliek before, but the dropdown works, just click the rpg stats image and it works