Are you tired of rewriting the URL of a PG to open it locally?

Hello!
Are you tired of rewriting the URL of a PG to open it locally?

  1. Install TamperMonkey. https://www.tampermonkey.net/ and pin it:

  2. Create a new script by clicking on the TamperMonkey icon and select Create a new script:

  3. Paste this little script:

// ==UserScript==
// @name         Open BabylonJS PG locally
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Opens the current PG locally on localhost:1338
// @author       roland@babylonjs.xyz
// @match        https://playground.babylonjs.com/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        GM_registerMenuCommand
// ==/UserScript==

(function() {
    'use strict';

    GM_registerMenuCommand('Open in local PG', function() {
        location.href = location.href.replace('https://playground.babylonjs.com', 'http://localhost:1338')
    })
})();

File / Save.

  1. Go to any http://playground.babylonjs.com PG
  2. Click the TamperMonkey icon again and then on the newly created menu item Open in local PG.

If your script is not enabled, click:
image

Applies to Chrome.

Happy coding!

:vulcan_salute:

4 Likes