Pure Creativity > The Coders' Quarter :: The Arsenal :: > Title Front Page Headers

Title Front Page Headers - Posted By webmaren (webmaren) on 24th Apr 10 at 2:23pm
This code will move the category and info center titles for your forum into the header images of your category splitter. It is only functional on the front page.

Main Footers:
Code:
 
  1. <script type="text/javascript">
  2. // Titles in Front Page Headers - virtualForums; Public Code 01 (c) 2010 Webmaren
  3. if(vf_action=='home'&&document.title.match(/Home/)){var wm_pc01_hl=document.getElementsByClassName('head_left');if(vf_username=='guest'){var wm_pc01_sc=wm_pc01_hl.length-1;}else{var wm_pc01_sc=wm_pc01_hl.length;}var wm_pc01_hh=new Array();for(a in vf_categories){wm_pc01_hh.push(vf_categories[a]);}wm_pc01_hh.push('Info Center');for(a=0;a<wm_pc01_sc;a++){var ctd=document.createElement('td');ctd.className='head_center textcenter';ctd.setAttribute('align','center');ctd.innerHTML=wm_pc01_hh[a-1];wm_pc01_hl[a].parentNode.insertBefore(ctd,wm_pc01_hl[a].nextSibling);}}
  4. </script>
 


CSS:
Code:
 
  1. .textcenter { text-align: center; }
  2. .head_center { font-size: 13px; font-weight: bold; }
  3. .categorytitle { display: none; }
 


This code may be used in any virtualForums forum free of charge. It is being made available under the terms of the Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License


Unminified Code:
Code:
 
  1. <script type="text/javascript">
  2. // Titles in Front Page Headers - virtualForums
  3. // Public Code 01 (c) 2010 Webmaren
  4. if (vf_action == 'home' && document.title.match(/Home/)) {
  5.     var pcSplitterHeadLeft = document.getElementsByClassName('head_left');
  6.     if (vf_username == 'guest') {
  7.         var pcSplitterCount = pcSplitterHeadLeft.length-1;
  8.     } else {
  9.         var pcSplitterCount = pcSplitterHeadLeft.length;
  10.     }
  11.     var pcHomeHeaders = new Array();
  12.     for (a in vf_categories) {
  13.         pcHomeHeaders.push(vf_categories[a]);
  14.     }
  15.     pcHomeHeaders.push('Info Center');
  16.     for (a=0;a<pcSplitterCount;a++) {
  17.         var centerTd = document.createElement('td');
  18.         centerTd.className = 'head_center textcenter';
  19.         centerTd.setAttribute('align','center');
  20.         centerTd.innerHTML = pcHomeHeaders[a-1];
  21.         pcSplitterHeadLeft[a].parentNode.insertBefore(centerTd, pcSplitterHeadLeft[a].nextSibling);
  22.     }
  23. }
  24. </script>
 



UPDATED 26 Apr 2010: Fixed "undefined" appearing over login panel on front page.