diff --git a/css/main.css b/css/main.css index f76c2dd..aa5409c 100644 --- a/css/main.css +++ b/css/main.css @@ -1,3 +1,14 @@ +/* General */ +.error { + border: 1px solid red; + border-radius: 3px; + background-color: rgba(255, 0, 0, 0.5); + padding: 5px; + font-size: 2em; + font-family: "Helvetica", Arial, sans-serif; +} + +/* Editor */ .invalid { background-color: red; color: white !important; @@ -13,11 +24,24 @@ height: 100%; } -.error { - border: 1px solid red; - border-radius: 3px; - background-color: rgba(255, 0, 0, 0.5); - padding: 5px; - font-size: 2em; - font-family: "Helvetica", Arial, sans-serif; +/* Index */ +.prev-list { + padding: 0px; + margin: 0px; +} + +.prev-list > li { + display: inline-block; + width: 30%; + list-style: none; + margin: 5px; + padding: 5px; + border: #CCC 1px solid; + border-radius: 3px; +} + +.prev-list > li > a, +.prev-list > li > a:visited { + text-decoration: none; + color: blue; } diff --git a/index.html b/index.html index 1ddfaf4..58bb225 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,14 @@
+ +

Previous Repos

+
+ +
+ +

New Repo


@@ -21,10 +28,11 @@

- +
+ diff --git a/js/index.js b/js/index.js index 1842548..38cbec9 100644 --- a/js/index.js +++ b/js/index.js @@ -1,3 +1,27 @@ +let prevRepoList = $("#prev-repos"); + +localforage.keys() + .then((keys) => { + return keys.filter((el) => { + return el != "theme"; + }); + }) + .then((repos) => { + repos.forEach((el) => { + let li = $("
  • "); + let a = $(""); + a.attr("href", `/repo.html#${el}`); + let div = $("
    "); + div.text(el); + a.append(div); + li.append(a); + prevRepoList.append(li); + }); + }) + .catch((e) => { + throw e; + }); + $("#form").submit((event) => { event.preventDefault(); diff --git a/js/repo.js b/js/repo.js new file mode 100644 index 0000000..dc68d5b --- /dev/null +++ b/js/repo.js @@ -0,0 +1,25 @@ +let repo = window.location.hash.substring(1); + +localforage.getItem(repo) + .then((val) => { + for (var f in val) { + let li = $("
  • "); + let a = $(""); + a.attr("href", `/type.html#${repo}/${f}`); + let div = $("
    "); + div.text(f); + a.append(div); + li.append(a); + $("#prev-files").append(li); + } + }) + .catch((e) => { + throw e; + }); + +$("#form").submit((event) => { + event.preventDefault(); + + let file = $("#file").val(); + window.location.href = `/type.html#${repo}/${file}`; +}); diff --git a/repo.html b/repo.html new file mode 100644 index 0000000..f194df2 --- /dev/null +++ b/repo.html @@ -0,0 +1,35 @@ + + + + + Type + + + + + + +

    + +

    Previous Files

    +
    + +
    + +

    New File

    +
    + +
    + +
    + + + + + +