|
Post by Wormopolis on Apr 8, 2012 17:23:07 GMT -8
Browsers Tested: IE, FF, and Chrome Placement: global or board footer Lets you create a dropdown that appears in the header bar above the first post of the page that contains links to other locations. format in post: [dropdown=TITLE] [option=LINK TITLE]URL TO LINK[/option] [option=LINK TITLE]URL TO LINK[/option] [option=LINK TITLE]URL TO LINK[/option] [/dropdown] you can put more then one dropdown in a post, and even more dropdowns in later posts - they will all be pushed up into that header row. <script type="text/javascript"> <!-- // dropdowns in post // v1.0 // by Wormopolis - www.wormocodes.com
for (td=document.getElementsByTagName('td'), tt=0; tt<td.length; tt++) { if (td[tt].width=='80%' && td[tt].className.match(/windowbg/) && td[tt].vAlign=='top' && td[tt].innerHTML.match(/\[dropdown(=(.*?))?\]/)) { var postStuff=td[tt].firstChild.rows[1].cells[0]; var getStuff=postStuff.innerHTML.match(/\[dropdown(=(.*?))?\](.*?)\[\/dropdown\]/); var nwdrpdwn=document.createElement('select'); nwdrpdwn.className="chapDrop"; nwdrpdwn.id='chapDrop'+tt; if (nwdrpdwn.addEventListener) { nwdrpdwn.addEventListener('change',function() {changePageFromDrop(this);},true); } else { nwdrpdwn.attachEvent('onchange',function() {changePageFromDrop(this);}); } if (getStuff[1]) { var nwopt=document.createElement('option'); nwopt.value=''; nwopt.innerHTML=getStuff[2]; nwdrpdwn.appendChild(nwopt); } while (getStuff[3].match(/\[option/i)) { var optStuff=getStuff[3].match(/\[option=(.*?)\](.*?)\[\/option\]/i); var nwopt=document.createElement('option'); nwopt.value=optStuff[2]; nwopt.innerHTML=optStuff[1]; nwdrpdwn.appendChild(nwopt); getStuff[3]=getStuff[3].replace(/\[option=(.*?)\](.*?)\[\/option\]/i,''); } td[tt].parentNode.parentNode.firstChild.nextSibling.cells[1].appendChild(nwdrpdwn); td[tt].innerHTML=td[tt].innerHTML.replace(/\[dropdown(=(.*?))?\](.*?)\[\/dropdown\]/,''); tt--; } } function changePageFromDrop(obj) { obj=(obj.options ? obj : obj.event.srcElement); location.href=obj.options[obj.selectedIndex].value; }
// --> </script>
preview: www.wormocodes.com/index.cgi?board=graphreqaswell&action=display&thread=1499
|
|