Guest User

Untitled

a guest
Oct 23rd, 2018
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Gmail - show FORMATTED full date and time in mail list
  3. // @description Just show the full date and time on the list instead of only short date. Useful if you need to create a report and you base on your activity and it's timing. Or when you look at mails and want to find one visually by looking on times.
  4. // @include https://mail.google.com/mail/*
  5. // @version 0.0.1.20180924133221
  6. // @namespace https://greasyfork.org/users/153157
  7. // ==/UserScript==
  8.  
  9. var formatDate = function(dateString) {
  10. var dateTime = new Date(dateString);
  11. return dateTime.toLocaleString();
  12. };
  13.  
  14. (function() {
  15. window.setInterval(function() {
  16. var date_titles_main = Array.from(document.getElementsByClassName("xW xY"));
  17. var date_titles_thread = Array.from(document.getElementsByClassName("g3"));
  18. date_titles_main.forEach(function(element, index, array) {
  19. var elements = element.childNodes;
  20. var title = elements.length > 0 ? elements[0].title : false;
  21. if (title) {
  22. title = formatDate(title);
  23. }
  24. if (title && elements[0].innerHTML != title) { elements[0].innerHTML = title; }
  25. });
  26. date_titles_thread.forEach(function(element, index, array) {
  27. if (element.title && element.innerHTML != element.title) { element.innerHTML = formatDate(element.title); }
  28. });
  29. Array.from(document.getElementsByClassName("xX")).forEach(function(element, index, array) {
  30. element.style.width = '80ex';
  31. });
  32. }, 2000);
  33. })();
Add Comment
Please, Sign In to add comment