├── media ├── .gitkeep ├── 1.jpg └── 2.jpg ├── README.md ├── index.js ├── index.html └── style.css /media/.gitkeep: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /media/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dev-ir/bandwidth-calculations/HEAD/media/1.jpg -------------------------------------------------------------------------------- /media/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dev-ir/bandwidth-calculations/HEAD/media/2.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # مبدل پهنای باند و حجم دانلود 2 | 3 | این پروژه یک مبدل آنلاین است که به کاربران کمک می‌کند تا محاسبه کنند: 4 | 1. اگر یک پورت پهنای باند اختصاصی (مثلاً 1 گیگابیت بر ثانیه) داشته باشند، در یک بازه زمانی مشخص چند ترابایت داده می‌توانند دریافت کنند. 5 | 2. همچنین به کاربران امکان می‌دهد مقدار داده (ترابایت) مورد نظرشان را وارد کنند تا پهنای باند مورد نیاز برای دریافت آن داده را در بازه زمانی مشخص محاسبه کنند. 6 | 7 | ![image](https://raw.githubusercontent.com/vR3za/bandwidth-calculations/refs/heads/master/media/1.jpg) 8 | ## ویژگی‌ها 9 | 10 | - **محاسبه حجم دانلود**: با وارد کردن پهنای باند و بازه زمانی، مقدار داده‌ای که می‌توانید در آن بازه دریافت کنید محاسبه می‌شود. 11 | - **محاسبه پهنای باند مورد نیاز**: با وارد کردن مقدار داده (ترابایت) و بازه زمانی، پهنای باند مورد نیاز برای دریافت آن داده محاسبه می‌شود. 12 | - **رابط کاربری ساده و کاربرپسند**: با کلیک روی لینک، کاربران به راحتی به ابزار دسترسی پیدا می‌کنند و محاسبات خود را انجام می‌دهند. 13 | 14 | ## استفاده آنلاین 15 | 16 | برای استفاده از مبدل، کافیست روی لینک زیر کلیک کنید: 17 | 18 | [استفاده از مبدل پهنای باند و حجم دانلود](https://dev-ir.github.io/bandwidth-calculations/) 19 | 20 | ## مشارکت 21 | 22 | اگر تمایل به مشارکت در این پروژه دارید: 23 | 24 | 1. مخزن پروژه را Fork کنید. 25 | 2. تغییرات مورد نظرتان را در یک شاخه جدید اعمال کنید. 26 | 3. Pull Request بفرستید تا بررسی شود. 27 | 28 | ## 📧 کانال تلگرام ما 29 | 30 | https://t.me/+EpErnDsDPhw3ZThk 31 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | function calculateDownload(speedGbps, days) { 2 | const speedBytesPerSecond = (speedGbps * 1e9) / 8; 3 | const secondsPerDay = 86400; 4 | const bytesPerDay = speedBytesPerSecond * secondsPerDay; 5 | const totalBytes = bytesPerDay * days; 6 | const totalTerabytes = totalBytes / 1e12; 7 | return Math.round(totalTerabytes); 8 | } 9 | 10 | function calculateSpeed(dataTB, days) { 11 | const totalBytes = dataTB * 1e12; 12 | const secondsPerDay = 86400; 13 | const totalSeconds = days * secondsPerDay; 14 | const speedBytesPerSecond = totalBytes / totalSeconds; 15 | const speedGbps = (speedBytesPerSecond * 8) / 1e9; 16 | return speedGbps; 17 | } 18 | 19 | function formatSpeed(speedGbps) { 20 | if (speedGbps >= 1) { 21 | return `${speedGbps.toFixed(2)} گیگابیت بر ثانیه`; 22 | } else { 23 | const speedMbps = speedGbps * 1000; 24 | return `${speedMbps.toFixed(2)} مگابیت بر ثانیه`; 25 | } 26 | } 27 | 28 | document.getElementById('downloadForm').addEventListener('submit', function (event) { 29 | event.preventDefault(); 30 | const speed = parseFloat(document.getElementById('speed').value); 31 | const days = parseInt(document.getElementById('days').value, 10); 32 | const result = calculateDownload(speed, days); 33 | document.getElementById('result').textContent = `در ${days} روز با سرعت ${speed} گیگابیت بر ثانیه، شما می‌توانید تقریبا ${result} ترابایت داده دانلود کنید.`; 34 | }); 35 | 36 | document.getElementById('speedForm').addEventListener('submit', function (event) { 37 | event.preventDefault(); 38 | const data = parseFloat(document.getElementById('data').value); 39 | const days = parseInt(document.getElementById('daysForSpeed').value, 10); 40 | const resultSpeedGbps = calculateSpeed(data, days); 41 | const formattedSpeed = formatSpeed(resultSpeedGbps); 42 | 43 | document.getElementById('result').textContent = `برای دانلود ${data} ترابایت داده در ${days} روز، شما نیاز به پهنای باند ${formattedSpeed} دارید.`; 44 | }); 45 | 46 | document.getElementById('switchToSpeedForm').addEventListener('click', function () { 47 | document.getElementById('form-container').classList.add('d-none'); 48 | document.getElementById('speedFormContainer').classList.remove('d-none'); 49 | }); 50 | 51 | document.getElementById('switchToDownloadForm').addEventListener('click', function () { 52 | document.getElementById('speedFormContainer').classList.add('d-none'); 53 | document.getElementById('form-container').classList.remove('d-none'); 54 | }); -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | محاسبه حجم دانلود 8 | 10 | 11 | 12 | 14 | 15 | 16 | 17 |
18 |

