From 98a4413762e86ada76babbe0c1d2573a20e5cb09 Mon Sep 17 00:00:00 2001 From: Matr1x-101 <70490301+Matr1x-101@users.noreply.github.com> Date: Thu, 2 Oct 2025 21:12:23 +0100 Subject: [PATCH 1/7] Dark mode fixes --- anrfc-lister.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/anrfc-lister.js b/anrfc-lister.js index 53250e6..2d21fd7 100644 --- a/anrfc-lister.js +++ b/anrfc-lister.js @@ -143,7 +143,8 @@ class ANRFC { $anrfcBox.css( { margin: '16px 0', padding: '16px', - 'background-color': '#f3f3f3', + 'background-color': 'var(--background-color-neutral-subtle, #f8f9fa)', + color: 'inherit', border: '1px solid grey', 'font-size': '14px', 'font-family': 'sans-serif' From 88f9f2364a53331af4074c4ecd633ceec6a171bf Mon Sep 17 00:00:00 2001 From: Matr1x-101 <70490301+Matr1x-101@users.noreply.github.com> Date: Sat, 4 Oct 2025 12:28:22 +0100 Subject: [PATCH 2/7] Use CSS instead of inline JS styles --- anrfc-lister.js | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/anrfc-lister.js b/anrfc-lister.js index 2d21fd7..da8b844 100644 --- a/anrfc-lister.js +++ b/anrfc-lister.js @@ -45,6 +45,8 @@ NOVEM LINGUAE TODO: // +mw.loader.load('/w/index.php?title=User:NovemLinguae/anrfc-test.css&action=raw&ctype=text/css', 'text/css'); + class ANRFC { constructor( document, mw, $ ) { this.document = document; @@ -85,11 +87,11 @@ class ANRFC { toggle() { const $anrfcListerLinkInMoreMenu = this.$( '#ca-anrfc a' ); - if ( $anrfcListerLinkInMoreMenu.css( 'color' ) === 'rgb(255, 0, 0)' ) { - $anrfcListerLinkInMoreMenu.css( 'color', '' ); + if ( $anrfcListerLinkInMoreMenu.hasClass( 'anrfc-link-active' ) ) { + $anrfcListerLinkInMoreMenu.removeClass('anrfc-link-active') this.removeLabels(); } else { - $anrfcListerLinkInMoreMenu.css( 'color', 'red' ); + $anrfcListerLinkInMoreMenu.addClass('anrfc-link-active') this.addLabels(); } } @@ -115,7 +117,6 @@ class ANRFC { that.$( 'a[indexkey="' + index + '"]' ).on( 'click', function () { that.addForm( this ); } ); - that.$( 'a.mw-ANRFC' ).css( { 'margin-left': '8px', 'font-size': 'small', 'font-family': 'sans-serif' } ); } ); } @@ -137,17 +138,8 @@ class ANRFC { getFormHtmlAndSetFormListeners( keyId ) { const $anrfcBox = this.$( '
', { - id: keyId - } ); - - $anrfcBox.css( { - margin: '16px 0', - padding: '16px', - 'background-color': 'var(--background-color-neutral-subtle, #f8f9fa)', - color: 'inherit', - border: '1px solid grey', - 'font-size': '14px', - 'font-family': 'sans-serif' + id: keyId, + class: "anrfc-box" } ); const items = []; @@ -185,21 +177,17 @@ class ANRFC { label: 'Cancel' } ); - $anrfcBox.append( '

List this discussion on Wikipedia:Closure requests

' ); + $anrfcBox.append( '

List this discussion on Wikipedia:Closure requests

' ); let wrapper = this.document.createElement( 'div' ); this.$( wrapper ).append( '

Under section:

' ); this.$( wrapper ).append( dropDown.$element ); $anrfcBox.append( wrapper ); wrapper = this.document.createElement( 'div' ); - this.$( wrapper ).css( { 'margin-top': '8px' } ); + this.$( wrapper ).addClass( 'anrfc-box-margins' ); this.$( wrapper ).append( messageInput.$element ); - this.$( wrapper ).append( this.$( submitButton.$element ).css( { - 'margin-top': '8px' - } ) ); - this.$( wrapper ).append( this.$( cancelButton.$element ).css( { - 'margin-top': '8px' - } ) ); + this.$( wrapper ).append( this.$( submitButton.$element ).addClass( 'anrfc-box-margins' )); + this.$( wrapper ).append( this.$( cancelButton.$element ).addClass( 'anrfc-box-margins' )); $anrfcBox.append( wrapper ); submitButton.on( 'click', () => { From 339f8d46d985105de7e3eedf8bd0c9be35d3c785 Mon Sep 17 00:00:00 2001 From: Matr1x-101 <70490301+Matr1x-101@users.noreply.github.com> Date: Sat, 4 Oct 2025 12:29:16 +0100 Subject: [PATCH 3/7] Add CSS file --- anrfc-lister.css | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 anrfc-lister.css diff --git a/anrfc-lister.css b/anrfc-lister.css new file mode 100644 index 0000000..bd3b577 --- /dev/null +++ b/anrfc-lister.css @@ -0,0 +1,33 @@ +/* CSS styles for anrfc-lister script. Added by [[User:Matrix]]. */ + +.anrfc-box { + margin: 16px 0px; + padding: 16px; + background-color: var(--background-color-neutral-subtle, #f8f9fa); + color: inherit; + border: 1px solid #a2a9b1; + font-size: 14px; + font-family: sans-serif; +} + +.anrfc-box h3 { + margin: 0 0 16px; +} + +.anrfc-box .anrfc-box-margins { + margin-top: 8px; +} + +.mw-ANRFC { + margin-left: 8px; + font-size: small; + font-family: sans-serif; +} + +#ca-anrfc .anrfc-link-active { + color: var(--color-destructive, #bf3c2c); +} + +#ca-anrfc .anrfc-link-active:hover { + color: var(--color-destructive--hover, #9f3526); +} From 6e9a193b6e96c1cf8343813c4b4d744f25ac7fcf Mon Sep 17 00:00:00 2001 From: Matr1x-101 <70490301+Matr1x-101@users.noreply.github.com> Date: Sat, 4 Oct 2025 16:04:30 +0100 Subject: [PATCH 4/7] Delete anrfc-lister.css --- anrfc-lister.css | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 anrfc-lister.css diff --git a/anrfc-lister.css b/anrfc-lister.css deleted file mode 100644 index bd3b577..0000000 --- a/anrfc-lister.css +++ /dev/null @@ -1,33 +0,0 @@ -/* CSS styles for anrfc-lister script. Added by [[User:Matrix]]. */ - -.anrfc-box { - margin: 16px 0px; - padding: 16px; - background-color: var(--background-color-neutral-subtle, #f8f9fa); - color: inherit; - border: 1px solid #a2a9b1; - font-size: 14px; - font-family: sans-serif; -} - -.anrfc-box h3 { - margin: 0 0 16px; -} - -.anrfc-box .anrfc-box-margins { - margin-top: 8px; -} - -.mw-ANRFC { - margin-left: 8px; - font-size: small; - font-family: sans-serif; -} - -#ca-anrfc .anrfc-link-active { - color: var(--color-destructive, #bf3c2c); -} - -#ca-anrfc .anrfc-link-active:hover { - color: var(--color-destructive--hover, #9f3526); -} From d512168549a2c55d4c3ac8e572448d01d325e4be Mon Sep 17 00:00:00 2001 From: Matr1x-101 <70490301+Matr1x-101@users.noreply.github.com> Date: Sat, 4 Oct 2025 16:06:09 +0100 Subject: [PATCH 5/7] Use internal styles instead --- anrfc-lister.js | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/anrfc-lister.js b/anrfc-lister.js index da8b844..1a5e176 100644 --- a/anrfc-lister.js +++ b/anrfc-lister.js @@ -36,6 +36,9 @@ CHANGES BY NOVEM LINGUAE: - Titles shouldn't have underscores - Fixed bug where the script would always give "signature not found" error if you had MediaWiki:Gadget-CommentsInLocalTime.js gadget installed +CHANGES BY MATRIX +- Fix in dark mode, use internal style sheet instead of inline styles + NOVEM LINGUAE TODO: - test unicode titles - test titles with weird punctuation in section names, e.g. ending in ? @@ -45,7 +48,40 @@ NOVEM LINGUAE TODO: // -mw.loader.load('/w/index.php?title=User:NovemLinguae/anrfc-test.css&action=raw&ctype=text/css', 'text/css'); +const style = `.anrfc-box { + margin: 16px 0px; + padding: 16px; + background-color: var(--background-color-neutral-subtle, #f8f9fa); + color: inherit; + border: 1px solid #a2a9b1; + font-size: 14px; + font-family: sans-serif; +} + +.anrfc-box h3 { + margin: 0 0 16px; +} + +.anrfc-box .anrfc-box-margins { + margin-top: 8px; +} + +.mw-ANRFC { + margin-left: 8px; + font-size: small; + font-family: sans-serif; +} + +#ca-anrfc .anrfc-link-active { + color: var(--color-destructive, #bf3c2c); +} + +#ca-anrfc .anrfc-link-active:hover { + color: var(--color-destructive--hover, #9f3526); +} +`; + +mw.util.addCSS(style); class ANRFC { constructor( document, mw, $ ) { @@ -88,10 +124,10 @@ class ANRFC { toggle() { const $anrfcListerLinkInMoreMenu = this.$( '#ca-anrfc a' ); if ( $anrfcListerLinkInMoreMenu.hasClass( 'anrfc-link-active' ) ) { - $anrfcListerLinkInMoreMenu.removeClass('anrfc-link-active') + $anrfcListerLinkInMoreMenu.removeClass('anrfc-link-active'); this.removeLabels(); } else { - $anrfcListerLinkInMoreMenu.addClass('anrfc-link-active') + $anrfcListerLinkInMoreMenu.addClass('anrfc-link-active'); this.addLabels(); } } From b4810633c7418f62f3f0be37471f90bc1be0971c Mon Sep 17 00:00:00 2001 From: Matr1x-101 <70490301+Matr1x-101@users.noreply.github.com> Date: Sat, 11 Oct 2025 16:01:45 +0100 Subject: [PATCH 6/7] change changelog --- anrfc-lister.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/anrfc-lister.js b/anrfc-lister.js index 1a5e176..164290e 100644 --- a/anrfc-lister.js +++ b/anrfc-lister.js @@ -36,8 +36,8 @@ CHANGES BY NOVEM LINGUAE: - Titles shouldn't have underscores - Fixed bug where the script would always give "signature not found" error if you had MediaWiki:Gadget-CommentsInLocalTime.js gadget installed -CHANGES BY MATRIX -- Fix in dark mode, use internal style sheet instead of inline styles +CHANGES BY OTHERS SINCE THIS WAS FORKED +- Added dark mode support NOVEM LINGUAE TODO: - test unicode titles From 3b86d55f63b7251834a6c96087418ed0df63679b Mon Sep 17 00:00:00 2001 From: Matr1x-101 <70490301+Matr1x-101@users.noreply.github.com> Date: Sat, 11 Oct 2025 16:03:34 +0100 Subject: [PATCH 7/7] use direct descendant selector which is more efficient --- anrfc-lister.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anrfc-lister.js b/anrfc-lister.js index 164290e..0cf72c1 100644 --- a/anrfc-lister.js +++ b/anrfc-lister.js @@ -58,7 +58,7 @@ const style = `.anrfc-box { font-family: sans-serif; } -.anrfc-box h3 { +.anrfc-box > h3 { margin: 0 0 16px; }