Jump to content

Module talk:Userbox

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by BrandonXLF (talk | contribs) at 22:48, 27 October 2018 (Template-protected edit request on 20 October 2018). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Template-protected edit request on 4 January 2015

Userboxes created with {{Userbox-2}} or {{Userbox-r}} are too wide if the specified border size is greater than 1px. Likewise, they are too narrow if the specified border size is zero. This bug is readily apparent in columns of multiple userboxes, as in the example floating to the right of this thread. It has already been fixed for {{Userbox}} with lines 79 and 82 of the module code:

local borderWidthNum = checkNum(args['border-width'] or args['border-s'], 1)
data.width = addSuffix(240 - 2 * borderWidthNum, 'px')

Could the same code please be coped to the vicinity of lines 125 and 177 for the sake of {{Userbox-2}} and {{Userbox-r}}? – voidxor (talk | contrib) 08:48, 4 January 2015 (UTC)[reply]

Not done: please make your requested changes to the module's sandbox first; see WP:TESTCASES. I had all the border stuff working well when it was a template. I'm not sure when or why it was all converted to lua, but please make the changes in the sandboxes and add any appropriate testcases and I'll be happy to look them over and make the changes. — {{U|Technical 13}} (etc) 12:52, 4 January 2015 (UTC)[reply]
Technical 13, I'm still new to the modules namespace and still learning to use the sandboxes and testcases. I have implemented my changes in the sandbox. The testcases look good. In full disclosure, I had to make a couple fixes or updates to the testcases. Please check those changes as well to ensure that I didn't cheat the testcases in any way. Thanks again! – voidxor (talk | contrib) 07:17, 6 January 2015 (UTC)[reply]
Note: I'm not particularly well versed in Lua either, so I prefer to leave these to other template editors that are. I know though that things like this should always be sandbox tested before being implemented. I'm reopening this request so a Lua knowledgeable template editor might be attracted to look it all over and implement it. Good luck! — {{U|Technical 13}} (etc) 14:05, 6 January 2015 (UTC)[reply]
  • I do have a question though... borderWidthNum = checkNum(args[9] or args['border-s'], 1) -- what's the default if those args aren't set? data.width = addSuffix(240 - 2 * borderWidthNum, 'px') requires the parameter to be set. How gracefully with the code fail if the borderWidthNum >= 120? How graciously will if fail if defined as 0 or < 0? — {{U|Technical 13}} (etc) 14:11, 6 January 2015 (UTC)[reply]
The default is the second parameter, which is 1. The changes look fine to me, so I'll copy them over to live. -- WOSlinker (talk) 18:41, 6 January 2015 (UTC)[reply]

Request

Please integrate the changes in the sandbox into the module. —Keφr 07:55, 6 September 2015 (UTC)[reply]

