Sort MetaFilter Comments

Adds a Sort by Favorites button. Also keeps the anchor tags in the right place, and allows restoring the original sort order.

Ниже показаны версии этого скрипта, в которых изменялся код. Показать все версии.

  • v18 25.09.2024

    Adding better logging of sorting vs restoring in JS console. Nothing end users will notice.

  • v17 04.09.2024

    Removing button height to fix sizing issue.

  • v16 29.04.2022

    Cleaned up code and comments, and switched back to an event-loop-blocking method of adding comments because waiting for animation frames or setTimeout were both an order of magnitude slower.

  • v15 07.08.2020 Now works even if there is no sidebar, which happens if the mods delete or archive a thread.
  • v14 15.03.2020 Removing @run-at as it's not guaranteed to work, and @locale because Greasemonkey's editor thinks it's erroneous.
  • v13 07.02.2020 Fixing an error in reGetAllDivsAndReSort().
  • v12 06.02.2020 Re-gathering the comment Divs and re-sorting the anchors every time the button is pushed so any changes are respected.
  • v11 01.02.2020 Switching to setTimeout( , 0) which keeps the page responsive but is faster than animation frame or setTimeout with a delay.
  • v10 30.01.2020 Switching from RequestAnimationFrame to recursive SetTimeout so the script runs a bit faster and doesn't stop if you navigate away from the tab.
  • v9 30.01.2020 Do fewer DOM manipulations per frame to maintain responsiveness, and set a static heights for the wrapper span during DOM work to prevent flickering.
  • v8 29.01.2020 Adding 5 divs per animation frame instead of 10 to reduce flickering on mobile devices.
  • v7 29.01.2020 Switching from "do all the DOM manipulations at once" to "add the Divs 10 at a time, then wait for the next animation frame" to keep the page responsive.
  • v6 29.01.2020 Replacing waitOneFrame() with waitUntilButtonDisabled(), which checks the button each AnimationFrame and only runs the sort once the button has been animated.
  • v5 28.01.2020 Adding requestAnimationFrame() to ensure the button says "Working..." before the sort operation starts and blocks painting.
  • v4 28.01.2020 Removed setTimeout(), which didn't keep the page responsive but added a 20% performance hit. It also tended to trigger script warnings on Android.
  • v3 28.01.2020 Added code to disable the button when clicked, and some comments and cleanup.
  • v2 26.01.2020 Speeding up the delete phase of each sort by wrapping the area to be modified in a span. String manipulation slightly slows down initial setup after page load.
  • v1 17.01.2020