learn-request-queue/views/main.eta

117 lines
4.6 KiB
Plaintext

<!DOCTYPE html>
<html>
<head>
<link rel=stylesheet href=style.css />
<title><%= it.streamerName %>'s Learn Request Queue</title>
<script>
window.loggedIn = <%= it.loggedIn %>;
window.validStates = <%~ it.validStates %>;
window.isStreamer = <%= it.isStreamer %>;
</script>
<script src="main.js" defer></script>
</head>
<body>
<div id="navbar">
<div id="nav-streamerpic"><a href="https://twitch.tv/<%= it.streamerName %>"><img src="<%= it.streamerProfilePicture %>" /></a></div>
<div id="nav-title"><a href="https://twitch.tv/<%= it.streamerName %>"><%= it.streamerName %></a>'s Learn Request Queue</div>
<div id="nav-requests"><a href="/">Requests</a></div>
<%- if (it.loggedIn) { -%>
<div id="nav-addrequest"><a href="#" onclick="openAddRequestModal()">Add Request</a></div>
<div id="nav-userpic"><img src="<%= it.userProfilePicture %>" /></div>
<div id="nav-username"><%= it.userName %></div>
<div id="nav-logout"><a href="/logout">Logout</a></div>
<%- } else { // Not logged in -%>
<div id="nav-login"><a href="https://id.twitch.tv/oauth2/authorize?client_id=<%=it.clientId%>&redirect_uri=<%=it.urlPrefix%>/callback&response_type=code">Login</a></div>
<%- } %>
</div>
<div id="main">
<div id="requests"></div><br>
Count:
<select id="count" value="10" onchange="updateTable()">
<option>5</option>
<option selected="selected">10</option>
<option>25</option>
<option>50</option>
<option>100</option>
</select>
<input type="checkbox" id="allRequests" onchange="updateTable()">View requests in any state</input>
</div>
<div id="modalBackground">
<div class="modal" id="messageModal">
<div class="modalClose"><a href="#" onclick="closeMessageModal()">&times;</a></div>
<span id="messageModalText"></span>
</div>
<div class="modal" id="addRequestModal">
<div class="modalClose"><a href="#" onclick="closeAddRequestModal()">&times;</a></div>
<h1>Add Request</h1>
<div class="error" id="addRequestError"></div>
<span id="addRequestInputContainer">
URL: <input id="addRequestUrl" placeholder="https://www.youtube.com/watch?v=dQw4w9WgXcQ"></input>
<button onclick="validateAndSubmitRequest()">Request</button><br>
</span>
Currently, only Youtube links are accepted.
</div>
<div class="modal" id="updateRequestModal">
<div class="modalClose"><a href="#" onclick="closeAddRequestModal()">&times;</a></div>
<h2>Update Request</h2>
<div class="error" id="updateRequestError"></div>
<br>
<a id="updateRequestUrl"></a>
<br>
Current Score: <span id="updateRequestModalCurrentScore"></span>
<hr>
<div>
State:
<select id="updateRequestStateSelect" onchange="updateRequestState(
document.getElementById('updateRequestUrl').innerText,
this.value)">Submit</button>
)"></select>
</div>
<br>
<div>
Modify Score:
<input type="number" id="scoreModifierInput"></input>
<button onclick="updateRequestScoreModifier(
document.getElementById('updateRequestUrl').innerText,
document.getElementById('scoreModifierInput').value)">Submit</button>
<br>
<span id="scoreModifierHelp" class="helptext">
Enter a number to add to (or negative to subtract from) the score of
a request. Use this for things like donations and channel points
redemptions.
</span>
</div>
<br>
<div>
<a id="updateMetadataLink" href="#" onclick="updateRequestMetadata(
document.getElementById('updateRequestUrl').innerText
)">Update Request Metadata</a>
<br>
<span id="updateMetadataHelp" class="helptext">
Use this to update metadata about a request (i.e. title) if it
is missing (shows URL instead of name) or is outdated.
</span>
</div>
<br>
<div>
<a id="deleteRequestLink" href="#" onclick="openDeleteRequestModal(
document.getElementById('updateRequestUrl').innerText
)">Delete Request</a>
</div>
</div>
<div class="modal" id="deleteRequestModal">
<div class="modalClose"><a href="#" onclick="closeDeleteRequestModal()">&times;</a></div>
<h2>Delete Request</h2>
<span style="color: #f00">WARNING:</span>
Deleting a request will remove the request and all votes for it from the
database. This action is irreversible. It will NOT prevent the request
from being made again - use the Rejected state for that. Are you sure
you want to delete this request?
<br><br>
<button onclick="closeDeleteRequestModal()">No</button>
<button onclick="deleteRequest(document.getElementById('updateRequestUrl').innerText)">Yes</button>
</div>
</div>
</body>
</html>