refactor(test): Use bootstrap.js in multi_playground.html

This removes the last use of load_all.js, so remove it.
This commit is contained in:
Christopher Allen
2022-06-12 12:48:31 +01:00
parent a1965aafea
commit 229dbf7ea0
2 changed files with 13 additions and 61 deletions

View File

@@ -4,14 +4,13 @@
<meta charset="utf-8">
<title>Multi-toolbox Playground</title>
<!-- This script loads uncompressed when on localhost and loads compressed when it is being hosted.
Please add any other dependencies to playgrounds/load_all.js.-->
<script src="playgrounds/load_all.js"></script>
<!-- This script loads uncompressed when on localhost and loads
compressed when it is being hosted or on Internet Explorer. -->
<script src="bootstrap.js"></script>
<script type=module>
import Blockly from './blockly.mjs';
<script>
'use strict';
const IS_UNCOMPRESSED = !!document.getElementById('blockly-uncompressed-script');
const IS_UNCOMPRESSED = Boolean(window.BlocklyLoader); // See bootstrap.js
var options = {
comments: true,
@@ -74,6 +73,12 @@ function setBackgroundColour() {
document.body.style.backgroundColor = '#60fcfc'; // Unfamiliar blue.
}
}
// Call start(). Because this <script> has type=module, it is
// automatically deferred, so it will not be run until after the
// document has been parsed, but before firing DOMContentLoaded.
start();
</script>
<style>
@@ -105,7 +110,7 @@ h1 {
}
</style>
</head>
<body onload="start()">
<body>
<h1>Blockly Multi Playground</h1>
<form id="options">

View File

@@ -1,53 +0,0 @@
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Loads uncompressed Blockly when running locally. Loads
* compressed otherwise.
*/
'use strict';
/**
* Loads all the compressed or uncompressed dependencies necessary to run the
* playground. This is necessary since the goog.module conversion. Please see
* issue #5557 for more information.
*/
(function() {
const isIe = navigator.userAgent.indexOf('MSIE') !== -1 ||
navigator.appVersion.indexOf('Trident/') > -1;
if ((location.hostname === 'localhost' || location.hostname === '127.0.0.1' ||
location.hostname === '[::1]') &&
!isIe) {
document.write(
`<script src="../blockly_uncompressed.js" id="blockly-uncompressed-script"></script>`);
document.write(`<script src="../msg/messages.js"></script>`);
document.write(`<script src="../tests/themes/test_themes.js"></script>`);
document.write(
`<script src="../node_modules/@blockly/block-test/dist/index.js"></script>`);
document.write(`<script>
// Custom requires for the playground.
goog.require('Blockly.libraryBlocks');
goog.require('Blockly.Dart.all');
goog.require('Blockly.JavaScript.all');
goog.require('Blockly.Lua.all');
goog.require('Blockly.PHP.all');
goog.require('Blockly.Python.all');
goog.require('Blockly.WorkspaceCommentSvg');
</script>`);
} else {
document.write(
`<script src="../blockly_compressed.js" id="blockly-compressed-script"></script>`);
document.write(`<script src="../blocks_compressed.js"></script>`);
document.write(`<script src="../dart_compressed.js"></script>`);
document.write(`<script src="../javascript_compressed.js"></script>`);
document.write(`<script src="../lua_compressed.js"></script>`);
document.write(`<script src="../php_compressed.js"></script>`);
document.write(`<script src="../python_compressed.js"></script>`);
document.write(`<script src="../msg/messages.js"></script>`);
}
})();