Bonsai

    
      
  • /*
     * @title Bonsai
     * @description hg.mozilla.org の pushloghtml に変更されたファイルの一覧を表示します。
     * @include http://hg.mozilla.org/*
     * @license MIT License
     * @require 
     */
    javascript:(function() {
    function insertFileList(xml) {
      var entries = xml.querySelectorAll('entry');
      var data = {};
      for (var i = 0; i < entries.length; i++) {
        var entry = entries[i]; 
        var link = entry.querySelector('link').getAttributeNS(null, 'href');
        link = link.replace(/^http:\/\/hg\.mozilla\.org/, '');
        link = link.replace(/\/([0-9a-f]{12})[0-9a-f]+$/, '/$1');
        data[link] = document.importNode(entry.querySelector('content > div'), true);
      }
    
      var target = document.querySelector('table tr:first-child > th:nth-child(3)');
      var th = document.createElement('TH');
      th.appendChild(document.createTextNode('Files'));
      target.parentNode.insertBefore(th, target);
    
      for (var link in data) {
        var sel = 'a[href="' + link + '"]';
        var el = document.querySelector(sel).parentNode;
        var cell = document.createElement('TD');
        cell.appendChild(data[link]);
        el.parentNode.insertBefore(cell, el.nextElementSibling);
      }
    }
    
    var url = (window.location + '').replace('pushloghtml', 'pushlog');
    var req = new XMLHttpRequest();
    req.overrideMimeType('text/xml');
    req.open('GET', url, true);
    req.onreadystatechange = function(aEvent) {
      if (req.readyState == 4) {
        if (req.status == 200) {
          insertFileList(req.responseXML);
        }
      }
    };
    req.send(null);})();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2010/08/28 22:53:48 - 2010-08-28
  2. 2010/08/28 22:52:46 - 2010-08-28
  3. 2010/08/28 22:51:23 - 2010-08-28
  4. 2010/08/20 15:22:40 - 2010-08-20
  5. 2010/08/18 11:40:39 - 2010-08-18
  6. 2010/08/18 11:09:56 - 2010-08-18
  7. 2010/08/18 10:45:26 - 2010-08-18