Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
projects:unsorted:webpage_pieces [2024/12/06 16:10] – created kymki | projects:unsorted:webpage_pieces [2024/12/06 16:34] (current) – kymki | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Webpage Pieces ====== | ||
+ | |||
General collection of potentially useful bits of raw HTML that may or may not at all be useful to you. | General collection of potentially useful bits of raw HTML that may or may not at all be useful to you. | ||
===== The Ramble Meter ===== | ===== The Ramble Meter ===== | ||
- | I wanted a simple way to indicate how trustworthy and polished my posts are - it allows me to post stuff that is less structured while also indicating this clearly to the reader. | + | I wanted a simple way to indicate how trustworthy and polished my posts are - it allows me to post stuff that is less structured while also indicating this clearly to the reader. |
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | < | ||
+ | <meta charset=" | ||
+ | <meta name=" | ||
+ | < | ||
+ | < | ||
+ | /* Container for the entire Ramble Meter */ | ||
+ | .ramble-meter-container { | ||
+ | display: flex; | ||
+ | align-items: | ||
+ | justify-content: | ||
+ | margin: 20px 0; | ||
+ | } | ||
+ | |||
+ | /* Ramble Meter */ | ||
+ | .ramble-meter { | ||
+ | position: relative; | ||
+ | width: 200px; /* Scaled down */ | ||
+ | height: 40px; /* Scaled down */ | ||
+ | background: linear-gradient(to right, green, yellow, orange, red); | ||
+ | border-radius: | ||
+ | overflow: hidden; | ||
+ | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); | ||
+ | } | ||
+ | |||
+ | /* Needle */ | ||
+ | .needle { | ||
+ | position: absolute; | ||
+ | top: 5px; /* Adjust for centering */ | ||
+ | left: 50%; /* Default position */ | ||
+ | width: 4px; /* Visible width */ | ||
+ | height: 30px; | ||
+ | background: black; | ||
+ | border-radius: | ||
+ | z-index: 2; | ||
+ | box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); /* Glow effect */ | ||
+ | } | ||
+ | |||
+ | /* Label in the middle of the meter */ | ||
+ | .meter-label { | ||
+ | position: absolute; | ||
+ | top: 50%; | ||
+ | left: 50%; | ||
+ | transform: translate(-50%, | ||
+ | font-family: | ||
+ | font-size: 12px; /* Adjusted for smaller size */ | ||
+ | font-weight: | ||
+ | color: #fff; | ||
+ | text-shadow: | ||
+ | z-index: 3; | ||
+ | } | ||
+ | |||
+ | /* Tooltip styling */ | ||
+ | .tooltip { | ||
+ | visibility: hidden; | ||
+ | width: 250px; | ||
+ | background-color: | ||
+ | color: #fff; | ||
+ | text-align: center; | ||
+ | padding: 10px; | ||
+ | border-radius: | ||
+ | position: absolute; | ||
+ | top: 50%; /* Vertically aligned */ | ||
+ | left: 110%; /* Position to the right of the meter */ | ||
+ | transform: translateY(-50%); | ||
+ | font-size: 12px; | ||
+ | z-index: 10; | ||
+ | box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); | ||
+ | } | ||
+ | |||
+ | /* Show tooltip on hover */ | ||
+ | .ramble-meter: | ||
+ | visibility: visible; | ||
+ | } | ||
+ | |||
+ | /* Wrapper for positioning the tooltip and meter */ | ||
+ | .ramble-wrapper { | ||
+ | position: relative; | ||
+ | display: flex; | ||
+ | align-items: | ||
+ | } | ||
+ | </ | ||
+ | < | ||
+ | document.addEventListener(" | ||
+ | const needle = document.querySelector(" | ||
+ | const rambleMeter = document.querySelector(" | ||
+ | const level = rambleMeter.getAttribute(" | ||
+ | needle.style.left = `${Math.min(Math.max(level, | ||
+ | }); | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <!-- Ramble Meter --> | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Which if wrapped in html tags in a docuwiki like this one yields: | ||
+ | |||
+ | < | ||
+ | < | ||
+ | <meta charset=" | ||
+ | <meta name=" | ||
+ | < | ||
+ | < | ||
+ | /* Container for the entire Ramble Meter */ | ||
+ | .ramble-meter-container { | ||
+ | display: flex; | ||
+ | align-items: | ||
+ | justify-content: | ||
+ | margin: 20px 0; | ||
+ | } | ||
+ | |||
+ | /* Ramble Meter */ | ||
+ | .ramble-meter { | ||
+ | position: relative; | ||
+ | width: 200px; /* Scaled down */ | ||
+ | height: 40px; /* Scaled down */ | ||
+ | background: linear-gradient(to right, green, yellow, orange, red); | ||
+ | border-radius: | ||
+ | overflow: hidden; | ||
+ | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); | ||
+ | } | ||
+ | |||
+ | /* Needle */ | ||
+ | .needle { | ||
+ | position: absolute; | ||
+ | top: 5px; /* Adjust for centering */ | ||
+ | left: 50%; /* Default position */ | ||
+ | width: 4px; /* Visible width */ | ||
+ | height: 30px; | ||
+ | background: black; | ||
+ | border-radius: | ||
+ | z-index: 2; | ||
+ | box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); /* Glow effect */ | ||
+ | } | ||
+ | |||
+ | /* Label in the middle of the meter */ | ||
+ | .meter-label { | ||
+ | position: absolute; | ||
+ | top: 50%; | ||
+ | left: 50%; | ||
+ | transform: translate(-50%, | ||
+ | font-family: | ||
+ | font-size: 12px; /* Adjusted for smaller size */ | ||
+ | font-weight: | ||
+ | color: #fff; | ||
+ | text-shadow: | ||
+ | z-index: 3; | ||
+ | } | ||
+ | |||
+ | /* Tooltip styling */ | ||
+ | .tooltip { | ||
+ | visibility: hidden; | ||
+ | width: 250px; | ||
+ | background-color: | ||
+ | color: #fff; | ||
+ | text-align: center; | ||
+ | padding: 10px; | ||
+ | border-radius: | ||
+ | position: absolute; | ||
+ | top: 50%; /* Vertically aligned */ | ||
+ | left: 110%; /* Position to the right of the meter */ | ||
+ | transform: translateY(-50%); | ||
+ | font-size: 12px; | ||
+ | z-index: 10; | ||
+ | box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); | ||
+ | } | ||
+ | |||
+ | /* Show tooltip on hover */ | ||
+ | .ramble-meter: | ||
+ | visibility: visible; | ||
+ | } | ||
+ | |||
+ | /* Wrapper for positioning the tooltip and meter */ | ||
+ | .ramble-wrapper { | ||
+ | position: relative; | ||
+ | display: flex; | ||
+ | align-items: | ||
+ | } | ||
+ | </ | ||
+ | < | ||
+ | document.addEventListener(" | ||
+ | const needle = document.querySelector(" | ||
+ | const rambleMeter = document.querySelector(" | ||
+ | const level = rambleMeter.getAttribute(" | ||
+ | needle.style.left = `${Math.min(Math.max(level, | ||
+ | }); | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <!-- Ramble Meter --> | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||