-
Notifications
You must be signed in to change notification settings - Fork 1
/
js05_publish.js
62 lines (51 loc) · 2.03 KB
/
js05_publish.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function publishMap(id)
{
var xhr = new XMLHttpRequest();
xhr.open("GET", "Library/Map.svg", true);
xhr.onload = function()
{
var xmlString = this.responseText
//---DOMParser---
var parser = new DOMParser();
MapDoc = parser.parseFromString(xmlString, "text/xml").documentElement;
var groups = MapDoc.childNodes
for(var k = 0; k<groups.length; k++)
{
var group = groups.item(k)
if(group.nodeName!="#text")
{
var mapId = group.getAttribute("id")
if(mapId==id)
{
publishG=group.cloneNode(true)
for(k=0;k<publishG.childNodes.length;k++)
{
var elem=publishG.childNodes.item(k)
elem.removeAttribute("onmouseover")
elem.removeAttribute("onmouseout")
elem.removeAttribute("onmousedown")
}
var svgString= new XMLSerializer().serializeToString(publishG)
var xhr = new XMLHttpRequest();
xhr.open("POST", "_ASP/publishMap.asp", true);
xhr.onload = function()
{
if (this.status == 200)
{
closeMapTable()
publishValue.value = "<!DOCTYPE HTML>\n"+
"<html>\n"+
"<script>\n"+
" window.open('http://svg-maps.com/PUBLISH/index.htm\\?id="+mapId+"','_self')\n"+
"</script>\n"+
"</html>"
publishMapDiv.style.visibility="visible"
}
};
xhr.send(svgString);
break
}
}
}
}
xhr.send()}