vForums Support > Programming & Coding :: Code Requests & Support :: > [F] Requesting A Code Please

[F] Requesting A Code Please - Posted By CåñåÐå™ (canada) on 17th Feb 08 at 8:23pm
Would this "Change color of "Today" & "Yesterday" be possible please.

Re: Requesting A Code Please - Posted By Marc (cr0w) on 17th Feb 08 at 8:24pm
 
Would this "Change color of "Today" & "Yesterday" be possible please.


Would this be for any specific place[s], or everywhere? {Smile}

Re: Requesting A Code Please - Posted By CåñåÐå™ (canada) on 18th Feb 08 at 1:06am
Just for the main page will be fine please {Smile} and thanks Marc .

Re: Requesting A Code Please - Posted By Marc (cr0w) on 18th Feb 08 at 1:35am
 
Just for the main page will be fine please {Smile} and thanks Marc .


Just for the "Last Post" column, or in the info center, as well?

Re: Requesting A Code Please - Posted By dog199200 (dog199200) on 18th Feb 08 at 3:20am
you couold always use the switch it code and put in the Yesterday and today text, like this:

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /* Switch-It by Cr0w */
  4. function switchIt(word,word2){
  5.     var f = document.getElementsByTagName("font");
  6.     for(i=0;i<f.length;i++){
  7.         f[i].innerHTML = f[i].innerHTML.replace(word,word2);
  8.     }
  9. }
  10.  
  11. switchIt("Yesterday","<Font Color=green>Yesterday<font>");
  12. switchIt("Today","<Font Color=red>Today<font>");
  13. //-->
  14. </script>
 


you would just have to change the color names to what you want them to be or add a # and put in a color hex {Smile}

Re: Requesting A Code Please - Posted By Marc (cr0w) on 18th Feb 08 at 3:32am
Posted By dog199200 on 18th Feb 08 at 3:20am
 
you couold always use the switch it code and put in the Yesterday and today text, like this:

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /* Switch-It by Cr0w */
  4. function switchIt(word,word2){
  5.     var f = document.getElementsByTagName("font");
  6.     for(i=0;i<f.length;i++){
  7.         f[i].innerHTML = f[i].innerHTML.replace(word,word2);
  8.     }
  9. }
  10.  
  11. switchIt("Yesterday","<Font Color=green>Yesterday<font>");
  12. switchIt("Today","<Font Color=red>Today<font>");
  13. //-->
  14. </script>
 


you would just have to change the color names to what you want them to be or add a # and put in a color hex {Smile}


Yes, but that would replace it everywhere; in posts, too. That's why I'm asking him exactly where he wants it to be replaced, so that I can check the specific cells only. {Wink}

Re: Requesting A Code Please - Posted By dog199200 (dog199200) on 18th Feb 08 at 3:58am
lol ya i see, that makes sence.

Re: Requesting A Code Please - Posted By CåñåÐå™ (canada) on 18th Feb 08 at 4:07am
 

Just for the "Last Post" column, or in the info center, as well?
If it will be easier for you to do like this that will be cool thanks.

Re: Requesting A Code Please - Posted By Marc (cr0w) on 18th Feb 08 at 4:08am
 
 

Just for the "Last Post" column, or in the info center, as well?
If it will be easier for you to do like this that will be cool thanks.


What colours would you like them to change to? {Smile}

Re: Requesting A Code Please - Posted By CåñåÐå™ (canada) on 18th Feb 08 at 4:13am
For "Today" 336600 and for "Yesterday" FFCC66 please {Smile} .

Re: Requesting A Code Please - Posted By Marc (cr0w) on 18th Feb 08 at 4:14am
 
For "Today" 336600 and for "Yesterday" FFCC66 please {Smile} .


Give me a minute. {Smile}

Re: Requesting A Code Please - Posted By CåñåÐå™ (canada) on 18th Feb 08 at 4:24am
Ok no worries {Grin} .