Just wondering about the colour checks, supposing I have the following userbox:
{{Userbox/sandbox
|id = [[File:Imbox_content.png]]
|id-c = black
|info = This is a test 
}}
Then it would be added to Category:Potentially illegible userboxes but it does not contain any clashing text and background colours. Could the checks be changed so that if id, id1 or id2 only contain Files or Images and no other text then the check is not done? -- WOSlinker (talk) 08:49, 6 September 2015 (UTC)[reply]
I've added Kephir's requested changes (before I saw WOSlinker's comment), but what WOSlinker says makes sense, so feel free to update the module again or reactivate the protected edit request as necessary. — Mr. Stradivarius ♪ talk ♪ 08:57, 6 September 2015 (UTC)[reply]
I refined the test to address the above. —Keφr 10:31, 6 September 2015 (UTC)[reply]
I've applied those changes. -- WOSlinker (talk) 13:26, 6 September 2015 (UTC)[reply]
Just wondering if it's really worth categorising talk pages? -- WOSlinker (talk) 19:11, 6 September 2015 (UTC)[reply]
@Kephir and WOSlinker: I've done some refactoring of the code in the sandbox so that the category code is separated out from the rendering code, and to remove the dependency on Module:Category handler. Any objections to me updating the module with it? I've also changed the module to only activate Category:Potentially illegible userboxes on user subpages, in the template namespace, and in the Wikipedia namespace. (Are there any other namespaces in which userbox templates reside?) — Mr. Stradivarius ♪ talk ♪ 07:05, 9 September 2015 (UTC)[reply]
Userboxes in User:UBX/ subpages are no longer been added to any categories with the sandbox version. -- WOSlinker (talk) 08:20, 9 September 2015 (UTC)[reply]
@WOSlinker: Which page(s) are you seeing this at? I just tested a couple of subpages of User:UBX at random and they seem to be working ok, plus I added some test cases for user subpage categories. If there's a problem with User:UBX pages then I'm not seeing it. — Mr. Stradivarius ♪ talk ♪ 08:37, 9 September 2015 (UTC)[reply]
Ah, perhaps you're looking at the code if title.namespace == 2 and title.rootText ~= 'UBX' then? That is intentional, as Module:Category handler blacklists User:UBX subpages via Module:Category handler/blacklist. You should find that the behaviour is the same as the current Module:Userbox for User:UBX subpages. The original rationale for the blacklisting code is here. — Mr. Stradivarius ♪ talk ♪ 08:47, 9 September 2015 (UTC)[reply]
I was just wondering if the UBX pages should be categorised the same as templates: elseif title.namespace == 10 or (title.namespace == 2 and title.rootText ~= 'UBX') then ? -- WOSlinker (talk) 09:31, 9 September 2015 (UTC)[reply]

Layout table edit request on 11 July 2016

Request
Copy Old revision of Module:Userbox/sandbox to Module:Userbox
Changes
Marks up the <table> as a layout table instead of a data table, by adding role="presentation" and replacing <th> with <td> (see MOS:LTAB).
Bolds the former <th>s to keep them visually the same.
There should be no visual changes (see Template:Userbox/testcases).
Users of assistive technologies will get simpler, less confusing output. For me, "Table with two columns and one rows, TS This user likes Taylor Swift, table end" becomes just "TS This user likes Taylor Swift".

Matt Fitzpatrick (talk) 05:44, 11 July 2016 (UTC)[reply]

Done — Martin (MSGJ · talk) 08:06, 11 July 2016 (UTC)[reply]

Optimize for mobile page

As Chinese Wikipedian, the .content table class may cause unexpected result on mobile page when you look at the user page, in this case every user box would display an unused whitespace at the top. You need make the following modify to fix:

local tableroot = root:tag('table')
tableroot
	:css('border-collapse', 'collapse')
	:css('width', data.width)
	:css('margin-bottom', '0')
	:css('margin-top', '0') -- add this
	:css('background', data.backgroundColor)

--Great Brightstar (talk) 09:52, 16 July 2016 (UTC)[reply]

Done This is my first edit to a template-protected page after becoming a template editor. GeoffreyT2000 (talk) 02:44, 17 July 2016 (UTC)[reply]

Template-protected edit request on 6 September 2016

Please change line 331 from this:

		root:wikitext('[[Category:Potentially illegible userboxes]]')

To this:

		root:wikitext('<noinclude>[[Category:Potentially illegible userboxes]]</noinclude>')

Currently this puts any pages transcluding potentially illegible userboxes in the category as well, making the backlog seem bigger than it is and making it hard to go through it. nyuszika7h (talk) 10:29, 6 September 2016 (UTC)[reply]

Would that code not suppress the category on the userpage itself? — Martin (MSGJ · talk) 10:55, 6 September 2016 (UTC)[reply]
Not done: please make your requested changes to the module's sandbox first; see WP:TESTCASES. Izno (talk) 11:32, 6 September 2016 (UTC)[reply]
@MSGJ: If a user page calls {{userbox}} itself with non-compliant colors, it would be categorized, otherwise only the userbox templates, which is the intended effect, as the problem in the latter case needs to be fixed in the templates, not the user pages. @Izno: Done. – nyuszika7h (talk) 11:53, 6 September 2016 (UTC)[reply]
Okay,  Implemented — Martin (MSGJ · talk) 14:02, 6 September 2016 (UTC)[reply]
Please revert the change for now, as it's broken, categorizes regardless and causes "<noinclude></noinclude>" to show up on illegible userboxes. I should have tested it, but I didn't think of using {{Userbox/sandbox}} to use the sandbox version of the module (though I've done so with another template before). I'm trying there now, but no success so far, so for now the change should be just reverted. nyuszika7h (talk) 13:13, 10 September 2016 (UTC)[reply]
Done — Andy W. (talk ·ctb) 13:55, 10 September 2016 (UTC)[reply]

Template-protected edit request on 21 August 2018

Currently, module Userbox supports up to three user categories. I suggest to upgrade the Userbox module to support up to five user categories. There are already userboxes, which pass five parameters, e.g. Template:User London. —⁠andrybak (talk) 21:51, 21 August 2018 (UTC)[reply]

 Not done: it's not clear what changes you want to be made. Please mention the specific changes in a "change X to Y" format and provide a reliable source if appropriate. — JJMC89(T·C) 03:08, 22 August 2018 (UTC)[reply]
Change following three lines:
	cats[#cats + 1] = args.usercategory
	cats[#cats + 1] = args.usercategory2
	cats[#cats + 1] = args.usercategory3
to
	cats[#cats + 1] = args.usercategory
	cats[#cats + 1] = args.usercategory2
	cats[#cats + 1] = args.usercategory3
	cats[#cats + 1] = args.usercategory4
	cats[#cats + 1] = args.usercategory5
—⁠andrybak (talk) 10:23, 22 August 2018 (UTC)[reply]
 Donexaosflux Talk 12:57, 22 August 2018 (UTC)[reply]

Template-protected edit request on 20 October 2018

Replace all instances of 240 with (args['wide'] and 482 or (args['small'] and 119 or 240)) or just replace the live version with the sandbox version. These edits allow for the use of |wide= which makes the userbox double the width of a normal userbox and |small= which make the userbox half the width of a normal userbox.

Testcases
Code Sandbox Live
{{#invoke:Userbox(/sandbox)|userbox|info=text|id=USER}}
USERThis user is a user who has user-boxes on their user-page and on their user-talk.
USERThis user is a user who has user-boxes on their user-page and on their user-talk.
{{#invoke:Userbox(/sandbox)|userbox|info=text}}
This user is a user who has user-boxes on their user-page and on their user-talk.
This user is a user who has user-boxes on their user-page and on their user-talk.
{{#invoke:Userbox(/sandbox)|userbox|info=text|id=id}}
idThis user is a user who has user-boxes on their user-page and on their user-talk.
idThis user is a user who has user-boxes on their user-page and on their user-talk.
{{#invoke:Userbox(/sandbox)|userbox-r|info=text|id=id}}
This user is a user who has user-boxes on their user-page and on their user-talk.id
This user is a user who has user-boxes on their user-page and on their user-talk.id
{{#invoke:Userbox(/sandbox)|userbox-2|info=text|id=id}}
id1This user is a user who has user-boxes on their user-page and on their user-talk.id2
id1This user is a user who has user-boxes on their user-page and on their user-talk.id2
Examples
Code Sandbox
{{#invoke:Userbox/sandbox|userbox|info=text|wide=yes|id=id}}
idThis user is a user who has user-boxes on their user-page and on their user-talk.
{{#invoke:Userbox/sandbox|userbox|info=text|wide=yes}}
This user is a user who has user-boxes on their user-page and on their user-talk.
{{#invoke:Userbox/sandbox|userbox-2|info=text|wide=yes}}
id1This user is a user who has user-boxes on their user-page and on their user-talk.id2
{{#invoke:Userbox/sandbox|userbox-r|info=text|wide=yes}}
This user is a user who has user-boxes on their user-page and on their user-talk.id
{{#invoke:Userbox/sandbox|userbox|info=text|small=yes|id=id}}
idThis is a user-page.
{{#invoke:Userbox/sandbox|userbox|info=text|small=yes}}
This is a user-page.
{{#invoke:Userbox/sandbox|userbox-2|info=text|small=yes}}
id1This is a user-page.id2
{{#invoke:Userbox/sandbox|userbox-r|info=text|small=yes}}
This is a user-page.id
Example of usage
Userbox
Userbox
Userbox
idUserbox
idUserbox
Userbox
idUserbox
id1Userboxid2
id1Userboxid2
Userboxid
id1Userboxid2
idUserbox
Userboxid
id1Userboxid2
id1Us
er
id2
Userboxid
Userbox
idUserbox

– BrandonXLF (t@lk) 18:40, 20 October 2018 (UTC)[reply]

no Declined not a helpful edit. Simply adds more complexity to an already complicated template. If you want to make a custom userbox for your userpage, then use your userspace. --Zackmann (Talk to me/What I been doing) 22:11, 22 October 2018 (UTC)[reply]
This isn't possible for a custom userbox, only a few more bytes of data, I don't see the issue. It meant to replace Template:Userbox-w and allow for a Template:Userbox-s. – BrandonXLF (t@lk) 00:22, 23 October 2018 (UTC)[reply]
 Not done: I'm neutral on the change (only a slight complication, but also doesn't appear to be used much/have a lot of utility) but since Zackman has opposed the change please gain a consensus before requesting a template-protected edit. Galobtter (pingó mió) 11:01, 24 October 2018 (UTC)[reply]
@Zackmann08 and Galobtter:, this change is useful because it would add more options to Template:Userbox-w (with 88 transclusions) sure it's not a lot but it's not a lot of code either. It also provides unification between user boxes of different sizes. I'm not sure it adds that much complexity (Zackmann08) and as making a custom user box would break the fact that this module is meant to unify user boxes. – BrandonXLF (t@lk) 12:47, 24 October 2018 (UTC)[reply]