-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from penwern/console-modifications
Console modifications
- Loading branch information
Showing
4 changed files
with
89 additions
and
19 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const elementsToFind = [ | ||
// Expressions should return the element to remove | ||
(doc) => doc.querySelector(".icomoon-cells")?.closest("button"), | ||
(doc) => doc.querySelector(".layout-fill"), | ||
]; | ||
|
||
function modifyConsole() { | ||
console.log("console modifier"); | ||
// wait for pydio to be loaded | ||
if (!pydio?.user) { | ||
console.log("pydio not loaded yet"); | ||
setTimeout(modifyConsole, 100); | ||
return; | ||
} | ||
if (!pydio.user.isAdmin) { | ||
pydio.observe("context_changed", (e) => { | ||
if (e._label === "Settings") { | ||
const observer = new MutationObserver(() => { | ||
let removedSomething = false; | ||
|
||
elementsToFind.forEach((finder) => { | ||
const element = finder(document); | ||
if (element) { | ||
element.remove(); | ||
removedSomething = true; | ||
} | ||
}); | ||
|
||
if (removedSomething) { | ||
observer.disconnect(); | ||
} | ||
}); | ||
|
||
observer.observe(document.body, { | ||
childList: true, | ||
subtree: true, | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
window.removeEventListener("load", modifyConsole); | ||
} | ||
|
||
window.addEventListener("load", modifyConsole); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const systemName = window.curateDistrobution || "Soteria+"; // could be replaced with something that figures out whether we're in Soteria+ or Curate | ||
|
||
const welcomeMessage = () => { | ||
console.log("message modifier"); | ||
const messages = pydioBootstrap.parameters.get("i18nMessages"); | ||
|
||
// Function to handle both "Cells" and "Pydio Cells" replacements | ||
const replaceSystemNames = (text) => { | ||
return text | ||
.replace(/Pydio\s*Cells/gi, systemName) // Replace "Pydio Cells" or "PydioCells" | ||
.replace(/(?<!Pydio\s*)Cells/gi, systemName); // Replace standalone "Cells" not preceded by "Pydio" | ||
}; | ||
|
||
// Process all messages that might contain "Cells" references | ||
Object.keys(messages).forEach((key) => { | ||
if (typeof messages[key] === "string") { | ||
messages[key] = replaceSystemNames(messages[key]); | ||
} | ||
}); | ||
window.removeEventListener("load", welcomeMessage); | ||
}; | ||
|
||
window.addEventListener("load", welcomeMessage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
import '../js/core/CurateFunctions/CurateFunctions.js'; | ||
import '../js/core/CustomPreservationConfigs.js'; | ||
import '../js/core/fileInfoModifier.js'; | ||
import '../js/core/MetadataHierarchies.js'; | ||
import '../js/core/OAIHarvestClient.js'; | ||
import '../js/core/publicAccessModifier.js'; | ||
import '../js/core/tourModifier.js'; | ||
import '../js/core/ChecksumValidation.js'; | ||
import '../js/core/PassOaiToChildren.js'; | ||
import '../js/web-components/atom-search.js'; | ||
import '../js/web-components/atom-connector.js'; | ||
import '../js/web-components/dip-slug-resolver.js'; | ||
import '../js/web-components/contextual-help.js'; | ||
import '../js/web-components/oai-harvest-updates.js'; | ||
import '../js/core/fixes/FixInfoPanelScroll.js'; | ||
import "../js/core/CurateFunctions/CurateFunctions.js"; | ||
import "../js/core/CustomPreservationConfigs.js"; | ||
import "../js/core/fileInfoModifier.js"; | ||
import "../js/core/MetadataHierarchies.js"; | ||
import "../js/core/OAIHarvestClient.js"; | ||
import "../js/core/publicAccessModifier.js"; | ||
import "../js/core/tourModifier.js"; | ||
import "../js/core/ChecksumValidation.js"; | ||
import "../js/core/PassOaiToChildren.js"; | ||
import "../js/core/consoleModifier.js"; | ||
import "../js/core/messageModifier.js"; | ||
import "../js/web-components/atom-search.js"; | ||
import "../js/web-components/atom-connector.js"; | ||
import "../js/web-components/dip-slug-resolver.js"; | ||
import "../js/web-components/contextual-help.js"; | ||
import "../js/web-components/oai-harvest-updates.js"; | ||
//import './deprecated/UploadChecksumGenerator.js'; | ||
import '../js/core/PermissionEnforcers.js' | ||
import '../js/external/ExternalScripts.js'; | ||
import "../js/core/PermissionEnforcers.js"; | ||
import "../js/external/ExternalScripts.js"; | ||
//import 'chart.js'; | ||
//import Swal from 'sweetalert2'; | ||
//import Papa from 'papaparse'; | ||
//import he from 'he'; | ||
//import he from 'he'; |