Skip to content

Commit

Permalink
add note about incompatibilty with v3
Browse files Browse the repository at this point in the history
  • Loading branch information
FreekBes committed Oct 2, 2024
1 parent e2e28e9 commit 8f0a1b7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
23 changes: 23 additions & 0 deletions fixes/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,29 @@ function setInternshipAdministrationImprovements(match) {
}
}

/**
* Improvements for Intra v3 early access page (add note that v3 is not supported by Improved Intra)
* @param {RegExpExecArray} match
*/
function setEarlyAccessImprovements(match) {
const earlyAccessContainer = document.getElementById("profile-v3-early-access-container");
if (earlyAccessContainer) {
const earlyAccessNote = document.createElement("p");
earlyAccessNote.className = "alert alert-warning";
earlyAccessNote.style.marginTop = "6rem";
earlyAccessNote.style.fontWeight = "bold";
earlyAccessNote.style.whiteSpace = "pre-wrap"; // make sure the note line breaks on \r\n
earlyAccessNote.innerText = "Improved Intra does not support Intra v3 and probably never will.\r\n This is due to the fact the new Intra is impossible to work with for extensions because of its heavy use of elements without specific ids or classes.\r\n\r\nIf you want to use Improved Intra without issues, keep using Intra v2. If you want to use v3, it is recommended to disable the Improved Intra extension.";
earlyAccessContainer.appendChild(earlyAccessNote);

// replace the container class with container-inner-item class to prevent the container from going out of bounds
while (wrongContainerUse = earlyAccessContainer.closest(".container")) {
iConsole.log("Replaced container class with container-inner-item class", wrongContainerUse);
wrongContainerUse.classList.replace("container", "container-inner-item");
}
}
}

/**
* Improvements for user profile pages
* @param {RegExpExecArray} match
Expand Down
4 changes: 4 additions & 0 deletions fixes/improv.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ const improvementsPerUrl = [
guard: () => /^companies\.intra\.42\.fr\/(?<lang>[a-z]+)\/administrations\/(?<administration_id>[0-9]+)\/?$/.exec(pageUrl),
handler: setInternshipAdministrationImprovements,
},
{
guard: () => /^profile\.intra\.42\.fr\/v3_early_access\/?$/.exec(pageUrl),
handler: setEarlyAccessImprovements,
},
{ handler: setOptionalImprovements },
];

Expand Down

0 comments on commit 8f0a1b7

Please sign in to comment.