Example File for jFav "add to favourites/bookmarks" for jQuery!

This file contains examples of jFav, plugin created by Nikos "DuMmWiam" Kontis for use with the jQuery library version 1.2+. Currently supported browsers are: FireFox, Internet Explorer and Opera. Safari and Chrome are not supported yet due to browser limitations. For more information visit the official website: http://www.dummwiam.com/jFav.

Example A : Simple Usage AKA Bookmaring The Current Page

The first and most important thing you have to understand is that jFav, doesn't have any parameters. In order to have maximum usability and implementation the "bookmarking" parameters are set per link, in the attributes href and title! Now that you've got tha let's go the most simple and common usage of jFav, make a link (or more, but I believe you need only one), to Add to Bookmarks/Favourites the current url. In order to do that you have to do two things: 1) create the link(s) in HTML and then 2) assign the jFav function on those links. The following examples goes like this...

HTML CODE:
<a id="buttonOne">Click here to Add this Page to Favourites</a>

jQuery CODE:
$('#buttonOne').jFav();

Click here to Add this Page to Favourites

By click the link above in the example, you will see that the add to bookmarks/favourites dialogue box opens. The name of the link is taken from the <title> element of you page (inside <head>...</head>) and the link (URL, HREF whatever you call it) is the current url of the page. This is the (smart) jFav, it sees that you have not set the title & href attributes on the <a> tag and it assumes that you want this bookmark to point to the current page.


Example B : Advanced Usage AKA Bookmark Any Number of Internal or External Links!

The second more "complicated" usage of jFav is handy when you want to create bookmarks that point to any url/href/link you want and with any title you want. Declare a title and href attributes in your links and you are set. A very important think to note, is the correct declartion of external links. This is wrong: www.google.com this is correct: http://www.google.com! See the following examples and you will understand.

HTML CODE:
1) <a class="buttonsTwo" href="http://www.google.com/" title="Google T H E search engine">Bookmark Google</a>
2) <a class="buttonsTwo" href="http://www.drupal.org/" title="Drupal RULEZ">Add Drupal to favourites!</a>
3) <a class="buttonsTwo" href="#" title="My Page Name Here">Bookmark Current Page, with custom title</a>

jQuery CODE:
$('.buttonsTwo').jFav();

1) Bookmark Google
2) Add Drupal to favourites!
3) Bookmark Current Page, with custom title

The first and second links have a custom declaration in both title and href, thus instead of links these two work as add bookmarks/favourites for Google and Drupal respectively. The third link has a declaration only in the title attribute, so jFav uses the current URL/address for the favourite/bookmark destination and the bookmark/favourite name is take by the title attribute.