Skip to content

Commit

Permalink
Working on removing the custom on-the-fly enqueueing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Wolf committed Aug 23, 2017
1 parent 9e56f27 commit e2d215b
Show file tree
Hide file tree
Showing 13 changed files with 14,746 additions and 8 deletions.
Binary file added assets/leaflet/1.2/images/layers-2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/leaflet/1.2/images/layers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/leaflet/1.2/images/marker-icon-2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/leaflet/1.2/images/marker-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/leaflet/1.2/images/marker-shadow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13,609 changes: 13,609 additions & 0 deletions assets/leaflet/1.2/leaflet-src.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/leaflet/1.2/leaflet-src.js.map

Large diffs are not rendered by default.

632 changes: 632 additions & 0 deletions assets/leaflet/1.2/leaflet.css

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions assets/leaflet/1.2/leaflet.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/leaflet/1.2/leaflet.js.map

Large diffs are not rendered by default.

40 changes: 32 additions & 8 deletions assets/plugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
/**
* Leaflet handler (theoretically requires no jQuery, but we use it anyway, just because ;) :P )
*
* @version 0.4
* Changelog:
* v0.5:
* - enhanced custom events with useful information
* - event data always include the map ID
* v0.4:
* - added custom events
*/

jQuery( function() {
Expand All @@ -10,7 +18,7 @@ jQuery( function() {
// grab all maps

if( jQuery('.ui-leaflet-map').length > 0 ) {
jQuery('.ui-leaflet-map').each( function() { // i, elem
jQuery('.ui-leaflet-map').each( function( iMapCount, elem) { // i, elem
// init map(s)
var strMapID = jQuery( this ).attr('id');
var config = jQuery( this ).data('leaflet-config');
Expand All @@ -19,10 +27,12 @@ jQuery( function() {

if( typeof( strMapID ) != 'undefined' && strMapID != '' && typeof( config ) == 'object' ) {
// fire custom init event
jQuery( document ).trigger( '_ui_leaflet_map_init' ); // base event

jQuery( document ).trigger( '_ui_leaflet_map_init__' + strMapID ); // custom map id

jQuery( document ).trigger( '_ui_leaflet_map_init', {
'map_id': strMapID,
'config': config,
'map_count': iMapCount,
} ); //



// init map
Expand Down Expand Up @@ -98,16 +108,30 @@ jQuery( function() {

L.marker( posMarker, {icon: L.divIcon({className: 'ui-leaflet-div-icon', html: strMarkerIcon} ) } ).addTo( _ui_leaflet_maps[strMapID] ).bindPopup( strMarkerText ).openPopup();

jQuery( document ).trigger( '_ui_leaflet_map_marker_added' );
jQuery( document ).trigger( '_ui_leaflet_map_marker_added', {
'map_id': strMapID,
'marker': {
'position': posMarker,
'icon_class': 'ui-leaflet-div-icon'
},
} );

// .. and remove marker code from dom, to avoid issues
jQuery('#' + strMapID + ' script.ui-leaflet-marker' ).remove();

}
}
jQuery( document ).trigger( '_ui_leaflet_map_loaded' ); // base event
jQuery( document ).trigger( '_ui_leaflet_map_loaded', {
'map_id': strMapID,
'settings': {
'layer': map_layer,
'zoom_level': map_zoomlevel,
'longitude': config.longitude,
'latitude': config.latitude,
}
} ); // base event


jQuery( document ).trigger( '_ui_leaflet_map_loaded__' + strMapID );
}
})
}
Expand Down
1 change: 1 addition & 0 deletions leaflet-map.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function init_assets() {
*/
$leaflet_version = apply_filters( $this->pluginPrefix . 'load_leaflet_version', '0.7.7' );
$leaflet_version = apply_filters( $this->pluginPrefix . 'load_leaflet_version', '1.0.1' );
$leaflet_version = apply_filters( $this->pluginPrefix . 'load_leaflet_version', '1.2' );

$leaflet_js_url = apply_filters( $this->pluginPrefix . 'js_url', trailingslashit( $this->pluginURL ). "assets/leaflet/$leaflet_version/leaflet.js");
$leaflet_css_url = apply_filters( $this->pluginPrefix . 'css_url', trailingslashit( $this->pluginURL ) . "assets/leaflet/$leaflet_version/leaflet.css");
Expand Down
Loading

0 comments on commit e2d215b

Please sign in to comment.