Site Meter

SafariBookmarsk2Web

SafariBooksMarks2Web is an applescript that will read the bookmakrs from Safari and create a javascript that can be placed in a website. The javascript functions will display the links on your website.

Why?

The primary purpose of this script was so I could update the links on my blog without having to regenerate the entire site every time (since every page has the links on them). I also wanted to be able to manage those links from Safari, since that's where I do all my surfing. A single javascript function can now access them from the website without updating the site every time.

How Do I Use It?

When you run the application it will present you with a dialog of the root directory. This is the directory in your Safari Bookmarks that has the links you want displayed. The default is the Bookmarks Bar.



When you click OK it will parse your Safari Bookmarks.plist file and pull out all the links and directory structure. It will then stick all of them into a file called safaribookmarks.js on your desktop. You can then use this file in your site.\

Before you use it you will need to put the file on your website in the <HEAD> section:
<script type="text/javascript" src="safaribookmarks.js" language="JavaScript"></script>

There are two functions:

randomlink will display a random link from the list. Use this code in your website: <script language="JavaScript"> randomlink(); </script>

writelinks will write a list of the URLs in a HTML list format with the subdirectories as headers. Use this code in your website:<script language="JavaScript"> writelinks(); </script>

[Update:] Beta 2 adds the ability to have comments for a website. Separate the name with the comment with a double pipe ||.

Where Do I Download It?

Click here:
SafariBookmarks2Web 2.zip


Are There Any Known issues?

This is a beta. It works for me, maybe not so much for you. It also probably doesn't have the options you want. Please give me feedback so I can improve it.

If a bookmark is listed first and a folder is listed after it, it will stick the bookmark in the next directory. For example Apple is listed under Mac Sites in my bookmarks then there is a folder called General News. For some reason it is put into General News. This doesn't happen if you put the bookmarks after the folders.

There is an error after running the script. The safaribookmarks.js should still be produced ok.



The more links you have, the longer it takes to run since it reads in the entries bookmarks list.

I've thought long and hard about weather to share the code for this. For now I've decided not to.