Browse Source

Async JS: Load new report form on demand

spaghetti 8 years ago
parent
commit
e64fbd85ff
2 changed files with 6 additions and 3 deletions
  1. 1
    3
      sections/reportsv2/report.php
  2. 5
    0
      static/functions/reportsv2.js

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

@@ -107,7 +107,7 @@ View::show_header('Report', 'reportsv2,browse,torrent,bbcode,recommend');
107 107
         <tr>
108 108
           <td class="label">Reason:</td>
109 109
           <td>
110
-            <select id="type" name="type" onchange="ChangeReportType();">
110
+            <select id="type" name="type" class="change_report_type">
111 111
 <?
112 112
         if (!empty($Types[$CategoryID])) {
113 113
           $TypeList = $Types['master'] + $Types[$CategoryID];
@@ -144,8 +144,6 @@ View::show_header('Report', 'reportsv2,browse,torrent,bbcode,recommend');
144 144
         <input id="track" type="hidden" name="track" size="8" value="<?=(!empty($_POST['track']) ? display_str($_POST['track']) : '')?>" />
145 145
         <input id="link" type="hidden" name="link" size="50" value="<?=(!empty($_POST['link']) ? display_str($_POST['link']) : '')?>" />
146 146
         <input id="extra" type="hidden" name="extra" value="<?=(!empty($_POST['extra']) ? display_str($_POST['extra']) : '')?>" />
147
-
148
-        <script type="text/javascript">ChangeReportType();</script>
149 147
       </div>
150 148
     </div>
151 149
   <input type="submit" value="Submit report" />

+ 5
- 0
static/functions/reportsv2.js View File

@@ -224,3 +224,8 @@ function Switch(reportid, torrentid, otherid) {
224 224
 document.querySelectorAll('[data-load-report]').forEach(function(el) {
225 225
   Load(+el.attributes['data-load-report'].value);
226 226
 })
227
+
228
+if(document.querySelector('.change_report_type')) {
229
+  document.querySelector('.change_report_type').addEventListener('change', ChangeReportType);
230
+  ChangeReportType();
231
+}

Loading…
Cancel
Save