[Solved] Open a popup by default in Google Map Viz

georgie

Member
Hello

Please is it possible to choose a popup to open by default on a GM viz?

I saw a discussion about, but it seems concerned code has changed and discussion is closed.

Thanks
 
Yeah, that's a 7 year old thread, from Fabrik 2.x (Joomla 1.5). So yes, it's closed, and the code won't work. :)

The code you would need now would be something like ...

However, I'm not entirely sure when to run it. Looks like the only convenient event we have is 'fabrik.viz.googlemap.ajax.refresh' which runs after an AJAX refresh. We don't seem to fire an event on initial load. But if you set "Defer loading" in the viz options, that would probably work. So maybe ...

Code:
requirejs(['fab/fabrik'], function () {
   Fabrik.addEvent('', function (viz) {
      viz.infoWindow.open(viz.map, viz.markers[0]);
   });
});

... in a ./components/com_fabrik/js/viz_X.js file, where X is your numeric viz ID.

-- hugh
 
Last edited:
Thanks.

I have now an error:

syntax error, unexpected 'var' (T_VAR)

I do this plugins \ fabrik_visualization \ googlemap \ views \ googlemap \ tmpl \ my_tmpl \ default.php (end of file):
Code:
window.addEvent('domready', function(){
var viz = Fabrik.getBlock('visualization_1');
viz.infoWindow.open(viz.map, viz.markers[0]);
});

And this in components \ com_fabrik \ js \ viz_1.js:
Code:
requirejs(['fab/fabrik'], function () {
   Fabrik.addEvent('', function (viz) {
     
   });
});

Please do you see the problem (I have changed the var name... without success)?
 
Sorry, I posted that before I finished editing the code.

You don't need to touch your default.php, so undo the changes to that, just add the JS file. See my previous post, which I've edited, for the code to use.

-- hugh
 
Hi

THX, but it does not work, with/without Ajax, Defer loading...

I will do last Joomla and Fab updates, to see.

THX
 
Looks like I never finished editing that code, the event name was missing.

Code:
requirejs(['fab/fabrik'], function () {
   Fabrik.addEvent('fabrik.viz.googlemap.ajax.refresh', function (viz) {
      viz.infoWindow.open(viz.map, viz.markers[0]);
   });
});

-- hugh
 
No, always no.

Please maybe I understand something, it seems to not be the code, but the Ajax/defer option:
Even without the code, this options does not work for me : map loads without end, neither icons.

Do you see where this can comes from?

THX
 
The defer option doesn't seem to be set.

Can you add this site to your My Sites, and give me a backend login so I can check.

-- hugh
 
OK thanks

Yes it is done, in my Sites it is "Master G?omatique".

So we talk to the map at the bottom of the front : https://master-geomatique.org/

In admin, it is the Viz ID 1 ("Carte Universit?").
The popup I want to display by default is in the first layer, it has a filter to select just one record, it is him.

THX!!!
 
Something is inserting this:

Code:
        <style>
        .lrcounter-horizontal-vertical table {
            background: none repeat scroll 0 0 transparent !important;
            border: medium none !important;
            color: #000000 !important;
            margin: 0 !important;
            padding: 0 !important;
            text-align: left !important;
        }
       
       
        .lrcounter-horizontal-vertical table tr, .lrcounter-horizontal-vertical table td {
            background: none repeat scroll 0 0 transparent !important;
            border: medium none !important;
            color: #000000 !important;
            display: inline-table;
            margin-left: 4px !important;
            padding: 0 2px !important;
            text-align: left !important;
            vertical-align: bottom !important;
        }
        iframe, svg {
            max-width: none !important;
        } 
        </style>

... into the JSON response from our map loading call, which is breaking it.

I'm pretty sure it's something to do with the "Login Radius" extension / plugin, but turning that plugin off didn't stop it.

You need to track down what is inserting that CSS into documents that aren't "format=html", and stop it doing that.

-- hugh


 
OK, yes, it was the social sharing extension. It was the "Content- social share" plygin which was inserting that CSS. I disabled that plugin. If you need to use it, you need to get the authors to make sure they only insert their CSS for document type html.

OK, so now the custom JS fires, but the code I gave you won't work, as it just opens an empty infowindow ... I forgot we insert the content for each marker on the fly, in the marker's click event. So in viz_1.js, replace ....

viz.infoWindow.open(viz.map, viz.markers[0]);

... with ...

google.maps.event.trigger(viz.markers[0], 'click');

... to simulate a click on the marker.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top