home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-11-19 | 31.0 KB | 1,012 lines |
- // Fireworks Microsoft FrontPage HTML & JavaScript
- // Version 3.0 03SEP99
-
- // To export HTML without comments change the value of variable doComments to "false".
- var doComments=true;
- var indentNestedImagemaps=false;
-
- // When doComments is set to "true" the WRITE_HTML_COMMENT and WRITE_JS_COMMENT functions
- // include HTML and JavaScript comments in the exported file.
- function WRITE_HTML_COMMENT(str) {
- if (doComments) WRITE_HTML("<!--"+str+"-->\n");
- }
-
- function WRITE_JS_COMMENT(str) {
- if (doComments) WRITE_HTML("/* "+str+" */\n");
- }
-
- var doHeader = true;
- doHeader = exportDoc.generateHeader;
- // When HTML is generated to a file, generateHeader is true.
- // When HTML is generated for the clipboard,
- // generateHeader is false.
-
-
- // These are the suffixes for the first 4 frames
- var sfx = new Array();
- sfx[0] = ""; // first frame doesn't normally have a suffix.
- sfx[1] = "_f2"; // second frame.
- sfx[2] = "_f3"; // third frame.
- sfx[3] = "_f4"; // fourth frame.
- var numSFX = 4;
- function UpdateFileNames(curSlices) {
- for (var curRow = 0; curRow < curSlices.numRows; curRow++) {
- for (var curCol = 0; curCol < curSlices.numColumns; curCol++) {
- if (curSlices[curRow][curCol].skipCell) continue;
- var nestedTable = curSlices[curRow][curCol].nestedTableSlices;
- if (nestedTable) {
- UpdateFileNames(nestedTable);
- continue;
- }
- var curSlice = curSlices[curRow][curCol];
- var cellName = "";
- if (curSlice && curSlice.getFrameFileName(0)) {
- cellName = curSlice.getFrameFileName(0).toString();
- var i;
- var limit = exportDoc.numFrames;
- if (limit > numSFX) limit = numSFX;
- for (i=0; i<limit; i++) {
- if (curSlice.getFrameFileName(i)) {
- curSlice.setFrameFileName(i, cellName + sfx[i]);
- }
- }
- }
- }
- }
- }
- UpdateFileNames(slices);
-
- var d = new Date();
- if (doHeader) {
- // Write general comments for copying and pasting Fireworks-generated code into existing HTML documents.
- WRITE_HTML_COMMENT("To put this html into an existing HTML document, you must copy the JavaScript and");
- WRITE_HTML_COMMENT("paste it in a specific location within the destination HTML document. You must then copy");
- WRITE_HTML_COMMENT("and paste the table in a different location.");
- WRITE_HTML("\n");
-
-
- WRITE_HTML("<html>\n");
- WRITE_HTML("\n");
-
- WRITE_HTML("<head>\n");
- WRITE_HTML("\n");
-
- // Use Base Name from export dialog as document title.
- WRITE_HTML("<title>", exportDoc.filename, "</title>\n");
- WRITE_HTML("\n");
-
- // Write Meta tags.
- WRITE_HTML("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
- var charSet = App.getPref("HtmlCharSet");
- if (charSet == "") charSet = "iso-8859-1";
- WRITE_HTML(charSet + "\">\n");
- WRITE_HTML("<meta name=\"description\" content=\"Fireworks Splice HTML\">\n");
- WRITE_HTML("\n");
-
- // Close head tag.
- WRITE_HTML("</head>\n");
- WRITE_HTML("\n");
-
- // Begin body tag. Set background color to Fireworks document canvas color.
- WRITE_HTML("<body bgcolor=\"#", exportDoc.backgroundColor.toString(16), "\" onload=\"\" " );
-
- WRITE_HTML( ">\n");
- WRITE_HTML("\n");
- }
- // Write HTML target and date created.
- WRITE_HTML("<!-- Fireworks 3.0 Microsoft FrontPage target.\n Created ", d, " -->\n");
- WRITE_HTML("\n");
-
- // Declare variables for processing Behaviors.
- var kActionStatusMessage = 1;
- var kActionSwapImage = 2;
- var kActionButtonDown = 4;
- var kActionSwapImageRestore = 5;
- var kActionButtonHighlight = 6;
- var kActionButtonRestore = 7;
-
-
- var kEventMouseOver = 0;
- var kEventOnClick = 1;
- var kEventMouseOut = 2;
- var kEventOnLoad = 3;
-
- var hasStatusMessage = false;
- var hasSwap = false;
- var hasDown = false;
- var hasRestore = false;
- var hasOnloadInits = false;
-
- // Function cellName determines the name for the image in a particular table cel
- // cellName is based off of the slice name if one was specified. Otherwise the
- // Base file name from the export dialog is used.
- function CellName(curSlices, row, col) {
- var curSlice = curSlices[row][col];
- var cellName = "";
- if (curSlice && curSlice.getFrameFileName(0)) {
- cellName = curSlice.getFrameFileName(0).toString();
- curSlice.setFrameFileName(0, cellName);
- // remove illegal characters
- cellName = cellName.replace(/\W/g, "");
- // if it starts with a number, add N to the front.
- if (cellName == "") cellName = "n" + exportDoc.imagename + "_" + (row+1) + "_" + (col+1);
- if (cellName.search(/\d/) == 0) {
- cellName = "n"+cellName;
- }
- }
- if (cellName!="") return(cellName);
-
- var prefix;
- if (!curSlices) return("nullCellName");
- if (curSlices.id == 0) {
- prefix = "";
- } else {
- prefix = curSlices.id+"_";
- }
- var suffix="";
- if (curSlices.numRows > 1 || curSlices.numColumns > 1) {
- suffix = "_" + (row+1) + "_" + (col+1);
- }
- cellName = "n" + prefix + exportDoc.imagename + suffix;
- return(cellName);
- }
-
- // Determine and process Behaviors in the document.
- function ProcessEvent(theCurBehaviors, targetEvent) {
- // Declare variable for processing Behaviors.
- var javaScript = "";
- var stat = false;
- var eraseStatOnMouseOut = false;
- var swapImage = "";
- var nbHighlight = "";
- var nbHighlightPreload = false;
- var nbDown = "";
- var nbDownPreload = false;
- var swap = "";
- var swapRestore = false;
- var buttonRestore = false;
-
- // Translate Behaviors into JavaScript.
- for (var i=0; i<theCurBehaviors.numberOfBehaviors; i++) {
- var curBehavior = theCurBehaviors[i];
-
- // Check for erase on mouse out status messages.
- if (curBehavior.action == kActionStatusMessage) {
- if (curBehavior.restoreOnMouseout) eraseStatOnMouseOut=true;
- }
-
- if (curBehavior.event != targetEvent) continue;
-
- if (curBehavior.action == kActionStatusMessage) {
- var statMsg = curBehavior.statusText;
- var curStat = "";
- curStat = "MM_displayStatusMsg('" + statMsg + "');";
- javaScript += curStat;
- stat = true;
- continue;
- }
- if (curBehavior.action == kActionSwapImageRestore) {
- swapRestore = true;
- continue;
- }
-
- if (curBehavior.action == kActionButtonRestore) {
- buttonRestore = true;
- continue;
- }
-
- var swapRow = curBehavior.targetRowNum;
- var swapCol = curBehavior.targetColumnNum;
- var swapFrame = curBehavior.targetFrameNum;
- var swapTable = curBehavior.targetTable;
- var fileName;
-
- if (!swapTable) {
- /* Not a swap behavior, so continue. */
- continue;
- }
-
- if (curBehavior.hasHref) {
- fileName = curBehavior.href;
- } else {
- fileName = swapTable.imagesDirPath + swapTable[swapRow][swapCol].getFrameFileName(swapFrame) + swapTable[swapRow][swapCol].imageSuffix;
- }
-
- var cellName = CellName(swapTable, swapRow,swapCol);
-
- // Translate button Behaviors into JavaScript.
- if (curBehavior.action == kActionButtonDown) {
- //MM_nbGroup(event, groupName, imgName, downSrc...preloadMarker)
- nbDown += "'" + cellName + "','" + fileName + "',";
- if (curBehavior.preload) nbDownPreload = true;
- continue;
- }
- // Translate button Behaviors into JavaScript.
- if (curBehavior.action == kActionButtonHighlight) {
- var highlightName = "";
- if (curBehavior.downHighlight) {
- if (curBehavior.hasDhHref) {
- highlightName = curBehavior.dhHref;
- } else {
- var f = curBehavior.dhTargetFrameNum;
- highlightName = swapTable.imagesDirPath + swapTable[swapRow][swapCol].getFrameFileName(f) + swapTable[swapRow][swapCol].imageSuffix
- }
- }
- nbHighlight += "'" + cellName + "','" + fileName + "','" + highlightName +"',";
- if (curBehavior.preload) nbHighlightPreload = true;
- continue;
- }
- // Translate Swap Image Behaviors into JavaScript.
- if (curBehavior.action == kActionSwapImage) {
- swap += "'" +cellName +"','','" + fileName + "',";
- continue;
- }
- }
-
- if (nbDown != "") {
- javaScript += "MM_nbGroup('down','navbar1'," + nbDown
- if (nbDownPreload) {
- javaScript += "1);";
- } else {
- javaScript += "0);";
- }
- }
- if (nbHighlight != "") {
- javaScript += "MM_nbGroup('over'," + nbHighlight
- if (nbHighlightPreload) {
- javaScript += "1);";
- } else {
- javaScript += "0);";
- }
- }
- if (swap != "") {
- javaScript += "MM_swapImage(" + swap + "1);";
- }
- if (swapRestore) {
- javaScript += "MM_swapImgRestore();";
- }
- if (buttonRestore) {
- javaScript += "MM_nbGroup('out');";
- }
- // Erase status bar message onMouseOut.
- if (eraseStatOnMouseOut && targetEvent == kEventMouseOut) {
- javaScript += "MM_displayStatusMsg(' ');" ;
- stat = true;
- }
-
- if (stat) javaScript += "return document.MM_returnValue";
- return(javaScript);
- }
-
-
- // Determine and process Behaviors in the document.
- function ProcessBehavior(theCurBehaviors) {
-
- javaOver = ProcessEvent(theCurBehaviors, kEventMouseOver);
- javaOut = ProcessEvent(theCurBehaviors, kEventMouseOut);
- javaClick = ProcessEvent(theCurBehaviors, kEventOnClick);
- if (javaOver != "" || javaOut != "" || javaClick != "") {
- return(true);
- }
- return(false);
- }
-
- function DoFile(curBeh) {
- var swapRow = curBeh.targetRowNum;
- var swapCol = curBeh.targetColumnNum;
- var swapFrame = curBeh.targetFrameNum;
- var swapTable = curBeh.targetTable;
- var fileName = swapTable[swapRow][swapCol].getFrameFileName(0);
- if (curBeh.downHighlight && curBeh.hasDhTargetFrame) {
- var fm = curBeh.dhTargetFrameNum;
- if (!swapTable[swapRow][swapCol].getFrameFileName(fm)) {
- var tmp;
- var frame = fm+1;
- if (fm < 4) {
- tmp = fileName + sfx[fm];
- } else {
- tmp = fileName + "_f" + frame;
- }
- swapTable[swapRow][swapCol].setFrameFileName(fm, tmp);
- }
- }
- if (curBeh.preload) {
- DoPreload(curBeh, swapRow, swapCol, swapFrame, swapTable);
- }
- if (curBeh.hasTargetFrame && swapFrame > 0) {
- if (!swapTable[swapRow][swapCol].getFrameFileName(swapFrame)) {
- var frame = swapFrame + 1;
- if (swapFrame < 4) {
- fileName = fileName + sfx[swapFrame];
- } else {
- fileName = fileName + "_f" + frame;
- }
- swapTable[swapRow][swapCol].setFrameFileName(swapFrame, fileName);
- }
- }
- }
-
- var filesToPreload = new Array;
- var autoFrame = exportDoc.numFrames+1;
-
- function PreloadFile(fileName, swapTable, swapRow, swapCol, swapFrame) {
- if (!fileName) return;
- /* See if we already precached this one. */
- for (j=0; j<filesToPreload.length; j++) {
- if (filesToPreload[j] == fileName) {
- return;
- }
- }
- filesToPreload[j] = fileName;
-
- // Declare and name each image and specify width and height. Ex: I_02_02_f2= new Image(47, 16);
- allThePreloads += (" " + cellName + "_f" + (swapFrame+1) +
- " = new Image(" + swapTable[swapRow][swapCol].width + " ," + swapTable[swapRow][swapCol].height +"); ");
- // Write image source. Ex: I_02_02_f2.src = "File_02_02_f2.gif";
- allThePreloads += (cellName + "_f" + (swapFrame+1) +
- ".src = \"" + fileName +"\";\n");
- }
-
- function DoPreload(curBeh) {
- var swapRow = curBeh.targetRowNum;
- var swapCol = curBeh.targetColumnNum;
- var swapFrame = curBeh.targetFrameNum;
- var swapTable = curBeh.targetTable;
- var fileName;
- var curFile;
- var j;
- cellName = CellName(swapTable, swapRow,swapCol);
- if (!swapTable) {
- return;
- }
- if (curBeh.hasHref) {
- fileName = curBeh.href;
- swapFrame = autoFrame;
- autoFrame++;
- } else {
- curFile = swapTable[swapRow][swapCol].getFrameFileName(swapFrame);
- if (curFile)
- fileName = swapTable.imagesDirPath + curFile + swapTable[swapRow][swapCol].imageSuffix;
- }
- PreloadFile(fileName, swapTable, swapRow, swapCol, swapFrame);
- if (curBeh.downHighlight) {
- if (curBeh.hasDhHref) {
- fileName = curBeh.dhHref;
- } else {
- var f = curBeh.dhTargetFrameNum;
- curFile = swapTable[swapRow][swapCol].getFrameFileName(f);
- if (curFile) {
- fileName = swapTable.imagesDirPath + curFile + swapTable[swapRow][swapCol].imageSuffix;
- }
- }
- if (fileName) {
- PreloadFile(fileName, swapTable, swapRow, swapCol, swapFrame);
- }
- }
- /* Preload frame 0. */
- curFile = swapTable[swapRow][swapCol].getFrameFileName(0);
- if (curFile)
- fileName = swapTable.imagesDirPath + curFile + swapTable[swapRow][swapCol].imageSuffix;
- if (fileName) {
- PreloadFile(fileName, swapTable, swapRow, swapCol, 0);
- }
- }
-
- // Examine all behaviors to determine what actions are present.
- // Determine which files to pre-cache.
- var FWLoadInit = "\n function FWLoadInit() {\n";
-
- function DoFileAndPreloads(curSlices) {
- for (var curRow = 0; curRow < curSlices.numRows; curRow++) {
- for (var curCol = 0; curCol < curSlices.numColumns; curCol++) {
- if (curSlices[curRow][curCol].skipCell) continue;
- var nestedTable = curSlices[curRow][curCol].nestedTableSlices;
- if (nestedTable) {
- DoFileAndPreloads(nestedTable);
- continue;
- }
- if (curSlices[curRow][curCol].behaviors.numberOfBehaviors > 0) {
- var behaviors = curSlices[curRow][curCol].behaviors;
- for (var i=0; i<behaviors.numberOfBehaviors; i++) {
- var curBehavior = behaviors[i];
- if (curBehavior.action == kActionSwapImage) {
- DoFile(curBehavior);
- hasSwap = true;
- }
- if (curBehavior.action == kActionButtonDown || curBehavior.action == kActionButtonHighlight) {
- DoFile(curBehavior);
- hasDown = true;
- }
- if (curBehavior.action == kActionSwapImageRestore) {
- hasRestore = true;
- }
- if (curBehavior.action == kActionStatusMessage) {
- hasStatusMessage = true;
- }
- }
- var init = ProcessEvent(behaviors, kEventOnLoad);
- if (init != "") {
- hasOnloadInits = true;
- FWLoadInit += init + "\n";
- }
- }
- var imagemap = curSlices[curRow][curCol].imagemap;
- for (var j=0; j < imagemap.numberOfURLs; j++) {
- var curImagemap = imagemap[j];
- var behaviors = curImagemap.behaviors;
- for (var i=0; i<behaviors.numberOfBehaviors; i++) {
- var curBehavior = behaviors[i];
- if (curBehavior.action == kActionSwapImage) {
- DoFile(curBehavior);
- hasSwap = true;
- }
- if (curBehavior.action == kActionButtonDown || curBehavior.action == kActionButtonHighlight) {
- DoFile(curBehavior);
- hasDown = true;
- }
- if (curBehavior.action == kActionSwapImageRestore) {
- hasRestore = true;
- }
- if (curBehavior.action == kActionStatusMessage) {
- hasStatusMessage = true;
- }
- }
- var init = ProcessEvent(behaviors, kEventOnLoad) ;
- if (init != "") {
- hasOnloadInits = true;
- FWLoadInit += init + "\n";
- }
- }
- }
- }
- }
- if (doHeader) {
- // Write comment for start of JavaScript copy/paste section.
- WRITE_HTML_COMMENT("------------------ BEGIN COPYING THE HTML HERE -----------------");
- }
-
- // Begin Script. Hide Script from non-javascript-enabled browsers.
- WRITE_HTML("<script language=\"JavaScript\">\n");
- WRITE_HTML("<!-- hide this script from non-javascript-enabled browsers\n");
- WRITE_HTML("\n");
- // Find and declare all images used in Behaviors.
- var allThePreloads = "";
-
- DoFileAndPreloads(slices);
-
-
- /*-------------------------- JavaScript functions used in the HTML -----------------*/
-
-
- // Write out only the JavaScript functions needed for the HTM
-
- // Write function dm if document includes status bar messages.
- if (hasStatusMessage) {
- WRITE_JS_COMMENT("Function that displays status bar messages.")
- //WRITE_HTML(MM_displayStatusMsg);
- WRITE_HTML("function MM_displayStatusMsg(msgStr) { //v3.0\n");
- WRITE_HTML(" status=msgStr; document.MM_returnValue = true;\n");
- WRITE_HTML("}\n");
- WRITE_HTML("\n");
- }
-
- if (hasSwap || hasDown) {
- WRITE_JS_COMMENT("Functions that finds images.")
- //WRITE_HTML(MM_findObj);
- WRITE_HTML("function MM_findObj(n, d) { //v3.0\n");
- WRITE_HTML(" var p,i,x; if(!d) d=document; if((p=n.indexOf(\"?\"))>0&&parent.frames.length) {\n");
- WRITE_HTML(" d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}\n");
- WRITE_HTML(" if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];\n");
- WRITE_HTML(" for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;\n");
- WRITE_HTML("}\n");
- }
-
- // Write function di20 if document includes swap image behaviors.
- if (hasSwap) {
- WRITE_JS_COMMENT("Functions that swaps images.")
- //WRITE_HTML(MM_swapImage);
- WRITE_HTML("function MM_swapImage() { //v3.0\n");
- WRITE_HTML(" var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)\n");
- WRITE_HTML(" if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}\n");
- WRITE_HTML("}\n");
- }
-
- // Write function di20 if document includes swap image behaviors.
- if (hasDown) {
- WRITE_JS_COMMENT("Functions that swaps down images.")
- //WRITE_HTML(MM_nbGroup);
- WRITE_HTML("function MM_nbGroup(event, grpName) { //v3.0\n");
- WRITE_HTML(" var i,img,nbArr,args=MM_nbGroup.arguments;\n");
- WRITE_HTML(" if (event == \"init\" && args.length > 2) {\n");
- WRITE_HTML(" if ((img = MM_findObj(args[2])) != null && !img.MM_init) {\n");
- WRITE_HTML(" img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;\n");
- WRITE_HTML(" if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();\n");
- WRITE_HTML(" nbArr[nbArr.length] = img;\n");
- WRITE_HTML(" for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {\n");
- WRITE_HTML(" if (!img.MM_up) img.MM_up = img.src;\n");
- WRITE_HTML(" img.src = img.MM_dn = args[i+1];\n");
- WRITE_HTML(" nbArr[nbArr.length] = img;\n");
- WRITE_HTML(" } }\n");
- WRITE_HTML(" } else if (event == \"over\") {\n");
- WRITE_HTML(" document.MM_nbOver = nbArr = new Array();\n");
- WRITE_HTML(" for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {\n");
- WRITE_HTML(" if (!img.MM_up) img.MM_up = img.src;\n");
- WRITE_HTML(" img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];\n");
- WRITE_HTML(" nbArr[nbArr.length] = img;\n");
- WRITE_HTML(" }\n");
- WRITE_HTML(" } else if (event == \"out\" ) {\n");
- WRITE_HTML(" for (i=0; i < document.MM_nbOver.length; i++) {\n");
- WRITE_HTML(" img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }\n");
- WRITE_HTML(" } else if (event == \"down\") {\n");
- WRITE_HTML(" if ((nbArr = document[grpName]) != null)\n");
- WRITE_HTML(" for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }\n");
- WRITE_HTML(" document[grpName] = nbArr = new Array();\n");
- WRITE_HTML(" for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {\n");
- WRITE_HTML(" if (!img.MM_up) img.MM_up = img.src;\n");
- WRITE_HTML(" img.src = img.MM_dn = args[i+1];\n");
- WRITE_HTML(" nbArr[nbArr.length] = img;\n");
- WRITE_HTML(" } }\n");
- WRITE_HTML("}\n");
- WRITE_HTML("\n");
- }
-
- if (hasRestore) {
- WRITE_JS_COMMENT("Functions that handle named groups.")
- //WRITE_HTML(MM_swapImgRestore);
- WRITE_HTML("function MM_swapImgRestore() { //v3.0\n");
- WRITE_HTML(" var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;\n");
- WRITE_HTML("}\n");
- WRITE_HTML("\n");
- }
-
- function FWOnLoad() {
- if (FwPrevHook) FwPrevHook();
- FWLoadInit();
- }
-
- function FWHookLoad()
- {
- var agent = navigator.userAgent;
- var hookPrev = true;
- if (agent.indexOf("MSIE") != -1 &&
- agent.indexOf("Mac_") != -1) {
- hookPrev = false;
- }
- if (hookPrev) {
- FwPrevHook = window.onload;
- } else {
- FwPrevHook = false;
- }
- window.onload = FWOnLoad;
- }
-
-
- if (hasOnloadInits) {
- WRITE_HTML(FWOnLoad);
- WRITE_HTML(FWHookLoad);
- }
- /*----------------- END JavaScript functions used in the HTML -----------------*/
-
- // Stop hiding script from non-javascript-enabled browsers. End script.
- WRITE_HTML("// stop hiding -->\n");
- WRITE_HTML("</script>\n");
- WRITE_HTML("\n");
-
-
-
- // Write comment for start of table copy/paste section.
- WRITE_HTML_COMMENT("The following section is an image or HTML table which reassembles the sliced image in a browser.");
-
-
- function WriteTable(curSlices, indent) {
- // Begin table.
- var needTable = curSlices.numRows > 1 || curSlices.numColumns > 1;
- var curCol;
- var curRow;
- var downIndex = 0;
-
- if (needTable) {
- WRITE_HTML("<table ");
-
- // If the Fireworks document's canvas is not transparent and the Include undefined curSlices checkbox
- // is off, give the table a background color based on the Fireworks document's canvas color.
- if (!exportDoc.backgroundIsTransparent && curSlices.doSkipUndefined) {
- WRITE_HTML("bgcolor=\"#", exportDoc.backgroundColor, "\"");
- }
- WRITE_HTML("border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"",
- curSlices.width, "\">\n");
- /* This is the magic comment for html update. */
- if (indent == "") {
- //<--- fwtable fwsrc="mydoc" fwbase="basename" --->
- var comment = "<!-- fwtable fwsrc=\"" + exportDoc.docSaveName + "\" fwbase=\"" + exportDoc.filename + "\"" + " -->\n";
- WRITE_HTML(comment);
- if (allThePreloads != "" || hasOnloadInits) {
- WRITE_HTML(" <script language=\"JavaScript\">\n");
- WRITE_HTML(" <!-- hide \n");
- if ( hasOnloadInits) {
- WRITE_HTML(" " + FWLoadInit + "}\n");
- WRITE_HTML(" var FwPrevHook = false;\n");
- WRITE_HTML(" if (FWHookLoad) {FWHookLoad(); FWHookLoad=false;}\n");
- }
- if (allThePreloads != "") {
- WRITE_HTML(" if (document.images) {\n");
- WRITE_HTML(allThePreloads);
- WRITE_HTML(" }\n");
- }
- WRITE_HTML(" // stop hiding -->\n");
- WRITE_HTML(" </script>\n");
- }
- }
- // If shims have been specified, write shim row.
- if (curSlices.doShimEdges) {
- WRITE_HTML(indent+" <tr>\n");
- WRITE_HTML_COMMENT(" Shim row, height 1. ");
- for (curCol = 0; curCol < curSlices.numColumns; curCol++) {
- WRITE_HTML(indent+" <td><img src=\"", curSlices.shimPath, "\" width=\"",
- curSlices[0][curCol].cellWidth, "\" height=\"1\" border=\"0\"></td>\n");
- }
- WRITE_HTML(indent+" <td><img src=\"", curSlices.shimPath, "\" width=\"1",
- "\" height=\"1\" border=\"0\"></td>\n");
- WRITE_HTML(indent+" </tr>\n");
- WRITE_HTML("\n");
- }
- }
-
- // Write table rows.
- for (curRow = 0; curRow < curSlices.numRows; curRow++) {
- if (needTable) {
- WRITE_HTML(indent+" <tr valign=\"top\">");
- WRITE_HTML_COMMENT(" row "+(curRow+1)+" ");
- }
- for (curCol = 0; curCol < curSlices.numColumns; curCol++) {
- var curSlice = curSlices[curRow][curCol];
- if (curSlice.skipCell) continue;
-
- if (needTable) {
- // Write rowspan and colspan if necessary. Ex: rowspan="1" colspan="3"
- WRITE_HTML(indent+" <td");
- if (curSlice.rowSpan > 1) {
- WRITE_HTML(" rowspan=\"", curSlice.rowSpan,"\"");
- }
- if (curSlice.columnSpan>1) {
- WRITE_HTML(" colspan=\"", curSlice.columnSpan, "\"");
- }
- WRITE_HTML(">");
- }
-
- var nestedTable = curSlice.nestedTableSlices;
- if (nestedTable) {
- WriteTable(nestedTable, " "+indent);
- if (needTable) {
- WRITE_HTML("</td>");
- }
- WRITE_HTML("\n");
- continue;
- }
-
- // Write HTML text from curSlices set to "Text (No Image)"
- if (!curSlice.hasImage) {
- // no image, just dump out html text.
- if (curSlice.htmlText) {
- WRITE_HTML(curSlice.htmlText);
- } else if (needTable) {
- if (curSlices.shimPath) {
- WRITE_HTML("<img src=\"",
- curSlices.shimPath, "\" width=\"", curSlice.width, "\" height=\"",
- curSlice.height, "\" border=\"0\">");
- }
- }
- if (needTable) WRITE_HTML("</td>\n");
- continue;
- }
-
- // If current slice is not defined by a slice object and Export Undefined
- // curSlices is not checked, don't output an image and if Shims are specified
- // place a shim image in the current cel
- if (curSlice.isUndefined && curSlices.doSkipUndefined) {
- if (needTable) {
- if (curSlices.shimPath) {
- WRITE_HTML("<img src=\"",
- curSlices.shimPath, "\" width=\"", curSlice.width, "\" height=\"",
- curSlice.height, "\" border=\"0\">");
- }
- WRITE_HTML("</td>\n");
- }
- // Tell Fireworks to not write the image file. Setting the filename to "" forces
- // Fireworks to not generate the image.
- var q;
- for (q=0; q<exportDoc.numFrames; q++) {
- curSlice.setFrameFileName(q, "");
- }
- continue;
- }
-
- // Write link if slice has URL attached.
- var href = "href=\"#\"";
- var hasHref = curSlice.hasHref;
- var abortHref = false;
- if (curSlice.hasHref) {
- href = "href=\"";
- href += curSlice.href;
- href += "\"";
- if (curSlice.hasTargetText) {
- href += " target=\"";
- href += curSlice.targetText;
- href += "\"";
- }
- } else {
- var link = "";
- if (exportDoc.backgroundLink) {
- link = exportDoc.backgroundLink.href;
- }
- if (link != "") {
- hasHref = true;
- href = "href=\"" + link +"\"";
- }
- }
-
- if (slices.doDemoHTML && curSlice.downIndex>0) {
- href = "href=\"" + slices.demoHref(curSlice.downIndex) +".htm\"";
- }
-
- cellName = CellName(curSlices, curRow, curCol);
- var anchorTagOpen = false;
-
- // If the slice has image map hotspots and has a url attached to it,
- // ignore the url here and move it into the image map.
- if (curSlice.hasImage && curSlice.hasImagemap) {
- abortHref = true; // we will put the href in the imagemaps.
- }
-
- // Write rollover and swap image events.
- if (!abortHref) {
- var behaviors = curSlice.behaviors;
- var gotJavascript = ProcessBehavior(behaviors);
-
- if ( gotJavascript || hasHref) {
- WRITE_HTML("<a ");
- anchorTagOpen = true;
- WRITE_HTML(href);
-
- if (javaOut != "") {
- WRITE_HTML(" onMouseOut=\"", javaOut, "\" ");
- }
- if (javaOver != "") {
- WRITE_HTML(" onMouseOver=\"", javaOver, "\" ");
- }
- if (javaClick != "") {
- WRITE_HTML(" onClick=\"", javaClick, "\" ");
- }
- WRITE_HTML(">");
- }
- }
-
- // Place image.
- if (curSlice.hasImage) {
- var imageName = curSlice.getFrameFileName(0);
- if (slices.doDemoHTML && slices.demoIndex>0 &&
- slices.demoIndex == curSlice.downIndex) {
- imageName = curSlice.getFrameFileName(2);
- }
- var altText = "";
- if (curSlice.hasAltText) {
- altText = curSlice.altText;
- } else {
- altText = exportDoc.altText;
- }
-
- // Assemble info for image tag.
- // Ex: <img name="n_03_02" src="File_03_02.gif" width="79" height="71" border="0"
- WRITE_HTML("<img name=\"", cellName, "\" src=\"",
- curSlices.imagesDirPath, imageName, curSlice.imageSuffix, "\" width=\"",
- curSlice.width,"\" height=\"", curSlice.height, "\" border=\"0\"");
-
- // Write image map name.
- // Ex: usemap="#base_r1_c2"
- if (curSlice.hasImagemap) {
- WRITE_HTML(" usemap=\"#m_", imageName, "\"");
- }
-
- // Write alt text.
- if (altText != "") {
- WRITE_HTML(" alt=\"", altText, "\"");
- }
- WRITE_HTML(">");
- }
-
- if (anchorTagOpen) {
- WRITE_HTML("</a>");
- }
- if (needTable) WRITE_HTML("</td>\n");
- }
-
- if (needTable) {
- // Place shim in rightmost column of table.
- if (curSlices.doShimEdges) {
- /* Write the 1 pixel transparent shim. */
- WRITE_HTML(" <td><img src=\"",
- curSlices.shimPath, "\" width=\"1\" height=\"",
- curSlices[curRow][0].cellHeight, "\" border=\"0\"></td>\n");
- }
- WRITE_HTML(indent+" </tr>\n");
- }
- }
-
- if (needTable) {
- // Close table.
- if (indent != "") WRITE_HTML(indent+"</table>");
- }
- }
-
- function WriteImagemaps(curSlices, indent) {
- // Traverse all curSlices and generate any image maps needed.
- if (!indentNestedImagemaps) indent="";
- for (var curRow = 0; curRow < curSlices.numRows; curRow++) {
- for (var curCol = 0; curCol < curSlices.numColumns; curCol++) {
- var curSlice = curSlices[curRow][curCol];
- if (curSlice.skipCell) continue;
- var nestedTable = curSlice.nestedTableSlices;
- if (nestedTable) {
- WriteImagemaps(nestedTable, " "+indent);
- continue;
- }
- if (curSlice.hasImagemap) {
-
- // Write the image map.
- WRITE_HTML(indent+"<map name=\"m_", curSlice.getFrameFileName(0), "\">\n");
-
- var i = 0;
- var imagemap = curSlice.imagemap;
- while (i < imagemap.numberOfURLs) {
- var curImagemap = imagemap[i];
-
- var behaviors = curImagemap.behaviors;
-
- if (behaviors.numberOfBehaviors==0) {
- var behaviors = curSlice.behaviors;
- }
- javaOver = "";
- javaOut = "";
- javaClick = "";
- var gotJavascript = ProcessBehavior(behaviors);
-
- // Write the area tag with shape definitions.
- WRITE_HTML(indent+"<area shape=\"");
- WRITE_HTML(curImagemap.shape); // Shapes are rect poly and circle
- WRITE_HTML("\" coords=\"");
- for (var j=0; j<curImagemap.numCoords; j++) {
- if (j>0) WRITE_HTML(",");
- // polygon has n coords.
- // rect has 2 coords, topLeft, and botomRight.
- // circle has one coord, center; plus radius.
- WRITE_HTML((curImagemap.xCoord(j)-curSlice.left), ",", (curImagemap.yCoord(j)-curSlice.top));
- }
- if (curImagemap.shape == "circle") {
- // Write the radius for circle hotspots.
- WRITE_HTML(", ", curImagemap.radius);
- }
- WRITE_HTML("\"");
- var href = " href=\"#\"";
- if (curImagemap.hasHref) {
- href = " href=\"";
- href += curImagemap.href;
- href += "\"";
- if (curImagemap.hasTargetText) {
- href += " target=\"";
- href += curImagemap.targetText;
- href += "\"";
- }
- }
-
- WRITE_HTML(href);
-
- // Write alt text for hotspot.
- var altText = "";
- if (curImagemap.hasAltText) {
- altText = curImagemap.altText;
- } else {
- altText = exportDoc.altText;
- }
-
- if (altText!="") {
- WRITE_HTML(" title=\"", altText, "\"");
- WRITE_HTML(" alt=\"", altText, "\"");
- }
-
- // Write rollover and swap image behaviors.
- if (javaOut != "") {
- WRITE_HTML(" onMouseOut=\"", javaOut, "\" ");
- }
- if (javaOver != "") {
- WRITE_HTML(" onMouseOver=\"", javaOver, "\" ");
- }
- if (javaClick != "") {
- WRITE_HTML(" onClick=\"", javaClick, "\" ");
- }
-
- WRITE_HTML(" >\n");
- i++;
- }
- var behaviors = curSlices[curRow][curCol].behaviors;
- javaOver = "";
- javaOut = "";
- javaClick = "";
- var gotJavascript = ProcessBehavior(behaviors);
-
- var link = "";
- if (curSlice.hasHref) {
- link = curSlice.href;
- } else {
- if (exportDoc.backgroundLink) {
- link = exportDoc.backgroundLink.href;
- }
- }
-
- // If the current slice had a URL attached, it was moved and written here.
- if (gotJavascript || link != "") {
- WRITE_HTML(indent+"<area shape=\"rect\" coords=\"0,0, ", curSlice.width, ",", curSlice.height, "\" ");
- var href="#";
- if (link!="") {
- href = link;
- }
- WRITE_HTML("href=\"", href, "\"");
-
- if (curSlice.hasTargetText) {
- WRITE_HTML("\n target=\"", curSlices[curRow][curCol].targetText, "\"");
- }
- if (javaOut != "") {
- WRITE_HTML(" onMouseOut=\"", javaOut, "\" ");
- }
- if (javaOver != "") {
- WRITE_HTML(" onMouseOver=\"", javaOver, "\" ");
- }
- if (javaClick != "") {
- WRITE_HTML(" onClick=\"", javaClick, "\" ");
- }
- var altText = "";
- if (curSlice.hasAltText) {
- altText = curSlice.altText;
- } else {
- altText = exportDoc.altText;
- }
- if (altText!="") {
- WRITE_HTML(" title=\"", altText, "\"");
- WRITE_HTML(" alt=\"", altText, "\"");
- }
- WRITE_HTML(">\n");
- }
-
- WRITE_HTML(indent+"</map>\n")
- WRITE_HTML("\n");
- }
- }
- }
- }
-
- WriteTable(slices, "");
- WRITE_HTML("\n");
- WriteImagemaps(slices, "");
-
- // End table copy/paste section.
- WRITE_HTML_COMMENT(" This HTML was automatically created with Macromedia Fireworks 3.0 ");
- WRITE_HTML_COMMENT(" http://www.macromedia.com ");
- WRITE_HTML("\n");
- var needTable = slices.numRows > 1 || slices.numColumns > 1;
- if (needTable) {
- WRITE_HTML("</table>\n");
- }
-
- WRITE_HTML_COMMENT("------------------------- STOP COPYING THE HTML HERE -------------------------");
-
- WRITE_HTML("\n");
-
- if (doHeader) {
- WRITE_HTML("</body>\n");
-
- WRITE_HTML("\n");
- WRITE_HTML("</html>\n");
- WRITE_HTML("\n");
- }
-
-
-