<commit_before><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Multi-toolbox Playground</title>
<script src="../blockly_uncompressed.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/procedures.js"></script>
<script>
'use strict';

function start() {
  startBlocklyInstance('VertStartLTR', false, false, 'start');
  startBlocklyInstance('VertStartRTL', true, false, 'start');

  startBlocklyInstance('VertEndLTR', false, false, 'end');
  startBlocklyInstance('VertEndRTL', true, false, 'end');


  startBlocklyInstance('HorizontalStartLTR', false, true, 'start');
  startBlocklyInstance('HorizontalStartRTL', true, true, 'start');

  startBlocklyInstance('HorizontalEndLTR', false, true, 'end');
  startBlocklyInstance('HorizontalEndRTL', true, true, 'end');
}

function startBlocklyInstance(suffix, rtl, horizontalLayout, position) {
  var toolbox = document.getElementById('toolbox_categoriesScroll');
  var options = {
    comments: false,
    disable: false,
    collapse: false,
    maxBlocks: Infinity,
    media: '../media/',
    readOnly: false,
    rtl: rtl,
    scrollbars: true,
    toolbox: toolbox,
    trashcan: true,
    horizontalLayout: horizontalLayout,
    toolboxPosition: position,
    zoom: {
      controls: true,
      wheel: false,
      startScale: 1.0,
      maxScale: 4,
      minScale: 0.25,
      scaleSpeed: 1.1
    },
  };
  Blockly.inject('blocklyDiv' + suffix, options);
}

</script>

<style>
html, body {
  height: 100%;
}
body {
  background-color: #fff;
  font-family: sans-serif;
}
h1 {
  font-weight: normal;
  font-size: 140%;
}
#blocklyDiv {
  float: right;
  height: 95%;
  width: 70%;
}
#collaborators {
  float: right;
  width: 30px;
  margin-left: 10px;
}
#collaborators > img {
  margin-right: 5px;
  height: 30px;
  padding-bottom: 5px;
  width: 30px;
  border-radius: 3px;
}
#importExport {
  font-family: monospace;
}
</style>
</head>
<body onload="start()">

  <div id="collaborators"></div>
  <table>
    <tr>
      <td/>
      <td>LTR</td>
      <td>RTL</td>
    </tr><commit_msg>Add a button to flip between flyouts and toolboxes.<commit_after><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Multi-toolbox Playground</title>
<script src="../blockly_uncompressed.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/procedures.js"></script>
<script>
'use strict';
 // True if we're showing toolboxes, false if showing open flyouts.
 var showingToolbox = true;
 // The workspaces we're showing.
 var workspaces = [];

 var options = {
  comments: false,
  disable: false,
  collapse: false,
  maxBlocks: Infinity,
  media: '../media/',
  readOnly: false,
  rtl: false,
  scrollbars: true,
  trashcan: true,
  horizontalLayout: false,
  toolboxPosition: 'start',
  zoom: {
    controls: true,
    wheel: false,
    startScale: 1.0,
    maxScale: 4,
    minScale: 0.25,
    scaleSpeed: 1.1
    },
  };

function start(toolboxId) {
  startBlocklyInstance('VertStartLTR', false, false, 'start', toolboxId);
  startBlocklyInstance('VertStartRTL', true, false, 'start', toolboxId);

  startBlocklyInstance('VertEndLTR', false, false, 'end', toolboxId);
  startBlocklyInstance('VertEndRTL', true, false, 'end', toolboxId);

  startBlocklyInstance('HorizontalStartLTR', false, true, 'start', toolboxId);
  startBlocklyInstance('HorizontalStartRTL', true, true, 'start', toolboxId);

  startBlocklyInstance('HorizontalEndLTR', false, true, 'end', toolboxId);
  startBlocklyInstance('HorizontalEndRTL', true, true, 'end', toolboxId);
}

function startBlocklyInstance(suffix, rtl, horizontalLayout, position,
  toolboxId) {
  var toolbox = document.getElementById(toolboxId);
  options.rtl = rtl;
  options.toolbox = toolbox;
  options.horizontalLayout = horizontalLayout;
  options.toolboxPosition = position;
  workspaces.push(Blockly.inject('blocklyDiv' + suffix, options));
}

function swapFlyoutToolbox() {
  var button = document.getElementById('swap');
  var toolboxId;
  if (showingToolbox) {
    swap.textContent = 'Show toolboxes';
    toolboxId = 'toolbox_alwaysOpen';
  } else {
    toolboxId = 'toolbox_categoriesScroll';
    swap.textContent = 'Show flyouts';
  }

  // Dispose of all existing workspace stuff so
  // we can repopulate.
  for (var i = 0, ws; ws = workspaces[i]; i++) {
   ws.dispose();
  }
  workspaces = [];

  // Re-inject all the workspaces with new ids.
  start(toolboxId);
  showingToolbox = !showingToolbox;
}
</script>

<style>
html, body {
  height: 100%;
}
body {
  background-color: #fff;
  font-family: sans-serif;
}
h1 {
  font-weight: normal;
  font-size: 140%;
}
#blocklyDiv {
  float: right;
  height: 95%;
  width: 70%;
}
#collaborators {
  float: right;
  width: 30px;
  margin-left: 10px;
}
#collaborators > img {
  margin-right: 5px;
  height: 30px;
  padding-bottom: 5px;
  width: 30px;
  border-radius: 3px;
}
#importExport {
  font-family: monospace;
}
#swap {
  background-color: #4CAF50; /* Green */
  color: white;
  text-decoration: none;
  font-size: 12px;
}
</style>
</head>
<body onload="start('toolbox_categoriesScroll')">
  <div id="collaborators"></div>
  <table>
    <tr>
      <td>
        <button id="swap" type="button" valaue="Swap toolbox" onclick="swapFlyoutToolbox()">Show Flyouts</button>  
      </td>
    </tr>
    <tr>
      <td/>
      <td>LTR</td>
      <td>RTL</td>
    </tr>
{'fraction_non_alphanumeric': 0.17017719826145103, 'fraction_numerical': 0.011367435640254095, 'mean_word_length': 4.036195286195286, 'pattern_counts': {'":': 0, '<': 93, '<?xml version=': 0, '>': 95, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5258127', 'n_tokens_mistral': 2136, 'n_tokens_neox': 2037, 'n_words': 456}