|
| |
|
|
leatherlips
Posts: 248 From: USA Status: offline
|
A neat little dictionary script... - 8/5/2005 20:06:14
I found what I think is a great little dictionary script. It can be found at The Free Dictionary. Here is the script: Place this in the head: <script src="http://www.thefreedictionary.com/dict.js"></script> Modify the body tag: <body ondblclick="dictionary()"> You're done! What it does is allows a user to double click on any word that is not a link and it will bring up a box that has the definition of that word. It even has an audio clip that pronounces the word! I tested it on my site on this page. If you have a technical page with a lot of terms this could be a useful script. I am a teacher and plan on using it on pages that can help my students. What do you think?
< Message edited by leatherlips -- 8/5/2005 20:24:03 >
|
|
|
|
ou812
Posts: 1603 Joined: 1/5/2002 From: San Diego Status: offline
|
RE: A neat little dictionary scritp... - 8/5/2005 20:21:34
Pretty neat! I have no need for it, currently, but can definitely understand how you could use it being a teacher. Nice find.
_____________________________
-brian EnterpriseDB: Enterprise-class relational database management system PostgreSQL: The world's most advanced open source database
|
|
|
|
ou812
Posts: 1603 Joined: 1/5/2002 From: San Diego Status: offline
|
RE: A neat little dictionary scritp... - 8/6/2005 0:45:55
Okay, since I thought this was a pretty cool thing, then Bobby made a good point, I thought I would modify the code. So, if you are interested you can just place this in your own page.
<SCRIPT Language="JavaScript">
//don't forget to add <body ondblclick="dictionary()">
function dictionary() {
if (navigator.appName == "Netscape") {
t = document.getSelection();
opennewdictwin(t);
}
else {
t = document.selection.createRange();
if(document.selection.type == 'Text' && t.text != '') {
document.selection.empty();
opennewdictwin(t.text);
}
}
}
function opennewdictwin(text) {
while (text.substr(text.length-1,1)==' ')
text=text.substr(0,text.length-1)
while (text.substr(0,1)==' ')
text=text.substr(1)
if (text > '') {
var newwin = window.open('http://dictionary.reference.com/search?q='+escape(text), 'dictionary', 'width=760,height=500,resizable=yes,menubar=no,scrollbars=yes,status=no,titlebar=yes,toolbar=no,location=yes,personalbar=yes');
}
}
status='double-click any word - get its instant definition in the dictionary.'
document.ondblclick=dictionary //works for IE only. For NS add <body ondblclick="dictionary()">
</SCRIPT>
_____________________________
-brian EnterpriseDB: Enterprise-class relational database management system PostgreSQL: The world's most advanced open source database
|
|
|
|
leatherlips
Posts: 248 From: USA Status: offline
|
RE: A neat little dictionary script... - 8/6/2005 13:18:36
Great idea! I also was not keen on the ads. However, I am also not too fond of dictionary.com either. You can't hear their pronunciations. So I went with your script change and decided on the following: //don't forget to add <body ondblclick="dictionary()">
function dictionary() {
if (navigator.appName == "Netscape") {
t = document.getSelection();
opennewdictwin(t);
}
else {
t = document.selection.createRange();
if(document.selection.type == 'Text' && t.text != '') {
document.selection.empty();
opennewdictwin(t.text);
}
}
}
function opennewdictwin(text) {
while (text.substr(text.length-1,1)==' ')
text=text.substr(0,text.length-1)
while (text.substr(0,1)==' ')
text=text.substr(1)
if (text > '') {
var newwin = window.open('http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va='+escape(text), 'dictionary', 'width=760,height=500,resizable=yes,menubar=no,scrollbars=yes,status=no,titlebar=yes,toolbar=no,location=yes,personalbar=yes');
}
}
status='double-click any word - get its instant definition in the dictionary.'
document.ondblclick=dictionary //works for IE only. For NS add <body ondblclick="dictionary()"> I would like to remove the address bar as well, but don't know the proper command. I've tried addressbar=no and address=no, but neither of them work. Any ideas? Incidentally, you can save the above as a .js file and store it in your own directory. You can then use the small code in my original post to call it up. Just be sure to refer to the place where you store the .js file in the head of the page where you want the script to work.
|
|
|
|
dpf
Posts: 7126 Joined: 11/12/2003 From: India-napolis Status: offline
|
RE: A neat little dictionary script... - 8/6/2005 13:28:13
try location = no
_____________________________
Dan
|
|
|
|
BobbyDouglas
Posts: 5470 Joined: 5/15/2003 From: Arizona Status: offline
|
RE: A neat little dictionary script... - 8/6/2005 14:09:36
Dan, Do you know how to onload the script for when you use the onclick, without having to insert <body ondblclick> in the html code?
_____________________________
Arizona Web Design - Mr Bobs Web Design in Arizona The Arizona Web Hosting Challenge
|
|
|
|
leatherlips
Posts: 248 From: USA Status: offline
|
RE: A neat little dictionary script... - 8/6/2005 14:25:20
Thanks, location=no worked. It was already in the script but didn't notice it.
|
|
|
|
lthaga
Posts: 24 Joined: 2/24/2004 Status: offline
|
RE: A neat little dictionary script... - 8/10/2005 11:36:43
Can you give me an example of how this works?
|
|
|
|
BobbyDouglas
Posts: 5470 Joined: 5/15/2003 From: Arizona Status: offline
|
RE: A neat little dictionary script... - 8/10/2005 13:00:16
quote:
ORIGINAL: leatherlips I tested it on my site on this page. I think the above link is a good example..
_____________________________
Arizona Web Design - Mr Bobs Web Design in Arizona The Arizona Web Hosting Challenge
|
|
|
|
mdurkee
Posts: 5 Joined: 10/1/2003 Status: offline
|
RE: A neat little dictionary script... - 8/26/2005 17:08:16
I love this little script. I worked on a web site for a doctor in my local area. We used lots of little external JavaScript files to do cool things. This really comes in handy for her when she puts out her electronic newsletter. You know those doctors always use terms that make us run for our dictionary. Now we can all just double click on the word and figure it out quickly. Thanks for the tip.
|
|
|
|
joa1barroso
Posts: 3 Joined: 6/5/2002 From: Status: offline
|
RE: A neat little dictionary script... - 2/28/2006 2:33:43
Greetings everyone, I was looking for a dictionary script, and found this thread... This is what I have been looking for, to enable a glossary on a website, but with one difference... I would like it to work in conjunction with a script that can be found here: http://ascripts.com/products/aims.shtml (this is free, and also uses a js file to call the popup windows -- with one difference: each occurrence of each word, so it can popup the definition, must be html hardcoded by hand, for each single page!...) The GREAT thing here with what you people did is of course that one does not need to hardcode each word... And if, as BobbyDouglas asks, "Do you know how to onload the script for when you use the onclick, without having to insert <body ondblclick> in the html code?" this would be even better... What I need, is to use my own database of words, etc. so I believe the script you guys have been working on would have somehow to be adapted... I am not a programmer... so I am lost here... but since you people seem interested in this, maybe someone would also be interested in this possibility, and be able/willing to make this work?... although I am not a programmer, I think there my be a need to do something like having a file being parsed, where for each word there will be one or more ID numbers, or comma delimited possible entries? (Does this go into changing the CGI itself?)... Thanks in advance for any feedback/help. Warm regards, Joa1 The glossary.js this script is using, looks like this: ... START... var serverPath, wWidth, wHeight,newWindow; serverPath="http://www.mysite.net/cgi-bin/glossary/"; wWidth=320; wHeight=380; //////////////////////////////////////////////////////////// /// (c) 2001 ASCRIPTS.COM // do not remove! // //////////////////////////////////////////////////////////// function showhelp(helpID) { newWindow=window.open(serverPath+'info.cgi?id='+helpID,"","width="+wWidth+", height="+wHeight+",toolbar=no, menubar=no, status=no,location=no,directories=no, scrollbars=no,resizable=no, left=2,top=2,screenX=2,screenY=2"); } ...END...
|
|
|
|
katylily33
Posts: 2 Joined: 2/24/2006 Status: offline
|
RE: A neat little dictionary script... - 3/1/2006 19:46:38
I told my sister who is a teacher about this and she thinks it is great. lol
|
|
|
|
traveler98
Posts: 362 From: Dallas Tx USA Status: offline
|
RE: A neat little dictionary script... - 3/17/2006 16:18:41
Awesome script---Have a site that I maintain for a counseling group and this would be great!
_____________________________
The worst day of golf is better than any day at work.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|