Guest User

Untitled

a guest
Mar 6th, 2024
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1.  
  2. // ==UserScript==
  3. // @name HN White
  4. // @namespace http://tampermonkey.net/
  5. // @version 0.1
  6. // @description Make HN background white and put details at the top
  7. // @author You
  8. // @match https://news.ycombinator.com/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. function wide(s) {
  13. document.querySelectorAll(s).forEach(e => {e.style.width = "95%"});
  14. }
  15. function white(s) {
  16. document.querySelectorAll(s).forEach(e => {e.style.backgroundColor = "#FFFFFF"});
  17. }
  18. function rm(s) {
  19. document.querySelectorAll(s).forEach(e => e.parentNode.removeChild(e));
  20. }
  21. function bookmark() {
  22. var title_ = document.querySelectorAll(
  23. "#hnmain > tbody > tr > td > table.fatitem > tbody > tr > td.title > span.titleline > a"
  24. )[0].text
  25. var link_ = document.querySelectorAll(
  26. "#hnmain > tbody > tr > td > table.fatitem > tbody > tr > td.title > span.titleline > a"
  27. )[0].href
  28. var loc_ = document.location.href
  29. var d1 = (new Date()).toISOString().split('T')[0]
  30. var d2 = " /" + d1.substr(2, 2) + d1.substr(5, 2) + d1.substr(8, 2)
  31. document.querySelectorAll("body")[0].insertAdjacentHTML(
  32. "afterbegin","<pre>"+title_+" "+d2+"<br/> "+link_+"<br/> "+loc_+"</pre>"
  33. )
  34. document.querySelectorAll("head")[0].insertAdjacentHTML(
  35. "beforeend","<style>pre { max-width: none; }</style>"
  36. )
  37. }
  38. (function() {
  39. 'use strict';
  40. wide("#hnmain");
  41. white("table");
  42. rm("#hnmain > tbody > tr:nth-child(1) > td > table > tbody > tr");
  43. rm("#hnmain > tbody > tr:nth-child(3) > td > table.fatitem > tbody > tr:nth-child(4) > td:nth-child(2) > form");
  44. bookmark();
  45. })();
Advertisement
Add Comment
Please, Sign In to add comment