osu! disable timeago

disable timeago and use local time. Suwako's request.

  1. // ==UserScript==
  2. // @name osu! disable timeago
  3. // @description disable timeago and use local time. Suwako's request.
  4. // @author JebwizOscar
  5. // @icon http://osu.ppy.sh/favicon.ico
  6. // @include http://osu.ppy.sh/*
  7. // @include https://osu.ppy.sh/*
  8. // @version 0.1u
  9. // @namespace https://greasyfork.org/users/3079
  10. // ==/UserScript=====
  11. function loadInCurrentTab(page)
  12. {
  13. if(activeRequest) {
  14. activeRequest.abort();
  15. }
  16. activeRequest = $.get(page, null, function(text){
  17. activeRequest = null;
  18. $("#" + activeTab).html(text);
  19. $("#" + activeTab).stop(true,true).fadeTo(50,1,function() { $("#" + activeTab).css('filter', 'none'); });
  20. $("#" + activeTab).addClass("loaded");
  21. $(".timeago").removeClass('timeago').addClass('timeago_');
  22. $('.timeago_').each(function(){$(this).html((new Date(Date.parse($(this).attr('title')))).Format("yyyy-MM-dd hh:mm:ss"))});
  23. });
  24. }
  25. Date.prototype.Format = function(fmt)
  26. { //author: meizz
  27. var o = {
  28. "M+" : this.getMonth()+1,
  29. "d+" : this.getDate(),
  30. "h+" : this.getHours(),
  31. "m+" : this.getMinutes(),
  32. "s+" : this.getSeconds(),
  33. };
  34. if(/(y+)/.test(fmt))
  35. fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
  36. for(var k in o)
  37. if(new RegExp("("+ k +")").test(fmt))
  38. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
  39. return fmt;
  40. }
  41. script = document.createElement("script");
  42. script.innerHTML = loadInCurrentTab;
  43. document.body.appendChild(script);
  44. $(".timeago").removeClass('timeago').addClass('timeago_');
  45. $('.timeago_').each(function(){$(this).html((new Date(Date.parse($(this).attr('title')))).Format("yyyy-MM-dd hh:mm:ss"))});
  46. $( document ).ajaxComplete(function( event, xhr, settings ) {
  47. $(".timeago").removeClass('timeago').addClass('timeago_');
  48. $('.timeago_').each(function(){$(this).html((new Date(Date.parse($(this).attr('title')))).Format("yyyy-MM-dd hh:mm:ss"))});
  49. });