|
Post by Wormopolis on Apr 1, 2009 23:24:52 GMT -8
Browser Tested: IE and FF placement: global footer
creates a drop down in the modify profile that lets the user choose the forum width they like. uses a cookie to store selection, so users who routinely delete cookies will see forum at default size.
code:
header portion:
<script type="text/javascript"> <!-- // PROFILE SELECTABLE FORUM RESIZER - BY WORMOPOLIS // v1.1 // Modded original code MPBG editor by DregonDahl // Header Portion
// header function in case you need to call resize from another code
var size_choice=0; if (document.cookie.match(/forum_size=(\d+?)($|;)/)) { size_choice=RegExp.$1; }
function forum_resize() { var fWidth = '80%'; //default or "normal" width if (size_choice==1) fWidth='75%'; if (size_choice==2) fWidth='70%'; if (size_choice==3) fWidth='65%'; var table = document.getElementsByTagName('table'); for(t=0; t<table.length; t++) { if(table[t].width == "92%") { table[t].width = fWidth; } } }
// --> </script>
footer portion:
<script type="text/javascript"> <!-- // PROFILE SELECTABLE FORUM RESIZER - BY WORMOPOLIS // v1.1 // Modded original code MPBG editor by Dregondahl // footer portion
if(document.modifyForm){ Form = document.modifyForm; accessPoint= Form.avatarheight.parentNode.parentNode.parentNode; ss= accessPoint.parentNode.insertRow(9); ss.insertCell(0).innerHTML = '<font size=2>Forum Width</font>'; ss.insertCell(1).innerHTML = '<select name="forum_width"><option value="0">Normal</option><option value="1">Skinny</option><option value="2">Skinnier</option><option value="3">Anorexic</option></select>';
Form.forum_width.options[size_choice].selected=true; Form.forum_width.selectedIndex=size_choice; ss.insertCell(2).innerHTML = '<font size=1>Choose the width you would like to view the forum.</font>';
function resize_forum(){ size_choice= Form.forum_width.value; date_exp=new Date(); date_exp.setYear(date_exp.getFullYear()+1); document.cookie="forum_size="+(size_choice)+"; expires="+date_exp;
} if(document.addEventListener){ Form.profileaction[0].addEventListener('click',resize_forum,false); } else { Form.profileaction[0].attachEvent('onclick',resize_forum); } }
forum_resize();
//--> </script>
Preview: coming soon
Update: better ability to customize drop down and sizes.
|
|
La_Reina
Not New Member
Posts: 15
La_Reina said 0 great things
|
Post by La_Reina on Mar 1, 2011 12:52:42 GMT -8
I'm using this now and though I do get the 3 options nothing changes. Do I have another code blocking this code from working?
|
|
|
Post by Wormopolis on Mar 1, 2011 17:42:51 GMT -8
possibly. if you have side tables, there is usually a resize in that already. I need a URL to look.
|
|
La_Reina
Not New Member
Posts: 15
La_Reina said 0 great things
|
Post by La_Reina on Mar 2, 2011 16:20:24 GMT -8
|
|
|
Post by Wormopolis on Mar 2, 2011 16:56:53 GMT -8
you have the footer portion in header. there are 2 parts you need, a header portion and a footer portion. put the footer portion at the very bottom of global footer.
you also have this:
<script> var boardwidth = document.getElementsByTagName('TABLE'); for(i=0;i<boardwidth.length;i++) { if(boardwidth.width=="92%"){ boardwidth.width='720 px';}} </script>
you will need to remove it or it overrides everyone's choice.
|
|
La_Reina
Not New Member
Posts: 15
La_Reina said 0 great things
|
Post by La_Reina on Mar 3, 2011 15:10:47 GMT -8
I put the header and footer in the right spot. I took out that script but it goes with the side tables and even with that script out it didn't change the size of the board. *sighs* the reason I want this code is some people feel the site is too wide. This will let them pick what's best for them.
|
|
|
Post by Wormopolis on Mar 3, 2011 17:14:36 GMT -8
we will get it. Im heading to the site right now to look.
|
|
|
Post by Wormopolis on Mar 3, 2011 17:32:40 GMT -8
temp remove that script again, then go into your modifyprofile and select "skinny" from the drop down.
up in the header part you will see it has a default width of "80%", then each choice lets you choose smaller and smaller. change the default width to be "720 px".
then change the choice sizes to be things like "700 px" "680 px" "660 px"
play around with the numbers to get them where you want. This code basically gives them 3 size to choose from. if you want more, we would need to make some edits.
I can see the code running in the footers when I went to select my choice size, but that little code you have in there overrides things. it changes the board size from 92% to 720px, so my code never has a chance to resize anything. by making the edit I said above, you can effectively combine both codes. it will default to 720 px for everyone, and if they want smaller they get 3 choices.
|
|
La_Reina
Not New Member
Posts: 15
La_Reina said 0 great things
|
Post by La_Reina on Mar 3, 2011 17:40:14 GMT -8
i can effectively combine both codes. i hope so. lol. I'll take it out. and play around with it. ... uuuuuh okay so I took out the code and change the header to 720px and then I just used your examples of 700, 680, and 650 (i know i made that one up) i figured I'll just change those three things if someone keeps asking for smaller.
Anywho so it's great the 720px made the side tables look like they should but now the code won't go to skinny or anorexic. I go back to my profile and it's still on normal. it's not sticking.
|
|
|
Post by Wormopolis on Mar 3, 2011 21:40:53 GMT -8
checking now
|
|
|
Post by Wormopolis on Mar 3, 2011 21:43:55 GMT -8
I see the width changing so I know that part is working. If what you are saying is that when you go BACK to modify profile, it is defaulting back to normal, yeah I just saw that myself.
lemme write in something that fixes that.
|
|
|
Post by Wormopolis on Mar 3, 2011 22:35:37 GMT -8
version update 1.1: changed over to regexp. recoded cookie storage and rememberance.
|
|
La_Reina
Not New Member
Posts: 15
La_Reina said 0 great things
|
Post by La_Reina on Mar 5, 2011 15:43:18 GMT -8
thank you. it's working now. *hugs*
|
|
|
Post by Wormopolis on Mar 6, 2011 17:55:44 GMT -8
Im glad you like it! It was actually one of the first codes I ever wrote, utilizing the base of someone else's code.
|
|
La_Reina
Not New Member
Posts: 15
La_Reina said 0 great things
|
Post by La_Reina on Mar 7, 2011 15:30:14 GMT -8
Yup and it's a great one for your first code. Now the girls can get off my back. lol
|
|