[
  {
    "path": ".gitignore",
    "content": "*.pyc\nheroku/secret.js\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright (c) 2010, Michael Bostock\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* The name Michael Bostock may not be used to endorse or promote products\n  derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,\nINDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\nBUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\nOF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\nEVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "README.md",
    "content": "# bl.ocks.org Browser Extensions\n\n<http://bl.ocks.org> is a simple Gist viewer for HTML/JavaScript examples.\n\nTo install the **Chrome** extension, visit the [Chrome Web Store](https://chrome.google.com/webstore/detail/blocksorg/phjkbonaifennbfpmieeipknnkhaoiaf) and click *Add to Chrome*.\n\nTo install the **Firefox** extension, visit the [Mozilla Add-ons](https://addons.mozilla.org/en-US/firefox/addon/blocksorg/). Then click *Add to Firefox*.\n\nA **Safari** extension is no longer supported because Apple requires a $99 per year fee to obtain a developer certificate. Please don’t use Safari.\n"
  },
  {
    "path": "chrome/bl.ocks.chrome/blocks.js",
    "content": "var observer = new MutationObserver(redraw);\n\nobserver.observe(document.documentElement, {childList: true, subtree: true});\n\nredraw();\n\nfunction redraw() {\n  var container = document.querySelector(\".file-navigation-options\");\n  if (!container) return;\n\n  var parts = location.pathname.substring(1).split(\"/\"),\n      user = parts[0],\n      id = parts[1],\n      sha = parts[2];\n  if (!user || user.length > 39 || !/^[a-z0-9](?:-?[a-z0-9])*$/i.test(user)) return;\n  if (!/^([0-9]+|[0-9a-f]{20,})$/.test(id)) id = null;\n  if (!/^[0-9a-f]{40}$/.test(sha)) sha = null;\n\n  var anchor = container.querySelector(\".bl-ocks-button\"),\n      href = \"http://bl.ocks.org/\" + user + (id ? \"/\" + id + (sha ? \"/\" + sha : \"\") : \"\");\n\n  if (!anchor) {\n    var div = document.createElement(\"div\");\n    div.className = \"file-navigation-option\";\n    anchor = div.appendChild(document.createElement(\"a\"));\n    anchor.className = \"btn btn-sm bl-ocks-button\";\n    var svg = anchor.appendChild(document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\"));\n    svg.setAttribute(\"class\", \"octicon octicon-link-external\");\n    svg.setAttribute(\"height\", 16);\n    svg.setAttribute(\"width\", 12);\n    var path = svg.appendChild(document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\"));\n    path.setAttribute(\"d\", \"M11 10h1v3c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V3c0-0.55 0.45-1 1-1h3v1H1v10h10V10zM6 2l2.25 2.25-3.25 3.25 1.5 1.5 3.25-3.25 2.25 2.25V2H6z\");\n    anchor.appendChild(document.createTextNode(\" bl.ocks\"));\n\n    // Disconnect to avoid observing our own mutations.\n    observer.disconnect();\n    container.appendChild(div);\n    observer.observe(document.documentElement, {childList: true, subtree: true});\n  }\n\n  if (anchor.href !== href) {\n    anchor.href = href;\n  }\n}\n"
  },
  {
    "path": "chrome/bl.ocks.chrome/manifest.json",
    "content": "{\n  \"manifest_version\": 2,\n  \"name\": \"bl.ocks.org\",\n  \"version\": \"1.3.10\",\n  \"short_name\": \"bl.ocks\",\n  \"description\": \"View any gist on bl.ocks.org.\",\n  \"icons\": {\"128\": \"icon-128.png\"},\n  \"content_scripts\": [\n    {\n      \"matches\": [\"https://gist.github.com/*\"],\n      \"js\": [\"blocks.js\"],\n      \"run_at\": \"document_end\"\n    }\n  ]\n}\n"
  },
  {
    "path": "firefox/build.sh",
    "content": "#/bin/bash\n\nrm -f bl.ocks.firefox.xpi\nzip bl.ocks.firefox.xpi chrome.manifest content/blocks.js content/blocks.xul install.rdf\n"
  },
  {
    "path": "firefox/chrome.manifest",
    "content": "content\tbl.ocks.org\tcontent/\ncontent\tbl.ocks.org\tcontent/ contentaccessible=yes\noverlay chrome://browser/content/browser.xul chrome://bl.ocks.org/content/blocks.xul\n"
  },
  {
    "path": "firefox/content/blocks.js",
    "content": "window.addEventListener(\"load\", function load() {\n  window.removeEventListener(\"load\", load, false);\n  gBrowser.addEventListener(\"DOMContentLoaded\", function(e) {\n    var document = e.originalTarget;\n    if (document.location.hostname !== \"gist.github.com\") return;\n    var observer = new MutationObserver(redraw);\n\n    observer.observe(document.documentElement, {childList: true, subtree: true});\n\n    redraw();\n\n    function redraw() {\n      var container = document.querySelector(\".file-navigation-options\");\n      if (!container) return;\n\n      var parts = document.location.pathname.substring(1).split(\"/\"),\n          user = parts[0],\n          id = parts[1],\n          sha = parts[2];\n      if (!user || user.length > 39 || !/^[a-z0-9](?:-?[a-z0-9])*$/i.test(user)) return;\n      if (!/^([0-9]+|[0-9a-f]{20,})$/.test(id)) id = null;\n      if (!/^[0-9a-f]{40}$/.test(sha)) sha = null;\n\n      var anchor = container.querySelector(\".bl-ocks-button\"),\n          href = \"http://bl.ocks.org/\" + user + (id ? \"/\" + id + (sha ? \"/\" + sha : \"\") : \"\");\n\n      if (!anchor) {\n        var div = document.createElement(\"div\");\n        div.className = \"file-navigation-option\";\n        anchor = div.appendChild(document.createElement(\"a\"));\n        anchor.className = \"btn btn-sm bl-ocks-button\";\n        var svg = anchor.appendChild(document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\"));\n        svg.setAttribute(\"class\", \"octicon octicon-link-external\");\n        svg.setAttribute(\"height\", 16);\n        svg.setAttribute(\"width\", 12);\n        var path = svg.appendChild(document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\"));\n        path.setAttribute(\"d\", \"M11 10h1v3c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V3c0-0.55 0.45-1 1-1h3v1H1v10h10V10zM6 2l2.25 2.25-3.25 3.25 1.5 1.5 3.25-3.25 2.25 2.25V2H6z\");\n        anchor.appendChild(document.createTextNode(\" bl.ocks\"));\n\n        // Disconnect to avoid observing our own mutations.\n        observer.disconnect();\n        container.appendChild(div);\n        observer.observe(document.documentElement, {childList: true, subtree: true});\n      }\n\n      if (anchor.href !== href) {\n        anchor.href = href;\n      }\n    }\n  }, false);\n}, false);\n"
  },
  {
    "path": "firefox/content/blocks.xul",
    "content": "<?xml version=\"1.0\"?>\n<overlay xmlns=\"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul\">\n  <script type=\"application/x-javascript\" src=\"chrome://bl.ocks.org/content/blocks.js\"/>\n</overlay>\n"
  },
  {
    "path": "firefox/install.rdf",
    "content": "<?xml version=\"1.0\"?>\n<RDF xmlns=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n     xmlns:em=\"http://www.mozilla.org/2004/em-rdf#\">\n  <Description about=\"urn:mozilla:install-manifest\">\n    <em:id>extension@bl.ocks.org</em:id>\n    <em:name>bl.ocks.org</em:name>\n    <em:version>1.3.10</em:version>\n    <em:type>2</em:type>\n    <em:description>View any gist on bl.ocks.org.</em:description>\n    <em:creator>Mike Bostock</em:creator>\n    <em:homepageURL>http://bl.ocks.org/</em:homepageURL>\n    <em:targetApplication>\n      <Description>\n        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>\n        <em:minVersion>3.0</em:minVersion>\n        <em:maxVersion>42.*</em:maxVersion>\n      </Description>\n    </em:targetApplication>\n  </Description>\n</RDF>\n"
  }
]