Adobe 38040334 - Dreamweaver CS3 User Manual page 345

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

Advertisement

outStr = outStr + replCode;
// Copy everything after the KENT tag.
outStr = outStr + inStr.substring(start+6);
// Use the string you just created for the next trip through
// the document. This is the most inefficient part of all.
inStr = outStr;
start = inStr.indexOf('<kent>');
}
// When there are no more KENT tags in the document, return outStr.
return outStr;
}
/**************************************************************
* The replaceKentTag() function assembles the HTML that will
* replace the KENT tag and the special locking tags that will *
* surround the HTML. It calls the getImage() function to
* determine the SRC of the IMG tag.
**************************************************************/
function replaceKentTag(){
// The image to display.
var image = getImage();
// The location of the image on the local disk.
var depFiles = dreamweaver.getSiteRoot() + image;
// The IMG tag that will be inserted between the lock tags.
var imgTag = '<IMG SRC="/' + image + '" WIDTH="320" HEIGHT="240" ALT="Kent">\n';
// 1st part of the opening lock tag. The remainder of the tag is assembled
below.
var start = '<MM:BeginLock translatorClass="DREAMWEAVER_TEAM" type="kent"';
// The closing lock tag.
var end = '<MM:EndLock>';
//Assemble the lock tags and the replacement HTML.
var replCode = start + ' depFiles="' + depFiles + '"';
replCode = replCode + ' orig="%3Ckent%3E">\n';
replCode = replCode + imgTag;
replCode = replCode + end;
return replCode;
}
/******************************************************************
* The getImage() function determines which image to display
* based on the day of the week, the time of day and the
* user's platform. The day and time are figured based on UTC
* time (Greenwich Mean Time) minus 8 hours, which gives
* Pacific Standard Time (PST). No allowance is made for Daylight *
* Savings Time in this routine.
******************************************************************/
function getImage(){
var today = new Date();
var day = today.getUTCDay();
*
*
*
// Today's date & time.
// Day of the week in the GMT time zone.
// 0=Sunday, 1=Monday, and so on.
DREAMWEAVER CS3
Extending Dreamweaver
*
*
*
*
*
339

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents