From 09b1b703f9afd2845b0c7ef4c9ba4d67e5ec502e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stan=20Forto=C5=84ski?= Date: Sun, 11 Jul 2021 17:40:22 +0200 Subject: [PATCH] Prevent close form --- public/js/close.js | 1 + public/mix-manifest.json | 1 + resources/js/close.js | 3 +++ resources/views/admin/categories/save.blade.php | 4 ++++ resources/views/admin/posts/save.blade.php | 4 ++++ webpack.mix.js | 1 + 6 files changed, 14 insertions(+) create mode 100644 public/js/close.js create mode 100644 resources/js/close.js diff --git a/public/js/close.js b/public/js/close.js new file mode 100644 index 0000000..e11856b --- /dev/null +++ b/public/js/close.js @@ -0,0 +1 @@ +window.onbeforeunload=function(){return"Do you really want to leave?"}; \ No newline at end of file diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 0b7a32e..1dad968 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,6 +1,7 @@ { "/js/app.js": "/js/app.js", "/js/admin.js": "/js/admin.js", + "/js/close.js": "/js/close.js", "/css/fontawesome.css": "/css/fontawesome.css", "/css/app.css": "/css/app.css", "/css/admin.css": "/css/admin.css" diff --git a/resources/js/close.js b/resources/js/close.js new file mode 100644 index 0000000..9d163be --- /dev/null +++ b/resources/js/close.js @@ -0,0 +1,3 @@ +window.onbeforeunload = function(){ + return "Do you really want to leave?"; +}; diff --git a/resources/views/admin/categories/save.blade.php b/resources/views/admin/categories/save.blade.php index 19f8121..84ee113 100644 --- a/resources/views/admin/categories/save.blade.php +++ b/resources/views/admin/categories/save.blade.php @@ -159,3 +159,7 @@ @endsection + +@push('scripts') + +@endpush diff --git a/resources/views/admin/posts/save.blade.php b/resources/views/admin/posts/save.blade.php index 73d0b08..7ef0d5e 100644 --- a/resources/views/admin/posts/save.blade.php +++ b/resources/views/admin/posts/save.blade.php @@ -209,3 +209,7 @@ @endsection + +@push('scripts') + +@endpush diff --git a/webpack.mix.js b/webpack.mix.js index 8b8143e..8333d91 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -14,6 +14,7 @@ const theme = process.env.BLOG_THEME; mix.js('resources/js/app.js', 'public/js') .js('resources/js/admin.js', 'public/js') + .js('resources/js/close.js', 'public/js') .sass(`resources/sass/admin/admin.scss`, 'public/css') .sass(`resources/sass/${theme}/app.scss`, 'public/css');