محاسبه
حجم دانلود / پهنای باند

19 |
20 |
21 |
22 | 23 | 32 |
33 |
34 | 35 | 36 |
37 |
38 | 39 | 40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | 48 | 49 |
50 |
51 | 52 | 53 |
54 |
55 | 56 | 57 |
58 |
59 |
60 |
61 |
62 | 65 |
66 |
67 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-weight: 300; 3 | font-size: 15px; 4 | line-height: 1.7; 5 | color: #c4c3ca; 6 | background-color: #1f2029; 7 | overflow-x: hidden; 8 | direction: rtl; 9 | text-align: right; 10 | font-family: Yekan; 11 | display: flex; 12 | min-height: 100vh; 13 | } 14 | footer { 15 | text-align: center; 16 | bottom: 0; 17 | position: fixed; 18 | width: 100%; 19 | } 20 | footer > div { 21 | margin: 0 20px; 22 | padding: 10px; 23 | background-color: #2a2b38; 24 | border-top: 2px solid #302e3f; 25 | border-radius: 8px 8px 0 0; 26 | box-shadow: 0px 8px 13px -1px #1f2029 inset; 27 | } 28 | .btn { 29 | width: 100%; 30 | font-size: 15px; 31 | border-radius: 4px; 32 | height: 44px; 33 | font-weight: 600; 34 | text-transform: uppercase; 35 | -webkit-transition: all 200ms linear; 36 | border: 1px solid #ffffff00 !important; 37 | transition: all 200ms linear; 38 | /* padding: 0 30px; */ 39 | letter-spacing: 1px; 40 | display: -webkit-inline-flex; 41 | display: -ms-inline-flexbox; 42 | display: inline-flex; 43 | -webkit-align-items: center; 44 | -moz-align-items: center; 45 | -ms-align-items: center; 46 | align-items: center; 47 | -webkit-justify-content: center; 48 | -moz-justify-content: center; 49 | -ms-justify-content: center; 50 | justify-content: center; 51 | -ms-flex-pack: center; 52 | text-align: center; 53 | border: none; 54 | background-color: #ffeba7; 55 | color: #102770; 56 | box-shadow: 0 8px 24px 0 rgba(255, 235, 167, 0.2); 57 | } 58 | .btn:active, 59 | .btn:focus { 60 | background-color: transparent !important; 61 | color: #fff !important; 62 | box-shadow: 0 8px 24px 0 rgba(16, 39, 112, 0.2); 63 | border: 1px solid #fff !important; 64 | } 65 | 66 | .btn:hover { 67 | background-color: #1f2029; 68 | color: #ffeba7; 69 | box-shadow: 0 8px 24px 0 rgba(16, 39, 112, 0.2); 70 | border: 1px solid #ffeba775 !important; 71 | } 72 | .container-btn > button:first-child { 73 | margin-left: 1rem; 74 | } 75 | 76 | a { 77 | cursor: pointer; 78 | transition: all 200ms linear; 79 | text-decoration: none; 80 | } 81 | 82 | .link { 83 | color: #c4c3ca; 84 | } 85 | .link:hover { 86 | color: #ffeba7; 87 | } 88 | .content > h1 { 89 | text-shadow: 1px 4px 3px #000000; 90 | } 91 | .content { 92 | width: 100%; 93 | height: fit-content; 94 | background-color: #2a2b38; 95 | background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/1462889/pat.svg); 96 | background-position: bottom center; 97 | background-repeat: no-repeat; 98 | background-size: 300%; 99 | border-radius: 16px; 100 | padding: 40px; 101 | box-shadow: 0px 4px 12px -3px #15161c; 102 | } 103 | .note > div { 104 | background-color: #1f2029; 105 | padding: 25px 10px; 106 | border: 2px solid #34364b; 107 | border-radius: 7px; 108 | font-size: 20px; 109 | } 110 | .form-group > label { 111 | text-indent: 15px; 112 | } 113 | .form-group select, 114 | .form-group input { 115 | background-color: #1f2029; 116 | border-radius: 7px; 117 | color: #fff !important; 118 | padding: 10px 15px; 119 | margin-top: 6px; 120 | border: 1px solid #34364b; 121 | } 122 | .form-group select:focus, 123 | .form-group input:focus { 124 | background-color: #1f2029ad; 125 | outline: none; 126 | box-shadow: 0 0 0 0.25rem rgb(255 235 167 / 8%); 127 | border: 1px solid #ffeba7; 128 | } 129 | .container-btn { 130 | display: flex; 131 | justify-content: space-evenly; 132 | } 133 | @media (max-width: 575px) { 134 | body > div.container { 135 | margin: 20px; 136 | } 137 | .container-btn { 138 | flex-direction: column; 139 | } 140 | } 141 | @media (min-width: 576px) { 142 | body > div.container { 143 | margin-top: 20px; 144 | } 145 | .content > h1 > br { 146 | display: none; 147 | } 148 | .container-btn > button:first-child { 149 | width: 42%; 150 | } 151 | } 152 | --------------------------------------------------------------------------------