/* * The contents of this file are subject to the Netscape Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/NPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is Netscape * Communications Corporation. Portions created by Netscape are * Copyright (C) 1999 Netscape Communications Corporation. All * Rights Reserved. * * Contributor(s): * Dan Haddix (dan6992@hotmail.com) */ var tHide = false; var highCont = false; var imageElement; var mapName; var imageMap; var oldMap = false; function Startup(){ if (!InitEditorShell()) return; dump("EditorShell found for image map dialog\n"); doSetOKCancel(onOK, null); initDialog(); } function initDialog(){ //Check to make sure selected element is an image imageElement = editorShell.GetSelectedElement("img"); if (!imageElement) //If not an image close window window.close(); //Set iframe pointer frameDoc = window.frames[0].document; //Fill button array buttonArray[0] = document.getElementById("pointer"); buttonArray[1] = document.getElementById("rect"); buttonArray[2] = document.getElementById("cir"); buttonArray[3] = document.getElementById("poly"); //Create marquee marquee = frameDoc.createElement("div"); marquee.setAttribute("id", "marquee"); frameDoc.body.appendChild(marquee); //Create background div bgDiv = frameDoc.createElement("div"); bgDiv.setAttribute("id", "bgDiv"); frameDoc.body.appendChild(bgDiv); //Place Image newImg = frameDoc.createElement("img"); newImg.setAttribute("src", imageElement.getAttribute("src")); newImg.setAttribute("id", "mainImg"); frameDoc.getElementById("bgDiv").appendChild(newImg); //Recreate Image Map if it exists if (imageElement.getAttribute("usemap") != "") recreateMap(); } function hideToolbar(){ // Check to see if toolbar is already hidden if (tHide){ // If it is show it document.getElementById("toolbar").setAttribute("collapsed", "false"); // Set the menu items text back to "Hide Toolbar" document.getElementById("view_hidetoolbar").setAttribute("value", "Hide Toolbar"); tHide = false } else{ // If not hide it document.getElementById("toolbar").setAttribute("collapsed", "true"); //Set the menu items text to "Show Toolbar" document.getElementById("view_hidetoolbar").setAttribute("value", "Show Toolbar"); tHide = true; } } function highContrast(){ imgEl = frameDoc.getElementById("mainImg"); if (highCont){ imgEl.style.opacity = "100%"; highCont = false; } else{ imgEl.style.opacity = "10%"; highCont = true; } } function recreateMap(){ map = imageElement.getAttribute("usemap"); map = map.substring(1, map.length); mapCollection = imageElement.ownerDocument.getElementsByName(map); areaCollection = mapCollection[0].childNodes; var len = areaCollection.length; var i=0; for(i=0; i= 1){ var i=0; for(i=0; i