mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
Add spaghetti stress test to playground.
This commit is contained in:
@@ -273,6 +273,7 @@
|
||||
</value>
|
||||
</block>
|
||||
</category>
|
||||
<hr>
|
||||
<category id="catVariables" custom="VARIABLE"></category>
|
||||
<category id="catFunctions" custom="PROCEDURE"></category>
|
||||
</xml>
|
||||
|
||||
@@ -7,7 +7,7 @@ goog.provide('Blockly.Msg.ca');
|
||||
goog.require('Blockly.Msg');
|
||||
|
||||
Blockly.Msg.ADD_COMMENT = "Afegeix un comentari";
|
||||
Blockly.Msg.AUTH = "Please authorize this app to enable your work to be saved and to allow it to be shared by you."; // untranslated
|
||||
Blockly.Msg.AUTH = "Si us plau, autoritzeu que aquesta aplicació pugui desar la vostra feina i que la pugueu compartir.";
|
||||
Blockly.Msg.CHANGE_VALUE_TITLE = "Canvia valor:";
|
||||
Blockly.Msg.CHAT = "Xateja amb el teu col·laborador escrivint en aquest quadre!";
|
||||
Blockly.Msg.COLLAPSE_ALL = "Contraure blocs";
|
||||
@@ -35,7 +35,7 @@ Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE = "continuar amb la segü
|
||||
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK = "Sortir del bucle interior.";
|
||||
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE = "Ometre la resta d'aquest bucle, i continuar amb la següent iteració.";
|
||||
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING = "Advertència: Aquest bloc només es pot utilitzar dins d'un bucle.";
|
||||
Blockly.Msg.CONTROLS_FOREACH_HELPURL = "https://github.com/google/blockly/wiki/Loops#for-each for each block"; // untranslated
|
||||
Blockly.Msg.CONTROLS_FOREACH_HELPURL = "https://github.com/google/blockly/wiki/Loops#for-each bloc for-each";
|
||||
Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST = "en la llista";
|
||||
Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST_TAIL = ""; // untranslated
|
||||
Blockly.Msg.CONTROLS_FOREACH_INPUT_ITEM = "per a cada element";
|
||||
|
||||
14
msg/js/hi.js
14
msg/js/hi.js
@@ -7,9 +7,9 @@ goog.provide('Blockly.Msg.hi');
|
||||
goog.require('Blockly.Msg');
|
||||
|
||||
Blockly.Msg.ADD_COMMENT = "टिप्पणी छोड़ें";
|
||||
Blockly.Msg.AUTH = "Please authorize this app to enable your work to be saved and to allow it to be shared by you."; // untranslated
|
||||
Blockly.Msg.AUTH = "अपने कार्य को सहेजना सक्षम करने और अपने साथ इसे साझा करने हेतु कृपया इस एप्प को अधिकृत करें।";
|
||||
Blockly.Msg.CHANGE_VALUE_TITLE = "मान परिवर्तित करें:";
|
||||
Blockly.Msg.CHAT = "Chat with your collaborator by typing in this box!"; // untranslated
|
||||
Blockly.Msg.CHAT = "इस सन्दूक में लिखकर हमारे सहयोगी के साथ बातचीत करें!";
|
||||
Blockly.Msg.COLLAPSE_ALL = "ब्लॉक संक्षिप्त करें";
|
||||
Blockly.Msg.COLLAPSE_BLOCK = "ब्लॉक को संक्षिप्त करें";
|
||||
Blockly.Msg.COLOUR_BLEND_COLOUR1 = "रंग 1";
|
||||
@@ -28,18 +28,18 @@ Blockly.Msg.COLOUR_RGB_GREEN = "हरा";
|
||||
Blockly.Msg.COLOUR_RGB_HELPURL = "http://www.december.com/html/spec/colorper.html"; // untranslated
|
||||
Blockly.Msg.COLOUR_RGB_RED = "लाल";
|
||||
Blockly.Msg.COLOUR_RGB_TITLE = "इसके साथ रंग करें";
|
||||
Blockly.Msg.COLOUR_RGB_TOOLTIP = "Create a colour with the specified amount of red, green, and blue. All values must be between 0 and 100."; // untranslated
|
||||
Blockly.Msg.COLOUR_RGB_TOOLTIP = "लाल, हरा और नीले की निर्दिष्ट मात्रा के साथ एक रंग बनायें। सभी मान ० से १०० के बीच होने चाहिए।";
|
||||
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL = "https://github.com/google/blockly/wiki/Loops#loop-termination-blocks"; // untranslated
|
||||
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK = "लूप से बाहर निकलें";
|
||||
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE = "लूप का अगला आईटरेशन जारी रखें";
|
||||
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK = "भीतरी लूप से बाहर निकलें।";
|
||||
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE = "बाकी बचे लूप को छोड़ें, और अगला आईटरेशन जारी रखें।";
|
||||
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING = "सावधान: ये ब्लॉक केवल लूप के अंदर इस्तेमाल किया जा सकता है।";
|
||||
Blockly.Msg.CONTROLS_FOREACH_HELPURL = "https://github.com/google/blockly/wiki/Loops#for-each for each block"; // untranslated
|
||||
Blockly.Msg.CONTROLS_FOREACH_HELPURL = "https://github.com/google/blockly/wiki/Loops#for-each प्रत्येक खण्ड के लिए";
|
||||
Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST = "सूची में";
|
||||
Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST_TAIL = ""; // untranslated
|
||||
Blockly.Msg.CONTROLS_FOREACH_INPUT_ITEM = "प्रत्येक आइटम के लिए";
|
||||
Blockly.Msg.CONTROLS_FOREACH_TOOLTIP = "For each item in a list, set the variable '%1' to the item, and then do some statements."; // untranslated
|
||||
Blockly.Msg.CONTROLS_FOREACH_TOOLTIP = "सूची के प्रत्येक आयटम के लिए, आयटम में चर का मान '%1' रखें और बाद में कुछ कथन लिखें।";
|
||||
Blockly.Msg.CONTROLS_FOR_HELPURL = "https://github.com/google/blockly/wiki/Loops#count-with"; // untranslated
|
||||
Blockly.Msg.CONTROLS_FOR_INPUT_FROM_TO_BY = "from %1 to %2 by %3"; // untranslated
|
||||
Blockly.Msg.CONTROLS_FOR_INPUT_WITH = "काउंट करें";
|
||||
@@ -52,7 +52,7 @@ Blockly.Msg.CONTROLS_IF_MSG_ELSE = "एल्स";
|
||||
Blockly.Msg.CONTROLS_IF_MSG_ELSEIF = "एल्स इफ";
|
||||
Blockly.Msg.CONTROLS_IF_MSG_IF = "इफ";
|
||||
Blockly.Msg.CONTROLS_IF_TOOLTIP_1 = "यदी मान ट्रू है, तो कुछ स्टेट्मेंट्स चलाएँ।";
|
||||
Blockly.Msg.CONTROLS_IF_TOOLTIP_2 = "If a value is true, then do the first block of statements. Otherwise, do the second block of statements."; // untranslated
|
||||
Blockly.Msg.CONTROLS_IF_TOOLTIP_2 = "यदि एक मान सत्य है तो कथनों का प्रथम खण्ड बनायें। अन्यथा कथनों का दूसरा भाग निर्मित करें।";
|
||||
Blockly.Msg.CONTROLS_IF_TOOLTIP_3 = "If the first value is true, then do the first block of statements. Otherwise, if the second value is true, do the second block of statements."; // untranslated
|
||||
Blockly.Msg.CONTROLS_IF_TOOLTIP_4 = "If the first value is true, then do the first block of statements. Otherwise, if the second value is true, do the second block of statements. If none of the values are true, do the last block of statements."; // untranslated
|
||||
Blockly.Msg.CONTROLS_REPEAT_HELPURL = "https://en.wikipedia.org/wiki/For_loop";
|
||||
@@ -263,7 +263,7 @@ Blockly.Msg.MATH_TRIG_TOOLTIP_ATAN = "संख्या का आर्कट
|
||||
Blockly.Msg.MATH_TRIG_TOOLTIP_COS = "डिग्री का कोसाइन रिटर्न करें (रेडियन नही)";
|
||||
Blockly.Msg.MATH_TRIG_TOOLTIP_SIN = "डिग्री का साइन रिटर्न करें (रेडियन नही)";
|
||||
Blockly.Msg.MATH_TRIG_TOOLTIP_TAN = "डिग्री का टैन्जन्ट रिटर्न करें (रेडियन नही)";
|
||||
Blockly.Msg.ME = "Me"; // untranslated
|
||||
Blockly.Msg.ME = "मैं";
|
||||
Blockly.Msg.NEW_VARIABLE = "नया चर...";
|
||||
Blockly.Msg.NEW_VARIABLE_TITLE = "नए चर का नाम:";
|
||||
Blockly.Msg.ORDINAL_NUMBER_SUFFIX = ""; // untranslated
|
||||
|
||||
@@ -75,7 +75,7 @@ Blockly.Msg.EXPAND_ALL = "Expandir Blocos";
|
||||
Blockly.Msg.EXPAND_BLOCK = "Expandir Bloco";
|
||||
Blockly.Msg.EXTERNAL_INPUTS = "Entrada externa";
|
||||
Blockly.Msg.HELP = "Ajuda";
|
||||
Blockly.Msg.INLINE_INPUTS = "Entradas Internas";
|
||||
Blockly.Msg.INLINE_INPUTS = "Entradas Incorporadas";
|
||||
Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL = "https://github.com/google/blockly/wiki/Lists#create-empty-list"; // untranslated
|
||||
Blockly.Msg.LISTS_CREATE_EMPTY_TITLE = "criar lista vazia";
|
||||
Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP = "Retorna uma lista, de tamanho 0, contendo nenhum registro";
|
||||
|
||||
@@ -35,7 +35,7 @@ Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE = "перейти к сл
|
||||
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK = "Прерывает этот цикл.";
|
||||
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE = "Пропускает остаток цикла и переходит к следующему шагу.";
|
||||
Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING = "Предупреждение: этот блок может использоваться только внутри цикла.";
|
||||
Blockly.Msg.CONTROLS_FOREACH_HELPURL = "https://github.com/google/blockly/wiki/Loops#for-each for each block"; // untranslated
|
||||
Blockly.Msg.CONTROLS_FOREACH_HELPURL = "https://github.com/google/blockly/wiki/Loops#for-each для каждого блока";
|
||||
Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST = "в списке";
|
||||
Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST_TAIL = ""; // untranslated
|
||||
Blockly.Msg.CONTROLS_FOREACH_INPUT_ITEM = "для каждого элемента";
|
||||
@@ -156,7 +156,7 @@ Blockly.Msg.LOGIC_BOOLEAN_FALSE = "ложь";
|
||||
Blockly.Msg.LOGIC_BOOLEAN_HELPURL = "https://github.com/google/blockly/wiki/Logic#values"; // untranslated
|
||||
Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP = "Возвращает значение истина или ложь.";
|
||||
Blockly.Msg.LOGIC_BOOLEAN_TRUE = "истина";
|
||||
Blockly.Msg.LOGIC_COMPARE_HELPURL = "https://en.wikipedia.org/wiki/Inequality_(mathematics)";
|
||||
Blockly.Msg.LOGIC_COMPARE_HELPURL = "https://ru.wikipedia.org/wiki/%D0%9D%D0%B5%D1%80%D0%B0%D0%B2%D0%B5%D0%BD%D1%81%D1%82%D0%B2%D0%BE";
|
||||
Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ = "Возвращает значение истина, если вставки равны.";
|
||||
Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT = "Возвращает значение истина, если первая вставка больше второй.";
|
||||
Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE = "Возвращает значение истина, если первая вставка больше или равна второй.";
|
||||
@@ -263,7 +263,7 @@ Blockly.Msg.MATH_TRIG_TOOLTIP_ATAN = "Возвращает арктангенс
|
||||
Blockly.Msg.MATH_TRIG_TOOLTIP_COS = "Возвращает косинус угла в градусах.";
|
||||
Blockly.Msg.MATH_TRIG_TOOLTIP_SIN = "Возвращает синус угла в градусах.";
|
||||
Blockly.Msg.MATH_TRIG_TOOLTIP_TAN = "Возвращает тангенс угла в градусах.";
|
||||
Blockly.Msg.ME = "Я";
|
||||
Blockly.Msg.ME = "Мне";
|
||||
Blockly.Msg.NEW_VARIABLE = "Новая переменная…";
|
||||
Blockly.Msg.NEW_VARIABLE_TITLE = "Имя новой переменной:";
|
||||
Blockly.Msg.ORDINAL_NUMBER_SUFFIX = ""; // untranslated
|
||||
@@ -289,7 +289,7 @@ Blockly.Msg.PROCEDURES_HIGHLIGHT_DEF = "Выделить определение
|
||||
Blockly.Msg.PROCEDURES_IFRETURN_TOOLTIP = "Если первое значение истинно, возвращает второе значение.";
|
||||
Blockly.Msg.PROCEDURES_IFRETURN_WARNING = "Предупреждение: Этот блок может использоваться только внутри определения функции.";
|
||||
Blockly.Msg.PROCEDURES_MUTATORARG_TITLE = "имя параметра:";
|
||||
Blockly.Msg.PROCEDURES_MUTATORARG_TOOLTIP = "Добавить входные параметры в функцию.";
|
||||
Blockly.Msg.PROCEDURES_MUTATORARG_TOOLTIP = "Добавить входной параметр в функцию.";
|
||||
Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TITLE = "параметры";
|
||||
Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP = "Добавить, удалить или изменить порядок входных параметров для этой функции.";
|
||||
Blockly.Msg.REMOVE_COMMENT = "Удалить комментарий";
|
||||
|
||||
@@ -378,6 +378,7 @@ h1 {
|
||||
</value>
|
||||
</block>
|
||||
</category>
|
||||
<hr>
|
||||
<category name="Variables" custom="VARIABLE"></category>
|
||||
<category name="Functions" custom="PROCEDURE"></category>
|
||||
</xml>
|
||||
|
||||
@@ -95,10 +95,10 @@ function airstrike(n) {
|
||||
var prototypes = [];
|
||||
var toolbox = document.getElementById('toolbox');
|
||||
var blocks = toolbox.getElementsByTagName('block');
|
||||
for (var x = 0, block; block = blocks[x]; x++) {
|
||||
for (var i = 0, block; block = blocks[i]; i++) {
|
||||
prototypes.push(block.getAttribute('type'));
|
||||
}
|
||||
for (var x = 0; x < n; x++) {
|
||||
for (var i = 0; i < n; i++) {
|
||||
var prototype = prototypes[Math.floor(Math.random() * prototypes.length)];
|
||||
var block = Blockly.Block.obtain(Blockly.mainWorkspace, prototype);
|
||||
block.initSvg();
|
||||
@@ -108,6 +108,50 @@ function airstrike(n) {
|
||||
block.render();
|
||||
}
|
||||
}
|
||||
|
||||
function spaghetti(n) {
|
||||
var xml = spaghettiXml;
|
||||
for(var i = 0; i < n; i++) {
|
||||
xml = xml.replace(/(<(statement|next)( name="DO0")?>)<\//g,
|
||||
'$1' + spaghettiXml + '</');
|
||||
}
|
||||
xml = '<xml xmlns="http://www.w3.org/1999/xhtml">' + xml + '</xml>';
|
||||
var dom = Blockly.Xml.textToDom(xml);
|
||||
console.time('Spaghetti domToWorkspace');
|
||||
Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, dom);
|
||||
console.timeEnd('Spaghetti domToWorkspace');
|
||||
}
|
||||
var spaghettiXml = [
|
||||
' <block type="controls_if" inline="false" x="30" y="30">' +
|
||||
' <value name="IF0">' +
|
||||
' <block type="logic_compare" inline="true">' +
|
||||
' <field name="OP">EQ</field>' +
|
||||
' <value name="A">' +
|
||||
' <block type="math_arithmetic" inline="true">' +
|
||||
' <field name="OP">MULTIPLY</field>' +
|
||||
' <value name="A">' +
|
||||
' <block type="math_number">' +
|
||||
' <field name="NUM">6</field>' +
|
||||
' </block>' +
|
||||
' </value>' +
|
||||
' <value name="B">' +
|
||||
' <block type="math_number">' +
|
||||
' <field name="NUM">7</field>' +
|
||||
' </block>' +
|
||||
' </value>' +
|
||||
' </block>' +
|
||||
' </value>' +
|
||||
' <value name="B">' +
|
||||
' <block type="math_number">' +
|
||||
' <field name="NUM">42</field>' +
|
||||
' </block>' +
|
||||
' </value>' +
|
||||
' </block>' +
|
||||
' </value>' +
|
||||
' <statement name="DO0"></statement>' +
|
||||
' <next></next>' +
|
||||
' </block>'].join('\n');
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@@ -393,7 +437,9 @@ h1 {
|
||||
<hr>
|
||||
|
||||
<p>
|
||||
Stress test with an <input type="button" value="Airstrike!" onclick="airstrike(100)">
|
||||
Stress test:
|
||||
<input type="button" value="Airstrike!" onclick="airstrike(100)">
|
||||
<input type="button" value="Spaghetti!" onclick="spaghetti(6)">
|
||||
</p>
|
||||
|
||||
<!-- Realtime setup buttons. -->
|
||||
|
||||
Reference in New Issue
Block a user