diff --git a/3D distance calculator/manifest.json b/3D distance calculator/manifest.json new file mode 100644 index 00000000..c48d9607 --- /dev/null +++ b/3D distance calculator/manifest.json @@ -0,0 +1,10 @@ +{ + "manifest_version": 3, + "name": "Distance Calculator", + "version": "1.0", + "description": "Distance Calculator.", + "permissions": [], + "action": { + "default_popup": "popup.html" + } +} \ No newline at end of file diff --git a/3D distance calculator/popup.html b/3D distance calculator/popup.html new file mode 100644 index 00000000..31562187 --- /dev/null +++ b/3D distance calculator/popup.html @@ -0,0 +1,29 @@ + + + + + + + + Distance Calculator + + + +
+
+

Distance Calculator

+ + + + + + + +
+
+
+
+ + + + \ No newline at end of file diff --git a/3D distance calculator/script.js b/3D distance calculator/script.js new file mode 100644 index 00000000..38d59af7 --- /dev/null +++ b/3D distance calculator/script.js @@ -0,0 +1,25 @@ +document.getElementById('myButton').addEventListener('click', function() { + const point1 = document.getElementById('point1').value.split(','); + const point2 = document.getElementById('point2').value.split(','); + + if (point1.length === 3 && point2.length === 3) { + const x1 = parseFloat(point1[0]); + const y1 = parseFloat(point1[1]); + const z1 = parseFloat(point1[2]); + const x2 = parseFloat(point2[0]); + const y2 = parseFloat(point2[1]); + const z2 = parseFloat(point2[2]); + const a = x2-x1; + const b = y2-y1; + const c = z2-z1; + + + + const ans = Math.sqrt(a*a + b*b + c*c); + + document.getElementById('result').innerText = `Distance: (${ans})`; + + } else { + document.getElementById('result').innerText = 'Please enter two points in the format x,y,z.'; + } +}); \ No newline at end of file diff --git a/3D distance calculator/style.css b/3D distance calculator/style.css new file mode 100644 index 00000000..a5f533aa --- /dev/null +++ b/3D distance calculator/style.css @@ -0,0 +1,93 @@ +body { + font-family: "Arial", sans-serif; + background: linear-gradient(50deg, #8a1a1a, #087f9d); + margin: 0; + padding: 0; + list-style: 1.6; + height: 400px; + width: 400px; +} + +.main { + display: flex; + flex-direction: column; + align-items: center; + min-height: 100vh; +} + +@media screen and (max-width:400px) { + #formula { + font-size: 1.3rem; + font-weight: 600; + } +} + +.cal { + text-align: center; + color: #ddd; +} + +h1 { + margin: 40px 0; +} + +input { + width: calc(100% - 100px); + padding: 10px; + margin: 10px 0 20px 0; + box-sizing: border-box; + font-size: 16px; + border: 1px solid #ddd; + border-radius: 5px; +} + +#result { + margin: 1.4rem 0; + font-size: 1.5rem; + color: #000000; +} + + +.gcd { + font-size: 12px; + font-weight: 600; + margin-top: 0; +} + +abel { + font-weight: bold; + display: block; + margin-bottom: 8px; + color: #333333; +} + +input, +select { + width: 100%; + padding: 10px; + margin-bottom: 16px; + box-sizing: border-box; + border-radius: 10px; +} + +button { + width: 100%; + height: 40px; + font-size: 16px; + cursor: pointer; + background-color: #6f0150; + color: #ffffff; + border: none; + border-radius: 9px; + transition: background-color 0.3s; +} + +button:hover { + background-color: #45a09e; +} + +#result { + margin-top: 16px; + font-weight: bold; + color: #020101; +} \ No newline at end of file