Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warn: use jquery.chosen on select box #641

Merged
merged 3 commits into from
May 31, 2019

Conversation

siddharthvp
Copy link
Member

Add jquery.chosen on select box to make templates (and their descriptions) searchable.
Partially revert #517, bringing back the {{uw- prefix, as chosen's search works properly despite the presence of that prefix.
Closes #631.

Have used mw.loader.using('jquery.chosen') here, until jquery.chosen gets added to the gadget definition.

We should probably revisit the descriptions of templates to make them include relevant keywords that attract search hits.

Add jquery.chosen on select box to make templates (and their descriptions) searchable.
Partially revert wikimedia-gadgets#517, bringing back the `{{uw-` prefix, as chosen's search works properly despite the presence of that prefix.
Closes wikimedia-gadgets#631.
@@ -6,6 +6,7 @@ jsl.conf
stash*.txt
stash*.diff
*.jsX
.vscode/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modules/twinklewarn.js Outdated Show resolved Hide resolved
modules/twinklewarn.js Outdated Show resolved Hide resolved
@Amorymeltzer
Copy link
Collaborator

@siddharthvp One minor improvement, one question/discussion point.

Have used mw.loader.using('jquery.chosen') here, until jquery.chosen gets added to the gadget definition

Yup, thanks; that's a "me" job. I'll take care of it after this gets merged

We should probably revisit the descriptions of templates to make them include relevant keywords that attract search hits.

Indeed; I'll open a tracker and invite folks to discuss when this goes live. I think it'll be hugely popular!

@Amorymeltzer Amorymeltzer added this to the June 2019 update milestone May 30, 2019
@Amorymeltzer Amorymeltzer merged commit 1793517 into wikimedia-gadgets:master May 31, 2019
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Nov 29, 2019
Mentioned in wikimedia-gadgets#673 (comment).  While this makes use of 10 for `defaultWarningGroup`, I considered reusing 8, which was until the addition of the block module in wikimedia-gadgets#260 (well, also 430e225) reserved for sysops to select blocking templates, to cut down on bloat.  There are a handful of users, some still active sysops, with the option set, but while that's a trivial barrier, I think it's better list it below the individual items, reinforcing the "all-of-the-above"-ness of the option.

This also tweaks the process by which `twinklewarn` tries to select the template that corresponds to what was selected in the previous menu.  As it has every item, the new kitchensink menu should always match exactly, but since the process was previously only relevant for levels 1-4im, the highest level would always be selected upon moving to the kitchensink menu (i.e., vandalism1 -> vandalism4im).  Now, in addition to doing an exact match in the kitchensink, it also won't keep searching once it has found the match.  Part of this is from wikimedia-gadgets#592.

Also removed a comment made incorrect by wikimedia-gadgets#641.
@Amorymeltzer Amorymeltzer mentioned this pull request Nov 29, 2019
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Nov 29, 2019
Mentioned by me in wikimedia-gadgets#673 (comment).  While this makes use of `defaultWarningGroup = 10`, I considered reusing 8, which was until the addition of the block module in wikimedia-gadgets#260 (well, also 430e225) reserved for sysops to select blocking templates, to cut down on bloat.  There are a handful of users, some still active sysops, with the option set, but while that's a trivial barrier, I think it's better list it below the individual items, reinforcing the "all-of-the-above"-ness of the option, as well as not relying other projects to do the same thing.  Unlike the combined singlet menu from wikimedia-gadgets#759, this menu is not sorted: I thought it'd be clearer for folks to have a progression rather than all the groups clumped together, to take advantage of the quickFilter.

This also tweaks the process by which `twinklewarn` tries to select the template that corresponds to what was selected in the previous menu.  As it contains every item, this new `kitchensink` menu should always match exactly, but the previous process kept searching once a match was found.  This wasn't an issue since this was only relevant for levels 1-4im where only the correct match could be found, but here it meant that the highest level warning would always be selected upon moving to the kitchensink menu (i.e., vandalism1 -> vandalism4im).  Now, in addition to doing an exact match in the kitchensink, it also won't keep searching once it has found the match.  Part of this is as a result of my work in wikimedia-gadgets#592.  There's also a tweak to how the combined singlet menu from wikimedia-gadgets#759 is sorted; it now selects either the previously selected option (if going from kitchensink->singletcombined, just like for other menu changes), or the top option if the previous value is not present (level2->singletcombined, as in wikimedia-gadgets#759).

