Template talk:Install user script

Protected edit request on 4 June 2014

edit

Please change the current code of:

importScript('{{{1}}}'); // Backlink: [[{{{1}}}]]<noinclude>{{doc}} </noinclude>

To a new code of:

/* {{{2|{{{1}}}}}} */
importScript( '{{{1}}}' );// Backlink: [[{{{2|{{{1}}}}}}]]<noinclude>{{Doc}}</noinclude>

So that it will be possible for me to use this template to guide users to install my scripts for themselves and have them have backlinks to the directions page instead of the actual script like I like them. This change will also add linkable section headers for those who use User:Technical 13/Scripts/Gadget-codeAnchors (edit | talk | history | links | watch | logs) making it easier to navigate to a section. Alternatively, please lower the protection level to template editor so I may make these simple change myself. Thanks. — {{U|Technical 13}} (etc) 02:33, 4 June 2014 (UTC)Reply

@Technical 13: I've lowered the protection to template-editor for you. — Mr. Stradivarius ♪ talk ♪ 06:30, 4 June 2014 (UTC)Reply

Edit request: Re-insert space

edit

There was originally a space between the semi-colon and the two slashes which was removed by T13. I think it looks bad, so I propose that we put it back. I believe there will be no objections.

 /* {{{2|{{{1}}}}}} */
-importScript( '{{{1}}}' );// Backlink: [[{{{2|{{{1}}}}}}]]<noinclude>{{Doc}}</noinclude>
+importScript( '{{{1}}}' ); // Backlink: [[{{{2|{{{1}}}}}}]]<noinclude>{{Doc}}</noinclude>

Hello71 02:42, 15 February 2016 (UTC)Reply

  Not done: please establish a consensus for this alteration before using the {{edit template-protected}} template. I have no objection to the substance of the change, but going back-and-forth between the two preferences based on personal taste isn't a way forward. Bazj (talk) 09:11, 15 February 2016 (UTC)Reply
One, I believe it was removed accidentally during other changes. Two, T13 has since been indefinitely banned from editing Wikipedia. Three, there are several different options for spacing here (e.g. importScript('{{{1}}}')), but the present state is none of them. ⁓ Hello71 00:35, 20 February 2016 (UTC)Reply
  Done This looks like a minor edit to me, so I don't think we need to require discussion for it. If anyone is really passionate about whitespace in user .js files then I'll revert and we can talk about it, but otherwise I don't see it being an issue. — Mr. Stradivarius ♪ talk ♪ 12:10, 20 February 2016 (UTC)Reply

Requested move 7 April 2016

edit
The following is a closed discussion of the proposal. Please do not modify it. Subsequent comments should be made in a new section on the talk page. No further edits should be made to this section.

The result of the proposal was move per request. Template titling using the natural sentence name has been the trend for a few years now.--Fuhghettaboutit (talk) 22:15, 16 April 2016 (UTC)Reply


Template:InstallUserScriptTemplate:Install user script – Templates have often been moved to use the intuitive case for readability rather than CamelCase. Since this one is not even transcluded anywhere, it's a no-brainer. The few links I'll happily correct if asked for. The Evil IP address (talk) 14:59, 7 April 2016 (UTC)Reply

The above discussion is preserved as an archive of the proposal. Please do not modify it. Subsequent comments should be made in a new section on this talk page. No further edits should be made to this section.

Protected edit request on 23 June 2016

edit

