moneyman18
New Member
What goes here?!?!
Posts: 82
|
Post by moneyman18 on Apr 13, 2009 19:09:10 GMT -5
Code Name: Info Center Head/Base Images Creator: moneyman18 Preview: N/A Definition: Adds Head/Base Images to the Info Center with the option to remove the info center title row Placement: Main Footer
<script type="text/javascript"> <!-- /* Info Center Head/Base Images - Moneyman18 */
var head = "Head Image Url"; // Head Image var base = "Base Image Url"; // Base Image var titlerow = "no"; // Remove Info Center Title row? yes or no
/*==(Do Not Edit Below)==*/ if(location.href.match(/action=home/i) || !location.href.match(/action/i)){ var mTable = document.getElementsByTagName('table'); for(i=0;i<mTable.length;i++){ if(mTable[i].innerHTML.match(/Info\sCenter/i) && mTable[i].className == 'bordercolor' && mTable[i].cellPadding == '0'){ if(titlerow == 'yes'){ mTable[i+1].rows[0].style.display = 'none'; } var HeadImg = document.createElement('center'); var image1 = document.createElement('img'); image1.src = head; image1.border = 0; HeadImg.appendChild( image1 ); var BaseImg = HeadImg.cloneNode(true); BaseImg.firstChild.src = base; mTable[i].parentNode.insertBefore(HeadImg, mTable[i]); mTable[i].parentNode.insertBefore(BaseImg, mTable[i].nextSibling); break; } } } // --> </script>
What to Edit:
var head = "Head Image Url"; // Head Image var base = "Base Image Url"; // Base Image var titlerow = "no"; // Remove Info Center Title row? yes or no Edit those three lines. Pretty self explanatory. Additional Comments: Tested in FF IE and Chrome
|
|
|
Post by Wrighty on Apr 13, 2009 19:11:22 GMT -5
I'd recommend [not 100% necessary] changing: if(location.href.match(/action=home/i) || !location.href.match(/(action|board)=/i)){to: if(location.href.match(/action=home/i) || !location.href.match(/action/i)){ With it being the main footers, there's no reason why it would be anywhere with 'board=' in the location.href
|
|
moneyman18
New Member
What goes here?!?!
Posts: 82
|
Post by moneyman18 on Apr 13, 2009 19:16:48 GMT -5
I seem to forget about that. Changed.
|
|
|
Post by Wrighty on Apr 13, 2009 19:19:21 GMT -5
You could perhaps cut the code down a bit - you should look into: x.cloneNode(true);then when you initialise the 2 images & 2 divs, you can instead 'copy' the other one - what you could do is make the 'head' image & then say: var base = head.cloneNode(true); base.firstChild.src = base;or something like that!
|
|
moneyman18
New Member
What goes here?!?!
Posts: 82
|
Post by moneyman18 on Apr 13, 2009 19:43:21 GMT -5
I was looking at that earlier today but did not understand it completly. After re-reading it a few times I understand it a bit more. So basically if I understand correctly. var HeadImg = document.createElement('center'); var image1 = document.createElement('img'); image1.src = head; image1.border = 0; HeadImg.appendChild( image1 ); var BaseImg = HeadImg.cloneNode(true); BaseImg.firstChild.src = base;
|
|
|
Post by Wrighty on Apr 13, 2009 19:48:18 GMT -5
Should work! What you could do also is look into: var image1 = (new Image()).src = head;I THINK! (not at all sure) should work - test it though - that's the best thing that you can do with these things!
|
|
moneyman18
New Member
What goes here?!?!
Posts: 82
|
Post by moneyman18 on Apr 13, 2009 19:51:21 GMT -5
Thats what I been doing for the most part. Will have to look into that when I get a chance. Thanks for all your info/help! Edit:Seems to work with what is 2 post up. SHould I change it or should I leave it as it?
|
|
|
Post by Wrighty on Apr 13, 2009 19:59:00 GMT -5
If you've got a shorter code that you think works in all browsers [IE, FF & Chrome] then go for it & change the above!
|
|
Devin
Special Person
tay <3
without ME it's just AWESO
Posts: 1,199
|
Post by Devin on Apr 14, 2009 4:07:49 GMT -5
This code works fine as it is, so I'm gonna go ahead and move it. If you want to make any more versions of it just submit it separately and I'll add it as well
|
|