Browse Source

Async JS: Load reports on demand

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

+ 2
- 6
sections/reportsv2/static.php View File

307
         WHERE ID = $ReportID");
307
         WHERE ID = $ReportID");
308
       $Cache->decrement('num_torrent_reportsv2');
308
       $Cache->decrement('num_torrent_reportsv2');
309
 ?>
309
 ?>
310
-  <div id="report<?=$ReportID?>" class="report box pad center">
310
+  <div id="report<?=$ReportID?>" class="report box pad center" data-load-report="<?=$ReportID?>">
311
     <a href="reportsv2.php?view=report&amp;id=<?=$ReportID?>">Report <?=$ReportID?></a> for torrent <?=$TorrentID?> (deleted) has been automatically resolved. <input type="button" value="Hide" onclick="ClearReport(<?=$ReportID?>);" />
311
     <a href="reportsv2.php?view=report&amp;id=<?=$ReportID?>">Report <?=$ReportID?></a> for torrent <?=$TorrentID?> (deleted) has been automatically resolved. <input type="button" value="Hide" onclick="ClearReport(<?=$ReportID?>);" />
312
   </div>
312
   </div>
313
 <?
313
 <?
349
         $BBName = "[url=artist.php?id=$ArtistID]".$ArtistName."[/url] - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Media][/url] ".' ('.number_format($Size / (1024 * 1024), 2).' MB)';
349
         $BBName = "[url=artist.php?id=$ArtistID]".$ArtistName."[/url] - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Media][/url] ".' ('.number_format($Size / (1024 * 1024), 2).' MB)';
350
 //      }
350
 //      }
351
 ?>
351
 ?>
352
-  <div id="report<?=$ReportID?>">
352
+  <div id="report<?=$ReportID?>" data-load-report="<?=$ReportID?>">
353
     <form class="manage_form" name="report" id="reportform_<?=$ReportID?>" action="reports.php" method="post">
353
     <form class="manage_form" name="report" id="reportform_<?=$ReportID?>" action="reports.php" method="post">
354
 <?
354
 <?
355
 /*
355
 /*
726
       </div>
726
       </div>
727
     </form>
727
     </form>
728
   </div>
728
   </div>
729
-  <script type="text/javascript">//<![CDATA[
730
-    Load(<?=$ReportID?>);
731
-  //]]>
732
-  </script>
733
 <?
729
 <?
734
     }
730
     }
735
   }
731
   }

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

220
     }
220
     }
221
   );
221
   );
222
 }
222
 }
223
+
224
+document.querySelectorAll('[data-load-report]').forEach(function(el) {
225
+  Load(+el.attributes['data-load-report'].value);
226
+})

Loading…
Cancel
Save