InterOcean Designs
« Post Background Image Global-Certain Users »

Welcome Guest. Please Login or Register.
May 25, 2013, 6:57am




InterOcean Designs :: ProBoards Codes :: ProBoard Code Database :: Post Background Image Global-Certain Users
   [Search This Thread] [Share Topic] [Print]
 AuthorTopic: Post Background Image Global-Certain Users (Read 568 times)
SubDevo
Co-Admin
Code Support
member is offline

[avatar]

Creator of LSD...


[homepage]

Joined: Mar 2009
Gender: Male
Posts: 2,594
Location: MI, USA
Karma: 102
 Post Background Image Global-Certain Users
« Thread Started on Apr 8, 2012, 8:23pm »

Post Background Image Global-Certain Users by SubDevo
Tested in IE, FF, Opera, Safari and Chrome.

Allows you to use a background image for posts and PMs for your entire forum.
Allows you to give certain users a different background of your choosing.
Option to not use a global image and only use an image for certain users.
Option to use the image for the whole post cell or just the post only.

PREVIEW: You are looking at it! We use this code here at IOD! ;)

Using a global post image will give your forum a little more "character".
Admins can use the "certain users" background image as a "prize" or a "thank you" or whatever for a "special" member!

Enjoy!!!
SubDevo :)

Variable Descriptions:

var gType=0; // 0=Total cell, 1=Post only
Change this to 1 to use the image for the actual post only. For example, if a user only posts one line of text, the background image will only appear on that one line. Code default is to use the whole cell.

var gI="URL TO IMAGE"; // URL to Global Image.
Enter the URL to your global post background image. This image will be used for all posts except for the members listed in the next variable below.

uI["username"]="URL TO IMAGE"; // URL to Image.
Enter the user name (NOT display name) in the first Yellow part, and the URL to their image in the second part. Any users listed here will overide the global image. To add more users, simply copy/repeat this line and change the username and URL to the image.

Example:

uI["admin"]="URL TO IMAGE"; // URL to Image.
uI["joe2000"]="URL TO IMAGE"; // URL to Image.
uI["maryjp"]="URL TO IMAGE"; // URL to Image.

To temporarily disable any user, just set the user name part to "". Using this method, you don't have to remove the entire line of code and you can reuse it later.

NOTE:
If you have a user in the list, and the url does not start with "http:", the global image will be shown instead. If the URL is "bad", even the global image will not show. In this case, correct the URL or disable the user in the list by setting the user name to "".

Another point... You can change the code to use the same image for ALL posts by setting all the user names in the list to "". Likewise, you may set the Global image to "", to only use a background image for certain users.

Location: Global Footer
Code:
<script type="text/javascript">
/* Post Background Image Global-Certain Users by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* [url]http://interoceandesigns.com[/url] or [url]http://lsdp.proboards.com[/url] */

var gType=0; // 0=Total cell, 1=Post only
var gI="URL TO IMAGE"; // URL to Global Image.
var uI=[]; // DO NOT TOUCH
// FORMAT uI["username"]="URL TO IMAGE";
uI["username"]="URL TO IMAGE"; // URL to Image.

var td=document.getElementsByTagName("td"),b,i,n,pU,gN,x=-1,nx=/user=(.+?)\"/i;
function chBack(a){a.style.backgroundImage="url("+gN+")";}
if(/(calendar|pm|pre)view|search2|display/i.test(pb_action)){
&nbsp; &nbsp;while(td[++x]){ b=td[x]; n=b.nextSibling;
&nbsp; &nbsp;&nbsp; &nbsp;if(b.width=="20%"&&n&&n.width=="80%"&&nx.test(b.innerHTML)){
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;b=n.getElementsByTagName("td"); pU=RegExp.$1; gN=(uI[pU])?uI[pU]:gI;
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;if(/^http:/i.test(gN)){
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;if(gType){ n=n.firstChild.rows[1].cells[0].getElementsByTagName("font")[0];
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;n.style.display="block"; chBack(n);
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;}else{ chBack(n); i=-1;
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;while(b[++i]){ b[i].style.background="transparent none"; b[i].className="";}
}}}}}
</script>
« Last Edit: Apr 8, 2012, 8:33pm by SubDevo »Link to Post - Back to Top  IP: Logged

[image] [image]
[image]
Why are you looking at my signature, [ME]?
JJ
Senior Member
IOD Supporter
member is offline

[avatar]


[homepage]

Joined: Jan 2011
Gender: Female
Posts: 931
Location: Kentucky USA
Karma: 21
 Re: Post Background Image Global-Certain Users
« Reply #1 on Apr 9, 2012, 8:01pm »

Interesting. I used to use a background for the post area. I was wondering if it is possible to have a line for Window 1 and Window 2? I like to have a demarcation since I think it makes long threads easier to scroll up and down when you are looking for something.
Link to Post - Back to Top  IP: Logged

[image]
SubDevo
Co-Admin
Code Support
member is offline

[avatar]

Creator of LSD...


[homepage]

Joined: Mar 2009
Gender: Male
Posts: 2,594
Location: MI, USA
Karma: 102
 Re: Post Background Image Global-Certain Users
« Reply #2 on Apr 9, 2012, 8:48pm »

That would be a nice touch JJ! ;)
So basically the post backgrounds would alternate every other post right?
Give this a shot...

var bg1="URL TO IMAGE"; // URL to windowbg1 Image.
var bg2="URL TO IMAGE"; // URL to windowbg2 Image.

Basically, I replaced the global variable in the other code with two lines now. Should be self explanatory. Using the same URL in both variables would (of course) use the same image for all posts.
Any individual users listed will overide these two images.

