Discussion MediaWiki:Gadget-TargetedTranslations.js

Le contenu de la page n’est pas pris en charge dans d’autres langues.
Définition, traduction, prononciation, anagramme et synonyme sur le dictionnaire libre Wiktionnaire.

Installation[modifier le wikicode]

I don't think this gadget will be able to work here unless the translationtargetstar and translationtargetstarchecked CSS classes from en:Mediawiki:Common.css and the newNode function from en:Mediawiki:Common.js are also imported. --Yair rand 23 février 2011 à 10:41 (UTC)[répondre]

fait Thanks a lot. JackPotte ($) 23 février 2011 à 19:05 (UTC)[répondre]

La fonction apparait dans tout menu déroulant : synonymes, dérivés… JackPotte ($) 25 février 2011 à 20:16 (UTC)[répondre]

Changing
  for (var i=0; i<tables.length; i++) {
     if (tables[i].className == 'translations') {
to
  function checkIsTransTable(node) {
     while(node.className != "boite") {
       node = node.parentNode;
       }
     while(node && node.nodeName.substr(0,1) != "H") {
       node = node.previousSibling;
       }
     return /Traductions/.test(node.innerHTML)
     }
     
  for (var i=0; i<tables.length; i++) {
     if (tables[i].className == 'translations' && checkIsTransTable(tables[i])) {
would fix it, I think. --Yair rand 27 février 2011 à 17:53 (UTC)[répondre]
Perfectly, however the other gadget editor.js supprimé pour laisser place à une nouvelle version — Automatik (discussion) 21 août 2014 à 12:19 (UTC) also do it and doesn't have these lines… JackPotte ($) 27 février 2011 à 19:37 (UTC)[répondre]
The same function could work. Editor.js also has a for (var i=0; i<tables.length; i++) followed by an if statement checking if it's a translation table, near the bottom of TranslationsAdders. If the checkIsTransTable function was also copied there and the if bit also had && checkIsTransTable(tables[i]) added to it, it could work. --Yair rand 27 février 2011 à 23:41 (UTC)[répondre]