-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
58 lines (54 loc) · 1.9 KB
/
index.html
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
<html>
<head>
<meta charset="UTF-8" />
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'" /> -->
<title>Powershell Profile Manager</title>
<meta author="Nikhil Swami" profile="https://www.linkedin.com/in/nikhilswamiofficial/" />
<link rel="stylesheet" href="./assets/bs5.css" />
<link rel="stylesheet" href="./assets/jquery-ui.css" />
<link rel="stylesheet" href="./assets/styles.css" />
<style></style>
<script src="./assets/jquery-3.6.0.js"></script>
<script src="./assets/jquery-ui.js"></script>
</head>
<body class="p-3">
<div class="row d-flex align-items-start">
<div class="col">
<h1>Profiles</h1>
</div>
<div class="col-auto ms-auto">
<button class="btn btn-sm button" onclick="setProfiles()">Save</button>
</div>
</div>
<ul id="profile-list"></ul>
</body>
<script>
profiles = [];
getProfiles = async () => {
profiles = await pywebview.api.get_profiles();
console.log(profiles);
profiles.forEach((profile) => {
$('#profile-list').append(`<li class="profile ui-state-default rounded-2 p-2 mt-1 ${profile.hidden ? 'profile-hidden' : ''}">${profile.name}</li>`);
});
};
setProfiles = async () => {
// check with name of list and sort
currentProfilesOrder = [];
$('#profile-list li').each((index, element) => {
currentProfilesOrder.push($(element).text());
});
console.log(currentProfilesOrder);
await pywebview.api.set_profiles(currentProfilesOrder);
};
// add jquery event listener
$(window).on('pywebviewready', getProfiles);
$(function () {
$('#profile-list').sortable({
stop: function (event, ui) {
console.log('stopped');
},
});
});
// $('button').click(() => $('button').toggleClass('btn-success btn-danger'));
</script>
</html>