mirror of
https://github.com/flarum/core.git
synced 2025-05-06 23:45:39 +02:00
chore: drop usage of jquery in install
and update
interfaces (#3797)
This commit is contained in:
parent
7a6d477550
commit
4901c586ce
@ -66,29 +66,37 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
$('form :input:first').select();
|
document.querySelector('form input').select();
|
||||||
|
|
||||||
$('form').on('submit', function(e) {
|
document.querySelector('form').addEventListener('submit', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var $button = $(this).find('button')
|
var button = this.querySelector('button');
|
||||||
.text('Please Wait...')
|
button.textContent = 'Please Wait...';
|
||||||
.prop('disabled', true);
|
button.disabled = true;
|
||||||
|
|
||||||
$.post('', $(this).serialize())
|
fetch('', {
|
||||||
.done(function() {
|
method: 'POST',
|
||||||
window.location.reload();
|
body: new FormData(this)
|
||||||
})
|
})
|
||||||
.fail(function(data) {
|
.then(response => {
|
||||||
$('#error').show().text('Something went wrong:\n\n' + data.responseText);
|
if (response.ok) {
|
||||||
|
window.location.reload();
|
||||||
|
} else {
|
||||||
|
response.text().then(errorMessage => {
|
||||||
|
var error = document.querySelector('#error');
|
||||||
|
error.style.display = 'block';
|
||||||
|
error.textContent = 'Something went wrong:\n\n' + errorMessage;
|
||||||
|
button.disabled = false;
|
||||||
|
button.textContent = 'Install Flarum';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$button.prop('disabled', false).text('Install Flarum');
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -17,29 +17,37 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
$('form :input:first').select();
|
document.querySelector('form input').select();
|
||||||
|
|
||||||
$('form').on('submit', function(e) {
|
document.querySelector('form').addEventListener('submit', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var $button = $(this).find('button')
|
var button = this.querySelector('button');
|
||||||
.text('Please Wait...')
|
button.textContent = 'Please Wait...';
|
||||||
.prop('disabled', true);
|
button.disabled = true;
|
||||||
|
|
||||||
$.post('', $(this).serialize())
|
fetch('', {
|
||||||
.done(function() {
|
method: 'POST',
|
||||||
window.location.reload();
|
body: new FormData(this)
|
||||||
})
|
})
|
||||||
.fail(function(data) {
|
.then(response => {
|
||||||
$('#error').show().text('Something went wrong:\n\n' + data.responseText);
|
if (response.ok) {
|
||||||
|
window.location.reload();
|
||||||
|
} else {
|
||||||
|
response.text().then(errorMessage => {
|
||||||
|
var error = document.querySelector('#error');
|
||||||
|
error.style.display = 'block';
|
||||||
|
error.textContent = 'Something went wrong:\n\n' + errorMessage;
|
||||||
|
button.disabled = false;
|
||||||
|
button.textContent = 'Update Flarum';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$button.prop('disabled', false).text('Update Flarum');
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user