Quellcode durchsuchen

Fixed activeTab problem.

deadtom vor 1 Monat
Ursprung
Commit
70778483dd
2 geänderte Dateien mit 21 neuen und 49 gelöschten Zeilen
  1. 3 44
      ownchatbot/templates/userpanel.html
  2. 18 5
      ownchatbot/templates/userqueue.html

+ 3 - 44
ownchatbot/templates/userpanel.html

@@ -9,9 +9,9 @@
     
     <div class="navbar">
         <div class="tab">
-            <button class="tablinks" data-tab="ocbinfo" onclick="openTab(event, 'ocbinfo')">OwnchatBot Info</button>
-            <button class="tablinks" data-tab="rewards" onclick="openTab(event, 'rewards')">Points and Rewards</button>
-            <button class="tablinks" onclick="window.location.href='{{ url_for('web_panels.user_queue') }}'">Rewards Queue</button>
+            <button tabindex="0" class="tablinks" data-tab="ocbinfo" onclick="openTab(event, 'ocbinfo')">OwnchatBot Info</button>
+            <button tabindex="1" class="tablinks" data-tab="rewards" onclick="openTab(event, 'rewards')">Points and Rewards</button>
+            <button tabindex="2" class="tablinks" data-tab="queue" onclick="window.location.href='{{ url_for('web_panels.user_queue', activeTab='queue') }}'">Rewards Queue</button>
         </div>
         <img alt="Ownchat Bot logo, whimsical robot" src="/static/img/ownchatbotwide.png">
     </div>
@@ -275,45 +275,4 @@
         </body>
     </div>
 
-    <div id='queue' class="tabcontent">
-
-        <body>
-            <h3>Queue</h3>
-            {% if queue %}
-            <table>
-                <thead>
-                    <tr>
-                        <th>Time</th>
-                        <th>Name</th>
-                        <th>Description</th>
-                        <th>User</th>
-                        <th></th>
-                    </tr>
-                </thead>
-                <tbody>
-                {% for row in queue %}
-                <tr>
-                    <td>{{ row[1].replace(tzinfo=utc_timezone).astimezone().strftime("%H:%M") }}</td>
-                    {% if row[4] %}
-                        <td><s>{{ prefix }}{{ row[2] }}</s></td>
-                    {% else %}
-                        <td>{{ prefix }}{{ row[2] }}</td>
-                    {% endif %}
-                    <td>{{ all_rewards[row[2]]["info"] }}</td>
-                    {% if row[6] %}
-                    <td>{{ row[6] }}</td>
-                    {% else %}
-                    <td></td>
-                    {% endif %}
-                </tr>
-                {% endfor %}
-                </tbody>
-            </table>
-            {% else %}
-            &nbsp;&nbsp;The queue is currently empty
-            {% endif %}
-        </body>
-        <br><br>
-    </div>
-
 </html>

+ 18 - 5
ownchatbot/templates/userqueue.html

@@ -5,18 +5,17 @@
     <link rel="icon" type="image/x-icon" href="/static/img/favicon.ico">
     <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
 </head>
-    <script src="/static/viewerpanel.js"></script>
     
     <div class="navbar">
         <div class="tab">
-            <button class="tablinks" onclick="window.location.href='{{ url_for('web_panels.user_panel', instance=instance, username=username, activeTab='ocbinfo') }}'">OwnchatBot Info</button>
-            <button class="tablinks" onclick="window.location.href='{{ url_for('web_panels.user_panel', instance=instance, username=username, activeTab='rewards') }}'">Points and Rewards</button>
-            <button class="tablinks" onclick="window.location.href='{{ url_for('web_panels.user_queue') }}'">Rewards Queue</button>
+            <button tabindex="0" class="tablinks" data-tab="ocbinfo" onclick="setActiveTabAndNavigate('ocbinfo', '{{ url_for('web_panels.user_panel', instance=instance, username=username) }}')">OwnchatBot Info</button>
+            <button tabindex="1" class="tablinks" data-tab="rewards" onclick="setActiveTabAndNavigate('rewards', '{{ url_for('web_panels.user_panel', instance=instance, username=username) }}')">Points and Rewards</button>
+            <button tabindex="2" style="background-color: #003399; color: white;" class="tablinks" data-tab="queue" onclick="window.location.href='{{ url_for('web_panels.user_queue', activeTab='queue') }}'">Rewards Queue</button>
         </div>
         <img alt="Ownchat Bot logo, whimsical robot" src="/static/img/ownchatbotwide.png">
     </div>
 
-    <div class="queuecontent">
+    <div id="queue" class="queuecontent">
 
         <body>
             <h3>Queue</h3>
@@ -58,6 +57,20 @@
     </div>
     
     <script>
+        window.onload = function() {
+            var activeTab = 'queue';
+            localStorage.setItem('activeTab', activeTab);
+        }
+        
+        function setActiveTabAndNavigate(tabName, url) {
+            localStorage.setItem('activeTab', tabName);
+            window.location.href = url;
+        }
+
+        function refreshPage() {
+            window.location.reload();
+        }
+    
         setTimeout(refreshPage, 30 * 1000);
     </script>