Post by 2tlnooby on Dec 30, 2013 6:06:27 GMT -5
Hello all
I have searched for this and found a code by Jordan, but I'm pretty much a noob when it comes to new code and stuff, so here's my question.
We would like to have a different banner image appear when not on the main screen of our forum.
This is the code I found, but am not sure where to put it, or if it's even geared to do what I want it to do.
_______________________________________________________
Code by Jordan
Allows you to have a different banner for each board.
Place the board id where the red is text is.
Global Headers
<script type="text/javascript"><!--
/*
Different Banner for Each Board
Open Source
*/
var _logo = new Array();
_logo["general"] = "image_url";
_logo["board_id"] = "image_url";
if(location.href.match(/board=(.+?)(&.+)?$/i)){
if(_logo[RegExp.$1]){
var td = document.getElementsByTagName("td")[1];
var _img = td.firstChild.firstChild.cloneNode(true);
_img.src = _logo[RegExp.$1];
td.firstChild.replaceChild(_img, td.firstChild.firstChild);
}
}
//--></script>
If you want to have the same image for each board in a category, use this version. Be sure to put the category id and not the board id where the red text is.
<script type="text/javascript"><!--
var _logo = new Array();
_logo["general"] = "image_url";
_logo["board_id"] = "image_url";
if(location.href.match(/board=(.+?)(&.+)?$/i)){
for(var a = document.getElementsByTagName("a"), x = 0; x < a.length; x++){
if(a[x].className == "nav" && a[x].previousSibling.nodeType == 3 && a[x].previousSibling.data.match(/::/i)){
if(_logo[a[x].href.split("#")[1]]){
var td = document.getElementsByTagName("td")[1];
var _img = td.firstChild.firstChild.cloneNode(true);
_img.src = _logo[a[x].href.split("#")[1]];
td.firstChild.replaceChild(_img, td.firstChild.firstChild);
break;
}
}
}
}
//--></script>
______________________________________________________________
I have tried to make the above happen by adding this to my Global Header
<script type="text/javascript"><!--
/*
Different Banner for Each Board
Open Source
*/
var _logo = new Array();
_logo["WeAreBack"] = "http://img.photobucket.com/albums/v315/JG26_EZ/JGsitePics/JG54Banner1.png";
_logo["Application threads"] = "http://img.photobucket.com/albums/v315/JG26_EZ/JGsitePics/JG54Banner2.png";
if(location.href.match(/board=(.+?)(&.+)?$/i)){
if(_logo[RegExp.$1]){
var td = document.getElementsByTagName("td")[1];
var _img = td.firstChild.firstChild.cloneNode(true);
_img.src = _logo[RegExp.$1];
td.firstChild.replaceChild(_img, td.firstChild.firstChild);
}
}
//--></script>
____________________________________
I have also tried to use URL links to my images, such as this one, (I added a space between the URL here, just so the image won't pop up on this post I'm writing).
[/URL]
Any help would be appreciated.
I have searched for this and found a code by Jordan, but I'm pretty much a noob when it comes to new code and stuff, so here's my question.
We would like to have a different banner image appear when not on the main screen of our forum.
This is the code I found, but am not sure where to put it, or if it's even geared to do what I want it to do.
_______________________________________________________
Code by Jordan
Allows you to have a different banner for each board.
Place the board id where the red is text is.
Global Headers
<script type="text/javascript"><!--
/*
Different Banner for Each Board
Open Source
*/
var _logo = new Array();
_logo["general"] = "image_url";
_logo["board_id"] = "image_url";
if(location.href.match(/board=(.+?)(&.+)?$/i)){
if(_logo[RegExp.$1]){
var td = document.getElementsByTagName("td")[1];
var _img = td.firstChild.firstChild.cloneNode(true);
_img.src = _logo[RegExp.$1];
td.firstChild.replaceChild(_img, td.firstChild.firstChild);
}
}
//--></script>
If you want to have the same image for each board in a category, use this version. Be sure to put the category id and not the board id where the red text is.
<script type="text/javascript"><!--
var _logo = new Array();
_logo["general"] = "image_url";
_logo["board_id"] = "image_url";
if(location.href.match(/board=(.+?)(&.+)?$/i)){
for(var a = document.getElementsByTagName("a"), x = 0; x < a.length; x++){
if(a[x].className == "nav" && a[x].previousSibling.nodeType == 3 && a[x].previousSibling.data.match(/::/i)){
if(_logo[a[x].href.split("#")[1]]){
var td = document.getElementsByTagName("td")[1];
var _img = td.firstChild.firstChild.cloneNode(true);
_img.src = _logo[a[x].href.split("#")[1]];
td.firstChild.replaceChild(_img, td.firstChild.firstChild);
break;
}
}
}
}
//--></script>
______________________________________________________________
I have tried to make the above happen by adding this to my Global Header
<script type="text/javascript"><!--
/*
Different Banner for Each Board
Open Source
*/
var _logo = new Array();
_logo["WeAreBack"] = "http://img.photobucket.com/albums/v315/JG26_EZ/JGsitePics/JG54Banner1.png";
_logo["Application threads"] = "http://img.photobucket.com/albums/v315/JG26_EZ/JGsitePics/JG54Banner2.png";
if(location.href.match(/board=(.+?)(&.+)?$/i)){
if(_logo[RegExp.$1]){
var td = document.getElementsByTagName("td")[1];
var _img = td.firstChild.firstChild.cloneNode(true);
_img.src = _logo[RegExp.$1];
td.firstChild.replaceChild(_img, td.firstChild.firstChild);
}
}
//--></script>
____________________________________
I have also tried to use URL links to my images, such as this one, (I added a space between the URL here, just so the image won't pop up on this post I'm writing).
[/URL]
Any help would be appreciated.