Optimizations of Javascript and little bug corrections
Hi,
First of all thanks a lot for sharing this beautiful plugin with everyone, it's really useful.
I would like to contribute to your work by adding some enhancement to this plugin... It's a big change, but I tried to commit separately all the things I do in order you to be able simply to pick what you want if you don't want all of it.
Theses are the changes of this pull request :
- Suppress CTRL+M end lines in the CSS and tries to fix themes using box-shadow on images For example, with Twenty Twelve theme, all parts of the map is surrounded by box-shadows.
- Replaces header and footer scripts by HTML5 data description and jQuery selectors to rebuild the maps in a generic way
This enhancement is offered to solve these issues :
- It separates the JavaScript from the PHP and the HTML (issue #18)
- No further use of the ids of the divs (issue #15 - the script was creating 2 script blocks for only one div)
- There is no inline
<script>tag anymore, that permits plugins like wp-minify to minify all the script - The script could then be deferred to raise the performance of the page
- Async load of Google Maps API Script
- Use of Static maps API to offer the admin user to :
- only use Static maps API to render the maps (complementary to issue #1)
- use Static maps API at first (for performance issues), and load Google Maps API on click or mouse over (issue #7)
- keep the current behaviour (no use of Static maps API)
- Restore the overview option on GmapsV3
(please apologize my English...)
Take care, you have to add the following line in the 2 functions wp_footer in order it not to break the feed :
if(is_feed()) return;
@piwel This is all great and something I would like to implement - I had already started thinking of the best approach.
I think what you've done is great, but it would be good to do it in a way so that maps could automtaically handle multiple markers too.
It might be that the map settings should be stored as attributes on the map div, and there should be a list or multiple divs instead the map div to which marker data could be added.
Hi Ben :)
Do you have news about it ?
I've not had chance to fully review this yet. I try to take a bit of look through now. Sorry
Thanks :) There's no rush, but I stopped updating the extension since then and that would be so great if it was integrated :-)