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.
Yes, it is set up absolutely correctly. I have discovered some stuff that might shed light on my (and other's) problems:
The "Automatically parse links in text" option ALWAYS screws up the HTML code on the map page whenever the post edit box is loaded (it's too late even if you turn it off before saving the edit). You can either disable the function in the Vb Admin (not very convenient for users) or re-paste the Google map code into a post during editing.
If I use your code exactly as is it returns "Wrong Map URL..." every time. I've placed the code on a this page with the correct Google map code so you can view and debug the source (it doesn't seem to recognise the first search string?). Out of desperation, I modified the code to simplify it and tested it on this other page with exactly the same Google code and it seems to work OK (I've removed a couple of tests and avoided using " It's probably full of security holes as I'm no programmer
I've mentioned this on last page.
Quote:
Originally Posted by Leo Brazil
Just one small thing, does someone here knows an instrution to include on the code to remove the hyperlinks from GoogleMaps before the gmap instruction ?
I'll tell you why, on my board I have to use "parse links automaticaly" so when I past the Google Map link it comes with the links and if I use it with the link parsed the BB Code doesn't work, so I have to remove the hyperlink manually. As most my users are hard to teach this sequence I was wondering about this solution to be inside of gmap BBCode it self.
No idea so far. But I'm sure there must to be a way to include a string just at the beginning of this BBCode to unparse the links. I'm just trying to figure out each one.
I have found another quirk that your users need to be aware of....
If they are using the enhanced WYSIWYG post editor this will automatically parse the links in the Google iframe code to include [noparse][URL][/URL][noparse] tags, this breaks the bbcode.
Unfortunately I do not understand exactly what you mean because I can not so good English would be better for me, you can deuzsch Maybe it somewhat easier to explain.
[QUOTE=MrEyes;1650263]I have found another quirk that your users need to be aware of....
If they are using the enhanced WYSIWYG post editor this will automatically parse the links in the Google iframe code to include [noparse][URL][/URL][noparse] tags, this breaks the bbcode.
They need to change to the standard editor[/QUOTE]
This is exactly what I tried to describe. The point is using the standar editor really sucks and switching from standard do enhanced WYSIWYG also. The only "solution" I've found at this moment is never use quick reply editor, always Go Advanced, past Google link, select it all, click on Remove Links and after that use GoogleMaps BBcode.
If we had a string before this BBcode to remove the links from it would solve this issue at all.
This is exactly what I tried to describe. The point is using the standar editor really sucks and switching from standard do enhanced WYSIWYG also. The only "solution" I've found at this moment is never use quick reply editor, always Go Advanced, past Google link, select it all, click on Remove Links and after that use GoogleMaps BBcode.
If we had a string before this BBcode to remove the links from it would solve this issue at all.
Vb doesn't just add [url .. etc to the map code, it also re-arranges the parameters inside the <iframe..> block. I'm afraid I've had to give up on this one unless someone knows how to fix it - disabling the WYSIWYG editor or the automatic link parsing isn't an option for our users
Vb doesn't just add [url .. etc to the map code, it also re-arranges the parameters inside the <iframe..> block. I'm afraid I've had to give up on this one unless someone knows how to fix it - disabling the WYSIWYG editor or the automatic link parsing isn't an option for our users
That's correct. The editor parses [B] [U] [COLOR] and [URL] in case of Googlemaps links.
I've been playing here with intructions like stripe_tags and urlrx but I'm not a coder but I'm sure it can be possible. I'm sure someone here will come up with something for this.
I'm going to test it when I have a time slot...
I'll try to fix it, it seems possible...
Thanks all for testing
Thanks oasi for that. My comments here were given just with good intetions to improve this BBCode. I've been looking for this for so long and never found a easy and good solution as this one. Like I told before with this fix will be one of the best BBCodes ever publish here and will be MOTM for sure. :up: