MediaWiki talk:Gadget-dictionaryLookupHover.js

 [ Signal a bug] See WN:WiktLookup for more information.

Note: This script currently does not have a maintainer. If you know Javascript, HTML, and (a little) XSLT, and you don't mind spaghetti code, please feel free to help out or take over maintaining the script. -- This script is currently broken by 39180

FAQ

 * I want to use this, but at the same time I want to be able to double-click things without the pop-up coming up. (aka i want to use the edit when double clicking option, or i want to select whole words by double clicking).
 * hold down shift while double clicking
 * Can this be translated into &lt;some language&gt;
 * yep, this is already in several languages. See below to request a new translation, or help with translation
 * Can I use this on my website or wiki
 * Yes you can. See WN:WiktLookup for details on how to use on your own website. Ask user:Bawolff if you need help.
 * I know javascript and want to help
 * Awesome, ask user:Bawolff what you could do to help.
 * I for some reason want to query wiktionary for definitions
 * The script used in the backend of this project can be directly accessed at user:Bawolff/sandbox/Wiktionary query
 * I want to use this as a bookmarklet
 * Sure, just bookmark the following url (In firefox, highligh it and drag to toolbar)
 * I want to disable it for a paticular section of a page
 * just enclose that section in . (doesn't have to be a span, could be any element. also recognizes class name wiktLookup-enable to override).

Random idosynchrasis

 * The count parameter will only return definitions for the word as interperted as if the word is of a specific language. However ES translation does all definitions
 * Image handling kind of crap.

Open issues
-- Longer term/ stuff i'm aware but not on my immediate list of things to fix (yell at me if you think these are important and should be a priority) - Other requests (aka stuff other people reported that i'm not planning to do in short term):
 * Determine if - is a valid word separator. perhaps try both. What about _.
 * Better handling of compound words ( word-word ).
 * Issues with xslt
 * maybe bug link. (not happening right now, as i'm worried it will make things too clutered, but if people really want it, please yell at me)
 * Better instructions. (preferably with pictures)
 * integrate some stuff from fr wiktionary
 * count parameter. push to NL
 * showWord parameter. push to NL
 * get permission to steal wikt:MediaWiki:langcode2name.js
 * Investigate possibility of word press plugin, grease monkey script.
 * Have it recognize if its out of date, and make it do a hard refresh.
 * Double click on search box on mediawiki. (Scroll wheel or something)
 * Image captions are not stripped even though image is. EX: web (A spider's web at end should not be there)
 * Allow locutions with the shift selection, and other sites research with the CTRL + click (eg: Wikipedia, as proposed in the second Firefox module of this tutorial). JackPotte (talk) 14:02, 30 September 2009 (UTC)
 * Sorry, I don't understand what you mean/what you want changed. Bawolff ☺☻ 17:58, 30 September 2009 (UTC)
 * Xe'd like to double-click lookup on Wiktionary, or ctrl-double-click to look up on Wikipedia, and other options as well. -  Amgine | t 19:57, 5 October 2009 (UTC)
 * drop shadow perhaps.
 * mediawiki devs need to be convinced to use mime type text/xsl for the xslt stylesheet so IE plays nice.
 * 20939
 * How to set up in common.js/skin.js, as opposed to gadget (step-by-step) - Amgine
 * Bug report: Error on Camino "Error loading stylesheet: A network error occured loading an XSLT stylesheet:http://en.wiktionary.org/w/index.php?title=MediaWiki:extractFirst.xsl&amp;action=raw" (from Dmcdevit in #Wikisource) - Amgine
 * Thats sad. Due to lack of having a mac, thats unlikey to be fixed in the near future. Bawolff ☺☻ 23:21, 1 October 2009 (UTC)
 * I haz macz. If you need someone to look at something and say "Yep, that's messed up" I can do. PS. we need to coordinate time online. -  Amgine | t 19:55, 5 October 2009 (UTC)
 * Update probably issue with old moz not parsing ?xml-stylesheet processing instruction acording to spec.
 * long term: Actually hover, not double click (lupin popup style)
 * Interface expansion requests found lurking on my talk page:
 * I could be interested to add two link:
 * One for the feedback about the script (bugs)
 * Otourly 11:52, 20 October 2009 (UTC)
 * I could see how that could be useful (adding a bug report page link), but i don't want to make the interface too cluttered. As for your second request. It currently says, can not find word, and has a more link which links to the page. that should probably be improved. thank you for the feedback. Bawolff ☺☻ 00:56, 21 October 2009 (UTC)


 * This is very cool; I've been giving a spin on my blog. A few bugs and requests:
 * There is no way to select compound words (either hyphenated or non-hyphenated)
 * It now considers a hyphen as part of a word. However this introduces problems with hyphanated words that are really two words (example from your blog scientist-historians) . Ideally it should first check the entire thing, than try to see if just one part of the hyphanated word works. I don't know what you mean by non-hyphenated compound words.). - bawolff
 * I mean words like "sans serif" or "death rattle".--ragesoss (talk) 15:38, 25 October 2009 (UTC)
 * Yeah, that would be very very hard to detect, I don't see any possible way of doing that. Bawolff ☺☻ 19:32, 25 October 2009 (UTC)
 * Well theoretically i could introduce some markup suchas: sans serif, but that seems kind of messy. I could also perhaps make it treat an under-score as a fake space, but thats also ugly. Bawolff ☺☻ 18:08, 26 October 2009 (UTC)

Browser-related potential problem
Firefox extension noscript may block scripts from en.wikinews, resulting in issues as pictured here. Solution: Have user whitelist wiktionary.org resolved this problem. -  Amgine | t 21:48, 7 November 2009 (UTC)
 * I wouldn't really clasify this as a problem - if someone disables javascript, they should not be suprised when the javascript does not work. (the issue above would be blocking scripts from wiktionary (with either xslt defined as a script or having css disabled as well) - as if you had either en wikinews, or fr wikinews blocked, you would not be able to get to that step) Bawolff ☺☻ 22:09, 7 November 2009 (UTC)

Clic or shortcut?
[...]Au lieu du double-clic ou triple-clic pour le gadget, on peut utiliser une combinaison de touche clavier (Ctrl+F11 par ex) que l'utilisateur peut changer.
 * [...]Instead of double-clic third-clic and so one, we could use a key-combination (Ctrl+F11 by ex) that the user could change. Otourly (talk) 13:21, 14 November 2009 (UTC)
 * hop Otourly (talk) 13:24, 14 November 2009 (UTC)
 * If we use a key combo, how do we know which word to lookup. unless he means single-click, plus a key combo. Bawolff ☺☻ 22:59, 15 November 2009 (UTC)


 * I agree with this request as an aditional alternative (not instead of double-clicking). We can perform a partial selection of word s or a combined selection of a phrasal verb and then use the key-combination shortcut. Gustronico (talk) 17:44, 21 November 2009 (UTC)
 * That sounds like a good idea. Bawolff ☺☻ 04:08, 22 November 2009 (UTC)


 * ✅.   looks up word. (can be configured to be ctrl+shift+anycharacter).
 * That's good. Thank you! Gustronico (talk) 08:15, 28 November 2009 (UTC)

Japanese word margins
According to Makato, determining word boundaries may be a problem for the script in Japanese. -  Amgine | t 18:27, 18 November 2009 (UTC)
 * ✅ highlight and use key combo ctrl+shift+l

Request for translations
See /how to adapt to another language. Or you could just leave the translation here, but it might take me a little while to get to it.

Languages available
Want this in your language? To speed up the process, consider helping me by translating the following messages ($1 is where stuff gets substituted. leave it in) (Please also specify language code, as well as an admin contact at the specific language wiktionary in question whom i can bug with with re-sync requests)


 * © Wiktionary. Released under CC-BY-SA 3.0
 * Don't worry about urls, i can translate those.
 * Error:
 * » More
 * Note: bear in mind the » may not be a good arrow depending on your language.
 * » Create
 * Could not retrieve definition of $1.

Deutsch (DE)(left to right)

 * © Wiktionary. Unter der CC-BY-SA 3.0 Lizenz verfügbar.
 * Fehler:
 * » Weiter
 * Neuen Eintrag erstellen
 * Nicht möglich, die Definition von $ 1 abzurufen

PL

 * User:Herr Kriss/sb
 * Could not find word: Nie można znaleźć definicji $1.

EL
Here is a translation of this points:

--Egmontaz  ♤  συζήτηση  17:55, 20 Νοεμβρίου 2009 (UTC)
 * © Βικιλεξικό. Διανέμεται υπό την CC-BY-SA 3.0
 * Σφάλμα:
 * » Περισσότερα
 * » Δημιουργία
 * Δεν ήταν δυνατόν να ανακτηθεί ο ορισμός του $1.
 * From: Otourly (talk) 18:16, 20 November 2009 (UTC)

LA
Latin translation, from Wiktionary's EncycloPetey:


 * © Victionarium. exsolutus per CC-BY-SA 3.0
 * Erratum:
 * » Plus
 * » Crea
 * Non putuit reddere definitionem de $1.

More work for Bawolff! \o/ -  Amgine | t 21:48, 21 November 2009 (UTC)

CA

 * © Viccionari. Disponible sota CC-BY-SA 3.0
 * Error:
 * » Més
 * » Crea-la
 * No s'ha trobat cap coincidència per a «$1».

Pasqual (talk) 17:56, 7 December 2009 (UTC)

EO
-- → A ir  on Ĉ  12:11, 30 December 2009 (UTC)  —Preceding unsigned comment added by Otourly (talk • contribs)
 * © Vikivortaro. Publikigita sub kopirajto CC-BY-SA 3.0
 * Eraro:
 * » Pli
 * » Krei
 * Ne povis obteni difinon de «$1».

Translation and Translatewiki
Why do you not transform the LookupHover javascript in a Wikimedia extensions and use the power of the translatewiki ? Crochet.david (talk) 18:32, 12 November 2009 (UTC)
 * That would take it from a simple javascript to requiring it's own extension? That doesn't seem...good. -- Shakata Ga Nai ^_^ 18:39, 12 November 2009 (UTC)
 * For now, it's a simple javascript. But one never knows what the future holds.Crochet.david (talk) 18:46, 12 November 2009 (UTC)
 * I think the point is that it is simple javascript and doesn't need to be anything more, since it already does it's job. Plus if you make it a mediawiki plugin then you can't propagate it out to blogs and such. -- Shakata Ga Nai  ^_^ 18:49, 12 November 2009 (UTC)
 * If it were to become an extension, it would essentially be an extension that just loaded a script. (which i geuss there is nothing wrong with, some people might find that easier to install). However the issue with translatewiki, which well very appealing, the translation doesn't just involve translating a few key phrases, it also involves modifying some rather complicated (And quite fragile) regexs that screen scrape wiktionary, since each language definition uses slightly different markup. This requires some technical knowladge, beyond simply translating words. Bawolff ☺☻ 19:51, 12 November 2009 (UTC)

Problem with French language
Accents at begin and end of words are legal in many languages. For example, on French wikibooks, when I click on "désactivé" word, I get "Could not retrieve definition of desactiv".

Also error messages should be translated. --DavidL (talk) 23:50, 14 November 2009 (UTC)
 * The error message is translated (I could [have] sworn that was translated. must be losing my mind. Its translated now, just needs to be posted to fr wiktionary.). When I click on the word, I get "(Français) Du verbe désactiver." The issue with accents at the end of the word was fixed weeks ago. Perhaps you have an old (really old) cached version of the script. Try doing a hard refresh of the page where you clicked the word. Apperently this is a different issue with accents (Its caused by their being extra whitespace at the end of the word that was not stripped properly). If you do a hard refresh it should be fixed now. Thanks for the bug report. Bawolff ☺☻ 05:24, 15 November 2009 (UTC)

Particularity of the Wikizionario
Hi, for the wikt it, Wim_b has requested me that we should add the local project feedback: The second link should be associated to it:wikt:Wikizionario:Feedback by adding a new section with the article link in title. Then the user will complete the body of the request. Otourly (talk) 22:30, 15 November 2009 (UTC)
 * If I don't know the word, two links: "crea" (create it) or "richiedila" (request it)
 * That should definitly be do-able. Should the bottom link look as follows (If it was an entry for sample word):

» Crea » richiedila

? Bawolff ☺☻ 22:56, 15 November 2009 (UTC)
 * Wim_b have ask this it:wikt:Wikizionario:Bar; It work with china writing ! I'm proud of you! Otourly (talk) 23:48, 15 November 2009 (UTC)
 * On en wikt they also have a feedback but it seems more difficult for edit wikt:Wiktionary:Feedback (monthly self-archive) Otourly (talk) 00:00, 16 November 2009 (UTC)

Phonetic and sound
As a good seller, I've promised the moon to to convince Wikispecies:Wikispecies:Village_Pump: is it possible to start the development of the displaying of the wiktionaries phonetic and sound, which would ones of the most important aspect of this project, please? JackPotte (talk) 22:27, 16 November 2009 (UTC)
 * Yes, but it'd take time. This would have to be implemented for each language seperately. Bawolff ☺☻ 13:25, 17 November 2009 (UTC)

Reach
Otourly is tracking the ever-expanding reach of wiktLookUp. -  Amgine | t 04:01, 17 November 2009 (UTC)
 * Wow, thats awesome. Bawolff ☺☻ 13:26, 17 November 2009 (UTC)

Feedback from the Chinese side
As our fellow said, there's a very big problem with ideograms ;). JackPotte (talk) 14:08, 21 November 2009 (UTC)

Script conflicts with "Edit pages on double-click"
I'm using the script on Commonms and also have "Edit pages on double-click" activated in the preferences. Unfortunately, both parts can't be used together (unoess on special pages, which are localized almost anytime). It would be great if you could find another way than double-clicking. (See also User talk:Otourly on Commons where I originally asked this). --The Evil IP address (talk) 23:52, 28 November 2009 (UTC)
 * There's a couple ways arround this. First of all, you can hold down shift well double clicking to edit, and not hold down shift to look up a word. Second of all, you can enable the reverseShift option (If your not sure how to do that, i can help you), and use the key combo ctrl+shift+l to look things up. Cheers. Bawolff ☺☻ 18:20, 29 November 2009 (UTC)

Unhiding too early
Displaying the window first and changing its contents second is ugly. Try doubleclicking on a word, then clicking away to hide the window, then doubleclicking another. First the previous definition will show up, then an empty window with the (C) footer, and the actual definition only after that. --Tgr (talk) 08:57, 4 December 2009 (UTC)
 * ✅ You're right that is ugly. It should now be fixed. Thankyou for your feedback. Bawolff ☺☻ 17:15, 4 December 2009 (UTC)

IE bug
Please see this report. JackPotte (talk) 11:34, 3 September 2010 (UTC)

Place to function
Someone on the French Wikinews is asking for the tool deactivation in the modifiable frame in Safari (which isn't the case on Firefox). JackPotte (talk) 16:48, 3 September 2010 (UTC)
 * Sorry, I don't think i understand. deactivating on safari should be same as firefox. Bawolff ☺☻ 18:54, 9 September 2010 (UTC)

Catalan
Hi, I've tested Catalan Wiktionary here, but It doesn't retrieve Catalan definitions. How can I help? --Unjoanqualsevol (talk) 19:15, 17 November 2010 (UTC)
 * Hi. Officially I've stopped supporting this tool, but your issue is an easy fix - On line 85 of wikt:ca:Mediawiki:extractFirst.xsl change:

var extractCurLangName = / \s*]*?>\[]*?>\w+<\/a>\](?:<\/?span[^>]*>\s*){,2}]*>(.+?)<\/a>(?:<\/span>){,2}<\/h2>$/; //first subexpression to var extractCurLangName = / \s*]*?>\[]*?>\w+<\/a>\](?:<\/?span[^>]*>\s*){0,3}]*>(.+?)<\/a>(?:<\/span>){0,2}<\/h2>/; //first subexpression and that should hopefully fix the issue. Bawolff ☺☻ 20:12, 17 November 2010 (UTC)
 * Thanks for quick support. I've contacted with a Catalan Wiktionary admin to make theses changes. Regards,--Unjoanqualsevol (talk) 12:12, 19 November 2010 (UTC)

Persion Translations (Right-to-Left)

 * © ویکی‌واژه. منتشر شده تحت مجوز CC-BY-SA 3.0
 * خطا:
 * » بیشتر
 * » ایجاد
 * «$1» تعریف نشده است.
 * Mjbmr Talk 22:22, 2 February 2011 (UTC)

Protocol Relative URLs
Hi,

Could someone please remove all references to the http protocol from this script, to use protocol relative URLs instead?

Examples:

This is a major issue for the new https://wikiwhatever.org scheme to work.

Thanks in advance — Arkanosis ✉ 14:59, 2 October 2011 (UTC)

Compatibility with Template:lang
Would it be possible to implement a section selection according to the CSS code of the targeted word, defined through Template:lang? JackPotte (talk) 19:26, 12 January 2012 (UTC)

WiktLookup.supported too narrow
WiktLookup.supported returns false when using Chrome 16. After manually changing to true, it works perfectly. --Tgr (talk) 21:29, 7 February 2012 (UTC)

Can't create the targeted page
When the following message appears: The page you specified doesn't exist, there is still the mention to read the full article but without the, whereas we logically should see the link to create it on the Wiktionary. JackPotte (talk) 17:01, 12 August 2012 (UTC)

PS: The page you specified doesn't exist isn't translated as well. JackPotte (talk) 17:03, 12 August 2012 (UTC)

Complete failure
Since the last Mediawiki migration, this script doesn't work anymore on all the wikis. Actually, the only action is "GET http://en.wiktionary.org/w/api.php?action=parse&redirects&prop=text&format=xml&xslt=MediaWiki:extractFirst.xsl&page=have%20&lang=en [HTTP/1.0 200 OK 468ms]". So in Firefox 16 we can see nothing, with Chrome it opens a new tab, and IE and Safari open a new window. JackPotte (talk) 19:59, 14 November 2012 (UTC)
 * Sorry yeah - the fix for 39180 broke wiktLookup on non-ancient browsers. Bawolff ☺☻ 23:54, 16 November 2012 (UTC)
 * Thanks for your answer, we could maybe use the tricks which already works for the recent Firefox users into [//addons.mozilla.org/fr/firefox/addon/google-dictionary-and-google-t/?src=search Wiktionary and Google Translate]. JackPotte (talk) 10:57, 17 November 2012 (UTC)

Target=blank?
The gadget always opens new window when I double-click. Can it be changed to be a box at the same page? Infovarius (talk) 12:30, 2 June 2017 (UTC)
 * It doesn't work at all for me: Gadget "dictHover" was not loaded. Please migrate it to use ResourceLoader.
 * Moreover, I have thought we could repair the old XSS blocking problem we had with a [//doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.ForeignApi ].
 * JackPotte (talk) 09:16, 25 June 2017 (UTC)
 * My impression is this gadget hasn't worked for a long time. It's not within my expertise, though.  Possibly Amgine might know something.  --Pi zero (talk) 13:49, 25 June 2017 (UTC)
 * I believe this tool has been unmaintained since at least 2012. It was a very brittle model, requiring continuous updating and maintenance. On another hand, it showed one way the sister projects could coordinate trans-project, and in that it was a great success. -  Amgine | t 14:18, 25 June 2017 (UTC)

ReferenceError: hookEvent is not defined
Editprotected

This script now throws the following error :

Because there is a try/catch, usually the script should silently fail, but in some scenarios the script still breaks and stops execution of all the next scripts…

This script is loaded by other wikis… To fix it, there are simply two callbacks to migrate to jQuery.

References:
 * ResourceLoader/Migration guide (users)
 * ResourceLoader/Legacy JavaScript

Od1n (talk) 00:54, 7 July 2017 (UTC)


 * I was under the impression this gadget has not worked for years, not just since late 2016. See the preceding thread.  --Pi zero (talk) 12:25, 7 July 2017 (UTC)
 * Unmaintained is not quite the same as completely broken; I understand most of it still works on some of the wikis it is enabled on. - <span style="font: brush 10pt/12pt cursive;"> Amgine | t 14:17, 7 July 2017 (UTC)
 * We encountered a strange issue on fr.wiki, when using  was kind of making ineffective the try/catch of this externally loaded gadget, thus encountering the reported fatal error and breaking all the next scripts. This really has to be fixed.
 * A few tips for the (straightforward) jQuery migration:
 * jQuery makes available a normalized that you can use instead of
 * already includes  and
 * Od1n (talk) 15:08, 7 July 2017 (UTC)


 * : Because no one on en.WN is maintaining this script, I would suggest you copy the script to fr.WP and make the changes you see as necessary to fix it. You will likely also need the xslt. I believe JackPotte could be helpful in maintaining the xslt. - <span style="font: brush 10pt/12pt cursive;"> Amgine | t 15:37, 7 July 2017 (UTC)
 * The XSLT is loaded from the Wiktionary, so it is not applicable to fork it. But maybe I overlooked something? Od1n (talk) 21:09, 7 July 2017 (UTC)
 * Update: I forked the script and applied the fixes at fr:w:MediaWiki:Gadget-dictionaryLookupHover.js, and indeed, now I am encountering this error when querying a term:  Od1n (talk) 22:31, 7 July 2017 (UTC)


 * This is clearly not settled, but it doesn't seem to be a realistically pending edit-request, either. --Pi zero (talk) 22:28, 9 May 2018 (UTC)


 * This script does not work. It's throwing a lot of errors in production so I've disabled it for now. Jon (WMF) (talk) 18:55, 9 September 2020 (UTC)