View Full Version : BB Code Enhancements - Google maps BBCode
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:
http://forums.tinet.org/images/usmapes.jpg
<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.l ength);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! :)
GreasySpoon
10-16-2008, 10:55 AM
What kind of HTML code can be added? Every?
No, it's to insert google maps references.
The javascript checks you're introducing a valid maps.google URL.
Into the image,the code you must paste is shown....
robbiefritz
10-16-2008, 11:47 AM
Super!
Leo Brazil
10-16-2008, 03:34 PM
Dude, this is awsome !!!
Let's see how it goes (intalling right now) and get back for a feedback.
Good job.
Feign
10-16-2008, 04:11 PM
Very good. Was looking for this a few weeks ago. This seems to work for all manner of Google Maps, including the "route" type ones which is good for planning weekend cruises!
sensimilla
10-16-2008, 07:38 PM
Any demo ? TIA
crkgb
10-16-2008, 07:53 PM
It iframes the entire page as I see. Is there a way to display just a map?
As far as I know, it only iframes the map, if you tested and it appeared all the page, please send how you did it to parse this case....
Here is an example (it's in our local language, but the map is the map XD)
http://forums.tinet.org/showthread.php?t=103
skcyber
10-17-2008, 12:30 PM
hey guys, I got a problem using this wonderful code..
when I paste the html code (iframe...)
I have this message in the post :
Google
Error
Forbidden
Your client does not have permission to get URL /maps?f=q&hl=fr&geocode=&q=tour+eiffel+%20%20paris&ie=UTF8&ll=48.858072,2.294859& sp%20%20n=0.006295,0.006295&output=embed&s=AARTsJr%20%20CvdyoV0AZQw6_BVqD495b8b0 qyA from this server. (Client IP address: 82.238.112.139)
MrEyes
10-17-2008, 02:30 PM
This is great, thankyou very much for providing this.
I have been looking at doing it myself but could not find a secure solution that would prevent people embedding any link. Looking at the javascript it looks like this solves that problem
segwayon
10-17-2008, 06:34 PM
hey guys, I got a problem using this wonderful code..
when I paste the html code (iframe...)
I have this message in the post :
Google
Error
Forbidden
Your client does not have permission to get URL /maps?f=q&hl=fr&geocode=&q=tour+eiffel+%20%20paris&ie=UTF8&ll=48.858072,2.294859&sp%20%20n=0.006295,0.006295&output=embed&s=AARTsJr%20%20CvdyoV0AZQw6_BVqD495b8b0qyA from this server. (Client IP address: 82.238.112.139)
Me too.
As I recall, Google requires an API key on a server to dish out their maps. Any leads on this? I know their licensing levels for businesses is really steep.
safakuygur
10-17-2008, 06:51 PM
very nice
good
thanks
segwayon
10-17-2008, 07:33 PM
My first try was with a Google search on my town. It had one pin in the map. That URL got a permissions error from the Google server.
When I tried to paste in a URL with driving directions, it embedded the page, albeit in a small form, and with the driving directions hogging a lot of the IFRAME space. I can alter the scripts' width and height, but are there any pointers for embedding the map alone as showing on the Tinet.org website?
segwayon
10-17-2008, 08:03 PM
I'm attaching a "gmap.gif" button which I made for this BB Code, if anyone wishes to use it.
Leo Brazil
10-17-2008, 08:36 PM
It iframes the entire page as I see. Is there a way to display just a map?
I could reproduce this situation here. It gave me the intire page if I use a link that comes for the first page when you open googlemaps, like your country. If you get a close up one it gave me only the map.
hey guys, I got a problem using this wonderful code..
when I paste the html code (iframe...)
I have this message in the post :
Google
Error
Forbidden
Your client does not have permission to get URL /maps?f=q&hl=fr&geocode=&q=tour+eiffel+%20%20paris&ie=UTF8&ll=48.858072,2.294859&sp%20%20n=0.006295,0.006295&output=embed&s=AARTsJr%20%20CvdyoV0AZQw6_BVqD495b8b0qyA from this server. (Client IP address: 82.238.112.139)
I've got the same here. I don't know why but If use a code from anyplace in US it works fine but anything from out side like my country, it gives me the same error.
Any idea what could it be ?
If this problem can be solved this will be one of the best BBCode ever.
Tks
skcyber
10-17-2008, 09:40 PM
If this problem can be solved this will be one of the best BBCode ever.
yeah this would be the best BB code ever lol :up:
I tried with the USA, it's working, but it doesn't store the zoom on the street.
segwayon
10-18-2008, 02:40 AM
I compared my HTML source with yours, and noticed that mine contains some extra space characters. Not sure if that matters or not, but here they are, represented by underline characters for ease of viewing:
&__amp;t=h
&a__mp;ll=38.1 . . .
&amp;ou__tput=embed" . . .
&__amp;t=h
&amp;so__urce=embed" . . .
The URL source from Google didn't contain any of these extra space characters.
On another note, would you mind sharing how you acquired the URL from Google? Did you use the "My Maps" feature? And do just plain driving directions embedd a map, too? Or a whole webpage as it does for me?
Thanks!
segwayon
10-18-2008, 02:55 AM
I could reproduce this situation here. It gave me the intire page if I use a link that comes for the first page when you open googlemaps, like your country. If you get a close up one it gave me only the map.
I've got the same here. I don't know why but If use a code from anyplace in US it works fine but anything from out side like my country, it gives me the same error.
Any idea what could it be ?
If this problem can be solved this will be one of the best BBCode ever.
Tks
I noticed that using a URL of just a town's location returned the forbidden permissions error, but using a URL of driving directions of maybe 80 miles embeds a whole page. Update: Page embeds also for a 1.6 mile drive.
Thank you very much for this bb-code, but mostly I got this :confused:
saan88262
skcyber
10-18-2008, 02:24 PM
on google map, i click on "link", then copy the Second line code "HTML"
and then paste in between the 2
exemple :
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.fr/maps?f=q&hl=fr&q=Tour+Eiffel,+Paris,+Paris,+Ile-de-France,+France&ie=UTF8&cd=1&geocode=FV2E6QIdVwIjAA &ll=48.858072,2.294859&spn=0.006295,0.006295&outpu t=embed&s=AARTsJrhqdnzOeeswFdlcNNM6gKhvDTNsg"></iframe><br /><small><a href="http://maps.google.fr/maps?f=q&hl=fr&q=Tour+Eiffel,+Paris,+Paris,+Ile-de-France,+France&ie=UTF8&cd=1&geocode=FV2E6QIdVwIjAA &ll=48.858072,2.294859&spn=0.006295,0.006295&sourc e=embed" style="color:#0000FF;text-align:left">Agrandir le plan</a></small>
I got the same thing than Saan...
segwayon
10-18-2008, 03:10 PM
As a test, it would be good to use the URL source of those who CAN get the map-only to embed, to make sure it isn't something on our servers. The originator presents a grainy photo of the URL, but getting it in copy would be ideal.
I suspect that the parsing within this mod isn't polished enough to account for ALL the types of Google URLs out there.
Alfa1
10-18-2008, 05:00 PM
This is really interesting. I hope someone can improve this. I was previously using Stonyarc his hack (https://vborg.vbsupport.ru/showthread.php?t=114149), but that is in the graveyard for a security flaw.
segwayon
10-19-2008, 03:01 AM
From the best of my ability, here's the text of his HTML he got from Google (from his post #9 on page 1, URL = http://forums.tinet.org/showthread.php?t=103). Try to paste this into a posting on your server using the "GMAP" tags to see what you get. All that comes back for me a map of Spain centered on Madrid, and again with the Google headers at the top, not just a map. API key issue perhaps?
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.es/maps/ms?ie=UTF8&hl=ca&t=h&msa=0&msid=104139708205298078 957.00043d251afa29cec95f2&ll=29.609115,50.196534&s pn=43.744536,100.744629&output=embed&s=AARTsJobPyL WsaJC_-0NDWUE45MwMMe4mQ"></iframe><br /><small><a href="http://maps.google.es/maps/ms?ie=UTF8&hl=ca&t=h&msa=0&msid=104139708205298078 957.00043d251afa29cec95f2&ll=29.609115,50.196534&s pn=43.744536,100.744629&source=embed" style="color:#0000FF;text-align:left">Mostra un mapa m?s gran</a></small>
MrEyes
10-19-2008, 06:56 PM
I have been running this mod for a few days and not found any of the issues that other people are describing. So here is some information that may or may not help other mod users:
1) The Google Maps API key is irrelevant to this mod and is a red herring
2) You have to get the code to embed from:
http://maps.google.com
Looking at the bbcode it seems that other Google domains (i.e. .es may work but I have not try this)
3) For my users I have created an FAQ that details exactly how to use the mod, see here for that:
http://www.therevcounter.com/faq/24169-faq-adding-google-wikiloc-maps-your-threads-posts.html
4) This is how I have the bbcode configured:
Title:
Google Map
BB Code Tag Name:
gmap
Replacement Code:
<script type="text/javascript">
function checkURL()
{
if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
if (url.indexOf('"')>=0) {return false;}
if (url.indexOf("http://maps.google")!=0){return false;}
return true
}
tot='{param}';
tot=tot.substr(tot.indexOf("src="")+10,tot.length);
url=tot.substr(0,tot.indexOf("""));
urlp=url.replace(/;amp;/g,';');
url=urlp;
if (checkURL())
{
document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'"></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>
Example
iframe code
Description:
Embeds Google maps into posts. To use this find the map you want on Google Maps, click the link icon and select all text that is in the "Paste HTML to embed in website" section. Then paste into the post surround by
Use {option}:
No
Button Image (Optional)
I didn't define one, you can if you want
Remove Tag If Empty
Disable BB Code Within This BB Code
Disable Smilies Within This BB Code
Disable Word Wrapping Within This BB Code
All yes
segwayon
10-19-2008, 11:00 PM
I have been running this mod for a few days and not found any of the issues that other people are describing. So here is some information that may or may not help other mod users:
1) The Google Maps API key is irrelevant to this mod and is a red herring
2) You have to get the code to embed from:
http://maps.google.com
Looking at the bbcode it seems that other Google domains (i.e. .es may work but I have not try this)
3) For my users I have created an FAQ that details exactly how to use the mod, see here for that:
http://www.therevcounter.com/faq/24169-faq-adding-google-wikiloc-maps-your-threads-posts.html
4) This is how I have the bbcode configured:
Title:
Google Map
BB Code Tag Name:
<script type="text/javascript">
function checkURL()
{
if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
if (url.indexOf('"')>=0) {return false;}
if (url.indexOf("http://maps.google")!=0){return false;}
return true
}
tot='{param}';
tot=tot.substr(tot.indexOf("src="")+10,tot.length);
url=tot.substr(0,tot.indexOf("""));
urlp=url.replace(/;amp;/g,';');
url=urlp;
if (checkURL())
{
document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'"></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>
Example
iframe code
Description:
Embeds Google maps into posts. To use this find the map you want on Google Maps, click the link icon and select all text that is in the "Paste HTML to embed in website" section. Then paste into the post surround by
Use {option}:
No
Button Image (Optional)
I didn't define one, you can if you want
Remove Tag If Empty
Disable BB Code Within This BB Code
Disable Smilies Within This BB Code
Disable Word Wrapping Within This BB Code
All yes
Wow, it works now. All that was different before were the yes/no options in the BB code setup. Thanks, MrEyes!!
Thanks Mr Eyes,
I forgot to tell how to tune the other settings for the BBCode...
I'll update the main entrance.
I have'nt any API key or similar, this works using the embed option that google offers.
To the users having problems, please set the settings for the BBCode as follows:
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
And then let me know if your problems persist...
For those having the Permission problems, test the above solution, and if the problem persists, could you do an "View source" and then paste the code for the tot variable here?
You can find : tot='
And then paste here the whole line...
Thanks
I get the error "Wrong Map URL....."
map link code is:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?hl=en&ie=UTF8&msa=0&msid=107862149087073613526. 00044b7d4c1dc31d40e5d&t=h&ll=53.384826,-1.69503&spn=5.158155,2.562814&output=embed&s=AARTs JolE0Pef8rEmKk2Gs9h4BwtXXwYlQ"></iframe><br /><small><a href="http://maps.google.com/maps/ms?hl=en&ie=UTF8&msa=0&msid=107862149087073613526. 00044b7d4c1dc31d40e5d&t=h&ll=53.384826,-1.69503&spn=5.158155,2.562814&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>
The tot= lines from "View Source" are:
tot='<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?hl=en&ie=UTF8&msa=0&msid=107862149087073613526. 00044b7d4c1dc31d40e5d&t=h&ll=53.384826,-1.69503&spn=5.158155,2.562814&output=embed&s=AARTs JolE0Pef8rEmKk2Gs9h4BwtXXwYlQ"></iframe><br /><small><a href="http://maps.google.com/maps/ms?hl=en&ie=UTF8&msa=0&msid=107862149087073613526. 00044b7d4c1dc31d40e5d&t=h&ll=53.384826,-1.69503&spn=5.158155,2.562814&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>';
tot=tot.substr(tot.indexOf("src="")+10,tot.length);
I embed the exact same google link code into an HTML-enabled post I get the "Permissions..." error mentioned above.
It works for me... :confused:
I'm gone here:
http://maps.google.com/maps/ms?hl=en&ie=UTF8&msa=0&msid=107862149087073613526.00044b7d4c1dc31d40e5d&t=h
Clicked on the link button, and copied the content from the field: Paste HTML to embed in website
then I've pasted the content inside the
Please enter the BBCode definition for gmap and check these values are like here:
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
If public, let me see your test page...
Leo Brazil
10-20-2008, 11:15 AM
I've got running OK now. This is so cool !!!
Just one small thing, does someone here knows an instrution to include on the code to remove the hyperlinks from Google Maps 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.
Tks
It works for me... :confused:
I'm gone here:
http://maps.google.com/maps/ms?hl=en&ie=UTF8&msa=0&msid=107862149087073613526.00044b7d4c1dc31d40e5d&t=h
Clicked on the link button, and copied the content from the field: Paste HTML to embed in website
then I've pasted the content inside the
Please enter the BBCode definition for gmap and check these values are like here:
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
If public, let me see your test page...
I've set up a simple page that has the gmap code embedded with the Google map code HERE (http://www.vbhov.cirtech.co.uk/map.html) - sorry, my web programming skills aren't up to working out why it isn't recognising the URL :confused:
And you have edited the BBCode to set the values as I said??
Please, verify it, and tell me, I think that there could be a workaround, but I think the solution is on setting those values right.
AndyA
10-21-2008, 10:09 AM
It works great, shame it can't embed a route too. Thanks for the code. :)
Who said no routes??
Check it: http://forums.tinet.org/showthread.php?t=103
Create your route and store it, and then click on the Link button and paste as in the examples...
AndyA
10-21-2008, 10:29 AM
Whoops, error on my behalf. It does show routes . . . I must have done something wrong. :)
AndyA
10-21-2008, 10:45 AM
Edit, answer found.
Leo Brazil
10-21-2008, 12:08 PM
I've set up a simple page that has the gmap code embedded with the Google map code HERE (http://www.vbhov.cirtech.co.uk/map.html) - sorry, my web programming skills aren't up to working out why it isn't recognising the URL :confused:
Just a tip, this BB Code doesn't work with Google Maps URL, it does work only with the HTML links with the Iframe instruction.
segwayon
10-21-2008, 01:49 PM
Who said no routes??
Check it: http://forums.tinet.org/showthread.php?t=103
Create your route and store it, and then click on the Link button and paste as in the examples...
Any pointers on how to create a route in Google Maps? Great mod, oasi!
And you have edited the BBCode to set the values as I said??
Please, verify it, and tell me, I think that there could be a workaround, but I think the solution is on setting those values right.
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 (http://www.vbhov.cirtech.co.uk/map.html) 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 (http://www.vbhov.cirtech.co.uk/mapnew.html) 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 :)
Another little vBulletin quirk is that any HTML code added to a post stays there even if your turn off "Allow HTML" in the forum properties. Handy if you want to add an HTML content post to a normally non-HTML forum!
Many Thanks for your additional BB-Code-Info!
It works!!! :)
Leo Brazil
10-21-2008, 05:00 PM
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 (http://www.vbhov.cirtech.co.uk/map.html) 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 (http://www.vbhov.cirtech.co.uk/mapnew.html) 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.
Just one small thing, does someone here knows an instrution to include on the code to remove the hyperlinks from Google Maps 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. :confused:
mycitylive
10-22-2008, 04:28 AM
Hallo please Help me i habe problem the google map
Error Message:
Wrong map URL, edit the post to change it.
Reload the page when finished to check if correct.
MrEyes
10-22-2008, 08:33 AM
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][noparse] tags, this breaks the bbcode.
They need to change to the standard editor
mycitylive
10-22-2008, 09:37 AM
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.
Would be great thank you
Leo Brazil
10-22-2008, 12:57 PM
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][noparse] tags, this breaks the bbcode.
They need to change to the standard editor
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 Google Maps 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 Google Maps 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
Leo Brazil
10-22-2008, 03:23 PM
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 Google maps 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.
mycitylive
10-23-2008, 06:32 AM
None has a solution for the problem?
Because one knows another similar addon BBCode?
About an answer I would be very happy!
Thank you in advance for the sometimes painful.
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
Leo Brazil
10-24-2008, 11:28 AM
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:
I'm not been able to reproduce the link stuff you mentioned, but This version could solve this stuff and the related with the &
Please, try it and let me know...
<script type="text/javascript">
function checkURL()
{
if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
if (url.indexOf('"')>=0) {return false;}
if (url.indexOf("http://maps.google")!=0){return false;}
return true
}
tot='';
tot_ini='{param}';
tot_no_amp=tot_ini.replace(/&/g,'&');
tot_no_quo=tot_no_amp.replace(/"/g,'"');
tot=tot_no_quo.substr(tot_no_quo.indexOf('marginwi dth="0" src="')+21,tot_no_quo.length);
url=tot.substr(0,tot.indexOf('"'));
urlp=url.replace(/amp;/g,'');
url=urlp;
if (checkURL())
{
document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'"></iframe>');
}
else
{
document.write("<p><b>WRONG URL</b></p>Recorda que cal enganxar el contingut del camp que indica que es per enganxar en una web.<br />Un cop arreglat el post, has de recarregar la plana per poder veure si ha funcionat.");
}
</script>
If this fails, and the error message appears, please view source on the document and paste here the value for the variable tot_ini ( Right click on document, View source, search tot_ini)
Thanks
Leo Brazil
10-24-2008, 05:42 PM
Hi oasi,
Nothing changed so far, let's see.
This is the link I'm using for tests already with gmap tags
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&hl=pt-BR&q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&ie=UTF8&cd=1&geocode=FdJhmP4de304_Q&ll =-23.558323,-46.62529&spn=0.036583,0.054932&z=14&iwloc=addr&out put=embed&s=AARTsJrSb_gFa1Ssu_1wwOFTDbl5gJKezg"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&hl=pt-BR&q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&ie=UTF8&cd=1&geocode=FdJhmP4de304_Q&ll =-23.558323,-46.62529&spn=0.036583,0.054932&z=14&iwloc=addr&sou rce=embed" style="color:#0000FF;text-align:left">Exibir mapa ampliado</a></small>
And this is the source code of my page after I post it.
<!-- message -->
<div id="post_message_26"><font face="Arial"><font size="2"><script type="text/javascript">
function checkURL()
{
if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
if (url.indexOf('"')>=0) {return false;}
if (url.indexOf("http://maps.google")!=0){return false;}
return true
}
tot='';
tot_ini='<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="[url="http://maps.google.com/maps?f=q&amp;hl=pt-BR&amp;q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&amp;ie=UTF8&amp;cd=1&amp;geocode=FdJhm P4de304_Q&amp;ll=-23.558323,-46.62529&amp;spn=0.036583,0.054932&amp;z=14&amp;iw loc=addr&amp;output=embed&amp;s=AARTsJrSb_gFa1Ssu_ 1wwOFTDbl5gJKezg"></iframe><br"][color=#0000ff]http://maps.google.com/maps?f=q&amp;hl=pt-BR&amp;q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&amp;ie=UTF8&amp;cd=1&amp;geocode=FdJhm P4de304_Q&amp;ll=-23.558323,-46.62529&amp;spn=0.036583,0.054932&amp;z=14&amp;iw loc=addr&amp;output=embed&amp;s=AARTsJrSb_gFa1Ssu_ 1wwOFTDbl5gJKezg"></iframe><br[/color][/url] /><small><a href="[url="http://maps.google.com/maps?f=q&amp;hl=pt-BR&amp;q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&amp;ie=UTF8&amp;cd=1&amp;geocode=FdJhm P4de304_Q&amp;ll=-23.558323,-46.62529&amp;spn=0.036583,0.054932&amp;z=14&amp;iw loc=addr&amp;source=embed"][color=#0000ff]http://maps.google.com/maps?f=q&amp;hl=pt-BR&amp;q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&amp;ie=UTF8&amp;cd=1&amp;geocode=FdJhm P4de304_Q&amp;ll=-23.558323,-46.62529&amp;spn=0.036583,0.054932&amp;z=14&amp;iw loc=addr&amp;source=embed[/color][/url]" style="color:#0000FF;text-align:left">Exibir mapa ampliado</a></small>';
tot_no_amp=tot_ini.replace(/&/g,'&');
tot_no_quo=tot_no_amp.replace(/"/g,'"');
tot=tot_no_quo.substr(tot_no_quo.indexOf('marginwi dth="0" src="')+21,tot_no_quo.length);
url=tot.substr(0,tot.indexOf('"'));
urlp=url.replace(/amp;/g,'');
url=urlp;
if (checkURL())
{
document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'"></iframe>');
}
else
{
document.write("<p><b>WRONG URL</b></p>Recorda que cal enganxar el contingut del camp que indica que es per enganxar en una web.<br />Un cop arreglat el post, has de recarregar la plana per poder veure si ha funcionat.");
}
</script></font></font></div>
<!-- / message -->
The problem is I must use WYSIWYG editor on my board and when I paste the Google Maps links the editor parses a lot of thing with braking the pure link itself.
MediaHound
10-24-2008, 07:17 PM
Subscribing to thread, this is a wonderful hack, hope the "Wrong map URL, edit the post to change it." errors get fixed as that's a problem for me as well.
tintin74
10-24-2008, 08:14 PM
First of all a big thank you to Oasi for studing on this very useful mod. I'm search for it for a long time!
I've tried to embed several Google maps without any problem but now I want to embed this kind of map , but I've had negative result.
This is the web page from where I have take the iframe link:
http://maps.google.com/maps?f=d&saddr=Bagolino+BS&daddr=darfo+boario+to:endine+to:Frazione+Rigosa%2F SP28+to:san+pellegrino+terme+to:sant%27omobono+ima gna+to:valcava+to:Como+CO&hl=it&geocode=%3B%3B%3BFR7ougId7q6UAA%3B%3B%3B%3B&mra=ls&via=3&sll=45.702343,9.813538&sspn=0.895773,1.757813&ie=UTF8&ll=45.844108,9.775085&spn=0.893499,1.757813&t=p&z=9
As you could see, it doesn't work.
Could you solve also this issue, please?
Thank you
Regards
Tintin
Ok, now I see the error :D
Please, test this code (this is going to fix the tintin74 problem too) and tell if it works to upgrade the "release"
The damn code BBCode don't seems to work... :mad:
<script type="text/javascript">
function checkURL()
{
if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
if (url.indexOf('"')>=0) {return false;}
if (url.indexOf("http://maps.google")!=0){return false;}
return true
}
tot='';
tot_ini="{param}";
tot_no_quo=tot_ini.replace(/"/g,'"');
if(tot_no_quo.indexOf("[url=")>0)
{ tot=tot_no_quo.substr(tot_no_quo.indexOf('[url="')+6,tot_no_quo.length);}
else
{ tot=tot_no_quo.substr(tot_no_quo.indexOf('src="')+5,tot_no_quo.length);}
url=tot.substr(0,tot.indexOf('"'));
urlp=url.replace(/amp;/g,'');
url=urlp;
if (checkURL())
{
document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'"></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>
tintin74
10-27-2008, 07:22 AM
Yeeeeessss! Thank you very much , Oasi!
segwayon
10-27-2008, 08:37 AM
Ok, now I see the error :D
Please, test this code (this is going to fix the tintin74 problem too) and tell if it works to upgrade the "release"
The damn code BBCode don't seems to work... :mad:
I get the "Wrong map URL, edit the post to change it." message with the 1.0 script, and nothing gets rendered with this one.
Please, could you paste the generated code for your page, as LeoBrazil did, or paste an example URL?
If I can see the value for the tot_ini variable I would be able to figure what's wrong...
Leo Brazil
10-27-2008, 10:26 AM
With the new code I've got double error messages.
Here is what I've got from the source code. I'm still using the same link from Google maps for tests.
<!-- message -->
<div id="post_message_27"><font face="Arial"><script type="text/javascript">
function checkURL()
{
if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
if (url.indexOf('"')>=0) {return false;}
if (url.indexOf("http://maps.google")!=0){return false;}
return true
}
tot='';
tot_ini="<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="";
tot_no_quo=tot_ini.replace(/"/g,'"');
if(tot_no_quo.indexOf("http://maps.google.com/maps?f=q&amp;hl=pt-BR&amp;q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&amp;ie=UTF8&amp;cd=1&amp;geocode=FdJhm P4de304_Q&amp; ll=-23.558323,-46.62529&amp;spn=0.036583,0.054932&amp;z=14&amp;iw loc=addr&amp;o utput=embed&amp;s=AARTsJrSb_gFa1Ssu_1wwOFTDbl5gJKe zg"></iframe><br (")>0)
{ tot=tot_no_quo.substr(tot_no_quo.indexOf('[url="')+6,tot_no_quo.length);}
else
{ tot=tot_no_quo.substr(tot_no_quo.indexOf('src="')+5,tot_no_quo.length);}
url=tot.substr(0,tot.indexOf('"'));
urlp=url.replace(/amp;/g,'');
url=urlp;
if (checkURL())
{
document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'"></iframe>');
}
else
{
document.write("<p><b>Endereço errado do Mapa, edite seu post para alterá-lo.</b></p>Recarregue a página quando verificar que está correto.");
}
</script></font><script type="text/javascript">
function checkURL()
{
if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
if (url.indexOf('"')>=0) {return false;}
if (url.indexOf("http://maps.google")!=0){return false;}
return true
}
tot='';
tot_ini="[url="http://maps.google.com/maps?f=q&amp;hl=pt-BR&amp;q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&amp;ie=UTF8&amp;cd=1&amp;geocode=FdJhm P4de304_Q&amp; ll=-23.558323,-46.62529&amp;spn=0.036583,0.054932&amp;z=14&amp;iw loc=addr&amp;o utput=embed&amp;s=AARTsJrSb_gFa1Ssu_1wwOFTDbl5gJKe zg"></iframe><br") /><small><a href="http://maps.google.com/maps?f=q&amp;hl=pt-BR&amp;q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&amp;ie=UTF8&amp;cd=1&amp;geocode=FdJhm P4de304_Q&amp; ll=-23.558323,-46.62529&amp;spn=0.036583,0.054932&amp;z=14&amp;iw loc=addr&amp;s ource=embed ("http://maps.google.com/maps?f=q&amp;hl=pt-BR&amp;q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&amp;ie=UTF8&amp;cd=1&amp;geocode=FdJhm P4de304_Q&amp; ll=-23.558323,-46.62529&amp;spn=0.036583,0.054932&amp;z=14&amp;iw loc=addr&amp;s ource=embed")" style="color:#0000FF;text-align:left">Exibir mapa ampliado</a></small>";
tot_no_quo=tot_ini.replace(/"/g,'"');
if(tot_no_quo.indexOf("[url=")>0)
{ tot=tot_no_quo.substr(tot_no_quo.indexOf('[url="')+6,tot_no_quo.length);}
else
{ tot=tot_no_quo.substr(tot_no_quo.indexOf('src="')+5,tot_no_quo.length);}
url=tot.substr(0,tot.indexOf('"'));
urlp=url.replace(/amp;/g,'');
url=urlp;
if (checkURL())
{
document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'"></iframe>');
}
else
{
document.write("<p><b>Endereço errado do Mapa, edite seu post para alterá-lo.</b></p>Recarregue a página quando verificar que está correto.");
}
</script></div>
<!-- / message -->
Leo
You have to set the option "Disable BB Code Within This BB Code" to yes when you add the gmap code...
I think the problem is that gmap takes as parameter {param} all the content you put between and , but if the url BBcode is also between and other different {param} value is appeared and the gmap addon can't catch the value for the iframe, and the content appears 2 times, but without a valid value.
There is no workaround with this I fear ...
Despite of this, in my forums I use the WYSIWYG editor and I'm not having all these weird problems, I don't figure how this is happening if you verified those values
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
Leo Brazil
10-28-2008, 12:21 PM
Leo
You have to set the option "Disable BB Code Within This BB Code" to yes when you add the gmap code...
100% sure this is correct and I'm using this in my test forum without plugins installed.
I think the problem is that gmap takes as parameter {param} all the content you put between and , but if the url BBcode is also between and other different {param} value is appeared and the gmap addon can't catch the value for the iframe, and the content appears 2 times, but without a valid value.
If try to post the Google link directly it gaves me an error, if I edit the post I can see what happens with the link. All tags were included in it as below. I wrapped with HTML tags otherwise the editor would parse the link and you woundn't get what really happens. Check the tags that appears on the Google Link.
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&hl=pt-BR&q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&ie=UTF8&cd=1&geocode=FdJhmP4de304_Q&ll =-23.558323,-46.62529&spn=0.036583,0.054932&z=14&iwloc=addr&out put=embed&s=AARTsJrSb_gFa1Ssu_1wwOFTDbl5gJKezg"></iframe><br (http://maps.google.com/maps?f=q&hl=pt-BR&q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&ie=UTF8&cd=1&geocode=FdJhmP4de304_Q&ll =-23.558323,-46.62529&spn=0.036583,0.054932&z=14&iwloc=addr&out put=embed&s=AARTsJrSb_gFa1Ssu_1wwOFTDbl5gJKezg"></iframe><br) /><small><a href="http://maps.google.com/maps?f=q&hl=pt-BR&q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&ie=UTF8&cd=1&geocode=FdJhmP4de304_Q&ll =-23.558323,-46.62529&spn=0.036583,0.054932&z=14&iwloc=addr&sou rce=embed (http://maps.google.com/maps?f=q&hl=pt-BR&q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&ie=UTF8&cd=1&geocode=FdJhmP4de304_Q&ll =-23.558323,-46.62529&spn=0.036583,0.054932&z=14&iwloc=addr&sou rce=embed)" style="color:#0000FF;text-align:left">Exibir mapa ampliado</a></small>
Despite of this, in my forums I use the WYSIWYG editor and I'm not having all these weird problems, I don't figure how this is happening if you verified those values
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
That's exactly what I have here since the beginning.
I tought with Disable BB Code Within This BB Code -> Yes - I would never had what I'm getting on the example I gave above. You can still see com BB Codes on it. Weird huh ?
And these BBcode tags are added automatically??
src="[/gmap][gmap]
Tomorrow I'll try to solve it. The solution is going to add extra+unuseful code to the html, but I think it can work...
Leo Brazil
10-28-2008, 02:25 PM
Yes, did you notice those in the middle, right ?
They were placed there buy the editor automaticaly, just after I clicked preveiw post.
Weird ? Yes, but I found why. The link I'm using as an example I placed on Microsoft Word File because I use to keep a file on WORD of all mods I like and use just to make my life easier to organize and for upgrades, check diferences. Same as I did with yours, visually nothing chances but I think WORD uses weird HTML or something the scroll this up. I did that as I was using exactly the same link for several tests it's faster than going to Google and check for the same link all the time, you know.
But now I just copy/paste directly from Google and this was what I've got:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&hl=pt-BR&q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&sll=37.0625,-95.677068&sspn=32.38984,56.25&ie=UTF8&cd=1&geocode =FdJhmP4de304_Q&ll=-23.558323,-46.62529&spn=0.036583,0.054932&z=14&g=Liberdade,+S %C3%A3o+Paulo+-+SP,+Brasil&iwloc=addr&output=embed&s=AARTsJpM49-sTq_lIb07cjYCRnPUSvYXwA"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&hl=pt-BR&q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&sll=37.0625,-95.677068&sspn=32.38984,56.25&ie=UTF8&cd=1&geocode =FdJhmP4de304_Q&ll=-23.558323,-46.62529&spn=0.036583,0.054932&z=14&g=Liberdade,+S %C3%A3o+Paulo+-+SP,+Brasil&iwloc=addr&source=embed" style="color:#0000FF;text-align:left">Exibir mapa ampliado</a></small>
You'll see those between the link were gone but a lot of tags still remains the same and conparing the raw link with the this one those tags are causing this errors.
Sorry bugging you around with all those long posts I'm just trying to be usefull.
Ok,
I think this has to work...
<script type="text/javascript">
function checkURL()
{
if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
if (url.indexOf('"')>=0) {return false;}
if (url.indexOf("http://maps.google")!=0){return false;}
return true
}
tot='';
tot_ini="{param}";
tot_no_quo=tot_ini.replace(/"/g,'"');
if(tot_no_quo.indexOf("[url")>0)
{ //The URL affaire...
if(tot_no_quo.indexOf('[url="')>0) {tot=tot_no_quo.substr(tot_no_quo.indexOf('[url="')+6,tot_no_quo.length);tot_no_quo='';}
if(tot_no_quo.indexOf('[url=')>0) {tot=tot_no_quo.substr(tot_no_quo.indexOf('[url=')+5,tot_no_quo.length);tot_no_quo='';a=tot.re place(/\]/g,'"');tot=a;}
if(tot_no_quo.indexOf('[url]')>0) {tot=tot_no_quo.substr(tot_no_quo.indexOf('[url]')+5,tot_no_quo.length);a=tot.replace(/\[/g,'"');tot=a;}
}
else
{ tot=tot_no_quo.substr(tot_no_quo.indexOf('src="')+5,tot_no_quo.length);}
url=tot.substr(0,tot.indexOf('"'));
urlp=url.replace(/amp;/g,'');
url=urlp;
if (checkURL())
{
document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'"></iframe>');
}
else
{
document.write("<p><b>La URL que has passat per al mapa contenia errors, edita el post per arreglar-ho</b></p>Recorda que cal enganxar el contingut del camp que indica que es per enganxar en una web.<br />Un cop arreglat el post, has de recarregar la plana per poder veure si ha funcionat.");
}
</script>
Now I don't see the "wrong URL" error but see nothing displays. Nothing, no map nor error message.
Please, paste your tot_ini value here (view source for the page)...
Certainly!
Here is the code I used with [GMAP] tag:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&hl=pt-BR&q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&ie=UTF8&cd=1&geocode=FdJhmP4de304_Q&ll =-23.558323,-46.62529&spn=0.036583,0.054932&z=14&iwloc=addr&out put=embed& s=AARTsJrSb_gFa1Ssu_1wwOFTDbl5gJKezg"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&hl=pt-BR&q=Liberdade,+S%C3%A3o+Paulo+-+SP,+Brasil&ie=UTF8&cd=1&geocode=FdJhmP4de304_Q&ll =-23.558323,-46.62529&spn=0.036583,0.054932&z=14&iwloc=addr&sou rce=embed" style="color:#0000FF;text-align:left">Exibir mapa ampliado</a></small>
And here the source code of my page after posted:
<script type="text/javascript">
function checkURL()
{
if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
if (url.indexOf('"')>=0) {return false;}
if (url.indexOf("http://maps.google")!=0){return false;}
return true
}
tot='';
tot_ini="<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/?ie=UTF8&ll=40.84706,-98.448486&spn=2.576261,5.806274&z=8&output=embed&s =AARTsJqzARj-Z8VnW5pkPMLMmZbqrJcYpw"></iframe><br /><small><a href="http://maps.google.com/?ie=UTF8&ll=40.84706,-98.448486&spn=2.576261,5.806274&z=8&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>";
tot_no_quo=tot_ini.replace(/"/g,'"');
if(tot_no_quo.indexOf("[url")>0)
{ //The URL affaire...
if(tot_no_quo.indexOf('[url="')>0) {tot=tot_no_quo.substr(tot_no_quo.indexOf('[url="')+6,tot_no_quo.length);tot_no_quo='';}
if(tot_no_quo.indexOf('[url=')>0) {tot=tot_no_quo.substr(tot_no_quo.indexOf('[url=')+5,tot_no_quo.length);tot_no_quo='';a=tot.re place(/\]/g,'"');tot=a;}
if(tot_no_quo.indexOf('[url]')>0) {tot=tot_no_quo.substr(tot_no_quo.indexOf('[url]')+5,tot_no_quo.length);a=tot.replace(/\[/g,'"');tot=a;}
}
else
{ tot=tot_no_quo.substr(tot_no_quo.indexOf('src="')+5,tot_no_quo.length);}
url=tot.substr(0,tot.indexOf('"'));
urlp=url.replace(/amp;/g,'');
url=urlp;
if (checkURL())
{
document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'"></iframe>');
}
else
{
document.write("<p><b>La URL que has passat per al mapa contenia errors, edita el post per arreglar-ho</b></p>Recorda que cal enganxar el contingut del camp que indica que es per enganxar en una web.<br />Un cop arreglat el post, has de recarregar la plana per poder veure si ha funcionat.");
}
</script>
FReeSTER
10-29-2008, 05:00 PM
Thank you for this BB code. Works great
dreamer81
10-29-2008, 07:23 PM
how do I use this? is there installation instructions somewhere?
Leo Brazil
10-29-2008, 07:27 PM
Ok,
I think this has to work...
Sorry but don't. I'm still getting the wrong URL and also all my previous posts that were working got the same wrong messages.
But worry, I wrote a very detailed instructions to my members and the first code published here is working fine with them. Just a pain to switch editor mode to do it but it's fine.
Tks.
Nadeemjp
10-30-2008, 06:25 AM
I have been running this mod for a few days and not found any of the issues that other people are describing. So here is some information that may or may not help other mod users:
1) The Google Maps API key is irrelevant to this mod and is a red herring
2) You have to get the code to embed from:
http://maps.google.com
Looking at the bbcode it seems that other Google domains (i.e. .es may work but I have not try this)
3) For my users I have created an FAQ that details exactly how to use the mod, see here for that:
http://www.therevcounter.com/faq/24169-faq-adding-google-wikiloc-maps-your-threads-posts.html
4) This is how I have the bbcode configured:
Title:
Google Map
BB Code Tag Name:
gmap
Replacement Code:
<script type="text/javascript">
function checkURL()
{
if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
if (url.indexOf('"')>=0) {return false;}
if (url.indexOf("http://maps.google")!=0){return false;}
return true
}
tot='{param}';
tot=tot.substr(tot.indexOf("src="")+10,tot.length);
url=tot.substr(0,tot.indexOf("""));
urlp=url.replace(/;amp;/g,';');
url=urlp;
if (checkURL())
{
document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'"></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>
Example
iframe code
Description:
Embeds Google maps into posts. To use this find the map you want on Google Maps, click the link icon and select all text that is in the "Paste HTML to embed in website" section. Then paste into the post surround by
Use {option}:
No
Button Image (Optional)
I didn't define one, you can if you want
Remove Tag If Empty
Disable BB Code Within This BB Code
Disable Smilies Within This BB Code
Disable Word Wrapping Within This BB Code
All yes
itried the above mentioned and i got the following error!
Wrong map URL, edit the post to change it.
Reload the page when finished to check if correct.
any clues?
Ooooohhh!!
Finally I've been able to reproduce this!!
I'm using the advanced Browser Firefox, so despite of using the WYSIWYG editor I wasn't having this problem...
Now I've been testing and I'm have a solution, I have to do some more testing, but tomorrow I'll post the new version.
Thanks all for your patience :D
Leo Brazil
10-30-2008, 02:29 PM
That's correct oasi, my bad in not informing you about it. But it only happens if you're using IE.
Not at all, thank you for your patience and support.
@oasi : take your time, we can wait! :)
Thanks so much!
Nadeemjp
10-31-2008, 04:46 AM
i seee........ok oasi hope you can fix it:) waiting for your updated xml file:)
Ok, I upgraded the code (first post on each page).
Please, test it and tell me if it works now...
I've tested on Explorer and Firefox and seems to run for me...
Please, mark as installed if you use it...
It still does not work with my board :(
The maps link:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&hl=en&geocode=&q=Singapore&sll=40.446947,-86.923828&sspn=0.040497,0.090723&ie=UTF8&ll=1.3520 83,103.819836&spn=0.0532,0.090723&z=14&output=embe d&s=AARTsJqkLJNXPDqzeV-2S6QWBWQf58w4dg"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&hl=en&geocode=&q=Singapore&sll=40.446947,-86.923828&sspn=0.040497,0.090723&ie=UTF8&ll=1.3520 83,103.819836&spn=0.0532,0.090723&z=14&source=embe d" style="color:#0000FF;text-align:left">View Larger Map</a></small>
And the page source 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="<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&hl=en&geocode=&q=Singapore&sll=40.446947,-86.923828&sspn=0.040497,0.090723&ie=UTF8&ll=1.3520 83,103.819836&spn=0.0532,0.090723&z=14&output=embe d&s=AARTsJqkLJNXPDqzeV-2S6QWBWQf58w4dg"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&hl=en&geocode=&q=Singapore&sll=40.446947,-86.923828&sspn=0.040497,0.090723&ie=UTF8&ll=1.3520 83,103.819836&spn=0.0532,0.090723&z=14&source=embe d" style="color:#0000FF;text-align:left">View Larger Map</a></small>";
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.l ength);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>
Please help us look into it to see what's possibly wrong.
Thankssss!
I don't know why your gmap pasted code isn't chaged to html chars...
" should be "
< should ve <
An easy "fix" would be to change this line in the code:
t_i="{param}";
to
t_i='{param}';
But if could fail if there is some ' char into the code of the map...
Try it...
I don't know why your gmap pasted code isn't chaged to html chars...
" should be "
< should ve <
An easy "fix" would be to change this line in the code:
t_i="{param}";
to
t_i='{param}';
But if could fail if there is some ' char into the code of the map...
Try it...Oh, I tried with what you suggested and it works now.
So at least it works for my system. But as your concern, it might not be stable. Please help me to find what could be the reason that let my system not identical with yours.
Thanks so much!
Leo Brazil
11-03-2008, 10:58 AM
It' works great for me now !!
Thank you oasi, MOTM for sure.
Leo Brazil
11-04-2008, 01:41 PM
Oasi, after giving you some headaches to fix it and now that's is working great....
....I was thinking to my self yeasterday....How about to improve this BBCode or even a new one ? I mean, how about to include Google Earth on it ?
Just an idea...lol...
mattcaswell
11-15-2008, 03:34 PM
I don't know why your gmap pasted code isn't chaged to html chars...
" should be "
< should ve <
An easy "fix" would be to change this line in the code:
t_i="{param}";
to
t_i='{param}';
But if could fail if there is some ' char into the code of the map...
Try it...
This was the only way I could get this to work on my system. Thanks for all your hard work!
matt
CThiessen
11-19-2008, 06:01 PM
Hi,
I head the following Problem .
If I test this BBCode in my "Admin Only" Part of the Forum everything was OK.
If I copied the Post to the Forum where I make Announcements it stops working.
Long time ago I set up this Forum with the Possibility of the use of HTML
this is not working together with this BBCode.
Just to let you know, maybe helps somebody if this is not running.
Best regards
Christian
aciurczak
11-20-2008, 06:32 PM
How does it confirm that it is a valid google maps code? Looking at the code, one of the checks seems to be that the URL starts with http://maps.google, and it also confirms that there isn't any other http:// within the code. But if someone posted something like http://maps.google.evildomain.com, would that fail this check or would it be approved?
->Christian,
Could you copy the generated code to see what's wrong?
->aciurczak
The check would fail with the URL you posted, I know that this is not perfect :P
If you try to get a better security check for this please post it here to share it with us.
Thanks!
aciurczak
11-24-2008, 06:22 AM
The check would fail with the URL you posted, I know that this is not perfect :P
If you try to get a better security check for this please post it here to share it with us.
Hi Oasi -
I changed that check to:
if (u.indexOf("http://maps.google.com/")!=0){return false;}
so the code has to include http://maps.google.com/, not just http://maps.google . Still not perfect, but a little better.
I hope all your users come from the US or UK ;-)
What about
http://maps.google.it/
http://maps.google.es/
http://maps.google.de/
If all of your users use the .com domain to insert the maps, it's a very valid solution...
Other option would be to check that after the http://maps.google. there are as maximum 4/5 characters, so only a domain could be included, or set an array of valid domains to check that the rest of the URL is one of the domains allowed.
aciurczak
11-24-2008, 07:20 AM
I hope all your users come from the US or UK ;-)
I'm not worried about anything but .com yet. It will cover 95% of my users, and likely 100% of my users who would be prone to embedding a map. As soon as one of my users tries embedding a google map from a non .com address and runs into a problem, I'll deal with it then.
Also, even if the map or route is not in the US or UK, you can still use maps.google.com to map it or route it. Here's an example route (http://maps.google.com/maps?f=d&saddr=berlin,+germany&daddr=paris,+france&hl=en&geocode=&mra=ls&sll=37.0625,-95.677068&sspn=50.51141,113.90625&ie=UTF8&z=7) from Berlin to Paris using maps.google.com. Yes, it's in English, but it still works fine.
zelnik
11-25-2008, 01:00 PM
Great little code... two questions.
1> Is there a way of adding the directions to the map or a automatic link?
2> Why when i zoom into a map to the highest point can I not use the embed code?
Thanks marked as installed.
1> Is there a way of adding the directions to the map or a automatic link?
I'm not suere if it's that you're asking, but you can add directions, routes or whatever the google maps 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.
It's not possible to add the link, but you only have to add an html link below...
2> Why when i zoom into a map to the highest point can I not use the embed code?
I've been able to add maps with the StreetView inclusive, but it's true that some maps does'nt have the "link" option to add the code to a web or a direct link. You'll have to ask google why, I don't know the reason :(
zelnik
11-26-2008, 09:11 AM
I'm not suere if it's that you're asking, but you can add directions, routes or whatever the google maps 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.
Any help would be appreciated.
RAIDPTN
12-07-2008, 07:55 PM
Moltes gràcies oasi funciona perfectament.
fins una altra.
intruder
12-23-2008, 04:25 PM
Very nice addon.
I'll donate 10$ for a yahoo maps bb code.
bymetinay
02-06-2009, 05:38 PM
thanks perfect
I tried on my vb 3.6.8 and it doesn't work - need to pay for a vb update to get this to work I suppose? :(
mykkal
02-16-2009, 09:31 AM
Can someone make an XML and separate files for this? I don't want to make code changes unless necessary. I'd like to be able to uninstall it cleanly.
Sonyuserforum
02-16-2009, 11:34 AM
Can someone make an XML and separate files for this? I don't want to make code changes unless necessary. I'd like to be able to uninstall it cleanly.
You have to make a new custom BBCode. Please read carefully.
mykkal
02-16-2009, 11:54 AM
You have to make a new custom BBCode. Please read carefully.
Ok... Thanks.
inciarco
02-16-2009, 02:54 PM
Thank You For Sharing this BB Code. :up:
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.
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&source=s_q&hl=es&geocode=&q=burj+al+arab& sll=37.0625,-95.677068&sspn=25.20756,56.601563&ie=UTF8&ll=25.14 1149,55.185614&spn=0.006295,0.006295&t=h&output=em bed&s=AARTsJrQ_VeJ0vHH1hWqkq_CSvs8lI6h2A"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&source=embed&hl=es&geocode=&q=burj+al+ara b&sll=37.0625,-95.677068&sspn=25.20756,56.601563&ie=UTF8&ll=25.14 1149,55.185614&spn=0.006295,0.006295&t=h" style="color:#0000FF;text-align:left">Ver mapa m?s grande</a></small>
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 Google Maps 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)? :confused::confused::confused:
I obtained this by searching burj al arab on Google Maps and choosing/clicking on the first result.
My Best Regards.
:)
Vaupell
02-16-2009, 04:22 PM
Tx.. lovely mod.. Installed and voted.. yeah. ;)
senadxxx
02-16-2009, 11:47 PM
very good picture to google maps Enjoy
ozvr4com
02-28-2009, 12:57 AM
Got it working, and its ACE! Thanks!
Defkalion
03-20-2009, 09:36 AM
Very nice, installed.
Thankyou :)
BlueNinjaGo
03-20-2009, 01:39 PM
Awesome... works... thanks!
cellarius
04-21-2009, 07:04 AM
Works for me in all browsers (Firefox, Safari, Chrome, Opera) but in IE. In IE 7 and 8 I only get blank, white page inside the iframe. If I look at the source code of the iframe page, it seems to be there alright, but it displays as just plain white...
GeoMapia
04-23-2009, 01:56 PM
Works for me in all browsers (Firefox, Safari, Chrome, Opera) but in IE. In IE 7 and 8 I only get blank, white page inside the iframe. If I look at the source code of the iframe page, it seems to be there alright, but it displays as just plain white...
use this code:
<script type="text/javascript">
function checkURL()
{
if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
if (url.indexOf('"')>=0) {return false;}
if (url.indexOf("http://maps.google")!=0){return false;}
return true
}
tot='{param}';
tot=tot.substr(tot.indexOf("src="")+10,tot.length);
url=tot.substr(0,tot.indexOf("""));
urlp=url.replace(/;amp;/g,';');
url=urlp;
if (checkURL())
{
document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'"></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:
Title:
Google Map
Tag:
GMAP
Sample:
iframe code
Description:
Embeds Google maps into posts. To use this find the map you want on Google Maps, click the link icon and select all text that is in the "Paste HTML to embed in website" section. Then paste into the post surround by iframe code
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
and use this button on the message editor toolbar (16x16 Pixels | PNG transparent)
cellarius
04-26-2009, 07:07 AM
Whereas the Code in the Firstpost worked in all browsers but IE, the code by GeoMapia does not work for me at all.
spillage
05-16-2009, 08:16 PM
Are there any more revisions to this code?
I'm trying to get it to work on vB3.8, with little success.
I've tried each of the code examples and fixes posted here, and the best I get is for it to work in the BBCode test screen, but not in an actual post.
I noted that when I go back in to BBCode Manager to edit it, the "Example" code is cropped short of the full code originally pasted in that field, hence I never have a working example.
Any thoughts would be greatly appreciated.
THANK!
Sunka
05-16-2009, 11:32 PM
This is work for me in vBulletin v3.8.2
<script type="text/javascript">
function checkURL()
{
if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
if (url.indexOf('"')>=0) {return false;}
if (url.indexOf("http://maps.google")!=0){return false;}
return true
}
tot='{param}';
tot=tot.substr(tot.indexOf("src="")+10,tot.length);
url=tot.substr(0,tot.indexOf("""));
urlp=url.replace(/;amp;/g,';');
url=urlp;
if (checkURL())
{
document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'"></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>
spillage
05-17-2009, 01:14 PM
Thanks Sunka, that seems to initially work in the Test your BBCode area, but in an actual post I get the "Wrong map URL, edit the post to change it. Reload the page when finished to check if correct." error message.
On return to the BBCode Manager, and trying the Test your BBCode again, I also get the error there as well.
This is the sample map code used in all instances;
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/?ie=UTF8&ll=26.468114,-80.065699&spn=0.024625,0.028195&t=h&z=15&output=em bed"></iframe><br /><small><a href="http://maps.google.com/?ie=UTF8&ll=26.468114,-80.065699&spn=0.024625,0.028195&t=h&z=15&source=em bed" style="color:#0000FF;text-align:left">View Larger Map</a></small>
Also in the BBCode Manager window, the "Example" field doesn't work, as the code above gets trimmed when saved... and looks like this;
[gmap]<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="[URL]http://maps.google.com/?ie=UTF8&ll=26.468114,-80.065699&spn=0.024625,0.028195&a
Any further thoughts?
Sunka
05-18-2009, 06:48 AM
Hmmm.
On Google Maps, you choose LINK and then copy Paste HTML to embed in website
This is code for Zagreb on Google maps:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/?ie=UTF8&ll=45.786679,15.930176&spn=0.387841,0.839 081&t=h&z=10&output=embed"></iframe><br /><small><a href="http://maps.google.com/?ie=UTF8&ll=45.786679,15.930176&spn=0.387841,0.839 081&t=h&z=10&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>
If this code I use on my forum with [ gmap ] [ /gmap ] all is OK
Sportsriders
06-05-2009, 05:44 PM
I found the IE issue is related to this
{ document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+u+'"></iframe>');}
with this you can see the map but it messes with the php
{ document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+u+'"</iframe>');}
So it is a formatting in the above line in BOLD that is causing the IE issues. Not yet worked out what is the actual issue.
ricardoNJ
06-07-2009, 12:04 AM
Thanks a lot!!!!
Sportsriders
06-07-2009, 03:07 PM
Some more information
Internet Explored adds [URL] tags to the Google code and this causes the map not to
show. You see
"Wrong map URL, edit the post to change it. Reload the page when finished to check if correct."
You need to edit the [URL] tags out. Firefox and Chrome do not add these tags when
posting the Google code.
Sportsriders
06-07-2009, 03:32 PM
And more..................
If you can see WHITE where the map should be in IE, then Refreshing the page with the <REFRESH>
button will not cause the map to show. HOWEVER right clicking on where the map should be and selecting
REFRESH will cause the map to show.
I noticed that IE will show the map only the first time the page with the map is accessed. After that it will
not load the map the next time the page is loaded ( unless you use the above mentioned refresh ).
Sportsriders
06-07-2009, 03:48 PM
I wonder is someone with code experience could modify the script to detect if IE is the
browser and if so detected, refresh the frame twice and also remove any URL /URL
tags from betten the GAMP /GMAP tags.
Sportsriders
06-07-2009, 03:53 PM
This is work for me in vBulletin v3.8.2
<script type="text/javascript">
function checkURL()
{
if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
if (url.indexOf('"')>=0) {return false;}
if (url.indexOf("http://maps.google")!=0){return false;}
return true
}
tot='{param}';
tot=tot.substr(tot.indexOf("src="")+10,tot.length);
url=tot.substr(0,tot.indexOf("""));
urlp=url.replace(/;amp;/g,';');
url=urlp;
if (checkURL())
{
document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'"></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>
This worked for me when I used Firefox to do add the BBcode. But strangely, when I used
IE it did not work.
hytram
06-08-2009, 08:10 AM
thanks for great Mod..
It been working fine for a few weeks and today we have hit a glitch, I think its always been there but only showed up today
until now all [gmap] code has been in threads started by one of 2 Admins, members have replied with maps and they have showed up with no problems. Today a supermod posted a map in his own thread and it errored and didnt show up, Even if an Admin post a [gmap] in that thread it wouldnt show up. Cut and paste the same code into a Admin started thread, it works fine
doing the research on my forum, Admins have HTML turned on, no one else does, I dont want to turn it on if I can help it.
will turning HTML on for everyone but turn HTML code of be safe?
I will do some more testing, but I wont be near a puter for the next 24hr
any thoughts or ideas?
ta
Marty
Sportsriders
06-09-2009, 12:29 AM
thanks for great Mod..
until now all [gmap] code has been in threads started by one of 2 Admins, members have replied with maps and they have showed up with no problems. Today a supermod posted a map in his own thread and it errored and didnt show up, Even if an Admin post a [gmap] in that thread it wouldnt show up. Cut and paste the same code into a Admin started thread, it works fine
doing the research on my forum, Admins have HTML turned on, no one else does, I dont want to turn it on if I can help it.
will turning HTML on for everyone but turn HTML code of be safe?
I will do some more testing, but I wont be near a puter for the next 24hr
any thoughts or ideas?
ta
Marty
Every thing I have read suggests keep HTML turned off for the forums. I am admin on
my forum and I do not have HTML turned on and my users can post maps.
You should post up the error message.
hytram
06-09-2009, 11:28 AM
there is no error message, just nothing..blank
TRC-blurose
06-19-2009, 06:19 PM
Love this code...did not notice the glich with IE until I read the whole thread. This worked for me....
<script type="text/javascript">
function checkURL()
{
if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
if (url.indexOf('"')>=0) {return false;}
if (url.indexOf("http://maps.google")!=0){return false;}
return true
}
var browser=navigator.appName;
tot='{param}';
tot=tot.substr(tot.indexOf("src="")+10,tot.length);
url=tot.substr(0,tot.indexOf("""));
urlp=url.replace(/;amp;/g,';');
url=urlp;
if (checkURL())
{
document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url.replace(/\[url\]|\[\\url\]/gi,"")+'"></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 only change is in the document.write statement for iframe... changing +url+ to replace with a regular expression...no need to detect the browser since the replaced text does not exist when it is working.
url.replace(/\[url\]|\[\\url\]/gi,"")
I tried cleaning up the URL before the if statement but it kept failing. Adding the replace text directly in the document.write worked fine.
Enjoy.. :D
vithorius
07-08-2009, 04:01 PM
Ok, I've just "installed" this hack with success! (on a v3.6.12 board)
Thank you ALL so very much for taking the time to develop (and help the developer) of this fantastic 'little' BIG hack!
spillage
07-09-2009, 01:28 AM
...I tried cleaning up the URL before the if statement but it kept failing. Adding the replace text directly in the document.write worked fine.
Just when I thought there was hope for a fix...
This code works great in the Test area, but fails in a forum post.
(vB3.8.2)
Any further thoughts?
selene1
07-14-2009, 09:05 AM
Not work for me in vB 3.8.3
Ciao
TRC-blurose
07-20-2009, 05:01 AM
Just when I thought there was hope for a fix...
This code works great in the Test area, but fails in a forum post.
(vB3.8.2)
Any further thoughts?
No sorry, I have it working in both test and the main forum.
I will say the fix I did only works on new entries not old ones.
My forum is still in conversion testing...so you can't view it...
TRC-blurose
07-25-2009, 03:14 PM
Just a note I retested this morning with IE8 and had no issues.
Besure your using the Iframe code under the heading "Paste HTML to embed in website
" and not just the map link on the top.
crazycarl
07-30-2009, 11:44 PM
Installed it on mychinamoto.com (http://www.mychinamoto.com/) and it runs great so far. Much thanks to everyone who's helped put this together.
Seems to be more than a couple riders on this thread. Go figure... :cool:
Now am trying to figure out what is and is not embeddable according to Google... :confused:
Ride Safe, Have Fun
CrazyCarl
Kushty
08-30-2009, 10:07 AM
Great addon, thanks marked as installed and works fine on 3.8.3
One question, is it possible to add some code that will cause the link for directions to/from the point on the map to open in a new page/tab? At the moment if the find directions tab is clicked it loads in my forum tab.
thanks
Steve
Tommo224
09-02-2009, 02:29 AM
Took me a while to work out how to install it, didn't realise I had to go through "Add Custom BB Code"
Works beautifully, thank you :)
Feign
01-19-2010, 01:29 PM
See below.
Feign
01-19-2010, 01:47 PM
Wasn't working in 3.8.4 after a recent update.
Re-added the code and it's great now.
V8Owner
02-12-2010, 08:58 AM
I have installed and tested this in VB4 & it works fine :)
CThiessen
10-05-2010, 03:02 PM
Hi,
works fine with vB4 but not with vB4 and vBSEO 3.5.2
Change:
<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+u+'"></iframe>to
<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" rel="novbseo" src="'+u+'"></iframe>and it keeps working.
Greetings
Christian
tintin74
10-08-2010, 09:56 AM
Goood CThiessen, thank you!
Sunka
06-10-2012, 04:12 AM
Google link with https not working.
Anyone know what to change in code so Google link with SSL protocol works too?
Here is example Google link location on Google map with http and with https:
HTTPS
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q=45.811572,15.961533&num=1&t=h&ie=UTF8&z=10& ll=45.814912,15.978514&output=embed"></iframe><br /><small><a href="https://maps.google.com/maps?q=45.811572,15.961533&num=1&t=h&ie=UTF8&z=10& ll=45.814912,15.978514&source=embed" style="color:#0000FF;text-align:left">Prikaz veće karte</a></small>
HTTP
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.hr/maps?q=45.554449,16.295471&num=1&t=h&hl=hr&ie=UTF8 &z=10&ll=45.411948,16.408081&output=embed"></iframe><br /><small><a href="http://maps.google.hr/maps?q=45.554449,16.295471&num=1&t=h&hl=hr&ie=UTF8 &z=10&ll=45.411948,16.408081&source=embed" style="color:#0000FF;text-align:left">Prikaz veće karte</a></small>
Panosz
06-24-2012, 11:38 AM
It seems like something changed from the Google side of things and the map doesnt work anymore.
The old links (already posted ones) still works fine but if i request a new link from Google , it won't work.
Mellow
07-04-2012, 11:23 AM
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
to
[Gmap]<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f
and it will work, not sure what changes the BB code needs to work.
Mellow
07-04-2012, 02:06 PM
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.
Mellow
07-04-2012, 02:20 PM
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.
Sunka
07-07-2012, 10:13 AM
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.
Any help here is welcome.
JetLee
08-10-2012, 08:42 PM
Seeing as the developer hasn't been online since 2008, I'll post how I do Google maps...
AdminCP > Custom BB Codes > Add New BB Code
Title: Google Maps
BB Code Tag Name: map
Replacement:
<div align="center" style="margin: 5px 5px 5px 5px;">
<table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%">
<tr>
<td class="thead" style="text-align:center"><iframe width="100%" height="600" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?q={param}&ie=UTF8&hq={param}&t=h&output=embed"></iframe></td>
</tr>
</table>
</div>
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
Disable Automatic Link Parsing Within This BB Code: Yes
Use would be:
Sacramento, CA
Sacramento, CA to San Diego, CA
pig trail harley davidson
It works great for us. I also did a [chatmap] version that limits the size to 200px for use in the chatbox.
You can add "&iwloc=near" to the end of the src= code to disable the name bubble in the map. This is very helpful in my [chatmap] version due to its smaller iframe size.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.