\n";
}
//Returns fn call to insert in HTML tag
//Gets list of layers from doc property. With each layer, it gets the parallel
//layer name from select 'menu'. Each layerObj refs and properties are embedded as arguments.
function applyBehavior() {
return "resizePatch()"; //return fn call with args
}
//Given the original function call, this parses out the args and updates
//the UI. First it gets new layer, property sets
//If layer already present in menu, stuff properties in property arrays. If layer
//doesn't exist, add to menu, and extend property arrays with defaults.
function inspectBehavior(){
var dummy = "nada"
}
//Used to improve performance, this hardcodes the expected window size. Without
//this fn, or if WINDOWSIZE_Autosize is false, DW will render the UI dynamically.
//IMPORTANT: for internationalization and other UI changes, update the globals.
function WindowDimensions(platform) {
if (!WINDOWSIZE_Autosize) {
if (platform.charAt(0) == "m" || platform.charAt(0) == "M") //if Mac
return WINDOWSIZE_Mac;
else //else Windows 95 or NT
return WINDOWSIZE_Win;
}
}
//***************** LOCAL FUNCTIONS ******************
//Load the select menu with layer names.
//Also sets the global property arrays to the right num of items.
function initializeUI(){
}
//Given menu selection, looks up the menu's selection number, and stores the
//new properties at that position in the global document properties arrays.
//**************** GENERIC FUNCTIONS ****************
//Given a function call, extracts the args and returns them in array
//Respects ', skips over stuff between quotes, and returns them dequoted.
//IMPORTANT: argArray[0] is the function call!! Actual args start at argArray[1].
function extractArgs(behFnCallStr){
var i, theStr, lastPos, argArray;
argArray = getTokens(behFnCallStr,"(),");
for (i=0; i 0 && theStr.charAt(lastPos) == "'")
argArray[i] = theStr.substring(1,lastPos);
}
return argArray
}
//Given a string "some property (value)" returns "some property".
function stripValue(theStr) {
var endPos = theStr.indexOf(' (');
return ((endPos > 0)? theStr.substring(0,endPos) : theStr);
}
//Given theSelect obj and an index and horzizontal and vertical booleans,
//it appends the booleans in parens and inserts the new string into the menu at position index.
//Passed a string, finds special chars '"\ and escapes them with \
function escQuotes(theStr){
var i, theChar, escStr = "";
for(i=0; i 1) {
niceRef = objTypeStr + ' ' + nameReduce(tokens[0]); //start building str, ie: image "foo"
if (tokens.length > 2) { //reference includes some nesting...
if (tokens[1] != "document") //inside a form so add form reference
niceRef += ' ' + TYPE_Separator + ' ' + TYPE_Form + ' ' + nameReduce(tokens[1]);
for (j=1; j "myImg"
// layers['foo'] => "foo"
// embeds[0] => 0
// myImg[2] => "myImg[2]"
function nameReduce (objName) {
var retVal, arrayTokens;
retVal = '"' + objName + '"'; //default is object wrapped in quotes
if (objName.indexOf("[") > 0) { //if it's an array
arrayTokens = getTokens(objName,"[]\"'"); //break up tokens
if (arrayTokens.length == 2) { //if exactly two tokens
if ("layers forms embeds links anchors all".indexOf(arrayTokens[0]) != -1) { //if legal
if (arrayTokens[1] == ""+parseInt(arrayTokens[1])) //if a number
retVal = arrayTokens[1];
else //else it's a string
retVal = '"' + arrayTokens[1] + '"';
}
}
}
return retVal;
}
//Emulates printf("blah blah %s blah %s",str1,str2)
//Used for concatenating error message for easier localization.
//Returns assembled string.
function errMsg() {
var i,numArgs,errStr="",argNum=0,startPos;
numArgs = errMsg.arguments.length;
if (numArgs) {
theStr = errMsg.arguments[argNum++];
startPos = 0; endPos = theStr.indexOf("%s",startPos);
if (endPos == -1) endPos = theStr.length;
while (startPos < theStr.length) {
errStr += theStr.substring(startPos,endPos);
if (argNum < numArgs) errStr += errMsg.arguments[argNum++];
startPos = endPos+2; endPos = theStr.indexOf("%s",startPos);
if (endPos == -1) endPos = theStr.length;
}
if (!errStr) errStr = errMsg.arguments[0];
}
return errStr;
}
//*************** END OF JAVASCRIPT *****************
behavior "Center Layers"