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.
You have to edit the link from:
[Gmap]<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f
I tried messing with the javascript but I'm far from an expert and didn't understand what some of it was doing. Someone w/more experience should be able to fix this for the current way Google is doing this and maybe even add an OR to support the previous way it was done.
Simply removing the 1st 's' from the 1st 'https' will allow the script to work albeit not the best looking code. I just don't know how to do that so any help is appreciated.
Yep, that is only temporary solution.
I put this problem on my forum if some user have skill in Javascript coding to find solution that code works with http and https protocol.