New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
Web Design and Hosting Creating sites, scripting, and hosting discussions.

Help with JavaScript and PhoneBook widget


Post Reply New Thread Subscribe

 
Thread Tools
garymm
Guest
 
Posts: n/a

For starters, I have very limited experience with JavaScript. That out of the way, I want to modify the phonebook widget so that when I click on an address, I get directions to it rather than a map of it. The pertinent section of PhoneBook.js (or at least this is the only thing that I think is pertinent but I have no idea how to use javascript) follows (can be accessed via the "show package contents" on the PhoneBook widget file in Library/Widgets):

var mapURL = "http://www.mapquest.com/maps/map.adp?country=us&address=";

mapURL += URLEncode( singleResult.address );
mapURL += "&city=";
mapURL += URLEncode( singleResult.city );
mapURL += "&state=";
mapURL += URLEncode( singleResult.state );
mapURL += "&zip=";
mapURL += URLEncode( singleResult.zip );

addressSpansContainer.setAttribute("maplink", mapURL );
addressSpansContainer.onclick = function(event)
{
if( window.widget )
widget.openURL(this.getAttribute("maplink"));
}

Here are the mapquest guidelines for creating a link to directions (instead of a map): link

I can figure out how to simply enter my home address into the base URL and have it permanently stored in the PhoneBook.js, but what I really want is a way to make it check my address from my card in Address Book. Is there a way to do this with JavaScript or at all?

Thanks for the help. I will definitely share the edited widget.
QUOTE Thanks

Post Reply New Thread Subscribe


« Help with b2evolution php/mySQL | Apache and root folders »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

All times are GMT -4. The time now is 07:25 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?