Skip to content

Instantly share code, notes, and snippets.

@syoichi
Forked from noromanba/gist-logs.user.js
Created July 16, 2012 10:04
Show Gist options
  • Save syoichi/3121904 to your computer and use it in GitHub Desktop.
Save syoichi/3121904 to your computer and use it in GitHub Desktop.

Revisions

  1. syoichi revised this gist Jul 18, 2012. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions gist-logs.user.js
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,8 @@
    // @namsgpace https://www.hatena.ne.jp/noromanba/
    // @description show commit messages on Gist
    // @include https://gist.github.com/*
    // @version 0.0.2
    // @update 2012-07-16T19:10:21.543Z(GMT+09:00)
    // @version 0.0.3
    // @update 2012-07-18T21:18:13.437Z(GMT+09:00)
    // @license WTFPL http://sam.zoy.org/wtfpl/ (Do What The Fuck You Want To Public License)
    // @contributor satyr https://gist.github.com/107780
    // @contributor saitamanodoruji https://gist.github.com/2653937
    @@ -14,7 +14,7 @@
    // @icon64 https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Talk_icon.svg/64px-Talk_icon.svg.png
    // @run-at document-end
    // @priority 0
    // @compatibility Firefox 13.0.1(Scriptish 0.1.7), Chrome 20.0.1132.57, Safari 5.1.7(NinjaKit 0.9.1) on Windows 7 Home Premium SP1 64bit
    // @compatibility Firefox 14.0.1(Scriptish 0.1.7), Chrome 20.0.1132.57, Safari 5.1.7(NinjaKit 0.9.1) on Windows 7 Home Premium SP1 64bit
    // @charset UTF-8
    // ==/UserScript==

    @@ -60,8 +60,8 @@
    ' border: 1px solid silver !important;',
    ' border-radius: 10px !important;',
    ' padding: 0 3px !important;',
    ' word-wrap: break-word !important;',
    ' word-break: break-all !important;',
    ' white-space: pre-wrap !important;',
    '}',
    '.error {',
    ' color: red !important;',
  2. syoichi revised this gist Jul 16, 2012. 1 changed file with 198 additions and 78 deletions.
    276 changes: 198 additions & 78 deletions gist-logs.user.js
    100755 → 100644
    Original file line number Diff line number Diff line change
    @@ -1,87 +1,207 @@
    // ==UserScript==
    // @name gist logs
    // @namsgpace https://www.hatena.ne.jp/noromanba/
    // @description Show commit logs on Gist for Greasemonkey
    // @include https://gist.github.com/*
    // @version 2012.7.14.16.26
    // @license WTFPL http://sam.zoy.org/wtfpl/ (Do What The Fuck You Want To Public License)
    // @contributor satyr https://gist.github.com/107780
    // @contributor saitamanodoruji https://gist.github.com/2653937
    // @author noromanba (https://www.hatena.ne.jp/noromanba/)
    // @homepage https://gist.github.com/2669793
    // @icon https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Talk_icon.svg/32px-Talk_icon.svg.png
    // @icon64 https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Talk_icon.svg/64px-Talk_icon.svg.png
    // @name gist logs
    // @namsgpace https://www.hatena.ne.jp/noromanba/
    // @description show commit messages on Gist
    // @include https://gist.github.com/*
    // @version 0.0.2
    // @update 2012-07-16T19:10:21.543Z(GMT+09:00)
    // @license WTFPL http://sam.zoy.org/wtfpl/ (Do What The Fuck You Want To Public License)
    // @contributor satyr https://gist.github.com/107780
    // @contributor saitamanodoruji https://gist.github.com/2653937
    // @author noromanba (https://www.hatena.ne.jp/noromanba/)
    // @homepage https://gist.github.com/2669793
    // @icon https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Talk_icon.svg/32px-Talk_icon.svg.png
    // @icon64 https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Talk_icon.svg/64px-Talk_icon.svg.png
    // @run-at document-end
    // @priority 0
    // @compatibility Firefox 13.0.1(Scriptish 0.1.7), Chrome 20.0.1132.57, Safari 5.1.7(NinjaKit 0.9.1) on Windows 7 Home Premium SP1 64bit
    // @charset UTF-8
    // ==/UserScript==

    // Icon (Public Domain by Jonathan)
    // https://commons.wikimedia.org/wiki/File:Talk_icon.svg

    // c.f. http://d.hatena.ne.jp/murky-satyr/20090508/gist_logs
    (function () {
    if (!(/^https:\/\/gist\.github\.com\/\d+/.test(location.href))) return;

    var indicator = (function () {
    var spinner = document.createElement('img');
    spinner.src = 'https://assets.github.com/images/spinners/octocat-spinner-32.gif';
    var style = spinner.style;
    style.display = 'inline-block';
    style.marginLeft = '5px';
    style.height = '16px';
    document.querySelector('#revisions h3').appendChild(spinner);

    var timer, threshold = 1500;
    return {
    keep: function () { // debounce
    clearTimeout(timer);
    timer = setTimeout(function () {
    style.display = 'none';
    }, threshold);

    /*jslint browser: true, maxlen: 80*/
    /*global GM_xmlhttpRequest*/
    // Edition 2012-07-13

    (function executeShowCommitMessages(doc) {
    'use strict';

    var GIST_META_URL, GITHUB_LOADING_ICON, revisions, gmXHR, button,
    revisionHeadline, revisionList, ids, idsLen, messages, noMessageIdExp,
    $X, addMessage, req, removeButtonAndEventListener, addAllMessage,
    cancelDblclickSelect, selectRevisions, details, noMessageIds, idx, id,
    loading;

    revisions = doc.getElementById('revisions');

    if (!revisions) {
    return;
    }

    doc.head.appendChild(doc.createElement('style')).textContent = [
    '#revisions > h3 > .classy {',
    ' top: -2px !important;',
    ' height: auto !important;',
    '}',
    '#revisions > h3 > .classy > span {',
    ' height: auto !important;',
    ' line-height: normal !important;',
    '}',
    '.loading {',
    ' margin-left: 10px !important;',
    ' margin-bottom: -3px !important;',
    ' height: 19px !important;',
    '}',
    '.message {',
    ' border: 1px solid silver !important;',
    ' border-radius: 10px !important;',
    ' padding: 0 3px !important;',
    ' word-wrap: break-word !important;',
    ' word-break: break-all !important;',
    '}',
    '.error {',
    ' color: red !important;',
    '}'
    ].join('\n');

    GIST_META_URL = 'https://raw.github.com/gist';
    GITHUB_LOADING_ICON =
    'https://assets.github.com/images/spinners/octocat-spinner-32.gif';

    gmXHR = GM_xmlhttpRequest;
    button = doc.createElement('button');
    revisionHeadline = revisions.firstElementChild;
    revisionList = revisionHeadline.nextElementSibling;
    ids = revisionList.getElementsByClassName('id');
    idsLen = ids.length;
    messages = revisionList.getElementsByClassName('message');
    noMessageIdExp = 'a[' + (
    'contains(concat(" ", @class, " "), " id ") and ' +
    'not(' + (
    'following-sibling::pre[' + (
    'contains(concat(" ", @class, " "), " message ")'
    ) + ']'
    ) + ')'
    ) + ']';

    $X = function $X(exp, context) {
    var root, result, len, idx, nodes;

    root = context ? context.ownerDocument : (context = doc);
    result = root.evaluate(exp, context, null, 7, null);
    len = result.snapshotLength;

    for (idx = 0, nodes = []; idx < len; idx += 1) {
    nodes.push(result.snapshotItem(idx));
    }

    return nodes;
    };
    addMessage = function addMessage(res) {
    var message, matchMessage;

    message = doc.createElement('pre');

    message.className = 'message';

    if (/^(?:200|304)$/.test(res.status)) {
    matchMessage = /\n{2}([\s\S]+)\n$/m.exec(res.responseText);

    if (matchMessage) {
    message.textContent = matchMessage[1];
    } else {
    message.classList.add('error');
    message.textContent = 'commit message not found';
    }
    };
    })();

    var format = (function () {
    var entity = {
    '<': '&lt;',
    '>': '&gt;',
    '&': '&amp;',
    '"': '&quot;'
    };
    return function (captured) {
    return (/\n/.test(captured)) ? '<br>' : entity[captured];
    };
    })();

    var timer, queue = [], interval = 1000;
    Array.prototype.forEach.call(document.querySelectorAll('#revisions .id'), function (rev, idx) {
    // XXX too much XHR requests!
    // therefore Github block a response: (D)DoS filtering or API constraints => 505 error
    // better to be a XHR once only. but Gist API v1 and v3 not provide log information
    timer = setTimeout(function () {
    indicator.keep();
    queue.shift();
    try {
    GM_xmlhttpRequest({
    method: 'GET',
    url: 'https://raw.github.com/gist' + rev.pathname + '/meta',
    onload: function (res) {
    var msg = (res.responseText.match(/\n\n([\s\S]*)\n$/m) || [])[1];
    if (!msg) return;

    var container = document.createElement('div');
    container.innerHTML = msg.replace(/[<>&"\n]/g, format);
    rev.parentNode.appendChild(container);
    }
    });
    } catch (e) {
    queue.forEach(function (job) {
    clearTimeout(job);
    });
    if (console && console.warn) {
    console.warn('*error caught by gist logs =>', e);
    }
    } else {
    message.classList.add('error');
    message.textContent = 'loading error';
    }

    id.parentNode.appendChild(message);

    if (messages.length < idsLen) {
    if (noMessageIds) {
    req(noMessageIds[idx += 1]);
    } else {
    loading.hidden = true;
    }
    }, interval * idx);
    queue.push(timer);
    });
    })();
    } else {
    revisionHeadline.removeChild(loading);
    }
    };
    req = function req(rev) {
    if (!rev) {
    return;
    }

    id = rev;

    if (loading) {
    loading.hidden = false;
    } else {
    loading = doc.createElement('img');
    loading.className = 'loading';
    loading.src = GITHUB_LOADING_ICON;
    revisionHeadline.appendChild(loading);
    }

    details.url = GIST_META_URL + id.pathname;

    gmXHR(details);
    };
    removeButtonAndEventListener = function removeButtonAndEventListener() {
    button.removeEventListener('click', addAllMessage);
    button.parentNode.removeChild(button);
    revisionList.removeEventListener('selectstart', cancelDblclickSelect);
    revisionList.removeEventListener('dblclick', selectRevisions);
    };
    addAllMessage = function addAllMessage() {
    removeButtonAndEventListener();

    noMessageIds = $X('.//' + noMessageIdExp, revisions);
    idx = 0;

    req(noMessageIds[idx]);
    };
    cancelDblclickSelect = function cancelDblclickSelect(evt) {
    var target;

    target = evt.target;

    if (!(target.tagName === 'LI' && target.parentNode === revisionList)) {
    return;
    }

    evt.preventDefault();
    };
    selectRevisions = function selectRevisions(evt) {
    var target;

    target = evt.target;

    if (target.tagName === 'A') {
    return;
    }

    if (messages.length === (idsLen - 1)) {
    removeButtonAndEventListener();
    }

    req($X('./ancestor-or-self::li[@class]/' + noMessageIdExp, target)[0]);
    };

    details = {method: 'GET', onload: addMessage, onerror: addMessage};

    button.className = 'classy';
    button.insertAdjacentHTML('BeforeEnd', '<span>message</span>');
    revisionHeadline.appendChild(button);

    button.addEventListener('click', addAllMessage);
    revisionList.addEventListener('selectstart', cancelDblclickSelect);
    revisionList.addEventListener('dblclick', selectRevisions);
    }(document));
  3. @noromanba noromanba revised this gist Jul 14, 2012. 1 changed file with 19 additions and 17 deletions.
    36 changes: 19 additions & 17 deletions gist-logs.user.js
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    // @namsgpace https://www.hatena.ne.jp/noromanba/
    // @description Show commit logs on Gist for Greasemonkey
    // @include https://gist.github.com/*
    // @version 2012.6.25.7.5
    // @version 2012.7.14.16.26
    // @license WTFPL http://sam.zoy.org/wtfpl/ (Do What The Fuck You Want To Public License)
    // @contributor satyr https://gist.github.com/107780
    // @contributor saitamanodoruji https://gist.github.com/2653937
    @@ -16,22 +16,10 @@
    // Icon (Public Domain by Jonathan)
    // https://commons.wikimedia.org/wiki/File:Talk_icon.svg

    // http://d.hatena.ne.jp/murky-satyr/20090508/gist_logs
    // c.f. http://d.hatena.ne.jp/murky-satyr/20090508/gist_logs
    (function () {
    if (!(/^https:\/\/gist\.github\.com\/\d+/.test(location.href))) return;

    var format = (function () {
    var entity = {
    '<': '&lt;',
    '>': '&gt;',
    '&': '&amp;',
    '"': '&quot;'
    };
    return function (captured) {
    return (/\n/.test(captured)) ? '<br>' : entity[captured];
    };
    })();

    var indicator = (function () {
    var spinner = document.createElement('img');
    spinner.src = 'https://assets.github.com/images/spinners/octocat-spinner-32.gif';
    @@ -52,7 +40,19 @@
    };
    })();

    var timer, queue = [], inteval = 1000;
    var format = (function () {
    var entity = {
    '<': '&lt;',
    '>': '&gt;',
    '&': '&amp;',
    '"': '&quot;'
    };
    return function (captured) {
    return (/\n/.test(captured)) ? '<br>' : entity[captured];
    };
    })();

    var timer, queue = [], interval = 1000;
    Array.prototype.forEach.call(document.querySelectorAll('#revisions .id'), function (rev, idx) {
    // XXX too much XHR requests!
    // therefore Github block a response: (D)DoS filtering or API constraints => 505 error
    @@ -77,9 +77,11 @@
    queue.forEach(function (job) {
    clearTimeout(job);
    });
    console.warn('*error caught by gist logs:', 'e:', e);
    if (console && console.warn) {
    console.warn('*error caught by gist logs =>', e);
    }
    }
    }, inteval * idx);
    }, interval * idx);
    queue.push(timer);
    });
    })();
  4. @noromanba noromanba revised this gist Jun 24, 2012. 1 changed file with 32 additions and 27 deletions.
    59 changes: 32 additions & 27 deletions gist-logs.user.js
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    // @namsgpace https://www.hatena.ne.jp/noromanba/
    // @description Show commit logs on Gist for Greasemonkey
    // @include https://gist.github.com/*
    // @version 2012.6.15
    // @version 2012.6.25.7.5
    // @license WTFPL http://sam.zoy.org/wtfpl/ (Do What The Fuck You Want To Public License)
    // @contributor satyr https://gist.github.com/107780
    // @contributor saitamanodoruji https://gist.github.com/2653937
    @@ -32,21 +32,18 @@
    };
    })();

    var feedback = (function () {
    var indicator = document.createElement('img');
    indicator.src = 'https://assets.github.com/images/spinners/octocat-spinner-32.gif';
    var style = indicator.style;
    style.display = 'none';
    var indicator = (function () {
    var spinner = document.createElement('img');
    spinner.src = 'https://assets.github.com/images/spinners/octocat-spinner-32.gif';
    var style = spinner.style;
    style.display = 'inline-block';
    style.marginLeft = '5px';
    style.height = '16px';
    document.querySelector('#revisions h3').appendChild(indicator);
    document.querySelector('#revisions h3').appendChild(spinner);

    var timer, threshold = 1500;
    return {
    show: function () {
    style.display = 'inline-block';
    },
    debounce: function () {
    keep: function () { // debounce
    clearTimeout(timer);
    timer = setTimeout(function () {
    style.display = 'none';
    @@ -55,26 +52,34 @@
    };
    })();

    feedback.show();
    var timer, queue = [], inteval = 1000;
    Array.prototype.forEach.call(document.querySelectorAll('#revisions .id'), function (rev, idx) {
    // XXX too much XHR requests!
    // therefore Github block a response: (D)DoS filtering or API constraints => 505 error
    // better to be a XHR once only. but Gist API v1 and v3 not provide log information
    setTimeout(function () {
    GM_xmlhttpRequest({
    method: 'GET',
    url: 'https://raw.github.com/gist' + rev.pathname + '/meta',
    onload: function (res) {
    feedback.debounce();
    timer = setTimeout(function () {
    indicator.keep();
    queue.shift();
    try {
    GM_xmlhttpRequest({
    method: 'GET',
    url: 'https://raw.github.com/gist' + rev.pathname + '/meta',
    onload: function (res) {
    var msg = (res.responseText.match(/\n\n([\s\S]*)\n$/m) || [])[1];
    if (!msg) return;

    var msg = (res.responseText.match(/\n\n([\s\S]*)\n$/m) || [])[1];
    if (!msg) return;

    var container = document.createElement('div');
    container.innerHTML = msg.replace(/[<>&"\n]/g, format);
    rev.parentNode.appendChild(container);
    }
    });
    }, 1000 * idx);
    var container = document.createElement('div');
    container.innerHTML = msg.replace(/[<>&"\n]/g, format);
    rev.parentNode.appendChild(container);
    }
    });
    } catch (e) {
    queue.forEach(function (job) {
    clearTimeout(job);
    });
    console.warn('*error caught by gist logs:', 'e:', e);
    }
    }, inteval * idx);
    queue.push(timer);
    });
    })();
  5. @noromanba noromanba revised this gist Jun 13, 2012. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions gist-logs.user.js
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    // @namsgpace https://www.hatena.ne.jp/noromanba/
    // @description Show commit logs on Gist for Greasemonkey
    // @include https://gist.github.com/*
    // @version 2012.6.11
    // @version 2012.6.15
    // @license WTFPL http://sam.zoy.org/wtfpl/ (Do What The Fuck You Want To Public License)
    // @contributor satyr https://gist.github.com/107780
    // @contributor saitamanodoruji https://gist.github.com/2653937
    @@ -18,6 +18,8 @@

    // http://d.hatena.ne.jp/murky-satyr/20090508/gist_logs
    (function () {
    if (!(/^https:\/\/gist\.github\.com\/\d+/.test(location.href))) return;

    var format = (function () {
    var entity = {
    '<': '&lt;',
    @@ -37,7 +39,7 @@
    style.display = 'none';
    style.marginLeft = '5px';
    style.height = '16px';
    document.querySelector('#revisions h3').appendChild(indicator, null);
    document.querySelector('#revisions h3').appendChild(indicator);

    var timer, threshold = 1500;
    return {
  6. @noromanba noromanba revised this gist Jun 11, 2012. 1 changed file with 27 additions and 1 deletion.
    28 changes: 27 additions & 1 deletion gist-logs.user.js
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    // @namsgpace https://www.hatena.ne.jp/noromanba/
    // @description Show commit logs on Gist for Greasemonkey
    // @include https://gist.github.com/*
    // @version 2012.6.10.21.56
    // @version 2012.6.11
    // @license WTFPL http://sam.zoy.org/wtfpl/ (Do What The Fuck You Want To Public License)
    // @contributor satyr https://gist.github.com/107780
    // @contributor saitamanodoruji https://gist.github.com/2653937
    @@ -30,6 +30,30 @@
    };
    })();

    var feedback = (function () {
    var indicator = document.createElement('img');
    indicator.src = 'https://assets.github.com/images/spinners/octocat-spinner-32.gif';
    var style = indicator.style;
    style.display = 'none';
    style.marginLeft = '5px';
    style.height = '16px';
    document.querySelector('#revisions h3').appendChild(indicator, null);

    var timer, threshold = 1500;
    return {
    show: function () {
    style.display = 'inline-block';
    },
    debounce: function () {
    clearTimeout(timer);
    timer = setTimeout(function () {
    style.display = 'none';
    }, threshold);
    }
    };
    })();

    feedback.show();
    Array.prototype.forEach.call(document.querySelectorAll('#revisions .id'), function (rev, idx) {
    // XXX too much XHR requests!
    // therefore Github block a response: (D)DoS filtering or API constraints => 505 error
    @@ -39,6 +63,8 @@
    method: 'GET',
    url: 'https://raw.github.com/gist' + rev.pathname + '/meta',
    onload: function (res) {
    feedback.debounce();

    var msg = (res.responseText.match(/\n\n([\s\S]*)\n$/m) || [])[1];
    if (!msg) return;

  7. @noromanba noromanba revised this gist Jun 8, 2012. 1 changed file with 21 additions and 19 deletions.
    40 changes: 21 additions & 19 deletions gist-logs.user.js
    Original file line number Diff line number Diff line change
    @@ -3,22 +3,22 @@
    // @namsgpace https://www.hatena.ne.jp/noromanba/
    // @description Show commit logs on Gist for Greasemonkey
    // @include https://gist.github.com/*
    // @version 2012.5.29.14.51
    // @version 2012.6.10.21.56
    // @license WTFPL http://sam.zoy.org/wtfpl/ (Do What The Fuck You Want To Public License)
    // @contributor murky-satyr https://gist.github.com/107780
    // @contributor satyr https://gist.github.com/107780
    // @contributor saitamanodoruji https://gist.github.com/2653937
    // @author noromanba (https://www.hatena.ne.jp/noromanba/)
    // @homepage https://gist.github.com/2669793
    // @icon https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Talk_icon.svg/32px-Talk_icon.svg.png
    // @icon64 https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Talk_icon.svg/64px-Talk_icon.svg.png
    // ==/UserScript==

    // Icon (Public Domain)
    // Icon (Public Domain by Jonathan)
    // https://commons.wikimedia.org/wiki/File:Talk_icon.svg

    // http://d.hatena.ne.jp/murky-satyr/20090508/gist_logs
    (function () {
    var sanitize = (function () {
    var format = (function () {
    var entity = {
    '<': '&lt;',
    '>': '&gt;',
    @@ -30,21 +30,23 @@
    };
    })();

    Array.prototype.forEach.call(document.querySelectorAll('#revisions .id'), function (rev) {
    // XXX too much XHR requests! therefore Github block a response (prob. DDoS filtering) => 505 error
    // better to be one XHR request. but can't get logs from Gist API v1 and v3
    GM_xmlhttpRequest({
    method: 'GET',
    url: 'https://raw.github.com/gist' + rev.pathname + '/meta',
    onload: function (req) {
    var msg = (req.responseText.match(/\n\n([\s\S]*)\n$/m) || [])[1];
    if (!msg) return;
    Array.prototype.forEach.call(document.querySelectorAll('#revisions .id'), function (rev, idx) {
    // XXX too much XHR requests!
    // therefore Github block a response: (D)DoS filtering or API constraints => 505 error
    // better to be a XHR once only. but Gist API v1 and v3 not provide log information
    setTimeout(function () {
    GM_xmlhttpRequest({
    method: 'GET',
    url: 'https://raw.github.com/gist' + rev.pathname + '/meta',
    onload: function (res) {
    var msg = (res.responseText.match(/\n\n([\s\S]*)\n$/m) || [])[1];
    if (!msg) return;

    var container = document.createElement('div');
    container.className = 'log';
    container.innerHTML = msg.replace(/[<>&"\n]/g, sanitize);
    rev.parentNode.appendChild(container);
    }
    });
    var container = document.createElement('div');
    container.innerHTML = msg.replace(/[<>&"\n]/g, format);
    rev.parentNode.appendChild(container);
    }
    });
    }, 1000 * idx);
    });
    })();
  8. @noromanba noromanba revised this gist May 13, 2012. 1 changed file with 42 additions and 33 deletions.
    75 changes: 42 additions & 33 deletions gist-logs.user.js
    Original file line number Diff line number Diff line change
    @@ -1,41 +1,50 @@
    // ==UserScript==
    // @name gist logs
    // @namespace http://d.hatena.ne.jp/murky-satyr
    // @description Shows commit logs on Gist.
    // @namsgpace https://www.hatena.ne.jp/noromanba/
    // @description Show commit logs on Gist for Greasemonkey
    // @include https://gist.github.com/*
    // @version 2012.5.1.0.31
    // @homepage
    // @downloadURL
    // @installURL
    // @updateURL
    // @license Unknown (as-is)
    // @copyright
    // @author noromanba
    // @contributor murky-satyr
    // @contributor saitamanodoruji
    // @contributor noromanba (https://www.hatena.ne.jp/noromanba/)
    // @icon
    // @icon64
    // @version 2012.5.29.14.51
    // @license WTFPL http://sam.zoy.org/wtfpl/ (Do What The Fuck You Want To Public License)
    // @contributor murky-satyr https://gist.github.com/107780
    // @contributor saitamanodoruji https://gist.github.com/2653937
    // @author noromanba (https://www.hatena.ne.jp/noromanba/)
    // @homepage https://gist.github.com/2669793
    // @icon https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Talk_icon.svg/32px-Talk_icon.svg.png
    // @icon64 https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Talk_icon.svg/64px-Talk_icon.svg.png
    // ==/UserScript==

    // Icon (Public Domain)
    // https://commons.wikimedia.org/wiki/File:Talk_icon.svg

    function $(expression, context) {
    return Array.prototype.slice.call((context||document).querySelectorAll(expression))
    }
    // http://d.hatena.ne.jp/murky-satyr/20090508/gist_logs
    (function () {
    var sanitize = (function () {
    var entity = {
    '<': '&lt;',
    '>': '&gt;',
    '&': '&amp;',
    '"': '&quot;'
    };
    return function (captured) {
    return (/\n/.test(captured)) ? '<br>' : entity[captured];
    };
    })();

    $('#revisions .id').forEach(get)
    Array.prototype.forEach.call(document.querySelectorAll('#revisions .id'), function (rev) {
    // XXX too much XHR requests! therefore Github block a response (prob. DDoS filtering) => 505 error
    // better to be one XHR request. but can't get logs from Gist API v1 and v3
    GM_xmlhttpRequest({
    method: 'GET',
    url: 'https://raw.github.com/gist' + rev.pathname + '/meta',
    onload: function (req) {
    var msg = (req.responseText.match(/\n\n([\s\S]*)\n$/m) || [])[1];
    if (!msg) return;

    function get(a) {
    GM_xmlhttpRequest({
    method: 'get',
    url: 'https://raw.github.com/gist'
    + a.pathname
    + '/meta',
    onload: function(r) {
    var mes = document.createElement('div')
    mes.className = 'log'
    mes.innerHTML = r.responseText.match(/\n\n[\s\S]*$/m)[0]
    a.parentNode.appendChild(mes)
    }
    })
    }
    var container = document.createElement('div');
    container.className = 'log';
    container.innerHTML = msg.replace(/[<>&"\n]/g, sanitize);
    rev.parentNode.appendChild(container);
    }
    });
    });
    })();
  9. @noromanba noromanba revised this gist May 13, 2012. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions gist-logs.user.js
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,22 @@
    // @namespace http://d.hatena.ne.jp/murky-satyr
    // @description Shows commit logs on Gist.
    // @include https://gist.github.com/*
    // @version 2012.5.1.0.31
    // @homepage
    // @downloadURL
    // @installURL
    // @updateURL
    // @license Unknown (as-is)
    // @copyright
    // @author noromanba
    // @contributor murky-satyr
    // @contributor saitamanodoruji
    // @contributor noromanba (https://www.hatena.ne.jp/noromanba/)
    // @icon
    // @icon64
    // ==/UserScript==


    function $(expression, context) {
    return Array.prototype.slice.call((context||document).querySelectorAll(expression))
    }
  10. @noromanba noromanba renamed this gist May 13, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  11. @saitamanodoruji saitamanodoruji revised this gist May 10, 2012. 1 changed file with 18 additions and 9 deletions.
    27 changes: 18 additions & 9 deletions gist_logs.user.js
    Original file line number Diff line number Diff line change
    @@ -4,15 +4,24 @@
    // @description Shows commit logs on Gist.
    // @include https://gist.github.com/*
    // ==/UserScript==
    var {$} = unsafeWindow
    $ && setTimeout(function(){
    $('#revisions .id').each(function() setTimeout(get, 0, this))
    })
    function get(a){

    function $(expression, context) {
    return Array.prototype.slice.call((context||document).querySelectorAll(expression))
    }

    $('#revisions .id').forEach(get)

    function get(a) {
    GM_xmlhttpRequest({
    method: 'get', url: 'https://raw.github.com/gist'+ a.pathname +'/meta',
    onload: function(r)
    /\n\n/.test(r.responseText) &&
    $('<div class="log">').text(RegExp["$'"]).appendTo(a.parentNode),
    method: 'get',
    url: 'https://raw.github.com/gist'
    + a.pathname
    + '/meta',
    onload: function(r) {
    var mes = document.createElement('div')
    mes.className = 'log'
    mes.innerHTML = r.responseText.match(/\n\n[\s\S]*$/m)[0]
    a.parentNode.appendChild(mes)
    }
    })
    }
  12. @satyr satyr revised this gist Jul 8, 2011. 1 changed file with 11 additions and 13 deletions.
    24 changes: 11 additions & 13 deletions gist_logs.user.js
    Original file line number Diff line number Diff line change
    @@ -2,19 +2,17 @@
    // @name gist logs
    // @namespace http://d.hatena.ne.jp/murky-satyr
    // @description Shows commit logs on Gist.
    // @include http://gist.github.com/*
    // @include https://gist.github.com/*
    // ==/UserScript==
    var {$} = unsafeWindow;
    var {$} = unsafeWindow
    $ && setTimeout(function(){
    $('#revisions .id').each(function(){
    $.ajax({
    url: '//'+ this.hostname +'/raw'+ this.pathname +'/meta',
    success: setlog, a: this,
    });
    });
    function setlog(txt){
    /\n\n/.test(txt) &&
    $('<div class="log">').text(RegExp["$'"]).appendTo(this.a.parentNode);
    }
    });
    $('#revisions .id').each(function() setTimeout(get, 0, this))
    })
    function get(a){
    GM_xmlhttpRequest({
    method: 'get', url: 'https://raw.github.com/gist'+ a.pathname +'/meta',
    onload: function(r)
    /\n\n/.test(r.responseText) &&
    $('<div class="log">').text(RegExp["$'"]).appendTo(a.parentNode),
    })
    }
  13. @satyr satyr revised this gist Apr 30, 2010. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gist_logs.user.js
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ var {$} = unsafeWindow;
    $ && setTimeout(function(){
    $('#revisions .id').each(function(){
    $.ajax({
    url: this.href.replace(/^https/, '').replace(/com/, '$&/raw'),
    url: '//'+ this.hostname +'/raw'+ this.pathname +'/meta',
    success: setlog, a: this,
    });
    });
  14. @satyr satyr revised this gist Mar 3, 2010. 1 changed file with 10 additions and 4 deletions.
    14 changes: 10 additions & 4 deletions gist_logs.user.js
    Original file line number Diff line number Diff line change
    @@ -6,9 +6,15 @@
    // @include https://gist.github.com/*
    // ==/UserScript==
    var {$} = unsafeWindow;
    $ && $('#revisions .id').each(function(i, a){
    $.get(a.href.replace(/com/, '$&/raw'), function(txt){
    /\n\n/.test(txt) &&
    $('<div>').text(RegExp.rightContext).appendTo(a.parentNode);
    $ && setTimeout(function(){
    $('#revisions .id').each(function(){
    $.ajax({
    url: this.href.replace(/^https/, '').replace(/com/, '$&/raw'),
    success: setlog, a: this,
    });
    });
    function setlog(txt){
    /\n\n/.test(txt) &&
    $('<div class="log">').text(RegExp["$'"]).appendTo(this.a.parentNode);
    }
    });
  15. @satyr satyr revised this gist Jan 28, 2010. 1 changed file with 4 additions and 7 deletions.
    11 changes: 4 additions & 7 deletions gist_logs.user.js
    Original file line number Diff line number Diff line change
    @@ -6,12 +6,9 @@
    // @include https://gist.github.com/*
    // ==/UserScript==
    var {$} = unsafeWindow;
    $ && $('#revisions')[0] && $(function(){
    $('.id').each(function(){
    var a = this;
    $.get(a.href.replace(/com/, '$&/raw'), function(txt){
    /\n\n[^]+/.test(txt) &&
    $(a.parentNode).append(<div>{RegExp.lastMatch}</div>.toXMLString());
    });
    $ && $('#revisions .id').each(function(i, a){
    $.get(a.href.replace(/com/, '$&/raw'), function(txt){
    /\n\n/.test(txt) &&
    $('<div>').text(RegExp.rightContext).appendTo(a.parentNode);
    });
    });
  16. @satyr satyr revised this gist May 12, 2009. 1 changed file with 6 additions and 8 deletions.
    14 changes: 6 additions & 8 deletions gist_logs.user.js
    100644 → 100755
    Original file line number Diff line number Diff line change
    @@ -7,13 +7,11 @@
    // ==/UserScript==
    var {$} = unsafeWindow;
    $ && $('#revisions')[0] && $(function(){
    (function glog(ids){
    var a = ids.shift();
    a && $.get(a.href.replace(/com/, '$&/raw'), function(txt){
    var log = /\n\n[^]+/(txt);
    if(!log) return;
    $(a.parentNode).append('<div>'+ log +'</div>');
    glog(ids);
    $('.id').each(function(){
    var a = this;
    $.get(a.href.replace(/com/, '$&/raw'), function(txt){
    /\n\n[^]+/.test(txt) &&
    $(a.parentNode).append(<div>{RegExp.lastMatch}</div>.toXMLString());
    });
    })($('.id').get())
    });
    });
  17. @satyr satyr created this gist May 6, 2009.
    19 changes: 19 additions & 0 deletions gist_logs.user.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    // ==UserScript==
    // @name gist logs
    // @namespace http://d.hatena.ne.jp/murky-satyr
    // @description Shows commit logs on Gist.
    // @include http://gist.github.com/*
    // @include https://gist.github.com/*
    // ==/UserScript==
    var {$} = unsafeWindow;
    $ && $('#revisions')[0] && $(function(){
    (function glog(ids){
    var a = ids.shift();
    a && $.get(a.href.replace(/com/, '$&/raw'), function(txt){
    var log = /\n\n[^]+/(txt);
    if(!log) return;
    $(a.parentNode).append('<div>'+ log +'</div>');
    glog(ids);
    });
    })($('.id').get())
    });