I also removed a comment made incorrect by wikimedia-gadgets#641.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Dec 1, 2019
Mentioned by me in wikimedia-gadgets#673 (comment).  While this makes use of `defaultWarningGroup = 10`, I considered reusing 8, which was until the addition of the block module in wikimedia-gadgets#260 (well, also 430e225) reserved for sysops to select blocking templates, to cut down on bloat.  There are a handful of users, some still active sysops, with the option set, but while that's a trivial barrier, I think it's better list it below the individual items, reinforcing the "all-of-the-above"-ness of the option, as well as not relying other projects to do the same thing.  Unlike the combined singlet menu from wikimedia-gadgets#759, this menu is not sorted: I thought it'd be clearer for folks to have a progression rather than all the groups clumped together, to take advantage of the quickFilter.

This also tweaks the process by which `twinklewarn` tries to select the template that corresponds to what was selected in the previous menu.  As it contains every item, this new `kitchensink` menu should always match exactly, but the previous process kept searching once a match was found.  This wasn't an issue since this was only relevant for levels 1-4im where only the correct match could be found, but here it meant that the highest level warning would always be selected upon moving to the kitchensink menu (i.e., vandalism1 -> vandalism4im).  Now, in addition to doing an exact match in the kitchensink, it also won't keep searching once it has found the match.  Part of this is as a result of my work in wikimedia-gadgets#592.  There's also a tweak to how the combined singlet menu from wikimedia-gadgets#759 is sorted; it now selects either the previously selected option (if going from kitchensink->singletcombined, just like for other menu changes), or the top option if the previous value is not present (level2->singletcombined, as in wikimedia-gadgets#759).

I also removed a comment made incorrect by wikimedia-gadgets#641.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Dec 23, 2019
Mentioned by me in wikimedia-gadgets#673 (comment).  While this makes use of `defaultWarningGroup = 10`, I considered reusing 8, which was until the addition of the block module in wikimedia-gadgets#260 (well, also 430e225) reserved for sysops to select blocking templates, to cut down on bloat.  There are a handful of users, some still active sysops, with the option set, but while that's a trivial barrier, I think it's better list it below the individual items, reinforcing the "all-of-the-above"-ness of the option, as well as not relying other projects to do the same thing.  Unlike the combined singlet menu from wikimedia-gadgets#759, this menu is not sorted: I thought it'd be clearer for folks to have a progression rather than all the groups clumped together, to take advantage of the quickFilter.

This also tweaks the process by which `twinklewarn` tries to select the template that corresponds to what was selected in the previous menu.  As it contains every item, this new `kitchensink` menu should always match exactly, but the previous process kept searching once a match was found.  This wasn't an issue since this was only relevant for levels 1-4im where only the correct match could be found, but here it meant that the highest level warning would always be selected upon moving to the kitchensink menu (i.e., vandalism1 -> vandalism4im).  Now, in addition to doing an exact match in the kitchensink, it also won't keep searching once it has found the match.  Part of this is as a result of my work in wikimedia-gadgets#592.  There's also a tweak to how the combined singlet menu from wikimedia-gadgets#759 is sorted; it now selects either the previously selected option (if going from kitchensink->singletcombined, just like for other menu changes), or the top option if the previous value is not present (level2->singletcombined, as in wikimedia-gadgets#759).

I also removed a comment made incorrect by wikimedia-gadgets#641.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Jan 7, 2020
Mentioned by me in wikimedia-gadgets#673 (comment).  While this makes use of `defaultWarningGroup = 10`, I considered reusing 8, which was until the addition of the block module in wikimedia-gadgets#260 (well, also 430e225) reserved for sysops to select blocking templates, to cut down on bloat.  There are a handful of users, some still active sysops, with the option set, but while that's a trivial barrier, I think it's better list it below the individual items, reinforcing the "all-of-the-above"-ness of the option, as well as not relying other projects to do the same thing.  Unlike the combined singlet menu from wikimedia-gadgets#759, this menu is not sorted: I thought it'd be clearer for folks to have a progression rather than all the groups clumped together, to take advantage of the quickFilter.

This also tweaks the process by which `twinklewarn` tries to select the template that corresponds to what was selected in the previous menu.  As it contains every item, this new `kitchensink` menu should always match exactly, but the previous process kept searching once a match was found.  This wasn't an issue since this was only relevant for levels 1-4im where only the correct match could be found, but here it meant that the highest level warning would always be selected upon moving to the kitchensink menu (i.e., vandalism1 -> vandalism4im).  Now, in addition to doing an exact match in the kitchensink, it also won't keep searching once it has found the match.  Part of this is as a result of my work in wikimedia-gadgets#592.  There's also a tweak to how the combined singlet menu from wikimedia-gadgets#759 is sorted; it now selects either the previously selected option (if going from kitchensink->singletcombined, just like for other menu changes), or the top option if the previous value is not present (level2->singletcombined, as in wikimedia-gadgets#759).

