mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 03:05:34 +00:00
*** empty log message ***
This commit is contained in:
parent
fca7ca2b94
commit
042b7884cc
@ -32,7 +32,7 @@ var oldMap = false;
|
||||
function Startup(){
|
||||
if (!InitEditorShell())
|
||||
return;
|
||||
dump("EditorShell found for image map dialog\n");
|
||||
doSetOKCancel(finishMap, null);
|
||||
initDialog();
|
||||
}
|
||||
|
||||
@ -46,10 +46,10 @@ function initDialog(){
|
||||
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");
|
||||
buttonArray[0] = document.getElementById("pointerButton");
|
||||
buttonArray[1] = document.getElementById("rectButton");
|
||||
buttonArray[2] = document.getElementById("cirButton");
|
||||
buttonArray[3] = document.getElementById("polyButton");
|
||||
|
||||
//Create marquee
|
||||
marquee = frameDoc.createElement("div");
|
||||
@ -64,19 +64,16 @@ function initDialog(){
|
||||
//Place Image
|
||||
newImg = frameDoc.createElement("img");
|
||||
newImg.setAttribute("src", imageElement.getAttribute("src"));
|
||||
newImg.setAttribute("width", imageElement.getAttribute("width"));
|
||||
newImg.setAttribute("height", imageElement.getAttribute("height"));
|
||||
newImg.setAttribute("width", imageElement.offsetWidth);
|
||||
newImg.setAttribute("height", imageElement.offsetHeight);
|
||||
newImg.setAttribute("id", "mainImg");
|
||||
frameDoc.getElementById("bgDiv").appendChild(newImg);
|
||||
frameDoc.getElementById("bgDiv").style.width = imageElement.offsetWidth;
|
||||
|
||||
//Recreate Image Map if it exists
|
||||
if (imageElement.getAttribute("usemap") != "")
|
||||
recreateMap();
|
||||
}
|
||||
|
||||
function exitImageMap(){
|
||||
dump("exit called");
|
||||
window.close();
|
||||
}
|
||||
|
||||
function hideToolbar(){
|
||||
@ -115,21 +112,20 @@ function recreateMap(){
|
||||
mapCollection = imageElement.ownerDocument.getElementsByName(map);
|
||||
areaCollection = mapCollection[0].childNodes;
|
||||
var len = areaCollection.length;
|
||||
var i=0;
|
||||
for(i=0; i<len; i++){
|
||||
area = areaCollection[i];
|
||||
for(j=0; j<len; j++){
|
||||
area = areaCollection[j];
|
||||
shape = area.getAttribute("shape");
|
||||
shape = shape.toLowerCase();
|
||||
coords = area.getAttribute("coords");
|
||||
href = area.getAttribute("href");
|
||||
//target = area.getAttribute("target");
|
||||
//title = null; //area.getAttribute("title");
|
||||
target = area.getAttribute("target");
|
||||
alt = area.getAttribute("alt");
|
||||
if (shape == "rect")
|
||||
Rect(coords, href, null, null, true);
|
||||
Rect(coords, href, target, alt, true);
|
||||
else if (shape == "circle")
|
||||
Circle(coords, href, null, null, true);
|
||||
Circle(coords, href, target, alt, true);
|
||||
else
|
||||
Poly(coords, href, null, null, true);
|
||||
Poly(coords, href, target, alt, true);
|
||||
}
|
||||
imageElement.ownerDocument.removeChild(mapCollection[0]);
|
||||
}
|
||||
@ -139,9 +135,7 @@ function finishMap(){
|
||||
var len = spots.length;
|
||||
createMap();
|
||||
if (len >= 1){
|
||||
var i=0;
|
||||
for(i=0; i<len; i++){
|
||||
dump(len+"\n");
|
||||
curSpot = spots[i];
|
||||
if (curSpot.getAttribute("class") == "rect")
|
||||
createRect(curSpot);
|
||||
@ -151,9 +145,10 @@ function finishMap(){
|
||||
createPoly(curSpot);
|
||||
}
|
||||
imageElement.setAttribute("usemap", ("#"+mapName));
|
||||
editorShell.InsertElement(imageMap, false);
|
||||
alert(imageMap);
|
||||
//editorShell.InsertElementAtSelection(imageMap, false);
|
||||
}
|
||||
exitImageMap();
|
||||
return true;
|
||||
}
|
||||
|
||||
function createMap(){
|
||||
@ -170,14 +165,16 @@ function createRect(which){
|
||||
newRect.setAttribute("shape", "rect");
|
||||
coords = parseInt(which.style.left)+","+parseInt(which.style.top)+","+(parseInt(which.style.left)+parseInt(which.style.width))+","+(parseInt(which.style.top)+parseInt(which.style.height));
|
||||
newRect.setAttribute("coords", coords);
|
||||
if (which.getAttribute("href") != "")
|
||||
newRect.setAttribute("href", which.getAttribute("href"));
|
||||
if (which.getAttribute("hsHref") != ""){
|
||||
newRect.setAttribute("href", which.getAttribute("hsHref"));
|
||||
}
|
||||
else{
|
||||
newRect.setAttribute("nohref", "");
|
||||
}
|
||||
newRect.setAttribute("target", which.getAttribute("hsTarget"));
|
||||
newRect.setAttribute("alt", which.getAttribute("hsAlt"));
|
||||
newRect.removeAttribute("id");
|
||||
imageMap.appendChild(newRect);
|
||||
dump("rect created\n");
|
||||
}
|
||||
|
||||
function createCir(which){
|
||||
@ -186,14 +183,15 @@ function createCir(which){
|
||||
radius = Math.floor(parseInt(which.style.width)/2);
|
||||
coords = (parseInt(which.style.left)+radius)+","+(parseInt(which.style.top)+radius)+","+radius;
|
||||
newCir.setAttribute("coords", coords);
|
||||
if (which.getAttribute("href") != "")
|
||||
newCir.setAttribute("href", which.getAttribute("href"));
|
||||
if (which.getAttribute("hsHref") != "")
|
||||
newCir.setAttribute("href", which.getAttribute("hsHref"));
|
||||
else{
|
||||
newCir.setAttribute("nohref", "");
|
||||
}
|
||||
newCir.setAttribute("target", which.getAttribute("hsTarget"));
|
||||
newCir.setAttribute("alt", which.getAttribute("hsAlt"));
|
||||
newCir.removeAttribute("id");
|
||||
imageMap.appendChild(newCir);
|
||||
dump("circle created\n");
|
||||
}
|
||||
|
||||
function createPoly(which){
|
||||
@ -201,20 +199,20 @@ function createPoly(which){
|
||||
newPoly.setAttribute("shape", "poly");
|
||||
var coords = '';
|
||||
var len = which.childNodes.length;
|
||||
var i=0
|
||||
for(i=0; i<len; i++){
|
||||
coords += (parseInt(which.style.left)+parseInt(which.childNodes[i].style.left))+","+(parseInt(which.style.top)+parseInt(which.childNodes[i].style.top))+",";
|
||||
for(l=0; l<len; l++){
|
||||
coords += (parseInt(which.style.left)+parseInt(which.childNodes[l].style.left))+","+(parseInt(which.style.top)+parseInt(which.childNodes[l].style.top))+",";
|
||||
}
|
||||
coords = coords.substring(0, (coords.length-1));
|
||||
newPoly.setAttribute("coords", coords);
|
||||
if (which.getAttribute("href") != "")
|
||||
newPoly.setAttribute("href", which.getAttribute("href"));
|
||||
if (which.getAttribute("hsHref") != "")
|
||||
newPoly.setAttribute("href", which.getAttribute("hsHref"));
|
||||
else{
|
||||
newPoly.setAttribute("nohref", "");
|
||||
}
|
||||
newPoly.setAttribute("target", which.getAttribute("hsTarget"));
|
||||
newPoly.setAttribute("alt", which.getAttribute("hsAlt"));
|
||||
newPoly.removeAttribute("id");
|
||||
imageMap.appendChild(newPoly);
|
||||
dump("poly created\n");
|
||||
}
|
||||
|
||||
function hotSpotProps(which){
|
||||
@ -222,8 +220,7 @@ function hotSpotProps(which){
|
||||
currentCir = null;
|
||||
if (which == null)
|
||||
return;
|
||||
href = which.getAttribute("href");
|
||||
hotSpotWin = window.openDialog("chrome://editor/content/EdImageMapHotSpot.xul", "htsptdlg", "modal", which, href);
|
||||
hotSpotWin = window.openDialog("chrome://editor/content/EdImageMapHotSpot.xul", "_blank", "chrome,close,titlebar,modal", which);
|
||||
}
|
||||
|
||||
function deleteAreas(){
|
||||
|
Loading…
Reference in New Issue
Block a user