LinkStack/resources/views/components/config/advanced-config.blade.php

41 lines
1.8 KiB
PHP
Raw Normal View History

2023-06-05 17:42:26 +02:00
<p>{{__('messages.AC.description')}}</p>
<form action="{{ route('editAC') }}" method="post">
@csrf
<div class="form-group">
<label>{{__('messages.Advanced Configuration file.')}}</label>
<textarea style="width:100%;display:none;" class="form-control" name="AdvancedConfig" rows="280">{{ file_get_contents('config/advanced-config.php') }}</textarea>
<div id="editor" style="width:100%; height:<?php echo count(file('config/advanced-config.php')) * 24 + 15;?>px; background-color:transparent !important;" class="form-control border-1 border-light" name="AdvancedConfig" rows="280">{{ file_get_contents('config/advanced-config.php') }}</div>
</div>
<button type="submit" class="btn btn-primary">{{__('messages.Save')}}</button>
<a class="btn btn-danger confirmation" href="{{url('/admin/advanced-config?restore-defaults')}}">{{__('messages.Restore defaults')}}</a>
<script type="text/javascript">
var elems = document.getElementsByClassName('confirmation');
var confirmIt = function (e) {
if (!confirm('Are you sure?')) e.preventDefault();
};
for (var i = 0, l = elems.length; i < l; i++) {
elems[i].addEventListener('click', confirmIt, false);
}
</script>
</form>
2022-11-17 15:22:05 +01:00
<script src="{{ asset('assets/external-dependencies/ace.js') }}" type="text/javascript" charset="utf-8"></script>
2022-11-17 15:22:05 +01:00
<script>
var editor = ace.edit("editor");
2022-12-14 12:12:59 +01:00
//if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
if(!$('#toggle-switch').is(':checked')){
2023-06-05 17:42:26 +02:00
// dark mode
editor.setTheme("ace/theme/tomorrow_night");
2022-12-14 12:12:59 +01:00
} else {
2023-06-05 17:42:26 +02:00
editor.setTheme("ace/theme/xcode");
2022-12-14 12:12:59 +01:00
}
2022-11-17 15:22:05 +01:00
editor.getSession().setMode("ace/mode/javascript");
2022-11-20 21:54:03 +01:00
editor.session.setUseWorker(false);
2022-11-17 15:22:05 +01:00
</script>
2022-11-18 13:37:14 +01:00
<script>
editor.getSession().on('change', function(e) {
$('textarea[name=AdvancedConfig]').val(editor.getSession().getValue());
});
</script>