diff options
| author | Xe Iaso <me@christine.website> | 2022-11-25 19:01:10 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-25 19:01:10 -0500 |
| commit | cc933b31fd23bb06e95bf41f848a1c99353d44ae (patch) | |
| tree | af8288dbd4db2ad886d6b326bffb1c9d5b568de3 /static/js | |
| parent | 551e0384c923ff3ee98cfddf7e3eb42c6dbb2941 (diff) | |
| download | xesite-cc933b31fd23bb06e95bf41f848a1c99353d44ae.tar.xz xesite-cc933b31fd23bb06e95bf41f848a1c99353d44ae.zip | |
Start version 3 (#573)
* Start version 3
* Change version to 3.0.0 in Cargo.toml
* Add metadata for series
* Change types for signal boosts
* Add start of LaTeX resume generation at Nix time
* Add start of proper author tagging for posts in JSONFeed and ldjson
* Convert templates to use Maud
* Add start of dynamic resume generation from dhall
* Make patrons page embed thumbnails
TODO:
* [ ] Remove the rest of the old templates
* [ ] Bring in Xeact for the share on mastodon button
* [ ] Site update post
Signed-off-by: Xe <me@christine.website>
* fix nix builds
Signed-off-by: Xe Iaso <me@christine.website>
* fix dhall build
Signed-off-by: Xe Iaso <me@christine.website>
* fix non-flakes build
Signed-off-by: Xe Iaso <me@christine.website>
* make new mastodon share button
Signed-off-by: Xe Iaso <me@christine.website>
* remove the rest of the ructe templates that I can remove
Signed-off-by: Xe Iaso <me@christine.website>
* refactor blogposts to its own file
Signed-off-by: Xe Iaso <me@christine.website>
* move resume to be generated by nix
Signed-off-by: Xe Iaso <me@christine.website>
* write article
Signed-off-by: Xe Iaso <me@christine.website>
* blog/site-update-v3: hero image
Signed-off-by: Xe Iaso <me@christine.website>
* add site update series tag to site updates
Signed-off-by: Xe Iaso <me@christine.website>
Signed-off-by: Xe <me@christine.website>
Signed-off-by: Xe Iaso <me@christine.website>
Diffstat (limited to 'static/js')
| -rw-r--r-- | static/js/.gitignore | 1 | ||||
| -rw-r--r-- | static/js/conversation.js | 36 | ||||
| -rw-r--r-- | static/js/hnwarn.js | 35 | ||||
| -rw-r--r-- | static/js/xeact-html.min.js | 1 | ||||
| -rw-r--r-- | static/js/xeact.min.js | 1 |
5 files changed, 1 insertions, 73 deletions
diff --git a/static/js/.gitignore b/static/js/.gitignore new file mode 100644 index 0000000..4bf7e61 --- /dev/null +++ b/static/js/.gitignore @@ -0,0 +1 @@ +mastodon_share_button.js diff --git a/static/js/conversation.js b/static/js/conversation.js deleted file mode 100644 index 0e6eea5..0000000 --- a/static/js/conversation.js +++ /dev/null @@ -1,36 +0,0 @@ -import { g, h, x } from "./xeact.min.js"; -import { div, span } from "./xeact-html.min.js"; - -export const mkConversation = (who, mood, message, extraClasses = "") => - h("div", {className: "conversation gruvbox-dark " + extraClasses}, [ - h("div", {className: "conversation-picture conversation-smol"}, [ - h("picture", {}, [ - h("source", {type: "image/avif", srcset: `https://cdn.xeiaso.net/file/christine-static/stickers/${who.toLowerCase()}/${mood}.avif`}), - h("source", {type: "image/webp", srcset: `https://cdn.xeiaso.net/file/christine-static/stickers/${who.toLowerCase()}/${mood}.webp`}), - h("img", {alt: `${who} is ${mood}`, src: `https://cdn.xeiaso.net/file/christine-static/stickers/${who.toLowerCase()}/${mood}.png`}) - ]) - ]), - h("div", {className: "conversation-chat"}, [ - h("span", {innerText: "<"}), - h("b", {innerText: who}), - h("span", {innerText: "> "}), - span({}, Array.from(message)) - ]) - ]); - -export class Conversation extends HTMLElement { - constructor() { - super(); - - let root = this.attachShadow({mode: "open"}); - let who = this.getAttribute("name"); - let mood = this.getAttribute("mood"); - - root.appendChild(h("link", {rel: "stylesheet", href: "/css/hack.css"})); - root.appendChild(h("link", {rel: "stylesheet", href: "/css/gruvbox-dark.css"})); - root.appendChild(h("link", {rel: "stylesheet", href: "/css/shim.css"})); - root.appendChild(mkConversation(who, mood, this.childNodes)); - } -} - -window.customElements.define("xeblog-conv", Conversation); diff --git a/static/js/hnwarn.js b/static/js/hnwarn.js deleted file mode 100644 index c56bcfe..0000000 --- a/static/js/hnwarn.js +++ /dev/null @@ -1,35 +0,0 @@ -import { g, x, r, t } from "./xeact.min.js"; -import { div, ahref, br } from "./xeact-html.min.js"; -import { mkConversation } from "./conversation.js"; - -// list of regexps for potentially problematic referrers to display the nag to -const FLAGGED_REFERRERS = [ - /^https?:\/\/((.+)\.)?reddit\.com/i, - /^https?:\/\/news\.ycombinator\.com/i, -]; - -const addNag = () => { - let root = g("refererNotice"); - x(root); - root.appendChild( - div( - {style: "padding:1em"}, - mkConversation("Cadey", "coffee", [ - t("Thank you for reading this article. If you have any questions or thoughts about its contents, please comment civilly on it and remember the human on the other side of the screen. Due to facts and circumstances surrounding our fundamentally subjective reality, I may experience things differently than you do. If this is somehow unacceptable to you, please feel free to "), - ahref("https://zombo.com", "go somewhere else"), - t(". Have a good day and be well!") - ], "warning"), - br(), - br() - ) - ); -}; - -r(() => { - const ref = document.referrer; - if (!ref) return; - - if (FLAGGED_REFERRERS.some(r => r.test(ref))) { - addNag(); - } -}); diff --git a/static/js/xeact-html.min.js b/static/js/xeact-html.min.js deleted file mode 100644 index 8f76bfe..0000000 --- a/static/js/xeact-html.min.js +++ /dev/null @@ -1 +0,0 @@ -import{h,t}from"./xeact.min.js";const $tl=d=>(l,$={},s=[])=>(s.unshift(t(l)),h(d,$,s)),h1=$tl("h1"),h2=$tl("h2"),h3=$tl("h3"),h4=$tl("h4"),h5=$tl("h5"),h6=$tl("h6"),p=$tl("p"),b=$tl("b"),i=$tl("i"),u=$tl("u"),dd=$tl("dd"),dt=$tl("dt"),del=$tl("del"),sub=$tl("sub"),sup=$tl("sup"),strong=$tl("strong"),small=$tl("small"),hl=()=>h("hl"),br=()=>h("br"),img=(l,t="")=>h("img",{src:l,alt:t}),ahref=(l,$)=>h("a",{href:l},t($)),$dl=$=>(l={},t=[])=>h($,l,t),span=$dl("span"),div=$dl("div"),ul=$dl("ul"),iframe=(l,t={})=>(t.src=l,h("iframe",t));export{h1,h2,h3,h4,h5,h6,p,b,i,u,dd,dt,del,sub,sup,strong,small,hl,br,img,ahref,span,div,ul,iframe}; diff --git a/static/js/xeact.min.js b/static/js/xeact.min.js deleted file mode 100644 index 1703a9c..0000000 --- a/static/js/xeact.min.js +++ /dev/null @@ -1 +0,0 @@ -const h=(e,t={},r=[])=>{let n=Object.assign(document.createElement(e),t);return Array.isArray(r)||(r=[r]),n.append(...r),n},t=e=>document.createTextNode(e),x=e=>{for(;e.lastChild;)e.removeChild(e.lastChild)},g=e=>document.getElementById(e),c=e=>document.getElementsByClassName(e),n=e=>document.getElementsByName(e),s=e=>Array.from(document.querySelectorAll(e)),u=(e="",t={})=>{let r=new URL(e,window.location.href);return Object.entries(t).forEach(e=>{var[t,e]=e;r.searchParams.set(t,e)}),r.toString()},r=e=>window.addEventListener("DOMContentLoaded",e);export{h,t,x,g,c,n,u,s,r}; |
