User Guide

A simple block/tag translator example 349
//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";
}else{
imageRef = "images/kent_hardAtWorkOnWin.jpg";
}
}else{
imageRef = "images/kent_sleeping.jpg";
}
//If it's after midnight and before 10am, or anytime on Sunday
}else{
imageRef = "images/kent_sleeping.jpg";
}
return imageRef;
}
</script>
</head>
<body>
</body>
</html>
Creating Property inspectors for locked content
After you create a translator, you need to create a Property inspector for the content so the user
can change its properties (for example, the file to be included or one of the conditions in a
conditional statement). Inspecting translated content is a unique problem for several reasons:
The user might want to change the properties of the translated content, and those changes
must be reflected in the untranslated content.
The DOM contains the translated content (that is, the lock tags and the tags they surround are
nodes in the DOM), but the
outerHTML property of the documentElement object and the
dreamweaver.getSelection() and dreamweaver.nodeToOffsets() functions act on the
untranslated source.
The tags you inspect are different before and after translation.
A Property inspector for the
HAPPY tag might have a comment that looks similar to the following
example:
<!-- tag:HAPPY,priority:5,selection:exact,hline,vline, attrName:xxx,¬
attrValue:yyy -->
The Property inspector for the translated HAPPY tag, however, would have a comment that looks
similar to the following example:
<!-- tag:*LOCKED*,priority:5,selection:within,hline,vline -->