emacs.d/custom/toot-mockup.el

28 lines
3 KiB
EmacsLisp
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;; light mode only not yet sure how to do dark mode in the most sensible way
(defun addtoot ()
(interactive)
(setq dispname (read-string "Display name: "))
(setq avatar (read-string "Avatar URL (with https://): "))
(setq fediname (read-string "Username: "))
(setq instanceurl (read-string "Instance URL (without https://): "))
(setq profileurl (read-string "Profile URL (with https://): "))
(setq toottext (read-string "Text (HTML): "))
(setq csstext (replace-regexp-in-string "<a href" "<a style=\"color: #2b90d9; text-decoration: underline;\" href" toottext))
(setq theurl (read-string "URL of post (with https://): "))
(setq theday (read-string "Day of month: "))
(setq themonth (read-string "Month in words: "))
(setq theyear (read-string "Year: "))
(setq repost (y-or-n-p "Shared by someone else?"))
(if repost
(setq reposter (read-string "Username of reposter: ")))
(insert " <div class=\"item\" style=\"padding: 1rem; display: block; margin: 0; border-top: 1px solid #8494ab;\">\n")
(if repost
(insert (concat "<div class=\"item-title\" style=\"margin: 0 0 0.7rem 0; color: #90a1ba; font-size: 0.9rem; padding: 0; display: block;\">" reposter " shared a status by " fediname "</div>\n")))
(insert (concat "<div class=\"author\" style=\"display: flex; margin-bottom: 1rem; margin: 0; padding: 0;\">\n <a target=\"_top\" class=\"avatar\" href=\"" profileurl "\" style=\"width: 3rem; height: 3rem: border: none; border-radius: 10%; color: #2b90d9; margin: 0; padding: 0; display: block;\">\n <img class=\"avatar\" src=\"" avatar "\" style=\"width: 3rem; height: 3rem: border: none; border-radius: 10%; color: #2b90d9; margin: 0; padding: 0; overflow: clip-margin: content-box; overflow: clip;\">\n </a>\n <div class=\"author-info\" style=\"margin: 0 1rem; display: flex; flex-direction: column; justify-content: space-around; padding: 0; font-size: 0.9rem;\">\n <a target=\"_top\" class=\"author-displayname\" href=\"" profileurl "\" style=\"font-size: 1.2rem; color: #282c37; text-decoration: none; display: block; font-weight: bolder; margin: 0; padding: 0;\">" dispname "</a>\n <div class=\"author-fullname\" style=\"color: #90a1ba; font-size: 0.9rem; margin: 0; padding: 0; display: block;\">&#64;" fediname "&#64;" instanceurl "</div>\n </div>\n </div>\n <div class=\"item-content\" style=\"font-weight: normal; font-size: 1.1rem; margin: 0; padding: 0; display: block;\">\n <p style=\"margin: 1rem 0; line-height: 1.4rem; padding: 0;\">" csstext "</p>\n </div>\n <a class=\"date\" href=\"" theurl "\" style=\"margin: 1rem 0 0 0; text-decoration: none; display: block; color: #90a1ba; font-size: 0.9rem;\">" theday " " themonth ", " theyear "</a>\n </div>\n")))
(defun tootbuild ()
(interactive)
(insert "<div class=\"container\" style=\"font-size: 80%; background-color: #ffffff; font-family: 'Roboto', roboto, Arial, sans-serif; color: #282c37; overflow-x: hidden; word-break: break-word; margin: 10px; padding: 0; width: 300px; border: 1px solid #8494ab;\">\n")
(addtoot)
(insert "</div>"))