Greasy Fork is available in English.

CodeSpaces Close Confirmation

Ask before you close GitHub or VS Codespaces

// ==UserScript==
// @name         CodeSpaces Close Confirmation
// @namespace    https://github.com/wei
// @version      0.2
// @description  Ask before you close GitHub or VS Codespaces
// @author       Wei <github@weispot.com>
// @match        https://*.github.dev
// @match        https://online.visualstudio.com/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  window.addEventListener('beforeunload', function (e) {
    e.preventDefault();
    e.returnValue = 'Are you sure?';
  });
})();