Skip to content
Snippets Groups Projects
Commit 4c9cb98b authored by johnv's avatar johnv Committed by podarok
Browse files

Issue #1945102 by johnv | ggarry: Fixed Drupal.ajax.prototype error.

parent 43b9e2fb
No related branches found
Tags 6.x-2.0-beta1
No related merge requests found
......@@ -241,8 +241,7 @@ function _gmap_base_js() {
$ret[$path . '/js/icon.js'] = array('weight' => 2);
$ret[$path . '/js/marker.js'] = array('weight' => 2);
$ret[$path . '/js/highlight.js'] = array('weight' => 2);
$ret[$path . '/js/poly.js'] = array('weight' => 3);
$ret[$path . '/js/gmap_views_ajax.js'] = array('weight' => 3);
$ret[$path . '/js/poly.js'] = array('weight' => 2);
global $language;
$file = 'api/js';
......@@ -259,26 +258,26 @@ function _gmap_base_js() {
// There is no https:// version of this domain, so this can be hard coded.
$ret[url('http' . '://ditu.google.cn/maps/' . $file, array('query' => $query))] = array(
'type' => 'external',
'weight' => 2,
'weight' => 1,
);
}
elseif ($query['language'] == 'zh-hant') {
$query['language'] = 'zh-TW';
$ret[url(gmap_views_protocol() . '://maps.googleapis.com/maps/' . $file, array('query' => $query))] = array(
'type' => 'external',
'weight' => 2,
'weight' => 1,
);
}
else {
$ret[url(gmap_views_protocol() . '://maps.googleapis.com/maps/' . $file, array('query' => $query))] = array(
'type' => 'external',
'weight' => 2,
'weight' => 1,
);
}
$ret['/' . variable_get('file_public_path', conf_path() . '/files') . '/js/gmap_markers.js'] = array(
'type' => 'external',
'weight' => 2,
'weight' => 4,
);
return $ret;
......@@ -612,7 +611,26 @@ function gmap_element_info() {
}
/**
* Pre render function to make sure all required JS is available.
* Implementation of hook_views_pre_render().
* Pre render function to load ajax-js file, which is only possible if ajax is enabled in the display.
*/
function gmap_views_pre_render(&$view) {
static $gmap_processed = FALSE;
// Add js only for gmap style views with ajax and not already processed.
if (($view->plugin_name != 'gmap' && $view->plugin_name != 'gmapextended')
|| (!$view->use_ajax) || $gmap_processed
) {
return;
}
// Mark the view as already processed.
$gmap_processed = TRUE;
// Add js, now we are certain ajax is enabled.
drupal_add_js(drupal_get_path('module', 'gmap') . '/js/gmap_views_ajax.js', array('group' => JS_DEFAULT));
}
/**
* Pre render function to make sure all required JS is available, depending on the display's behavior.
*/
function _gmap_pre_render_map($element) {
$path = drupal_get_path('module', 'gmap');
......@@ -653,7 +671,7 @@ function _gmap_pre_render_map($element) {
}
if (isset($mms[$mm]['filename'])) {
$element['#attached']['js'][$path . '/thirdparty/js/' . $mms[$mm]['filename']] = array('weight' => 3);
$element['#attached']['js'][$path . '/thirdparty/js/' . $mms[$mm]['filename']] = array('weight' => 5);
}
$element['#attached']['js'][$path . '/js/' . $mm . '_marker.js'] = array('weight' => 5);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment