blob: 8d812060375a35b238b11004fd60f05e7971f662 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// @author rubenwardy
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
$(function() {
function finish() {
$(".pkg_wiz_1").hide()
$(".pkg_wiz_2").hide()
$(".pkg_repo").show()
$(".pkg_meta").show()
}
function repoIsSupported(url) {
// try {
// return URI(url).hostname() == "github.com"
// } catch(e) {
// return false
// }
return true
}
$(".pkg_meta").hide()
$(".pkg_wiz_1").show()
$("#pkg_wiz_1_next").click(function() {
const repoURL = $("#repo").val();
if (repoIsSupported(repoURL)) {
$(".pkg_wiz_1").hide()
$(".pkg_wiz_2").show()
$(".pkg_repo").hide()
function setSpecial(id, value) {
if (value != "") {
var ele = $(id);
ele.val(value);
ele.trigger("change")
}
}
performTask("/tasks/getmeta/new/?url=" + encodeURI(repoURL)).then(function(result) {
$("#name").val(result.name || "")
setSpecial("#provides_str", result.provides || "")
$("#title").val(result.title || "")
$("#repo").val(result.repo || repoURL)
$("#issueTracker").val(result.issueTracker || "")
$("#desc").val(result.description || "")
$("#shortDesc").val(result.short_description || "")
setSpecial("#harddep_str", result.depends || "")
setSpecial("#softdep_str", result.optional_depends || "")
$("#shortDesc").val(result.short_description || "")
if (result.forumId) {
$("#forums").val(result.forumId)
}
finish()
}).catch(function(e) {
alert(e)
$(".pkg_wiz_1").show()
$(".pkg_wiz_2").hide()
$(".pkg_repo").show()
// finish()
})
} else {
finish()
}
})
})
|