PDA

View Full Version : GoogleMaps Profile Tab Strange Problem


SorentoUltimate
12-01-2010, 08:10 AM
Hi all,

i add a profile tab with User Location on GoogleMaps.
I have a very strange problem, After Profile page koaded , if you go to the User Location GoogleMap the map are not Ok. (See First Image).

If you press Zoom In/Zoom Out from Browser View Menu the Map Fixed automaticaly! (See Second Image).

Another Info may help you understand what happen...

If you switch to User Location GoogleMap Tab when Profile Page Loading(Before finished) then load the map ok.

I need your Help !!!

First Image:
https://vborg.vbsupport.ru/attachment.php?attachmentid=124047&stc=1&d=1291198155

Second Image:
https://vborg.vbsupport.ru/attachment.php?attachmentid=124048&stc=1&d=1291198155

kh99
12-01-2010, 10:18 AM
I don't know anything about google maps, but my guess would be that it's just because it's not visible when the page loads (but maybe that's the obvious part).

Is this a mod or did you code this yourself? I'm thinking if you can somehow change the tab switch js function for that tab you could add some call to refresh it (or maybe not load it at all until the user actually goes to that tab).

SorentoUltimate
12-01-2010, 10:25 AM
but my guess would be that it's just because it's not visible when the page loads (but maybe that's the obvious part).

I agree with that.

Is this a mod or did you code this yourself?

Code by me.

I'm thinking if you can somehow change the tab switch js function for that tab you could add some call to refresh it (or maybe not load it at all until the user actually goes to that tab).

Good idea but i don't know how to do that, can u help on that ?

kh99
12-01-2010, 10:46 AM
Well, maybe you could use a plugin on member_complete hook and do a str_replace of the javascript call. There may be a better way to handle it but I don't remember offhand how tabs are added to the profile.

I guess I should have let someone else help you...:)

ETA: On my test site there's one custom tab (added by a modification), and it's got it's own template. In that case it would be easy because the javascript "toggle_collapse" call is in the template code. If you know what GMap method would refresh the map, you could try putting it in there after the toggle_collapse();

SorentoUltimate
12-01-2010, 11:25 AM
ETA: On my test site there's one custom tab (added by a modification), and it's got it's own template. In that case it would be easy because the javascript "toggle_collapse" call is in the template code. If you know what GMap method would refresh the map, you could try putting it in there after the toggle_collapse();

Here the code of "toggle_collapse"

onclick="return toggle_collapse('vbgooglemaps_ul')"

The function i want to call is "Load_Map"

but how?

kh99
12-01-2010, 11:48 AM
I haven't tried it, but maybe something like this:

onclick="var ret = toggle_collapse('vbgooglemaps_ul'); Load_Map(); return ret;"

I don't know how important that return code from toggle_collapse() really is (or what it even means).

SorentoUltimate
12-01-2010, 01:03 PM
Here the code i use:

require_once(DIR . '/includes/adminfunctions_template.php');

$string_fnd = 'onclick="return toggle_collapse(\'vbgooglemaps_ul\')"';

$string_rpl = 'onclick="var ret = toggle_collapse(\'vbgooglemaps_ul\'); alert(\'Geo\'); Load_Map; return ret;"';

$template_hook['profile_left_last'] = str_replace($string_fnd, $string_rpl, $template_hook['profile_left_last']);

unset($string_fnd, $string_rpl);
I add an alert to check, but never do the alert and also no display the map !!!!!!!

i check the source with mozilla and the replace work !!!

any idea?

kh99
12-01-2010, 01:16 PM
No, it looks OK to me. Could you post that section from the mozilla source?

ETA: except that, shouldn't it be Load_Map()? I'm not a js expert, I can't remember if you need the "()" for a function call. And in any case it seems like the alert should show up (unless it all gets ignored if there's an error an it somewhere).

ETA more: I tried it and you do need it to be "Load_Map();" for the function to be called, but using just "Load_Map;" doesn't cause any error.

SorentoUltimate
12-01-2010, 01:39 PM
i add the ()

here the code i view with Mozilla sources:
<div id="vbgooglemaps_ul" class="tborder content_block">
<h4 class="thead block_title">
<a href="http://www.sorento-ultimateclub.com/forum/members/administrator.html#top" class="collapse_gadget" onclick="var ret = toggle_collapse('vbgooglemaps_ul'); alert('Geo'); Load_Map(); return ret;"><img id="collapseimg_vbgooglemaps_ul" src="http://...............collapse_generic.gif" alt="" border="0" /></a>
<a name="vbgooglemaps_ul"></a>
<span class="block_name">Location On GoogleMaps</span>
</h4>
<div class="block_content" id="collapseobj_vbgooglemaps_ul" style="">

kh99
12-01-2010, 01:58 PM
I created this html file for a test:

<html>
<head><title></title>
<script type="text/javascript">
function Load_Map()
{
alert('Load_Map');
}
function toggle_collapse(name)
{
alert('toggle_collapse');
return false;
}
</script>
</head>
<body>
<div id="vbgooglemaps_ul" class="tborder content_block">
<h4 class="thead block_title">
<a href="http://www.sorento-ultimateclub.com/...rator.html#top" onclick="var ret = toggle_collapse('vbgooglemaps_ul'); alert('Geo'); Load_Map(); return ret;">Test</a>
<a name="vbgooglemaps_ul"></a>
<span class="block_name">Location On GoogleMaps</span>
</h4>
</div>
</body>
</html>


And it works, I get three alerts: toggle_collapse, Geo, Load_Map. But I'm not including the CSS classes or the real toggle_collapse function, so maybe that's the difference.

SorentoUltimate
12-01-2010, 02:23 PM
no idea why not work :(:(:(

kh99
12-01-2010, 10:37 PM
Me either. I spent some time trying to figure it out but couldn't.

I may have steered you in the wrong direction - I don't know if toggle_collapse() is even the right javascript function to be looking at for the tabs. That may be why you're not seeing the alerts.

I'll look at it more on Friday if you haven't figured out something by then.

SorentoUltimate
12-01-2010, 10:58 PM
Me either. I spent some time trying to figure it out but couldn't.

I may have steered you in the wrong direction - I don't know if toggle_collapse() is even the right javascript function to be looking at for the tabs. That may be why you're not seeing the alerts.

I'll look at it more on Friday if you haven't figured out something by then.

thanks for the help.

I Solve my problem, i modify vbulletin_tabctrl.js and now i'm ok!!!!

You give me the idea :):):):):):):):):).

you know about css?

look here if u can give any good idea https://vborg.vbsupport.ru/showthread.php?t=234195 ;)