Обсуждение MediaWiki:Comments.js

Последнее сообщение: 7 лет назад от Krassotkin в теме «Broken JavaScript»

Broken JavaScript

править

MediaWiki developers found that this page probably breaks JavaScript for users (example: not seeing the buttons when editing a page). You probably need to edit this .js page and/or MediaWiki:Gadgets-definition as in the examples at phabricator:T122755. List more pages to check.

If you have questions or need help, please ask at phabricator:T164242. You can login with your wiki account. Best wishes, Nemo 09:49, 14 мая 2017 (UTC)Ответить

@Krassotkin: As you asked for help in T164242: What is your question? See https://phabricator.wikimedia.org/T163540#3251139 for general info how to debug gadget problems.
MediaWiki:ticker2.js shows an error: "getElementsByClassName is not defined". The line var tickerList = getElementsByClassName(document.body, "div", "isATicker"); needs fixing by adding a document. prefix to the function. (I'd recommend anyway to replace MediaWiki:Ticker2.js if you do not actively maintain its code in your community. The file is an exact copy of an old version on English Wikinews.)
And var tOld = document.getElementById('toolbar') || document.getElementById('wpTextbox1') is null in MediaWiki:Gadget-preview.js but should not be. --AKlapper (WMF) 15:01, 14 мая 2017 (UTC)
@Krassotkin: Looking at https://ru.wikinews.org/w/index.php?title=MediaWiki%3AGadget-preview.js&type=revision&diff=499009&oldid=461606 , what is the reason to copy code from Russian Wikipedia (which will get outdated again at some point, if nobody watches the Russian Wikipedia gadget)? https://ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-preview.js&oldid=65932118 and https://ru.wikinews.org/w/index.php?title=MediaWiki:Gadget-preview.js&oldid=499009 are exactly the same code, and mw.load.loader exists to load code from another site. --AKlapper (WMF) 15:59, 14 мая 2017 (UTC)
If you have problems to load comment pages and the toolbar menu, please provide exact and clear steps to reproduce the problems, and please check the link I provided above how you could find JavaScript problems yourself. --AKlapper (WMF) 15:59, 14 мая 2017 (UTC)
@Krassotkin: https://ru.wikinews.org/wiki/MediaWiki:Gadget-preview.js infinitely loads itself. Please fix its URL (should probably point to ru.wikipedia.org instead?). --AKlapper (WMF) 17:00, 14 мая 2017 (UTC)Ответить
@Krassotkin: For the "without toolbar" one, please see https://phabricator.wikimedia.org/T163540#3251139 and https://phabricator.wikimedia.org/T164242 which explain how to find the problem and fix it. If anything is unclear with these two links, please say which line and why. Thanks! --AKlapper (WMF) 17:06, 14 мая 2017 (UTC)
  • @AKlapper (WMF): This isn't my code and I don't have time to fix it. As far as I know, this wiki does not have other specialists who can do it. As a result this wiki will be non-working only because developers have broken up API without taking care of either compatibility or correction of old code. This is an outrageous situation. --cаша (krassotkin) 18:33, 14 мая 2017 (UTC)Ответить
@Krassotkin: Generally speaking, if nobody maintains custom code on a site then maybe custom code should be kept as minimal as possible. (Regarding "breaking the API", warnings about the deprecation were shown in the Developer Console for nearly three years and the final removal was announced in numerous places.)
Anyway, the next error I get on this very page (as I am adding this comment on https://ru.wikinews.org/w/index.php?title=Обсуждение_MediaWiki:Comments.js&action=edit&section=1&debug=true ) which is shown in the Developer tools is: "ReferenceError: appendCSS is not defined". Clicking on "index.php:12:2" in that line, the Firefox browser shows that the line comes from MediaWiki:ToolbarOld.js. mw:ResourceLoader/Legacy JavaScript#wikibits.js says that you need to use mw.util.addCSS instead, and phab:T164242 shows how to use mw.loader.using to load that. But looking at the very first version in https://ru.wikinews.org/w/index.php?title=MediaWiki:ToolbarOld.js&oldid=46902 it looks a lot like a code copy from https://ru.wikipedia.org/w/index.php?title=MediaWiki:ToolbarOld.js&oldid=25260134 and that code on ruwp has seen quite some code updates in the last 7 years. Hence a similar case. --AKlapper (WMF) 20:26, 14 мая 2017 (UTC)
Вернуться на страницу «Comments.js».