public.js 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469
  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. callbackGoogle = function (data) {
  372. if (data.status === 0) {
  373. var value = data.points[0].lng + "," + data.points[0].lat;
  374. Fe.G("googlePointInput").value = value;
  375. Fe.G('googlePointInput').setAttribute('data-clipboard-text', value);
  376. }
  377. }
  378. callbackMars = function (data) {
  379. if (data.status === 0) {
  380. var value = data.points[0].lng + "," + data.points[0].lat;
  381. Fe.G("marsPointInput").value = value;
  382. Fe.G('marsPointInput').setAttribute('data-clipboard-text', value);
  383. }
  384. }
  385. function setInputPoint(a) {
  386. var value = a.lng + "," + a.lat;
  387. var point = new BMap.Point(a.lng, a.lat);
  388. var convertor = new BMap.Convertor();
  389. // convertor.translate(point, 5,3, callbackGoogle);
  390. convertor.translate(point, 5,3, callbackMars);
  391. Fe.G("pointInput").value = value;
  392. Fe.G('pointInput').setAttribute('data-clipboard-text', value);
  393. }
  394. function createMouseMoveLabel(c) {
  395. var a = map.pixelToPoint(new BMap.Pixel(0, 0));
  396. var b = c.lng + "," + c.lat;
  397. var d = new BMap.Label(b, {
  398. point: a,
  399. offset: new BMap.Size(13, 20),
  400. enableMassClear: false
  401. });
  402. d.setStyle({
  403. background: "#fff",
  404. border: "#999 solid 1px",
  405. zIndex: 10000000
  406. });
  407. map.addOverlay(d);
  408. temp.mouseLabel = d
  409. }
  410. function addMapControls() {
  411. window.stdMapCtrl = new BMap.NavigationControl();
  412. map.addControl(window.stdMapCtrl);
  413. window.scaleCtrl = new BMap.ScaleControl();
  414. map.addControl(window.scaleCtrl);
  415. window.overviewCtrl = new BMap.OverviewMapControl();
  416. map.addControl(window.overviewCtrl);
  417. var a = new BMap.CopyrightControl();
  418. map.addControl(a)
  419. }
  420. function mapResize() {
  421. var a = Fe.G("MapHolder");
  422. var b = Fe.G("shad_v");
  423. if (window._resizeTimer) {
  424. return
  425. }
  426. window._resizeTimer = setTimeout(function() {
  427. var c = getClientSize().height - 140;
  428. var d = c - 20;
  429. c = c < 0 ? 0 : c;
  430. d = d < 0 ? 0 : d;
  431. a.style.height = c + "px";
  432. Fe.G("MapInfo").style.height = d + "px";
  433. // if (overviewCtrl.getDom() == null) {
  434. // var e = parseInt(a.style.height)
  435. // } else {
  436. // var e = parseInt(a.style.height) - parseInt(overviewCtrl.getDom().style.height)
  437. // }
  438. // e = e < 0 ? 0 : e;
  439. // b.style.height = e + "px";
  440. window._resizeTimer = null
  441. },
  442. 100)
  443. }
  444. var mapInfo = {
  445. cityName: "",
  446. cityCode: "",
  447. centerPoint: null
  448. };
  449. var temp = {
  450. pt: [],
  451. mk: [],
  452. iw: [],
  453. iwOpenIndex: null,
  454. mouseLabel: null,
  455. poiSearchMark: null,
  456. geoCoder: null
  457. };
  458. var eventTemp = {};
  459. function clearLastResult() {
  460. Fe.G("txtPanel").innerHTML = "";
  461. temp.pt = [];
  462. temp.mk = [];
  463. temp.iw = [];
  464. temp.iwOpenInde = null;
  465. map.clearOverlays();
  466. if (temp.poiSearchMark) {
  467. temp.poiSearchMark.hide()
  468. }
  469. }
  470. function localsearch() {
  471. var a = [];
  472. var c = Fe.G("localvalue").value;
  473. var d = {
  474. onSearchComplete: function(w) {
  475. clearLastResult();
  476. if (b.getStatus() == BMAP_STATUS_SUCCESS) {
  477. var l = w.getCurrentNumPois();
  478. var k = w.getCurrentNumPois();
  479. var e = w.getNumPois();
  480. var p = "";
  481. if (l == 1 && typeof w.getPoi(0).city == "undefined") {
  482. var f = 4;
  483. // if (b && b._json && b._json.content && b._json.content.length == 2) {
  484. if (b && w && w.getNumPois() == 2) {
  485. f = w.getPoi(1);
  486. p = '<b style="font-size:14px;">' + w.keyword + "</b>"
  487. } else {
  488. if (b && w && w.city) {
  489. // f = b._json.current_city.level;
  490. // if (b._json.current_city.name == "全国") {
  491. // f = 4
  492. // }
  493. p = '<span style="color:#00c">已切换至' + w.city + "</span>";
  494. Fe.G("resultNum").innerHTML = ""
  495. }
  496. }
  497. map.centerAndZoom(w.getPoi(0).point, 12);
  498. Fe.G("txtPanel").innerHTML = p
  499. } else {
  500. // var o = _res_sta_i = b._json.content.length - k;
  501. p = '<ul class="local_s">';
  502. for (var z = 0; z < l; z++) {
  503. var h = w.getPoi(z);
  504. var q = h.title;
  505. var u = h.address;
  506. var n = h.phoneNumber;
  507. var v = h.point;
  508. var A = v.lng + "," + v.lat;
  509. var x = q;
  510. var j = h.type;
  511. var t = "地址";
  512. if (x.length > 20) {
  513. x = x.substring(0, 17) + "..."
  514. }
  515. if (j == 1) {
  516. t = "途径公交车"
  517. }
  518. if (j == 3) {
  519. t = "途径地铁"
  520. }
  521. p += '<li id="no' + z + '">';
  522. p += '<span id="mk_' + z + '"></span>';
  523. p += ' <div id="no_' + z + '">';
  524. p += ' <a href="javascript:void(0)" title="' + q + '">' + x + "</a>";
  525. p += " <p>" + t + ":" + u;
  526. n ? p += " <br/>电话:" + n: null;
  527. p += " <br/>坐标:" + A;
  528. p += " </p>";
  529. p += " </div>";
  530. p += "</li>";
  531. a.push(v);
  532. temp.pt.push(v);
  533. addMarker(z);
  534. createIw({
  535. tit: q,
  536. add: u,
  537. tel: n,
  538. poi: v,
  539. type: j
  540. })
  541. }
  542. p += "</ul>";
  543. p += '<div id="result_page_c"></div>';
  544. map.setViewport(a);
  545. a = [];
  546. Fe.G("txtPanel").innerHTML = p;
  547. Fe.G("resultNum").innerHTML = "共找到" + e + "条结果";
  548. var m = new Page("result_page_c",
  549. function(i) {
  550. Fe.G("MapInfo").scrollTop = 0;
  551. b.gotoPage(i - 1)
  552. },
  553. {
  554. page: w.getPageIndex() + 1,
  555. totalCount: e,
  556. pageCount: Math.ceil(e / 10)
  557. });
  558. if (m.pageCount <= 1) {
  559. Fe.G("result_page_c").innerHTML = ""
  560. }
  561. bindEvent()
  562. }
  563. } else {
  564. var y = "";
  565. Fe.G("resultNum").innerHTML = "";
  566. if (w.city != "全国") {
  567. y = "在<b>" + w.city + "</b>及全国没有找到相关的地点。"
  568. } else {
  569. y = "在全国没有找到相关的地点。"
  570. }
  571. if (w.getCityList().length > 0) {
  572. if (w.city != "全国") {
  573. y = "在<b>" + w.city + "</b>没有找到相关的地点。"
  574. } else {
  575. y = "在以下城市有结果,请您选择:<br />"
  576. }
  577. var g = w.getCityList();
  578. if (g.length > 0) {
  579. y += '<p style="margin-top:10px;">在以下城市找到结果,请选择城市:</p><ul class="SearchList" id="cityList" style="height:40px;overflow:hidden;">';
  580. for (var z = 0; z < g.length; z++) {
  581. y += "<li><a onclick=\"searchInthisCity('" + g[z].city + '\')" href="javascript:void(0)">' + g[z].city + "</a>(";
  582. y += g[z].numResults + ")</li>"
  583. }
  584. y += "</ul>";
  585. if (g.length > 6) {
  586. y += '<div id="moreCityPop"><a onclick="showMoreCity()" class="resultMore">更多城市</a></div>'
  587. }
  588. }
  589. }
  590. Fe.G("txtPanel").innerHTML = y
  591. }
  592. }
  593. };
  594. var b = new BMap.LocalSearch(map, d);
  595. window.l_local = b;
  596. Fe.G("localsearch").onclick = function() {
  597. beginsearch(b)
  598. }
  599. }
  600. function setCurrentMapInfo(c, d) {
  601. var a = mapInfo;
  602. var b = map.getZoom();
  603. a.cityName = c;
  604. a.cityCode = d;
  605. a.centerPoint = map.getCenter();
  606. Fe.G("curCity").innerHTML = c;
  607. Fe.G("ZoomNum").innerHTML = b
  608. }
  609. function getCurrentCityName() {
  610. var a = map.getZoom();
  611. var c;
  612. var h = 10000;
  613. if (a <= 7) {
  614. c = a;
  615. setCurrentMapInfo("全国");
  616. return
  617. }
  618. var i = function() {
  619. var m = map.getBounds();
  620. var j = projection.lngLatToPoint(m.getSouthWest());
  621. var l = projection.lngLatToPoint(m.getNorthEast());
  622. var k = function(n) {
  623. return parseInt(n / 1000) * 1000
  624. };
  625. return k(j.x) + "," + k(j.y) + ";" + k(l.x) + "," + k(l.y)
  626. };
  627. var e = mapInfo.centerPoint;
  628. var d = map.getCenter();
  629. var f = Math.sqrt((e.lng - d.lng) * (e.lng - d.lng) + (e.lat - d.lat) * (e.lat - d.lat));
  630. if (f > h || a != c) {
  631. c = a;
  632. var b = "https://map.baidu.com/?newmap=1&qt=cen&b=" + i() + "&l=" + a;
  633. scriptRequest(b, g, "_MAP_CENTER_", "gbk")
  634. }
  635. function g() {
  636. if (typeof _mapCenter == "undefined") {
  637. return
  638. }
  639. var j = _mapCenter;
  640. var k = j.content;
  641. if (!k) {
  642. return
  643. }
  644. setCurrentMapInfo(_mapCenter.content.name, _mapCenter.content.uid)
  645. }
  646. }
  647. function bindEvent() {
  648. var d = temp.mk;
  649. var a = temp.iw;
  650. var b = function(g) {
  651. if (temp.iwOpenIndex == g) {
  652. return
  653. }
  654. temp.iwOpenIndex = g;
  655. d[g].openInfoWindow(a[g]);
  656. setInputPoint(d[g].point)
  657. };
  658. var c = function(g) {
  659. if (temp.iwOpenIndex == g) {
  660. return
  661. }
  662. var i = d[g];
  663. var h = i.getIcon();
  664. h.setImageOffset(new BMap.Size(0, -250 - g * 25));
  665. i.setIcon(h);
  666. i.setTop(true, 1000100);
  667. Fe.G("no_" + g) ? Fe.G("no_" + g).className = "hover": null
  668. };
  669. var e = function(g) {
  670. var i = d[g];
  671. if (temp.iwOpenIndex == g) {
  672. i.setTop(true);
  673. return
  674. }
  675. var h = i.getIcon();
  676. h.setImageOffset(new BMap.Size(0, -g * 25));
  677. i.setIcon(h);
  678. i.setTop(false);
  679. Fe.G("no_" + g) ? Fe.G("no_" + g).className = "": null
  680. };
  681. for (var f = 0; f < d.length; f++) { (function() {
  682. var h = f;
  683. var i = d[h];
  684. var g = a[h];
  685. d[h].addEventListener("click",
  686. function() {
  687. b(h)
  688. });
  689. d[h].addEventListener("mouseover",
  690. function() {
  691. c(h)
  692. });
  693. d[h].addEventListener("mouseout",
  694. function() {
  695. e(h)
  696. });
  697. g.addEventListener("open",
  698. function() {
  699. temp.iwOpenIndex = h
  700. });
  701. g.addEventListener("close",
  702. function() {
  703. temp.iwOpenIndex = null;
  704. e(h)
  705. });
  706. Fe.on(Fe.G("no_" + h), "click",
  707. function() {
  708. b(h)
  709. });
  710. Fe.on(Fe.G("no_" + h), "mouseover",
  711. function() {
  712. c(h)
  713. });
  714. Fe.on(Fe.G("no_" + h), "mouseout",
  715. function() {
  716. e(h)
  717. });
  718. Fe.on(Fe.G("mk_" + h), "click",
  719. function() {
  720. b(h)
  721. });
  722. Fe.on(Fe.G("mk_" + h), "mouseover",
  723. function() {
  724. c(h)
  725. });
  726. Fe.on(Fe.G("mk_" + h), "mouseout",
  727. function() {
  728. e(h)
  729. })
  730. })()
  731. }
  732. }
  733. function addMarker(a) {
  734. var b = temp.pt[a];
  735. var d = new BMap.Icon("images/markers.png", new BMap.Size(23, 25), {
  736. offset: new BMap.Size(10, 25),
  737. imageOffset: new BMap.Size(0, 0 - a * 25),
  738. infoWindowAnchor: new BMap.Size(12, 0)
  739. });
  740. var c = new BMap.Marker(b, {
  741. icon: d
  742. });
  743. map.addOverlay(c);
  744. temp.mk.push(c);
  745. return c
  746. }
  747. function createIw(a) {
  748. var e = a.tit;
  749. var h = a.add;
  750. var d = a.tel;
  751. var i = a.poi.lng + "," + a.poi.lat;
  752. var j = '<p class="iwContent">';
  753. var f = a.type;
  754. var c = "地址";
  755. if (f == 1) {
  756. c = "途径公交车"
  757. }
  758. if (f == 3) {
  759. c = "途径地铁"
  760. }
  761. j += "<em>" + c + ":</em>" + h + "<br/>";
  762. d ? j += "<em>电话:</em>" + d + "<br/>": null;
  763. j += "<em>坐标:</em>" + i + "";
  764. j += "</p>";
  765. var g = e;
  766. if (g.length > 15) {
  767. g = g.substring(0, 12) + "..."
  768. }
  769. var b = new BMap.InfoWindow(j, {
  770. title: '<span class="iwTitle" title="' + e + '">' + g + "</span>",
  771. width: 250
  772. });
  773. temp.iw.push(b);
  774. return b
  775. }
  776. function showMoreCity() {
  777. Fe.G("cityList").style.height = "auto";
  778. Fe.G("moreCityPop").style.display = "none"
  779. }
  780. function goCity(c) {
  781. var b = c.tagName.toLowerCase() == "input" ? "value": "innerHTML";
  782. var a = c[b];
  783. getCityPoint(a)
  784. }
  785. function getCityPoint(b) {
  786. b = encodeURIComponent(b);
  787. var a = "https://map.baidu.com/?newmap=1&qt=cur&callback=setCurrentCity&ie=utf-8&wd=" + b + "&oue=1&res=jc";
  788. scriptRequest(a, "null")
  789. }
  790. function setCurrentCity(d) {
  791. if (!d.content || d.content.error == 0) {
  792. setTimeout(function() {
  793. Fe.G("selCityMessage").style.display = "block";
  794. Fe.G("selCityMessage").innerHTML = "请输入正确的中文城市名称"
  795. },
  796. 0)
  797. } else {
  798. hidePop();
  799. var b = (((d.content.geo).split("|")[2]).split(";")[0]).split(",")[0];
  800. var a = (((d.content.geo).split("|")[2]).split(";")[0]).split(",")[1];
  801. var c = projection.pointToLngLat(new BMap.Pixel(b, a));
  802. if (d.content.cname == "全国") {
  803. map.centerAndZoom(new BMap.Point(c.lng, c.lat), 5)
  804. } else {
  805. map.centerAndZoom(new BMap.Point(c.lng, c.lat), d.content.level)
  806. }
  807. clearLastResult();
  808. Fe.G("resultNum").innerHTML = "";
  809. Fe.G("txtPanel").innerHTML = '<span style="color:#00c">已切换至' + d.content.cname + "</span>"
  810. }
  811. }
  812. function hidePop() {
  813. if (Fe.G("selCityInput")) {
  814. Fe.G("selCityInput").value = "请输入城市名";
  815. Fe.G("selCityMessage").style.display = "none";
  816. Fe.G("map_popup").style.display = "none"
  817. }
  818. if (eventTemp.cityPop.length > 0) {
  819. var a = eventTemp.cityPop;
  820. for (var b = 0; b < a.length; b++) {
  821. Fe.un(a[b].dom, a[b].type, a[b].fun)
  822. }
  823. eventTemp.cityPop = []
  824. }
  825. }
  826. function showPop() {
  827. if (Fe.G("map_popup").style.display == "block") {
  828. return
  829. }
  830. Fe.G("map_popup").style.display = "block";
  831. var a = function(c) {
  832. var b = c.srcElement || c.target;
  833. while (b) {
  834. if (b == Fe.G("map_popup") || b == Fe.G("curCityText")) {
  835. return
  836. }
  837. if (b == Fe.G("selCity")) {
  838. Fe.G("selCityMessage").style.display = "none";
  839. return
  840. }
  841. if (b == document.body) {
  842. hidePop();
  843. return
  844. }
  845. b = b.parentNode
  846. }
  847. };
  848. Fe.on(document.body, "mousedown", a);
  849. eventTemp.cityPop = [];
  850. eventTemp.cityPop.push({
  851. dom: document.body,
  852. type: "mousedown",
  853. fun: a
  854. })
  855. }
  856. var TimerSM;
  857. function showMessage(b) {
  858. var a = Fe.G("searchTip");
  859. if (TimerSM) {
  860. clearTimeout(TimerSM)
  861. }
  862. a.innerHTML = b;
  863. TimerSM = setTimeout(function() {
  864. a.innerHTML = ""
  865. },
  866. 1000)
  867. }
  868. function createCopyBt() {
  869. if (!document.all) {
  870. Fe.G("baiduCopyButton").style.top = "-9px";
  871. Fe.G("baiduCopyButton").style.left = "5px"
  872. }
  873. if (baidu.browser.ie >= 8) {
  874. Fe.G("baiduCopyButton").style.top = "-22px";
  875. Fe.G("baiduCopyButton").style.left = "5px"
  876. }
  877. var b = navigator.userAgent.toLowerCase();
  878. if ((/mozilla/.test(b)) && (!/(compatible|webkit)/.test(b))) {
  879. Fe.G("baiduCopyButton").style.top = "-22px";
  880. Fe.G("baiduCopyButton").style.left = "5px"
  881. }
  882. // 绑定复制功能
  883. // Fe.G("baiduCopyButton").addEventListener('click', function() {
  884. // console.log('-0-0-0-0-0-0')
  885. // copyTextByCB();
  886. // });
  887. copyTextByCB();
  888. }
  889. function copyTextByCB() {
  890. function messageTips(text) {
  891. var c = Fe.G("copyMessage");
  892. c.innerHTML = text;
  893. c.style.display = "inline-block";
  894. setTimeout(function() {
  895. c.style.display = "none"
  896. }, 1000);
  897. }
  898. // var clipboard = new Clipboard('#copyPoint');
  899. var clipboard = new Clipboard('#baiduCopyButton');
  900. clipboard.on('success', function(e) {
  901. e.clearSelection();
  902. if (e.text !== '') {
  903. messageTips('复制成功');
  904. }
  905. // console.info('Action:', e.action);
  906. // console.info('Text:', e.text);
  907. // console.info('Trigger:', e.trigger);
  908. });
  909. clipboard.on('error', function(e) {
  910. // console.error('Action2:', e.action);
  911. // console.error('Trigger2:', e.trigger);
  912. messageTips('请手动复制');
  913. });
  914. // var inpObj = document.getElementById('pointInput');
  915. // function messageTips(text) {
  916. // var c = Fe.G("copyMessage");
  917. // c.innerHTML = text;
  918. // c.style.display = "inline-block";
  919. // setTimeout(function() {
  920. // c.style.display = "none"
  921. // }, 1000);
  922. // }
  923. // var clipboard = new Clipboard(document.getElementById('copyPoint'), {
  924. // text: function(target) {
  925. // return inpObj.value || '';
  926. // }
  927. // });
  928. // clipboard.on('success', function(e) {
  929. // e.clearSelection();
  930. // messageTips('复制成功');
  931. // });
  932. // clipboard.on('error', function(e) {
  933. // messageTips('请手动复制');
  934. // });
  935. }
  936. function getAbsPoint(c) {
  937. var b = c.offsetLeft;
  938. var a = c.offsetTop;
  939. while (c = c.offsetParent) {
  940. b += c.offsetLeft;
  941. a += c.offsetTop
  942. }
  943. return {
  944. x: b,
  945. y: a
  946. }
  947. }
  948. // function CreateFlash(a, e, f, b, d) {
  949. // 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">';
  950. // c += '<param name="allowScriptAccess" value="always">';
  951. // c += '<param name="quality" value="high">';
  952. // c += '<param name="movie" value="' + e + '">';
  953. // c += '<param name="flashvars" value="' + d + '">';
  954. // 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">';
  955. // c += "</object>";
  956. // return c
  957. // }
  958. // function ieCopy() {
  959. // var a = Fe.G("pointInput");
  960. // var c = a.value;
  961. // if (!c) {
  962. // return
  963. // }
  964. // if (window.clipboardData) {
  965. // window.clipboardData.clearData();
  966. // window.clipboardData.setData("Text", c);
  967. // if (Fe.G("copyMessage")) {
  968. // Fe.G("copyMessage").style.display = ""
  969. // }
  970. // setTimeout(function() {
  971. // if (Fe.G("copyMessage")) {
  972. // Fe.G("copyMessage").style.display = "none"
  973. // }
  974. // },
  975. // 1000)
  976. // } else {
  977. // try {
  978. // Fe.copy(c);
  979. // if (Fe.G("copyMessage")) {
  980. // Fe.G("copyMessage").style.display = ""
  981. // }
  982. // setTimeout(function() {
  983. // if (Fe.G("copyMessage")) {
  984. // Fe.G("copyMessage").style.display = "none"
  985. // }
  986. // },
  987. // 1000);
  988. // return c
  989. // } catch(b) {}
  990. // }
  991. // }
  992. function filtQuery(a) {
  993. a = a || "";
  994. return a.replace(/[\uac00-\ud7a3]/g, "").replace(/\u2022|\u2027|\u30FB/g, String.fromCharCode(183)).replace(/^\s*|\s*$/g, "")
  995. }
  996. function beginsearch(b, a) {
  997. var c = filtQuery(Fe.G("localvalue").value);
  998. // 处理特殊城市
  999. if (isInArray(c)) {
  1000. trickCity(c);
  1001. return;
  1002. }
  1003. if (!c || c == "请输入关键字进行搜索") {
  1004. return
  1005. }
  1006. if (Fe.G("pointLabel").checked) {
  1007. searchByPoint(c)
  1008. } else {
  1009. if (!a) {
  1010. b.setLocation(map)
  1011. }
  1012. b.search(c)
  1013. }
  1014. }
  1015. // 判断是否市特殊城市
  1016. function isInArray(value){
  1017. var arr = ['钓鱼岛','赤尾屿','台北','高雄','台湾','台湾省','台北市','高雄市'];
  1018. for(var i = 0; i < arr.length; i++){
  1019. if(value === arr[i]){
  1020. return true;
  1021. }
  1022. }
  1023. return false;
  1024. }
  1025. // 处理特殊城市的状态
  1026. function trickCity(cityName) {
  1027. Fe.G("txtPanel").innerHTML = '<span style="color:#00c">已切换至' + cityName + "</span>";
  1028. switch (cityName) {
  1029. case '钓鱼岛':
  1030. var point = new BMap.Point(123.480329,25.748826);
  1031. break;
  1032. case '赤尾屿':
  1033. var point = new BMap.Point(124.582155,25.91351);
  1034. break;
  1035. case '台北':
  1036. case '台北市':
  1037. var point = new BMap.Point(121.546943,25.045762);
  1038. break;
  1039. case '高雄':
  1040. case '高雄市':
  1041. var point = new BMap.Point(120.326972,22.672297);
  1042. break;
  1043. case '台湾':
  1044. case '台湾省':
  1045. var point = new BMap.Point(120.985825,23.773814 );
  1046. break;
  1047. }
  1048. map.centerAndZoom(point, 10);
  1049. }
  1050. function searchByPoint(c) {
  1051. var d = c.split(",");
  1052. var b;
  1053. var g = "";
  1054. var e = temp.poiSearchMark;
  1055. var a = temp.geoCoder;
  1056. if (d[0] && d[0].split(".")[0].length > 5 && d[1] && d[1].split(".")[0].length > 5) {
  1057. var f = projection.pointToLngLat(new BMap.Pixel(d[0], d[1]));
  1058. d = [f.lng, f.lat]
  1059. }
  1060. if (d[0] && d[1]) {
  1061. clearLastResult();
  1062. b = new BMap.Point(d[0], d[1]);
  1063. if (!a) {
  1064. a = new BMap.Geocoder();
  1065. temp.geoCoder = a
  1066. }
  1067. a.getLocation(b,
  1068. function(h) {
  1069. if (h.address) {
  1070. Fe.G("txtPanel").innerHTML = "<b>地址:</b>" + h.address
  1071. }
  1072. });
  1073. if (e) {
  1074. e.show();
  1075. e.setPosition(b)
  1076. } else {
  1077. e = new BMap.Marker(b, {
  1078. enableMassClear: false
  1079. });
  1080. map.addOverlay(e);
  1081. temp.poiSearchMark = e
  1082. }
  1083. map.centerAndZoom(b, 15)
  1084. } else {
  1085. showMessage("请输入正确的坐标")
  1086. }
  1087. }
  1088. function searchInthisCity(a) {
  1089. l_local.setLocation(a);
  1090. beginsearch(l_local, "cityList")
  1091. }
  1092. document.onkeydown = function(evt) {
  1093. var evt = window.event ? window.event: evt;
  1094. target = evt.target ? evt.target: evt.srcElement;
  1095. fun = target.getAttribute("callback");
  1096. if (fun && evt.keyCode == 13) {
  1097. eval(fun)
  1098. }
  1099. };
  1100. function scriptRequest(url, echo, id, charset) {
  1101. var isIe = /msie/i.test(window.navigator.userAgent);
  1102. if (isIe && Fe.G("_script_" + id)) {
  1103. var script = Fe.G("_script_" + id)
  1104. } else {
  1105. if (Fe.G("_script_" + id)) {
  1106. Fe.G("_script_" + id).parentNode.removeChild(Fe.G("_script_" + id))
  1107. }
  1108. var script = document.createElement("script");
  1109. if (charset != null) {
  1110. script.charset = charset
  1111. }
  1112. if (id != null && id != "") {
  1113. script.setAttribute("id", "_script_" + id)
  1114. }
  1115. script.setAttribute("type", "text/javascript");
  1116. document.body.appendChild(script)
  1117. }
  1118. var t = new Date();
  1119. if (url.indexOf("?") > -1) {
  1120. url += "&t=" + t.getTime()
  1121. } else {
  1122. url += "?t=" + t.getTime()
  1123. }
  1124. var _complete = function() {
  1125. if (!script.readyState || script.readyState == "loaded" || script.readyState == "complete") {
  1126. if (echo == "null") {
  1127. return
  1128. } else {
  1129. if (typeof(echo) == "function") {
  1130. try {
  1131. echo()
  1132. } catch(e) {}
  1133. } else {
  1134. eval(echo)
  1135. }
  1136. }
  1137. }
  1138. };
  1139. if (isIe) {
  1140. script.onreadystatechange = _complete
  1141. } else {
  1142. script.onload = _complete
  1143. }
  1144. script.setAttribute("src", url)
  1145. }
  1146. function Page(d, c, e) {
  1147. Fe.BaseClass.call(this);
  1148. if (!d) {
  1149. return
  1150. }
  1151. this.container = (typeof(d) == "object") ? d: Fe.G(d);
  1152. this.page = 1;
  1153. this.pageCount = 100;
  1154. this.argName = "pg";
  1155. this.pagecap = 4;
  1156. this.callback = c;
  1157. this.update = true;
  1158. var a = {
  1159. page: 1,
  1160. totalCount: 100,
  1161. pageCount: 100,
  1162. pagecap: 4,
  1163. argName: "pg",
  1164. update: true
  1165. };
  1166. if (!e) {
  1167. e = a
  1168. }
  1169. for (var b in e) {
  1170. if (typeof(e[b]) != "undefined") {
  1171. this[b] = e[b]
  1172. }
  1173. }
  1174. this.render()
  1175. }
  1176. Fe.extend(Page.prototype, {
  1177. render: function() {
  1178. this.initialize()
  1179. },
  1180. initialize: function() {
  1181. this.checkPages();
  1182. this.container.innerHTML = this.createHtml()
  1183. },
  1184. checkPages: function() {
  1185. if (isNaN(parseInt(this.page))) {
  1186. this.page = 1
  1187. }
  1188. if (isNaN(parseInt(this.pageCount))) {
  1189. this.pageCount = 1
  1190. }
  1191. if (this.page < 1) {
  1192. this.page = 1
  1193. }
  1194. if (this.pageCount < 1) {
  1195. this.pageCount = 1
  1196. }
  1197. if (this.page > this.pageCount) {
  1198. this.page = this.pageCount
  1199. }
  1200. this.page = parseInt(this.page);
  1201. this.pageCount = parseInt(this.pageCount)
  1202. },
  1203. getPage: function() {
  1204. var c = location.search;
  1205. var a = new RegExp("[?&]?" + this.argName + "=([^&]*)[&$]?", "gi");
  1206. var b = c.match(a);
  1207. this.page = RegExp.$1
  1208. },
  1209. createHtml: function() {
  1210. var b = [],
  1211. f = this.page - 1,
  1212. e = this.page + 1;
  1213. b.push('<p class="page">');
  1214. if (f < 1) {} else {
  1215. if (this.page >= this.pagecap) {
  1216. b.push('<span><a href="javascript:void(0)" onclick="Instance(\'' + this.hashCode + "').toPage(1);\">首页</a></span>")
  1217. }
  1218. b.push('<span><a href="javascript:void(0)" onclick="Instance(\'' + this.hashCode + "').toPage(" + f + ');">上一页</a></span>')
  1219. }
  1220. if (this.page < this.pagecap) {
  1221. if (this.page % this.pagecap == 0) {
  1222. var a = this.page - this.pagecap - 1
  1223. } else {
  1224. var a = this.page - this.page % this.pagecap + 1
  1225. }
  1226. var d = a + this.pagecap - 1
  1227. } else {
  1228. var c = Math.floor(this.pagecap / 2);
  1229. var h = this.pagecap % 2 - 1;
  1230. if (this.pageCount > this.page + c) {
  1231. var d = this.page + c;
  1232. var a = this.page - c - h
  1233. } else {
  1234. var d = this.pageCount;
  1235. var a = this.page - c - h
  1236. }
  1237. }
  1238. if (this.page > this.pageCount - this.pagecap && this.page >= this.pagecap) {
  1239. var a = this.pageCount - this.pagecap + 1;
  1240. var d = this.pageCount
  1241. }
  1242. for (var g = a; g <= d; g++) {
  1243. if (g > 0) {
  1244. if (g == this.page) {
  1245. b.push("<span>" + g + "</span>")
  1246. } else {
  1247. if (g >= 1 && g <= this.pageCount) {
  1248. b.push('<span><a href="javascript:void(0)" onclick="Instance(\'' + this.hashCode + "').toPage(" + g + ');">[' + g + "]</a></span>")
  1249. }
  1250. }
  1251. }
  1252. }
  1253. if (e > this.pageCount) {} else {
  1254. b.push('<span><a href="javascript:void(0)" onclick="Instance(\'' + this.hashCode + "').toPage(" + e + ');">下一页</a></span>')
  1255. }
  1256. b.push("</p>");
  1257. return b.join("")
  1258. },
  1259. toPage: function(b) {
  1260. var a = b ? b: 1;
  1261. if (typeof(this.callback) == "function") {
  1262. this.callback(a);
  1263. this.page = a
  1264. }
  1265. if (this.update) {
  1266. this.render()
  1267. }
  1268. }
  1269. });
  1270. function Popup(a) {
  1271. Fe.BaseClass.call(this);
  1272. this.visible = false;
  1273. this.config = a;
  1274. if (!this.config) {
  1275. return
  1276. }
  1277. this.config.addDom = this.config.addDom ? Fe.G(this.config.addDom) : document.body;
  1278. if (a.clickClose != null && a.clickClose == false) {
  1279. this.config.clickClose = false
  1280. } else {
  1281. this.config.clickClose = true
  1282. }
  1283. this.connectDom = new Array()
  1284. }
  1285. Fe.extend(Popup.prototype, {
  1286. render: function() {
  1287. var b = this.config;
  1288. this.main = beforeEndHTML(b.addDom, '<div class="map_popup" style="width:390px;display:none"></div>');
  1289. var a = this.popBox = beforeEndHTML(this.main, '<div class="popup_main"></div>');
  1290. if (b.isTitle != false) {
  1291. this.title = beforeEndHTML(a, '<div class="title">系统信息</div>')
  1292. }
  1293. this.content = beforeEndHTML(a, '<div class="content"></div>');
  1294. if ( !! this.config.closeButton) {
  1295. this.button = beforeEndHTML(a, this.config.closeButton)
  1296. } else {
  1297. this.button = beforeEndHTML(a, '<button id="popup_close"></button>')
  1298. }
  1299. this.shadow = beforeEndHTML(this.main, '<div class="poput_shadow"></div>');
  1300. this.addConnectDom(this.main);
  1301. this.initialize()
  1302. },
  1303. initialize: function() {
  1304. var c = this.config;
  1305. this.setTitle(c.title);
  1306. this.setContent(c.content);
  1307. this.setWidth(c.width);
  1308. this.setHeight(c.height);
  1309. this.show();
  1310. var a = this;
  1311. var b = function(d) {
  1312. var f = d.srcElement || d.target;
  1313. while (f) {
  1314. var e = a.connectDom;
  1315. for (var g = 0; g < e.length; g++) {
  1316. if (f == e[g]) {
  1317. return
  1318. }
  1319. }
  1320. if (f == document.body) {
  1321. a.close();
  1322. return
  1323. }
  1324. f = f.parentNode
  1325. }
  1326. };
  1327. if (this.config.clickClose) {
  1328. Fe.on(document.body, "mousedown", b)
  1329. }
  1330. Fe.on(this.button, "click",
  1331. function(d) {
  1332. if (a.config.clickClose) {
  1333. Fe.un(document.body, "mousedown", b)
  1334. }
  1335. if (a.config.closeEffect && typeof(a.config.closeEffect) == "function") {
  1336. a.config.closeEffect()
  1337. } else {
  1338. a.main.parentNode.removeChild(a.main)
  1339. }
  1340. a.visible = false;
  1341. if (a.config.close && typeof(a.config.close) == "function") {
  1342. a.config.close()
  1343. }
  1344. if (this.resizeTimer) {
  1345. window.clearInterval(this.resizeTimer);
  1346. this.resizeTimer = null
  1347. }
  1348. if (Fe.G("imgLogo")) {
  1349. Fe.G("imgLogo").style.display = "";
  1350. Fe.G("imgLogo").style.display = "inline"
  1351. }
  1352. });
  1353. if (c.open && typeof(c.open) == "function") {
  1354. c.open()
  1355. }
  1356. },
  1357. setTitle: function(a) {
  1358. if (a && this.title) {
  1359. this.title.innerHTML = a;
  1360. this.config.title = a
  1361. }
  1362. },
  1363. setContent: function(a) {
  1364. if (a) {
  1365. if (typeof(a) == "string") {
  1366. this.content.innerHTML = a
  1367. } else {
  1368. this.content.innerHTML = "";
  1369. this.content.appendChild(a)
  1370. }
  1371. this.config.content = a
  1372. }
  1373. },
  1374. setWidth: function(a) {
  1375. if (a) {
  1376. this.main.style.width = (a - 8) + "px";
  1377. this.config.width = a
  1378. }
  1379. },
  1380. setHeight: function(a) {
  1381. if (this.resizeTimer) {
  1382. window.clearInterval(this.resizeTimer);
  1383. this.resizeTimer = null
  1384. }
  1385. if (a) {
  1386. this.main.style.height = this.shadow.style.height = (a - 9) + "px";
  1387. this.config.height = a;
  1388. if (this.config.isTitle == false) {
  1389. this.content.style.height = (a - 2) + "px"
  1390. } else {
  1391. this.content.style.height = (a - 24 - 9) + "px"
  1392. }
  1393. this.content.style.overflowY = "auto"
  1394. } else {
  1395. this.content.style.height = "auto";
  1396. this.resize()
  1397. }
  1398. },
  1399. hide: function() {
  1400. this.main.style.display = "none";
  1401. this.visible = false
  1402. },
  1403. show: function() {
  1404. this.main.style.display = "block";
  1405. this.popBox.scrollTop = 0;
  1406. this.visible = true
  1407. },
  1408. getDom: function() {
  1409. return this.main
  1410. },
  1411. resize: function() {
  1412. var a = this;
  1413. var b = function() {
  1414. if (a.config.isAddBottomHeight == false) {
  1415. var c = a.content.offsetHeight
  1416. } else {
  1417. var c = a.content.offsetHeight + 24
  1418. }
  1419. if (a.mainHeight) {
  1420. if (a.mainHeight != c) {
  1421. a.mainHeight = c
  1422. }
  1423. }
  1424. a.popBox.style.height = a.shadow.style.height = a.main.style.height = c + "px";
  1425. a.popBox.scrollTop = 0
  1426. };
  1427. if (this.resizeTimer) {
  1428. window.clearInterval(this.resizeTimer);
  1429. this.resizeTimer = null
  1430. }
  1431. this.resizeTimer = window.setInterval(b, 50)
  1432. },
  1433. close: function() {
  1434. this.button.click()
  1435. },
  1436. addConnectDom: function(a) {
  1437. this.connectDom.push(a)
  1438. }
  1439. });
  1440. function stopBubble(a) {
  1441. var a = window.event || a;
  1442. a.stopPropagation ? a.stopPropagation() : a.cancelBubble = true
  1443. }
  1444. function preventDefault(a) {
  1445. var a = window.event || a;
  1446. a.preventDefault ? a.preventDefault() : a.returnValue = false;
  1447. return false
  1448. };