type/js/repo.js

26 lines
514 B
JavaScript
Raw Normal View History

2016-10-02 14:34:57 +00:00
let repo = window.location.hash.substring(1);
localforage.getItem(repo)
.then((val) => {
for (var f in val) {
let li = $("<li></li>");
let a = $("<a></a>");
a.attr("href", `/type.html#${repo}/${f}`);
let div = $("<div></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}`;
});