forked from rDrama/rDrama
add gif button to award modal
parent
a57016b1ad
commit
ef4096b849
|
@ -27,8 +27,8 @@ gifModal.addEventListener('shown.bs.modal', function () {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
async function show_gif_categories(form) {
|
async function show_gif_categories(t, form) {
|
||||||
commentFormID = form;
|
if (form) commentFormID = form;
|
||||||
|
|
||||||
gifSearchBar.value = null;
|
gifSearchBar.value = null;
|
||||||
noGIFs.classList.add("d-none");
|
noGIFs.classList.add("d-none");
|
||||||
|
@ -112,14 +112,22 @@ async function show_gif_categories(form) {
|
||||||
element.addEventListener('click', () => {searchGifs(element.firstElementChild.innerHTML)});
|
element.addEventListener('click', () => {searchGifs(element.firstElementChild.innerHTML)});
|
||||||
}
|
}
|
||||||
|
|
||||||
gifModal.addEventListener('hide.bs.modal', () => {
|
if (t) {
|
||||||
setTimeout(() => {
|
if (t.dataset.previousModal) {
|
||||||
document.getElementById(commentFormID).focus();
|
gifModal.addEventListener('hide.bs.modal', () => {
|
||||||
}, 200);
|
bootstrap.Modal.getOrCreateInstance(document.getElementById(t.dataset.previousModal)).show()
|
||||||
}, {once : true});
|
}, {once : true});
|
||||||
|
}
|
||||||
|
|
||||||
|
gifModal.addEventListener('hide.bs.modal', () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
document.getElementById(commentFormID).focus();
|
||||||
|
}, 200);
|
||||||
|
}, {once : true});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('gifs-back-btn').addEventListener('click', show_gif_categories);
|
document.getElementById('gifs-back-btn').addEventListener('click', () => show_gif_categories(null, null));
|
||||||
|
|
||||||
async function searchGifs(searchTerm) {
|
async function searchGifs(searchTerm) {
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
<label id="notelabel" for="note" class="pt-4">Note (optional):</label>
|
<label id="notelabel" for="note" class="pt-4">Note (optional):</label>
|
||||||
<textarea autocomplete="off" id="note" maxlength="200" class="form-control" placeholder="Note to include in award notification..."></textarea>
|
<textarea autocomplete="off" id="note" maxlength="200" class="form-control" placeholder="Note to include in award notification..."></textarea>
|
||||||
{{macros.emoji_btn('note', 'awardModal')}}
|
{{macros.emoji_btn('note', 'awardModal')}}
|
||||||
|
{{macros.gif_btn('note', 'awardModal')}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input autocomplete="off" id="giveaward" class="awardbtn btn btn-primary mt-3 fl-r" type="submit" data-nonce="{{g.nonce}}" data-onclick="giveaward(this)" value="Give Award" data-bs-dismiss="modal" disabled>
|
<input autocomplete="off" id="giveaward" class="awardbtn btn btn-primary mt-3 fl-r" type="submit" data-nonce="{{g.nonce}}" data-onclick="giveaward(this)" value="Give Award" data-bs-dismiss="modal" disabled>
|
||||||
|
|
|
@ -114,8 +114,8 @@
|
||||||
</button>
|
</button>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro gif_btn(textarea_id) %}
|
{% macro gif_btn(textarea_id, previous_modal) %}
|
||||||
<button type="button" class="btn btn-secondary format m-0 mr-1 font-weight-bolder text-uppercase" data-nonce="{{g.nonce}}" data-onclick="show_gif_categories('{{textarea_id}}')" data-bs-toggle="modal" data-bs-target="#gifModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add GIF">GIF</button>
|
<button type="button" class="btn btn-secondary format m-0 mr-1 font-weight-bolder text-uppercase" data-nonce="{{g.nonce}}" data-onclick="show_gif_categories(this, '{{textarea_id}}')" data-bs-toggle="modal" data-bs-target="#gifModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add GIF" {% if previous_modal %}data-previous-modal="{{previous_modal}}"{% endif %}>GIF</button>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro file_btn(input_id, disabled, image_only) %}
|
{% macro file_btn(input_id, disabled, image_only) %}
|
||||||
|
|
Loading…
Reference in New Issue