Template talk:Userscript
Comments by Mr. Great Cow
editThis needs to be permanently protected. 🐂◌Mr. Great Cow (talk · contribs)◌🐂 18:12, 20 November 2015 (UTC)
@DannyS712: any reason not to use Special:MyPage/skin.js instead? Headbomb {t · c · p · b} 04:18, 2 May 2019 (UTC)
- @Headbomb: what do you mean? Instead of common.js? Usually, user scripts are installed in common.js so that they are accessible from all skins. --DannyS712 (talk) 04:22, 2 May 2019 (UTC)
- Yeah. I suppose it's a bit weird for me to use put my stuff in User:Headbomb/monobook.js instead of User:Headbomb/common.js? Headbomb {t · c · p · b} 04:25, 2 May 2019 (UTC)
- @Headbomb: yeah, generally. What specifically are you asking? --DannyS712 (talk) 04:26, 2 May 2019 (UTC)
- I just thought it would be a better/more reliable target since it would direct people to the actual skin they used. I didn't know common.js was meant to affect all skins. Headbomb {t · c · p · b} 04:28, 2 May 2019 (UTC)
- @Headbomb: Well, you learn something new every day :) --DannyS712 (talk) 04:34, 2 May 2019 (UTC)
- I just thought it would be a better/more reliable target since it would direct people to the actual skin they used. I didn't know common.js was meant to affect all skins. Headbomb {t · c · p · b} 04:28, 2 May 2019 (UTC)
- @Headbomb: yeah, generally. What specifically are you asking? --DannyS712 (talk) 04:26, 2 May 2019 (UTC)
- Yeah. I suppose it's a bit weird for me to use put my stuff in User:Headbomb/monobook.js instead of User:Headbomb/common.js? Headbomb {t · c · p · b} 04:25, 2 May 2019 (UTC)
Global installation
editIt would be useful to have a setting to allow the installation to happen over at meta:Special:MyPage/global.js instead. ~★ nmaia d 01:10, 15 August 2020 (UTC)
Extra pipe character for ifeq
edit@Nardog Hi. I'm updating the corresponding template on another wiki and i need help to understand something. I made a more readable copy of the code at Template:Userscript/sandbox2 so i can explain the problem i saw: At the "generation of ref tag" part, the "tag" function is closed at line 13 and the second "ifeq" function closed at line 14. The first "ifeq" should be closed at 15 but there's an extra pipe at 15 and the function is closed at 16 instead. As the first "ifeq" has both results defined at 9 and 10, the extra pipe should be for "if", and lines 15 and 16 can be swapped. Am i right?
It makes no difference (tested here), but i am confused how it works here on enwiki and doesn't hide the ref as it does on fawiki! can you please help me? Jeeputer (talk) 07:44, 25 May 2021 (UTC)
- You're right. I'm not sure if we need all the
|<!--nothing-->
that appear right before}}
though. The third parameter inif
orifexist
and the fourth inifeq
are completely optional, so I would just remove line 15 rather than swap it. Nardog (talk) 08:03, 25 May 2021 (UTC)- @Nardog: Thank you. :) —Jeeputer (talk) 08:25, 25 May 2021 (UTC)
Template returns the string "no"
edit@SD0001 Your change that added {{yesno-no}}
to the template seems to be outputting the literal string "no" when no value is provided for |noref=
. For example {{Userscript|code=User:Example/example.js}}
produces example[1] (source). – BrandonXLF (talk) 23:16, 14 January 2022 (UTC)
References
- ^ Copy the following code, edit your user JavaScript, then paste:
{{subst:lusc|1=User:Example/example.js}}
- @BrandonXLF I've undone those changes for now. Yesno usage looks more complicated that I thought. BTW while you're here, can you address the minor issues in the namespace-specific gadgets patch? It's likely to be merged as soon as the issues are fixed, as there's been a lot of activity with this extension of late. – SD0001 (talk) 08:11, 15 January 2022 (UTC)
- Sure, I've addressed the issues in the patch. I meant to do that earlier, but other things got in the way. – BrandonXLF (talk) 08:52, 15 January 2022 (UTC)
Template-protected edit request on 26 March 2024
editThis edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Line 5: | Line 5: |
-->|{{{name|{{{name|{{SUBPAGENAME: {{#invoke: String|replace|source= {{{code|{{#ifexist:{{{doc|}}}.js|{{{doc|}}}.js|<!--nothing-->}}}}}|pattern= .js |replace= }} }} }}} }}} }} }}<!-- | -->|{{{name|{{{name|{{SUBPAGENAME: {{#invoke: String|replace|source= {{{code|{{#ifexist:{{{doc|}}}.js|{{{doc|}}}.js|<!--nothing-->}}}}}|pattern= .js |replace= }} }} }}} }}} }} }}<!-- |
-- Begin generation of ref tag | -- Begin generation of ref tag |
-->{{#if: {{{code| {{#ifexist: {{{doc|}}}.js | {{{doc|}}}.js | <!--nothing--> }} }}} |{{#ifeq: {{{noautoinstall}}} | yes | <!--nothing--> | {{#ifeq: {{{noref|}}} | yes | <!-- nothing --> | {{#tag:ref|Copy the following code, '''<span title="Click here to edit your common.js page" class="plainlinks">[{{fullurl:Special:MyPage/common.js|action=edit}} |
-->{{#if: {{{code| {{#ifexist: {{{doc|}}}.js | {{{doc|}}}.js | <!--nothing--> }} }}} |{{#ifeq: {{{noautoinstall}}} | yes | <!--nothing--> | {{#ifeq: {{{noref|}}} | yes | <!-- nothing --> | {{#tag:ref|Copy the following code, '''<span title="Click here to edit your common.js page" class="plainlinks">[{{fullurl:Special:MyPage/common.js|action=edit}} edit your user JavaScript]</span>''', then paste:<br /><code>{{subst:{{#if:{{str endswith|{{{code| {{#ifexist: {{{doc|}}}.js | {{{doc|}}}.js | <!--nothing--> }} }}}|.css}}|luss|lusc}}|1={{{code| {{#ifexist: {{{doc|}}}.js | {{{doc|}}}.js| <!--nothing--> }}}}}{{#ifeq:{{{backlink|}}}|||{{!}}2{{=}}{{{backlink}}} }}}} </code> }} }} |<!--nothing-->}} }} <!-- |
-- End generation of ref tag, begin generation of "(source)" | -- End generation of ref tag, begin generation of "(source)" |
-->{{#if: {{{code| {{#ifexist: {{{doc|}}}.js | {{{doc|}}}.js | <!--nothing--> }} }}} | <small>([[{{{code| {{#ifexist: {{{doc|}}}.js | {{{doc|}}}.js | <!--nothing--> }} }}}|source]])</small> |<!--nothing-->}}<!-- | -->{{#if: {{{code| {{#ifexist: {{{doc|}}}.js | {{{doc|}}}.js | <!--nothing--> }} }}} | <small>([[{{{code| {{#ifexist: {{{doc|}}}.js | {{{doc|}}}.js | <!--nothing--> }} }}}|source]])</small> |<!--nothing-->}}<!-- |
"Click here" links are bad for accessibility (see Links section of MOS:Accessibility and Mystery meat navigation. ~~2NumForIce (speak|edits) 01:02, 27 March 2024 (UTC)
- Done I've also changed the link to point to Special:EditPage/Special:MyPage/common.js, which is the equivalent link. SWinxy (talk) 04:36, 27 March 2024 (UTC)