بستن توضیحات document.addEventListener("DOMContentLoaded", function () { let fullText = ``; // متن کامل توضیحات let maxLength = 500; // حداکثر مقدار برای نمایش خلاصه let shortLength = 500; // حداقل مقدار برای نمایش خلاصه let shortDescription = ""; // حذف تمام تگهای HTML و استایلها let textWithoutHtml = fullText.replace(/ ]*>/g, '').trim(); // حذف تمام تگهای HTML از متن if (textWithoutHtml.length > maxLength)… ادامهی معرفی
ارسال به همهی ایرانتحویل دوشنبه ۱۶ آذر تا شنبه ۲۱ آذر
نو، از خود ناشربا قیمت پشت جلد امروز
۱۴ روز فرصت مرجوعیآسیبدیده یا بدچاپ؟ پس بده
۱۹۳٬۳۱۲ عنوان کتاباز ۲٬۲۴۶ ناشر، قیمت هر روز
معرفی کتاب
بستن توضیحات document.addEventListener("DOMContentLoaded", function () { let fullText = ``; // متن کامل توضیحات let maxLength = 500; // حداکثر مقدار برای نمایش خلاصه let shortLength = 500; // حداقل مقدار برای نمایش خلاصه let shortDescription = ""; // حذف تمام تگهای HTML و استایلها let textWithoutHtml = fullText.replace(/ ]*>/g, '').trim(); // حذف تمام تگهای HTML از متن if (textWithoutHtml.length > maxLength) { let cutoffIndex = shortLength; let extraText = textWithoutHtml.slice(shortLength, maxLength); let match = extraText.match(/[\.\،]/); // جستجوی نقطه یا ویرگول در متن اضافی if (match) { cutoffIndex += match.index + 1; } else { cutoffIndex = maxLength; // اگر پیدا نشد، متن را تا 1000 کاراکتر نشان بده } shortDescription = textWithoutHtml.slice(0, cutoffIndex) + '... ادامه مطلب '; } else { shortDescription = textWithoutHtml; // اگر کمتر از 1000 کاراکتر بود، همه متن را نمایش بده } document.getElementById("short-description").innerHTML = shortDescription; // استفاده از setTimeout برای اضافه کردن event listener بعد از بارگذاری کامل setTimeout(function() { const showMoreButton = document.getElementById("show-more"); const closeButton = document.getElementById("close-description"); if (showMoreButton) { showMoreButton.addEventListener("click", function (e) { e.preventDefault(); // جلوگیری از حرکت صفحه showFullDescription(); }); } if (closeButton) { closeButton.addEventListener("click", function () { hideFullDescription(); }); } }, 100); // مدت زمان کوتاهی برای اطمینان از بارگذاری کامل }); function showFullDescription() { document.getElementById('short-description').style.display = 'none'; document.getElementById('full-description').style.display = 'block'; // به روز رسانی ویژگیهای ARIA document.getElementById('show-more').setAttribute('aria-expanded', 'true'); document.getElementById('full-description').setAttribute('aria-hidden', 'false'); } function hideFullDescription() { document.getElementById('full-description').style.display = 'none'; document.getElementById('short-description').style.display = 'block'; // به روز رسانی ویژگیهای ARIA document.getElementById('show-more').setAttribute('aria-expanded', 'false'); document.getElementById('full-description').setAttribute('aria-hidden', 'true'); // اسکرول به ابتدای توضیحات document.getElementById('end-of-details').scrollIntoView({ behavior: 'smooth' }); } سایز و مدل: رقعی شومیز تعداد صفحه: 128 شابک: 9789648049275 زبان: فارسی
مشخصات کتاب
دستهبندی
مدیریت
شناسه کالا
kj-434359
شابک
۹۷۸۹۶۴۸۰۴۹۲۷۵
تعداد صفحه
۱۲۸
قطع
رقعی شومیز
زبان
فارسی
دیدگاه خوانندهها
هنوز کسی امتیاز ندادهاولین نفری باش که میگه این کتاب چطور بود.
بستن توضیحات document.addEventListener("DOMContentLoaded", function () { let fullText = ``; // متن کامل توضیحات let maxLength = 500; // حداکثر مقدار برای نمایش خلاصه let shortLength = 500; // حداقل مقدار برای نمایش خلاصه let shortDescription = ""; // حذف تمام تگهای HTML و استایلها let textWithoutHtml = fullText.replace(/ ]*>/g, '').trim(); // حذف تمام تگهای HTML از متن if (textWithoutHtml.length > maxLength) { let cutoffIndex = shortLength; let extraText = textWithoutHtml.slice(shortLength, maxLength); let match = extraText.match(/[\.\،]/); // جستجوی نقطه یا ویرگول در متن اضافی if (match) { cutoffIndex += match.index + 1; } else { cutoffIndex = maxLength; // اگر پیدا نشد، متن را تا 1000 کاراکتر نشان بده } shortDescription = textWithoutHtml.slice(0, cutoffIndex) + '... ادامه مطلب '; } else { shortDescription = textWithoutHtml; // اگر کمتر از 1000 کاراکتر بود، همه متن را نمایش بده } document.getElementById("short-description").innerHTML = shortDescription; // استفاده از setTimeout برای اضافه کردن event listener بعد از بارگذاری کامل setTimeout(function() { const showMoreButton = document.getElementById("show-more"); const closeButton = document.getElementById("close-description"); if (showMoreButton) { showMoreButton.addEventListener("click", function (e) { e.preventDefault(); // جلوگیری از حرکت صفحه showFullDescription(); }); } if (closeButton) { closeButton.addEventListener("click", function () { hideFullDescription(); }); } }, 100); // مدت زمان کوتاهی برای اطمینان از بارگذاری کامل }); function showFullDescription() { document.getElementById('short-description').style.display = 'none'; document.getElementById('full-description').style.display = 'block'; // به روز رسانی ویژگیهای ARIA document.getElementById('show-more').setAttribute('aria-expanded', 'true'); document.getElementById('full-description').setAttribute('aria-hidden', 'false'); } function hideFullDescription() { document.getElementById('full-description').style.display = 'none'; document.getElementById('short-description').style.display = 'block'; // به روز رسانی ویژگیهای ARIA document.getElementById('show-more').setAttribute('aria-expanded', 'false'); document.getElementById('full-description').setAttribute('aria-hidden', 'true'); // اسکرول به ابتدای توضیحات document.getElementById('end-of-details').scrollIntoView({ behavior: 'smooth' }); } سایز و مدل: رقعی شومیز تعداد صفحه: 128 شابک: 9789648049275 زبان: فارسی