pixelfed/resources/views/settings/labs.blade.php

45 lines
1.3 KiB
PHP
Raw Normal View History

2019-04-28 22:53:21 +00:00
@extends('settings.template')
@section('section')
<div class="title">
<h3 class="font-weight-bold">Labs</h3>
<p class="lead">Experimental features</p>
</div>
<hr>
<form method="post" id="form">
2019-04-28 22:53:21 +00:00
@csrf
<div class="form-check pb-3">
<input class="form-check-input" type="checkbox" name="dark_mode" id="dark_mode" {{request()->hasCookie('dark-mode') ? 'checked':''}}>
<label class="form-check-label font-weight-bold" for="dark_mode">
{{__('Dark Mode')}}
2019-04-28 22:53:21 +00:00
</label>
<p class="text-muted small help-text">Use dark mode theme.</p>
2019-04-28 22:53:21 +00:00
</div>
2019-04-28 22:53:21 +00:00
<div class="form-group row">
<div class="col-12">
<hr>
<button type="button" class="btn btn-primary font-weight-bold py-1 btn-block" id="save-btn">Save Changes</button>
2019-04-28 22:53:21 +00:00
</div>
</div>
</form>
2019-05-04 02:01:31 +00:00
@endsection
@push('scripts')
<script type="text/javascript">
$(document).ready(function() {
let darkMode = localStorage.getItem('pf_m2s.color-scheme') == 'dark' ? true : false;
if(darkMode == true) {
$('#dark_mode').attr('checked', true);
2019-05-04 02:01:31 +00:00
}
$('#save-btn').click(function() {
let darkMode = document.querySelector('#dark_mode').checked;
let colorScheme = darkMode ? 'dark' : 'light';
localStorage.setItem('pf_m2s.color-scheme', colorScheme);
$('#form').submit();
});
2019-05-04 02:01:31 +00:00
});
</script>
@endpush