Cleanup assets
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
@tailwind typography;
|
||||
|
@@ -1,31 +0,0 @@
|
||||
import "../../../../slices/main/assets/builds/app.css";
|
||||
import "../css/app.css";
|
||||
|
||||
(function() {
|
||||
document.addEventListener('alpine:init', () => {
|
||||
Alpine.magic('clipboard', () => {
|
||||
return subject => navigator.clipboard.writeText(subject)
|
||||
})
|
||||
|
||||
Alpine.magic('textHighlighter', (el, {Alpine}) => {
|
||||
return {
|
||||
isOpen: false,
|
||||
anchorX: "0px",
|
||||
anchorY: "0px",
|
||||
selection: null,
|
||||
text: "",
|
||||
highlightText() {
|
||||
this.isOpen = false
|
||||
// document.
|
||||
this.selection = document.getSelection()
|
||||
this.text = this.selection.toString()
|
||||
const anchor = this.selection.focusNode.parentElement.getBoundingClientRect()
|
||||
this.isOpen = el.contains(this.selection.focusNode) && this.selection.focusOffset != this.selection.anchorOffset;
|
||||
|
||||
this.anchorX = `${anchor.left - 170}px`
|
||||
this.anchorY = `${anchor.top + window.scrollY}px`
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})();
|
36
slices/admin/assets/js/app.ts
Normal file
36
slices/admin/assets/js/app.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
// import "../../../../slices/main/assets/builds/app.css";
|
||||
import "@main/css/app.css";
|
||||
import "@app/builds/tailwind.css";
|
||||
import "../css/app.css";
|
||||
|
||||
(function () {
|
||||
document.addEventListener("alpine:init", () => {
|
||||
Alpine.magic("clipboard", () => {
|
||||
return (subject) => navigator.clipboard.writeText(subject);
|
||||
});
|
||||
|
||||
Alpine.magic("textHighlighter", (el, { Alpine }) => {
|
||||
return {
|
||||
isOpen: false,
|
||||
anchorX: "0px",
|
||||
anchorY: "0px",
|
||||
selection: null,
|
||||
text: "",
|
||||
highlightText() {
|
||||
this.isOpen = false;
|
||||
// document.
|
||||
this.selection = document.getSelection();
|
||||
this.text = this.selection.toString();
|
||||
const anchor =
|
||||
this.selection.focusNode.parentElement.getBoundingClientRect();
|
||||
this.isOpen =
|
||||
el.contains(this.selection.focusNode) &&
|
||||
this.selection.focusOffset != this.selection.anchorOffset;
|
||||
|
||||
this.anchorX = `${anchor.left - 170}px`;
|
||||
this.anchorY = `${anchor.top + window.scrollY}px`;
|
||||
},
|
||||
};
|
||||
});
|
||||
});
|
||||
})();
|
@@ -55,12 +55,12 @@ module Admin
|
||||
|
||||
def inline_image_sources
|
||||
inline_images
|
||||
&.select {|attr, _value| attr == "src"}
|
||||
&.map {|img| img[1] } || []
|
||||
&.select { |attr, _value| attr == "src" }
|
||||
&.map { |img| img[1] } || []
|
||||
end
|
||||
|
||||
def photo_sources
|
||||
photos.map{|photo| photo["value"]}
|
||||
photos.map { |photo| photo["value"] }
|
||||
end
|
||||
|
||||
def prefix_emoji
|
||||
@@ -146,7 +146,7 @@ module Admin
|
||||
end
|
||||
|
||||
def to_h
|
||||
clean_content = CGI::unescapeHTML(content.gsub(/<\/?[^>]*>/, "")).strip
|
||||
clean_content = CGI.unescapeHTML(content.gsub(/<\/?[^>]*>/, "")).strip
|
||||
clean_content = clean_content.gsub(prefix_emoji[0], "") if prefix_emoji
|
||||
{
|
||||
id: slug,
|
||||
|
@@ -4,7 +4,6 @@ module Main
|
||||
module Actions
|
||||
module Posts
|
||||
class React < Action
|
||||
|
||||
include Deps["repos.reaction_repo", "repos.post_repo"]
|
||||
|
||||
def handle(req, res)
|
||||
@@ -16,7 +15,6 @@ module Main
|
||||
|
||||
res.body = "👍 #{reaction_count}"
|
||||
res.status = 201
|
||||
|
||||
rescue
|
||||
res.status = 400
|
||||
end
|
||||
|
@@ -1,98 +1,109 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
@tailwind typography;
|
||||
|
||||
@font-face {
|
||||
font-family: "Montagu";
|
||||
src: url("../fonts/MontaguSlab-VariableFont_opsz,wght.ttf") format("truetype");
|
||||
font-display: swap;
|
||||
font-family: "Montagu";
|
||||
src: url("../fonts/MontaguSlab-VariableFont_opsz,wght.ttf") format("truetype");
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "JetBrainsMono";
|
||||
src: url("../fonts/JetBrainsMono-VariableFont_wght.ttf") format("truetype");
|
||||
font-display: swap;
|
||||
font-family: "JetBrainsMono";
|
||||
src: url("../fonts/JetBrainsMono-VariableFont_wght.ttf") format("truetype");
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Figtree";
|
||||
src: url("../fonts/Figtree-VariableFont_wght.ttf") format("truetype");
|
||||
font-display: swap;
|
||||
font-family: "Figtree";
|
||||
src: url("../fonts/Figtree-VariableFont_wght.ttf") format("truetype");
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: "Figtree", Helvetica, Arial, sans-serif;
|
||||
font-family: "Figtree", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
|
||||
font-family: "Montagu", Times New Roman, serif;
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
h1 a,
|
||||
h2 a,
|
||||
h3 a,
|
||||
h4 a,
|
||||
h5 a,
|
||||
h6 a {
|
||||
font-family:
|
||||
"Montagu",
|
||||
Times New Roman,
|
||||
serif;
|
||||
}
|
||||
|
||||
.prose h1 a {
|
||||
border-bottom: none;
|
||||
text-decoration: none;
|
||||
border-bottom: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.prose h1 a:hover {
|
||||
opacity: 0.8;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.gist tr {
|
||||
border-bottom: none;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.gist span, pre, pre span {
|
||||
font-family: "JetBrainsMono", Monaco, monospace;
|
||||
.gist span,
|
||||
pre,
|
||||
pre span {
|
||||
font-family: "JetBrainsMono", Monaco, monospace;
|
||||
}
|
||||
|
||||
.map-marker {
|
||||
border: 3px solid blue;
|
||||
border-radius: 8px;
|
||||
background: RGBa(0, 0, 255, 0.1);
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border: 3px solid blue;
|
||||
border-radius: 8px;
|
||||
background: RGBa(0, 0, 255, 0.1);
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
.prose pre code::before {
|
||||
padding-left: unset
|
||||
padding-left: unset;
|
||||
}
|
||||
|
||||
.prose pre code:after {
|
||||
padding-right: unset
|
||||
padding-right: unset;
|
||||
}
|
||||
|
||||
.prose code {
|
||||
font-weight: 400;
|
||||
border-radius: 0.25rem;
|
||||
font-weight: 400;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
|
||||
.prose code:before {
|
||||
content: "";
|
||||
padding: 0 0 0 0.25rem;
|
||||
content: "";
|
||||
padding: 0 0 0 0.25rem;
|
||||
}
|
||||
|
||||
.prose pre {
|
||||
padding: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.prose code:after {
|
||||
content: "";
|
||||
padding: 0 0.25rem 0 0;
|
||||
content: "";
|
||||
padding: 0 0.25rem 0 0;
|
||||
}
|
||||
|
||||
.video-container {
|
||||
position: relative;
|
||||
padding-bottom: 56.25%; /* 16:9 */
|
||||
height: 0;
|
||||
position: relative;
|
||||
padding-bottom: 56.25%; /* 16:9 */
|
||||
height: 0;
|
||||
}
|
||||
.video-container iframe {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 8px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.squircle {
|
||||
|
@@ -1,76 +0,0 @@
|
||||
import { md_gallery } from "./gallery.js";
|
||||
|
||||
(function() {
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
|
||||
localStorage.setItem("_x_darkMode", event.matches ? true : false)
|
||||
});
|
||||
|
||||
if (window.hljs !== undefined) {
|
||||
window.hljs.highlightAll();
|
||||
}
|
||||
|
||||
const times = document.querySelectorAll('time');
|
||||
times.forEach((time) => {
|
||||
const oldDtime = Date.parse(time.dateTime);
|
||||
time.innerHTML = new Date(oldDtime).toLocaleDateString(navigator.language, { weekday:"long", year:"numeric", month:"short", day:"numeric"});
|
||||
|
||||
md_gallery({
|
||||
"class_name": "grid gap-4 grid-cols-2 prose-img:m-0"
|
||||
});
|
||||
|
||||
const mediaForm = document.getElementById("media_form");
|
||||
if (mediaForm !== null) {
|
||||
htmx.on('#media_form', 'htmx:xhr:progress', function (evt) {
|
||||
htmx.find('#progress').setAttribute('value', evt.detail.loaded / evt.detail.total * 100)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const videos = document.querySelectorAll('video');
|
||||
videos.forEach((video) => {
|
||||
video.addEventListener("click", () => {
|
||||
const isPaused = video.paused;
|
||||
video[isPaused ? "play" : "pause"]();
|
||||
video.classList.toggle("u-none", !isPaused);
|
||||
});
|
||||
});
|
||||
|
||||
const mapContainer = document.getElementById("map");
|
||||
const goBack = document.getElementById("go-back");
|
||||
if (mapContainer !== null) {
|
||||
if (goBack !== null) {
|
||||
document.getElementById("go-back").addEventListener("click", () => {
|
||||
history.back();
|
||||
});
|
||||
}
|
||||
|
||||
mapboxgl.accessToken = 'pk.eyJ1IjoiZG5pdHphIiwiYSI6ImNsZWIyY3ZzaTE0cjUzdm4xdnZ6czRlYjUifQ.FRETOXYRID6T2IoB7qqRLg';
|
||||
var map = new mapboxgl.Map({
|
||||
container: 'map',
|
||||
style: 'mapbox://styles/mapbox/streets-v11',
|
||||
maxZoom: 8
|
||||
});
|
||||
|
||||
const markers = JSON.parse(mapContainer.dataset["markers"]);
|
||||
|
||||
const bounds = new mapboxgl.LngLatBounds(markers[0], markers[0]);
|
||||
|
||||
for (var i = 0; i < markers.length; i++) {
|
||||
bounds.extend(markers[i]);
|
||||
}
|
||||
|
||||
map.fitBounds(bounds, { padding: 60 });
|
||||
|
||||
for (var i = 0; i < markers.length; i++) {
|
||||
const marker = markers[i];
|
||||
const el = document.createElement("div");
|
||||
el.className = "map-marker";
|
||||
|
||||
new mapboxgl.Marker(el)
|
||||
.setLngLat(marker)
|
||||
.addTo(map);
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
87
slices/main/assets/js/app.ts
Normal file
87
slices/main/assets/js/app.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
import "@app/builds/tailwind.css";
|
||||
import "@main/css/app.css";
|
||||
import { md_gallery } from "./gallery.js";
|
||||
|
||||
(function () {
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
window
|
||||
.matchMedia("(prefers-color-scheme: dark)")
|
||||
.addEventListener("change", (event) => {
|
||||
localStorage.setItem("_x_darkMode", event.matches ? true : false);
|
||||
});
|
||||
|
||||
if (window.hljs !== undefined) {
|
||||
window.hljs.highlightAll();
|
||||
}
|
||||
|
||||
const times = document.querySelectorAll("time");
|
||||
times.forEach((time) => {
|
||||
const oldDtime = Date.parse(time.dateTime);
|
||||
time.innerHTML = new Date(oldDtime).toLocaleDateString(
|
||||
navigator.language,
|
||||
{ weekday: "long", year: "numeric", month: "short", day: "numeric" },
|
||||
);
|
||||
|
||||
md_gallery({
|
||||
class_name: "grid gap-4 grid-cols-2 prose-img:m-0",
|
||||
});
|
||||
|
||||
const mediaForm = document.getElementById("media_form");
|
||||
if (mediaForm !== null) {
|
||||
htmx.on("#media_form", "htmx:xhr:progress", function (evt) {
|
||||
htmx
|
||||
.find("#progress")
|
||||
.setAttribute(
|
||||
"value",
|
||||
(evt.detail.loaded / evt.detail.total) * 100,
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const videos = document.querySelectorAll("video");
|
||||
videos.forEach((video) => {
|
||||
video.addEventListener("click", () => {
|
||||
const isPaused = video.paused;
|
||||
video[isPaused ? "play" : "pause"]();
|
||||
video.classList.toggle("u-none", !isPaused);
|
||||
});
|
||||
});
|
||||
|
||||
const mapContainer = document.getElementById("map");
|
||||
const goBack = document.getElementById("go-back");
|
||||
if (mapContainer !== null) {
|
||||
if (goBack !== null) {
|
||||
document.getElementById("go-back").addEventListener("click", () => {
|
||||
history.back();
|
||||
});
|
||||
}
|
||||
|
||||
mapboxgl.accessToken =
|
||||
"pk.eyJ1IjoiZG5pdHphIiwiYSI6ImNsZWIyY3ZzaTE0cjUzdm4xdnZ6czRlYjUifQ.FRETOXYRID6T2IoB7qqRLg";
|
||||
var map = new mapboxgl.Map({
|
||||
container: "map",
|
||||
style: "mapbox://styles/mapbox/streets-v11",
|
||||
maxZoom: 8,
|
||||
});
|
||||
|
||||
const markers = JSON.parse(mapContainer.dataset["markers"]);
|
||||
|
||||
const bounds = new mapboxgl.LngLatBounds(markers[0], markers[0]);
|
||||
|
||||
for (var i = 0; i < markers.length; i++) {
|
||||
bounds.extend(markers[i]);
|
||||
}
|
||||
|
||||
map.fitBounds(bounds, { padding: 60 });
|
||||
|
||||
for (var i = 0; i < markers.length; i++) {
|
||||
const marker = markers[i];
|
||||
const el = document.createElement("div");
|
||||
el.className = "map-marker";
|
||||
|
||||
new mapboxgl.Marker(el).setLngLat(marker).addTo(map);
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
@@ -55,12 +55,12 @@ module Main
|
||||
|
||||
def inline_image_sources
|
||||
inline_images
|
||||
&.select {|attr, _value| attr == "src"}
|
||||
&.map {|img| img[1] } || []
|
||||
&.select { |attr, _value| attr == "src" }
|
||||
&.map { |img| img[1] } || []
|
||||
end
|
||||
|
||||
def photo_sources
|
||||
photos.map{|photo| photo["value"]}
|
||||
photos.map { |photo| photo["value"] }
|
||||
end
|
||||
|
||||
def prefix_emoji
|
||||
@@ -146,7 +146,7 @@ module Main
|
||||
end
|
||||
|
||||
def to_h
|
||||
clean_content = CGI::unescapeHTML(content.gsub(/<\/?[^>]*>/, "")).strip
|
||||
clean_content = CGI.unescapeHTML(content.gsub(/<\/?[^>]*>/, "")).strip
|
||||
clean_content = clean_content.gsub(prefix_emoji[0], "") if prefix_emoji
|
||||
{
|
||||
id: slug,
|
||||
|
@@ -11,7 +11,7 @@ module Main
|
||||
recently_played_result.map do |game|
|
||||
{
|
||||
name: game["name"],
|
||||
playtime_forever: game["playtime_forever"].to_i / 60,
|
||||
playtime_forever: game["playtime_forever"].to_i / 60
|
||||
}
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user