Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A page of useful Safari JavaScript bookmarks Web Browsers
I found an interesting Safari bookmarks page on Apple's site. On this page, they provide some useful JavaScript bookmarks that can communicate with additional applications such as Sherloc.

Here's an alternative version to search webster for a word definition. Enter the following bookmark defintion as one line with no spaces at all between characters:

javascript:x=escape(getSelection());window.location=
  'http://www.webster.com/cgi-bin/dictionary?book=dictionary&va='+x;
[robg adds: The submitted hint also included a JavaScript to search Google for the selected text, but it's somewhat redundant -- you can just control-click on any selected text and choose Google search. However, for completeness sake, here's the Google JavaScript:
javascript:x=escape(getSelection());window.location=
  'http://www.google.com/search?q='+x;
Again, enter it as one line without any spaces at all.]
    •    
  • Currently 2.60 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[34,322 views]  

A page of useful Safari JavaScript bookmarks | 10 comments | Create New Account
Click here to return to the 'A page of useful Safari JavaScript bookmarks' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A page of useful Safari JavaScript bookmarks
Authored by: JackSim on Jul 14, '03 11:09:29AM
The last two bookmarks are the most useful at my opinion. Very useful when a JavaScript popup makes the new windows size very small. But the code snippets on Apple's page don't work because of a syntax error. The last part of the code:

screen.availHeight');

should be:

screen.availHeight);

(remove the single quote)

[ Reply to This | # ]

A page of useful Safari JavaScript bookmarks
Authored by: luhmann on Jul 14, '03 04:05:43PM

Neither one works for me ...



[ Reply to This | # ]
A page of useful Safari JavaScript bookmarks
Authored by: jonny5 on Jul 14, '03 12:07:57PM
alternatively, you can use this to pop up a dialog box for a word to look up in the dictionary, in case you don't have the word high-lighted in a page:

javascript:x=escape(prompt('Enter%20a%20word','type%20a%20word%20here'));
window.location='http://www.webster.com/cgi-bin/dictionary?book=dictionary&va='+x;


just paste it into a bookmark link, again - no spaces

[ Reply to This | # ]
A little better
Authored by: kleinmatic on Jul 18, '03 11:05:38AM

This is a mix-up of Jonny5's and the other scripts. With this bookmarklet, if a word is highlighted, you'll get the definition for it. If it isn't, you're prompted to enter a word. Huzzah!

[no spaces, I guess, though it works for me either way]

javascript:x=escape(getSelection()); if(!x){x=escape(prompt('Enter%20a%20word','type%20a%20word%20here'));}if(x!='null') {window.location='http://www.webster.com/cgi-bin/dictionary?book=dictionary&va='+x;} else{return;}



[ Reply to This | # ]
Don't forget regular bookmarklets
Authored by: bongo on Jul 14, '03 12:31:10PM
Other more general-purpose 'bookmarklets' are here. Most of them are browser neutral.

[ Reply to This | # ]
A page of useful Safari JavaScript bookmarks
Authored by: sfodden on Jul 14, '03 04:27:14PM
I, too, find the resizing Javascript bookmarks most useful. With a 15 inch iBook flat panel I use this to get me 800 x 600 centred on the screen:

javascript:window.resizeTo(800,600);window.moveTo
(Math.round((screen.availWidth-window.outerWidth)/2),
Math.round((screen.availHeight-window.outerHeight)/2))
And to get to true full screen I use:

javascript:window.defaultStatus='';%20self.moveTo(0,0);
%20self.resizeTo(screen.availWidth,screen.availHeight)
Can't remember where I got them from. Probably bookmarklets.com, with a modification here and there. --- Simon F.

robg adds: I edited this one for formatting. Enter the JavaScripts as one line with no spaces at all between the current lines.

[ Reply to This | # ]
And here's something for those pesky forms
Authored by: bostmass on Jul 14, '03 06:58:45PM
Tired of filling out forms just to read an article online or something similar or mundane? Here's a javascript you can add to your menubar that will fill every text box in every form on the page with the word 'anonymous.' It also tries to fill in email boxes with 'anonymous@example.com'. Give the menubar button a name like Autofill Anonymous and click it when you're prompted by an intrusive form (don't confuse a shopping cart form to a nosy-website form). Here it is:

javascript:function%20ROIoiW()%7Bvar%20i=0,j,A='anonymous',
D,E,F=document.forms;while(i%3CF.length)%7BE=F%5Bi%5D.elements;
for(j=0;j%3CE.length;j++)%7BD=E%5Bj%5D;if(D.type=='text')
%7BD.value=(D.name.toUpperCase().indexOf('MAIL')!=-1)?A+
'@example.com':A%7D%7Di++%7D%7DROIoiW();void(null)
robg adds: I edited the above for formatting; enter the above as ONE LINE with no extra spaces or line breaks!

[ Reply to This | # ]
And here's something for those pesky forms
Authored by: inertia186 on Jul 18, '03 12:53:36PM
That's really good, but I had to improve it a little:
javascript:function%20ZoTiT()%7Bvar%20i,
j,A='anonymous',D,E,F=document.forms,
H=location.host;for(i=0;i%3CF.length;i++)%7B
E=F%5Bi%5D.elements;for(j=0,D=E%5Bj%5D;
j%3CE.length;D=E%5Bj++%5D)if(D.type=='text'
&&!D.value)D.value=(D.name.toUpperCase().
indexOf('MAIL')!=-1)?A+'@'+(H?H:'example.com')
:A;%7D%7DZoTiT();void(null);


[ Reply to This | # ]
stupid stupid rat creature
Authored by: frankie1969 on Jul 15, '03 10:36:47AM

Thanks for this hint. So...

Safari supports a bare getSelection() method, but still not Netscape's document.getSelection(). This means if I want my AutoGoogler to work with Safari, I have to add a third if branch. How annoying.

http://www.google.com/search?q=autogoogler



[ Reply to This | # ]
Location and Language Specific Google Searches
Authored by: paulrob on Dec 20, '03 11:45:42AM

One of the annoying things about Safari from a non-US users point of view is that the built-in Google search is locked onto the US site. This means that non-US users get swamped by all the US sites, and not the more pertinent local sites.

So pop this into your bookmark bar folder. No spaces. Remember to enable JS:-

javascript:x=escape(prompt('Enter%20a%20word','type%20a%20word%20here'));window.location=%0a%20%20'http://www.google.co.uk/search?q='+x+'&meta=cr%3DcountryUK%7CcountryGB';

Press the button in the bookmarks bar and you get a search window. Script searches UK Google, with "UK only" option set.

Same idea for Aussies:-

javascript:x=escape(prompt('Enter%20a%20word','type%20a%20word%20here'));window.location=%0a%20%20'http://www.google.com.au/search?q='+x+'&meta=cr%3DcountryAU';

Et pour les Francais, rechercher en Francais:-

javascript:x=escape(prompt('Écrivez%20un%20mot','dactylographiez%20un%20mot%20ici'));window.location=%0a%20%20'http://www.google.fr/search?q='+x+'&meta=lr%3Dlang_f';

And so on ... identify the URL needed to do a search at your national site, and for nationally sourced documents only by doing actually doing such a search. Copy the URL from the address bar and edit one of the above Javascripts for your local area. Note you need to insert '+x+' in the URL. Can't use in Bookmarks window.

P.



[ Reply to This | # ]