Registration date in VK

Registration date in VK profile

  1. // ==UserScript==
  2. // @name Registration date in VK
  3. // @name:ru Дата регистрации в VK
  4. // @namespace FIX
  5. // @version 0.6
  6. // @description Registration date in VK profile
  7. // @description:ru Показ даты регистрации в профиле VK
  8. // @author raletag
  9. // @copyright 2016-2021, raletag
  10. // @include *://vk.com/*
  11. // @exclude *://vk.com/notifier.php*
  12. // @exclude *://vk.com/*widget*.php*
  13. // @grant none
  14. // @run-at document-end
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. 'use strict';
  19. var month = [null, 'января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'],
  20. error = function () {
  21. console.error('GET registration date in VK ERROR!');
  22. };
  23. new MutationObserver(function () {
  24. var a = document.body.querySelector('#profile_short:not([vrd]'), b, c, id;
  25. if (!a) return;
  26. a.setAttribute('vrd', '1');
  27. b = document.body.querySelector('a.page_actions_item[onclick*="Abuse"]');
  28. id = ((b && b.getAttribute('onclick').match(/(\d+)/))||[])[1];
  29. if (!id && window.vk && window.vk.id) id = window.vk.id;
  30. if (!id) return;
  31. c = new XMLHttpRequest();
  32. c.onload = function () {
  33. var xd = (this.responseText.match(/ya:created dc:date="(.+)T/i)||[])[1], ad, div;
  34. if (xd) {
  35. ad = xd.split('-');
  36. div = document.createElement ('div');
  37. div.className = 'clear_fix profile_info_row';
  38. div.innerHTML = '<div class="label fl_l">Дата регистрации:</div><div class="labeled">' + parseInt(ad[2]) + ' ' + month[parseInt(ad[1])] + ' ' + ad[0] + ' г.</div>';
  39. a.insertBefore(div, a.firstChild);
  40. } else {
  41. error ();
  42. }
  43. };
  44. c.onerror = error;
  45. c.timeout = 10000;
  46. c.open('GET', '/foaf.php?id=' + id, true);
  47. c.send();
  48. }).observe(document.body, {childList: true, subtree: true});
  49. })();