Comment by brudgers

9 years ago

A piece of kludgecode for Greasemonkey[Firefox] or TamperMonkey[Chrome/Chromium]. The script will all move the collapse links to the left margin on this page:

  // ==UserScript==
  // @name        move_collapse_link
  // @namespace   com.kludgecode.hn.demo
  // @include     https://news.ycombinator.com/item?id=12073675
  // @version     1
  // @grant       none
  // @run-at      document-end
  // ==/UserScript==

  window.$destination =  document.getElementsByClassName('comtr');
  window.$source = document.getElementsByClassName('togg');

  for (var i = 0; i < $source.length; i++) {
    var row = $destination[i].getElementsByTagName('tr')[0];
    var cell = row.insertCell(0);
    row.children[0].appendChild($source[i]);
  }

Modifying the @include line by replacing the query portion of the URI with an asterisk, will cause the code to run on all HN "story" pages. Matters of preference ought to be within the users control. I like Greasemonkey/Tampermonkey because suddenly a lot of things are.