Code:
<script type="text/javascript">
/* Post Background Image Global-Certain Users by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* [url]http://interoceandesigns.com[/url] or [url]http://lsdp.proboards.com[/url] */

var gType=0; // 0=Total cell, 1=Post only
var bg1="URL TO IMAGE"; // URL to windowbg1 Image.
var bg2="URL TO IMAGE"; // URL to windowbg2 Image.
var uI=[]; // DO NOT TOUCH
// FORMAT uI["username"]="URL TO IMAGE";
uI["username"]="URL TO IMAGE"; // URL to Image.

var td=document.getElementsByTagName("td"),b,i,n,pU,gN,x=-1,nx=/user=(.+?)\"/i;
function chBack(a){a.style.backgroundImage="url("+gN+")";}
if(/(calendar|pm|pre)view|search2|display/i.test(pb_action)){
&nbsp; &nbsp;while(td[++x]){ b=td[x]; n=b.nextSibling;
&nbsp; &nbsp;&nbsp; &nbsp;if(b.width=="20%"&&n&&n.width=="80%"&&nx.test(b.innerHTML)){
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;b=n.getElementsByTagName("td"); pU=RegExp.$1;
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;gN=(uI[pU])?uI[pU]:(/wbg2/i.test(n.className))?bg2:bg1;
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;if(/^http:/i.test(gN)){
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;if(gType){ n=n.firstChild.rows[1].cells[0].getElementsByTagName("font")[0];
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;n.style.display="block"; chBack(n);
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;}else{ chBack(n); i=-1;
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;while(b[++i]){ b[i].style.background="transparent none"; b[i].className="";}
}}}}}
</script>
Link to Post - Back to Top  IP: Logged

[image] [image]
[image]
Why are you looking at my signature, [ME]?
JJ
Senior Member
IOD Supporter
member is offline

[avatar]


[homepage]

Joined: Jan 2011
Gender: Female
Posts: 931
Location: Kentucky USA
Karma: 21
 Re: Post Background Image Global-Certain Users
« Reply #3 on Apr 9, 2012, 9:00pm »

Thanks, Sub, that's more my style.
Link to Post - Back to Top  IP: Logged

[image]
aRMY83
Elite Member
IOD Supporter
member is offline

[avatar]

It's me!


[homepage]

Joined: Mar 2010
Gender: Male
Posts: 1,077
Location: Just a Stone's Throw Away!
Karma: 40
 Re: Post Background Image Global-Certain Users
« Reply #4 on Apr 20, 2012, 4:09pm »

Sub...

Would it be possible to add a var for text color within the textareas while inputing only?
Link to Post - Back to Top  IP: Logged

[image]

[image]
aRMY83
Elite Member
IOD Supporter
member is offline

[avatar]

It's me!


[homepage]

Joined: Mar 2010
Gender: Male
Posts: 1,077
Location: Just a Stone's Throw Away!
Karma: 40
 Re: Post Background Image Global-Certain Users
« Reply #5 on Apr 22, 2012, 10:23am »

Sub...

Once again, should have checked the code index area and I would have found 'Individual Text Area Styles' which does exactly what I wanted and much more.



Link to Post - Back to Top  IP: Logged

[image]

[image]
SubDevo
Co-Admin
Code Support
member is offline

[avatar]

Creator of LSD...


[homepage]

Joined: Mar 2009
Gender: Male
Posts: 2,594
Location: MI, USA
Karma: 102
 Re: Post Background Image Global-Certain Users
« Reply #6 on Apr 30, 2012, 1:56pm »


Apr 22, 2012, 10:23am, aRMY83 wrote:
Sub...

Once again, should have checked the code index area and I would have found 'Individual Text Area Styles' which does exactly what I wanted and much more.
Sorry. Was gone a few days... Glad you found the code. Any other questions, just ask! ;)
Link to Post - Back to Top  IP: Logged

[image] [image]
[image]
Why are you looking at my signature, [ME]?
LunyRed
Senior Member
member is offline

[avatar]


[homepage]

Joined: Sept 2009
Gender: Male
Posts: 542
Location: An archipelago in SE Asia
Karma: 14
 Re: Post Background Image Global-Certain Users
« Reply #7 on May 10, 2012, 12:52am »

[image] [image]


Finally! It's about time! Thank you so much for sharing this code, Sub! I have a feeling my members would be very delighted to have this! =D

Better test it in my test forum.

Hmmm... Question. Since the code asks for the member's user name and NOT the display name, does that mean this code wouldn't have any conflicts with other codes involving the member's display names such as "Multi-colored Display Names" or "Replace User Name with Image by SubDevo" codes? I asked this just to play it safe... ^^;
Link to Post - Back to Top  IP: Logged

[image]
[ME] and I are best buddies~ Unlike me, [ME] is obsessed with Justin Bieber.. o_o'
Pebble
Code Helper
IOD Supporter
member is online

[avatar]


[homepage]

Joined: Mar 2011
Gender: Male
Posts: 1,190
Location: Here & There
Karma: 155
 Re: Post Background Image Global-Certain Users
« Reply #8 on May 10, 2012, 12:06pm »

No, there shouldn't be any conflicts with those codes. If you have any trouble, let us know, but it should work fine.
Link to Post - Back to Top  IP: Logged

[image]

   [Search This Thread] [Share Topic] [Print]

Click Here To Make This Board Ad-Free


This Board Hosted For FREE By ProBoards
Get Your Own Free Message Boards & Free Forums!
Terms of Service | Privacy Policy | Notice | FTC Disclosure | Report Abuse | Mobile