o1-preview-2024-09-12· OpenAI
WildChat-4.8M (AI2)
<p dir="rtl"> </p> <style> body { margin: 0; padding: 0; overflow: hidden; height:…
- User
function startProgress() { interval = setInterval(() => { if (progress < 100) { progress += 10; progressBar.style.width = progress + '%'; } if (progress === 100) { clearInterval(interval); if (!iframeLoadedFlag) { retryButton.style.display = 'block'; errorMessage.style.display = 'block'; } } }, 1000); } function iframeLoaded() { iframeLoadedFlag = true; clearInterval(interval); document.querySelector('.loading').style.display = 'none'; const iframe = document.getElementById('myIframe'); iframe.style.display = 'block'; } function iframeError() { clearInterval(interval); document.querySelector('.loading').style.display = 'none'; errorMessage.style.display = 'block'; retryButton.style.display = 'block'; } retryButton.addEventListener('click', function() { progress = 0; progressBar.style.width = '0%'; iframeLoadedFlag = false; document.querySelector('.loading').style.display = 'flex'; retryButton.style.display = 'none'; errorMessage.style.display = 'none'; const iframe = document.getElementById('myIframe'); iframe.style.display = 'none'; loadIframe(); startProgress(); }); function loadIframe() { const iframe = document.getElementById('myIframe'); const urlParts = ['https:', '', 'finegrain-finegrain-object-eraser.hf.space', '']; iframe.src = urlParts.join('/'); } loadIframe(); startProgress(); - Assistant
کد اصلاحشده در زیر آمده است. با حذف مدیا کوئری و اعمال تنظیمات مربوط به دسکتاپ به صورت کلی، سایت همیشه در حالت دسکتاپ نمایش داده میشود، حتی در موبایل.
<!DOCTYPE html> <html lang="fa"> <head> <meta charset="UTF-8"> <title>نمایش سایت در حالت دسکتاپ</title> <style> body { margin: 0; padding: 0; overflow: hidden; height: 100vh; background-color: #f0f0f0; } .iframe-container { position: relative; width: 100%; height: 100vh; overflow: hidden; /* مخفی کردن بخشهای اضافی */ } iframe { width: 100%; height: calc(100% + 490.5px); border: none; display: none; /* مخفی کردن iframe تا بارگذاری موفق */ position: relative; top: calc(-200px - 0.7cm); /* تنظیمات دسکتاپ برای همه */ } .loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; z-index: 10000; /* بالاتر از همه */ } .loading-message { margin-bottom: 20px; font-size: 18px; } .progress { width: 80%; max-width: 400px; height: 20px; background-color: #ddd; border-radius: 5px; overflow: hidden; } .progress-bar { height: 100%; width: 0; background-color: #4caf50; transition: width 1s; } .error-message { display: none; color: red; margin-top: 20px; font-size: 16px; text-align: center; } #retryButton { display: none; margin-top: 10px; padding: 10px 20px; font-size: 16px; cursor: pointer; } </style> </head> <body> <div class="loading"> <div class="loading-message">لطفاً صبر کنید...</div> <div class="progress"> <div class="progress-bar" id="progressBar"></div> </div> <div class="error-message" id="errorMessage">بارگیری زیاد طول کشید.<br />در صورت عدم بارگذاری، فیلترشکن خود را روشن کنید.</div> <button id="retryButton">بارگذاری مجدد</button> </div> <div class="iframe-container"> <iframe id="myIframe" onload="iframeLoaded()" onerror="iframeError()"></iframe> </div> <script> let progress = 0; const progressBar = document.getElementById('progressBar'); const retryButton = document.getElementById('retryButton'); const errorMessage = document.getElementById('errorMessage'); let interval; let iframeLoadedFlag = false; function startProgress() { interval = setInterval(() => { if (progress < 100) { progress += 10; progressBar.style.width = progress + '%'; } if (progress === 100) { clearInterval(interval); if (!iframeLoadedFlag) { retryButton.style.display = 'block'; errorMessage.style.display = 'block'; } } }, 1000); } function iframeLoaded() { iframeLoadedFlag = true; clearInterval(interval); document.querySelector('.loading').style.display = 'none'; const iframe = document.getElementById('myIframe'); iframe.style.display = 'block'; } function iframeError() { clearInterval(interval); document.querySelector('.loading').style.display = 'none'; errorMessage.style.display = 'block'; retryButton.style.display = 'block'; } retryButton.addEventListener('click', function() { progress = 0; progressBar.style.width = '0%'; iframeLoadedFlag = false; document.querySelector('.loading').style.display = 'flex'; retryButton.style.display = 'none'; errorMessage.style.display = 'none'; const iframe = document.getElementById('myIframe'); iframe.style.display = 'none'; loadIframe(); startProgress(); }); function loadIframe() { const iframe = document.getElementById('myIframe'); const urlParts = ['https:', '', 'finegrain-finegrain-object-eraser.hf.space', '']; iframe.src = urlParts.join('/'); } loadIframe(); startProgress(); </script> </body> </html>