Browse Source

Only include the trianglify JS when enabled.

ullbergm/trianglify
magnus Ullberg 7 years ago
parent
commit
6044894ebd
  1. 4
      app/Providers/AppServiceProvider.php
  2. 4
      resources/views/app.blade.php

4
app/Providers/AppServiceProvider.php

@ -17,7 +17,7 @@ class AppServiceProvider extends ServiceProvider
public function boot()
{
$alt_bg = '';
$trianglify = '';
$trianglify = 'false';
if(!is_file(base_path('.env'))) {
touch(base_path('.env'));
@ -34,7 +34,7 @@ class AppServiceProvider extends ServiceProvider
if(is_file(database_path('app.sqlite'))) {
if(Schema::hasTable('settings')) {
if(Setting::fetch('trianglify')) {
$trianglify = '<script>addTriangleTo(app);</script>';
$trianglify = 'true';
} else if($bg_image = Setting::fetch('background_image')) {
$alt_bg = ' style="background-image: url(/storage/'.$bg_image.')"';
}

4
resources/views/app.blade.php

@ -91,6 +91,7 @@
<script>!window.jQuery && document.write('<script src="/js/jquery-3.3.1.min.js"><\/script>')</script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="/js/app.js?v=2"></script>
@if ($trianglify == 'true')
<script src="/js/trianglify.min.js"></script>
<script>
function addTriangleTo(target) {
@ -114,7 +115,8 @@
}, 400);
});
</script>
{!! $trianglify !!}
<script>addTriangleTo(app);</script>
@endif
@yield('scripts')
</body>

Loading…
Cancel
Save