主题: 百度地图官方代码问题,第二次修正 |
作者: 丰收之歌, 发布日期: 2013-04-13 09:21:16, 浏览数: 2382 |
function replaceBaiduMapString(s) {
var v = s; if (v.indexOf("//创建InfoWindow") != -1) { var sIndex_0 = v.indexOf("//标注点数组"); var eIndex_0 = v.indexOf("//创建marker"); var sStr_0 = v.substring(0, sIndex_0); var eStr_0 = v.substring(sIndex_0, eIndex_0); eStr_0="//标注点数组\n" + eStr_0.substr("//标注点数组".length).replace(/\s+/, "").replace(/[^}]+$/, "];")+"\n"; var sIndex_1 = v.indexOf("//创建InfoWindow"); var eIndex_1 = v.indexOf("//创建一个Icon"); var sStr_1 = v.substring(eIndex_0 , sIndex_1); var eStr_1 = v.substring(eIndex_1, v.length); v = sStr_0 + eStr_0+sStr_1 + "\/\/创建InfoWindow\n"; v += "function createInfoWindow(i){\n"; v += "var json = markerArr[i];\n"; v += "var iw = new BMap.InfoWindow(\"<b class='iw_poi_title' title='\" + json.title + \"'>\" + json.title + \"</b><div class='iw_poi_content'>\"+json.content+\"</div>\");\n"; v += "return iw;\n"; v += "}\n"; v += eStr_1; return v; } return s; }
function addEvent(obj, evt, fn) {
KindEditor.ready(function (K) { |