KAT - Average posts/day

Shows average post per day for a user on KAT

  1. // ==UserScript==
  2. // @name KAT - Average posts/day
  3. // @namespace AveragePosts
  4. // @version 1.05
  5. // @description Shows average post per day for a user on KAT
  6. // @match http://kat.cr/community/show/*
  7. // @match https://kat.cr/community/show/*
  8. // @include /https?:\/\/kat.cr\/user\/[^\/]+\//
  9. // ==/UserScript==
  10.  
  11. if (window.location.href.search("\/user\/") != -1)
  12. {
  13. var joinDate = $(".formtable tbody tr:first td:last").text();
  14. joinDate = joinDate.substring(joinDate.indexOf('(') + 1, joinDate.length - 1);
  15. var posts = $(".formtable tbody tr td strong a[href^='/community/']").closest("tr").children("td:last").text();
  16. var start = new Date(joinDate),
  17. end = new Date(),
  18. diff = new Date(end - start),
  19. days = diff/1000/60/60/24,
  20. ppd = posts/days;
  21. ppd = Math.round( ppd * 100 ) / 100;
  22. $(".formtable tbody tr td strong a[href^='/community/']").closest("tr").children("td:last").append(" - " + ppd + " posts per day");
  23. }
  24. else
  25. {
  26. $("div[id^='post'] .badgeInfo").each(function()
  27. {
  28. var joinDate = $(this).children().last().text();
  29. var posts = $(this).find("span:eq(3)").text();
  30. posts = posts.substring(7);
  31.  
  32. var start = new Date(joinDate),
  33. end = new Date(),
  34. diff = new Date(end - start),
  35. days = diff/1000/60/60/24,
  36. ppd = posts/days;
  37. ppd = Math.round( ppd * 100 ) / 100;
  38. $('<span class="font11px lightgrey">posts/day: ' + ppd + '</span>').insertAfter($(this).find("span:eq(3)"));
  39. });
  40. }