File "advanced_playground.html"

Full path: /usr/home/mndrn/domains/mndrn.ru/public_html/block-hill/blockly/tests/playgrounds/advanced_playground.html
File size: 7.09 KiB (7261 bytes)
MIME-type: text/html
Charset: utf-8

Download   Open   Back

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Advanced Blockly Playground</title>
<script src="../../blockly_uncompressed.js"></script>
<script src="../../generators/javascript.js"></script>
<script src="../../generators/javascript/logic.js"></script>
<script src="../../generators/javascript/loops.js"></script>
<script src="../../generators/javascript/math.js"></script>
<script src="../../generators/javascript/text.js"></script>
<script src="../../generators/javascript/lists.js"></script>
<script src="../../generators/javascript/colour.js"></script>
<script src="../../generators/javascript/variables.js"></script>
<script src="../../generators/javascript/variables_dynamic.js"></script>
<script src="../../generators/javascript/procedures.js"></script>
<script src="../../generators/python.js"></script>
<script src="../../generators/python/logic.js"></script>
<script src="../../generators/python/loops.js"></script>
<script src="../../generators/python/math.js"></script>
<script src="../../generators/python/text.js"></script>
<script src="../../generators/python/lists.js"></script>
<script src="../../generators/python/colour.js"></script>
<script src="../../generators/python/variables.js"></script>
<script src="../../generators/python/variables_dynamic.js"></script>
<script src="../../generators/python/procedures.js"></script>
<script src="../../generators/php.js"></script>
<script src="../../generators/php/logic.js"></script>
<script src="../../generators/php/loops.js"></script>
<script src="../../generators/php/math.js"></script>
<script src="../../generators/php/text.js"></script>
<script src="../../generators/php/lists.js"></script>
<script src="../../generators/php/colour.js"></script>
<script src="../../generators/php/variables.js"></script>
<script src="../../generators/php/variables_dynamic.js"></script>
<script src="../../generators/php/procedures.js"></script>
<script src="../../generators/lua.js"></script>
<script src="../../generators/lua/logic.js"></script>
<script src="../../generators/lua/loops.js"></script>
<script src="../../generators/lua/math.js"></script>
<script src="../../generators/lua/text.js"></script>
<script src="../../generators/lua/lists.js"></script>
<script src="../../generators/lua/colour.js"></script>
<script src="../../generators/lua/variables.js"></script>
<script src="../../generators/lua/variables_dynamic.js"></script>
<script src="../../generators/lua/procedures.js"></script>
<script src="../../generators/dart.js"></script>
<script src="../../generators/dart/logic.js"></script>
<script src="../../generators/dart/loops.js"></script>
<script src="../../generators/dart/math.js"></script>
<script src="../../generators/dart/text.js"></script>
<script src="../../generators/dart/lists.js"></script>
<script src="../../generators/dart/colour.js"></script>
<script src="../../generators/dart/variables.js"></script>
<script src="../../generators/dart/variables_dynamic.js"></script>
<script src="../../generators/dart/procedures.js"></script>
<script src="../../msg/messages.js"></script>
<script src="../../blocks/logic.js"></script>
<script src="../../blocks/loops.js"></script>
<script src="../../blocks/math.js"></script>
<script src="../../blocks/text.js"></script>
<script src="../../blocks/lists.js"></script>
<script src="../../blocks/colour.js"></script>
<script src="../../blocks/variables.js"></script>
<script src="../../blocks/variables_dynamic.js"></script>
<script src="../../blocks/procedures.js"></script>
<script src="../themes/test_themes.js"></script>
<script src="./screenshot.js"></script>
<script src="https://unpkg.com/@blockly/[email protected]/dist/index.js"></script>
<script src="https://unpkg.com/@blockly/theme-modern/dist/index.js"></script>

<script>
// Custom requires for the playground.
// Rendering.
goog.require('Blockly.minimalist.Renderer');
goog.require('Blockly.Themes.Zelos');

// Other.
goog.require('Blockly.WorkspaceCommentSvg');
goog.require('Blockly.WorkspaceCommentSvg.render');
</script>
<script>
'use strict';

function start() {
  setBackgroundColour();
  initPlayground();
}

function createWorkspace(blocklyDiv, options) {
  var workspace = Blockly.inject(blocklyDiv, options);
  workspace.configureContextMenu = configureContextMenu.bind(workspace);
  return workspace;
}

function configurePlayground(playground) {
  // Rendering options.
  var gui = playground.getGUI();
  var renderingFolder = gui.addFolder('Rendering');
  var renderingOptions = {
    'font Size': 10,
  };
  renderingFolder.add(renderingOptions, 'font Size', 0, 50)
    .onChange(function(value) {
      var ws = playground.getWorkspace();
      var fontStyle = {
        'size': value
      };
      ws.getTheme().setFontStyle(fontStyle);
      // Refresh theme.
      ws.setTheme(ws.getTheme());
    });
}

function initPlayground() {
  var defaultOptions = {
        comments: true,
        collapse: true,
        disable: true,
        grid:
          {
            spacing: 25,
            length: 3,
            colour: '#ccc',
            snap: true
          },
        horizontalLayout: false,
        maxBlocks: Infinity,
        maxInstances: {'test_basic_limit_instances': 3},
        maxTrashcanContents: 256,
        media: '../../media/',
        oneBasedIndex: true,
        readOnly: false,
        rtl: false,
        move: {
          scrollbars: true,
          drag: true,
          wheel: false,
        },
        toolbox: toolboxCategories,
        toolboxPosition: 'start',
        renderer: 'geras',
        zoom:
          {
            controls: true,
            wheel: true,
            startScale: 1.0,
            maxScale: 4,
            minScale: 0.25,
            scaleSpeed: 1.1
          }
  };

  const playgroundConfig = {
    toolboxes: {
      'categories': toolboxCategories,
      'simple': toolboxSimple,
      'test blocks': toolboxTestBlocks,
    }
  }

  createPlayground(document.getElementById('root'), createWorkspace,
      defaultOptions, playgroundConfig,
      'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.19.2/min/vs')
      .then(function(playground) {
        configurePlayground(playground);
      });
}

function setBackgroundColour() {
  // Set background colour to differentiate server vs local copy.
  if (location.protocol == 'file:') {
    var lilac = '#d6d6ff';
    document.body.style.backgroundColor = lilac;
  }
}


function configureContextMenu(menuOptions, e) {
  var workspace = this;
  var screenshotOption = {
    text: 'Download Screenshot',
    enabled: workspace.getTopBlocks().length,
    callback: function() {
      Blockly.downloadScreenshot(workspace);
    }
  };
  menuOptions.push(screenshotOption);

  // Adds a default-sized workspace comment to the workspace.
  menuOptions.push(Blockly.ContextMenu.workspaceCommentOption(workspace, e));
}

</script>

<style>
  html, body {
    margin: 0;
  }

  .ioLabel>.blocklyFlyoutLabelText {
    font-style: italic;
  }

  .playgroundToggleOptions {
    list-style: none;
    padding: 0;
  }
  .playgroundToggleOptions li {
    margin-top: 1em;
  }

  .zelos-renderer .blocklyFlyoutButton .blocklyText {
    font-size: 1.5rem;
  }
</style>
</head>
<body onload="start()">
  <div id="root"></div>
</body>
</html>

PHP File Manager