alt element, misc

katproto.girlonthemoon.xyz 48c19253 cbf7ea7b

verified
Changed files
+21 -5
app
assets
stylesheets
javascript
views
config
+1 -1
app/assets/stylesheets/application.css
··· 221 221 display: block; 222 222 background: var(--main-color-darkest); 223 223 color: var(--text-color-code); 224 - font-size: 1rem; 224 + font-size: 0.9rem; 225 225 } 226 226 227 227 .pbody pre code {
+2 -1
app/javascript/application.js
··· 1 1 // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails 2 2 3 - import * as AsciinemaPlayer from 'asciinema-player'; 3 + import * as AsciinemaPlayer from 'asciinema-player' 4 4 import "@github/markdown-toolbar-element" 5 + import "custom/alt"
+14
app/javascript/custom/alt.js
··· 1 + const allImgs = document.querySelectorAll("img[alt]"); 2 + 3 + function altButton() { 4 + allImgs.forEach((im) => { 5 + const det = document.createElement("details"); 6 + const sum = document.createElement("summary"); 7 + sum.textContent = "alt text"; 8 + det.appendChild(sum); 9 + det.textContent = im.getAttribute("alt"); 10 + im.insertAdjacentElement("afterend", det); 11 + }) 12 + } 13 + 14 + altButton();
+3 -3
app/views/layouts/application.html.erb
··· 3 3 <head> 4 4 <title> 5 5 <% if defined?(@article.title) %> 6 - <%= @article.title %> 6 + <%= @article.title %> :: bubblegum 7 7 <% else %> 8 8 <% if defined?(@tag.name) %> 9 - <%= @tag.name %> 9 + <%= @tag.name %> :: bubblegum 10 10 <% else %> 11 11 sweet like bubblegum 12 12 <% end %> ··· 19 19 <meta name="author" content="girl on the moon"> 20 20 21 21 <meta property="og:title" content="<% if defined?(@article.title) %> <%= @article.title %> <% end %>"> 22 - <meta property="og:description" content="<% if defined?(@article.body) %> <%= truncate(@article.body, length: 27, separator: /\s/) %> <% end %>"> 22 + <meta property="og:description" content="<% if defined?(@article.body) %> <%= truncate(strip_tags(markdown(@article.body)), length: 27, separator: /\s/) %> <% end %>"> 23 23 <meta property="og:image" content="<% if defined?(@article.slug) && !(@article.slug).nil? %> <%= article_url(@article.slug, format: :png) %> <% end %>"> 24 24 <meta property="og:type" content="website"> 25 25 <meta property="og:url" content="<% if defined?(@article.slug) && !(@article.slug).nil? %> <%= article_url(@article.slug) %> <% end %>">
+1
config/importmap.rb
··· 3 3 pin "application" 4 4 pin "asciinema-player" # @3.8.1 5 5 pin "@github/markdown-toolbar-element", to: "https://ga.jspm.io/npm:@github/markdown-toolbar-element@2.1.1/dist/index.js" 6 + pin "custom/alt"