time of day style...

phpBB3 styling support, style coding, and style graphics assistance.
Forum rules
Style coding and style related questions only.

time of day style...

Postby spaceace » 06 Mar 2011, 18:36

i need to know if it's possible for a style to tell the time of day a user has. a member here(you'll know who you are if you read this) talked about creating a style that would change with the users time of day. example would be the base colour of the style is light blue in the morning and progresses to a dark blue at night. all depending on the time of day on the users end. i know it would need multiple stylesheets but i just don't know how to code the time part if it's even possible.
User avatar
spaceace
Supporter
Supporter
 
Posts: 263
Joined: 14 Feb 2008, 20:44
Location: Ontario, Canada
Gender: Male
phpBB Knowledge: 5


Re: time of day style...

Postby Sniper_E » 06 Mar 2011, 22:08

May be off topic...
Your post reads: by spaceace on Mar 6, 2011, 6:36 pm
Does it show the same time to everyone in all the posts?
Does anyone see a different time on spaceace's post other than 6:36 pm? I'm curious...
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6985
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Re: time of day style...

Postby barri123 » 07 Mar 2011, 00:04

Hello,
I am studied this topic at CSS, in the CSS it is even too much difficult coding but using the ASP.net it would be much easy I am giving you some codes you can check them hopefully it will work for you.

Option 1: Color Picker

Use this color picker to find a suitable color. To use it:

1. Use the slider on the right to change the hue.
2. Click anywhere in the large square to pick a color.
3. Once you're happy with the color, copy the hexadecimal value from the bottom field (the series of 6 digits/letters in bold (for example #FFFFFF).
barri123
Crewman
Crewman
 
Posts: 1
Joined: 06 Mar 2011, 23:30
Location: USA
Gender: Female
phpBB Knowledge: 2

Re: time of day style...

Postby spaceace » 07 Mar 2011, 08:21

Sniper_E wrote:May be off topic...
Your post reads: by spaceace on Mar 6, 2011, 6:36 pm
Does it show the same time to everyone in all the posts?
Does anyone see a different time on spaceace's post other than 6:36 pm? I'm curious...


i have this - by spaceace on March 6th, 2011, 7:36 pm

it should show different for each members time zone and dst setting. if we all had the same tz, it would all be the same time ;)

i guess what i'm looking for is something like <!-- IF THIS_TIME --> use this stylesheet <!-- ESLE --> use this one <!-- ENDIF -->

i know it's not going to be quite that simple, but that should at least show what i'm trying to do. and that code would go into the overall_header.html and simple_header.html to load the stylesheet. i just need to know if there's a piece of code that would pull the users time and work solely from the style without adding or changing core code.
User avatar
spaceace
Supporter
Supporter
 
Posts: 263
Joined: 14 Feb 2008, 20:44
Location: Ontario, Canada
Gender: Male
phpBB Knowledge: 5

Re: time of day style...

Postby spaceace » 07 Mar 2011, 19:15

ok, i think i found the code that i need to use to pull the time data. small piece of js and it should in theory execute each stylesheet accordingly. what i need to know is if i'm correct in my js before i even begin to work on this.

Code: Select all
<script type="text/javascript">
var d = new Date()
var time = d.getHours()
if (time<10)
  {
  document.write("<link href="{T_THEME_PATH}/morning.css" rel="stylesheet" type="text/css" media="screen, projection" />");
  }
else if (time>10 && time<16)
  {
  document.write("<link href="{T_THEME_PATH}/day.css" rel="stylesheet" type="text/css" media="screen, projection" />");
  }
else
  {
  document.write("<link href="{T_THEME_PATH}/evening.css" rel="stylesheet" type="text/css" media="screen, projection" />");
  }
</script>
User avatar
spaceace
Supporter
Supporter
 
Posts: 263
Joined: 14 Feb 2008, 20:44
Location: Ontario, Canada
Gender: Male
phpBB Knowledge: 5

Re: time of day style...

Postby spaceace » 08 Mar 2011, 07:40

someone looked over the code i have and told me of a small change that i needed to make and now all is working fine for when i start to develop a new style that changes as a day progresses :D

i've never seen anyone do this kind of style and now i just hope that i can do it before anyone else LOL
User avatar
spaceace
Supporter
Supporter
 
Posts: 263
Joined: 14 Feb 2008, 20:44
Location: Ontario, Canada
Gender: Male
phpBB Knowledge: 5

Re: time of day style...

Postby Sniper_E » 08 Mar 2011, 08:16

shhhhhhh, *wispers* don't tell anyone.
It's a very nice idea Ace! I haven't thought of it before. Look forward to seeing your finished product. :good:
Does that code of yours above work? I'd like to use it for a background change in another mod if I could.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6985
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Re: time of day style...

Postby spaceace » 08 Mar 2011, 09:57

no, that code does not work. but this code does ;)

tested it this morning.
Spoiler:
Code: Select all
<script type="text/javascript">
var d = new Date()
var time = d.getHours()
if (time<10)
  {
  document.write('<link href="{T_THEME_PATH}/morning.css" rel="stylesheet" type="text/css" media="screen, projection" />');
  }
else if (time>10 && time<16)
  {
  document.write('<link href="{T_THEME_PATH}/day.css" rel="stylesheet" type="text/css" media="screen, projection" />');
  }
else
  {
  document.write('<link href="{T_THEME_PATH}/evening.css" rel="stylesheet" type="text/css" media="screen, projection" />');
  }
</script>


i did however find that several aspects of the stylesheet have to be changed as it's still wanting to use stylesheet.css for some things. it's going to be a lot of work to get this one done :blink:
User avatar
spaceace
Supporter
Supporter
 
Posts: 263
Joined: 14 Feb 2008, 20:44
Location: Ontario, Canada
Gender: Male
phpBB Knowledge: 5

Re: time of day style...

Postby spaceace » 09 Mar 2011, 07:35

got all the final pieces of the code finished and have had to add the part for people who have js disabled and the style is going to be called "Time and space". no demo or screens yet as the basics are still in dev ;)
User avatar
spaceace
Supporter
Supporter
 
Posts: 263
Joined: 14 Feb 2008, 20:44
Location: Ontario, Canada
Gender: Male
phpBB Knowledge: 5

Re: time of day style...

Postby Honor » 09 Mar 2011, 11:41

Would love this!
BluePlanet RP
my own creation.

Host: Host Monster
Version: 3.0.9
Honor    
STG Moderator
STG Moderator
 
Posts: 328
Joined: 23 Dec 2010, 10:53
Gender: Female
phpBB Knowledge: 2

Next

Return to phpBB3 Styling Assistance

Who is online

Users browsing this forum: Majestic-12 [Bot], Sogou [Bot] and 13 guests