You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
esc_html_e( 'Warning: Switching versions may cause compatibility issues. Always backup your site before switching versions. This feature allows you to install different versions of the Code Snippets plugin.', 'code-snippets' );
392
-
?>
393
-
</p>
394
388
<?phpendif; ?>
395
389
</div>
396
390
397
391
<script type="text/javascript">
398
392
jQuery(document).ready(function($) {
399
-
$('#switch-version-btn').on('click', function() {
400
-
var targetVersion = $('#target_version').val();
401
-
var $button = $(this);
402
-
var $result = $('#version-switch-result');
393
+
var currentVersion = '<?phpechoesc_js( $current_version ); ?>';
394
+
var $button = $('#switch-version-btn');
395
+
var $dropdown = $('#target_version');
396
+
var $result = $('#version-switch-result');
397
+
398
+
// Handle dropdown changes - enable/disable button and show/hide warning
399
+
$dropdown.on('change', function() {
400
+
var selectedVersion = $(this).val();
401
+
402
+
if (!selectedVersion || selectedVersion === currentVersion) {
403
+
// Current version or no selection - disable button and hide warning
404
+
$button.prop('disabled', true);
405
+
$('#version-switch-warning').hide();
406
+
} else {
407
+
// Different version selected - enable button and show warning
408
+
$button.prop('disabled', false);
409
+
$('#version-switch-warning').show();
410
+
}
411
+
});
412
+
413
+
$button.on('click', function() {
414
+
var targetVersion = $dropdown.val();
403
415
404
-
if (!targetVersion) {
416
+
if (!targetVersion || targetVersion === currentVersion) {
0 commit comments