Skip to content
Open
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"type": "module",
"scripts": {
"build": "deno build.ts --tagName 1.73.1b0 > ubo.js",
"build": "deno build.ts --tagName 1.73.1b4 > ubo.js",
"test": "node --test"
},
"author": {
Expand Down
24 changes: 18 additions & 6 deletions ubo.js
Original file line number Diff line number Diff line change
Expand Up @@ -29456,11 +29456,23 @@ function preventClipboardWrite(matches = '', ...varargs) {
const div = doc.createElement('div');
const span = doc.createElement('span');
span.style = 'flex-grow:1;padding:0.5em 0 0.5em 0.5em;';
const { domAlert } = extraArgs;
const domAlert = extraArgs.domAlert.replace(/\\n/g, '\n');
const placeholder = /\$\{text\}/.exec(domAlert);
if ( placeholder ) {
const code = doc.createElement('code');
code.style = 'background-color:#ddc;font-family:monospace;padding:0.25em;user-select:none;word-break:break-all';
const styles = [
'background-color: #ddc',
'display: inline-block',
'font-family: monospace',
'max-height: 8em',
'overflow: auto',
'padding: 0.25em',
'word-break: break-all'
];
if ( Boolean(extraArgs.selectable ?? true) === false ) {
styles.push('user-select: none');
}
code.style = styles.join(';');
code.textContent = clipboardText;
span.append(
domAlert.slice(0, placeholder.index),
Expand All @@ -29471,15 +29483,15 @@ function preventClipboardWrite(matches = '', ...varargs) {
span.append(domAlert);
}
const button = doc.createElement('button');
button.style = 'padding:1em';
button.style = 'font-size:32px;padding:0.5em';
button.textContent = '×';
button.addEventListener('click', ( ) => {
if ( currentAlert === null ) { return; }
currentAlert.remove();
currentAlert = null;
});
div.append(span, button);
div.style = 'background-color:beige;color:black;border:1px solid black;display:flex;font-size:medium;position:fixed;text-align:center;top:0;width:100%;z-index:2147483647';
div.style = 'background-color:beige;color:black;border:1px solid black;display:flex;font-family:sans-serif;font-size:medium;position:fixed;top:0;white-space:pre-wrap;width:100%;z-index:2147483647';
doc.documentElement.append(div);
if ( currentAlert ) {
currentAlert.remove();
Expand Down Expand Up @@ -29510,7 +29522,7 @@ function preventClipboardWrite(matches = '', ...varargs) {
const { callArgs } = context;
if ( callArgs[0] === 'copy' || callArgs[0] === 'cut' ) {
const text = document.getSelection()?.toString();
if ( text && prevent(text) ) { return false; }
if ( prevent(text) ) { return true; }
}
return context.reflect();
}, { skipToString: true });
Expand Down Expand Up @@ -43637,7 +43649,7 @@ function trustedReplaceOutboundText(
) {
if ( propChain === '' ) { return; }
const safe = safeSelf();
const logPrefix = safe.makeLogPrefix('trusted-replace-outbound-text', propChain, rawPattern, rawReplacement, ...args);
const logPrefix = safe.makeLogPrefix('trusted-replace-outbound-text', propChain, rawPattern, rawReplacement, ...varargs);
const rePattern = safe.patternToRegex(rawPattern);
const replacement = rawReplacement.startsWith('json:')
? safe.JSON_parse(rawReplacement.slice(5))
Expand Down
Loading