Re: Requesting A Code Please - Posted By Marc (cr0w) on 18th Feb 08 at 4:44am
Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /* Change "Today" and "Yesterday" Colours
  4. By Cr0w */
  5.  
  6. if(location.href.match(/\.co\.uk(\/$|\/action\/home$|\/action\/home\/$|$)/i)){
  7.  
  8.     var td = document.getElementsByTagName("td");
  9.     var lpc = document.getElementById("info_center_last_post");
  10.  
  11.     lpc.innerHTML = lpc.innerHTML.replace(/Today<\/b> at/i, '<font color="#336600">Today</font></b> at');
  12.     lpc.innerHTML = lpc.innerHTML.replace(/Yesterday<\/b> at/i, '<font color="#FFCC66">Yesterday</font></b> at');
  13.  
  14.     for(t=0;t<td.length;t++){
  15.         if(td[t].className.match(/(window2|lastpost)/) && td[t].width == "25%" && td[t-1].width == "69%"){
  16.             td[t].innerHTML = td[t].innerHTML.replace(/Today<\/b> at/i, '<font color="#336600">Today</font></b> at');
  17.             td[t].innerHTML = td[t].innerHTML.replace(/Yesterday<\/b> at/i, '<font color="#FFCC66">Yesterday</font></b> at');
  18.         }
  19.     }
  20.  
  21. }
  22. //-->
  23. </script>
 


Main Footer. {Smile}

Re: Requesting A Code Please - Posted By CåñåÐå™ (canada) on 18th Feb 08 at 4:53am
Thank you Marc its working fine my friend , nice code {Grin} .

Re: Requesting A Code Please - Posted By Marc (cr0w) on 18th Feb 08 at 4:54am
No problem. {Smile}

Re: Requesting A Code Please - Posted By CåñåÐå™ (canada) on 18th Feb 08 at 5:01am
I'm sorry to say this but when the page reloaded yesterday change back to the default color ?

http://tropolis.virtualforums.co.uk/

Re: Requesting A Code Please - Posted By Marc (cr0w) on 18th Feb 08 at 5:06am
Oops, the word "Yesterday" isn't bolded; thought it was. {Tongue Out} Give me a second. {Smile}

EDIT: How's this:

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /* Change "Today" and "Yesterday" Colours
  4. By Cr0w */
  5.  
  6. if(location.href.match(/\.co\.uk(\/$|\/action\/home$|\/action\/home\/$|$)/i)){
  7.  
  8.     var td = document.getElementsByTagName("td");
  9.     var lpc = document.getElementById("info_center_last_post");
  10.  
  11.     lpc.innerHTML = lpc.innerHTML.replace(/Today<\/b> at/i, '<font color="#336600">Today</font></b> at');
  12.     lpc.innerHTML = lpc.innerHTML.replace(/Yesterday at/i, '<font color="#FFCC66">Yesterday</font> at');
  13.  
  14.     for(t=0;t<td.length;t++){
  15.         if(td[t].className.match(/(window2|lastpost)/) && td[t].width == "25%" && td[t-1].width == "69%"){
  16.             td[t].innerHTML = td[t].innerHTML.replace(/Today<\/b> at/i, '<font color="#336600">Today</font></b> at');
  17.             td[t].innerHTML = td[t].innerHTML.replace(/Yesterday at/i, '<font color="#FFCC66">Yesterday</font> at');
  18.         }
  19.     }
  20.  
  21. }
  22. //-->
  23. </script>
 


{Smile}

Re: Requesting A Code Please - Posted By CåñåÐå™ (canada) on 18th Feb 08 at 5:08am
Ok lol .

Re: Requesting A Code Please - Posted By Marc (cr0w) on 18th Feb 08 at 5:08am
 
Ok lol .


I've edited my previous post. {Smile}

Re: Requesting A Code Please - Posted By CåñåÐå™ (canada) on 18th Feb 08 at 5:14am
Cool stuff my friend its perfect thank you {Grin} .

Re: Requesting A Code Please - Posted By Marc (cr0w) on 18th Feb 08 at 5:15am
No worries. {Smile}