Adobe 38040334 - Dreamweaver CS3 User Manual page 346

Extending dreamweaver
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

var hour = today.getUTCHours();
var SFhour = hour - 8;
var platform = navigator.platform;
var imageRef;
// If SFhour is negative, you have two adjustments to make.
// First, subtract one from the day count because it is already the wee
// hours of the next day in GMT. Second, add SFhour to 24 to
// give a valid hour in the 24-hour clock.
if (SFhour < 0){
day = day - 1;
// The day count back one would make it negative, and it's Saturday,
// so set the count to 6.
if (day < 0){
day = 6;
}
SFhour = SFhour + 24;
}
// Now determine which photo to show based on whether it's a work day or a
// weekend; what time it is; and, if it's a time and day when Kent is
// working, what platform the user is on.
//If it's not Sunday
if (day != 0){
//And it's between 10am and noon, inclusive
if (SFhour >= 10 && SFhour <= 12){
imageRef = "images/kent_tiredAndIrritated.jpg";
//Or else it's between 1pm and 3pm, inclusive
}else if (SFhour >= 13 && SFhour <= 15){
imageRef ="images/kent_hungry.jpg";
//Or else it's between 4pm and 5pm, inclusive
}else if (SFhour >= 16 && SFhour <= 17){
//If user is on Mac, show Kent working on Mac
if (platform == "MacPPC"){
imageRef = "images/kent_gettingStartedOnMac.jpg";
//If user is on Win, show Kent working on Win
}else{
imageRef = "images/kent_gettingStartedOnWin.jpg";
}
//Or else it's after 6pm but before the stroke of midnight
}else if (SFhour >= 18){
//If it's Saturday
if (day == 6){
imageRef = "images/kent_dancing.jpg";
//If it's not Saturday, check the user's platform
}else if (platform == "MacPPC"){
imageRef = "images/kent_hardAtWorkOnMac.jpg";
// The current hour in GMT, based on the
// 24-hour clock.
// The time in San Francisco, based on the
// 24-hour clock.
// User's platform. All Windows computers
// are identified by Dreamweaver as "Win32",
// all Macs as "MacPPC".
// The image reference to be returned.
DREAMWEAVER CS3
340
Extending Dreamweaver

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents