Projekt

Obecné

Profil

« Předchozí | Další » 

Revize ac6504c1

Přidáno uživatelem Ondřej Fibich před asi 5 roky(ů)

Fixes #1121: Fix slow loading of mapy.cz if Loader not fetched (e.g. slow connection or offline). The mapy.cz API is loaded asynchronously now. The map loading is waiting in a loop until it is loaded.

Zobrazit rozdíly:

application/views/devices/show.php
</div>
<script type="text/javascript">
$(document).ready(function () {
mapycz_dev('ap_gmap', <?php echo $gpsx ?>, <?php echo $gpsy ?>);
(function map_async_loader() {
if ('Loader' in window) {
Loader.async = true;
Loader.load(null, null, function () {
mapycz_dev('ap_gmap', <?php echo $gpsx ?>, <?php echo $gpsy ?>);
});
} else {
setTimeout(map_async_loader, 1000);
}
})();
});
</script>
<?php endif; ?>
application/views/js/address_points_show.php
markerLayer.enable();
};
var $map = $('#ap_gmap');
mapycz_addr('ap_gmap', $map.data('gpsx'), $map.data('gpsy'));
(function map_async_loader() {
if ('Loader' in window) {
Loader.async = true;
Loader.load(null, null, function () {
var $map = $('#ap_gmap');
mapycz_addr('ap_gmap', $map.data('gpsx'), $map.data('gpsy'));
});
} else {
setTimeout(map_async_loader, 1000);
}
})();
});
application/views/main.php
<?php echo html::script('media/js/messages_cs', FALSE) ?>
<?php echo html::script('media/js/php.min', FALSE) ?>
<?php if (isset($google_jsapi_enabled)): ?><script type="text/javascript" src="https://www.google.com/jsapi"></script><?php endif ?>
<?php if (isset($mapycz_enabled)): ?><script type="text/javascript" src="https://api.mapy.cz/loader.js"></script><script type="text/javascript">Loader.load()</script><?php endif ?>
<?php if (isset($mapycz_enabled)): ?><script type="text/javascript" src="https://api.mapy.cz/loader.js" async="async" defer="defer"></script><?php endif ?>
<?php if (TextEditor::$instance_counter): ?>
<?php echo html::script('media/js/tinymce/tiny_mce', FALSE) ?>
<script type="text/javascript"><!--

Také k dispozici: Unified diff