Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Google maps BBCode Details »»
Google maps BBCode
Version: 1.1, by oasi oasi is offline
Developer Last Online: Dec 2008 Show Printable Version Email this Page

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(/&quot;/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.

Comments
  #72  
Old 10-30-2008, 06:25 AM
Nadeemjp Nadeemjp is offline
 
Join Date: Aug 2008
Location: Japan
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MrEyes View Post
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/241...ads-posts.html

4) This is how I have the bbcode configured:

Title:
Google Map

BB Code Tag Name:
gmap

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

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+'"></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
[gmap]iframe code[/gmap]

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 [gmap][/gmap]

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!

Quote:
Wrong map URL, edit the post to change it.

Reload the page when finished to check if correct.
any clues?
Reply With Quote
  #73  
Old 10-30-2008, 12:59 PM
oasi oasi is offline
 
Join Date: Mar 2008
Location: Tarragona
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #74  
Old 10-30-2008, 02:29 PM
Leo Brazil's Avatar
Leo Brazil Leo Brazil is offline
 
Join Date: Dec 2007
Location: Brazil
Posts: 485
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #75  
Old 10-31-2008, 01:58 AM
cvn cvn is offline
 
Join Date: May 2006
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@oasi : take your time, we can wait!

Thanks so much!
Reply With Quote
  #76  
Old 10-31-2008, 04:46 AM
Nadeemjp Nadeemjp is offline
 
Join Date: Aug 2008
Location: Japan
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i seee........ok oasi hope you can fix it waiting for your updated xml file
Reply With Quote
  #77  
Old 10-31-2008, 07:56 AM
oasi oasi is offline
 
Join Date: Mar 2008
Location: Tarragona
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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...
Reply With Quote
  #78  
Old 10-31-2008, 12:23 PM
cvn cvn is offline
 
Join Date: May 2006
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It still does not work with my board

The maps link:
PHP Code:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;q=Singapore&amp;sll=40.446947,-86.923828&amp;sspn=0.040497,0.090723&amp;ie=UTF8&amp;ll=1.352083,103.819836&amp;spn=0.0532,0.090723&amp;z=14&amp;output=embed&amp;s=AARTsJqkLJNXPDqzeV-2S6QWBWQf58w4dg"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;q=Singapore&amp;sll=40.446947,-86.923828&amp;sspn=0.040497,0.090723&amp;ie=UTF8&amp;ll=1.352083,103.819836&amp;spn=0.0532,0.090723&amp;z=14&amp;source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small
And the page source code:
PHP 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&amp;hl=en&amp;geocode=&amp;q=Singapore&amp;sll=40.446947,-86.923828&amp;sspn=0.040497,0.090723&amp;ie=UTF8&amp;ll=1.352083,103.819836&amp;spn=0.0532,0.090723&amp;z=14&amp;output=embed&amp;s=AARTsJqkLJNXPDqzeV-2S6QWBWQf58w4dg"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;q=Singapore&amp;sll=40.446947,-86.923828&amp;sspn=0.040497,0.090723&amp;ie=UTF8&amp;ll=1.352083,103.819836&amp;spn=0.0532,0.090723&amp;z=14&amp;source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>";
t_n_q=t_i.replace(/&quot;/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
Please help us look into it to see what's possibly wrong.

Thankssss!
Reply With Quote
  #79  
Old 10-31-2008, 12:43 PM
oasi oasi is offline
 
Join Date: Mar 2008
Location: Tarragona
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know why your gmap pasted code isn't chaged to html chars...

" should be &quot;
< should ve &lt;

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...
Reply With Quote
  #80  
Old 10-31-2008, 01:03 PM
cvn cvn is offline
 
Join Date: May 2006
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by oasi View Post
I don't know why your gmap pasted code isn't chaged to html chars...

" should be &quot;
< should ve &lt;

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!
Reply With Quote
  #81  
Old 11-03-2008, 10:58 AM
Leo Brazil's Avatar
Leo Brazil Leo Brazil is offline
 
Join Date: Dec 2007
Location: Brazil
Posts: 485
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It' works great for me now !!

Thank you oasi, MOTM for sure.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:28 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04745 seconds
  • Memory Usage 2,349KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete