Version: 1.1, by oasi
Developer Last Online: Dec 2008
Category: BB Code Enhancements -
Version: 3.7.x
Rating:
Released: 10-15-2008
Last Update: Never
Installs: 86
Re-useable Code Translations Is in Beta Stage
No support by the author.
Hi all
I've made a Custom BBcode to be able to insert any kind of google map into the forum posts, so the Plugins I tried were'nt working as we expected.
I post the code, I hope it can be useful for anyone.
Security problems, improvements and tunning will be apreciated...
I used the tag [gmap], and inside you have to copy the code for the HTML inclusion you can copy when you click the link icon in the map:
Code:
<script type="text/javascript">
function ckURL()
{ if ((u.indexOf("http://")!=u.lastIndexOf("http://"))||u.lastIndexOf("http://")!=0){return false;}
if (u.indexOf('"')>=0) {return false;}
if (u.indexOf("http://maps.google")!=0){return false;}
return true;
}
t='';incr=0;t_i="{param}";
t_n_q=t_i.replace(/"/g,'"');
if(t_n_q.indexOf("91;url")>0)
{ if(t_n_q.indexOf('91;url="')>0){t=t_n_q.substr(t_n_q.indexOf('91;url="')+8,t_n_q.length);t_n_q='';}
if(t_n_q.indexOf('91;url=')>0) {t=t_n_q.substr(t_n_q.indexOf('91;url=')+7,t_n_q.length);t_n_q='';a=t.replace(/93;/g,'"');t=a;incr=2;}
if(t_n_q.indexOf('91;url')>0) {if (t_n_q.indexOf('93;')==(t_n_q.indexOf('91;url')+8)){t=t_n_q.substr(t_n_q.indexOf('91;url')+11,t_n_q.length);a=t.replace(/91;/g,'"');t=a;}}
}
else
{ t=t_n_q.substr(t_n_q.indexOf('src="')+5,t_n_q.length);}
u=t.substr(0,t.indexOf('"')-incr);
up=u.replace(/amp;/g,'');u=up;
if (ckURL())
{ document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+u+'"></iframe>');}
else
{document.write("<p><b>Wrong map URL, edit the post to change it.</b></p>Reload the page when finished to check if correct.");}
</script>
The others settings for the BBCode are:
Use {option}: -> No Remove Tag If Empty -> Yes Disable BB Code Within This BB Code -> Yes Disable Smilies Within This BB Code -> Yes Disable Word Wrapping Within This BB Code ->Yes
Please, mark as installed if it worked and you are using it.
Hope it helps!
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
I'm not suere if it's that you're asking, but you can add directions, routes or whatever the googlemaps app let you add. You only have to click the link button when you've finished adding the stuff and put this code into the [gmap] bbcode.
I mean including the direction, such as "Turn left onto the n332 Alicante" next to the map.
There is a Problem when the Map is Searched via "Search in Map", the Embed HTML includes the Search Result Code and when Included in the GMAP BBCode then it Browse the Original Result and Not the Zoomed and Moved Map that supposes to be the one to be seen on the Embed HTML Code.
At first it seems to Displays the Zoomed Map but a Few Seconds Later when the Page is Loaded it Zoomes Back to the Original Result of the Search in Map.
This is a Zoomed Version of the Hotel Burj Al Arab, (Max Zoom), but if you Include it on the GMAP BBCode you'll see that it's Displayed Zoomed Out.
How can I Correct that and Tell GoogleMaps to Ignore the Search Code (You can see it on the Code as "q=burj+al+arab&" and some other Codes that are Different than the ones obtained by Browsing the Google Map and Not Searching it, and by Browsing it the Code is Correct and Displays the Zoomed Map as it should be)?
I obtained this by searching burj al arab on GoogleMaps and choosing/clicking on the first result.