From e0b23bbbf55aa83eff4bebced36ddb3f011dbe35 Mon Sep 17 00:00:00 2001 From: Flominatortm Date: Sat, 8 Jun 2024 05:49:46 +0200 Subject: [PATCH 1/2] Usability Tweaks: sneaking "and" in between parents in example --- src/features/usability_tweaks/usability_tweaks.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/features/usability_tweaks/usability_tweaks.js b/src/features/usability_tweaks/usability_tweaks.js index fff853b5..933e0623 100644 --- a/src/features/usability_tweaks/usability_tweaks.js +++ b/src/features/usability_tweaks/usability_tweaks.js @@ -594,6 +594,15 @@ shouldInitializeFeature("usabilityTweaks").then((result) => { if (isPlusDomain && options.enhanceThonPages) { enhanceThonStats(); } + + if (isProfileEdit) { + //insert and between the parents in the example + var allExamples = document.getElementsByClassName("EXAMPLE"); + if (allExamples[2].innerHTML != null && allExamples[2].innerHTML.search(/\]\] \[\[/) > -1) { + allExamples[2].innerText = allExamples[2].innerHTML.replace("]] [[", "]] and [[").trim(); + } + } + }); //getFeatureOptions } }); From fa4cb95f81a5a2882f15e4e91a02e388e54fb46d Mon Sep 17 00:00:00 2001 From: Flominatortm Date: Sat, 8 Jun 2024 05:55:53 +0200 Subject: [PATCH 2/2] Usability Tweaks: separate option for "and" between parents --- .../usability_tweaks/usability_tweaks.js | 23 ++++++++++--------- .../usability_tweaks_options.js | 6 +++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/features/usability_tweaks/usability_tweaks.js b/src/features/usability_tweaks/usability_tweaks.js index 933e0623..9dfff8bc 100644 --- a/src/features/usability_tweaks/usability_tweaks.js +++ b/src/features/usability_tweaks/usability_tweaks.js @@ -541,8 +541,18 @@ shouldInitializeFeature("usabilityTweaks").then((result) => { } // Open Add/Remove/Replace links in the same tab - if (isProfileEdit && options.removeTargetsFromEditFamilyLinks) { - $("a[href*='&who=']").attr("target", "_self"); + if (isProfileEdit) { + if (options.removeTargetsFromEditFamilyLinks) { + $("a[href*='&who=']").attr("target", "_self"); + } + + if (options.andBetweenParentsExample) { + //insert and between the parents in the example + var allExamples = document.getElementsByClassName("EXAMPLE"); + if (allExamples[2].innerHTML != null && allExamples[2].innerHTML.search(/\]\] \[\[/) > -1) { + allExamples[2].innerText = allExamples[2].innerHTML.replace("]] [[", "]] and [[").trim(); + } + } } // Replace Add/Remove/Replace links with Add, Remove, Connect links @@ -594,15 +604,6 @@ shouldInitializeFeature("usabilityTweaks").then((result) => { if (isPlusDomain && options.enhanceThonPages) { enhanceThonStats(); } - - if (isProfileEdit) { - //insert and between the parents in the example - var allExamples = document.getElementsByClassName("EXAMPLE"); - if (allExamples[2].innerHTML != null && allExamples[2].innerHTML.search(/\]\] \[\[/) > -1) { - allExamples[2].innerText = allExamples[2].innerHTML.replace("]] [[", "]] and [[").trim(); - } - } - }); //getFeatureOptions } }); diff --git a/src/features/usability_tweaks/usability_tweaks_options.js b/src/features/usability_tweaks/usability_tweaks_options.js index d782dfee..943bab49 100644 --- a/src/features/usability_tweaks/usability_tweaks_options.js +++ b/src/features/usability_tweaks/usability_tweaks_options.js @@ -58,6 +58,12 @@ const usabilityTweaks = { type: OptionType.GROUP, label: "Profile edit page", options: [ + { + id: "andBetweenParentsExample", + type: OptionType.CHECKBOX, + label: "Insert 'and' between the parents in the wiki code example.", + defaultValue: true, + }, { id: "removeTargetsFromEditFamilyLinks", type: OptionType.CHECKBOX,