ベーステンプレートのインラインスクリプトをapp.jsに移動

This commit is contained in:
shibafu 2019-03-05 00:18:27 +09:00
parent 8cdf086296
commit 81e37034ce
2 changed files with 30 additions and 26 deletions

View File

@ -1 +1,31 @@
import Cookies from 'js-cookie';
require('./bootstrap'); require('./bootstrap');
$(() => {
if (Cookies.get('agechecked')) {
$('body').removeClass('tis-need-agecheck');
} else {
$('#ageCheckModal')
.modal({backdrop: 'static'})
.on('hide.bs.modal', function () {
$('body').removeClass('tis-need-agecheck');
Cookies.set('agechecked', '1', {expires: 365});
});
}
if (navigator.serviceWorker) {
navigator.serviceWorker.register('/sw.js');
}
$('[data-toggle="tooltip"]').tooltip();
$('.alert').alert();
$('.tis-page-selector').pageSelector();
if (document.getElementById('status')) {
setTimeout(function () {
$('#status').alert('close');
}, 5000);
}
$('.link-card').linkCard();
});

View File

@ -218,32 +218,6 @@
</div> </div>
@endguest @endguest
<script src="{{ mix('js/app.js') }}"></script> <script src="{{ mix('js/app.js') }}"></script>
<script>
$(function(){
@guest
if (Cookies.get('agechecked')) {
$('body').removeClass('tis-need-agecheck');
} else {
$('#ageCheckModal').modal({ backdrop: 'static' })
.on('hide.bs.modal', function() {
$('body').removeClass('tis-need-agecheck');
Cookies.set('agechecked', '1', { expires: 365 });
});
}
@endguest
if (navigator.serviceWorker) {
navigator.serviceWorker.register('/sw.js');
}
$('[data-toggle="tooltip"]').tooltip();
$('.alert').alert();
$('.tis-page-selector').pageSelector();
@if (session('status'))
setTimeout(function () {
$('#status').alert('close');
}, 5000);
@endif
});
</script>
@stack('script') @stack('script')
</body> </body>
</html> </html>