مطمئناً! من کد شما را با اضافه کردن یک دکمهی "P" (پرامپت) مشابه کد دوم و همچنین ادغام تمام پرامپتها به کد اصلی اصلاح کردهام. در اینجا نسخهی بهروز شدهی کد شما را میبینید:
<p> </p>
<style>
:root {
--color-primary: #4CAF50;
--color-secondary: rgb(84, 110, 122);
--color-danger: #f44336;
--color-white: #ffffff;
--color-black: #000000;
--color-gray: #f0f0f0;
--color-light-gray: #ddd;
--color-green: #4caf50;
--color-hover: #d32f2f;
}
body {
margin: 0;
padding: 0;
overflow: hidden;
height: 100vh;
background-color: var(--color-gray);
font-family: Arial, sans-serif;
text-align: center;
direction: rtl;
}
.iframe-container {
position: relative;
width: 100%;
height: 100vh;
overflow: hidden;
}
iframe {
width: 100%;
height: 100%;
border: none;
display: none;
position: relative;
}
.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: var(--color-light-gray);
border-radius: 5px;
overflow: hidden;
}
.progress-bar {
height: 100%;
width: 0;
background-color: var(--color-green);
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;
background-color: var(--color-green);
color: var(--color-white);
border: none;
border-radius: 5px;
transition: background-color 0.3s;
}
#retryButton:hover {
background-color: #45a049;
}
/* دکمهها */
.button-container {
position: fixed;
top: 10px;
left: 10px;
display: flex;
gap: 10px;
z-index: 10001;
}
.download-button, .download-button-bottom {
background-color: var(--color-primary);
color: var(--color-white);
text-align: center;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
text-decoration: none;
display: flex;
align-items: center;
justify-content: center;
padding: 6px 10px;
font-size: 11px;
width: 130px;
}
.download-button-bottom {
position: fixed;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
z-index: 10001;
}
.download-button:hover, .download-button-bottom:hover {
background-color: #45a049;
}
.description-button, .prompt-button {
background-color: var(--color-secondary);
color: var(--color-white);
text-align: center;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
text-decoration: none;
display: flex;
align-items: center;
justify-content: center;
padding: 6px 10px;
font-size: 11px;
width: 130px;
}
.prompt-button {
width: 30px;
font-size: 14px;
padding: 4px;
}
.description-button:hover, .prompt-button:hover {
filter: brightness(0.9);
}
/* مدالها */
.modal {
display: none;
position: fixed;
z-index: 10002;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow-y: auto;
background-color: rgba(0, 0, 0, 0.5);
padding: 20px;
box-sizing: border-box;
}
.modal-content {
background-color: var(--color-white);
margin: 50px auto;
padding: 20px;
border: 1px solid #888;
width: 90%;
max-width: 800px;
text-align: center;
border-radius: 10px;
box-shadow: 0 5px 15px rgba(0,0,0,0.3);
position: relative;
max-height: 90vh;
overflow-y: auto;
}
.modal-button {
margin-top: 20px;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s;
}
.cancel-btn {
background-color: var(--color-danger);
color: var(--color-white);
}
.cancel-btn:hover {
background-color: #d32f2f;
}
.download-btn {
background-color: var(--color-green);
color: var(--color-white);
}
.download-btn:hover {
background-color: #45a049;
}
/* دکمه بستن بالای مودال */
.close-top-btn {
position: absolute;
top: 10px;
left: 10px;
background-color: var(--color-danger);
color: var(--color-white);
border: none;
font-size: 24px;
cursor: pointer;
font-weight: bold;
line-height: 1;
padding: 5px 10px;
border-radius: 5px;
}
.close-top-btn:hover {
background-color: #d32f2f;
}
/* استایلهای دستهبندی پرامپتها */
.prompt-category {
background: #ffffff;
padding: 12px 20px;
margin: 10px auto;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
cursor: pointer;
transition: background-color 0.3s, transform 0.2s;
width: 80%;
max-width: 300px;
border: 1px solid #e0e0e0;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
position: relative;
}
.prompt-category:hover {
background-color: #f9f9f9;
transform: translateY(-2px);
}
.prompt-category .icon {
margin-left: 8px;
font-size: 20px;
color: #3498db;
}
/* مودال لیست پرامپتها */
.prompt-list {
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
}
.prompt-item {
background-color: #fff;
padding: 8px 12px;
margin: 5px 0;
border-radius: 8px;
transition: background-color 0.3s, box-shadow 0.3s;
text-align: left;
font-weight: bold;
font-size: 14px;
width: 100%;
max-width: 400px;
display: flex;
align-items: center;
justify-content: space-between;
border: 1px solid #e0e0e0;
position: relative;
}
.prompt-item:hover {
background-color: #f0f0f0;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.prompt-text-container {
display: flex;
flex-direction: column;
align-items: flex-start;
text-align: right;
}
.prompt-text {
font-weight: bold;
font-size: 16px;
margin-bottom: 5px;
cursor: pointer;
}
.persian-translation {
font-size: 14px;
color: #555;
}
.copy-icon {
cursor: pointer;
font-size: 20px;
color: #555;
transition: color 0.3s;
margin-left: 10px;
display: flex;
align-items: center;
justify-content: center;
}
.copy-icon:hover {
color: #000;
}
/* دکمه کوچکتر برای پرامپتها */
.prompt-button-small {
background-color: #3498db;
color: white;
border: none;
border-radius: 50%;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background-color 0.3s, transform 0.2s;
font-size: 12px;
}
.prompt-button-small:hover {
background-color: #2980b9;
transform: scale(1.1);
}
/* دکمههای صفحهبندی */
.pagination-button {
margin: 5px 5px 0 5px;
padding: 8px 16px;
font-size: 14px;
background-color: var(--color-primary);
color: var(--color-white);
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
.pagination-button:hover {
background-color: #45a049;
}
/* اطلاعات صفحه فعلی */
.page-info {
margin-top: 10px;
font-size: 14px;
color: #555;
}
/* تنظیم عرض مودالها برای نمایش بهتر در صفحات کوچک */
@media (max-width: 600px) {
.modal-content {
width: 95%;
}
.prompt-category {
width: 95%;
}
.prompt-item {
width: 95%;
}
.download-button, .download-button-bottom {
width: 100px;
font-size: 11px;
padding: 6px 10px;
}
.description-button {
width: 100px;
}
.prompt-text {
font-size: 14px;
}
.persian-translation {
font-size: 12px;
}
.copy-icon {
font-size: 18px;
}
.prompt-button-small {
width: 20px;
height: 20px;
font-size: 10px;
}
.close-top-btn {
font-size: 14px;
padding: 5px 10px;
}
.pagination-button {
width: 48%;
}
}
</style>
<!-- دکمهها -->
<div class="button-container">
<a href="#" class="description-button" id="descriptionButton">توضیحات</a>
<a href="#" class="prompt-button" id="promptButton">P</a>
</div>
<p><a href="#" class="download-button" id="downloadButton">دانلود تصویر 📥</a></p>
<!-- دکمه دانلود در پایین صفحه -->
<p><a href="#" class="download-button-bottom" id="downloadButtonBottom">دانلود تصویر 📥</a></p>
<!-- پنجره سفارشی (مدال) برای توضیحات -->
<div id="myModal" class="modal">
<div class="modal-content">
<p>هوش مصنوعی Flux از متن فارسی پشتیبانی نمی‌کند.<br />پرامپت یا همون متنی که وارد می‌کنید به زبان انگلیسی وارد کنید.<br />برای استفاده از مترجم گوگل، روی 'مترجم' کلیک کنید.</p>
<button class="modal-button cancel-btn" id="cancelBtn">لغو</button>
<button class="modal-button download-btn" id="confirmBtn">مترجم</button>
</div>
</div>
<!-- پنجره مودال توضیحات -->
<div id="myDescriptionModal" class="modal">
<div class="modal-content">
<button class="modal-button close-top-btn" id="closeDescriptionModalTopBtn">×</button>
<p>ربات هوشمند برنامه <span style="color: #008080;">هوش مصنوعی</span></p>
<p>با قابلیت ساخت تصاویر در لحظه</p>
<p>و گفتگو پیشرفته</p>
<p>ساخت تصاویر این ربات از متن فارسی پشتیبانی نمی‌کند و شما می‌توانید به فارسی هر تصویری که خواستید را تولید کنید.</p>
<p>برای ساخت تصاویر روی سه نقطه داخل صفحه بزنید و گزینه دوم را انتخاب کنید.</p>
<p>در بعضی مواقع اگر تصاویر پشت سر هم تولید نشد یک بار دکمه Clear را کلیک کنید یا از صفحه خارج شوید دوباره وارد شوید.</p>
<button class="modal-button cancel-btn" id="closeDescriptionBtn">بستن</button>
</div>
</div>
<!-- پنجره مودال پرامپتها -->
<div id="myPromptModal" class="modal">
<div class="modal-content">
<button class="modal-button close-top-btn" id="closePromptBtnTop">×</button>
<p>دسته‌بندی پرامپت‌ها</p>
<!-- دستهبندیهای پرامپت -->
<div class="prompt-category" data-category="lighting">پرامپت‌های نورپردازی <span class="icon">💡</span></div>
<div class="prompt-category" data-category="special_lighting">پرامپت‌های خاص نورپردازی <span class="icon">✨</span></div>
<div class="prompt-category" data-category="details_quality">پرامپت‌های جزئیات و کیفیت <span class="icon">🔍</span></div>
<div class="prompt-category" data-category="punk">پرامپت‌های Punk <span class="icon">🎸</span></div>
<div class="prompt-category" data-category="landscape">پرامپت‌های منظره <span class="icon">🌄</span></div>
<div class="prompt-category" data-category="colors">پرامپت‌های رنگ <span class="icon">🎨</span></div>
<div class="prompt-category" data-category="artist_style">پرامپت‌های استایل هنرمندان <span class="icon">🖌️</span></div>
<div class="prompt-category" data-category="iranian_art_identity">پرامپت‌های هویت هنری ایرانی <span class="icon">🏺</span></div>
<div class="prompt-category" data-category="iranian_set_design">پرامپت‌های فضاسازی ایرانی <span class="icon">🏙️</span></div>
<button class="modal-button cancel-btn" id="closePromptBtn">بستن</button>
</div>
</div>
<!-- پنجره مودال لیست پرامپتها -->
<div id="promptListModal" class="modal">
<div class="modal-content">
<button class="modal-button close-top-btn" id="closePromptListBtnTop">×</button>
<p id="promptListTitle">پرامپت‌ها</p>
<div class="prompt-list" id="promptList"></div>
<div class="page-info" id="pageInfo" style="display: none;"></div>
<div>
<button class="pagination-button" id="prevPageBtn" style="display: none;">بازگشت به صفحه قبلی</button>
<button class="pagination-button" id="nextPageBtn" style="display: none;">ادامه صفحه بعدی</button>
</div>
</div>
</div>
<!-- پنجره مودال تصاویر دانلود شده -->
<div id="myModalImages" class="modal">
<div class="modal-content">
<button class="modal-button close-top-btn" id="closeModalImagesTopBtn">×</button>
<p>تصاویر شناسایی شده</p>
<div class="image-container" id="imageContainer"></div>
<button class="modal-button cancel-btn" id="closeImagesBtn">بستن</button>
</div>
</div>
<!-- لودینگ و iframe -->
<div class="iframe-container">
<div class="loading" id="loadingContainer">
<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>
<!-- افزودن ویژگیهای sandbox و allow به iframe -->
<iframe id="myIframe" sandbox="allow-scripts allow-same-origin allow-forms allow-modals" allow="clipboard-read; clipboard-write"></iframe>
</div>
<p>
<script>
// تنظیم ارتفاع متغیر CSS --vh برای سازگاری با موبایل
function setVhVariable() {
let vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty('--vh', vh + 'px');
}
setVhVariable();
window.addEventListener('resize', setVhVariable);
const siteURL = 'https://kingnish-realtime-flux.hf.space/'; // تغییر URL به دلخواه
const excludeUrls = [
'https://yanze-pulid.hf.space/--replicas/3t64n/file=/tmp/gradio/7567beceda2541f726af7beb4c9aa857b4a96b77/liuyifei.png',
'https://yanze-pulid.hf.space/--replicas/3t64n/file=/tmp/gradio/7567beceda2541f726af7beb4c9aa857b4a96b77/liuyifei.png',
'https://prodiazenafey-faceswap.hf.space/file=/tmp/gradio/44ce6237aa956835c13beb89ae4c83f8afea7edb/example3.jpg',
'https://cohereforai-aya-expanse.hf.space/gradio_api/file=/tmp/gradio/195e9bc39ae67221fa523905a8a7f36b44bb03ebd3310192cf2ad0235b29fc1b/AyaExpanse.png'
];
let progress = 0;
const progressBar = document.getElementById('progressBar');
const retryButton = document.getElementById('retryButton');
const errorMessage = document.getElementById('errorMessage');
const loadingContainer = document.getElementById('loadingContainer');
const nextPageBtn = document.getElementById('nextPageBtn');
const prevPageBtn = document.getElementById('prevPageBtn');
const pageInfo = document.getElementById('pageInfo');
let interval;
let iframeLoadedFlag = false;
function startProgress() {
loadingContainer.style.display = 'flex';
progressBar.style.width = '0%';
progress = 0;
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);
loadingContainer.style.display = 'none';
document.getElementById('myIframe').style.display = 'block';
hideUnwantedElements();
setupElementHiding();
}
function iframeError() {
clearInterval(interval);
loadingContainer.style.display = 'flex';
retryButton.style.display = 'block';
errorMessage.style.display = 'block';
}
function setupElementHiding() {
const iframe = document.getElementById('myIframe');
try {
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
if (!iframeDocument) return;
hideUnwantedElements();
const observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.addedNodes.length) {
hideUnwantedElements();
}
});
});
observer.observe(iframeDocument.body, {
childList: true,
subtree: true
});
} catch (error) {
console.error("نمیتوان به محتوای iframe دسترسی پیدا کرد: ", error);
}
}
function hideUnwantedElements() {
const iframe = document.getElementById('myIframe');
try {
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
if (!iframeDocument) return;
// مخفی یا جایگزین کردن تصاویر مشخصشده
const images = iframeDocument.querySelectorAll('img');
images.forEach(img => {
if (img.src.endsWith('.png')) {
img.src = 'https://app.puzzley.net/uploads/user/Jydo/هوش%20مصنوعی/Negar_1731256487636.png';
}
});
// مخفی کردن لینکهای مشخصشده
const linksToHide = [
'https://docs.cohere.com/docs/c4ai-acceptable-use-policy',
'https://gradio.app/',
'https://huggingface.co/openai/whisper-large-v3-turbo',
'https://groq.com/',
'http://neets.ai/',
'https://huggingface.co/black-forest-labs/FLUX.1-schnell'
];
const links = iframeDocument.querySelectorAll('a');
links.forEach(link => {
if (
linksToHide.includes(link.href) ||
link.textContent.trim().includes("C4AI's Acceptable Use Policy")
) {
link.style.display = 'none';
}
});
// مخفی یا جایگزین کردن متون مشخصشده
const unwantedTexts = [
"C4AI Aya Expanse is a state-of-art model with highly advanced capabilities to connect the world across languages.",
"You can use this space to chat, speak and visualize with Aya Expanse in 23 languages.",
"Made with gradio",
"Whisper large-v3-turbo",
"Groq",
"neets.ai",
"Flux Schnell",
"This space uses Aya Expanse for translating multilingual prompts and generating detailed image descriptions and Flux Schnell for Image Generation.",
"To enable voice interaction with Aya Expanse, this space uses Whisper large-v3-turbo and Groq for STT and neets.ai for TTS."
];
const textsToReplace = {
"Aya Expanse": "هوش مصنوعی",
"Chat with Aya": "چت بات هوشمند",
"Speak with Aya": "تعامل صوتی(بزودی)",
"Visualize with Aya": "ساخت تصاویر با هوش مصنوعی",
"Aya": "هوش مصنوعی"
};
unwantedTexts.forEach(unwanted => {
const textNodes = getTextNodesContaining(iframeDocument.body, unwanted);
textNodes.forEach(node => {
const parentElement = node.parentElement;
if (parentElement) {
parentElement.style.display = 'none';
}
});
});
Object.keys(textsToReplace).forEach(originalText => {
const newText = textsToReplace[originalText];
const textNodes = getTextNodesContaining(iframeDocument.body, originalText);
textNodes.forEach(node => {
node.textContent = node.textContent.replace(new RegExp(escapeRegExp(originalText), 'g'), newText);
});
});
} catch (error) {
console.error("نمیتوان به محتوای iframe دسترسی پیدا کرد: ", error);
}
}
function getTextNodesContaining(node, text) {
let textNodes = [];
if (node.nodeType === Node.TEXT_NODE && node.nodeValue.includes(text)) {
textNodes.push(node);
} else {
node.childNodes.forEach(child => {
textNodes = textNodes.concat(getTextNodesContaining(child, text));
});
}
return textNodes;
}
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
retryButton.addEventListener('click', function() {
progress = 0;
progressBar.style.width = '0%';
iframeLoadedFlag = false;
retryButton.style.display = 'none';
errorMessage.style.display = 'none';
loadingContainer.style.display = 'flex';
document.getElementById('myIframe').style.display = 'none';
loadIframe();
startProgress();
});
function loadIframe() {
fetch(siteURL, { method: 'HEAD', mode: 'no-cors' })
.then(() => {
const iframe = document.getElementById('myIframe');
iframe.src = siteURL;
iframe.onload = iframeLoaded;
iframe.onerror = iframeError;
})
.catch(() => {
iframeError();
});
}
function handleDownload(event) {
event.preventDefault();
const iframe = document.getElementById('myIframe');
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
try {
const images = iframeDocument.querySelectorAll('img');
if (images.length === 0) {
alert("هیچ تصویری با فرمت WEBP برای دانلود یافت نشد.");
return;
}
let webpImages = [];
images.forEach((img) => {
if (img.src.endsWith('.webp') && !excludeUrls.includes(img.src)) {
webpImages.push(img.src);
}
});
webpImages = webpImages.slice(0, 4);
if (webpImages.length === 0) {
alert("هیچ تصویر ساخته شدهای یافت نشد.");
return;
}
const imageContainer = document.getElementById('imageContainer');
imageContainer.innerHTML = '';
webpImages.forEach((imageUrl, index) => {
const imageItem = document.createElement('div');
imageItem.classList.add('image-item');
imageItem.style.marginBottom = '10px';
imageItem.innerHTML = `
<img src="${imageUrl}" alt="Image ${index + 1}" style="max-width: 100%; border-radius: 5px;">
<button onclick="downloadImage('${imageUrl}')" style="margin-top: 5px; padding: 5px 10px; border: none; border-radius: 5px; background-color: var(--color-primary); color: var(--color-white); cursor: pointer;">دانلود</button>
`;
imageContainer.appendChild(imageItem);
});
document.getElementById('myModalImages').style.display = 'block';
} catch (error) {
console.error("خطا در شناسایی تصاویر: ", error);
alert("خطایی در شناسایی تصاویر رخ داد.");
}
}
function downloadImage(imageUrl) {
if (confirm("برای دانلود تصویر روی تایید کلیک کنید و بعد از باز شدن مرورگر روی تصویر محکم نگهدارید و بارگیری تصویر را کلیک کنید.")) {
window.open(imageUrl, '_blank');
}
}
document.getElementById('downloadButton').addEventListener('click', handleDownload);
document.getElementById('downloadButtonBottom').addEventListener('click', handleDownload);
// بستن مودال تصاویر
const modalImages = document.getElementById('myModalImages');
const closeImagesBtn = document.getElementById('closeImagesBtn');
const closeModalImagesTopBtn = document.getElementById('closeModalImagesTopBtn');
closeImagesBtn.addEventListener('click', function() {
modalImages.style.display = 'none';
});
closeModalImagesTopBtn.addEventListener('click', function() {
modalImages.style.display = 'none';
});
window.addEventListener('click', function(event) {
const modal = document.getElementById('myModal');
const descriptionModal = document.getElementById('myDescriptionModal');
const promptModal = document.getElementById('myPromptModal');
const promptListModal = document.getElementById('promptListModal');
if (event.target == modal) {
modal.style.display = 'none';
}
if (event.target == descriptionModal) {
descriptionModal.style.display = 'none';
}
if (event.target == promptModal) {
promptModal.style.display = 'none';
}
if (event.target == promptListModal) {
promptListModal.style.display = 'none';
}
if (event.target == modalImages) {
modalImages.style.display = 'none';
}
});
// مدیریت پنجره توضیحات (مدال)
const modal = document.getElementById('myModal');
const cancelBtn = document.getElementById('cancelBtn');
const confirmBtn = document.getElementById('confirmBtn');
const descriptionButton = document.getElementById('descriptionButton');
// نمایش پنجره سفارشی
descriptionButton.addEventListener('click', function(event) {
event.preventDefault();
modal.style.display = 'block';
});
// دکمه لغو
cancelBtn.addEventListener('click', function() {
modal.style.display = 'none';
});
// دکمه مترجم
confirmBtn.addEventListener('click', function() {
modal.style.display = 'none';
window.open('https://translate.google.com/?hl=fa&sl=fa&tl=en&op=translate', '_blank');
});
// پنجره مودال توضیحات
const descriptionModal = document.getElementById('myDescriptionModal');
const closeDescriptionBtn = document.getElementById('closeDescriptionBtn');
const closeDescriptionModalTopBtn = document.getElementById('closeDescriptionModalTopBtn');
closeDescriptionBtn.addEventListener('click', function() {
descriptionModal.style.display = 'none';
});
closeDescriptionModalTopBtn.addEventListener('click', function() {
descriptionModal.style.display = 'none';
});
// پنجره مودال پرامپتها
const promptModal = document.getElementById('myPromptModal');
const promptButton = document.getElementById('promptButton');
const closePromptBtn = document.getElementById('closePromptBtn');
const closePromptBtnTop = document.getElementById('closePromptBtnTop');
promptButton.addEventListener('click', function(event) {
event.preventDefault();
promptModal.style.display = 'block';
});
closePromptBtn.addEventListener('click', function() {
promptModal.style.display = 'none';
});
closePromptBtnTop.addEventListener('click', function() {
promptModal.style.display = 'none';
});
// پنجره لیست پرامپتها
const promptListModal = document.getElementById('promptListModal');
const promptList = document.getElementById('promptList');
const promptListTitle = document.getElementById('promptListTitle');
const nextPageButton = document.getElementById('nextPageBtn');
const prevPageButton = document.getElementById('prevPageBtn');
const pageInfoElement = document.getElementById('pageInfo');
const promptsData = {
"lighting": [
{ "text": "Cinematic lighting", "translation": "نورپردازی سینمایی" },
{ "text": "Soft lighting", "translation": "نورپردازی نرم" },
{ "text": "Softbox lighting", "translation": "نورپردازی با سافتباکس" },
{ "text": "Bright lighting", "translation": "نورپردازی روشن" },
{ "text": "Ambient lighting", "translation": "نورپردازی محیطی" },
{ "text": "Silhouetted", "translation": "سایهدار" },
{ "text": "Flat lighting", "translation": "نورپردازی تخت" },
{ "text": "Backlit Volumetric lighting", "translation": "نورپردازی حجمی پسزمینه" }
],
"special_lighting": [
{ "text": "Neon", "translation": "نئون" },
{ "text": "Holographic", "translation": "هولوگرافیک" },
{ "text": "Glow", "translation": "تابان" },
{ "text": "Bioluminescent", "translation": "زیستتاب" },
{ "text": "Rimlight", "translation": "نور حاشیهای" },
{ "text": "Silhouetted", "translation": "سایهدار" }
],
"details_quality": [
{ "text": "Ultra photoreal", "translation": "فوقالعاده واقعگرایانه" },
{ "text": "Intricate details", "translation": "جزئیات پیچیده" },
{ "text": "Photorealistic", "translation": "فوتورئالیستی" },
{ "text": "Hyper detailed", "translation": "بسیار جزئیاتدار" },
{ "text": "Ultra detailed", "translation": "فوقالعاده جزئیاتدار" },
{ "text": "Extremely detailed", "translation": "بسیار پرجزئیات" },
{ "text": "4K", "translation": "4K" },
{ "text": "8K", "translation": "8K" },
{ "text": "Super resolution", "translation": "وضوح فوقالعاده" },
{ "text": "High resolution", "translation": "وضوح بالا" }
],
"punk": [
{ "text": "Steampunk", "translation": "استیمپانک" },
{ "text": "Cloudpunk", "translation": "کلودپانک" },
{ "text": "Cyberpunk", "translation": "سایبرپانک" },
{ "text": "Forestpunk", "translation": "فورستپانک" },
{ "text": "Decopunk", "translation": "دکوپانک" },
{ "text": "Atompunk", "translation": "اتمپانک" },
{ "text": "Dieselpunk", "translation": "دیزلپانک" },
{ "text": "Biopunk", "translation": "بیوپانک" },
{ "text": "Dinopunk", "translation": "دینوپانک" },
{ "text": "Cassettepunk", "translation": "کاستپانک" },
{ "text": "Dollupunk", "translation": "دالاپانک" },
{ "text": "Catholicpunk", "translation": "کاتولیکپانک" },
{ "text": "Clockpunk", "translation": "کلاکپانک" }
],
"landscape": [
{ "text": "Surreal landscape", "translation": "منظره سورئال" },
{ "text": "Unreal landscape", "translation": "منظره غیرواقعی" },
{ "text": "Fantasy landscape", "translation": "منظره فانتزی" },
{ "text": "Sci-fi landscape", "translation": "منظره علمی-تخیلی" },
{ "text": "Desert landscape", "translation": "منظره بیابانی" },
{ "text": "Tropical paradise", "translation": "بهشت گرمسیری" },
{ "text": "Rainforest scenery", "translation": "منظره جنگل بارانی" },
{ "text": "Expansive mountain range", "translation": "زنجیره کوهستانی گسترده" }
],
"colors": [
{ "text": "Retro colors", "translation": "رنگهای رترو" },
{ "text": "Vivid colors", "translation": "رنگهای زنده" },
{ "text": "Pastel colors", "translation": "رنگهای پاستلی" },
{ "text": "Neon colors", "translation": "رنگهای نئونی" },
{ "text": "Earthy tones", "translation": "رنگهای خاکی" },
{ "text": "Primary colors", "translation": "رنگهای اصلی" },
{ "text": "Monochromatic colors", "translation": "رنگهای تکرنگ" },
{ "text": "Jewel tones", "translation": "رنگهای جواهری" }
],
"artist_style": [
{ "text": "Leonardo da Vinci", "translation": "لئوناردو داوینچی" },
{ "text": "Michelangelo", "translation": "میکلآنجلو" },
{ "text": "Rembrandt", "translation": "رمبراندت" },
{ "text": "Vermeer", "translation": "ورمیر" },
{ "text": "Jean-Antoine Watteau", "translation": "ژان-آنتوان واتو" },
{ "text": "Eugene Delacroix", "translation": "اوژن دلاکروا" },
{ "text": "Claude Monet", "translation": "کلود مونه" },
{ "text": "Georges Seurat", "translation": "ژرژ سورا" },
{ "text": "Vincent van Gogh", "translation": "ونسان ون گوگ" },
{ "text": "Edvard Munch", "translation": "ادوارد مونک" },
{ "text": "Gustav Klimt", "translation": "گوستاو کلیمت" },
{ "text": "Pablo Picasso", "translation": "پابلو پیکاسو" },
{ "text": "Henri Matisse", "translation": "هانری ماتیس" },
{ "text": "Rene Magritte", "translation": "رنه ماگریت" },
{ "text": "Georgia O'Keeffe", "translation": "جورجیا اوکیف" },
{ "text": "Salvador Dalí", "translation": "سالوادور دالی" },
{ "text": "Edward Hopper", "translation": "ادوارد هاپر" },
{ "text": "Frida Kahlo", "translation": "فریدا کالو" },
{ "text": "Jackson Pollock", "translation": "جکسون پولاک" },
{ "text": "Andy Warhol", "translation": "اندی وارهول" }
],
"iranian_art_identity": [
{ "text": "Persian Carpet Weaving", "translation": "قالیبافی ایرانی" },
{ "text": "Persian Tilework", "translation": "کاشیکاری ایرانی" },
{ "text": "Persian Miniature Painting", "translation": "نگارگری ایرانی" },
{ "text": "Persian Calligraphy", "translation": "خوشنویسی ایرانی" },
{ "text": "Traditional Textiles", "translation": "منسوجات سنتی" },
{ "text": "Woodcarving", "translation": "منبتکاری" },
{ "text": "Persian Embroidery", "translation": "گلدوزی ایرانی" },
{ "text": "Persian Mirrorwork", "translation": "آینهکاری ایرانی" },
{ "text": "Termeh Weaving", "translation": "بافت ترمه" },
{ "text": "Persian Jewelry", "translation": "جواهرسازی ایرانی" }
],
"iranian_set_design": [
{ "text": "Tehran clothe", "translation": "لباس تهرانی" },
{ "text": "Tehran woman", "translation": "زن تهرانی" },
{ "text": "Tehran man", "translation": "مرد تهرانی" },
{ "text": "Modern Persian vibe", "translation": "حس و حال مدرن پارسی" },
{ "text": "Persian art", "translation": "هنر پارسی" },
{ "text": "Tehran atmosphere", "translation": "فضای تهران" },
{ "text": "Esfahan vibe", "translation": "حس و حال اصفهان" },
{ "text": "Qajar art", "translation": "هنر قاجار" },
{ "text": "Princess Qajar", "translation": "شاهزاده قاجار" },
{ "text": "Persian empire", "translation": "امپراتوری پارس" }
]
};
let currentCategory = '';
let currentPage = 1;
const pageSize = 5;
// باز کردن لیست پرامپت بر اساس دستهبندی با صفحهبندی
document.querySelectorAll('.prompt-category').forEach(category => {
category.addEventListener('click', function() {
currentCategory = this.getAttribute('data-category');
const prompts = promptsData[currentCategory];
if (prompts) {
currentPage = 1;
renderPrompts(prompts, currentPage, pageSize);
promptListTitle.innerText = this.innerText;
promptModal.style.display = 'none';
promptListModal.style.display = 'block';
}
});
});
// تعریف یک تابع برای رندر کردن پرامپتها با صفحهبندی
function renderPrompts(prompts, page, size) {
promptList.innerHTML = '';
const start = (page - 1) * size;
const end = start + size;
const paginatedPrompts = prompts.slice(start, end);
paginatedPrompts.forEach(prompt => {
const promptElement = document.createElement('div');
promptElement.classList.add('prompt-item');
promptElement.innerHTML = `
<div class="prompt-text-container">
<div class="prompt-text">${prompt.text}</div>
<div class="persian-translation">${prompt.translation}</div>
</div>
<div class="copy-icon" title="کپی">
<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="#555">
<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2z"/>
<path d="M10 12h4v4h-4z"/>
</svg>
</div>
`;
// اضافه کردن قابلیت کپی کردن با کلیک بر روی متن
promptElement.querySelector('.prompt-text').addEventListener('click', function() {
copyText(prompt.text);
});
// اضافه کردن قابلیت کپی کردن با کلیک بر روی آیکون
promptElement.querySelector('.copy-icon').addEventListener('click', function() {
copyText(prompt.text);
});
promptList.appendChild(promptElement);
});
// محاسبه تعداد کل صفحات
const totalPages = Math.ceil(prompts.length / size);
// نمایش اطلاعات صفحه
if (totalPages > 1) {
pageInfo.style.display = 'block';
pageInfo.innerText = `صفحه ${page} از ${totalPages}`;
} else {
pageInfo.style.display = 'none';
}
// مدیریت نمایش دکمههای صفحهبندی
if (page > 1) {
prevPageBtn.style.display = 'inline-block';
} else {
prevPageBtn.style.display = 'none';
}
if (page < totalPages) {
nextPageBtn.style.display = 'inline-block';
} else {
nextPageBtn.style.display = 'none';
}
}
// تعریف یک گوشدهنده رویداد برای دکمه "ادامه صفحه بعدی"
nextPageBtn.addEventListener('click', function() {
const prompts = promptsData[currentCategory];
const totalPages = Math.ceil(prompts.length / pageSize);
if (currentPage < totalPages) {
currentPage++;
renderPrompts(prompts, currentPage, pageSize);
}
});
// تعریف یک گوشدهنده رویداد برای دکمه "بازگشت به صفحه قبلی"
prevPageBtn.addEventListener('click', function() {
if (currentPage > 1) {
currentPage--;
const prompts = promptsData[currentCategory];
renderPrompts(prompts, currentPage, pageSize);
}
});
// تابع کپی کردن متن
function copyText(text) {
navigator.clipboard.writeText(text).then(() => {
alert("متن با موفقیت کپی شد: " + text);
}).catch(err => {
console.error("خطا در کپی کردن متن: ", err);
alert("خطایی در کپی کردن متن رخ داد.");
});
}
// بستن مودال لیست پرامپتها از طریق کلیک خارج از مودال
document.getElementById('closePromptListBtnTop').addEventListener('click', function() {
promptListModal.style.display = 'none';
});
// افزودن رویداد برای دکمه پرامپت
document.getElementById('promptButton').addEventListener('click', function(event) {
event.preventDefault();
promptModal.style.display = 'block';
});
loadIframe();
startProgress();
</script>
</p>
توضیحات تغییرات:
-
اضافه کردن دکمه "P" (پرامپت):
-
مدال پرامپتها:
- مدال مربوط به پرامپتها (
myPromptModal) و لیست پرامپتها (promptListModal) اضافه شدهاند تا کاربران بتوانند دستهبندیهای مختلف پرامپتها را مشاهده و از آنها استفاده کنند.
-
استایلها:
- استایلهای مربوط به پرامپتها، مدالها، و دکمهها گنجانده شدهاند تا طراحی یکپارچه و متناسب داشته باشد.
-
اسکریپتها:
- توابع مربوط به مدیریت پرامپتها شامل باز کردن مدالهای مختلف، رندر کردن پرامپتها با صفحهبندی، و کپی کردن متن به کلیپبورد اضافه شدهاند.
- همچنین، مدیریت ادغام با کد اصلی برای دانلود تصاویر و سایر امکانات حفظ شده است.
-
مدال تصاویر دانلود شده:
- یک مدال جدید (
myModalImages) برای نمایش تصاویر شناسایی شده و امکان دانلود آنها اضافه شده است.
-
رابط کاربری و دسترسی:
- دکمهها به گونهای طراحی شدهاند که به راحتی قابل دسترسی و استفاده باشند.
- قابلیت پاسخگویی به صفحات کوچک با استفاده از مدیا کوئریها تضمین شده است.
نحوه استفاده:
- دانلود تصویر: با کلیک بر روی دکمههای "دانلود تصویر 📥" تصاویر موجود در iframe بارگیری میشوند.
- توضیحات: با کلیک بر روی دکمه "توضیحات"، یک مدال باز میشود که توضیحات مربوط به استفاده از ربات و نکات لازم را نمایش میدهد.
- پرامپتها: با کلیک بر روی دکمه "P"، مدال دستهبندی پرامپتها باز میشود. با انتخاب هر دستهبندی، لیست پرامپتهای مربوطه نمایش داده شده و کاربران میتوانند آنها را کپی کنند.
نکات نهایی:
- تغییر URL: مطمئن شوید که متغیر
siteURL به درستی به URL مورد نظر شما اشاره میکند.
- فیلترشکن: در صورت بروز مشکلات در بارگیری iframe، به مشورت قبلی دربارهی فعالسازی فیلترشکن مراجعه کنید.
- استایلها و قابلیت پاسخگویی: استایلها به گونهای تنظیم شدهاند که در دستگاههای مختلف به خوبی نمایش داده شوند. با تغییرات لازم میتوانید آنها را بیشتر سفارشیسازی کنید.
امیدوارم این اصلاحات به شما کمک کند تا وبسایت یا پروژهی خود را بهینهتر و کاربرپسندتر کنید. در صورت نیاز به هرگونه تغییرات بیشتر، خوشحال میشوم کمک کنم!