I'd like the /* */ comment to be removed, since it was used by a script (code anchors) that currently has 0 users; also, because it clutters up people's commons.js pages. Enterprisey (talk!(formerly APerson) 20:55, 23 June 2016 (UTC)Reply

  Donexaosflux Talk 20:46, 26 June 2016 (UTC)Reply

Deprecation status of importScript

edit

I've combined three discussion sections on this page about the same topic into one for convenience. —⁠andrybak (talk) 12:43, 7 June 2024 (UTC)Reply

Remove the deprecated import function

edit

Replaced by mw.loader.load('full URL of the script'). KPu3uC B Poccuu (talk) 04:00, 9 January 2016 (UTC)Reply

importScript is nicer and does not yet have a good replacement. We should continue using it. --V111P (talk) 12:16, 10 January 2016 (UTC)Reply
importScript is surely deprecated. It will not be removed in near future because many legacy scripts still depends on it, but we should encourage new scripts to use the MediaWiki Resource Loader for performance reason. --Franklin Yu (talk) 05:04, 29 May 2019 (UTC)Reply

Protected edit request on 3 December 2018

edit

importScript() is deprecated. This template should be changed to:

mw.loader.load( '{{localurl:{{{1}}}|action=raw&ctype=text/javascript}}' ); // Backlink: [[{{{2|{{{1}}}}}}]]<noinclude>{{Documentation}}</noinclude> Ahecht (TALK
PAGE
) 17:37, 3 December 2018 (UTC)Reply

  Not done: per Template_talk:Install_user_script#Remove_the_deprecated_import_function there appears to be opposition to replacing with mw.loader.load; so you should gain a consensus for the change Galobtter (pingó mió) 06:31, 8 December 2018 (UTC)Reply

  You are invited to join the discussion at User talk:Enterprisey/script-installer § Confusing history of importScript. —⁠andrybak (talk) 12:31, 7 June 2024 (UTC)Reply

Protected edit request on 15 June 2024

edit

Please remove the spaces inside parentheses to match behavior of MediaWiki:Gadget-script-installer.js:

<noinclude>{{#tag:syntaxhighlight|</noinclude>importScript('{{{1}}}'); // Backlink: [[{{{2|{{{1}}}}}}]]<noinclude>|lang=js}}{{Doc}}</noinclude>

The spaces were originally added in Special:Diff/611517993 with addition of the second positional parameter {{{2}}} after #Protected edit request on 4 June 2014. See also the discussion User talk:Enterprisey/script-installer#Feature request: generate code that matches {{subst:iusc}}. —⁠andrybak (talk) 20:57, 15 June 2024 (UTC)Reply

I've changed my mind on this issue since i last posted about it. Mediawiki jacascript coding conventions include spaces inside parentheses, so I am not inclined to remove the spaces. Sorry for flip flopping! –Novem Linguae (talk) 22:11, 15 June 2024 (UTC)Reply
Ahh, so that's where this abomination of a code style comes from. I see.
Users' common.js, vector.js, vector-2022.js, etc don't really need consistency with MediaWiki's codebase though. On the other hand, MediaWiki:Gadget-script-installer.js is probably the most popular way of installing scripts nowadays on enwiki. Internal (to enwiki) consistency with the gadget would have been nice. —⁠andrybak (talk) 22:47, 15 June 2024 (UTC)Reply
I run mediawiki's JavaScript linter on any abandoned gadgets i work on, and that includes spaces inside parentheses too. After awhile i got used to seeing js code in mediawiki style. In fact code not in that style makes me want to run a linter on it. Lol –Novem Linguae (talk) 00:00, 16 June 2024 (UTC)Reply
  Not done This is apparently a controversial request. I would just move on as way too much energy is being spent on something that does not matter. * Pppery * it has begun... 01:01, 18 June 2024 (UTC)Reply

Protected edit request on 10 October 2024

edit

Add |copy=1 per the sandbox to add a "Copy" button to the code (see phab:T40932). --Ahecht (TALK
PAGE
)
21:30, 10 October 2024 (UTC)Reply

Where was this tested? (I don't see any test cases). — xaosflux Talk 23:22, 10 October 2024 (UTC)Reply
@Xaosflux It was only tested at Template:Install user script/sandbox since it's only changing parameters within the noinclude (it won't show up in testcases). It would allow a user to copy the formatting to manually install a script without actually using the template. However, as a matter of good practice, I'll go ahead and create a testcases page. --Ahecht (TALK
PAGE
)
15:35, 11 October 2024 (UTC)Reply
Unless impossible, the test cases should include the template and the sandbox template, so that the change can be demonstrated. I did see this parameter exists, but not sure if it plays nice with #tag invocation. — xaosflux Talk 16:07, 11 October 2024 (UTC)Reply
When I looked at this the other day the [COPY] thing wasn't showing in the sandbox, but now it is, so that's good. Not sure what else to test here, just didn't want to break things of course. — xaosflux Talk 16:10, 11 October 2024 (UTC)Reply
  Done Izno (talk) 22:54, 21 October 2024 (UTC)Reply