vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   BB Code Enhancements - Google maps BBCode (https://vborg.vbsupport.ru/showthread.php?t=193760)

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....


Code:

<script type="text/javascript">
function checkURL()
  {
      if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
      if (url.indexOf('&quot')>=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=&quot;")+10,tot.length);
url=tot.substr(0,tot.indexOf("&quot;"));
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.

Code:

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

Quote:

Originally Posted by TRC-blurose (Post 1832839)
...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

Quote:

Originally Posted by spillage (Post 1845507)
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 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:
Code:

<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+u+'"></iframe>
to
Code:

<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
Code:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q=45.811572,15.961533&amp;num=1&amp;t=h&amp;ie=UTF8&amp;z=10&amp;ll=45.814912,15.978514&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com/maps?q=45.811572,15.961533&amp;num=1&amp;t=h&amp;ie=UTF8&amp;z=10&amp;ll=45.814912,15.978514&amp;source=embed" style="color:#0000FF;text-align:left">Prikaz veće karte</a></small>


HTTP
Code:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.hr/maps?q=45.554449,16.295471&amp;num=1&amp;t=h&amp;hl=hr&amp;ie=UTF8&amp;z=10&amp;ll=45.411948,16.408081&amp;output=embed"></iframe><br /><small><a href="http://maps.google.hr/maps?q=45.554449,16.295471&amp;num=1&amp;t=h&amp;hl=hr&amp;ie=UTF8&amp;z=10&amp;ll=45.411948,16.408081&amp;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:
Code:

<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:
[map]Sacramento, CA[/map]
[map]Sacramento, CA to San Diego, CA[/map]
[map]pig trail harley davidson[/map]

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.


All times are GMT. The time now is 02:15 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01359 seconds
  • Memory Usage 1,772KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (21)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete