auto suggest orgy title
parent
3fdd5f58cd
commit
d64a72cdc5
|
@ -13,3 +13,23 @@ document.addEventListener('keydown', (e) => {
|
|||
|
||||
document.getElementById('start-orgy').click();
|
||||
});
|
||||
|
||||
|
||||
function autoSuggestTitle() {
|
||||
const urlField = document.getElementById("link");
|
||||
const titleField = document.getElementById("title");
|
||||
const isValidURL = urlField.checkValidity();
|
||||
|
||||
if (isValidURL && urlField.value.length > 0 && titleField.value === "") {
|
||||
const x = new XMLHttpRequest();
|
||||
x.onreadystatechange = function() {
|
||||
if (x.readyState == 4 && x.status == 200 && !titleField.value) {
|
||||
title = JSON.parse(x.responseText)["title"];
|
||||
titleField.value = title;
|
||||
}
|
||||
}
|
||||
x.open('get','/submit/title?url=' + urlField.value);
|
||||
x.setRequestHeader('xhr', 'xhr');
|
||||
x.send(null);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<label for="link">Link (youtube, twitch, rumble, mp4 file)</label>
|
||||
</div>
|
||||
<div class="body w-lg-100">
|
||||
<input id="link" autocomplete="off" type="text" name="link" class="form-control" placeholder="Required">
|
||||
<input id="link" autocomplete="off" type="text" name="link" class="form-control" placeholder="Required" data-nonce="{{g.nonce}}" data-oninput="autoSuggestTitle()">
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-lg-flex border-bottom mt-3">
|
||||
|
|
Loading…
Reference in New Issue