formatting
This commit is contained in:
parent
60358d32d6
commit
74fd12d199
6 changed files with 60 additions and 65 deletions
8
.prettierrc.json
Normal file
8
.prettierrc.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"tabWidth": 4,
|
||||||
|
"useTabs": true,
|
||||||
|
"singleQuote": false,
|
||||||
|
"jsxSingleQuote": false,
|
||||||
|
"semi": true,
|
||||||
|
"arrowParens": "avoid"
|
||||||
|
}
|
|
@ -3,4 +3,4 @@ platform: "Email"
|
||||||
name: "support@nin0.dev"
|
name: "support@nin0.dev"
|
||||||
url: "mailto:support@nin0.dev"
|
url: "mailto:support@nin0.dev"
|
||||||
note: "Replies may be slow"
|
note: "Replies may be slow"
|
||||||
---
|
---
|
||||||
|
|
|
@ -3,4 +3,4 @@ platform: "Telegram"
|
||||||
url: "https://nin0dev.t.me"
|
url: "https://nin0dev.t.me"
|
||||||
name: "@nin0dev"
|
name: "@nin0dev"
|
||||||
note: "Use for quick replies"
|
note: "Use for quick replies"
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
---
|
---
|
||||||
import Social from "./Social.astro"
|
import Social from "./Social.astro"
|
||||||
|
|
||||||
const contacts = await Astro.glob("../../info/contacts/*.md")
|
const contacts: any = Object.values(import.meta.glob("../../info/contacts/*.md", {
|
||||||
|
eager: true
|
||||||
|
}));
|
||||||
---
|
---
|
||||||
<ul>
|
<ul>
|
||||||
{contacts.map(contact => <Social platform={contact.frontmatter.platform} url={contact.frontmatter.url} name={contact.frontmatter.name} note={contact.frontmatter.note}/>)}
|
{contacts.map(contact => <Social platform={contact.frontmatter.platform} url={contact.frontmatter.url} name={contact.frontmatter.name} note={contact.frontmatter.note}/>)}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
body {
|
body {
|
||||||
background-color: #56a0d1;
|
background-color: #56a0d1;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
font-family: sans-serif !important;
|
font-family: sans-serif !important;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
@media (pointer: coarse) {
|
||||||
|
body {
|
||||||
|
overflow: scroll;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@media (pointer:coarse) {
|
|
||||||
body {
|
|
||||||
overflow: scroll;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,56 +1,41 @@
|
||||||
// wow i love being fake programmer
|
// wow i love being fake programmer
|
||||||
// source: https://jams.hackclub.com/batch/webOS/part-3
|
// source: https://jams.hackclub.com/batch/webOS/part-3
|
||||||
function dragElement(element) {
|
function dragElement(element) {
|
||||||
// Step 2: Set up variables to keep track of the element's position.
|
var initialX = 0;
|
||||||
var initialX = 0;
|
var initialY = 0;
|
||||||
var initialY = 0;
|
var currentX = 0;
|
||||||
var currentX = 0;
|
var currentY = 0;
|
||||||
var currentY = 0;
|
|
||||||
|
if (document.getElementById("title-bar"))
|
||||||
// Step 3: Check if there is a special header element associated with the draggable element.
|
document.getElementById("title-bar").onmousedown = startDragging;
|
||||||
if (document.getElementById("title-bar")) {
|
else element.onmousedown = startDragging;
|
||||||
// Step 4: If present, assign the `dragMouseDown` function to the header's `onmousedown` event.
|
|
||||||
// This allows you to drag the window around by its header.
|
function startDragging(e) {
|
||||||
document.getElementById("title-bar").onmousedown = startDragging;
|
e = e || window.event;
|
||||||
} else {
|
e.preventDefault();
|
||||||
// Step 5: If not present, assign the function directly to the draggable element's `onmousedown` event.
|
initialX = e.clientX;
|
||||||
// This allows you to drag the window by holding down anywhere on the window.
|
initialY = e.clientY;
|
||||||
element.onmousedown = startDragging;
|
document.onmouseup = stopDragging;
|
||||||
}
|
document.onmousemove = dragElement;
|
||||||
|
}
|
||||||
// Step 6: Define the `startDragging` function to capture the initial mouse position and set up event listeners.
|
|
||||||
function startDragging(e) {
|
function dragElement(e) {
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// Step 7: Get the mouse cursor position at startup.
|
currentX = initialX - e.clientX;
|
||||||
initialX = e.clientX;
|
currentY = initialY - e.clientY;
|
||||||
initialY = e.clientY;
|
initialX = e.clientX;
|
||||||
// Step 8: Set up event listeners for mouse movement (`elementDrag`) and mouse button release (`closeDragElement`).
|
initialY = e.clientY;
|
||||||
document.onmouseup = stopDragging;
|
console.log(element.offsetTop);
|
||||||
document.onmousemove = dragElement;
|
console.log(currentX);
|
||||||
}
|
element.style.top = element.offsetTop - currentY + "px";
|
||||||
|
element.style.left = element.offsetLeft - currentX + "px";
|
||||||
// Step 9: Define the `elementDrag` function to calculate the new position of the element based on mouse movement.
|
}
|
||||||
function dragElement(e) {
|
|
||||||
e = e || window.event;
|
function stopDragging() {
|
||||||
e.preventDefault();
|
document.onmouseup = null;
|
||||||
// Step 10: Calculate the new cursor position.
|
document.onmousemove = null;
|
||||||
currentX = initialX - e.clientX;
|
console.log(element.offsetTop - currentY);
|
||||||
currentY = initialY - e.clientY;
|
console.log(element.offsetLeft - currentX);
|
||||||
initialX = e.clientX;
|
}
|
||||||
initialY = e.clientY;
|
}
|
||||||
// Step 11: Update the element's new position by modifying its `top` and `left` CSS properties.
|
|
||||||
console.log(element.offsetTop);
|
|
||||||
console.log(currentX);
|
|
||||||
element.style.top = (element.offsetTop - currentY) + "px";
|
|
||||||
element.style.left = (element.offsetLeft - currentX) + "px";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 12: Define the `stopDragging` function to stop tracking mouse movement by removing the event listeners.
|
|
||||||
function stopDragging() {
|
|
||||||
document.onmouseup = null;
|
|
||||||
document.onmousemove = null;
|
|
||||||
console.log(element.offsetTop - currentY);
|
|
||||||
console.log(element.offsetLeft - currentX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue