You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dataTable.js 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. $.extend(true, $.fn.dataTable.defaults, {
  2. bLengthChange: false,
  3. pageLength: 15,
  4. "language": {
  5. "sEmptyTable": "Keine Daten in der Tabelle vorhanden",
  6. "sInfo": "_START_ bis _END_ von _TOTAL_ Einträgen",
  7. "sInfoEmpty": "0 bis 0 von 0 Einträgen",
  8. "sInfoFiltered": "(gefiltert von _MAX_ Einträgen)",
  9. "sInfoPostFix": "",
  10. "sInfoThousands": ".",
  11. "sLengthMenu": "_MENU_ Einträge anzeigen",
  12. "sLoadingRecords": "Wird geladen...",
  13. "sProcessing": "Bitte warten...",
  14. "sSearch": "Suchen: ",
  15. "sZeroRecords": "Keine Einträge vorhanden.",
  16. "oPaginate": {
  17. "sFirst": "Erste",
  18. "sPrevious": "Zurück",
  19. "sNext": "Nächste",
  20. "sLast": "Letzte"
  21. },
  22. "oAria": {
  23. "sSortAscending": ": aktivieren, um Spalte aufsteigend zu sortieren",
  24. "sSortDescending": ": aktivieren, um Spalte absteigend zu sortieren"
  25. }
  26. },
  27. responsive: true
  28. });
  29. function convertTimestamp(UNIX_TS) {
  30. var date = new Date(UNIX_TS * 1000);
  31. var year = date.getFullYear();
  32. var month = date.getMonth()+1;
  33. var day = date.getDate();
  34. var hour = date.getHours() < 10 ? '0'+date.getHours() : date.getHours();
  35. var min = date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes();
  36. var sec = date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds();
  37. var fulltime = day + '.' + month + '.' + year + ' - ' + hour + ':' + min + ':' + sec;
  38. return fulltime;
  39. }
  40. function anonIP(ipdata) {
  41. var split = ipdata.split(".", 2);
  42. return split[0]+'.'+split[1]+'.xxx.xxx';
  43. }
  44. function refLink(referrer) {
  45. if(referrer != 'direct') {
  46. return '<a href="'+referrer+'" target="_blank">Link zum Referer</a><p class="note">'+referrer+'</p>';
  47. } else {
  48. return 'Browsereingabe oder Anonymisierter aufruf';
  49. }
  50. }
  51. $(document).ready(function() {
  52. $('#dlLists').DataTable({
  53. "ajax": "ajax/downloadOverview.php?ssp=1",
  54. columns: [
  55. {"data": "guid"},
  56. {"data": function(data) {
  57. return anonIP(data.ip_adress);
  58. }
  59. },
  60. {"data": "user_agent"},
  61. {"data": function(data) {
  62. return convertTimestamp(data.timestamp);
  63. }
  64. },
  65. {"data": "dl_version"}
  66. ]
  67. });
  68. $('#visitorLists').DataTable({
  69. "ajax": "ajax/visitorOverview.php?ssp=1",
  70. columns: [
  71. {"data": "guid"},
  72. {"data": function(data) {
  73. return anonIP(data.ip_adress);
  74. }
  75. },
  76. {"data": "user_agent"},
  77. {"data": function(data) {
  78. return refLink(data.referrer);
  79. }
  80. },
  81. {"data": function(data) {
  82. return convertTimestamp(data.timestamp);
  83. }
  84. }
  85. ]
  86. });
  87. });