|
Questions about Preferences:
6. What is the small icon
that's displayed when double-clicked? How should I turn it on/off?
A. This icon is useful for those who dislike seeing
a tooltip on double-click.This icon will remain visible for 5 seconds
during which if you move your mouse over the icon, the tooltip or
iframe is displayed. This is also useful for those who have a habit
of double-clicking to select the word and copy the word. This icon
allows to differentiate when you really want to view the meaning
and when you want to select a word.
7. What are the preferences for invoking the tooltip?
A. The preferences allows you to customize how
and when to show the tooltip. When you double-click on a word, the
toolitp pops up. You can disable/enable the double-click feature
by removing the check mark on the checkbox.Similarly there are other
choices like Ctrl+Dbl-Click for those who feel double-click annoying.
Alternatively, you can press Ctrl+Shift+K (or any key of your choice)
or right-click and choose "View Definition" to invoke
the tooltip.
8. How to set the location of the tooltip?
A. By default, the tooltip is shown near the selected
word. You have a choice whether to show the tooltip near the selected
word (or) always at the same location.
9. What are the list of all websites and preferred
websites?
A. The list of all dictionaries (left list) is
the total availabe dictionaries/websites. The preferred list (right)
is the one that will be displayed on the dropdown in the tooltip.
So, keep the dictionaries that you use the most in the preferred
list so that your dropdown is not cluttered. These lists also enable
to sort (order shown in the dropdown) the dictionaries/websites.
10.How do I import a new dictionary/website?
A As said in answer to Q. 2,
the extension works by slicing of the unwanted part from the webpage,
it uses XML for storage of code. You can import the code stored
in xml to do the slicing for you from my website.
http://www.rjonna.com/ext/ext_download.php
Just select the websites/dictionaries that you want to add from
the list and click "Download XML" button. Give the location
you want to save the file. Then, click on the "Import Website"
button from the "options" and select the file you downloaded.
That's all, the dictionaries that you selected would appear in the
list boxes/
11. How do I add a new dictionary? What is the difference
between simple mode and expert mode?
A. Read answer to Q. 2
if you haven't read before proceeding. Simple Mode just
allows you to add the dictionary/website to the list. It doesn't
do the slicing. Expert mode allows you to add javascript code yourself
to do the slicing if you know scripting.
Simple Mode:You have to provide information
to only 3 fields.
Name : Give a name to the website that
you add. This will be the name that is displayed in the dropdown.
Url : This is the actual url of the website.
The "search term" has to be replaced by $$ (2 dollar signs).
'$$' is replaced by the word you select on the webpage.
eg. actual url : http://www.thefreedictionary.com/arrow?p
(actual url with 'arrow' as the search term). You may have to replace
'arrow' by $$.
converted url : http://www.thefreedictionary.com/$$?p
Sub Categories List: This list is the
2nd drop-down that usually has the conversion between different
languages from the same website. For example, in dict.org there
are many options to convert between languages. You can leave '*'
if the dictionary/website that you add doesn't have any such language
conversions. This is a comma separated list. To add multiple options,
make it a comma separated string. They will be split as options
and shown in the drop-down.
Expert Mode: You should know javascript
and DOM (a must) to do this. If you don't know javascript send a
request to me by giving the url and your email id(just to notify
you after it's complete) at http://www.rjonna.com/ext/ext_download.php.
I will do it in my free time.
I tried my best to make it simple..Ok. we shall start. Best way
to start is look at the "Code Preview" for the existing
dictionaries (particularly dict.org) (or) You can look at the actual
generated script file in a directory called dictionarytip in your
profiles folder. An array of these objects "arrDict" is
created and called as shown below.
toolTip.curDict = arrDict[prefDict];
toolTip.curDict.assignUrl(this.selectedText); //this assigns the
url and replaces $$ with the selected word
frameTip.setAttribute("src", this.curDict.url); //frameTip
is the iframe object
After Page Load:
toolTip.curDict.filterPage(ftDoc); //this function filters
the web content
How to fill the fields?
Sub Categories Value List: This is again
the comma separated list which holds the 'value' part of the options
in the dropdown. This should be in synchronous with the Sub
Categories List. ie they should have the same number of
comma separated values. What's the use of this? Take 'dict.org'
as the example. This has many choices like converting from english->
english, en->spanish, spanish->en. This is what is shown in
the drop-down. This field helps to show readable names in the drop-down
and have the actual values in their 'value' fields. The actual value
that's sent to the server is different. The values you provide in
this field is sent to the server. See the url below to get an idea.
prefLang is the index variable for the 2nd dropdown.
It is the "selectedIndex" for the dropdown.
this.subCatValue holds the comma separated string
you enterd in this field
url = "http://www.dict.org/bin/Dict?Form=Dict1&Query=$$&Strategy=*&Database="
+ this.subCatValue.split(",")[prefLang];
Code for Url: As seen above, if you need
multiple options in the same dictionary you have to give a complex
url. The variable 'url' stores the url which is provided as the
source to the iframe.
Code to parse webpage: This is where you
parse the webpage that's loaded in the iframe.You have the variable
called 'ftDoc' which is the actual 'document' object for that iframe.
You can filter the content using this ftDoc (document) object.
eg. (en.wiktionary.org) Look in the DOM Inspector for en.wiktionary.org
var newContent = ftDoc.getElementById("bodyContent").cloneNode(true);
var wiktionaryFont = ftDoc.createElement("font");
wiktionaryFont.setAttribute("size", "2");
wiktionaryFont.appendChild(newContent);
ftDoc.body.innerHTML = "";
ftDoc.body.appendChild(wiktionaryFont);
This code eliminates the outer table and shows only the
content.
As said earlier, this is an experiment and I tried my best to make
it simple. I am not yet sure if this works for all websites/dictionaries.
820
|