پرش به محتوا

الگو:کادر-شمارنده: تفاوت میان نسخه‌ها

از ویکی امام رضا علیه السلام
صفحه‌ای تازه حاوی «<!DOCTYPE html> <html lang="fa" dir="rtl"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>الگو:شمارشی</title> <style> body { font-family: 'Vazir', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f8f9fa; color: #222; line-height: 1.6; padding: 20px; max...» ایجاد کرد
برچسب: ویرایش مبدأ ۲۰۱۷
 
جزبدون خلاصۀ ویرایش
برچسب: ویرایش مبدأ ۲۰۱۷
 
(۴۰ نسخهٔ میانیِ ایجادشده توسط همین کاربر نشان داده نشد)
خط ۱: خط ۱:
<!DOCTYPE html>
<includeonly>
<html lang="fa" dir="rtl">
<div class="counter-box" style="display:inline-block; vertical-align:top; margin:4px; width:130px; border:0px solid #ccc; padding:0em !important; border-radius: 8px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); text-align:center; border-radius:0px; font-family:Gandom; background-color:{{{bgcolor|#f9f9f9}}}; box-sizing:border-box;">
<head>
  <div style="margin-bottom:0px;">
    <meta charset="UTF-8">
    [[پرونده:{{{icon|Icon-book.png}}}|{{{iconsize|60px}}}|link=|class=noviewer]]
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  </div>
    <title>الگو:شمارشی</title>
  <div style="font-weight:bold; font-size:16px; margin-bottom:0px;">
    <style>
    {{{title|عنوان پیش‌فرض}}}
        body {
  </div>
            font-family: 'Vazir', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  <div class="animated-counter"
            background-color: #f8f9fa;
      data-start="{{{start|1}}}"
            color: #222;
      data-end="{{{end|100}}}"
            line-height: 1.6;
      data-speed="{{{speed|30}}}"
            padding: 20px;
      style="font-size:16px; color:#333;">
            max-width: 1200px;
    {{{start|1}}}
            margin: 0 auto;
   </div>
        }
</div>
       
</includeonly>
        .template-container {
<noinclude>
            background-color: #fff;
'''نحوه استفاده:'''
            border: 1px solid #a2a9b1;
<pre>
            border-radius: 5px;
{{کادر-شمارنده
            padding: 20px;
| icon     = Icon-book.png
            margin: 20px 0;
| iconsize = 70px
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
| title    = کتاب‌ها
        }
| start    = 1
       
| end      = 232
        .template-title {
| speed    = 30
            font-size: 1.8em;
| bgcolor  = #fffbe6
            border-bottom: 1px solid #a2a9b1;
}}
            padding-bottom: 10px;
</pre>
            margin-bottom: 20px;
</noinclude>
            color: #0645ad;
        }
       
        .template-info {
            background-color: #f8f9fa;
            border: 1px solid #eaecf0;
            padding: 15px;
            margin: 15px 0;
            border-radius: 3px;
            font-size: 0.95em;
        }
       
        .template-usage {
            background-color: #eaf3ff;
            border: 1px dashed #36c;
            padding: 15px;
            margin: 15px 0;
            border-radius: 3px;
            font-family: monospace;
            white-space: pre-wrap;
        }
       
        .counter-box {
            width: 200px;
            height: 200px;
            border: 2px solid #3498db;
            border-radius: 10px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            font-family: Arial, sans-serif;
            background: #f8f9fa;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
            margin: 20px auto;
        }
       
        .counter-icon {
            font-size: 48px;
            color: #3498db;
        }
       
        .counter-title {
            font-size: 18px;
            margin: 10px 0;
            color: #2c3e50;
        }
       
        .counter-number {
            font-size: 24px;
            font-weight: bold;
            color: #e74c3c;
            margin-top: 5px;
        }
       
        .documentation {
            margin-top: 30px;
        }
       
        .documentation h3 {
            color: #54595d;
            border-bottom: 1px solid #eaecf0;
            padding-bottom: 5px;
        }
       
        .parameters {
            width: 100%;
            border-collapse: collapse;
            margin: 15px 0;
        }
       
        .parameters th, .parameters td {
            border: 1px solid #a2a9b1;
            padding: 8px 12px;
            text-align: right;
        }
       
        .parameters th {
            background-color: #eaecf0;
        }
       
        .code-example {
            background-color: #f8f9fa;
            border: 1px solid #eaecf0;
            padding: 15px;
            border-radius: 3px;
            font-family: monospace;
            direction: ltr;
            text-align: left;
            overflow-x: auto;
        }
       
        .try-button {
            display: inline-block;
            background-color: #3366cc;
            color: white;
            padding: 10px 15px;
            border-radius: 4px;
            text-decoration: none;
            margin: 10px 0;
            cursor: pointer;
        }
       
        .try-button:hover {
            background-color: #447ff5;
        }
    </style>
</head>
<body>
    <div class="template-container">
        <h1 class="template-title">الگو:شمارشی</h1>
       
        <div class="template-info">
            این الگو برای نمایش یک کادر با آیکون، عنوان و شمارنده استفاده می‌شود.
        </div>
       
        <div class="counter-box">
            <div class="counter-icon">📚</div>
            <div class="counter-title">کتاب خانه</div>
            <div id="counter" class="counter-number">1</div>
        </div>
       
        <div class="template-usage">{{شمارشی
  | عنوان    = کتاب خانه
  | آیکون    = 📚
  | شروع    = 1
  | پایان    = 199
  | سرعت    = 100
}}</div>
       
        <div class="documentation">
            <h3>پارامترها</h3>
           
            <table class="parameters">
                <tr>
                    <th>پارامتر</th>
                    <th>توضیح</th>
                    <th>پیش‌فرض</th>
                    <th>ضروری</th>
                </tr>
                <tr>
                    <td>عنوان</td>
                    <td>متنی که زیر آیکون نمایش داده می‌شود</td>
                    <td>کتاب خانه</td>
                    <td>خیر</td>
                </tr>
                <tr>
                    <td>آیکون</td>
                    <td>آیکون یا ایموجی که نمایش داده می‌شود</td>
                    <td>📚</td>
                    <td>خیر</td>
                </tr>
                <tr>
                    <td>شروع</td>
                    <td>عدد شروع شمارنده</td>
                    <td>1</td>
                    <td>خیر</td>
                </tr>
                <tr>
                    <td>پایان</td>
                    <td>عدد پایان شمارنده</td>
                    <td>199</td>
                    <td>خیر</td>
                </tr>
                <tr>
                    <td>سرعت</td>
                    <td>سرعت شمارش به میلی‌ثانیه (اعداد کمتر = سرعت بیشتر)</td>
                    <td>100</td>
                    <td>خیر</td>
                </tr>
            </table>
           
            <h3>نمونه استفاده</h3>
           
            <div class="code-example">
&lt;div class="counter-box"&gt;<br>
   &lt;div class="counter-icon"&gt;📚&lt;/div&gt;<br>
  &lt;div class="counter-title"&gt;کتاب خانه&lt;/div&gt;<br>
  &lt;div id="counter" class="counter-number"&gt;1&lt;/div&gt;<br>
&lt;/div&gt;<br>
<br>
&lt;script&gt;<br>
  let count = 1;<br>
  const counterElement = document.getElementById('counter');<br>
  const interval = setInterval(() => {<br>
     count++;<br>
    counterElement.textContent = count;<br>
    if(count >= 199) clearInterval(interval);<br>
  }, 100);<br>
&lt;/script&gt;
            </div>
           
            <a class="try-button" onclick="startCounter()">اجرای شمارنده</a>
        </div>
    </div>
 
    <script>
        function startCounter() {
            let count = 1;
            const counterElement = document.getElementById('counter');
            const interval = setInterval(() => {
                count++;
                counterElement.textContent = count;
                if(count >= 199) clearInterval(interval);
            }, 100);
        }
       
        // شروع خودکار شمارنده هنگام بارگذاری صفحه
        window.onload = startCounter;
    </script>
</body>
</html>

نسخهٔ کنونی تا ‏۷ سپتامبر ۲۰۲۵، ساعت ۱۳:۲۳


نحوه استفاده:

{{کادر-شمارنده
 | icon     = Icon-book.png
 | iconsize = 70px
 | title    = کتاب‌ها
 | start    = 1
 | end      = 232
 | speed    = 30
 | bgcolor  = #fffbe6
}}