Version at: 02/08/2013, 13:01

#Bookmarklets

A bookmarklet is a tool that you can keep on your bookmarks bar that performs an action when you click on it. Advanced contributors can use bookmarklets to link sentences that are not already indirectly linked.

To install a bookmarklet, use the drag-and-drop instructions below, or build it from scratch: create a bookmark from any web page, set the "Location" or "URL" field to the bookmarklet string, and change the name as desired. 

See the [Wikipedia page on bookmarklets](http://en.wikipedia.org/wiki/Bookmarklet) or [this short introduction](http://betterexplained.com/articles/how-to-make-a-bookmarklet-for-your-web-application/) for more details. 

## Drag-and-drop to Your Bookmarks Toolbar

* If your bookmarks/favorites toolbar is not displayed already, open it by right-clicking in the toolbar area and checking "Bookmarks Toolbar" or "Favorites Toolbar". Then go to [Tools for Tatoeba.org Members](http://bit.ly/tatoebatools) and drag one or more bookmarklets from the top of the page to your bookmarks toolbar.

##Description of Tatoeba bookmarklets

Both of these bookmarklets will accept either sentence numbers (for example, "1000000") or sentence URLs (for example, "http://tatoeba.org/eng/sentences/show/1000000"). To get the URL of a sentence, right-click on a link to it and select "Copy Link Location" (or its equivalent in your browser).

##*** *"Link To This Sentence"*

The following bookmarklet will let you link the sentence on the current page to any other sentence by copying the latter's ID or URL into a field. The text of the bookmarklet follows:

javascript:var%20a=window.prompt("Enter%20the%20URL%20or%20number%20of%20the%20sentence%20to%20link%20to%20this%20one","");if(a!=null){var%20t=/(http:\/\/tatoeba.org\/[a-z]{3}\/sentences\/show\/)?([1-9][0-9]*)/;var%20r=a.match(t);if(r!=null){var%20an=r[2];location.href=location.href.replace("sentences/show","links/add")+"/"+an};}

##*** *"Link 2 Sentences"*

The following bookmarklet will let you link any two sentences by copying their numbers or URLs into fields. It does not require you to be on a page that shows one of the sentences. However, you need to enter the numbers or URLs of both sentences. The text of the bookmarklet follows:

javascript:var%20u=0;var%20e="Enter%20number%20or%20URL%20of%20";var%20s="%20sentence";var%20a=window.prompt(e+"first"+s,"");if(a!=null){var%20t=/(http:\/\/tatoeba.org\/[a-z]{3}\/sentences\/show\/)?([1-9][0-9]*)/;var%20r=a.match(t);if(r!=null){var%20an=r[2];var%20b=window.prompt(e+"second"+s,"");if(b!=null){r=b.match(t);if(r!=null){var%20bn=r[2];u%20=1;c="http://tatoeba.org/eng/links/add"+"/"+an+"/"+bn;location.href=c;}}}}if(u==0){window.alert("Invalid%20input");}


The bookmarklets on this page were written by AlanF_US, based on one written by Zifre.

version at: 02/08/2013, 13:27

#Bookmarklets

A bookmarklet is a tool that you can keep on your bookmarks bar that performs an action when you click on it. Advanced contributors can use bookmarklets to link sentences that are not already indirectly linked.

To install a bookmarklet, use the drag-and-drop instructions below, or build it from scratch: create a bookmark from any web page, set the "Location" or "URL" field to the bookmarklet string, and change the name as desired. 

See the [Wikipedia page on bookmarklets](http://en.wikipedia.org/wiki/Bookmarklet) or [this short introduction](http://betterexplained.com/articles/how-to-make-a-bookmarklet-for-your-web-application/) for more details. 

## Drag-and-drop to Your Bookmarks Toolbar

* If your bookmarks/favorites toolbar is not displayed already, open it by right-clicking in the toolbar area and checking "Bookmarks Toolbar" or "Favorites Toolbar". Then go to [Tools for Tatoeba.org Members](http://bit.ly/tatoebatools) and drag one or more bookmarklets from the top of the page to your bookmarks toolbar.

##Description of Tatoeba bookmarklets

Both of these bookmarklets will accept either sentence numbers (for example, "1000000") or sentence URLs (for example, "http://tatoeba.org/eng/sentences/show/1000000"). To get the URL of a sentence, right-click on a link to it and select "Copy Link Location" (or its equivalent in your browser).

##*** *"Link To This Sentence"*

The following bookmarklet will let you link the sentence on the current page to any other sentence by copying the latter's number or URL into a field. The text of the bookmarklet follows:

javascript:var%20a=window.prompt("Enter%20the%20URL%20or%20number%20of%20the%20sentence%20to%20link%20to%20this%20one","");if(a!=null){var%20t=/(http:\/\/tatoeba.org\/[a-z]{3}\/sentences\/show\/)?([1-9][0-9]*)/;var%20r=a.match(t);if(r!=null){var%20an=r[2];location.href=location.href.replace("sentences/show","links/add")+"/"+an};}

##*** *"Link 2 Sentences"*

The following bookmarklet will let you link any two sentences by copying their numbers or URLs into fields. It does not require you to be on a page that shows one of the sentences. However, you need to enter the numbers or URLs of both sentences. The text of the bookmarklet follows:

javascript:var%20u=0;var%20e="Enter%20number%20or%20URL%20of%20";var%20s="%20sentence";var%20a=window.prompt(e+"first"+s,"");if(a!=null){var%20t=/(http:\/\/tatoeba.org\/[a-z]{3}\/sentences\/show\/)?([1-9][0-9]*)/;var%20r=a.match(t);if(r!=null){var%20an=r[2];var%20b=window.prompt(e+"second"+s,"");if(b!=null){r=b.match(t);if(r!=null){var%20bn=r[2];u%20=1;c="http://tatoeba.org/eng/links/add"+"/"+an+"/"+bn;location.href=c;}}}}if(u==0){window.alert("Invalid%20input");}


The bookmarklets on this page were written by AlanF_US, based on one written by Zifre.

Note

The lines in green are the lines that have been added in the new version. The lines in red are those that have been removed.