From 0578b5c4908ef2cf4f7ea24c0e7b7fb62cb65af7 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Thu, 27 Mar 2025 10:11:35 +0100 Subject: [PATCH] JS: Add 'use strict' --- adminer/static/editing.js | 2 +- adminer/static/functions.js | 1 + compile.php | 5 +++++ editor/static/editing.js | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/adminer/static/editing.js b/adminer/static/editing.js index 3a17c624..847f1d45 100644 --- a/adminer/static/editing.js +++ b/adminer/static/editing.js @@ -1,4 +1,4 @@ -// Adminer specific functions +'use strict'; // Adminer specific functions /** Load syntax highlighting * @param string first three characters of database system version diff --git a/adminer/static/functions.js b/adminer/static/functions.js index bad2321c..c2aa419b 100644 --- a/adminer/static/functions.js +++ b/adminer/static/functions.js @@ -1,3 +1,4 @@ +'use strict'; /** Get first element by selector * @param string diff --git a/compile.php b/compile.php index 7a8ac85c..64cd48fa 100755 --- a/compile.php +++ b/compile.php @@ -213,6 +213,11 @@ function minify_css($file) { } function minify_js($file) { + $file = preg_replace_callback("~'use strict';~", function ($match) { // keep only the first one + static $count = 0; + $count++; + return ($count == 1 ? $match[0] : ''); + }, $file); if (function_exists('jsShrink')) { $file = jsShrink($file); } diff --git a/editor/static/editing.js b/editor/static/editing.js index c7dcdcfd..5533c5ac 100644 --- a/editor/static/editing.js +++ b/editor/static/editing.js @@ -1,4 +1,4 @@ -// Editor specific functions +'use strict'; // Editor specific functions function messagesPrint() { }