Ich erstelle ein Benutzerkript für das einfache Einfügen von Dosennachrichten, die wir auf Arqade verwenden. Jedes Mal, wenn ich versuche, es zu verwenden, erhalte ich den Fehler: < /p>
Keine TextArea in dem Ziel -Kommentarformular gefunden.
// ==UserScript==
// @name Easy message pasting
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Don't you dislike having to type out long canned messages, or having to find, copy, and paste them? That's annoying. Let a userscript do it for you.
// @author Otaku
// @match https://gaming.stackexchange.com/*
// @grant GM_setClipboard
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
(function() {
'use strict';
const MINECRAFT_MESSAGE = "On Minecraft commands questions, please see our [guide on what to do before asking a Minecraft commands question](https://gaming.meta.stackexchange.com/q/13507/4797), especially the part about “what you’ve tried so far”, and edit in the requested information to your post.";
const REGISTER_MESSAGE = "Consider registering your account. This gives you certain benefits, such as being able to vote, not needing to worry about losing your account when your cookies are wiped or you use a different computer, and being able to gain reputation. For more info, see [Why should I register my account?](https://meta.stackexchange.com/questions/44557/why-should-i-register-my-account)."
let lastPressTime = 0;
let pressCount = 0;
document.addEventListener("keydown", function(event) {
if (event.key.toLowerCase() === "v") {
const currentTime = Date.now();
if (currentTime - lastPressTime < 1000) {
pressCount++;
} else {
pressCount = 1;
}
lastPressTime = currentTime;
if (pressCount === 2) {
GM_setClipboard(MINECRAFT_MESSAGE);
paste(MINECRAFT_MESSAGE);
} else if (pressCount === 3) {
GM_setClipboard(REGISTER_MESSAGE);
paste(REGISTER_MESSAGE);
}
}
});
function paste() {
// Find the correct comment form
const commentForms = document.querySelectorAll("[id^='add-comment-'][data-placeholdertext]");
if (!commentForms.length) {
console.warn("No matching comment form found.");
return;
}
let targetForm = commentForms[commentForms.length - 1];
// Find the textarea inside this form
let textArea = targetForm.querySelector("textarea");
if (!textArea) {
console.warn("No textarea found inside the target comment form.");
return;
}
// Select all existing text
textArea.focus();
textArea.select(); // Highlights all text
document.execCommand("insertText", false, MINECRAFT_MESSAGE);
// Ensure UI updates properly
textArea.dispatchEvent(new Event('input', { bubbles: true }));
setTimeout(() => {
textArea.value = textArea.value.slice(0, -1);
textArea.dispatchEvent(new Event('input', { bubbles: true }));
}, 50);
}
})();
Ich erstelle ein Benutzerkript für das einfache Einfügen von Dosennachrichten, die wir auf Arqade verwenden. Jedes Mal, wenn ich versuche, es zu verwenden, erhalte ich den Fehler: < /p>
Keine TextArea in dem Ziel -Kommentarformular gefunden.[code]// ==UserScript== // @name Easy message pasting // @namespace http://tampermonkey.net/ // @version 1.0 // @description Don't you dislike having to type out long canned messages, or having to find, copy, and paste them? That's annoying. Let a userscript do it for you. // @author Otaku // @match https://gaming.stackexchange.com/* // @grant GM_setClipboard // @grant GM_setValue // @grant GM_getValue // ==/UserScript==
(function() { 'use strict';
const MINECRAFT_MESSAGE = "On Minecraft commands questions, please see our [guide on what to do before asking a Minecraft commands question](https://gaming.meta.stackexchange.com/q/13507/4797), especially the part about “what you’ve tried so far”, and edit in the requested information to your post."; const REGISTER_MESSAGE = "Consider registering your account. This gives you certain benefits, such as being able to vote, not needing to worry about losing your account when your cookies are wiped or you use a different computer, and being able to gain reputation. For more info, see [Why should I register my account?](https://meta.stackexchange.com/questions/44557/why-should-i-register-my-account)."
if (pressCount === 2) { GM_setClipboard(MINECRAFT_MESSAGE); paste(MINECRAFT_MESSAGE); } else if (pressCount === 3) { GM_setClipboard(REGISTER_MESSAGE); paste(REGISTER_MESSAGE); } } });
function paste() { // Find the correct comment form const commentForms = document.querySelectorAll("[id^='add-comment-'][data-placeholdertext]");
if (!commentForms.length) { console.warn("No matching comment form found."); return; }
let targetForm = commentForms[commentForms.length - 1];
// Find the textarea inside this form let textArea = targetForm.querySelector("textarea"); if (!textArea) { console.warn("No textarea found inside the target comment form."); return; }
// Select all existing text textArea.focus(); textArea.select(); // Highlights all text document.execCommand("insertText", false, MINECRAFT_MESSAGE);
Ich versuche, eine große GPKG-Datei mithilfe einer WPF-Anwendung an eine API zu senden, stoße jedoch auf die folgende Ausnahme:
Fehler beim Kopieren von Inhalten in einen Stream.
Was ich versucht...
Ich habe Schwierigkeiten, die Edit.ToggleLineComment-Tastenkombination in Visual Studio 2022 zu verwenden, wenn es um .xaml-Dateien geht.
Mein Tastenkürzel ist wie hier gezeigt richtig eingestellt...