Browse Source

Ensure that report form javascript twiggers after page finishes loading

spaghetti 8 years ago
parent
commit
ccbd8c1fa6
2 changed files with 11 additions and 4 deletions
  1. 2
    1
      sections/reportsv2/report.php
  2. 9
    3
      static/functions/reportsv2.js

+ 2
- 1
sections/reportsv2/report.php View File

@@ -88,7 +88,8 @@ View::show_header('Report', 'reportsv2,browse,torrent,bbcode,recommend');
88 88
         </td>
89 89
       </tr>
90 90
       <?
91
-      build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $GroupName, $GroupCategoryID, $TorrentList, $Types, $Username);
91
+      $LangName = $GroupName ? $GroupName : ($GroupNameRJ ? $GroupNameRJ : $GroupNameJP);
92
+      build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $LangName, $GroupCategoryID, $TorrentList, $Types, $Username);
92 93
       ?>
93 94
     </table>
94 95
   </div>

+ 9
- 3
static/functions/reportsv2.js View File

@@ -225,7 +225,13 @@ document.querySelectorAll('[data-load-report]').forEach(function(el) {
225 225
   Load(+el.attributes['data-load-report'].value);
226 226
 })
227 227
 
228
-if(document.querySelector('.change_report_type')) {
229
-  document.querySelector('.change_report_type').addEventListener('change', ChangeReportType);
230
-  ChangeReportType();
228
+var ReportSelectorInited = false;
229
+function ReportSelectorInit() {
230
+  if (!ReportSelectorInited && document.querySelector('.change_report_type')) {
231
+    document.querySelector('.change_report_type').addEventListener('change', ChangeReportType);
232
+    ChangeReportType();
233
+  }
231 234
 }
235
+
236
+document.addEventListener("DOMContentLoaded", ReportSelectorInit);
237
+ReportSelectorInit();

Loading…
Cancel
Save