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,15 +3,16 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Multi-toolbox Playground</title>
|
||||
<script src="../blockly_uncompressed.js"></script>
|
||||
<script src="../msg/messages.js"></script>
|
||||
|
||||
<script>
|
||||
// Custom requires for the playground.
|
||||
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 options = {
|
||||
comments: true,
|
||||
collapse: true,
|
||||
@@ -37,6 +38,7 @@ var options = {
|
||||
};
|
||||
|
||||
function start() {
|
||||
setBackgroundColour();
|
||||
var match = location.search.match(/toolbox=([^&]+)/);
|
||||
var toolbox =
|
||||
document.getElementById('toolbox-' + (match ? match[1] : 'categories'));
|
||||
@@ -63,6 +65,15 @@ function startBlocklyInstance(suffix, rtl, horizontalLayout, position,
|
||||
options.toolboxPosition = position;
|
||||
Blockly.inject('blocklyDiv' + suffix, options);
|
||||
}
|
||||
|
||||
function setBackgroundColour() {
|
||||
// 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.
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
Reference in New Issue
Block a user