Gi+ git clone

    @@ -1,6 +1,6 @@ /* - * @title G +git:// - * @description append git-protocal (git://) on Gist + * @title Gi+ git clone + * @description append ssh-protocol for clone on Gist * @include https://gist.github.com/* * @contributor xtetsuji http://let.hatelabo.jp/xtetsuji/let/hJmcxdPpvrF- (Fork of) * @contributor noromanba http://let.hatelabo.jp/noromanba/let/hJmcxq3wlKcE @@ -10,20 +10,26 @@ (function () { var id = (location.pathname.match(/\/.*\/(\w+)/) || [])[1], - container = document.querySelector('.export-references'); - if (!id || !container) return; + parent = document.querySelector('.export-references'); + if (!id || !parent) return; - var gpField = document.createElement("li"); + var container = document.createElement('li'); - // TODO omit innerHTML - gpField.innerHTML = [ - '<label for="x-git-clone-field">', - '<strong>Git Clone</strong> this gist', - '</label>', - '<input type="text" readonly spellcheck="false" class="url-field js-url-field"', - 'name="x-git-clone-field"', - 'value="git clone git@github.com:', id, '.git">' - ].join(''); + var label = document.createElement('label'); + var what = document.createElement('strong'); + what.textContent = 'Git Clone'; + label.appendChild(what); + label.appendChild(document.createTextNode(' this gist')); + container.appendChild(label); - container.appendChild(gpField); + var gc = document.createElement('input'); + gc.type = 'text'; + gc.readOnly = true; + gc.spellcheck = false; + gc.className = 'url-field js-url-field'; + gc.name = 'x-git-clone-field'; + gc.value = 'git clone git@github.com:' + id + '.git'; // TBD git:// + container.appendChild(gc); + + parent.appendChild(container); })();
  • /*
     * @title Gi+ git clone
     * @description append ssh-protocol for clone on Gist
     * @include https://gist.github.com/*
     * @contributor xtetsuji  http://let.hatelabo.jp/xtetsuji/let/hJmcxdPpvrF- (Fork of)
     * @contributor noromanba http://let.hatelabo.jp/noromanba/let/hJmcxq3wlKcE
     * @license MIT License http://opensource.org/licenses/MIT
     * @javascript_url
     */
    
    (function () {
      var id = (location.pathname.match(/\/.*\/(\w+)/) || [])[1],
          parent = document.querySelector('.export-references');
      if (!id || !parent) return;
    
      var container = document.createElement('li');
    
      var label = document.createElement('label');
      var what = document.createElement('strong');
      what.textContent = 'Git Clone';
      label.appendChild(what);
      label.appendChild(document.createTextNode(' this gist'));
      container.appendChild(label);
    
      var gc = document.createElement('input');
      gc.type = 'text';
      gc.readOnly = true;
      gc.spellcheck = false;
      gc.className = 'url-field js-url-field';
      gc.name = 'x-git-clone-field';
      gc.value = 'git clone git@github.com:' + id + '.git'; // TBD git://
      container.appendChild(gc);
    
      parent.appendChild(container);
    })();
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2013/11/08 00:29:45 - 2013-11-08
  2. 2013/11/07 23:42:27 - 2013-11-07
  3. 2013/11/07 23:01:20 - 2013-11-07