Greasy Fork is available in English.

Scroll to first stackoverflow answer

Scroll to the first stackoverflow answer on page load

  1. // ==UserScript==
  2. // @name Scroll to first stackoverflow answer
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Scroll to the first stackoverflow answer on page load
  6. // @author Alex Lamson
  7. // @match *://superuser.com/*
  8. // @match *://stackoverflow.com/*
  9. // @match *://askubuntu.com/*
  10. // @match *://serverfault.com/*
  11. // @match *://*.stackexchange.com/*
  12. // @require https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.slim.min.js
  13. // @grant none
  14. // @license MIT
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. 'use strict';
  19.  
  20. // collect all the answers
  21. var answers = document.querySelectorAll(".answer");
  22. var scores = Array.from(answers).map((x) =>
  23. parseInt(x.getElementsByClassName("js-vote-count")[0].textContent)
  24. );
  25.  
  26. // scroll to the answer with the highest score
  27. var i = scores.indexOf(Math.max(...scores));
  28. answers[i].scrollIntoView();
  29.  
  30. })();