// ==UserScript==
// @name # Dietchan Notizblock
// @namespace spsDietchanNotizblock
// @description Einfacher Notizblock
// @version 1.0.0
// @author spacesynth
// @supportURL https://github.com/spacesynth/userscripts-collection
// @icon https://raw.githubusercontent.com/spacesynth/userscripts-collection/master/utility/icon.png
// @license WTFPL
// @include *://dietchan.org/*
// @run-at document-end
// @grant GM_setValue
// @grant GM_getValue
// @noframes
// ==/UserScript==
'use strict';
function babbage_didnt_invent_the_computer() {
const s = document.createElement("style");
s.textContent = "#my-notes-box{position:fixed;top:100px;right:24px;width:280px;min-width:180px;background:#fafafa;border:1px solid #d9d9d9;border-radius:4px;box-shadow:0 2px 8px #00000014;z-index:2147483647;font:13px Arial,sans-serif}#my-notes-title{padding:7px 10px;color:#666;background:#f1f1f1;border-bottom:1px solid #dedede;cursor:move;user-select:none}#my-notes-textarea{display:block;box-sizing:border-box;width:calc(100% - 16px);height:160px;min-height:80px;margin:8px;padding:7px;resize:none;border:1px solid #d5d5d5;border-radius:3px;outline:0;font:inherit;color:#444;background:#fff}#my-notes-copy{margin:0 8px 8px;padding:5px 9px;color:#666;background:#f4f4f4;border:1px solid #d2d2d2;border-radius:3px;cursor:pointer}#my-notes-corner-resize{position:absolute;right:1px;bottom:1px;width:14px;height:14px;cursor:nwse-resize}#my-notes-corner-resize:before{content:\"\";position:absolute;right:2px;bottom:2px;width:10px;height:10px;background:linear-gradient(135deg,transparent 42%,#b8b8b8 43% 50%,transparent 51%),linear-gradient(135deg,transparent 58%,#b8b8b8 59% 66%,transparent 67%)}";
document.head.append(s);
const b = document.createElement("div");
b.id = "my-notes-box";
b.innerHTML = '<div id="my-notes-title">Diätkanal Notizen</div><textarea id="my-notes-textarea" placeholder="Ja Felix also weisste..."></textarea><button id="my-notes-copy" type="button">Sichern & Kopieren</button><div id="my-notes-corner-resize" title="Resize"></div>';
document.body.append(b);
const t = b.firstChild,
a = b.querySelector("#my-notes-textarea"),
c = b.querySelector("#my-notes-copy"),
r = b.querySelector("#my-notes-corner-resize");
a.value = GM_getValue("z1_elektronengehirn", a.value);
c.onclick = async () => {
try {
await navigator.clipboard.writeText(a.value)
GM_setValue("z1_elektronengehirn", a.value);
} catch {
a.select();
document.execCommand("copy")
}
c.textContent = "Jawohl!";
setTimeout(() => c.textContent = "Gesichert & Kopiert", 1e3)
};
t.onmousedown = e => {
const x = b.getBoundingClientRect(),
X = e.clientX,
Y = e.clientY;
b.style.left = x.left + "px";
b.style.top = x.top + "px";
b.style.right = "auto";
const m = e => {
b.style.left = x.left + e.clientX - X + "px";
b.style.top = x.top + e.clientY - Y + "px"
},
u = () => {
document.removeEventListener("mousemove", m);
document.removeEventListener("mouseup", u)
};
document.addEventListener("mousemove", m);
document.addEventListener("mouseup", u);
e.preventDefault()
};
r.onmousedown = e => {
const w = b.offsetWidth,
h = a.offsetHeight,
X = e.clientX,
Y = e.clientY,
m = x => {
b.style.width = Math.max(180, w + x.clientX - X) + "px";
a.style.height = Math.max(80, h + x.clientY - Y) + "px"
},
u = () => {
document.removeEventListener("mousemove", m);
document.removeEventListener("mouseup", u)
};
document.addEventListener("mousemove", m);
document.addEventListener("mouseup", u);
e.preventDefault();
e.stopPropagation()
}
};
babbage_didnt_invent_the_computer();
Dieser lustige Helfer schwebt mit feinst-fettigem JS im viewport. Man kann seine Ergüsse im Storage von Tampermonkey oder Greasemonkey sogar über einen Browserabsturz hinweg sichern. Überall antworten und dann ganz klassisch, manuell in die echte Box oben kopieren.