From 2adf326c230589800880faa9599eca2ecc94d283 Mon Sep 17 00:00:00 2001 From: alschmiedt Date: Thu, 6 Jan 2022 11:28:27 -0800 Subject: [PATCH] fix: update the playground to load compressed when hosted (#5835) --- tests/multi_playground.html | 23 +- tests/playground.html | 33 +- tests/playgrounds/compressed.html | 1211 ----------------------- tests/playgrounds/load_all.js | 53 + tests/playgrounds/multi_compressed.html | 470 --------- 5 files changed, 80 insertions(+), 1710 deletions(-) delete mode 100644 tests/playgrounds/compressed.html create mode 100644 tests/playgrounds/load_all.js delete mode 100644 tests/playgrounds/multi_compressed.html diff --git a/tests/multi_playground.html b/tests/multi_playground.html index 0cabadb6d..da48e2c85 100644 --- a/tests/multi_playground.html +++ b/tests/multi_playground.html @@ -3,15 +3,16 @@ Multi-toolbox Playground - - - + + + - - - -
- -

Blockly Playground

- -

Show - - Hide - - Advanced

- -
- - -
-

- - - -
- - - - - -
- -

- -

- Stress test:   - - - -

- - - - - - - - - - - - - - - diff --git a/tests/playgrounds/load_all.js b/tests/playgrounds/load_all.js new file mode 100644 index 000000000..a444e8cd3 --- /dev/null +++ b/tests/playgrounds/load_all.js @@ -0,0 +1,53 @@ +/** + * @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( + ``); + document.write(``); + document.write(``); + document.write( + ``); + document.write(``); +} else { + document.write( + ``); + document.write(``); + document.write(``); + document.write(``); + document.write(``); + document.write(``); + document.write(``); + document.write(``); +} +})(); diff --git a/tests/playgrounds/multi_compressed.html b/tests/playgrounds/multi_compressed.html deleted file mode 100644 index 29f0ae383..000000000 --- a/tests/playgrounds/multi_compressed.html +++ /dev/null @@ -1,470 +0,0 @@ - - - - -Multi-toolbox Compressed Playground - - - - - - - - -

Blockly Multi Playground

- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LTR, Vertical, StartRTL, Vertical, Start
LTR, Vertical, EndRTL, Vertical, End
LTR, Horizontal, StartRTL, Horizontal, Start
LTR, Horizontal, EndRTL, Horizontal, End
- - - - - -