Extension talk:GlobalCssJs
Add topic| This page used the Structured Discussions extension to give structured discussions. It has since been converted to wikitext, so the content and history here are only an approximation of what was actually displayed at the time these comments were made. |
Home wiki
[edit]Would it not make a lot more sense to load a users' global scripts from its home wiki, as designated in Special:CentralAuth? I am rarely on meta, so requiring users to store their global code there seems overly complicated. -- [[User:Edokter]] {{talk}} 14:42, 14 July 2014 (UTC)
- Nope. Or at least this is something I wouldn't be able to see as an improvement until CentralAuth has a way to set your home wiki. MediaWiki.org is my home wiki in terms of edits and user rights and overall activity, but CA thinks my home wiki is test.wikipedia.org, where I have a whopping nine (!) edits and some user rights. So no, I wouldn't want to have my global CSS & JS stored on test.wikipedia.org; Meta in the context of WMF wikis makes total sense to me as it's a central place for coordination. Jack Phoenix (Contact) 15:47, 14 July 2014 (UTC)
- Yes, what Jack said. CentralAuth has some unreliable criteria with which it picks a home wiki, and it's really only used to figure out who wins the account. Also, from a security perspective it is much safer to only allow meta admins to edit your global scripts, as opposed to any testwiki admin :/. Legoktm (talk) 18:24, 14 July 2014 (UTC)
- +1 Helder.wiki 14:27, 16 July 2014 (UTC)
Ability to exclude a wiki?
[edit]- @Legoktm: Is there an ability to exclude wikis? For instance, I wish to exclude English Wikisource from my global rollout, as I use other tools there and addition of global.js causes issues. I thought that the script configuration looked to sectionalise what was rolled where, however, I see that the output of
onEveryWiki()is additive. Thanks. — billinghurst sDrewth 04:06, 28 August 2014 (UTC)- You can wrap your global.js in:
- Legoktm (talk) 05:24, 28 August 2014 (UTC)
if ( mw.config.get("wgDBname") !== "enwikisource" ) { // Whatever JavaScript you want to run on all wikis but enwikisource }
- hmm, for me this doesn't work... XXN (talk) 00:58, 20 January 2016 (UTC)
- Can you expand on how it's not working? Legoktm (talk) 22:39, 20 January 2016 (UTC)
- @Legoktm: Please take a look at my global.js; I tried to disable my personal popups.js on Wikidata and edittop.js on ruwiki and enwiki, but both these scripts continue to be loaded everytime on the specified wikis. XXN (talk) 19:20, 25 January 2016 (UTC)
- Ah, found, fixed, works. If for wikisource it's necessary to specify long DB name (i.e.: "enwikisource"), for wikipedias it's necessary to specify short DB name (for example "enwiki"). XXN (talk) 11:40, 13 February 2016 (UTC)
Add a link to special pages of local wikis
[edit]@Legoktm: Is there a possibility to add a link to special pages, which changes for every wiki? With local js I used to link to "https://it.wikivoyage.org/wiki/Special:UnconnectedPages", "https://it.wikiquote.org/wiki/Special:UnconnectedPages" etc. How can I do now with global js? Does it exist something like "http://LOCALWIKI/wiki/Special:UnconnectedPages", so if I'm on it.quote it will link to https://it.wikiquote.org/wiki/Special:UnconnectedPages, if I'm on en.voy it will link to https://en.wikivoyage.org/wiki/Special:UnconnectedPages etc.? Superchilum (talk) 09:20, 28 August 2014 (UTC)
- You can use:
var url = "https:" + mw.config.get('wgServer') + "/wiki/Special:UnconnectedPages";
- And use the
urlvariable wherever you need it. Legoktm (talk) 20:49, 28 August 2014 (UTC)- @Legoktm: Thanks :-) I've modified accordingly, but no link appears... why? Superchilum (talk) 09:16, 29 August 2014 (UTC)
mw.util.getUrlreturns a relative URL, but it should suffice for your purposes.- Example:
mw.util.getUrl('Special:UnconnectedPages')
- Using my superpower, I guessed that you enabled the "collegamenti personali" gadget on the Italian Wikipedia. Unfortunately, it doesn't work on Meta-Wiki, but you can still use the standard
mw.util.addPortletLinkfunction: - Ricordisamoa 04:36, 4 September 2014 (UTC)
mw.util.addPortletLink( 'p-navigation', mw.util.getUrl('Special:UnconnectedPages'), 'Pagine non connesse', 'unconnected-pages' );
- @Ricordisamoa: Thank you so much, it does work!
- Regarding the "collegamenti personali" gadget, do you mean I can delete the line from my global.js? Superchilum (talk) 08:12, 5 September 2014 (UTC)
Automated deletions by User:Maintenance script
[edit]Hi. At es.wikibooks I've noticed the following:
- 04:42 7 sep 2014 Maintenance script (discusión | bloquear) borró Usuario:Makecat/common.js (Deleting JavaScript page on user request due to deployment of mw:Help:Extension:GlobalCssJs) (ver/restaurar)
I wonder if those who have dozens of crosswiki .css/.js pages such as me can also "order" that script to perform the cleanup or is just reserved for users with higher levels of access in the DB. If possible, how is it done? - I have translated some system messages regarding this on betawiki, but I can't figure out how to run that cleanup.
Best regards. -- MA 00:51, 22 November 2014 (UTC)
- That was a script that was run server-side by Krinkle and myself during the initial migration. I'd recommend you file a request with m:Synchbot and Pathoschild can delete them for you. Legoktm (talk) 19:30, 22 November 2014 (UTC)
- Thanks for you reply. Isn't the script working anymore then? I filed both a request on Meta for your script and Pathoschild's one. Best regards. --Marco Aurelio (talk • meta) 15:28, 6 December 2014 (UTC)
- It probably still works but had issues with being blocked by the AbuseFilter, and was generally less flexible than Pathoschild's script was, which is why I've been letting him take care of it. Legoktm (talk) 22:47, 13 January 2015 (UTC)
- Thanks for you reply. Isn't the script working anymore then? I filed both a request on Meta for your script and Pathoschild's one. Best regards. --Marco Aurelio (talk • meta) 15:28, 6 December 2014 (UTC)
Per-skin customization works
[edit]See Phabricator T63748. I can confirm that it works in what's currently shipping. 71.36.99.196 (talk) 06:43, 19 December 2016 (UTC)
Strange wording
[edit]Quote from the article:
"Functions like <code>importScript</code> will not work as those use the local wiki, not the global one."
I cannot seem to figure out the meaning of this sentence.
Can someone help?
best regards, KaiKemmann (talk) 11:41, 31 July 2017 (UTC)
- First, you are talking in the wrong thread, or for the wrong page, since the quotation is occurring on Help:Extension:GlobalCssJs.
- Second, the grammar is not pretty indeed, could be read as "nor the global one", but actually means: An importScript() call will refer to the local wiki currently in use, not to a page with this name on Meta wiki, which is usually not intended.
- Third, it says that using global resources, you are encouraged to use full URL including project domain, if it shall be shared among all wikis, since importScript() calls are related to pages on current local wiki. PerfektesChaos (talk) 12:20, 31 July 2017 (UTC)
- The Help talk:Extension:GlobalCssJs page redirects here.
- I've tried to fix the sentence using an adaptation of your wording. If you can make it better, please do! Quiddity (WMF) (talk) 15:59, 31 July 2017 (UTC)
Import local script globally
[edit]I've noticed that you can apparently import a local script and make it global. How do you do that? Can I Log In (talk) 00:07, 13 May 2020 (UTC)
- You can pass the raw URL of the script to
mw.loader.loadin your global JavaScript. For example, I load - en:User:Pppery/no-ooui-contribs.js
- in m:User:Pppery/global.js using
mw.loader.load("https://en.wikipedia.org/w/index.php?action=raw&title=User:Pppery/no-ooui-contribs.js&ctype=text/javascript"). * Pppery * it has begun 00:38, 13 May 2020 (UTC) - So what I'm seeing here is that you need the "&action=raw" and "&ctype=text/javascript". Is this how it's done? Can I Log In (talk) 03:31, 13 May 2020 (UTC)
- Well, that's how I do it at least, and it works for me. If you want a more detailed explanation, you should probably ask at Project:Support desk or w:Wikipedia:Village pump (technical), since this talk page is fairly low traffic and I only noticed your post via recent changes patrol. * Pppery * it has begun 03:33, 13 May 2020 (UTC)
- The help docs are at Help:Extension:GlobalCssJs. Looking at examples used by other active users is generally the best way to learn. :) –Quiddity (talk) 16:42, 13 May 2020 (UTC)