-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Anonymized screenshots - Lorem Ipsemifier - dummy text #9615
Comments
To add some keywords:
Screenshot mockup: https://codepen.io/MadLittleMods/pen/VwyJEOE You can also see a video demo of this in action: https://youtu.be/n78tHoCx1es?t=252 JavaScript to create screenshot mockup// Wraps every text node with `span.anonymous-text-block` which can
// be styled to make all text into color blocks to anonymize it.
function anonymizeContentInNode(node) {
// This is just nested here to make it easy to copy-paste a single function
const template = document.createElement('template');
function createNodesFromHtml(html) {
template.innerHTML = html;
return template.content.childNodes;
}
// Loop through each child in the given node
let nextSibling;
for (node = node.firstChild; node; node = nextSibling) {
// Record this before we potentially replace the node below and it will lose its siblings
// and seems to freeze the browser.
nextSibling = node.nextSibling;
// Don't mangle styles and scripts
if (node.tagName && ['style', 'script'].includes(node.tagName.toLowerCase())) {
continue;
}
// Don't anonymize twice if this function is run more than once (while testing).
// This is not related to the recursive nature of this function.
if (node.classList && node.classList.contains('anonymous-text-block')) {
continue;
}
// Only text nodes
if (node.nodeType === 3) {
const newNodes = [];
// Split the text by whitespace
[...node.textContent.matchAll(/(\s*)(\S*)(\s*)/g)].forEach(([_, padStart, text, padEnd]) => {
// Ensure the white-space is maintained
newNodes.push(...createNodesFromHtml(padStart));
// No need to touch empty nodes
if (text.length !== 0) {
const html = `<span class="anonymous-text-block">${text}</span>`;
newNodes.push(...createNodesFromHtml(html));
}
// Ensure the white-space is maintained
newNodes.push(...createNodesFromHtml(padEnd));
});
// Replace the text node with our wrapped text that we can style with CSS
node.replaceWith(...newNodes);
} else {
// Recursively call for each element
anonymizeContentInNode(node);
}
}
}
anonymizeContentInNode(document.querySelector('body'));
// Add some CSS styles
document.body.insertAdjacentHTML('beforeend', `
<style>
.should-anonymize .anonymous-text-block {
overflow: hidden;
display: inline-block;
height: 1ex;
margin-top: calc((1em - 1ex) / 2);
background-color: currentColor;
opacity: 0.65;
border-radius: 4px;
}
.should-anonymize img {
filter: blur(4px);
}
</style>
`);
document.body.classList.add('should-anonymize'); Right now it’s a general script that runs on any page and replaces all text nodes on the page. But we don’t need to replace all text nodes. The normal strings in the UI aren’t sensitive. We only need to apply this to user-generated content that is sensitive like messages, room names, and things like IP’s and keys in the settings, etc. So this could benefit from some deeper integration in Element itself. Probably related to the skeleton UI (placeholder content before a SPA hydrates with real content) styles we already have in place: Another example is the code syntax minimap styles you would see in a code editor (VSCode, Atom, Sublime): When in this mode, it would also be interesting to add some |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@JokerGermany This is very noisy and this issue is not really the place to nitpick the proof of concept (obviously not perfect and just made to craft a screenshot to show what's possible). Probably best to chat in https://matrix.to/#/#element-web:matrix.org and you can also see people sharing concerns when I first posted it in the TWIM room. The JavaScript snippet, simply color blocks all text currently on the page. If the page updates in any way, that text won't also be obscured. Details on the design can change in any way when we actually implement something (it's not even designed atm, just me as a developer). To unblur stuff, you will need to refresh the page. |
* Further improve replies ([\element-hq#6396](matrix-org/matrix-react-sdk#6396)). Fixes element-hq#19074, element-hq#18194 element-hq#18027 and element-hq#19179. * Enable users to join group calls from multiple devices ([\element-hq#9625](matrix-org/matrix-react-sdk#9625)). * fix(visual): make cursor a pointer for summaries ([\element-hq#9419](matrix-org/matrix-react-sdk#9419)). Contributed by @r00ster91. * Add placeholder for rich text editor ([\element-hq#9613](matrix-org/matrix-react-sdk#9613)). * Consolidate public room search experience ([\element-hq#9605](matrix-org/matrix-react-sdk#9605)). Fixes element-hq#22846. * New password reset flow ([\element-hq#9581](matrix-org/matrix-react-sdk#9581)). Fixes element-hq#23131. * Device manager - add tooltip to device details toggle ([\#9594](matrix-org/matrix-react-sdk#9594)). * sliding sync: add lazy-loading member support ([\element-hq#9530](matrix-org/matrix-react-sdk#9530)). * Limit formatting bar offset to top of composer ([\element-hq#9365](matrix-org/matrix-react-sdk#9365)). Fixes element-hq#12359. Contributed by @owi92. * Fix issues around up arrow event edit shortcut ([\element-hq#9645](matrix-org/matrix-react-sdk#9645)). Fixes element-hq#18497 and element-hq#18964. * Fix search not being cleared when clicking on a result ([\element-hq#9635](matrix-org/matrix-react-sdk#9635)). Fixes element-hq#23845. * Fix screensharing in 1:1 calls ([\element-hq#9612](matrix-org/matrix-react-sdk#9612)). Fixes element-hq#23808. * Fix the background color flashing when joining a call ([\element-hq#9640](matrix-org/matrix-react-sdk#9640)). * Fix the size of the 'Private space' icon ([\element-hq#9638](matrix-org/matrix-react-sdk#9638)). * Fix reply editing in rich text editor (https ([\element-hq#9615](matrix-org/matrix-react-sdk#9615)). * Fix thread list jumping back down while scrolling ([\element-hq#9606](matrix-org/matrix-react-sdk#9606)). Fixes element-hq#23727. * Fix regression with TimelinePanel props updates not taking effect ([\element-hq#9608](matrix-org/matrix-react-sdk#9608)). Fixes element-hq#23794. * Fix form tooltip positioning ([\element-hq#9598](matrix-org/matrix-react-sdk#9598)). Fixes element-hq#22861. * Extract Search handling from RoomView into its own Component ([\element-hq#9574](matrix-org/matrix-react-sdk#9574)). Fixes element-hq#498. * Fix call splitbrains when switching between rooms ([\element-hq#9692](matrix-org/matrix-react-sdk#9692)). * [Backport staging] Fix replies to emotes not showing as inline ([\element-hq#9708](matrix-org/matrix-react-sdk#9708)).
A devtools tool to temporarily switch all message text with lorem ipsum (plus generated avatars and display names) so that people can submit anonymised screen captures that don't look like a blurry disaster.
The text was updated successfully, but these errors were encountered: