public.js 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478
  1. if (typeof(console) == "undefined") {
  2. console = {};
  3. console.log = function() {}
  4. }
  5. window.onerror = function() {}; (function() {
  6. var i = window.DomReady = {};
  7. var h = navigator.userAgent.toLowerCase();
  8. var c = {
  9. version: (h.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
  10. safari: /webkit/.test(h),
  11. opera: /opera/.test(h),
  12. msie: (/msie/.test(h)) && (!/opera/.test(h)),
  13. mozilla: (/mozilla/.test(h)) && (!/(compatible|webkit)/.test(h))
  14. };
  15. var d = false;
  16. var e = false;
  17. var g = [];
  18. function a() {
  19. if (!e) {
  20. e = true;
  21. if (g) {
  22. for (var j = 0; j < g.length; j++) {
  23. g[j].call(window, [])
  24. }
  25. g = []
  26. }
  27. }
  28. }
  29. function f(j) {
  30. var k = window.onload;
  31. if (typeof window.onload != "function") {
  32. window.onload = j
  33. } else {
  34. window.onload = function() {
  35. if (k) {
  36. k()
  37. }
  38. j()
  39. }
  40. }
  41. }
  42. function b() {
  43. if (d) {
  44. return
  45. }
  46. d = true;
  47. if (document.addEventListener && !c.opera) {
  48. document.addEventListener("DOMContentLoaded", a, false)
  49. }
  50. if (c.msie && window == top) { (function() {
  51. if (e) {
  52. return
  53. }
  54. try {
  55. document.documentElement.doScroll("left")
  56. } catch(k) {
  57. setTimeout(arguments.callee, 0);
  58. return
  59. }
  60. a()
  61. })()
  62. }
  63. if (c.opera) {
  64. document.addEventListener("DOMContentLoaded",
  65. function() {
  66. if (e) {
  67. return
  68. }
  69. for (var k = 0; k < document.styleSheets.length; k++) {
  70. if (document.styleSheets[k].disabled) {
  71. setTimeout(arguments.callee, 0);
  72. return
  73. }
  74. }
  75. a()
  76. },
  77. false)
  78. }
  79. if (c.safari) {
  80. var j; (function() {
  81. if (e) {
  82. return
  83. }
  84. if (document.readyState != "loaded" && document.readyState != "complete") {
  85. setTimeout(arguments.callee, 0);
  86. return
  87. }
  88. if (j === undefined) {
  89. var l = document.getElementsByTagName("link");
  90. for (var m = 0; m < l.length; m++) {
  91. if (l[m].getAttribute("rel") == "stylesheet") {
  92. j++
  93. }
  94. }
  95. var k = document.getElementsByTagName("style");
  96. j += k.length
  97. }
  98. if (document.styleSheets.length != j) {
  99. setTimeout(arguments.callee, 0);
  100. return
  101. }
  102. a()
  103. })()
  104. }
  105. f(a)
  106. }
  107. i.ready = function(k, j) {
  108. b();
  109. if (e) {
  110. k.call(window, [])
  111. } else {
  112. g.push(function() {
  113. return k.call(window, [])
  114. })
  115. }
  116. };
  117. b()
  118. })();
  119. var Fe = Fe || {
  120. version: "20080809",
  121. emptyFn: function() {}
  122. };
  123. Fe._log = [];
  124. var counter = 0;
  125. var instances = {};
  126. Fe.BaseClass = function(a) {
  127. instances[(this.hashCode = (a || Fe.BaseClass.guid()))] = this
  128. };
  129. Fe.BaseClass.guid = function() {
  130. return "mz_" + (counter++).toString(36)
  131. };
  132. Fe.BaseClass.create = function() {
  133. var a = new Fe.BaseClass();
  134. a.decontrol();
  135. return a
  136. };
  137. window.Instance = Fe.instance = Fe.I = function(a) {
  138. return instances[a]
  139. };
  140. Fe.BaseClass.prototype.dispose = function() {
  141. if (this.hashCode) {
  142. delete instances[this.hashCode]
  143. }
  144. for (var a in this) {
  145. if (typeof this[a] != "function") {
  146. delete this[a]
  147. }
  148. }
  149. };
  150. Fe.BaseClass.prototype.getHashCode = function() {
  151. if (!this.hashCode) {
  152. instances[(this.hashCode = Fe.BaseClass.guid())] = this
  153. }
  154. return this.hashCode
  155. };
  156. Fe.BaseClass.prototype.decontrol = function() {
  157. delete instances[this.hashCode]
  158. };
  159. Fe.BaseClass.prototype.toString = function() {
  160. return "[object " + (this._className || "Object") + "]"
  161. };
  162. Fe.BaseClass.prototype._wlog = function(c, d) {
  163. var b = Fe._log;
  164. if (b.length > 100) {
  165. b.reverse().length = 50;
  166. b.reverse()
  167. }
  168. b[b.length] = "[" + c + "][" + (this._className || "Object") + " " + this.hashCode + "] " + d
  169. };
  170. Fe.extend = function(d, b) {
  171. if (d && b && typeof(b) == "object") {
  172. for (var c in b) {
  173. d[c] = b[c]
  174. }
  175. var a = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"];
  176. for (var e = 0,
  177. f; e < a.length; e++) {
  178. f = a[e];
  179. if (Object.prototype.hasOwnProperty.call(b, f)) {
  180. d[f] = b[f]
  181. }
  182. }
  183. }
  184. return d
  185. };
  186. Fe.on = function(a, c, b) {
  187. if (! (a = Fe.G(a))) {
  188. return a
  189. }
  190. c = c.replace(/^on/, "").toLowerCase();
  191. if (a.attachEvent) {
  192. a[c + b] = function() {
  193. b.call(a, window.event)
  194. };
  195. a.attachEvent("on" + c, a[c + b])
  196. } else {
  197. a.addEventListener(c, b, false)
  198. }
  199. return a
  200. };
  201. Fe.un = function(a, c, b) {
  202. if (! (a = Fe.G(a))) {
  203. return a
  204. }
  205. c = c.replace(/^on/, "").toLowerCase();
  206. if (a.attachEvent) {
  207. a.detachEvent("on" + c, a[c + b]);
  208. a[c + b] = null
  209. } else {
  210. a.removeEventListener(c, b, false)
  211. }
  212. return a
  213. };
  214. Fe.G = function() {
  215. for (var b = [], c = arguments.length - 1; c > -1; c--) {
  216. var d = arguments[c];
  217. b[c] = null;
  218. if (typeof d == "object" && d && d.dom) {
  219. b[c] = d.dom
  220. } else {
  221. if ((typeof d == "object" && d && d.tagName) || d == window || d == document) {
  222. b[c] = d
  223. } else {
  224. if (typeof d == "string" && (d = document.getElementById(d))) {
  225. b[c] = d
  226. }
  227. }
  228. }
  229. }
  230. return b.length < 2 ? b[0] : b
  231. };
  232. Fe.copy = function(a) {};
  233. function beforeEndHTML(b, a) {
  234. b.insertAdjacentHTML("beforeEnd", a);
  235. return b.lastChild
  236. }
  237. function getClientSize() {
  238. if (window.innerHeight) {
  239. return {
  240. width: window.innerWidth,
  241. height: window.innerHeight
  242. }
  243. } else {
  244. if (document.documentElement && document.documentElement.clientHeight) {
  245. return {
  246. width: document.documentElement.clientWidth,
  247. height: document.documentElement.clientHeight
  248. }
  249. } else {
  250. return {
  251. width: document.body.clientWidth,
  252. height: document.body.clientHeight
  253. }
  254. }
  255. }
  256. }
  257. function foucs_(a, b, c) {
  258. if (!c) {
  259. c = ""
  260. }
  261. a.style.color = "#000"; (a.value != b) ? null: a.value = c
  262. }
  263. function blur_(a, b, c) {
  264. a.style.color = "#8c8c8c"; (a.value == c || a.value.length <= 0) ? a.value = b: null
  265. }
  266. function loadBody() {
  267. createCopyBt()
  268. initMapSize();
  269. initMap();
  270. addMapControls();
  271. setTimeout(function() {
  272. mapResize()
  273. },
  274. 200);
  275. }
  276. function initMapSize() {
  277. var a = Fe.G("MapHolder");
  278. var b = getClientSize().height - 140;
  279. b = b < 0 ? 0 : b;
  280. a.style.height = b + "px";
  281. var e = Fe.G("MapInfo");
  282. var d = b + 2;
  283. d = d < 0 ? 0 : d;
  284. e.style.height = d + "px";
  285. var c = Fe.G("shad_v");
  286. var f = b;
  287. f = f < 0 ? 0 : f;
  288. c.style.height = f + "px"
  289. }
  290. function initMap() {
  291. window.map = new BMap.Map("MapHolder", {enableMapClick: false});
  292. window.projection = new BMap.MercatorProjection();
  293. var a = new BMap.Point(116.395645, 39.929986);
  294. map.addEventListener("load",
  295. function(b) {
  296. getCurrentCityName()
  297. });
  298. map.addEventListener("moveend",
  299. function(b) {
  300. getCurrentCityName()
  301. });
  302. map.addEventListener("dragend",
  303. function(b) {
  304. getCurrentCityName()
  305. });
  306. map.addEventListener("zoomend",
  307. function(b) {
  308. getCurrentCityName()
  309. });
  310. map.addEventListener("click",
  311. function(c) {
  312. var b = c.point;
  313. if (c.overlay && c.overlay instanceof BMap.Marker) {
  314. b = c.overlay.point
  315. }
  316. setInputPoint(b)
  317. });
  318. map.addEventListener("mousemove",
  319. function(c) {
  320. if (!temp.mouseLabel) {
  321. createMouseMoveLabel(c.point)
  322. }
  323. if (!temp.mouseLabel.isVisible()) {
  324. temp.mouseLabel.show()
  325. }
  326. var k = temp.mouseLabel;
  327. var h = map.getContainer();
  328. var g = h.clientWidth;
  329. var f = h.clientHeight;
  330. var j = 132;
  331. var i = 19;
  332. var n = map.pointToPixel(c.point).x + 13;
  333. var l = map.pointToPixel(c.point).y + 20;
  334. var m = map.pixelToPoint(new BMap.Pixel(g - j - 13, f - i - 20));
  335. var b = map.pixelToPoint(new BMap.Pixel(n - j - 33, f - i - 20));
  336. var d = c.point;
  337. if (g - n < j) {
  338. d = new BMap.Point(m.lng, d.lat)
  339. }
  340. if (f - l < i) {
  341. d = new BMap.Point(d.lng, m.lat)
  342. }
  343. if (g - n - 16 < j && f - l < i) {
  344. d = b
  345. }
  346. k.setPosition(d);
  347. k.setContent(c.point.lng + "," + c.point.lat)
  348. });
  349. Fe.on(document.body, "mousemove",
  350. function(c) {
  351. var c = window.event || c;
  352. var b = c.srcElement || c.target;
  353. if (b.className != "BMap_mask" && temp.mouseLabel && temp.mouseLabel.isVisible()) {
  354. temp.mouseLabel.hide()
  355. }
  356. });
  357. Fe.on(document.body, "mouseout",
  358. function(c) {
  359. var c = window.event || c;
  360. var b = c.srcElement || c.target;
  361. if (b.className == "BMap_mask" && temp.mouseLabel && temp.mouseLabel.isVisible()) {
  362. temp.mouseLabel.hide()
  363. }
  364. });
  365. mapInfo.centerPoint = a;
  366. map.centerAndZoom(a, 12);
  367. map.enableScrollWheelZoom();
  368. map.setDefaultCursor("default");
  369. map.setDraggingCursor("default")
  370. }
  371. function setInputPoint(a) {
  372. var value = a.lng + "," + a.lat;
  373. Fe.G("pointInput").value = value;
  374. Fe.G('pointInput').setAttribute('data-clipboard-text', value);
  375. }
  376. function createMouseMoveLabel(c) {
  377. var a = map.pixelToPoint(new BMap.Pixel(0, 0));
  378. var b = c.lng + "," + c.lat;
  379. var d = new BMap.Label(b, {
  380. point: a,
  381. offset: new BMap.Size(13, 20),
  382. enableMassClear: false
  383. });
  384. d.setStyle({
  385. background: "#fff",
  386. border: "#999 solid 1px",
  387. zIndex: 10000000
  388. });
  389. map.addOverlay(d);
  390. temp.mouseLabel = d
  391. }
  392. function addMapControls() {
  393. window.stdMapCtrl = new BMap.NavigationControl();
  394. map.addControl(window.stdMapCtrl);
  395. window.scaleCtrl = new BMap.ScaleControl();
  396. map.addControl(window.scaleCtrl);
  397. window.overviewCtrl = new BMap.OverviewMapControl();
  398. map.addControl(window.overviewCtrl);
  399. var a = new BMap.CopyrightControl();
  400. map.addControl(a)
  401. }
  402. function mapResize() {
  403. var a = Fe.G("MapHolder");
  404. var b = Fe.G("shad_v");
  405. if (window._resizeTimer) {
  406. return
  407. }
  408. window._resizeTimer = setTimeout(function() {
  409. var c = getClientSize().height - 140;
  410. var d = c - 20;
  411. c = c < 0 ? 0 : c;
  412. d = d < 0 ? 0 : d;
  413. a.style.height = c + "px";
  414. Fe.G("MapInfo").style.height = d + "px";
  415. // if (overviewCtrl.getDom() == null) {
  416. // var e = parseInt(a.style.height)
  417. // } else {
  418. // var e = parseInt(a.style.height) - parseInt(overviewCtrl.getDom().style.height)
  419. // }
  420. // e = e < 0 ? 0 : e;
  421. // b.style.height = e + "px";
  422. window._resizeTimer = null
  423. },
  424. 100)
  425. }
  426. var mapInfo = {
  427. cityName: "",
  428. cityCode: "",
  429. centerPoint: null
  430. };
  431. var temp = {
  432. pt: [],
  433. mk: [],
  434. iw: [],
  435. iwOpenIndex: null,
  436. mouseLabel: null,
  437. poiSearchMark: null,
  438. geoCoder: null
  439. };
  440. var eventTemp = {};
  441. function clearLastResult() {
  442. Fe.G("txtPanel").innerHTML = "";
  443. temp.pt = [];
  444. temp.mk = [];
  445. temp.iw = [];
  446. temp.iwOpenInde = null;
  447. map.clearOverlays();
  448. if (temp.poiSearchMark) {
  449. temp.poiSearchMark.hide()
  450. }
  451. }
  452. function localsearch() {
  453. var a = [];
  454. var c = Fe.G("localvalue").value;
  455. var d = {
  456. onSearchComplete: function(w) {
  457. clearLastResult();
  458. if (b.getStatus() == BMAP_STATUS_SUCCESS) {
  459. var l = w.getCurrentNumPois();
  460. var k = w.getCurrentNumPois();
  461. var e = w.getNumPois();
  462. var p = "";
  463. if (l == 1 && typeof w.getPoi(0).city == "undefined") {
  464. var f = 4;
  465. // if (b && b._json && b._json.content && b._json.content.length == 2) {
  466. if (b && w && w.getNumPois() == 2) {
  467. f = w.getPoi(1);
  468. p = '<b style="font-size:14px;">' + w.keyword + "</b>"
  469. } else {
  470. if (b && w && w.city) {
  471. // f = b._json.current_city.level;
  472. // if (b._json.current_city.name == "全国") {
  473. // f = 4
  474. // }
  475. p = '<span style="color:#00c">已切换至' + w.city + "</span>";
  476. Fe.G("resultNum").innerHTML = ""
  477. }
  478. }
  479. map.centerAndZoom(w.getPoi(0).point, 12);
  480. Fe.G("txtPanel").innerHTML = p
  481. } else {
  482. // var o = _res_sta_i = b._json.content.length - k;
  483. p = '<ul class="local_s">';
  484. for (var z = 0; z < l; z++) {
  485. var h = w.getPoi(z);
  486. var q = h.title;
  487. var u = h.address;
  488. var n = h.phoneNumber;
  489. var v = h.point;
  490. var A = v.lng + "," + v.lat;
  491. var x = q;
  492. var j = h.type;
  493. var t = "地址";
  494. if (x.length > 20) {
  495. x = x.substring(0, 17) + "..."
  496. }
  497. if (j == 1) {
  498. t = "途径公交车"
  499. }
  500. if (j == 3) {
  501. t = "途径地铁"
  502. }
  503. p += '<li id="no' + z + '">';
  504. p += '<span id="mk_' + z + '"></span>';
  505. p += ' <div id="no_' + z + '">';
  506. p += ' <a href="javascript:void(0)" title="' + q + '">' + x + "</a>";
  507. p += " <p>" + t + ":" + u;
  508. n ? p += " <br/>电话:" + n: null;
  509. p += " <br/>坐标:" + A;
  510. p += " </p>";
  511. p += " </div>";
  512. p += "</li>";
  513. a.push(v);
  514. temp.pt.push(v);
  515. addMarker(z);
  516. createIw({
  517. tit: q,
  518. add: u,
  519. tel: n,
  520. poi: v,
  521. type: j
  522. })
  523. }
  524. p += "</ul>";
  525. p += '<div id="result_page_c"></div>';
  526. map.setViewport(a);
  527. a = [];
  528. Fe.G("txtPanel").innerHTML = p;
  529. Fe.G("resultNum").innerHTML = "共找到" + e + "条结果";
  530. var m = new Page("result_page_c",
  531. function(i) {
  532. Fe.G("MapInfo").scrollTop = 0;
  533. b.gotoPage(i - 1)
  534. },
  535. {
  536. page: w.getPageIndex() + 1,
  537. totalCount: e,
  538. pageCount: Math.ceil(e / 10)
  539. });
  540. if (m.pageCount <= 1) {
  541. Fe.G("result_page_c").innerHTML = ""
  542. }
  543. bindEvent()
  544. }
  545. } else {
  546. var y = "";
  547. Fe.G("resultNum").innerHTML = "";
  548. if (w.city != "全国") {
  549. y = "在<b>" + w.city + "</b>及全国没有找到相关的地点。"
  550. } else {
  551. y = "在全国没有找到相关的地点。"
  552. }
  553. if (w.getCityList().length > 0) {
  554. if (w.city != "全国") {
  555. y = "在<b>" + w.city + "</b>没有找到相关的地点。"
  556. } else {
  557. y = "在以下城市有结果,请您选择:<br />"
  558. }
  559. var g = w.getCityList();
  560. if (g.length > 0) {
  561. y += '<p style="margin-top:10px;">在以下城市找到结果,请选择城市:</p><ul class="SearchList" id="cityList" style="height:40px;overflow:hidden;">';
  562. for (var z = 0; z < g.length; z++) {
  563. y += "<li><a onclick=\"searchInthisCity('" + g[z].city + '\')" href="javascript:void(0)">' + g[z].city + "</a>(";
  564. y += g[z].numResults + ")</li>"
  565. }
  566. y += "</ul>";
  567. if (g.length > 6) {
  568. y += '<div id="moreCityPop"><a onclick="showMoreCity()" class="resultMore">更多城市</a></div>'
  569. }
  570. }
  571. }
  572. Fe.G("txtPanel").innerHTML = y
  573. }
  574. }
  575. };
  576. var b = new BMap.LocalSearch(map, d);
  577. window.l_local = b;
  578. Fe.G("localsearch").onclick = function() {
  579. beginsearch(b)
  580. }
  581. }
  582. function setCurrentMapInfo(c, d) {
  583. var a = mapInfo;
  584. var b = map.getZoom();
  585. a.cityName = c;
  586. a.cityCode = d;
  587. a.centerPoint = map.getCenter();
  588. Fe.G("curCity").innerHTML = c;
  589. Fe.G("ZoomNum").innerHTML = b
  590. }
  591. function getCurrentCityName() {
  592. var a = map.getZoom();
  593. var c;
  594. var h = 10000;
  595. if (a <= 7) {
  596. c = a;
  597. setCurrentMapInfo("全国");
  598. return
  599. }
  600. var i = function() {
  601. var m = map.getBounds();
  602. var j = projection.lngLatToPoint(m.getSouthWest());
  603. var l = projection.lngLatToPoint(m.getNorthEast());
  604. var k = function(n) {
  605. return parseInt(n / 1000) * 1000
  606. };
  607. return k(j.x) + "," + k(j.y) + ";" + k(l.x) + "," + k(l.y)
  608. };
  609. var e = mapInfo.centerPoint;
  610. var d = map.getCenter();
  611. var f = Math.sqrt((e.lng - d.lng) * (e.lng - d.lng) + (e.lat - d.lat) * (e.lat - d.lat));
  612. if (f > h || a != c) {
  613. c = a;
  614. var b = "https://map.baidu.com/?newmap=1&qt=cen&b=" + i() + "&l=" + a;
  615. scriptRequest(b, g, "_MAP_CENTER_", "gbk")
  616. }
  617. function g() {
  618. if (typeof _mapCenter == "undefined") {
  619. return
  620. }
  621. var j = _mapCenter;
  622. var k = j.content;
  623. if (!k) {
  624. return
  625. }
  626. setCurrentMapInfo(_mapCenter.content.name, _mapCenter.content.uid)
  627. }
  628. }
  629. function bindEvent() {
  630. var d = temp.mk;
  631. var a = temp.iw;
  632. var b = function(g) {
  633. if (temp.iwOpenIndex == g) {
  634. return
  635. }
  636. temp.iwOpenIndex = g;
  637. d[g].openInfoWindow(a[g]);
  638. setInputPoint(d[g].point)
  639. };
  640. var c = function(g) {
  641. if (temp.iwOpenIndex == g) {
  642. return
  643. }
  644. var i = d[g];
  645. var h = i.getIcon();
  646. h.setImageOffset(new BMap.Size(0, -250 - g * 25));
  647. i.setIcon(h);
  648. i.setTop(true, 1000100);
  649. Fe.G("no_" + g) ? Fe.G("no_" + g).className = "hover": null
  650. };
  651. var e = function(g) {
  652. var i = d[g];
  653. if (temp.iwOpenIndex == g) {
  654. i.setTop(true);
  655. return
  656. }
  657. var h = i.getIcon();
  658. h.setImageOffset(new BMap.Size(0, -g * 25));
  659. i.setIcon(h);
  660. i.setTop(false);
  661. Fe.G("no_" + g) ? Fe.G("no_" + g).className = "": null
  662. };
  663. for (var f = 0; f < d.length; f++) { (function() {
  664. var h = f;
  665. var i = d[h];
  666. var g = a[h];
  667. d[h].addEventListener("click",
  668. function() {
  669. b(h)
  670. });
  671. d[h].addEventListener("mouseover",
  672. function() {
  673. c(h)
  674. });
  675. d[h].addEventListener("mouseout",
  676. function() {
  677. e(h)
  678. });
  679. g.addEventListener("open",
  680. function() {
  681. temp.iwOpenIndex = h
  682. });
  683. g.addEventListener("close",
  684. function() {
  685. temp.iwOpenIndex = null;
  686. e(h)
  687. });
  688. Fe.on(Fe.G("no_" + h), "click",
  689. function() {
  690. b(h)
  691. });
  692. Fe.on(Fe.G("no_" + h), "mouseover",
  693. function() {
  694. c(h)
  695. });
  696. Fe.on(Fe.G("no_" + h), "mouseout",
  697. function() {
  698. e(h)
  699. });
  700. Fe.on(Fe.G("mk_" + h), "click",
  701. function() {
  702. b(h)
  703. });
  704. Fe.on(Fe.G("mk_" + h), "mouseover",
  705. function() {
  706. c(h)
  707. });
  708. Fe.on(Fe.G("mk_" + h), "mouseout",
  709. function() {
  710. e(h)
  711. })
  712. })()
  713. }
  714. }
  715. function addMarker(a) {
  716. var b = temp.pt[a];
  717. var d = new BMap.Icon("Images/markers.png", new BMap.Size(23, 25), {
  718. offset: new BMap.Size(10, 25),
  719. imageOffset: new BMap.Size(0, 0 - a * 25),
  720. infoWindowAnchor: new BMap.Size(12, 0)
  721. });
  722. var c = new BMap.Marker(b, {
  723. icon: d
  724. });
  725. map.addOverlay(c);
  726. temp.mk.push(c);
  727. return c
  728. }
  729. function createIw(a) {
  730. var e = a.tit;
  731. var h = a.add;
  732. var d = a.tel;
  733. var i = a.poi.lng + "," + a.poi.lat;
  734. var j = '<p class="iwContent">';
  735. var f = a.type;
  736. var c = "地址";
  737. if (f == 1) {
  738. c = "途径公交车"
  739. }
  740. if (f == 3) {
  741. c = "途径地铁"
  742. }
  743. j += "<em>" + c + ":</em>" + h + "<br/>";
  744. d ? j += "<em>电话:</em>" + d + "<br/>": null;
  745. j += "<em>坐标:</em>" + i + "";
  746. j += "</p>";
  747. var g = e;
  748. if (g.length > 15) {
  749. g = g.substring(0, 12) + "..."
  750. }
  751. var b = new BMap.InfoWindow(j, {
  752. title: '<span class="iwTitle" title="' + e + '">' + g + "</span>",
  753. width: 250
  754. });
  755. temp.iw.push(b);
  756. return b
  757. }
  758. function showMoreCity() {
  759. Fe.G("cityList").style.height = "auto";
  760. Fe.G("moreCityPop").style.display = "none"
  761. }
  762. function goCity(c) {
  763. var b = c.tagName.toLowerCase() == "input" ? "value": "innerHTML";
  764. var a = c[b];
  765. getCityPoint(a)
  766. }
  767. function getCityPoint(b) {
  768. b = encodeURIComponent(b);
  769. var a = "https://map.baidu.com/?newmap=1&qt=cur&callback=setCurrentCity&ie=utf-8&wd=" + b + "&oue=1&res=jc";
  770. scriptRequest(a, "null")
  771. }
  772. function setCurrentCity(d) {
  773. if (!d.content || d.content.error == 0) {
  774. setTimeout(function() {
  775. Fe.G("selCityMessage").style.display = "block";
  776. Fe.G("selCityMessage").innerHTML = "请输入正确的中文城市名称"
  777. },
  778. 0)
  779. } else {
  780. hidePop();
  781. var b = (((d.content.geo).split("|")[2]).split(";")[0]).split(",")[0];
  782. var a = (((d.content.geo).split("|")[2]).split(";")[0]).split(",")[1];
  783. var c = projection.pointToLngLat(new BMap.Pixel(b, a));
  784. if (d.content.cname == "全国") {
  785. map.centerAndZoom(new BMap.Point(c.lng, c.lat), 5)
  786. } else {
  787. map.centerAndZoom(new BMap.Point(c.lng, c.lat), d.content.level)
  788. }
  789. clearLastResult();
  790. Fe.G("resultNum").innerHTML = "";
  791. Fe.G("txtPanel").innerHTML = '<span style="color:#00c">已切换至' + d.content.cname + "</span>"
  792. }
  793. }
  794. function hidePop() {
  795. if (Fe.G("selCityInput")) {
  796. Fe.G("selCityInput").value = "请输入城市名";
  797. Fe.G("selCityMessage").style.display = "none";
  798. Fe.G("map_popup").style.display = "none"
  799. }
  800. if (eventTemp.cityPop.length > 0) {
  801. var a = eventTemp.cityPop;
  802. for (var b = 0; b < a.length; b++) {
  803. Fe.un(a[b].dom, a[b].type, a[b].fun)
  804. }
  805. eventTemp.cityPop = []
  806. }
  807. }
  808. function showPop() {
  809. if (Fe.G("map_popup").style.display == "block") {
  810. return
  811. }
  812. Fe.G("map_popup").style.display = "block";
  813. var a = function(c) {
  814. var b = c.srcElement || c.target;
  815. while (b) {
  816. if (b == Fe.G("map_popup") || b == Fe.G("curCityText")) {
  817. return
  818. }
  819. if (b == Fe.G("selCity")) {
  820. Fe.G("selCityMessage").style.display = "none";
  821. return
  822. }
  823. if (b == document.body) {
  824. hidePop();
  825. return
  826. }
  827. b = b.parentNode
  828. }
  829. };
  830. Fe.on(document.body, "mousedown", a);
  831. eventTemp.cityPop = [];
  832. eventTemp.cityPop.push({
  833. dom: document.body,
  834. type: "mousedown",
  835. fun: a
  836. })
  837. }
  838. var TimerSM;
  839. function showMessage(b) {
  840. var a = Fe.G("searchTip");
  841. if (TimerSM) {
  842. clearTimeout(TimerSM)
  843. }
  844. a.innerHTML = b;
  845. TimerSM = setTimeout(function() {
  846. a.innerHTML = ""
  847. },
  848. 1000)
  849. }
  850. function createCopyBt() {
  851. // M.fe.copy({
  852. // copyBtnId: "copyPoint",
  853. // copytextId: "pointInput",
  854. // copyTag: "value",
  855. // callback: function(d) {
  856. // var c = Fe.G("copyMessage");
  857. // c.style.display = "inline-block";
  858. // setTimeout(function() {
  859. // c.style.display = "none"
  860. // },
  861. // 1000)
  862. // }
  863. // });
  864. // var a = setInterval(function() {
  865. // if (Fe.G("ZeroClipboardMovie_1")) {
  866. // var c = getAbsPoint(Fe.G("copyButton"));
  867. // if (baidu.browser.ie == 8) {
  868. // baidu.dom.getParent(Fe.G("ZeroClipboardMovie_1")).style.top = (c.y + 25) + "px";
  869. // baidu.dom.getParent(Fe.G("ZeroClipboardMovie_1")).style.left = (c.x + 170) + "px"
  870. // } else {
  871. // if (baidu.browser.ie < 8) {
  872. // baidu.dom.getParent(Fe.G("ZeroClipboardMovie_1")).style.top = (c.y - 10) + "px";
  873. // baidu.dom.getParent(Fe.G("ZeroClipboardMovie_1")).style.left = (c.x + 10) + "px"
  874. // } else {
  875. // baidu.dom.getParent(Fe.G("ZeroClipboardMovie_1")).style.top = (c.y + 6) + "px";
  876. // baidu.dom.getParent(Fe.G("ZeroClipboardMovie_1")).style.left = (c.x + 11) + "px"
  877. // }
  878. // }
  879. // clearInterval(a)
  880. // }
  881. // },
  882. // 1000);
  883. if (!document.all) {
  884. Fe.G("copyButton").style.top = "-9px";
  885. Fe.G("copyButton").style.left = "5px"
  886. }
  887. if (baidu.browser.ie >= 8) {
  888. Fe.G("copyButton").style.top = "-22px";
  889. Fe.G("copyButton").style.left = "5px"
  890. }
  891. var b = navigator.userAgent.toLowerCase();
  892. if ((/mozilla/.test(b)) && (!/(compatible|webkit)/.test(b))) {
  893. Fe.G("copyButton").style.top = "-22px";
  894. Fe.G("copyButton").style.left = "5px"
  895. }
  896. // 绑定复制功能
  897. // Fe.G("copyButton").addEventListener('click', function() {
  898. // console.log('-0-0-0-0-0-0')
  899. // copyTextByCB();
  900. // });
  901. copyTextByCB();
  902. }
  903. function copyTextByCB() {
  904. function messageTips(text) {
  905. var c = Fe.G("copyMessage");
  906. c.innerHTML = text;
  907. c.style.display = "inline-block";
  908. setTimeout(function() {
  909. c.style.display = "none"
  910. }, 1000);
  911. }
  912. // var clipboard = new Clipboard('#copyPoint');
  913. var clipboard = new Clipboard('#copyButton');
  914. clipboard.on('success', function(e) {
  915. e.clearSelection();
  916. if (e.text !== '') {
  917. messageTips('复制成功');
  918. }
  919. // console.info('Action:', e.action);
  920. // console.info('Text:', e.text);
  921. // console.info('Trigger:', e.trigger);
  922. });
  923. clipboard.on('error', function(e) {
  924. // console.error('Action2:', e.action);
  925. // console.error('Trigger2:', e.trigger);
  926. messageTips('请手动复制');
  927. });
  928. // var inpObj = document.getElementById('pointInput');
  929. // function messageTips(text) {
  930. // var c = Fe.G("copyMessage");
  931. // c.innerHTML = text;
  932. // c.style.display = "inline-block";
  933. // setTimeout(function() {
  934. // c.style.display = "none"
  935. // }, 1000);
  936. // }
  937. // var clipboard = new Clipboard(document.getElementById('copyPoint'), {
  938. // text: function(target) {
  939. // return inpObj.value || '';
  940. // }
  941. // });
  942. // clipboard.on('success', function(e) {
  943. // e.clearSelection();
  944. // messageTips('复制成功');
  945. // });
  946. // clipboard.on('error', function(e) {
  947. // messageTips('请手动复制');
  948. // });
  949. }
  950. function getAbsPoint(c) {
  951. var b = c.offsetLeft;
  952. var a = c.offsetTop;
  953. while (c = c.offsetParent) {
  954. b += c.offsetLeft;
  955. a += c.offsetTop
  956. }
  957. return {
  958. x: b,
  959. y: a
  960. }
  961. }
  962. // function CreateFlash(a, e, f, b, d) {
  963. // var c = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + f + '" height="' + b + '" id="' + a + '" align="middle">';
  964. // c += '<param name="allowScriptAccess" value="always">';
  965. // c += '<param name="quality" value="high">';
  966. // c += '<param name="movie" value="' + e + '">';
  967. // c += '<param name="flashvars" value="' + d + '">';
  968. // c += '<embed src="' + e + '" flashvars="' + d + '" quality="high" width="' + f + '" height="' + b + '" name="' + a + '" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
  969. // c += "</object>";
  970. // return c
  971. // }
  972. // function ieCopy() {
  973. // var a = Fe.G("pointInput");
  974. // var c = a.value;
  975. // if (!c) {
  976. // return
  977. // }
  978. // if (window.clipboardData) {
  979. // window.clipboardData.clearData();
  980. // window.clipboardData.setData("Text", c);
  981. // if (Fe.G("copyMessage")) {
  982. // Fe.G("copyMessage").style.display = ""
  983. // }
  984. // setTimeout(function() {
  985. // if (Fe.G("copyMessage")) {
  986. // Fe.G("copyMessage").style.display = "none"
  987. // }
  988. // },
  989. // 1000)
  990. // } else {
  991. // try {
  992. // Fe.copy(c);
  993. // if (Fe.G("copyMessage")) {
  994. // Fe.G("copyMessage").style.display = ""
  995. // }
  996. // setTimeout(function() {
  997. // if (Fe.G("copyMessage")) {
  998. // Fe.G("copyMessage").style.display = "none"
  999. // }
  1000. // },
  1001. // 1000);
  1002. // return c
  1003. // } catch(b) {}
  1004. // }
  1005. // }
  1006. function filtQuery(a) {
  1007. a = a || "";
  1008. return a.replace(/[\uac00-\ud7a3]/g, "").replace(/\u2022|\u2027|\u30FB/g, String.fromCharCode(183)).replace(/^\s*|\s*$/g, "")
  1009. }
  1010. function beginsearch(b, a) {
  1011. var c = filtQuery(Fe.G("localvalue").value);
  1012. // 处理特殊城市
  1013. if (isInArray(c)) {
  1014. trickCity(c);
  1015. return;
  1016. }
  1017. if (!c || c == "请输入关键字进行搜索") {
  1018. return
  1019. }
  1020. if (Fe.G("pointLabel").checked) {
  1021. searchByPoint(c)
  1022. } else {
  1023. if (!a) {
  1024. b.setLocation(map)
  1025. }
  1026. b.search(c)
  1027. }
  1028. }
  1029. // 判断是否市特殊城市
  1030. function isInArray(value){
  1031. var arr = ['钓鱼岛','赤尾屿','台北','高雄','台湾','台湾省','台北市','高雄市'];
  1032. for(var i = 0; i < arr.length; i++){
  1033. if(value === arr[i]){
  1034. return true;
  1035. }
  1036. }
  1037. return false;
  1038. }
  1039. // 处理特殊城市的状态
  1040. function trickCity(cityName) {
  1041. Fe.G("txtPanel").innerHTML = '<span style="color:#00c">已切换至' + cityName + "</span>";
  1042. switch (cityName) {
  1043. case '钓鱼岛':
  1044. var point = new BMap.Point(123.480329,25.748826);
  1045. break;
  1046. case '赤尾屿':
  1047. var point = new BMap.Point(124.582155,25.91351);
  1048. break;
  1049. case '台北':
  1050. case '台北市':
  1051. var point = new BMap.Point(121.546943,25.045762);
  1052. break;
  1053. case '高雄':
  1054. case '高雄市':
  1055. var point = new BMap.Point(120.326972,22.672297);
  1056. break;
  1057. case '台湾':
  1058. case '台湾省':
  1059. var point = new BMap.Point(120.985825,23.773814 );
  1060. break;
  1061. }
  1062. map.centerAndZoom(point, 10);
  1063. }
  1064. function searchByPoint(c) {
  1065. var d = c.split(",");
  1066. var b;
  1067. var g = "";
  1068. var e = temp.poiSearchMark;
  1069. var a = temp.geoCoder;
  1070. if (d[0] && d[0].split(".")[0].length > 5 && d[1] && d[1].split(".")[0].length > 5) {
  1071. var f = projection.pointToLngLat(new BMap.Pixel(d[0], d[1]));
  1072. d = [f.lng, f.lat]
  1073. }
  1074. if (d[0] && d[1]) {
  1075. clearLastResult();
  1076. b = new BMap.Point(d[0], d[1]);
  1077. if (!a) {
  1078. a = new BMap.Geocoder();
  1079. temp.geoCoder = a
  1080. }
  1081. a.getLocation(b,
  1082. function(h) {
  1083. if (h.address) {
  1084. Fe.G("txtPanel").innerHTML = "<b>地址:</b>" + h.address
  1085. }
  1086. });
  1087. if (e) {
  1088. e.show();
  1089. e.setPosition(b)
  1090. } else {
  1091. e = new BMap.Marker(b, {
  1092. enableMassClear: false
  1093. });
  1094. map.addOverlay(e);
  1095. temp.poiSearchMark = e
  1096. }
  1097. map.centerAndZoom(b, 15)
  1098. } else {
  1099. showMessage("请输入正确的坐标")
  1100. }
  1101. }
  1102. function searchInthisCity(a) {
  1103. l_local.setLocation(a);
  1104. beginsearch(l_local, "cityList")
  1105. }
  1106. document.onkeydown = function(evt) {
  1107. var evt = window.event ? window.event: evt;
  1108. target = evt.target ? evt.target: evt.srcElement;
  1109. fun = target.getAttribute("callback");
  1110. if (fun && evt.keyCode == 13) {
  1111. eval(fun)
  1112. }
  1113. };
  1114. function scriptRequest(url, echo, id, charset) {
  1115. var isIe = /msie/i.test(window.navigator.userAgent);
  1116. if (isIe && Fe.G("_script_" + id)) {
  1117. var script = Fe.G("_script_" + id)
  1118. } else {
  1119. if (Fe.G("_script_" + id)) {
  1120. Fe.G("_script_" + id).parentNode.removeChild(Fe.G("_script_" + id))
  1121. }
  1122. var script = document.createElement("script");
  1123. if (charset != null) {
  1124. script.charset = charset
  1125. }
  1126. if (id != null && id != "") {
  1127. script.setAttribute("id", "_script_" + id)
  1128. }
  1129. script.setAttribute("type", "text/javascript");
  1130. document.body.appendChild(script)
  1131. }
  1132. var t = new Date();
  1133. if (url.indexOf("?") > -1) {
  1134. url += "&t=" + t.getTime()
  1135. } else {
  1136. url += "?t=" + t.getTime()
  1137. }
  1138. var _complete = function() {
  1139. if (!script.readyState || script.readyState == "loaded" || script.readyState == "complete") {
  1140. if (echo == "null") {
  1141. return
  1142. } else {
  1143. if (typeof(echo) == "function") {
  1144. try {
  1145. echo()
  1146. } catch(e) {}
  1147. } else {
  1148. eval(echo)
  1149. }
  1150. }
  1151. }
  1152. };
  1153. if (isIe) {
  1154. script.onreadystatechange = _complete
  1155. } else {
  1156. script.onload = _complete
  1157. }
  1158. script.setAttribute("src", url)
  1159. }
  1160. function Page(d, c, e) {
  1161. Fe.BaseClass.call(this);
  1162. if (!d) {
  1163. return
  1164. }
  1165. this.container = (typeof(d) == "object") ? d: Fe.G(d);
  1166. this.page = 1;
  1167. this.pageCount = 100;
  1168. this.argName = "pg";
  1169. this.pagecap = 4;
  1170. this.callback = c;
  1171. this.update = true;
  1172. var a = {
  1173. page: 1,
  1174. totalCount: 100,
  1175. pageCount: 100,
  1176. pagecap: 4,
  1177. argName: "pg",
  1178. update: true
  1179. };
  1180. if (!e) {
  1181. e = a
  1182. }
  1183. for (var b in e) {
  1184. if (typeof(e[b]) != "undefined") {
  1185. this[b] = e[b]
  1186. }
  1187. }
  1188. this.render()
  1189. }
  1190. Fe.extend(Page.prototype, {
  1191. render: function() {
  1192. this.initialize()
  1193. },
  1194. initialize: function() {
  1195. this.checkPages();
  1196. this.container.innerHTML = this.createHtml()
  1197. },
  1198. checkPages: function() {
  1199. if (isNaN(parseInt(this.page))) {
  1200. this.page = 1
  1201. }
  1202. if (isNaN(parseInt(this.pageCount))) {
  1203. this.pageCount = 1
  1204. }
  1205. if (this.page < 1) {
  1206. this.page = 1
  1207. }
  1208. if (this.pageCount < 1) {
  1209. this.pageCount = 1
  1210. }
  1211. if (this.page > this.pageCount) {
  1212. this.page = this.pageCount
  1213. }
  1214. this.page = parseInt(this.page);
  1215. this.pageCount = parseInt(this.pageCount)
  1216. },
  1217. getPage: function() {
  1218. var c = location.search;
  1219. var a = new RegExp("[?&]?" + this.argName + "=([^&]*)[&$]?", "gi");
  1220. var b = c.match(a);
  1221. this.page = RegExp.$1
  1222. },
  1223. createHtml: function() {
  1224. var b = [],
  1225. f = this.page - 1,
  1226. e = this.page + 1;
  1227. b.push('<p class="page">');
  1228. if (f < 1) {} else {
  1229. if (this.page >= this.pagecap) {
  1230. b.push('<span><a href="javascript:void(0)" onclick="Instance(\'' + this.hashCode + "').toPage(1);\">首页</a></span>")
  1231. }
  1232. b.push('<span><a href="javascript:void(0)" onclick="Instance(\'' + this.hashCode + "').toPage(" + f + ');">上一页</a></span>')
  1233. }
  1234. if (this.page < this.pagecap) {
  1235. if (this.page % this.pagecap == 0) {
  1236. var a = this.page - this.pagecap - 1
  1237. } else {
  1238. var a = this.page - this.page % this.pagecap + 1
  1239. }
  1240. var d = a + this.pagecap - 1
  1241. } else {
  1242. var c = Math.floor(this.pagecap / 2);
  1243. var h = this.pagecap % 2 - 1;
  1244. if (this.pageCount > this.page + c) {
  1245. var d = this.page + c;
  1246. var a = this.page - c - h
  1247. } else {
  1248. var d = this.pageCount;
  1249. var a = this.page - c - h
  1250. }
  1251. }
  1252. if (this.page > this.pageCount - this.pagecap && this.page >= this.pagecap) {
  1253. var a = this.pageCount - this.pagecap + 1;
  1254. var d = this.pageCount
  1255. }
  1256. for (var g = a; g <= d; g++) {
  1257. if (g > 0) {
  1258. if (g == this.page) {
  1259. b.push("<span>" + g + "</span>")
  1260. } else {
  1261. if (g >= 1 && g <= this.pageCount) {
  1262. b.push('<span><a href="javascript:void(0)" onclick="Instance(\'' + this.hashCode + "').toPage(" + g + ');">[' + g + "]</a></span>")
  1263. }
  1264. }
  1265. }
  1266. }
  1267. if (e > this.pageCount) {} else {
  1268. b.push('<span><a href="javascript:void(0)" onclick="Instance(\'' + this.hashCode + "').toPage(" + e + ');">下一页</a></span>')
  1269. }
  1270. b.push("</p>");
  1271. return b.join("")
  1272. },
  1273. toPage: function(b) {
  1274. var a = b ? b: 1;
  1275. if (typeof(this.callback) == "function") {
  1276. this.callback(a);
  1277. this.page = a
  1278. }
  1279. if (this.update) {
  1280. this.render()
  1281. }
  1282. }
  1283. });
  1284. function Popup(a) {
  1285. Fe.BaseClass.call(this);
  1286. this.visible = false;
  1287. this.config = a;
  1288. if (!this.config) {
  1289. return
  1290. }
  1291. this.config.addDom = this.config.addDom ? Fe.G(this.config.addDom) : document.body;
  1292. if (a.clickClose != null && a.clickClose == false) {
  1293. this.config.clickClose = false
  1294. } else {
  1295. this.config.clickClose = true
  1296. }
  1297. this.connectDom = new Array()
  1298. }
  1299. Fe.extend(Popup.prototype, {
  1300. render: function() {
  1301. var b = this.config;
  1302. this.main = beforeEndHTML(b.addDom, '<div class="map_popup" style="width:390px;display:none"></div>');
  1303. var a = this.popBox = beforeEndHTML(this.main, '<div class="popup_main"></div>');
  1304. if (b.isTitle != false) {
  1305. this.title = beforeEndHTML(a, '<div class="title">系统信息</div>')
  1306. }
  1307. this.content = beforeEndHTML(a, '<div class="content"></div>');
  1308. if ( !! this.config.closeButton) {
  1309. this.button = beforeEndHTML(a, this.config.closeButton)
  1310. } else {
  1311. this.button = beforeEndHTML(a, '<button id="popup_close"></button>')
  1312. }
  1313. this.shadow = beforeEndHTML(this.main, '<div class="poput_shadow"></div>');
  1314. this.addConnectDom(this.main);
  1315. this.initialize()
  1316. },
  1317. initialize: function() {
  1318. var c = this.config;
  1319. this.setTitle(c.title);
  1320. this.setContent(c.content);
  1321. this.setWidth(c.width);
  1322. this.setHeight(c.height);
  1323. this.show();
  1324. var a = this;
  1325. var b = function(d) {
  1326. var f = d.srcElement || d.target;
  1327. while (f) {
  1328. var e = a.connectDom;
  1329. for (var g = 0; g < e.length; g++) {
  1330. if (f == e[g]) {
  1331. return
  1332. }
  1333. }
  1334. if (f == document.body) {
  1335. a.close();
  1336. return
  1337. }
  1338. f = f.parentNode
  1339. }
  1340. };
  1341. if (this.config.clickClose) {
  1342. Fe.on(document.body, "mousedown", b)
  1343. }
  1344. Fe.on(this.button, "click",
  1345. function(d) {
  1346. if (a.config.clickClose) {
  1347. Fe.un(document.body, "mousedown", b)
  1348. }
  1349. if (a.config.closeEffect && typeof(a.config.closeEffect) == "function") {
  1350. a.config.closeEffect()
  1351. } else {
  1352. a.main.parentNode.removeChild(a.main)
  1353. }
  1354. a.visible = false;
  1355. if (a.config.close && typeof(a.config.close) == "function") {
  1356. a.config.close()
  1357. }
  1358. if (this.resizeTimer) {
  1359. window.clearInterval(this.resizeTimer);
  1360. this.resizeTimer = null
  1361. }
  1362. if (Fe.G("imgLogo")) {
  1363. Fe.G("imgLogo").style.display = "";
  1364. Fe.G("imgLogo").style.display = "inline"
  1365. }
  1366. });
  1367. if (c.open && typeof(c.open) == "function") {
  1368. c.open()
  1369. }
  1370. },
  1371. setTitle: function(a) {
  1372. if (a && this.title) {
  1373. this.title.innerHTML = a;
  1374. this.config.title = a
  1375. }
  1376. },
  1377. setContent: function(a) {
  1378. if (a) {
  1379. if (typeof(a) == "string") {
  1380. this.content.innerHTML = a
  1381. } else {
  1382. this.content.innerHTML = "";
  1383. this.content.appendChild(a)
  1384. }
  1385. this.config.content = a
  1386. }
  1387. },
  1388. setWidth: function(a) {
  1389. if (a) {
  1390. this.main.style.width = (a - 8) + "px";
  1391. this.config.width = a
  1392. }
  1393. },
  1394. setHeight: function(a) {
  1395. if (this.resizeTimer) {
  1396. window.clearInterval(this.resizeTimer);
  1397. this.resizeTimer = null
  1398. }
  1399. if (a) {
  1400. this.main.style.height = this.shadow.style.height = (a - 9) + "px";
  1401. this.config.height = a;
  1402. if (this.config.isTitle == false) {
  1403. this.content.style.height = (a - 2) + "px"
  1404. } else {
  1405. this.content.style.height = (a - 24 - 9) + "px"
  1406. }
  1407. this.content.style.overflowY = "auto"
  1408. } else {
  1409. this.content.style.height = "auto";
  1410. this.resize()
  1411. }
  1412. },
  1413. hide: function() {
  1414. this.main.style.display = "none";
  1415. this.visible = false
  1416. },
  1417. show: function() {
  1418. this.main.style.display = "block";
  1419. this.popBox.scrollTop = 0;
  1420. this.visible = true
  1421. },
  1422. getDom: function() {
  1423. return this.main
  1424. },
  1425. resize: function() {
  1426. var a = this;
  1427. var b = function() {
  1428. if (a.config.isAddBottomHeight == false) {
  1429. var c = a.content.offsetHeight
  1430. } else {
  1431. var c = a.content.offsetHeight + 24
  1432. }
  1433. if (a.mainHeight) {
  1434. if (a.mainHeight != c) {
  1435. a.mainHeight = c
  1436. }
  1437. }
  1438. a.popBox.style.height = a.shadow.style.height = a.main.style.height = c + "px";
  1439. a.popBox.scrollTop = 0
  1440. };
  1441. if (this.resizeTimer) {
  1442. window.clearInterval(this.resizeTimer);
  1443. this.resizeTimer = null
  1444. }
  1445. this.resizeTimer = window.setInterval(b, 50)
  1446. },
  1447. close: function() {
  1448. this.button.click()
  1449. },
  1450. addConnectDom: function(a) {
  1451. this.connectDom.push(a)
  1452. }
  1453. });
  1454. function stopBubble(a) {
  1455. var a = window.event || a;
  1456. a.stopPropagation ? a.stopPropagation() : a.cancelBubble = true
  1457. }
  1458. function preventDefault(a) {
  1459. var a = window.event || a;
  1460. a.preventDefault ? a.preventDefault() : a.returnValue = false;
  1461. return false
  1462. };