Facebook (Show URLS on Posts)

Shows Full Timestamps on Facebook Posts

  1. // ==UserScript==
  2. // @name Facebook (Show URLS on Posts)
  3. // @description Shows Full Timestamps on Facebook Posts
  4. // @icon https://www.google.com/s2/favicons?domain=facebook.com
  5. // @match https://www.facebook.com/*
  6. // @match https://*.facebook.com/*
  7. // @match http://www.facebook.com/*
  8. // @match http://*.facebook.com/*
  9. // @run-at document-start
  10. // @grant GM_addStyle
  11. // @author JZersche
  12. // @require https://greasyfork.org/scripts/12228/code/setMutationHandler.js
  13. // @version 1.01
  14. // @namespace https://greasyfork.org/users/95175
  15. // ==/UserScript==
  16.  
  17. let event = new MouseEvent('pointerover', {'bubbles': true});
  18.  
  19. setMutationHandler({
  20. target: document.querySelector('.qzhwtbm6.knvmm38'),
  21. selector: '.oajrlxb2.gpro0wi8.b1v8xokw',
  22. handler: nodes => nodes.forEach(node => {
  23. setTimeout(function(){
  24. node.dispatchEvent(event);
  25. setTimeout(function(){
  26. if(node.href.length>100 && !node.outerHTML.match('tm_injection') && window.location.href.match(/facebook\.com\/\w+/) && !node.href.match(/hashtag/)) {
  27. //node.parentNode.parentNode.nextSibling.innerText = ' · ';
  28. console.log('node');
  29. try{node.parentNode.parentNode.nextSibling.innerHTML = node.parentNode.parentNode.nextSibling.innerHTML.replace('·',''); let date = new Date(); let _time_ = date.toLocaleTimeString(); let month = date.getMonth()+1;let day = ' '+date.getDate();let year = ' '+date.getFullYear();let Hr = date.getHours(), Min = date.getMinutes(), Sec = date.getSeconds();
  30. node.parentNode.parentNode.nextSibling.nextSibling.insertAdjacentHTML('afterend','<span class="additional" style="display:block;"><a href="#" class="add_button_1"><br>Archive Date: '+month+day+year+' at '+_time_+'</a></span>');
  31. node.parentNode.parentNode.nextSibling.nextSibling.nextSibling.setAttribute('style','display:inline;');
  32.  
  33. /* Remove Second Archive Date */
  34. let ArchiveDate2 = document.getElementsByClassName('d2edcug0 hpfvmrgz qv66sw1b c1et5uql lr9zc1uh a8c37x1j keod5gw0 nxhoafnm aigsh9s9 d9wwppkn fe6kdd0r mau55g9w c8b282yb mdeji52x e9vueds3 j5wam9gi knj5qynh m9osqain hzawbc8m')[1].children[0];
  35. ArchiveDate2.removeChild(ArchiveDate2.children[4])
  36.  
  37. document.getElementsByClassName('add_button_1')[0].setAttribute('style','color:#fff!important;padding-left:2px;padding-right:2px;font-weight:600;letter-spacing:0.75px;padding-top:2px;');
  38.  
  39. //setTimeout(function(){ console.log(node.parentNode.parentNode.nextSibling.nextSibling.nextSibling); },1050);
  40. //setTimeout(function(){ console.log(node.parentNode.parentNode.nextSibling.nextSibling.innerText); },1050);
  41.  
  42. }catch(e){}
  43. node.href = node.href.replace(node.search,'').replace(/photos/,'posts').replace(/\/a\.\d+/,'');
  44. //node.href = node.href.match(/(\d+\/)/)[0].replace('/','');
  45. node.href = node.href.replace(/(\/posts\/\d+)\//,'$1');
  46. node.href;
  47. try{node.insertAdjacentHTML('beforeend','<br /><span class="tm_injection"> '+node.href.match(/\.com\/.+/)[0].replace('.com/','')+'</span>').replace(/photos/,'a');}catch(e){}
  48. //alert(node.href);
  49. //node.children[0].setAttribute('style','background-image: linear-gradient(to left, white 50%, green 60%, white 60%, blue 70%, violet 80%);-webkit-background-clip: text;');
  50. //node.children[2].setAttribute('style','background-image: linear-gradient(to left, violet, blue, green, red, white);-webkit-background-clip: text;');
  51. }
  52. },222)
  53. },3000);
  54. return false})
  55. })