Post by iAlex on Dec 19, 2007 19:43:45 GMT -5
This code will organize the UBBC buttons into various different drop down menus. There will be one for the font size, one for the font face and one for the rest of the UBBC functions.
Preview: Click
Global Footer.
Cross Browser.
Open Source.
<script type="text/javascript">
<!--
/*Advaned UBBC Drop Down - By iAlex - Open Source*/
if(document.postForm){
var iTheFontList=["Verdana", "Times New Roman", "Comic Sans MS", "Arial", "Courier New", "Tahoma", "Century", "Autumn", "Lucida Console", "Rockwell", "Scibble", "Trebuchet"];
var iTheSizeList=["1", "2", "3", "4", "5", "6", "7"];
var iTheColor = document.postForm.color
var iTd = iTheColor.parentNode.parentNode
var iFirstSel = document.createElement('select');
var iSecSel = iFirstSel.cloneNode(true);
var iThirSel = iFirstSel.cloneNode(true);
iFirstSel.options[0] = new Option("Select UBBC");
iSecSel.options[0] = new Option("Select Font Face");
iThirSel.options[0] = new Option("Select Font Size");
var iPic=iTd.getElementsByTagName('a');
for(i = 0; i < iPic.length; i++){
if(!iPic.item(i).href.match(/\[(size|font)=/)){
iFirstSel.options[iFirstSel.length] = new Option(iPic.item(i).firstChild.alt, iPic.item(i).href);
}
iPic.item(i).style.display='none';
}
for(i = 0; i < iTheFontList.length; i++){
iSecSel.options[iSecSel.length] = new Option(iTheFontList, 'javascript: add("[font='+iTheFontList[i]+']","[/font]")');
}
for(i = 0; i < iTheSizeList.length; i++){
iThirSel.options[iThirSel.length] = new Option('Size '+iTheSizeList, 'javascript: add("[size='+iTheSizeList[i]+']","[/size]")');
}
iFirstSel.onchange = function(){iMenuChange(this);};
iSecSel.onchange = function(){iMenuChange(this);};
iThirSel.onchange = function(){iMenuChange(this);};
iTd.insertBefore(iThirSel, iTd.firstChild);
iTd.insertBefore(document.createTextNode(' '), iTd.firstChild);
iTd.insertBefore(iSecSel, iTd.firstChild);
iTd.insertBefore(document.createTextNode(' '), iTd.firstChild);
iTd.insertBefore(iFirstSel, iTd.firstChild);
}
function iMenuChange(iDrop){
eval(iDrop.value);
iDrop.selectedIndex=0;
}
//-->
</script>
Preview: Click
Global Footer.
Cross Browser.
Open Source.
<script type="text/javascript">
<!--
/*Advaned UBBC Drop Down - By iAlex - Open Source*/
if(document.postForm){
var iTheFontList=["Verdana", "Times New Roman", "Comic Sans MS", "Arial", "Courier New", "Tahoma", "Century", "Autumn", "Lucida Console", "Rockwell", "Scibble", "Trebuchet"];
var iTheSizeList=["1", "2", "3", "4", "5", "6", "7"];
var iTheColor = document.postForm.color
var iTd = iTheColor.parentNode.parentNode
var iFirstSel = document.createElement('select');
var iSecSel = iFirstSel.cloneNode(true);
var iThirSel = iFirstSel.cloneNode(true);
iFirstSel.options[0] = new Option("Select UBBC");
iSecSel.options[0] = new Option("Select Font Face");
iThirSel.options[0] = new Option("Select Font Size");
var iPic=iTd.getElementsByTagName('a');
for(i = 0; i < iPic.length; i++){
if(!iPic.item(i).href.match(/\[(size|font)=/)){
iFirstSel.options[iFirstSel.length] = new Option(iPic.item(i).firstChild.alt, iPic.item(i).href);
}
iPic.item(i).style.display='none';
}
for(i = 0; i < iTheFontList.length; i++){
iSecSel.options[iSecSel.length] = new Option(iTheFontList, 'javascript: add("[font='+iTheFontList[i]+']","[/font]")');
}
for(i = 0; i < iTheSizeList.length; i++){
iThirSel.options[iThirSel.length] = new Option('Size '+iTheSizeList, 'javascript: add("[size='+iTheSizeList[i]+']","[/size]")');
}
iFirstSel.onchange = function(){iMenuChange(this);};
iSecSel.onchange = function(){iMenuChange(this);};
iThirSel.onchange = function(){iMenuChange(this);};
iTd.insertBefore(iThirSel, iTd.firstChild);
iTd.insertBefore(document.createTextNode(' '), iTd.firstChild);
iTd.insertBefore(iSecSel, iTd.firstChild);
iTd.insertBefore(document.createTextNode(' '), iTd.firstChild);
iTd.insertBefore(iFirstSel, iTd.firstChild);
}
function iMenuChange(iDrop){
eval(iDrop.value);
iDrop.selectedIndex=0;
}
//-->
</script>