I also removed a comment made incorrect by wikimedia-gadgets#641.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Jan 18, 2020
chosen (https://harvesthq.github.io/chosen/, https://github.com/harvesthq/chosen), which has been in use since wikimedia-gadgets#580 (xfd) and wikimedia-gadgets#641 (warn), has been causing some consistent CSS issues in the warn modules (wikimedia-gadgets#665), and has recently been deprecated: harvesthq/chosen@91041bc.  select2 (https://select2.org/, https://github.com/select2/select2) is an alternative to chosen that resolves those issues and is better maintained, albeit larger even without using the full version.

select2, however, is not part of MediaWiki's core ResourceLoader modules, so have to upload it ourselves as a gadget, as we once did for moment (67e24a5).  We could technically use the [Toolserver CDN](https://tools.wmflabs.org/cdnjs/) but that is potentially prone to occasional unreliability and is not whitelisted by the CSP (https://phabricator.wikimedia.org/T223840); that's still in 'report only' mode but users will have to opt-themselves out so it's not long-term reliable (https://phabricator.wikimedia.org/T208188).  Uploading it as a gadget avoids all that and makes use of the advantages of the ResourceLoader.

Uploaded under the terms of the MIT license:

The MIT License (MIT)

Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Jan 19, 2020
chosen (https://harvesthq.github.io/chosen/, https://github.com/harvesthq/chosen), which has been in use since wikimedia-gadgets#580 (xfd) and wikimedia-gadgets#641 (warn), has been causing some consistent CSS issues in the warn modules (wikimedia-gadgets#665), and has recently been deprecated: harvesthq/chosen@91041bc.  select2 (https://select2.org/, https://github.com/select2/select2) is an alternative to chosen that resolves those issues and is better maintained, albeit larger even without using the full version.

select2, however, is not part of MediaWiki's core ResourceLoader modules, so have to upload it ourselves as a gadget, as we once did for moment (67e24a5).  We could technically use the [Toolserver CDN](https://tools.wmflabs.org/cdnjs/) but that is potentially prone to occasional unreliability and is not whitelisted by the CSP (https://phabricator.wikimedia.org/T223840); that's still in 'report only' mode but users will have to opt-themselves out so it's not long-term reliable (https://phabricator.wikimedia.org/T208188).  Uploading it as a gadget avoids all that and makes use of the advantages of the ResourceLoader.

Uploaded under the terms of the MIT license:

The MIT License (MIT)

Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Jan 19, 2020
chosen (https://harvesthq.github.io/chosen/, https://github.com/harvesthq/chosen), which has been in use since wikimedia-gadgets#580 (xfd) and wikimedia-gadgets#641 (warn), has been causing some consistent CSS issues in the warn modules (wikimedia-gadgets#665), and has recently been deprecated: harvesthq/chosen@91041bc.  select2 (https://select2.org/, https://github.com/select2/select2) is an alternative to chosen that resolves those issues and is better maintained, albeit larger even without using the full version.

select2, however, is not part of MediaWiki's core ResourceLoader modules (T53443), so have to upload it ourselves as a gadget, as we once did for moment (67e24a5).  We could technically use the [Toolserver CDN](https://tools.wmflabs.org/cdnjs/) but that is potentially prone to occasional unreliability and is not whitelisted by the CSP (https://phabricator.wikimedia.org/T223840); that's still in 'report only' mode but users will have to opt-themselves out so it's not long-term reliable (https://phabricator.wikimedia.org/T208188).  Uploading it as a gadget avoids all that and makes use of the advantages of the ResourceLoader.

Uploaded under the terms of the MIT license:

The MIT License (MIT)

Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Jan 19, 2020
chosen (https://harvesthq.github.io/chosen/, https://github.com/harvesthq/chosen), which has been in use since wikimedia-gadgets#580 (xfd) and wikimedia-gadgets#641 (warn), has been causing some consistent CSS issues in the warn modules (wikimedia-gadgets#665), and has recently been deprecated: harvesthq/chosen@91041bc.  select2 (https://select2.org/, https://github.com/select2/select2) is an alternative to chosen that resolves those issues and is better maintained, albeit larger even without using the full version.

select2, however, is not part of MediaWiki's core ResourceLoader modules (T53443), so have to upload it ourselves as a gadget, as we once did for moment (67e24a5).  We could technically use the [Toolserver CDN](https://tools.wmflabs.org/cdnjs/) but that is potentially prone to occasional unreliability and is not whitelisted by the CSP (https://phabricator.wikimedia.org/T223840); that's still in 'report only' mode but users will have to opt-themselves out so it's not long-term reliable (https://phabricator.wikimedia.org/T208188).  Uploading it as a gadget avoids all that and makes use of the advantages of the ResourceLoader.

Uploaded under the terms of the MIT license:

The MIT License (MIT)

Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Jan 19, 2020
chosen (https://harvesthq.github.io/chosen/, https://github.com/harvesthq/chosen), which has been in use since wikimedia-gadgets#580 (xfd) and wikimedia-gadgets#641 (warn), has been causing some consistent CSS issues in the warn modules (wikimedia-gadgets#665), and has recently been deprecated: harvesthq/chosen@91041bc.  select2 (https://select2.org/, https://github.com/select2/select2) is an alternative to chosen that resolves those issues and is better maintained, albeit larger even without using the full version.

select2, however, is not part of MediaWiki's core ResourceLoader modules (T53443), so have to upload it ourselves as a gadget, as we once did for moment (67e24a5).  We could technically use the [Toolserver CDN](https://tools.wmflabs.org/cdnjs/) but that is potentially prone to occasional unreliability and is not whitelisted by the CSP (https://phabricator.wikimedia.org/T223840); that's still in 'report only' mode but users will have to opt-themselves out so it's not long-term reliable (https://phabricator.wikimedia.org/T208188).  Uploading it as a gadget avoids all that and makes use of the advantages of the ResourceLoader.

Uploaded under the terms of the MIT license:

The MIT License (MIT)

Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Jan 23, 2020
chosen (https://harvesthq.github.io/chosen/, https://github.com/harvesthq/chosen), which has been in use since wikimedia-gadgets#580 (xfd) and wikimedia-gadgets#641 (warn), has been causing some consistent CSS issues in the warn modules (wikimedia-gadgets#665), and has recently been deprecated: harvesthq/chosen@91041bc.  select2 (https://select2.org/, https://github.com/select2/select2) is an alternative to chosen that resolves those issues and is better maintained, albeit larger even without using the full version.

select2, however, is not part of MediaWiki's core ResourceLoader modules (T53443), so have to upload it ourselves as a gadget, as we once did for moment (67e24a5).  We could technically use the [Toolserver CDN](https://tools.wmflabs.org/cdnjs/) but that is potentially prone to occasional unreliability and is not whitelisted by the CSP (https://phabricator.wikimedia.org/T223840); that's still in 'report only' mode but users will have to opt-themselves out so it's not long-term reliable (https://phabricator.wikimedia.org/T208188).  Uploading it as a gadget avoids all that and makes use of the advantages of the ResourceLoader.

There's a bit of a complication, though: select2 registers the ResourceLoader as a nodejs/commonjs environment, making use of with `module.exports`, so a slight tweak has been made, commenting out that check; see [external libraries](https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_for_extension_developers#Special_case_of_external_libraries) and [T108655](https://phabricator.wikimedia.org/T108655.  This is not ideal long-term, but works for now and should be checked if/when select2 is updated.

----

Uploaded under the terms of the MIT license:

The MIT License (MIT)

Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Jan 24, 2020
chosen (https://harvesthq.github.io/chosen/, https://github.com/harvesthq/chosen), which has been in use since wikimedia-gadgets#580 (xfd) and wikimedia-gadgets#641 (warn), has been causing some consistent CSS issues in the warn modules (wikimedia-gadgets#665), and has recently been deprecated: harvesthq/chosen@91041bc.  select2 (https://select2.org/, https://github.com/select2/select2) is an alternative to chosen that resolves those issues and is better maintained, albeit larger even without using the full version.

select2, however, is not part of MediaWiki's core ResourceLoader modules (T53443), so have to upload it ourselves as a gadget, as we once did for moment (a2c3f93).  We could technically use the [Toolserver CDN](https://tools.wmflabs.org/cdnjs/) but that is potentially prone to occasional unreliability and is not whitelisted by the CSP (https://phabricator.wikimedia.org/T223840); that's still in 'report only' mode but users will have to opt-themselves out so it's not long-term reliable (https://phabricator.wikimedia.org/T208188).  Uploading it as a gadget avoids all that and makes use of the advantages of the ResourceLoader.

There's a bit of a complication, though: select2 registers the ResourceLoader as a nodejs/commonjs environment, making use of with `module.exports`, so a slight tweak has been made, commenting out that check; see [external libraries](https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_for_extension_developers#Special_case_of_external_libraries) and [T108655](https://phabricator.wikimedia.org/T108655.  This is not ideal long-term, but works for now and should be checked if/when select2 is updated.

----

Uploaded under the terms of the MIT license:

The MIT License (MIT)

Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Amorymeltzer added a commit that referenced this pull request Jan 24, 2020
Replaced by select2; added in #580 and #641, removed in #692
@siddharthvp siddharthvp deleted the warn-chosen branch October 22, 2020 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search user warnings
2 participants