MediaWiki talk:Gadget-TabbedLanguages.js

From Wiktionary, the free dictionary
Jump to navigation Jump to search

Page body moves when I hover over a tab[edit]

For example, if I'm at [[utrum#Latin]], and I pass the mouse/cursor over "Swedish", "Swedish" moves left and back, and the whole page-body moves with it. (The converse is not true: if I'm at [[utrum#Swedish]], passing the cursor over "Latin" only moves "Latin", not the whole page-body, apparently because "Swedish" is longer than "Latin".) —RuakhTALK 18:51, 15 October 2012 (UTC)[reply]

Hm. Hopefully there will be a way around that. I've reverted the change that caused this for now. --Yair rand (talk) 19:03, 15 October 2012 (UTC)[reply]

Auto-addition of hash is kind of annoying.[edit]

Maybe this is just me, but I find it kind of annoying when I visit http://en.wiktionary.org/wiki/tekem%C3%A4st%C3%A4 and the URL gets automatically changed to http://en.wiktionary.org/wiki/tekem%C3%A4st%C3%A4#Finnish. —RuakhTALK 17:57, 29 December 2012 (UTC)[reply]

However, if the url doesn't contain this extra data, then it often won't reflect the correct section. If a user copies a url to send to someone else, it would be better to have it include the language section, or else the person receiving it might be directed to the wrong section and get very confused. Also, there doesn't appear to be any way to have the back button reliably go to the right section in IE9< and FF3.6 without the script adding the section to the url's hash. --Yair rand (talk) 17:27, 30 December 2012 (UTC)[reply]

Vietnamese version[edit]

I implemented this gadget at the Vietnamese Wiktionary. Since the standard entry layout and syntax is different there, I ended up writing it from scratch. It lacks all the special functionality around live preview, but it does have some additional features that might be worth exploring here:

  • The hash doesn't have to match exactly. Every language heading has Unicode characters, for example "Tiếng Việt" for Vietnamese, which MediaWiki annoyingly turns into "Ti.E1.BA.BFng_Vi.E1.BB.87t". The gadget lets you type "#Tiếng Việt" or even "#vie" (ISO 639-2 code) into the URL bar to display the same tab; the gadget rewrites the hash automatically. It would be nice if the English version did this for turning spaces into underscores or allowing case-insensitive matching.
  • When you print an entry or view the printable version of an entry, the gadget temporarily pulls apart the tabs so that you can see the entire entry (the contents of every tab) on your printed copy.
  • When you make the window too narrow, the tabs become horizontal tabs to save space.
  • It doesn't really matter here, since this wiki uses {{l}} consistently, but the Vietnamese version also appends the current tab's hash to links listed under headings like "Related terms" and "Homophones".

Try it out: go here and check "Organize each entry into tabs by language" (under "Navigation"). Then view an entry like "a" or "para".

Unfortunately, the gadget I wrote ended up being so different than this one that probably none of the code could be reused as is. But it would be nice to have some of these extra features here too.

 – Minh Nguyễn 💬 20:51, 15 January 2015 (UTC)[reply]

The Vietnamese Wiktionary version of this gadget has been enabled by default since 2015, so you don't need to enable it manually to see it in action. I recently upgraded it to use OOUI instead of jQuery UI, which is now deprecated. The booklet layout with tabs on the side felt too heavyweight for this purpose, so I changed it to an index layout, with tabs on the top. The tab bar ends up being a bit less discoverable, but that could be solved with a modicum of CSS by applying display: sticky. Minh Nguyễn 💬 23:43, 21 December 2021 (UTC)[reply]

Country Flags[edit]

This doesn't work with the Country Flags gadget. Is this an insurmountable problem? TIA HAND —Phil | Talk 16:39, 23 July 2018 (UTC)[reply]

I'm not even sure where the flags would go. At the top of the section? In the tab? I don't think trying to fit it in would be a good idea, and it might mess things up a bit. --Yair rand (talk) 04:29, 25 July 2018 (UTC)[reply]

Suggestion: user-selected default language[edit]

When I come to wiktionary it's to look up the definition of a word in a specific language. If that language isn't english and that word has meanings in multiple languages, this adds a bit of searching/clicking to get to that language. To get around this I've added a greasemonkey script that sets the anchor to the language I want, in my case "#French". Adding this as an option I think would be quite useful, however I don't know how to propose changes other than here.

The script I'm using (pretty brute-force without any options):

(function() {
    'use strict';
    if (window.location.hash !== 'French') {
        window.location.hash = 'French';
    }
})();

— This unsigned comment was added by Alwaysmpe (talkcontribs) at 17:43, 19 January 2021‎.

Unable to access non-English languages[edit]

When I activate this via Preferences, all languages except English are hidden. I can see the language tabs, but clicking them does nothing.

Relevant JavaScript console output:

console.trace() In AdderWrapper v1.0 7 dread:435:77
AdderWrapper https://en.wiktionary.org/wiki/dread#Portuguese line 10 > injectedScript:435
TranslationAdders https://en.wiktionary.org/wiki/dread#Portuguese line 10 > injectedScript:399
jQuery 2
TranslationAdders https://en.wiktionary.org/wiki/dread#Portuguese line 10 > injectedScript:399
<anonymous> https://en.wiktionary.org/wiki/dread#Portuguese line 10 > injectedScript:402
jQuery 11
<anonymous> https://en.wiktionary.org/wiki/dread#Portuguese line 10 > injectedScript:402
runScript https://en.wiktionary.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=timeless:11
execute https://en.wiktionary.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=timeless:13
doPropagation https://en.wiktionary.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=timeless:6
(Async: requestIdleCallback handler)
setAndPropagate https://en.wiktionary.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=timeless:7
implement https://en.wiktionary.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=timeless:18
<anonymous> https://en.wiktionary.org/wiki/dread#Portuguese line 10 > injectedScript:1
domEval https://en.wiktionary.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=timeless:10
asyncEval https://en.wiktionary.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=timeless:15
(Async: requestIdleCallback handler)
asyncEval https://en.wiktionary.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=timeless:15
work https://en.wiktionary.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=timeless:17
enqueue https://en.wiktionary.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=timeless:11
load https://en.wiktionary.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=timeless:18
<anonymous> https://en.wiktionary.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=timeless:55
<anonymous> https://en.wiktionary.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=timeless:55
This page is using the deprecated ResourceLoader module "jquery.ui".
Please use OOUI instead. load.php:1:80
Some cookies are misusing the recommended “SameSite“ attribute 3
This page is using the deprecated ResourceLoader module "jquery.tipsy". dread:1:83

Daask (talk) 00:58, 29 April 2022 (UTC)[reply]