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

G2G new feature: fixing My WikiTree link / small bugfix for preview links feature #512

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/features/g2g/g2g.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ function replacePermaLinks() {
//https://www.wikitree.com/g2g/1652303/join-the-2nd-germany-research-party-on-wikitree-day?show=1657604#a1657604

const indexShow = allAnchorNodes[i].href.indexOf("show=");
const indexHash = allAnchorNodes[i].href.indexOf("#"); //spare the top left menu when show= is used
const indexLast = allAnchorNodes[i].href.length - 1;

if (indexShow > -1) {
if (indexShow > -1 && indexHash < indexLast) {
//console.log(allAnchorNodes[i].href);
const indexHash = allAnchorNodes[i].href.indexOf("#");
const indexAfterHashAndAorC = indexHash + 2;
Expand Down Expand Up @@ -163,6 +165,9 @@ async function initG2G() {
replacePermaLinks();
}
}
if (options.fixHome) {
document.getElementsByClassName("pureCssMenui0")[0].href = "https://www.wikitree.com/wiki/Special:Home";
}
}

shouldInitializeFeature("g2g").then((result) => {
Expand Down
6 changes: 6 additions & 0 deletions src/features/g2g/g2g_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ const g2g = {
label: "Turn WikiTree IDs into links to the profiles",
defaultValue: true,
},
{
id: "fixHome",
type: OptionType.CHECKBOX,
label: "Make 'My WikiTree' link work like on other pages",
defaultValue: true,
},
{
id: "previewLinks",
type: OptionType.CHECKBOX,
Expand Down
Loading