mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-01-30 14:09:58 +08:00
Separate scripts about checking updates from HTML
This commit is contained in:
parent
a55f150eac
commit
1852e9f4fb
@ -88,6 +88,19 @@ function downloadUpdates() {
|
||||
|
||||
}
|
||||
|
||||
if (typeof require !== 'undefined' && typeof module !== 'undefined') {
|
||||
module.exports = downloadUpdates;
|
||||
function checkForUpdates() {
|
||||
fetch({ url: url('admin/update/check') }).then(data => {
|
||||
if (data.available == true) {
|
||||
let dom = `<span class="label label-primary pull-right">v${data.latest}</span>`;
|
||||
|
||||
$(`[href="${url('admin/update')}"]`).append(dom);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof require !== 'undefined' && typeof module !== 'undefined') {
|
||||
module.exports = {
|
||||
checkForUpdates,
|
||||
downloadUpdates,
|
||||
};
|
||||
}
|
||||
|
@ -92,16 +92,7 @@
|
||||
@include('common.dependencies.script', ['module' => 'admin'])
|
||||
|
||||
@if (option('check_update'))
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// check for updates
|
||||
$.getJSON("{{ url('admin/update/check') }}", function(data) {
|
||||
if (data.available == true) {
|
||||
$('[href="{{ url('admin/update') }}"]').append('<span class="label label-primary pull-right">v'+data.latest+'</span>');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>$(document).ready(checkForUpdates);</script>
|
||||
@endif
|
||||
|
||||
@if (option('allow_sending_statistics'))
|
||||
|
Loading…
Reference in New Issue
Block a user