2014-05-18 00:35:18 +08:00
|
|
|
<!DOCTYPE HTML>
|
2014-05-11 12:26:47 +08:00
|
|
|
<html>
|
|
|
|
|
<head>
|
2014-05-18 00:35:18 +08:00
|
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
|
|
|
|
<title>上海艺术地图 - by vinjn</title>
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="http://api.amap.com/Public/css/demo.Default.css"/>
|
2014-05-11 12:26:47 +08:00
|
|
|
<style type="text/css">
|
2014-05-18 00:35:18 +08:00
|
|
|
html, body {
|
|
|
|
|
height: 100%;
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
body {
|
|
|
|
|
overflow:hidden;
|
|
|
|
|
}
|
|
|
|
|
#iCenter {
|
|
|
|
|
min-height: 100%;
|
|
|
|
|
}
|
2014-05-11 12:26:47 +08:00
|
|
|
</style>
|
2014-05-18 00:35:18 +08:00
|
|
|
<!--[if lte IE 6]>
|
|
|
|
|
<style type="text/css">
|
|
|
|
|
#container {
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<![endif]-->
|
|
|
|
|
|
|
|
|
|
<script language="javascript" src="http://webapi.amap.com/maps?v=1.2&key=c782dab5eb7efe1269dbc13cd77b9801
|
|
|
|
|
"></script>
|
2014-05-11 12:26:47 +08:00
|
|
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
2014-05-18 00:35:18 +08:00
|
|
|
<script language="javascript">
|
2014-05-11 12:26:47 +08:00
|
|
|
|
2014-05-18 00:35:18 +08:00
|
|
|
// http://api.amap.com/javascript/index
|
|
|
|
|
// http://api.amap.com/javascript/example
|
|
|
|
|
var mapObj;
|
|
|
|
|
function mapInit(){
|
|
|
|
|
mapObj = new AMap.Map("iCenter", {
|
|
|
|
|
center: new AMap.LngLat(121.473267,31.222715),
|
|
|
|
|
level: 13
|
|
|
|
|
});
|
|
|
|
|
// mapObj.plugin(["AMap.ToolBar"],function(){
|
|
|
|
|
// toolBar = new AMap.ToolBar();
|
|
|
|
|
// mapObj.addControl(toolBar);
|
|
|
|
|
// });
|
2014-05-11 12:26:47 +08:00
|
|
|
|
2014-05-18 00:35:18 +08:00
|
|
|
// https://github.com/unixcrh/DOUBANTONGCHENG/blob/master/DouBanTongCheng/ContentVC.m
|
|
|
|
|
var doubanApi = "https://api.douban.com/v2/event/list?loc=shanghai&type=exhibition&max-results=100&callback=?";
|
|
|
|
|
$.getJSON(doubanApi)
|
|
|
|
|
.done(function(json){
|
|
|
|
|
//response json are now in the json variable
|
|
|
|
|
console.log(json);
|
|
|
|
|
var events = json.events;
|
|
|
|
|
for (var i = events.length - 1; i >= 0; i--) {
|
|
|
|
|
var geo = events[i].geo.split(' ');
|
|
|
|
|
var marker = new AMap.Marker({
|
|
|
|
|
map: mapObj,
|
|
|
|
|
position: new AMap.LngLat(geo[1], geo[0]),
|
|
|
|
|
title: events[i].title + '\n' +
|
|
|
|
|
events[i].address + '\n' + events[i].begin_time + ' ~ ' + events[i].end_time,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
})
|
|
|
|
|
.fail(function() {
|
|
|
|
|
alert('脦脼路篓路脙脦脢露鹿掳锚脥卢鲁脟API拢隆');
|
|
|
|
|
});
|
|
|
|
|
}
|
2014-05-11 12:26:47 +08:00
|
|
|
|
|
|
|
|
</script>
|
2014-05-18 00:35:18 +08:00
|
|
|
</head>
|
|
|
|
|
<body onLoad="mapInit()">
|
|
|
|
|
<div id="iCenter"></div>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|