habrClear

Clear the Habr.com layout for easy print.

  1. // ==UserScript==
  2. // @name habrClear
  3. // @description Clear the Habr.com layout for easy print.
  4. // @description:ru Очищает макет Habr.com для простой печати.
  5. // @namespace habr
  6. // @match https://habr.com/*
  7. // @require http://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
  8. // @version 1.1
  9. // @author Nikolay Raspopov
  10. // @license MIT
  11. // @icon http://habr.com/favicon.ico
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17. var $ = window.jQuery;
  18. $(document).ready( setTimeout( function(){
  19. $('.tm-header__container').append("<div class='clearIt' style='padding-left: 8px; padding-right: 8px;'><button type='button'> 🧹 </button></div>");
  20. $('.clearIt').click( function() {
  21. $('script').remove();
  22. $('noscript').remove();
  23. $('iframe').remove();
  24. $('.tm-header').remove();
  25. $('.tm-page__sidebar').remove();
  26. $('.tm-company-profile-card').remove();
  27. $('.tm-page-progress-bar').remove();
  28. $('.tm-page__header').remove();
  29. $('.tm-footer-menu').remove();
  30. $('.tm-footer').remove();
  31. $('.tm-base-layout__header').remove();
  32. $('.tm-article-sticky-panel').remove();
  33. $('.tm-article-presenter__footer').remove();
  34. $('.tm-article-presenter__meta').remove();
  35. $('.persona').remove();
  36. $('.tm-scroll-top').remove();
  37. $('.v-portal').remove();
  38. $('.Vue-Toastification__container').remove();
  39. $('.vue-portal-target').remove();
  40. $('.pswp').remove();
  41. $('html, body, .tm-layout__wrapper, .tm-layout, .tm-layout__container, .tm-page, .tm-page-width, .tm-page__wrapper, .tm-page__main').css({
  42. 'background-color' : 'white',
  43. });
  44. $('.article-formatted-body table td').css({
  45. 'border-color' : 'black',
  46. });
  47. $('.tm-page, .tm-page-width, .tm-page__main, .tm-article-presenter').css({
  48. 'max-width' : 'none',
  49. 'min-width' : 'none',
  50. 'margin' : 'auto',
  51. 'padding' : 'unset',
  52. });
  53. $('.clearIt').remove(); // self-destruct
  54. });
  55. }, 2000 ) ); // revive delay
  56. })();