mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
fix: update the playground to load compressed when hosted (#5835)
This commit is contained in:
@@ -3,24 +3,14 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Blockly Playground</title>
|
||||
<script src="../blockly_uncompressed.js"></script>
|
||||
<script src="../msg/messages.js"></script>
|
||||
<script src="themes/test_themes.js"></script>
|
||||
<script src="./playgrounds/screenshot.js"></script>
|
||||
<script src="../node_modules/@blockly/block-test/dist/index.js"></script>
|
||||
|
||||
<script>
|
||||
// Custom requires for the playground.
|
||||
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');
|
||||
goog.require('Blockly.blocks.all');
|
||||
</script>
|
||||
<!-- 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>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
const IS_UNCOMPRESSED = !!document.getElementById('blockly-uncompressed-script');
|
||||
var workspace = null;
|
||||
|
||||
function start() {
|
||||
@@ -97,14 +87,11 @@ function start() {
|
||||
}
|
||||
|
||||
function setBackgroundColour() {
|
||||
// Set background colour to differentiate file: vs. localhost
|
||||
// vs. server copy.
|
||||
if (location.protocol === 'file:') {
|
||||
document.body.style.backgroundColor = '#89A203'; // Unpleasant green.
|
||||
} else if (location.hostname === 'localhost' ||
|
||||
location.hostname === '127.0.0.1' ||
|
||||
location.hostname === '[::1]') {
|
||||
document.body.style.backgroundColor = '#d6d6ff'; // Familliar lilac.
|
||||
// Set background colour to differentiate between compressed and uncompressed mode.
|
||||
if (IS_UNCOMPRESSED) {
|
||||
document.body.style.backgroundColor = '#d6d6ff'; // Familiar lilac.
|
||||
} else {
|
||||
document.body.style.backgroundColor = '#60fcfc'; // Unfamiliar blue.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user