CSS: m.facebook.com - cleaner UI

Corrections to UI of Facebook for mobile browsers: remove useless panels

当前为 2022-09-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name CSS: m.facebook.com - cleaner UI
  3. // @description Corrections to UI of Facebook for mobile browsers: remove useless panels
  4. // @author MK
  5. // @namespace max44
  6. // @homepage https://greasyfork.org/en/users/309172-max44
  7. // @match *://m.facebook.com/*
  8. // @icon https://static.xx.fbcdn.net/rsrc.php/yD/r/d4ZIVX-5C-b.ico
  9. // @version 1.3
  10. // @license MIT
  11. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  12. // @run-at document-idle
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17.  
  18. var css = `
  19. /*Remove MBackNavBar - back arrow header above the current message*/
  20. #MBackNavBar {
  21. visibility: hidden !important;
  22. height: 0px !important;
  23. }
  24.  
  25. /*Remove mDialogHeader
  26. #mDialogHeader {
  27. visibility: hidden !important;
  28. height: 0px !important;
  29. }*/
  30.  
  31. /*Remove MStoriesTray - box with various stories*/
  32. #MStoriesTray {
  33. visibility: hidden !important;
  34. height: 0px !important;
  35. }
  36.  
  37. /*Remove conversation guides*/
  38. /*#u_0_11, #u_jb_9, #u_1y_8*/
  39. /*[id^="u_"][id$="_8"],
  40. [id^="u_"][id$="_9"],
  41. [id^="u_"][id$="_10"],
  42. [id^="u_"][id$="_11"]*/
  43. [class^="_7an"],
  44. ._4l3w {
  45. visibility: hidden !important;
  46. height: 0px !important;
  47. }
  48.  
  49. /*Make smaller clickable area around "Like", "Reply" and "More"*/
  50. a._2b0a {
  51. padding: 3px 8px 3px 8px !important;
  52. /*margin: 0px 0px 7px 0px;*/
  53. }
  54.  
  55. /*Correct place of comments switcher*/
  56. div > div#add_comment_switcher_placeholder {
  57. float: unset !important;
  58. text-align: right !important;
  59. }
  60.  
  61. /*Make darker background for new interface header*/
  62. /*#mJewelNav {
  63. background: #30a9d6*/ /*#eea1c6*/ /*#b5cdff*/ /*!important;
  64. }*/
  65. `;
  66.  
  67. if (typeof GM_addStyle != 'undefined') {
  68. GM_addStyle(css);
  69. } else if (typeof PRO_addStyle != 'undefined') {
  70. PRO_addStyle(css);
  71. } else if (typeof addStyle != 'undefined') {
  72. addStyle(css);
  73. } else {
  74. var node = document.createElement('style');
  75. node.type = 'text/css';
  76. node.appendChild(document.createTextNode(css));
  77. document.documentElement.appendChild(node);
  78. }
  79.  
  80. var divSwitcher = null;
  81. var divStory = null;
  82. var divComments = null;
  83. var i;
  84. let waitForStory = setInterval(function() { //Check page content constantly
  85. divSwitcher = document.getElementById("add_comment_switcher_placeholder");
  86.  
  87. if (divSwitcher != null) {
  88. divStory = divSwitcher.parentNode;
  89. for (i = 0; i < divStory.childNodes.length; i++) {
  90. if (divStory.childNodes[i].className.indexOf("_333v _45kb") > -1) { //Section to put comments switcher before
  91. divComments = divStory.childNodes[i];
  92. break;
  93. }
  94. }
  95. if (divComments != null) divStory.insertBefore(divSwitcher, divComments);
  96. clearInterval(waitForStory); //Stop waiting
  97. }
  98. }, 500); //Interval to check page content
  99.  
  100. })();