Обсуждение MediaWiki:Gadgets-definition (KQvr';yuny MediaWiki&Gadgets-definition)
Dear friends; please look at the links at user:i18n#useful links. Thanks in advance! Best regards
·לערי ריינהארט·T·m:Th·T·email me· 23:10, 5 февраля 2008 (UTC)
Proposal for GoogleTrans gadget
[править код]Hi there,
Sorry about the English.
I have made a GoogleTrans gadget which has been on the enwiki for around a year now. It is also on 8 other wikipedias including the Serbian, the Macedonian, and the Ukranian.
It functions like the Google toolbar translation feature. When you position the cursor over a word in a webpage and hit the SHIFT key, the Google translation of that word (or of selected text < 500 characters) appears in a popup below the cursor.
The help page for the gadget is at:
http://en.wikipedia.org/wiki/User:Endo999/GoogleTrans
(This has instructions on how to port over to other wikis).
and the code for it is at:
http://en.wikipedia.org/wiki/User:Endo999/GoogleTrans.js
It really works well for people who have intermediate Russian as they can easily look up a word they don't know (every 2 or 3 sentences). This is how I use the tool to read French and Spanish webpages. However, the person who knows no Russian (like me) can simply select a sentence or two and have it translated as well. In each popup there is a link to Google Translation Services. If you click on this link then the whole page is translated.
Good luck with your ruwiki and your postSoviet Russian state.
Endo999 01:46, 9 сентября 2010 (UTC)
Architecture
[править код]@Krinkle: hello! I know, you are interested in gadgets extension. We refactored the code last month and what do you think about it (look at the first block of gadgets and our Common.js)? How we can improve it? С уважением, Iniquity 20:40, 4 октября 2017 (UTC)
- I would like to add that, as one can infer from the gadget list, we're really missing a mechanism that will enable us to run gadgets only on pages with certain action value, certain page name in Special namespace, and certain namespaces. While there is no such, we load these gadgets manually in MediaWiki:Common.js depending on those parameters. One more thing, we noticed that in Chrome, gadgets loaded with
mw.loader.using
are taken from localStorage subsequently, but Firefox makes a HTTP request for these modules each time. Do you know why this happens? — Джек, который построил дом (обс.) 02:51, 5 октября 2017 (UTC)
Moving off of targets
[править код]Hey User:Stjn Russian Wikipedia is only one of two wikis (the other being Hungarian) that are still using this feature.
What do you need to get the scripts you are still targeting to desktop working on the Minerva / mobile skin?
In case it wasn't clear I'm still keen to remove this behaviour, preferably during the course of this year as it's an anti-pattern that I'd like to discourage. For the modules you are retaining - I assume you are using targets rather than skins as you need them to work on Minerva, but only on the desktop skin. What exactly is missing in terms of API to make this happen?
If you are removing them purely for performance, I'd also be interested in any skipFunctions that we could add to support that use case. e.g. Don't load code X when Y.
Thanks in advance for your assistance here. Jon (WMF) (обс.) 20:42, 20 июля 2023 (UTC)
- @Jon: Most of those targets were added in the aftermath of your changes to the targets system where the gadgets were broken for one reason or another. I can list specifics as to why those were added:
a) collapserefs collapses references for editors that have used a toggle on desktop, where it makes sense, but doesn’t do that on mobile, where the sections are already collapsed. (In my opinion, it is somewhat unneeded, but I do not want to spend time in discussions around it.)
b) directLinkToCommons broke MediaViewer specifically on the mobile website, see Википедия:Форум/Технический#Картинки в мобильной версии for details.
c) wikibugs is a gadget that works for desktop site sidebar, but doesn’t work for mobile site sidebar. I suppose since Minerva doesn’t implement actual sidebar navigation, that can be safely changed to skins=.
d) navboxNavigation is a gadget that provides navigation between navboxes with template links provided inside of them. It makes sense to enable it on desktop website, since it has navboxes, and disable it on mobile website.
I can elaborate if you have further questions. stjn 22:44, 20 июля 2023 (UTC)- Thanks @Stjn that's super helpful. I've added these to phab:T342567
- It does seem like you are having to work around MediaWiki tech debt. I personally would recommend enabling all of these gadgets in the mobile site, and adding checks at the top of the page so that when the upstream bug gets fixed these gadgets will just work™.
- Here's some specific recommendations:
- a) How about MediaWiki:Gadget-collapserefs.js checks
if ( $('.collapsible-heading').length ) { return; }
- Note: Vector 2022 can also have collapsible sections so this would future proof if that changed too: https://ru.m.wikipedia.org/wiki/Восстание_в_Дагестане_(1920—1921)?useskin=vector-2022
- b) Rather than working around technical debt of phab:T65504 you could add the following check to MediaWiki:Gadget-directLinkToCommons.js:
if ( mw.loader.getState('mobile.startup') === 'registered' ) { return; }
- c) The MediaWiki:Gadget-wikibugs.js looks like the easiest to fix. It seems like a better fit with the toolbox, since it relates to the page, so perhaps it could be moved there (toolbox is supported for logged in users on Russian mobile Wikipedia)
- d) The MediaWiki:Gadget-navboxNavigation.js could add the following check which would mean the gadget would work if phab:T124168 ever got resolved:
if ( ! $('.navbox' ).length ) { return; }
Jon (WMF) (обс.) 18:57, 24 июля 2023 (UTC)
- @Stjn: thanks for the feedback on phab:T342567#9042292. Given what you said there, does that mean my recommendations here make sense? If not, keen to think about this further! Having wikibugs on mobile in particular seems pretty cool to me as I'd love to give users there more power for raising bugs! Jon (WMF) (обс.) 20:58, 28 июля 2023 (UTC)
- Sorry for not replying here earlier. Yeah, most of these make sense, but on most of these, I think, switching to loading via MediaWiki:Common.js makes more sense. wikibugs.js in particular seems like a thing that shouldn’t have been written to load on all pages despite its actual usage statistics. Same with navboxNavigation (it doesn’t actually need that check with its current code btw, it just doesn’t need to be loaded on pages without navboxes, that’s why I added the check). I’ll do the change to directLinkToCommons now. I don’t see how reducing the payload as described in phab:T340705 can be done via small checks like these, tbh. Seems like a better solution is to move some gadgets to only load in contexts where they’re actually needed. stjn 21:07, 28 июля 2023 (UTC)
- I didn’t check this myself, but
mw.loader.getState( 'mobile.startup' ) === 'registered'
is true even on desktop. So it needs to be some other check. Currently I’ve just decided to ignore Minerva until we can come up with a better one. stjn 21:37, 28 июля 2023 (UTC)
- I didn’t check this myself, but
- Sorry for not replying here earlier. Yeah, most of these make sense, but on most of these, I think, switching to loading via MediaWiki:Common.js makes more sense. wikibugs.js in particular seems like a thing that shouldn’t have been written to load on all pages despite its actual usage statistics. Same with navboxNavigation (it doesn’t actually need that check with its current code btw, it just doesn’t need to be loaded on pages without navboxes, that’s why I added the check). I’ll do the change to directLinkToCommons now. I don’t see how reducing the payload as described in phab:T340705 can be done via small checks like these, tbh. Seems like a better solution is to move some gadgets to only load in contexts where they’re actually needed. stjn 21:07, 28 июля 2023 (UTC)
- > It seems like a better fit with the toolbox, since it relates to the page, so perhaps it could be moved there
@Jon, that can only be done via adding new code for Minerva (and to a lesser extent) new Vector skins, btw. Currently the link is present in MediaWiki:Sidebar, and doesn’t need to be generated via mw.util.addPortletLink. You cannot add items to toolbox that way, so code would need to be written to add it to that portlet. I can do that, but it’s hard to see a rationale in it while new Vector is not a thing in Russian Wikipedia (thankfully—too many egregious bugs that are going unfixed still) and Minerva doesn’t have tools for anonymous or the majority of users without AMC (AFAIK, that might not be true?). stjn 21:18, 28 июля 2023 (UTC)- Just to check I understand - you need to support for edits that introduce links to toolbox? e.g. phab:T6086? Jon (WMF) (обс.) 21:02, 18 сентября 2023 (UTC)
- Yes, if we move the link to that page/interface there. stjn 21:07, 18 сентября 2023 (UTC)
- Hi @User:Stjn, just to let you know there has been a decision to remove support for targets in gadgets (There is a message in this week's tech news and this will go int effect 1st February). Currently only Russian and Hungarian Wikipedia are using this feature and it doesn't make sense to support this feature for just 2 our wikis.
- Following the conversation above, my understanding is this impacts the wikibugs, navboxNavigation and navboxFeaturedArticles modules.
- I've patched the former to work in mobile as well as desktop and my understanding is for the latter two, the plan is to move the loading of these gadgets into MediaWiki:Common.js (rather than using the "default" mechanism).
- I'm happy to make the above changes before the switchover on Thursday, but as a courtesy I wanted to let you know in case you want to take an alternative approach to solving this problem (or would prefer to do this yourself).
- Let me know how I can support Russian Wikipedia making this transition.
- On the long run - I'm hoping to champion for some better infrastructure in the gadgets ecosystem to support link addition and to find a better solution than the status quo for navboxes on mobile.
- I hope you have a great weekend. Jdlrobson (обс.) 21:38, 26 января 2024 (UTC)
- @Jdlrobson: for personal reasons I cannot be much help with this right now. I’ll have to look at this in March if I don’t forget to. I trust you to use your best judgment to make the necessary gadget changes (and will fix some things where it makes sense). stjn 19:58, 29 января 2024 (UTC)
- Hey there sorry I happened to see you were on a wiki-break after posting this message so I've started to work on migrating these for you.
- I'll follow up here with a comment around exactly what I've done so you can review when you get back.
- Enjoy your break and look forward to having you back in March! Jdlrobson (обс.) 21:19, 29 января 2024 (UTC)
- There is a difference between the previous state and what you have done, though: previously you could opt out of just one of the gadgets, now you cannot. It was probably not the best to bundle them. stjn 21:26, 29 января 2024 (UTC)
- Okay this is now done.
- Summary of changes are as follows:
- 1) Wikibugs now loads on Minerva skin (and mobile): https://ru.wikipedia.org/w/index.php?title=MediaWiki%3AGadgets-definition&diff=135809831&oldid=135649420
- 2) Wikibugs script will now create a link if none exists. It will put this link in the toolbox (... menu) if available, or at the bottom of page (if not): https://ru.wikipedia.org/w/index.php?title=MediaWiki%3AGadget-wikibugs.js&diff=135809910&oldid=115934349
- 3) I created a new module ext.gadget.navboxDefaultGadgets that checks if navboxes are in the page, and pulls in ext.gadget.navboxFeaturedArticles and navboxNavigation in if the user has the correct user rights. https://ru.wikipedia.org/w/index.php?title=MediaWiki%3AGadget-navboxDefaultGadgets.js
- 4) I updated the logic for default to default to the new ext.gadget.navboxDefaultGadgets module.
- https://ru.wikipedia.org/w/index.php?title=MediaWiki%3AGadgets-definition&diff=135865845&oldid=135861505
- 5) I will send a note to Village technical pump [[D0%92%D0%B8%D0%BA%D0%B8%D0%BF%D0%B5%D0%B4%D0%B8%D1%8F:%D0%A4%D0%BE%D1%80%D1%83%D0%BC/%D0%A2%D0%B5%D1%85%D0%BD%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9#Updates_to_Navbox_gadgets]] (@Stjn I believe this addresses your last note - but let me know if I've misunderstood - I'm sure others will let me know if they are disrupted and I'll be happy to follow up) Jdlrobson (обс.) 21:31, 29 января 2024 (UTC)
- @Jdlrobson: for personal reasons I cannot be much help with this right now. I’ll have to look at this in March if I don’t forget to. I trust you to use your best judgment to make the necessary gadget changes (and will fix some things where it makes sense). stjn 19:58, 29 января 2024 (UTC)
- Yes, if we move the link to that page/interface there. stjn 21:07, 18 сентября 2023 (UTC)
- Just to check I understand - you need to support for edits that introduce links to toolbox? e.g. phab:T6086? Jon (WMF) (обс.) 21:02, 18 сентября 2023 (UTC)
Права для userrights
[править код]Зачем оно доступно всем? [1] MediaWiki:Gadget-common-special-userrights.js ~~~~ Jaguar K · 04:30, 23 декабря 2023 (UTC)
- Не нашёл права, которое бы позволило отключить гаджет неадминистраторам и небюрократам. Сейчас посмотрел и увидел одно такое. Исправлю. stjn 13:08, 23 декабря 2023 (UTC)
- А, ясно, дело в бюрократах. Думал почему не block. ~~~~ Jaguar K · 02:02, 24 декабря 2023 (UTC)