-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathold-gamepass-config-stuff.ejs
64 lines (62 loc) · 2.82 KB
/
old-gamepass-config-stuff.ejs
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
<% if (isCreator){ %>
<div class="BuyPriceBoxContainer">
<div class="BuyPriceBox">
Item Configuration:
<div id="visibilityBtn"
class="<% if (onSale){ %>btn-danger<%}else{%>btn-primary<%}%> btn-medium">
<% if (onSale){ %>Put OffSale<% }else{ %>Put OnSale<% } %>
</div>
<p> </p>
<form action="/v1/update/item" method="post">
<input type="hidden" name="itemId" value="<%= id %>">
<label for="price">Price:</label>
<input type="number" class="navbar-search-input" style="width: 99%;" name="price" placeholder="Price" value="<%= price %>">
<input type="submit" value="Save"
class="btn-primary btn-medium">
</form>
<script>
const sleep = (milliseconds) => {
return new Promise(resolve => setTimeout(resolve, milliseconds))
}
const visibilityBtn = document.getElementById('visibilityBtn');
visibilityBtn.addEventListener('click', async function() {
let errored = false;
$.ajax({
type: "POST",
url: "/v1/visibiliy/item/toggle",
data: {
itemId: <%= id %>
},
error: function () {
errored = true;
Roblox.GenericConfirmation
.open({
titleText: Roblox
.BuildPage
.Resources
.errorOccurred,
bodyContent: "Could not change item visibility, please try again later.",
acceptText: Roblox
.BuildPage
.Resources
.ok,
acceptColor: Roblox
.GenericConfirmation
.blue,
declineColor: Roblox
.GenericConfirmation
.none,
allowHtmlContentInBody: true,
dismissable: true
});
},
});
await sleep(100);
if (!errored) {
window.location.reload();
}
});
</script>
</div>
</div>
<% } %>