type/js/index.js

39 lines
722 B
JavaScript
Raw Normal View History

2016-10-02 14:34:57 +00:00
let prevRepoList = $("#prev-repos");
localforage.keys()
.then((keys) => {
return keys.filter((el) => {
return el != "theme";
});
})
.then((repos) => {
repos.forEach((el) => {
let li = $("<li></li>");
let a = $("<a></a>");
a.attr("href", `/repo.html#${el}`);
let div = $("<div></div>");
div.text(el);
a.append(div);
li.append(a);
prevRepoList.append(li);
});
})
.catch((e) => {
throw e;
});
2016-10-01 15:26:40 +00:00
$("#form").submit((event) => {
event.preventDefault();
let repo = $("#repo").val();
let branch = $("#branch").val();
2016-10-02 15:06:41 +00:00
localforage.setItem(`${repo}/${branch}`, {})
.then(() => {
window.location.href = `/repo.html#${repo}/${branch}`;
})
.catch((e) => {
throw e;
});
2016-10-01 15:26:40 +00:00
});