use google loader jsapi to load gmaps api later
This commit is contained in:
parent
baf713eaed
commit
b7f39f466f
|
@ -8,7 +8,7 @@
|
||||||
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
|
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
|
||||||
$this->breadcrumb('查看元数据');
|
$this->breadcrumb('查看元数据');
|
||||||
$this->breadcrumb()->setSeparator(' > ');
|
$this->breadcrumb()->setSeparator(' > ');
|
||||||
$this->headScript()->appendFile('http://maps.google.cn/maps?file=api&v=2&key='.$this->config->google->maps->api);
|
//$this->headScript()->appendFile('https://maps.google.cn/maps?file=api&v=2&key='.$this->config->google->maps->api);
|
||||||
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
|
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
|
||||||
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
|
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
|
||||||
$this->headLink()->appendStylesheet('/js/theme/default/style.css');
|
$this->headLink()->appendStylesheet('/js/theme/default/style.css');
|
||||||
|
@ -224,7 +224,7 @@ endforeach;
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach ($this->literature as $r) :
|
<?php foreach ($this->literature as $r) :
|
||||||
$u=parse_url($r->url);
|
$u=parse_url($r->url);
|
||||||
if ($u['host']=='hdl.handle.net')
|
if (@$u['host']=='hdl.handle.net')
|
||||||
$url=$this->config->seekspace->handleurl.$u['path'];
|
$url=$this->config->seekspace->handleurl.$u['path'];
|
||||||
else
|
else
|
||||||
$url=$r->url;
|
$url=$r->url;
|
||||||
|
@ -281,7 +281,18 @@ echo '</li>';
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function(){$(".colorbox").colorbox({photo:"true"});});
|
$(document).ready(function(){$(".colorbox").colorbox({photo:"true"});});
|
||||||
|
$(window).bind("load", function() { var timeout = setTimeout(function() { initLoader(); }, 100);});
|
||||||
|
//$(window).bind("load", function() { var timeout = setTimeout(function() { gmaploaded(); }, 1000);});
|
||||||
|
function loadMaps() {
|
||||||
|
google.load("maps", "2", {"callback" : gmaploaded,"base_domain": "ditu.google.cn"});
|
||||||
|
}
|
||||||
|
|
||||||
|
function initLoader() {
|
||||||
|
var script = document.createElement("script");
|
||||||
|
script.src = "https://www.google.com/jsapi?key=<?php echo $this->config->google->maps->api; ?>&callback=loadMaps";
|
||||||
|
script.type = "text/javascript";
|
||||||
|
document.getElementsByTagName("head")[0].appendChild(script);
|
||||||
|
}
|
||||||
//ajax download
|
//ajax download
|
||||||
function todownload(ft)
|
function todownload(ft)
|
||||||
{
|
{
|
||||||
|
@ -364,7 +375,9 @@ function getSubFileList(uuid,id,depth){
|
||||||
$('#span_'+id).html('-');
|
$('#span_'+id).html('-');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function gmaploaded()
|
||||||
|
{
|
||||||
//google map
|
//google map
|
||||||
var map = new GMap2(document.getElementById("watermap"));
|
var map = new GMap2(document.getElementById("watermap"));
|
||||||
var plotbounds=new GLatLngBounds(new GLatLng(<?= $md->south; ?>,<?= $md->west; ?>),new GLatLng(<?= $md->north; ?>,<?= $md->east; ?>));
|
var plotbounds=new GLatLngBounds(new GLatLng(<?= $md->south; ?>,<?= $md->west; ?>),new GLatLng(<?= $md->north; ?>,<?= $md->east; ?>));
|
||||||
|
@ -375,7 +388,7 @@ zoomlevel--;
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
if (zoomlevel>16) zoomlevel=16;
|
if (zoomlevel>16) zoomlevel=16;
|
||||||
map.setCenter(new GLatLng(<?= ($md->south+$md->north)/2; ?>,<?= ($md->east+$md->west)/2; ?>), zoomlevel);
|
map.setCenter(new GLatLng(<?= ($md->south+$md->north)/2; ?>,<?= ($md->east+$md->west)/2; ?>), zoomlevel);
|
||||||
map.setMapType(G_SATELLITE_MAP);
|
map.setMapType(G_HYBRID_MAP);
|
||||||
map.setUIToDefault();
|
map.setUIToDefault();
|
||||||
<?php if ($md->north==$md->south) : ?>
|
<?php if ($md->north==$md->south) : ?>
|
||||||
var marker=new GMarker(new GLatLng(<?= $md->north; ?>,<?= $md->east; ?>));
|
var marker=new GMarker(new GLatLng(<?= $md->north; ?>,<?= $md->east; ?>));
|
||||||
|
@ -389,7 +402,8 @@ zoomlevel--;
|
||||||
new GLatLng(<?= $md->north; ?>,<?= $md->west; ?>)
|
new GLatLng(<?= $md->north; ?>,<?= $md->west; ?>)
|
||||||
],"#f33f00",5,1,"#ff0000",0.2);
|
],"#f33f00",5,1,"#ff0000",0.2);
|
||||||
map.addOverlay(polygon);
|
map.addOverlay(polygon);
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<p>Cannot find the metadata.</p>
|
<p>Cannot find the metadata.</p>
|
||||||
|
|
Loading…
Reference in New Issue