User talk:Enterprisey/script-installer
Feature request: generate code that matches {{subst:iusc}}Here's my common.js right now. importScript( 'User:Enterprisey/script-installer.js' ); // Backlink: User:Enterprisey/script-installer.js importScript('User:Enterprisey/easy-brfa.js'); // Backlink: User:Enterprisey/easy-brfa.js importScript('User:Enterprisey/cv-revdel.js'); // Backlink: User:Enterprisey/cv-revdel.js importScript('User:Enterprisey/reply-link.js'); // Backlink: User:Enterprisey/reply-link.js importScript('User:Enterprisey/talk-tab-count.js'); // Backlink: User:Enterprisey/talk-tab-count.js importScript('User:Enterprisey/user-tabs-on-contribs.js'); // Backlink: User:Enterprisey/user-tabs-on-contribs.js Does that bug you? It bugs me. Would it be possible to change script-installer to match {{subst:iusc}}'s output? (For that matter, is there a reason it doesn't just generate that subst in the first place? DRY and all that.) Gaelan 💬✏️ 09:39, 24 February 2019 (UTC)
Global@Enterprisey: It would be neat if this script was extended to allow installing scripts on global.js, too. ~★ nmaia d 01:05, 15 September 2020 (UTC)
TODO: Bulk deletion supportWith checkboxes. Enterprisey (talk!) 04:10, 26 January 2021 (UTC)
id vs data-I don't think relying on IDs for getting script paths is a good idea as it results in invalid HTML if the same path appears more than once per page. Shouldn't it use a scriptManager@Enterprisey: It would be helpful if you added a function allowing you to add scripts using scriptManager's syntax. ― Qwerfjkl | 𝕋𝔸𝕃𝕂 (please use
Lusc instead of iuscThis script still seems to be using {{Iusc}}, rather than {{Lusc}}, which I understand to be the preferred method. Enterprisey, would it be possible to update that? {{u|Sdkb}} talk 03:47, 23 November 2021 (UTC)
Various to-dos@Enterprisey: Now that phab:T300743 is fixed, I can list the other to-do items that I noticed while looking for XSS issues. These are all suggestions for future development that you can take or leave as you see fit.
Best — Mr. Stradivarius ♪ talk ♪ 13:33, 7 February 2022 (UTC) unable to uninstall autoFormatter & cleanDiff@Enterprisey: i am unable to uninstall both autoFormatter & cleanDiff on common.js. can you please look into it. <_> jindam, vani (talk) 13:56, 27 December 2022 (UTC)
Recognize Full Protection@Enterprisey Currently, the script claims that Wikipedia:AutoEd/complete.js is insecure, in spite of the full protection. Could support be added? Aaron Liu (talk) 16:56, 13 September 2023 (UTC) Should script-installer add userscript pages to the watchlist?Working on userscripts sometimes requires discussion. Because script-installer is a gadget, this talk page is relatively active, but this is not true for all userscripts. In a recent case, I posted on the talk page of the author, because the script didn't have an existing talk page (both documentation and the code talk pages don't exist at the time of writing). However, in another case I created a talk page corresponding to the script's documentation page and pinged the author. Technically, due to backlinks generated by automatic script installation, I could figure out all the users, but pinging or messaging them would be way too much spam, which is disruptive. What if script-installer automatically added/removed the pages (documentation and .js) of a userscript being installed/uninstalled to the watchlist? This would keep the users informed of any updates that might affect them, and maybe encourage their participation in discussions. On the other hand, such automatic meddling with the watchlist might annoy some users. —andrybak (talk) 13:11, 4 June 2024 (UTC)
I have implemented this proposal in my sandbox: Special:Diff/1231540064/1231548208. During installation, the gadget will automatically add the source code page (example: User:Shubinator/DYKcheck.js) and the documentation page (example: User:Shubinator/DYKcheck) to the watchlist. During uninstallation, the gadget will automatically remove the pages from the watchlist. The customization of this automatic watching/unwatching feature can be done via two new options: window.scriptInstallerWatch = false; // disable automatic watching
window.scriptInstallerUnwatch = false; // disable automatic unwatching
There are two options rather than one, because there are use-cases for all four combinations:
What do you think? —andrybak (talk) 22:27, 28 June 2024 (UTC)
Confusing history of importScriptDue to some confusing discussions around functions I've considered different places for this discussion. The most automated way of installing script nowadays is the installer gadget, so I selected this talk page. —andrybak (talk) 12:27, 7 June 2024 (UTC) Timeline of importScript
Feel free to edit this timeline if you find mistakes, anything relevant turns up, or to improve formatting. —andrybak (talk) 12:27, 7 June 2024 (UTC)
Discussion – Confusing history of importScriptIt seems that most of the confusion was caused by the discrepancies between three sources of information: source code, mw:ResourceLoader/Legacy JavaScript, and mw:ResourceLoader/Migration guide (users). Hopefully this will clear up any confusion and clarify why people were confused. Let me know, if there are any other discussions. Courtesy pings to other participants of discussions and tickets: He7d3r, Skizzerz, Gary, Mdowdell. —andrybak (talk) 12:27, 7 June 2024 (UTC)
"Normalize" function breaks CSS importsEdit Jack who built the house (talk) 15:50, 13 July 2024 (UTC)
Add |
This edit request to mediawiki:gadget-script-installer-core.js has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Otherwise, when selecting the page title, the selection spreads to the script's links:
Jack who built the house (talk) 12:41, 16 August 2024 (UTC)
- I've been using it in my sandbox version. Seems good so far, no issues found. —andrybak (talk) 00:05, 21 August 2024 (UTC)
- Is there something wrong with making links selectable? This is the standard behavior for almost all links on websites, right? Might be counter-intuitive to turn it off. –Novem Linguae (talk) 21:56, 27 August 2024 (UTC)
- I think this is pretty much like how
.mw-editsection
[ edit | edit source ] hasuser-select: none
. Jack who built the house (talk) 23:59, 27 August 2024 (UTC) - It makes copying the page title harder, as triple-clicking it also ends up selecting the install link. This is different from, for instance, how you can triple-click a section header to select just the header, not the edit links. – SD0001 (talk) 15:12, 28 August 2024 (UTC)
- Done (except I added it to the CSS rather than the JS) * Pppery * it has begun... 16:15, 9 November 2024 (UTC)
- I think this is pretty much like how
Interface-protected edit request on 20 August 2024
This edit request to MediaWiki:Gadget-script-installer-core.js has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
On MediaWiki:Gadget-script-installer-core.js#L-590, please replace the line with the following:
const scriptName = this.id.replaceAll("_", " ");
This will convert underscores to spaces, which will prevent duplicate script installs and false reports that a script that is installed isn't installed. Awesome Aasim 16:57, 20 August 2024 (UTC)
- Use
.replace(/_/g, " ")
instead of.replaceAll("_", " ")
, which is not supported by some Grade A browsers. Nardog (talk) 01:43, 21 August 2024 (UTC)- Also per the style followed in the script, the space should be in single quotes. – SD0001 (talk) 10:50, 27 August 2024 (UTC)
- @Awesome Aasim:: Do you have an example of this actually occurring in the wild? From my brief testing, it looks like the element id that this is keying off of is alredy normalized with respect to spaces/underscores. Writ Keeper ⚇♔ 17:02, 31 August 2024 (UTC)
- @Writ Keeper It is happening to me. I install a script and in some places it shows as not installed and in other places it shows as installed. It is a mess. Awesome Aasim 17:49, 31 August 2024 (UTC)
- I was looking for some specifics. What script, where are you seeing this, where are you not seeing this, etc. Writ Keeper ⚇♔ 21:17, 31 August 2024 (UTC)
- I just created an example script to demonstrate my point. See User:Awesome Aasim/example script.js and User:Awesome Aasim/example script. Awesome Aasim 23:10, 31 August 2024 (UTC)
- That works correctly for me. What behavior are you seeing that seems wrong? Writ Keeper ⚇♔ 00:53, 1 September 2024 (UTC)
- For one, the script shows with underscores. The other, the script shows with spaces. See [1]. Awesome Aasim 02:30, 1 September 2024 (UTC)
- Not done There does not seem to be sufficient agreement here to make an edit to a widely used gadget. * Pppery * it has begun... 16:16, 9 November 2024 (UTC)
- I don't think consensus is needed to fix an obvious bug. User:Nardog seems to have a good suggestion. Awesome Aasim 19:51, 22 November 2024 (UTC)
- Ping User:Nardog for above. Awesome Aasim 19:52, 22 November 2024 (UTC)
- Not done There does not seem to be sufficient agreement here to make an edit to a widely used gadget. * Pppery * it has begun... 16:16, 9 November 2024 (UTC)
- For one, the script shows with underscores. The other, the script shows with spaces. See [1]. Awesome Aasim 02:30, 1 September 2024 (UTC)
- That works correctly for me. What behavior are you seeing that seems wrong? Writ Keeper ⚇♔ 00:53, 1 September 2024 (UTC)
- I just created an example script to demonstrate my point. See User:Awesome Aasim/example script.js and User:Awesome Aasim/example script. Awesome Aasim 23:10, 31 August 2024 (UTC)
- I was looking for some specifics. What script, where are you seeing this, where are you not seeing this, etc. Writ Keeper ⚇♔ 21:17, 31 August 2024 (UTC)
- @Writ Keeper It is happening to me. I install a script and in some places it shows as not installed and in other places it shows as installed. It is a mess. Awesome Aasim 17:49, 31 August 2024 (UTC)
So after a bit of testing, I found the culprit. There are several places where there can potentially be underscores in the title. One of them is the "href" attribute linking back to the script.
After assigning scriptName
, replacing all the underscores with spaces seems to work. Reopening this edit request with two things:
- MediaWiki:Gadget-script-installer-core.js#L-590 should read
const scriptName = this.id.replace( /_/g, ' ' ); // if the script name happens to contain underscores, this purges it
- MediaWiki:Gadget-script-installer-core.js#L-610 should have the following added before the JS filtering line:
scriptName = scriptName.replace( /_/g, ' ' ); // if the script name happens to contain underscores, this purges it
See [2]. Awesome Aasim 20:15, 22 November 2024 (UTC)
- I'm not going to decline this request twice, because that's poor form, but the discussion with Writ Keeper above shows that this clearly is not
an obvious bug
. * Pppery * it has begun... 00:14, 23 November 2024 (UTC)- When it is pulling from the
href
property of an element it will contain underscores instead of spaces. Awesome Aasim 18:00, 23 November 2024 (UTC)- @Awesome Aasim Could you throw a more fleshed out reproduction steps of what you are seeing (and the steps you used to reproduce this error/issue) (ping me when you do) Sohom (talk) 04:08, 27 November 2024 (UTC)
- [3] [4]
- If I install from the infobox it puts underscores in the install. If I install from the script page it does not. And the install with underscores does not cause the script page to update from "install" to "uninstall", and vice versa. This fix fixes this. Awesome Aasim 04:21, 27 November 2024 (UTC)
- @Awesome Aasim Could you throw a more fleshed out reproduction steps of what you are seeing (and the steps you used to reproduce this error/issue) (ping me when you do) Sohom (talk) 04:08, 27 November 2024 (UTC)
- When it is pulling from the
- Partly done: After debugging, I implemented the second suggestion (on line 610). There isn't any evidence of what the first suggestion fixes, as a result, I am declining to implement that fix.
- @Awesome Aasim Consider this a formal warning to include a concrete reproduction case of the problem with each edit request and test your fixes before making the edit request (both of which were missing from this request). Sohom (talk) 14:23, 27 November 2024 (UTC)
- @Sohom Datta I already did some testing, using safemode and the F12 developer tools. I should have included screenshots and screencasts but those are kind of hard to include without having to upload a file to Commons. I'll try to find a way to get a screen capture visible to you next time so you can see next time. Awesome Aasim 16:52, 27 November 2024 (UTC)
- If indeed only the second one needed fixing, then that is good. Many thanks. Awesome Aasim 16:53, 27 November 2024 (UTC)
- Yeah only that second fix was needed to fix everything. Thank you. Awesome Aasim 16:54, 27 November 2024 (UTC)
- Actually, no. User:Sohom Datta Here is a screencast showing the problem. Cannot get the filetype correct to upload on Wikipedia, so it is on OneDrive.
- Reopening the edit request one last time to get the other half of the required edit done (the first one). Thanks. Awesome Aasim 02:46, 30 November 2024 (UTC)
- I would also add comments mentioning that the first part is for WP:USL and the second part is for user script infoboxes. Awesome Aasim 02:50, 30 November 2024 (UTC)
- Done Sohom (talk) 03:00, 30 November 2024 (UTC)
Interface-protected edit request on 28 August 2024
This edit request to MediaWiki:Gadget-script-installer-core.css has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Define background color using CSS variables, for night mode compatibility. The header background color will change slightly (from #CAE1FF to #A3D3FF), as there is no perfectly matching CSS variable.
− | #script-installer-panel {
width: 60%;
border: solid lightgray 1px;
padding: 0;
margin-left: auto;
margin-right: auto;
margin-bottom: 15px;
overflow: auto;
box-shadow: 5px 5px 5px #999;
background-color: | + | #script-installer-panel {
width: 60%;
border: solid lightgray 1px;
padding: 0;
margin-left: auto;
margin-right: auto;
margin-bottom: 15px;
overflow: auto;
box-shadow: 5px 5px 5px #999;
background-color: var(--background-color-base, #fff);
z-index: 50;
}
#script-installer-panel header {
background-color: var(--background-color-content-added, #a3d3ff);
display: block;
padding: 5px;
font-size: 1.1em;
font-weight: bold;
text-align: left;
} |
Andumé (talk) 17:32, 28 August 2024 (UTC)
- I haven't had a chance to try and test this in a sandbox or anything, but has anyone else had a chance to review this request? From the get-go, it seems to be pretty harmless... ~Oshwah~(talk) (contribs) 20:38, 11 September 2024 (UTC)
- Agreed that this looks harmless. This might be a good one to just make the edit directly to the gadget, then quickly test it by adding &debug=1 to the URL to clear the cache. Then take a peek at #script-installer-panel on a user's JS page by clicking "Manage user scripts" and make sure things don't look too crazy. In fact now that I typed this out I think I'll just do it :) One sec. –Novem Linguae (talk) 20:51, 11 September 2024 (UTC)
- Looks good to me. Done –Novem Linguae (talk) 20:55, 11 September 2024 (UTC)
- Agreed that this looks harmless. This might be a good one to just make the edit directly to the gadget, then quickly test it by adding &debug=1 to the URL to clear the cache. Then take a peek at #script-installer-panel on a user's JS page by clicking "Manage user scripts" and make sure things don't look too crazy. In fact now that I typed this out I think I'll just do it :) One sec. –Novem Linguae (talk) 20:51, 11 September 2024 (UTC)
Move STRINGS to separate JSON file
Hi! Can anyone please put the STRINGS in a separate JSON (for example)? This will allow loading the script directly from enwiki, and changing a separate file if localization is needed. Iniquity (talk) 17:18, 17 November 2024 (UTC)
Portal di Ensiklopedia Dunia