mirror of
https://github.com/rikkaneko/paste.git
synced 2025-06-06 16:45:41 +00:00
Update tos button (web)
Signed-off-by: Joe Ma <rikkaneko23@gmail.com>
This commit is contained in:
parent
2d6f266a98
commit
ca47748164
2 changed files with 14 additions and 6 deletions
|
@ -52,15 +52,18 @@ function validate_url(path) {
|
||||||
return url.protocol === 'http:' || url.protocol === 'https:';
|
return url.protocol === 'http:' || url.protocol === 'https:';
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_pop_alert(message, alert_type = 'alert-primary') {
|
function show_pop_alert(message, alert_type = 'alert-primary', add_classes = null) {
|
||||||
remove_pop_alert();
|
remove_pop_alert();
|
||||||
$('.navbar').after(jQuery.parseHTML(
|
$('.navbar').after(jQuery.parseHTML(
|
||||||
`<div class="alert ${alert_type} alert-dismissible fade show position-absolute top-0 start-50 translate-middle-x"
|
`<div class="alert ${alert_type} alert-dismissible position-absolute fade show top-0 start-50 translate-middle-x"
|
||||||
style="margin-top: 80px; max-width: 500px; width: 80%" id="pop_alert" role="alert"> \
|
style="margin-top: 80px; max-width: 500px; width: 80%" id="pop_alert" role="alert"> \
|
||||||
<div>${message}</div> \
|
<div>${message}</div> \
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> \
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> \
|
||||||
</div>`,
|
</div>`,
|
||||||
));
|
));
|
||||||
|
if (add_classes) {
|
||||||
|
$('.alert').addClass(add_classes);
|
||||||
|
}
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +214,8 @@ $(function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tos_btn.prop('checked')) {
|
if (!tos_btn.prop('checked')) {
|
||||||
show_pop_alert('Please read the TOS before upload', 'alert-warning');
|
show_pop_alert('Please read the team and conditions before upload', 'alert-warning', 'tos-alert');
|
||||||
|
tos_btn.addClass('is-invalid');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,6 +264,11 @@ $(function () {
|
||||||
upload_button.text('Upload');
|
upload_button.text('Upload');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tos_btn.on('click', function () {
|
||||||
|
tos_btn.removeClass('is-invalid');
|
||||||
|
$('.tos-alert').remove();
|
||||||
|
});
|
||||||
|
|
||||||
show_saved_btn.on('click', function () {
|
show_saved_btn.on('click', function () {
|
||||||
if (!!!saved_modal) {
|
if (!!!saved_modal) {
|
||||||
show_pop_alert('No saved paste found.', 'alert-warning');
|
show_pop_alert('No saved paste found.', 'alert-warning');
|
||||||
|
|
|
@ -146,8 +146,8 @@
|
||||||
<div class="form-check mb-3">
|
<div class="form-check mb-3">
|
||||||
<input class="form-check-input" type="checkbox" value="" id="tos_btn" required>
|
<input class="form-check-input" type="checkbox" value="" id="tos_btn" required>
|
||||||
<label class="form-check-label" for="tos_btn">
|
<label class="form-check-label" for="tos_btn">
|
||||||
I understand <a class="link-primary" data-bs-toggle="modal" data-bs-target="#tos_modal" role="button">the terms
|
I understand <a data-bs-toggle="modal" data-bs-target="#tos_modal" role="button"><u>
|
||||||
and conditions</a>
|
the terms of service</u></a>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -156,7 +156,6 @@
|
||||||
<button type="button" class="btn btn-primary" id="upload_button">Upload</button>
|
<button type="button" class="btn btn-primary" id="upload_button">Upload</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue