From 9e1110eacf480865e0438df4b21dc8875f0a2c55 Mon Sep 17 00:00:00 2001 From: NovemLinguae <79697282+NovemLinguae@users.noreply.github.com> Date: Sun, 2 Jun 2024 00:05:03 -1000 Subject: [PATCH 1/5] turn off unit testing in `npm run build:dev` (#45) unit testing should be done in continuous integration, not during development builds. doing it during development builds is inconvenient. for example, adding a `debugger;` statement breaks the build, making it hard to do debugging in localhost. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a2e5e7c..816aead 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "build:concat": "concat-cli -f \"core-comment-top.js\" dist/core.min.js \"core-comment-bottom.js\" -o dist/core-gadget.js", "build:css": "node bin/concatCss", "build": "npm run globals:window && npm run build:loader && npm run lint && npm run test:all && npm run build:css && npm run build:bundle && npm run build:minify && npm run build:concat", - "build:dev": "npm run globals:window && npm run build:loader:dev && npm run lint:dev && npm run test:all && npm run build:css && npm run build:bundle ", + "build:dev": "npm run globals:window && npm run build:loader:dev && npm run build:css && npm run build:bundle", "build:quickdev": "npm run globals:window && npm run build:loader:dev && npm run build:bundle " }, "author": { From 33c4ff923d4337e898b471419a6b4027d0a4bb17 Mon Sep 17 00:00:00 2001 From: NovemLinguae <79697282+NovemLinguae@users.noreply.github.com> Date: Sun, 2 Jun 2024 01:22:18 -1000 Subject: [PATCH 2/5] fix missing xfdcloser links in old skins (#56) fix #54 headings sometimes incorrectly marked as closed on old skins (discussionText being read incorrectly) --- xfdcloser-src/App.js | 20 ++++------ xfdcloser-src/Venue.js | 54 ++++++++++++++++++++++++--- xfdcloser-src/Views/DiscussionView.js | 8 +++- 3 files changed, 61 insertions(+), 21 deletions(-) diff --git a/xfdcloser-src/App.js b/xfdcloser-src/App.js index 0bdaa8a..4eac352 100644 --- a/xfdcloser-src/App.js +++ b/xfdcloser-src/App.js @@ -66,22 +66,16 @@ import DiscussionView from "./Views/DiscussionView"; }); }); } else { + let heading = config.xfd.html.headlineinner.oldskin; + if ( [ "vector", "vector-2022", "minerva" ].includes ( mw.config.get( "skin" ) ) ) { + heading = config.xfd.html.headlineinner.newskin; + } + // Initialise show/hide closed discussions tag, unless there is only one discussion on the page - const showHide = $("#mw-content-text " + config.xfd.html.head).length > 1 && ShowHideTag.initialiseNewTag(); + const showHide = $("#mw-content-text " + heading).length > 1 && ShowHideTag.initialiseNewTag(); // Set up discussion object for each discussion - let headings; - switch ( mw.config.get( "skin" ) ) { - case "vector": - case "vector-2022": - case "minerva": - headings = config.xfd.html.head + " > span.mw-headline"; - break; - default: - headings = config.xfd.html.head; - } - - $( headings ) + $( heading ) .not(".XFDcloser-ignore") .each(function(index) { try { diff --git a/xfdcloser-src/Venue.js b/xfdcloser-src/Venue.js index 1eb27ce..d74d109 100644 --- a/xfdcloser-src/Venue.js +++ b/xfdcloser-src/Venue.js @@ -54,7 +54,14 @@ Venue.Mfd = () => new Venue("mfd", { hasIndividualSubpages: true, ns_number: null, html: { - head: "h4", + headlineouter: { + newskin: "h4", + oldskin: ".mw-heading.mw-heading4" + }, + headlineinner: { + newskin: "h4 > .mw-headline", + oldskin: "h4" + }, list: "dl", listitem: "dd" }, @@ -80,7 +87,14 @@ Venue.Cfd = () => { path: "Wikipedia:Categories for discussion/Log/", ns_number: [14], html: { - head: "h4", + headlineouter: { + newskin: "h4", + oldskin: ".mw-heading.mw-heading4" + }, + headlineinner: { + newskin: "h4 > .mw-headline", + oldskin: "h4" + }, list: "ul", listitem: "li", nthSpan: "2" @@ -130,7 +144,14 @@ Venue.Ffd = () => new Venue("ffd", { ns_number: [6], ns_unlink: ["0", "10", "100", "118"], // main, Template, Portal, Draft html: { - head: "h4", + headlineouter: { + newskin: "h4", + oldskin: ".mw-heading.mw-heading4" + }, + headlineinner: { + newskin: "h4 > .mw-headline", + oldskin: "h4" + }, list: "dl", listitem: "dd", nthSpan: "1" @@ -158,7 +179,14 @@ Venue.Tfd = () => { subpagePath: "Wikipedia:Templates for discussion/", ns_number: [10, 828], html: { - head: "h4", + headlineouter: { + newskin: "h4", + oldskin: ".mw-heading.mw-heading4" + }, + headlineinner: { + newskin: "h4 > .mw-headline", + oldskin: "h4" + }, list: "ul", listitem: "li", nthSpan: "1" @@ -235,7 +263,14 @@ Venue.Rfd = () => { path: "Wikipedia:Redirects for discussion/Log/", ns_number: null, html: { - head: "h4", + headlineouter: { + newskin: "h4", + oldskin: ".mw-heading.mw-heading4" + }, + headlineinner: { + newskin: "h4 > .mw-headline", + oldskin: "h4" + }, list: "ul", listitem: "li" }, @@ -274,7 +309,14 @@ Venue.Afd = transcludedOnly => new Venue("afd", { ns_logpages: 4, // Wikipedia ns_unlink: ["0", "10", "100", "118"], // main, Template, Portal, Draft html: { - head: "h3", + headlineouter: { + newskin: "h3", + oldskin: ".mw-heading.mw-heading3" + }, + headlineinner: { + newskin: "h3 > .mw-headline", + oldskin: "h3" + }, list: "dl", listitem: "dd", nthSpan: "2" diff --git a/xfdcloser-src/Views/DiscussionView.js b/xfdcloser-src/Views/DiscussionView.js index f49eea4..9bd9254 100644 --- a/xfdcloser-src/Views/DiscussionView.js +++ b/xfdcloser-src/Views/DiscussionView.js @@ -181,10 +181,14 @@ DiscussionView.newFromHeadline = function({headingIndex, context, venue, current // Find all nodes that are part of this discussion (i.e. excluding subsequent closed discussions) $("table.mw-collapsible").has("div.xfd-closed").addClass("xfd-closed"); // Fix for closed discussion within a collapsed table (e.g. MfD) - const $discussionNodes = $heading.nextUntil(venue.html.head + ", div.xfd-closed, table.xfd-closed"); + let headlineouter = venue.html.headlineouter.oldskin; + if ( [ "vector", "vector-2022", "minerva" ].includes ( mw.config.get( "skin" ) ) ) { + headlineouter = venue.html.headlineouter.newskin; + } + const $discussionNodes = $heading.nextUntil(headlineouter + ", div.xfd-closed, table.xfd-closed"); $discussionNodes.addClass(`${id}-discussion-node`); - // Get list of nominated pages. Also the proposed action for CfD. + // Get list of nominated pages. Also the proposed action for CfD. let pages = []; let action = ""; if (venue.type === "cfd") { From 2e763390bfd6cf2a64b8c21f87a194c7b3cef8f4 Mon Sep 17 00:00:00 2001 From: NovemLinguae <79697282+NovemLinguae@users.noreply.github.com> Date: Sun, 2 Jun 2024 01:27:10 -1000 Subject: [PATCH 3/5] fix height of XFDcloser links in Minerva (#58) fix #57 XFDcloser links in Minerva are slightly too high --- styles-src/discussion.css | 1 - 1 file changed, 1 deletion(-) diff --git a/styles-src/discussion.css b/styles-src/discussion.css index 14d0c39..358a456 100644 --- a/styles-src/discussion.css +++ b/styles-src/discussion.css @@ -12,7 +12,6 @@ .skin-minerva .xfdc-status { font-size: 0.98rem; display: block; - margin: -1rem 0 1rem; } .xfdc-action { From df2d5b666b8d5456e6186bf87aee9d20a903fbc7 Mon Sep 17 00:00:00 2001 From: NovemLinguae <79697282+NovemLinguae@users.noreply.github.com> Date: Sun, 2 Jun 2024 01:37:16 -1000 Subject: [PATCH 4/5] Bump to version 4.0.14 (#59) --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 121f4a5..5e1d0fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "xfdcloser", - "version": "4.0.13", + "version": "4.0.14", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 816aead..14a7e94 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xfdcloser", - "version": "4.0.13", + "version": "4.0.14", "description": "Wikipedia userscript that helps assess pages for WikiProjects", "homepage": "https://github.com/wikimedia-gadgets/xfdcloser", "browser": "index.js", From ca049a8e3af668d8e3f859b0bba32a82713ef4b4 Mon Sep 17 00:00:00 2001 From: NovemLinguae <79697282+NovemLinguae@users.noreply.github.com> Date: Sun, 2 Jun 2024 05:41:53 -1000 Subject: [PATCH 5/5] copy edit comments & readme (#61) --- README.md | 4 ++-- bin/version.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b6bb79c..aef33e7 100644 --- a/README.md +++ b/README.md @@ -78,9 +78,9 @@ On-wiki testing is conducted at the [Test Wikipedia](https://test.wikipedia.org/ ## Deployment As XFDcloser is a gadget, you must have interface-admin rights to deploy to the wiki. 1. Ensure: - - changes are committed and merged to master branch on GitHub rep + - changes are committed and merged to master branch of the GitHub repo - you are currently on the master branch, and synced with GitHub repo -2. Bump the version number. See the comments in the `bin\version.js` file for how to do this from the terminal. +2. Bump the version number. See the comments in the `bin\version.js` file for how to do this from the terminal. 3. Commit the version change, and push/sync to GitHub repo 4. Run a full build: run `npm run build` in terminal 5. You are now ready to deploy: see the comments in the `bin\deploy.js` file for how to do this from the terminal. diff --git a/bin/version.js b/bin/version.js index 9b84a55..df753cb 100644 --- a/bin/version.js +++ b/bin/version.js @@ -5,7 +5,7 @@ * - bug fixes and very small changes increment the patch number * - new features and other changes increment the minor number and reset the * patch number to 0 - * - significant changes, such as shifting coding paradyms or completely + * - significant changes, such as shifting coding paradigms or completely * redesigning the UI, increment the major number and reset both the minor * and patch numbers to 0 *