|
Post by Wormopolis on Mar 21, 2009 15:50:17 GMT -8
Browser tested: IE and FF placement: global header
turns logo image into a background image behind the menu buttons, and moves page title and hey X below banner.
<script type="text/javascript"> <!-- // Banner remodel - 2.2 // by Wormopolis - wormocodes.proboards.com // puts logo behind menu buttons and moves hey X and page title down // keep header intact
if (true) {
// it will move these 2 areas below the logocell if kept var keeppagetitle=false; // the <<home>> part var keepheyyou=false; // the hey x, you have n messages part
// this is if you want the menu buttons to have a highlight var highlightMenuButtons=true; //add 3D effect to buttons var highlightLightColor='AAAAAA'; var highlightDarkColor='555555';
var forceBannerDimensions=false; //set to true if you want to force dimensions var forceWidth='500px'; var forceHeight='200px';
// if you want to change the placement of the menu button table var menuButtonsPadBottom=0; var menuButtonsPadLeft=0;
var yourShopButton=''; //if using yourshop, put in URL to image here, otherwise leave blank
// no need to edit below unless you know what you are doing
var welcometablesave=document.getElementsByTagName('table')[0]; var logocell=welcometablesave.getElementsByTagName('td')[1]; tmp=new Image(); tmp.src=logocell.firstChild.firstChild.src;
function testFunc() { if (logocell.firstChild.firstChild.complete) { tds=welcometablesave.getElementsByTagName('td'); nwbgimg=logocell.firstChild.firstChild.src; nwcellht=(forceBannerDimensions ? forceHeight : logocell.firstChild.firstChild.clientHeight); nwcellwd=(forceBannerDimensions ? forceWidth : logocell.firstChild.firstChild.clientWidth); logocell.style.height=nwcellht; tds[0].parentNode.parentNode.parentNode.style.width=nwcellwd; logocell.style.backgroundImage="url('"+nwbgimg+"')"; logocell.style.backgroundRepeat="no-repeat"; logocell.style.backgroundPosition="center center"; logocell.vAlign="bottom"; logocell.firstChild.firstChild.style.display="none"; heyXcell=tds[2]; menucellbar=tds[3].getElementsByTagName('table')[0].rows[0]; menubtntbl=tds[4].getElementsByTagName('table')[0]; menubtntbl.width=""; menubtntbl.style.paddingBottom=menuButtonsPadBottom; menubtntbl.style.paddingLeft=menuButtonsPadLeft; pagetitle=tds[1].getElementsByTagName('font')[1]; if (keeppagetitle) menucellbar.cells[0].appendChild(pagetitle.cloneNode(true)); pagetitle.style.display="none"; menucellbar.cells[0].width=""; heyXcell.align='right'; if (keepheyyou) menucellbar.appendChild(heyXcell.cloneNode(true)); heyXcell.style.display="none"; logocell.appendChild(menubtntbl); menucellbar.cells[0].className="welcomebg"; menubtntbl.rows[0].cells[0].style.backgroundColor="transparent"; menubtntbl.rows[0].cells[0].className=""; menubtntbl.rows[0].cells[0].id="menubar"; if (yourShopButton) { menubtntbl.rows[0].cells[0].firstChild.appendChild(document.createTextNode(' ')); var shopbtn_=document.createElement('a'); shopbtn_.href="/index.cgi?action=modifyprofile&user="+pb_username+"&suba=shop"; var shopbtnimg=document.createElement('img'); shopbtnimg.src=yourShopButton; shopbtnimg.border='0'; shopbtn_.appendChild(shopbtnimg); menubtntbl.rows[0].cells[0].firstChild.appendChild(shopbtn_); } var btns=menubtntbl.rows[0].cells[0].getElementsByTagName('img'); for (bb=0; bb<btns.length; bb++) { if (btns[bb].style.display!='none' && !btns[bb].src.match(/blank\.(gif|png|jpg)/) && highlightMenuButtons) { btns[bb].style.borderTopColor=btns[bb].style.borderLeftColor=highlightLightColor; btns[bb].style.borderBottomColor=btns[bb].style.borderRightColor=highlightDarkColor; btns[bb].style.borderStyle='solid'; btns[bb].style.borderWidth='2px'; } } } else { setTimeout('testFunc()', 1000); } } testFunc();
}
// --> </script>
preview: using it onsite now!
|
|
|
Post by Wormopolis on May 15, 2010 14:35:53 GMT -8
updated to run code on image onload to help keep its properties.
|
|
|
Post by Wormopolis on May 29, 2010 8:05:39 GMT -8
version update 1.6: preserved original cells to facilitate later codes that rely on them to function.
as of now, however, yourShop code is not compatible.
|
|
|
Post by Wormopolis on Sept 1, 2010 20:31:00 GMT -8
version update 1.8: added in ability to force dimensions, highlight menu buttons.
|
|
|
Post by Wormopolis on Dec 20, 2010 0:34:03 GMT -8
version upgrade 2.0: added in a image load check that makes sure logo image is finished loading BEFORE running function to prevent it from undersizing welcome table.
|
|
|
Post by Wormopolis on May 12, 2012 21:48:46 GMT -8
version update 2.1: added in padding options to button tray
|
|
|
Post by Wormopolis on May 18, 2012 18:58:12 GMT -8
version update 2.2: added in a way to have a yourshop button
|
|