Skip to content

Instantly share code, notes, and snippets.

@ecasilla
Created May 14, 2016 22:21
Show Gist options
  • Save ecasilla/0a70c16518aaed50a534bfa2bce750b0 to your computer and use it in GitHub Desktop.
Save ecasilla/0a70c16518aaed50a534bfa2bce750b0 to your computer and use it in GitHub Desktop.

Revisions

  1. ecasilla created this gist May 14, 2016.
    21 changes: 21 additions & 0 deletions extract.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@

    // eg https://github.com/cssnext/cssnext/labels
    // paste this script in your console
    // copy the output and now you can import it using https://github.com/ecasilla/github-labelmaker !


    var labels = [].slice.call(document.querySelectorAll(".label-link"))
    .map(function(ele) {
    return {
    name: ele.textContent.trim(),
    color: ele.getAttribute("style")
    .replace("background-color:", "")
    .replace(/color:.*/,"")
    .trim()
    .replace(/^#/, "")
    .replace(/;$/, "")
    .trim(),
    }
    });

    console.log(JSON.stringify(labels, null, 2));