Skip to content

Commit

Permalink
Usability Tweaks: separate option for "and" between parents
Browse files Browse the repository at this point in the history
  • Loading branch information
FlominatorTM committed Jun 8, 2024
1 parent e0b23bb commit fa4cb95
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/features/usability_tweaks/usability_tweaks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
});
6 changes: 6 additions & 0 deletions src/features/usability_tweaks/usability_tweaks_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fa4cb95

Please sign in to comment.