پرش به محتوا

الگو:ShowDates: تفاوت میان نسخه‌ها

از صبح نجف
جزبدون خلاصۀ ویرایش
برچسب: ویرایش مبدأ ۲۰۱۷
جزبدون خلاصۀ ویرایش
برچسب: ویرایش مبدأ ۲۰۱۷
 
(۳۲ نسخهٔ میانیِ ایجادشده توسط همین کاربر نشان داده نشد)
خط ۱: خط ۱:
<div style="direction: rtl; display: flex; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 0; background: linear-gradient(135deg, #f8fafc, #e2e8f0); border-radius: 24px; padding: 8px 20px; margin: 8px; font-family: system-ui, Tahoma, sans-serif; box-shadow: 0 4px 12px rgba(0,0,0,0.05);">
<div style="direction: rtl; display: flex; flex-wrap: wrap;justify-content: center; line-height: 1px !important; align-items: center; gap: 1px; background: #fff0fd; border-radius: 20px; margin: 8px; padding: 2px; font-family: system-ui, Tahoma, sans-serif;">
     <div style="font-size: 14px; color: #1e293b; white-space: nowrap; padding: 0 12px; font-weight: 500;" id="shamsiDate">بارگذاری...</div>
   
     <div style="width: 1px; height: 20px; background: linear-gradient(to bottom, #cbd5e1, #94a3b8, #cbd5e1);"></div>
    <!-- تاریخ شمسی -->
     <div style="font-size: 14px; color: #1e293b; white-space: nowrap; padding: 0 12px; font-family: 'Amiri', 'Tahoma', sans-serif;" id="qamariDate">بارگذاری...</div>
     <div style="font-size: 14px; line-height: 1px !important; color: #0f172a; white-space: nowrap; padding: 0 8px; font-weight: 500;">
سه شنبه - ۱۵ اردیبهشت ۱۴۰۵
    </div>
   
 
 
    <!-- روزشمار غدیر - وسط و قرمز پررنگ با تگ span و !important -->
     <div style="white-space: nowrap; padding: 0 8px;">
        <span style="font-size: 17px;line-height: 1px !important; color: #ff6921 !important; font-weight: 700; background: none; border: none;">
  🏴 ۳۰ روز تا غدیر (۱۸ ذی‌الحجه)
        </span>
    </div>
   
 
 
    <!-- تاریخ قمری -->
     <div style="font-size: 14px;line-height: 1px !important; color: #0f172a; white-space: nowrap; padding: 0 8px;">
الثلاثاء - ۱۷ ذی‌القعده ۱۴۴۷
    </div>
   
</div>
</div>
<script>
(function(){
function toPersianDigits(num){return num.toString().replace(/\d/g,d=>'۰۱۲۳۴۵۶۷۸۹'[parseInt(d)]);}
function toArabicDigits(num){return num.toString().replace(/\d/g,d=>'٠١٢٣٤٥٦٧٨٩'[parseInt(d)]);}
function jd(gy,gm,gd){let a=Math.floor((14-gm)/12),y=gy+4800-a,m=gm+12*a-3;return gd+Math.floor((153*m+2)/5)+365*y+Math.floor(y/4)-Math.floor(y/100)+Math.floor(y/400)-32045;}
function gregToJalali(gy,gm,gd){let days=[31,31,31,31,31,31,30,30,30,30,30,29],j=jd(gy,gm,gd),depoch=j-jd(1948,3,21),cycle=Math.floor(depoch/1029983),cyear=depoch%1029983,y=0;if(cyear===1029982)y=2820;else{let a=Math.floor(cyear/366),b=cyear%366;y=a;for(let i=0;i<=100;i++){let aux=((i+1)%4===0&&(i+1)!==0)?31:30;if(b>=aux){b-=aux;y++;}else break;}y++;}let year=y+(cycle*2820)+473;let mod=year%33,isLeap=(mod===1||mod===5||mod===9||mod===13||mod===17||mod===22||mod===26||mod===30);if(isLeap)days[11]=30;let remaining=cyear,month=0;for(let i=0;i<12;i++){if(remaining<days[i]){month=i+1;break;}remaining-=days[i];}let day=remaining+1;return{year:year,month:month,day:day};}
function gregToHijri(gy,gm,gd){let j=jd(gy,gm,gd),epoch=1948439.5,daysSince=Math.floor(j-epoch),year=Math.floor(daysSince/354.367),rem=daysSince-(year*354.367),month=1,mdays=[30,29,30,29,30,29,30,29,30,29,30,29];for(let i=0;i<12;i++){if(rem<mdays[i])break;rem-=mdays[i];month++;}let day=Math.floor(rem)+1;return{year:year+1,month:month,day:day};}
let now=new Date(),offset=3.5*60*60*1000,tehran=new Date(now.getTime()+(now.getTimezoneOffset()*60*1000)+offset),gy=tehran.getUTCFullYear(),gm=tehran.getUTCMonth()+1,gd=tehran.getUTCDate();
let sh=gregToJalali(gy,gm,gd),qh=gregToHijri(gy,gm,gd);
let weekdaysFa=['یکشنبه','دوشنبه','سه‌شنبه','چهارشنبه','پنجشنبه','جمعه','شنبه'];
let weekdayEn=new Date(gy,gm-1,gd).getDay();
let weekdayFa=weekdaysFa[weekdayEn];
let shamsiMonths=['فروردین','اردیبهشت','خرداد','تیر','مرداد','شهریور','مهر','آبان','آذر','دی','بهمن','اسفند'];
let qamariMonths=['محرم','صفر','ربیع‌الاول','ربیع‌الثانی','جمادی‌الاول','جمادی‌الثانی','رجب','شعبان','رمضان','شوال','ذوالقعدة','ذوالحجة'];
let shamsiStr=weekdayFa+' - '+toPersianDigits(sh.day)+' '+shamsiMonths[sh.month-1]+' '+toPersianDigits(sh.year);
let arabicWeekdays=['الأحد','الإثنين','الثلاثاء','الأربعاء','الخميس','الجمعة','السبت'];
let weekdayAr=arabicWeekdays[weekdayEn];
let qamariStr=weekdayAr+' - '+toArabicDigits(qh.day)+' '+qamariMonths[qh.month-1]+' '+toArabicDigits(qh.year);
document.getElementById('shamsiDate').innerText=shamsiStr;
document.getElementById('qamariDate').innerText=qamariStr;
})();
</script>

نسخهٔ کنونی تا ‏۱۵ اردیبهشت ۱۴۰۵، ساعت ۰۰:۱۲

سه شنبه - ۱۵ اردیبهشت ۱۴۰۵


       
 🏴 ۳۰ روز تا غدیر (۱۸ ذی‌الحجه)
       


الثلاثاء - ۱۷ ذی‌القعده ۱۴۴۷