Skip to content

Instantly share code, notes, and snippets.

View GregTheMadMonk's full-sized avatar
💩
⇦ literally my code

Gregory Dushkin GregTheMadMonk

💩
⇦ literally my code
  • Somewhere in Russian Federation
View GitHub Profile
@GregTheMadMonk
GregTheMadMonk / nasha-life-quote.js
Created February 6, 2024 17:03
Кнопка для цитирования по выделению для Nasha-Life
function getPost(node) {
while (node.className != 'alt2' && node.className != 'alt1') node = node.parentElement;
return node;
}
function getCite(noauthor) {
let sel = window.getSelection()
let post = getPost(sel.anchorNode).children[0]
let name = ((post.children.length == 0) ? post : post.children[1]).innerText
let content = sel.getRangeAt(0).cloneContents()