diff --git a/activity_2/img/lander.png b/activity_2/img/lander.png new file mode 100644 index 0000000000000000000000000000000000000000..afcfe4a15aa8ef6d1a6f17e911c020ce07637774 Binary files /dev/null and b/activity_2/img/lander.png differ diff --git a/activity_2/img/landerjpg.jpg b/activity_2/img/landerjpg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..749004cfa2474cf9f31149d77996c71072e363a7 Binary files /dev/null and b/activity_2/img/landerjpg.jpg differ diff --git a/activity_2/img/r1.png b/activity_2/img/r1.png new file mode 100644 index 0000000000000000000000000000000000000000..a31d8034b049722f3462df0dd0f0d4e19321f312 Binary files /dev/null and b/activity_2/img/r1.png differ diff --git a/activity_2/img/r2.png b/activity_2/img/r2.png new file mode 100644 index 0000000000000000000000000000000000000000..07b615eb53bf4c1ed2ee5e9397876e4f4a71d116 Binary files /dev/null and b/activity_2/img/r2.png differ diff --git a/activity_2/img/r3.png b/activity_2/img/r3.png new file mode 100644 index 0000000000000000000000000000000000000000..4d7280ce37f31e6af9a48ca77a03690c7cbdc1ae Binary files /dev/null and b/activity_2/img/r3.png differ diff --git a/activity_2/img/r4.png b/activity_2/img/r4.png new file mode 100644 index 0000000000000000000000000000000000000000..a14bff70e2d8fedf6b7d0314aab6950be2517991 Binary files /dev/null and b/activity_2/img/r4.png differ diff --git a/activity_2/index.html b/activity_2/index.html index 206a8042d20c5df1758ce5ee3bc5cb05e4dbae02..db09f48edbab3d360d3057bfa3330411fa844a35 100644 --- a/activity_2/index.html +++ b/activity_2/index.html @@ -7,6 +7,7 @@ <!-- Import des bibliothèques js nécessaires --> <script src="../res/lib/jquery.js"></script> <script src="../res/lib/serial.js"></script> + <script src="../res/lib/svg.min.js"></script> <script src="../res/lib/blockly/blockly_compressed.js"></script> <script src="../res/lib/blockly/blocks_compressed.js"></script> @@ -33,7 +34,8 @@ </div> <div id="toolsArea"> - <div id="animationArea"></div> + <div id="animationArea"> + </div> <a class="button" id="connectButton">Connecter à la maquette</a> <a class="button" id="runButton">Lancer le programme !</a> </div> diff --git a/activity_2/main-script.js b/activity_2/main-script.js index 909fa9e89ebfbe8e57cc549973308c3ca9e9814e..b2aa8b30d674245f29a035c20a560c497b41b990 100644 --- a/activity_2/main-script.js +++ b/activity_2/main-script.js @@ -1,3 +1,56 @@ /* Insérer ici les fonctions spécifiques à cette activité. Elles peuvent marcher avec les fonctions et variables déjà définies dans 'activity_functions.js' du dossier 'res'.*/ + + +function init_var() { +} + +/*var draw = SVG().addTo('#animationArea').size(640, 480) +var rect = draw.rect(600, 400).attr({ fill: '#f06' }) +*/ +var canvas = SVG().addTo('#animationArea').size(660, 510) + +var fuel_gradient = canvas.gradient('linear', function(add) { + add.stop(0, '#ff2e27') + add.stop(1, '#ffde00') +}) +var power_gradient = canvas.gradient('linear', function(add) { + add.stop(0, '#3c8001') + add.stop(1, '#93f45e') +}) +var sky_gradient = canvas.gradient('linear', function(add) { + add.stop(0, '#4cdaff') + add.stop(1, '#001b91') +}).from(0, 1).to(0, 0) + +var sky_rect = canvas.rect(400, 350).fill(sky_gradient).stroke({ width: 3, color: '#333' }).attr({x: 5, y: 5}) +var path = canvas.path("M40,353 C40,70 300,48 403,41").fill('none').stroke({width:5, color: '#ff0000'}) +var rocket = canvas.image('img/lander.png').size(75, 75) +var length = path.length() + +var fuel_rect = canvas.rect(490, 50).attr({x: 160, y: 450, fill: fuel_gradient}) +var fuel_box = canvas.rect(490, 50).fill('none').stroke({ width: 3, color: '#333' }).attr({x: 160, y: 450}) +var fuel_text = canvas.text("Carburant de l'étage :").attr({x: 0, y: 460}) + +var power_rect = canvas.rect(490, 50).attr({x: 160, y: 395, fill: power_gradient}) +var power_box = canvas.rect(490, 50).fill('none').stroke({ width: 3, color: '#333' }).attr({x: 160, y: 395}) +var power_text = canvas.text("Puissance moteurs :").attr({x: 0, y: 405}) + +var r1_img = canvas.image('img/r1.png').attr({x: 550, y : 0}) + +changeFuel(0.50, 1000) +changePower(0.6, 1000) + +rocket.animate(3000).during(function(pos, morph, eased){ + var p = path.pointAt(pos * length); + rocket.center(p.x, p.y); +}) + +function changeFuel(ratio, duration) { + fuel_rect.animate(duration, 0, 'now').width(fuel_rect.width()*ratio); +} + +function changePower(ratio, duration) { + power_rect.animate(duration, 0, 'now').width(fuel_rect.width()*ratio); +} diff --git a/activity_4/index.html b/activity_4/index.html index 206a8042d20c5df1758ce5ee3bc5cb05e4dbae02..456aecc6009f1d00f23a81fd1f01e1e88a4430ed 100644 --- a/activity_4/index.html +++ b/activity_4/index.html @@ -23,7 +23,19 @@ </head> + <body> + <div id="intro_modal" class="modal"> + <div class="modal-content"> + <span class="close">×</span> + <h1 style="text-align: center;">Bienvenue dans la mission 4 !</h2> + <p>Les astronautes de la mission Apollo viennent de se poser avec succès sur la Lune. Les heures qui vont suivre seront à jamais gravées dans l'histoire de l'humanité. Mais encore faut-il que le monde entier puisse voir l'événement sur sa télévision...</p> + <p>On estime qu'entre 400 000 et 700 000 personnes ont actuellement les yeux rivés sur leur téléviseur, attendant qu'arrive le signal depuis la lune.</p> + <p>Le président des Etats-Unis, Richard Nixon, suit également l'événement depuis le bureau oval. Une fois Buzz Aldrin et Neil Armstrong sur la surface de la Lune, il apellera les deux astronautes par téléphone pour les féliciter.</p> + <p>Il est donc vital que les communications marchent comme prévu !</p> + <p style="text-align: center;"><strong>A vous de jouer ! Ne les décevez pas !</strong></p> + </div> + </div> <header id="header"></header> <section class="mainSection"> @@ -33,7 +45,33 @@ </div> <div id="toolsArea"> - <div id="animationArea"></div> + <div id="animationArea"> + <div id ="desc_1" class="consignes"> + <h3 style="text-align: center;">Première partie : démarrer la diffusion télévisée</h3> + <p>La caméra du module lunaire qui va filmer l'événement se déploie grace à un mécanisme. Il faut ensuite mettre en route le signal TV vers la Terre. Puis on ouvre le sas du module lunaire. Enfin on commence la diffusion.</p> + <p>Un programme informatique est une suite d'instruction comprises par l'ordinateur. Il faut trouver celle qui permet de faire cela.</p> + <p style="text-align: center;"><strong>A vous de jouer ! Utilisez les blocs correspondant à ces actions pour mener à bien cette mission !</strong></p> + </div> + <div id ="desc_2" class="consignes"> + <h3 style="text-align: center;">Deuxième partie : acheminer la communication de Houston à Washington</h3> + <p>Le signal reçu depuis la Lune est reçu en Australie puis transmis par satellite jusqu'en Californie puis jusqu'au centre de contrôle de Houston au Texas.</p> + <p>Il faut désormais trouver un chemin téléphonique jusqu'au bureau du président, à Washington.</p> + <p>Il faut relier les villes entre elles pour trouver le chemin le plus court entre les villes. Mais attention, la liaison entre Louisville et Washington est défectueuse. Il faut prévoir une autre route si elle ne marche pas (utiliser une condition "si... sinon".)</p> + <p style="text-align: center;"><strong>A vous de jouer ! Utilisez les blocs correspondant à ces actions pour mener à bien cette mission !</strong></p> + </div> + <div id ="desc_3" class="consignes"> + <h3 style="text-align: center;">Troisième partie : puzzle, trouver le numéro du président !</h3> + <p>Le signal téléphonique est arrivé à Washington. Il faut désormais l'acheminer vers le téléphone du président.</p> + <p>Problème : la personne chargée de passer le coup de fil ne se souvient plus des derniers numéros. Mais il se souvient qu'il correspond au résultat de l'algorithme suivant :</p> + <p><strong>On prend initialement le nombre d'apparitions de la lettre 'e' dans le discours que va prononcer le président. Si ce nombre est supérieur à 35, on le multiplie par 42, sinon par 66. Puis tant que ce numéro est supérieur à 1000, on le divise par deux.</strong></p> + <p> Le résultat de cet algorithme est le numéro à appeler pour avoir le président au bout du fil !</p> + <p style="text-align: center;"><strong>A vous de jouer ! Utilisez les blocs correspondant à ces actions pour mener à bien cette mission !</strong></p> + + <p> <strong>Le discours est le suivant : </strong>Bonjour, Neil et Buzz. Je m'adresse à vous par téléphone depuis le bureau ovale, + à la Maison-Blanche. C'est certainement l'appel téléphonique le plus historique jamais réalisé. + Puisque vous nous parlez depuis la mer de la Tranquillité, cela doit nous inciter à redoubler d'efforts pour instaurer la paix et la tranquillité sur Terre.</p> + </div> + </div> <a class="button" id="connectButton">Connecter à la maquette</a> <a class="button" id="runButton">Lancer le programme !</a> </div> @@ -41,6 +79,7 @@ </section> <footer id="footer"></footer> + </body> <!-- Script d'intanciation lancé au chargement, doit toujours être à la fin--> @@ -49,4 +88,6 @@ <script src="../res/activity_functions.js"></script> <script src="main-script.js"></script> + + </html> diff --git a/activity_4/main-script.js b/activity_4/main-script.js index 909fa9e89ebfbe8e57cc549973308c3ca9e9814e..e3924434b4011a797f01ea6ec3d95aed896c3949 100644 --- a/activity_4/main-script.js +++ b/activity_4/main-script.js @@ -1,3 +1,41 @@ /* Insérer ici les fonctions spécifiques à cette activité. Elles peuvent marcher avec les fonctions et variables déjà définies dans 'activity_functions.js' du dossier 'res'.*/ + +var camera_activated = false; +var camera_setup = false; +var moon_signal_activated = false; +var hatch_opened = false; + +function init_var() { + camera_activated = false; + camera_setup = false; + moon_signal_activated = false; + hatch_opened = false; + +} + +displayConsignes("desc_1"); + + +/* GESTION DES POPUP*/ + +// Gets the modal (intiated as the intro_modal at first) +var modal = document.getElementById("intro_modal"); +// Get the <span> element that closes the modal +var span = document.getElementsByClassName("close")[0]; + +// Displays the modal when DOM is Loaded +document.addEventListener('DOMContentLoaded', event => { + modal.style.display = "block"; +}); +// When the user clicks on <span> (x), close the modal +span.onclick = function() { + modal.style.display = "none"; +} +// When the user clicks anywhere outside of the modal, close it +window.onclick = function(event) { + if (event.target == modal) { + modal.style.display = "none"; + } +} diff --git a/activity_4/toolbox.xml b/activity_4/toolbox.xml index 8eca1b88a7cc67205cc32d1cae25ee5cd31a8a65..f5a3cd8ccd57afc1828afe95ef2c79d19edcfc5a 100644 --- a/activity_4/toolbox.xml +++ b/activity_4/toolbox.xml @@ -1,30 +1,99 @@ <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <category name="Arduino" colour="#a5745b"> - <block type="sendtoarduino"></block> - <block type="turn_led"> - <field name="val">on</field> - </block> - <block type="arduino_wait"> - <value name="time"> - <block type="math_number"> - <field name="NUM">1</field> + <category name="Partie 1"> + <block type="setup_camera_module"></block> + <block type="activate_camera"></block> + <block type="open_hatch"></block> + <block type="activate_moon_signal"></block> + </category> + <category name="Partie 2"> + <block type="establish_telecoms"></block> + <block type="controls_if"> + <mutation else="1"></mutation> + <value name="IF0"> + <block type="is_telecom_working"></block> + </value> + </block> + </category> + <category name="Partie 3"> + <block type="variables_set"> + <field name="VAR" id="6|-pKOy_37|G^q+cJMR*">Numéro</field> + <value name="VALUE"> + <block type="count_letter_in_string"> + <field name="letter">a</field> + <value name="text"> + <block type="text"> + <field name="TEXT">Bonjour, Neil et Buzz. Je m'adresse à vous par téléphone depuis le bureau ovale, à la Maison-Blanche, intervient Richard Nixon, à la tête du pays depuis six mois. C'est certainement l'appel téléphonique le plus historique jamais réalisé. Puisque vous nous parlez depuis la mer de la Tranquillité, cela doit nous inciter à redoubler d'efforts pour instaurer la paix et la tranquillité sur Terre.</field> + </block> + </value> + </block> + </value> + </block> + <block type="call_phone"> + <value name="NUM"> + <shadow type="math_number"> + <field name="NUM">42</field> + </shadow> + </value> + </block> + <block type="text_print"> + <value name="TEXT"> + <block type="variables_get"> + <field name="VAR" id="6|-pKOy_37|G^q+cJMR*">Numéro</field> </block> </value> </block> </category> - <category name="Texte" colour="#5b80a5"> - <block type="text"> - <field name="TEXT"></field> + <category name="Logique" colour="#5b67a5"> + <block type="controls_if"> + <mutation else="1"></mutation> + </block> + <block type="controls_if"></block> + <block type="logic_compare"> + <field name="OP">EQ</field> + <value name="B"> + <shadow type="logic_boolean"> + <field name="BOOL">TRUE</field> + </shadow> + </value> + </block> + <block type="logic_compare"> + <field name="OP">EQ</field> + <value name="B"> + <shadow type="math_number"> + <field name="NUM">0</field> + </shadow> + </value> </block> </category> - <category name="Variables" colour="#a55b80" custom="VARIABLE"></category> <category name="Boucles" colour="#5ba55b"> - <block type="controls_repeat_ext"> - <value name="TIMES"> + <block type="controls_whileUntil"> + <field name="MODE">WHILE</field> + </block> + </category> + <category name="Opérations" colour="#5b80a5"> + <block type="math_arithmetic"> + <field name="OP">ADD</field> + <value name="B"> <shadow type="math_number"> - <field name="NUM">10</field> + <field name="NUM">1</field> + </shadow> + </value> + </block> + <block type="variables_set"> + <field name="VAR" id="[1.AGmlSC#I.MJ=uY]jj">Numéro</field> + </block> + <block type="variables_get"> + <field name="VAR" id="[1.AGmlSC#I.MJ=uY]jj">Numéro</field> + </block> + <block type="math_number_property"> + <mutation divisor_input="true"></mutation> + <field name="PROPERTY">DIVISIBLE_BY</field> + <value name="NUMBER_TO_CHECK"> + <shadow type="math_number"> + <field name="NUM">0</field> </shadow> </value> </block> </category> + <category name="Variables" colour="#a55b80" custom="VARIABLE"></category> </xml> \ No newline at end of file diff --git a/arduino/IGB_atelier_apollo - Raccourci.lnk b/arduino/IGB_atelier_apollo - Raccourci.lnk new file mode 100644 index 0000000000000000000000000000000000000000..9af4ceac1f50d01ec00d44f665f6ed9572462fa6 Binary files /dev/null and b/arduino/IGB_atelier_apollo - Raccourci.lnk differ diff --git a/arduino/act4/act4.ino b/arduino/act4/act4.ino new file mode 100644 index 0000000000000000000000000000000000000000..9f38b124c6c293926ec11a7447d325161b4af3d7 --- /dev/null +++ b/arduino/act4/act4.ino @@ -0,0 +1,177 @@ +#include <WebUSB.h> +#include <DFMiniMp3.h> + + +class Mp3Notify +{ +public: + static void PrintlnSourceAction(DfMp3_PlaySources source, const char* action) + { + if (source & DfMp3_PlaySources_Sd) + { + Serial.print("SD Card, "); + } + if (source & DfMp3_PlaySources_Usb) + { + Serial.print("USB Disk, "); + } + if (source & DfMp3_PlaySources_Flash) + { + Serial.print("Flash, "); + } + Serial.println(action); + } + static void OnError(uint16_t errorCode) + { + // see DfMp3_Error for code meaning + Serial.println(); + Serial.print("Com Error "); + Serial.println(errorCode); + } + static void OnPlayFinished(DfMp3_PlaySources source, uint16_t track) + { + Serial.print("Play finished for #"); + Serial.println(track); + } + static void OnPlaySourceOnline(DfMp3_PlaySources source) + { + PrintlnSourceAction(source, "online"); + } + static void OnPlaySourceInserted(DfMp3_PlaySources source) + { + PrintlnSourceAction(source, "inserted"); + } + static void OnPlaySourceRemoved(DfMp3_PlaySources source) + { + PrintlnSourceAction(source, "removed"); + } +}; + +/** + Creating an instance of WebUSBSerial will add an additional USB interface to + the device that is marked as vendor-specific (rather than USB CDC-ACM) and + is therefore accessible to the browser. + + The URL here provides a hint to the browser about what page the user should + navigate to to interact with the device. +*/ +WebUSB WebUSBSerial(1 /* https:// */, "apollo.antoine-rcbs.ovh/activity_1"); +DFMiniMp3<HardwareSerial, Mp3Notify> mp3(Serial1); + +#define Serial WebUSBSerial + +#define RING_PIN 2 + +String currentCommand = ""; + + + + + +void setup() { + pinMode(3, OUTPUT); + pinMode(4, OUTPUT); + pinMode(5, OUTPUT); + pinMode(6, OUTPUT); + pinMode(7, OUTPUT); + pinMode(8, OUTPUT); + pinMode(9, OUTPUT); + pinMode(10, OUTPUT); + pinMode(14, OUTPUT); + pinMode(15, OUTPUT); + pinMode(16, OUTPUT); + pinMode(18, OUTPUT); + pinMode(19, OUTPUT); + pinMode(20, OUTPUT); + pinMode(21, OUTPUT); + pinMode(RING_PIN, OUTPUT); + mp3.begin(); + mp3.setVolume(24); + while (!Serial) { + ; + } + Serial.begin(9600); + Serial.print("Arduino connected and answering"); + delay(1000); + Serial.flush(); +} + +void loop() { + if (Serial) { + while (Serial.available() > 0) { + char c = '0'; + while (c != ';') { + c = Serial.read(); + currentCommand += c; + delay(1); + } + runCommand(currentCommand); + currentCommand = ""; + } + Serial.flush(); + } +} + +void ringTrack(int n, uint16_t duration) { + digitalWrite(RING_PIN, HIGH); + delay(4000); + digitalWrite(RING_PIN, LOW); + delay(500); + mp3.playMp3FolderTrack(n); + waitMilliseconds(duration); +} + +void waitMilliseconds(uint16_t msWait) +{ + uint32_t start = millis(); + + while ((millis() - start) < msWait) + { + // calling mp3.loop() periodically allows for notifications + // to be handled without interrupts + mp3.loop(); + delay(1); + } +} + + +void runCommand(String command) { + //Décomposition de la commande en ID + arguments + int curIndex = command.indexOf('_'); + String id = command.substring(0, curIndex); + Serial.print(id); + String args[5] = {"0", "0", "0", "0", "0"}; //Max 5 args + for (int i = 0; i<5; i++) { + int nextIndex = command.indexOf('_', curIndex+1); + args[i] = command.substring(curIndex + 1, nextIndex); + Serial.print(args[i]); + curIndex = nextIndex; + if (args[i].endsWith(";")) { + args[i].remove(args[i].indexOf(';')); + break; + } + } + + + //Lancement des diverses commandes + if (id == "IO") { + turnIO(args[0].toInt(), args[1].toInt()); + } else if (id == "DELAY") { + waitForUnlock(args[0].toInt()); + } else if (id == "RING") { + ringTrack(args[0].toInt(), 10000); + } + + +} + +/* FONCTIONS METIER */ + +void turnIO(int pin, boolean val) { + digitalWrite(pin, val); +} + +void waitForUnlock(int delayMs) { + delay(delayMs); + Serial.println("UNLOCK;"); +} diff --git a/index.html b/index.html index 07c03267852fe56b38c0a956e665b36f625a59b1..70ac75d3816a436eaa8a1750c9cc9b2879ab4a89 100644 --- a/index.html +++ b/index.html @@ -24,7 +24,9 @@ <a href="activity_1"> <h2>Activité 1</h2> <img src="res/img/activities_icons/1.png"> - <p>J'ai perdu au jeu. + <p>La fusée Saturne V de la mission Apollo 11 est sur le pas de tir ! Il faut effectuer les dernières + étapes avant le lancement : charger le carburant dans la fusée et préparer son décollage ! + A vous de prendre le contrôle de cette opération crutiale ! </p> </a> </li> @@ -32,9 +34,8 @@ <a href="activity_2/"> <h2>Activité 2</h2> <img src="res/img/activities_icons/2.png"> - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus tempor eros lorem, - sit amet porttitor lacus porta id. Fusce eu faucibus enim, sed dapibus mi. - Nunc sed lectus sit amet orci egestas placerat. Suspendisse quam velit posuere. + <p>3...2...1... Décollage ! La fusée est en route vers la Lune ! Il faut désormais que la séparation des étages se passe bien et que la fusée emprunte la bonne trajectoire ! + Programmez les différentes étapes de cette mission, gérez le carburant, la séparation et l'orientation de la fusée ! </p> </a> </li> @@ -42,9 +43,8 @@ <a href="activity_3/"> <h2>Activité 3</h2> <img src="res/img/activities_icons/3.png"> - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus tempor eros lorem, - sit amet porttitor lacus porta id. Fusce eu faucibus enim, sed dapibus mi. - Nunc sed lectus sit amet orci egestas placerat. Suspendisse quam velit posuere. + <p>La fusée arrive en orbite lunaire, il faut désormais se poser à la surface de la Lune. Gérez la séparation du module de service et du lander et contrôlez la descente des deux astronautes. + Mais attention, le carburant est limité ! </p> </a> </li> @@ -52,9 +52,9 @@ <a href="activity_4/"> <h2>Activité 4</h2> <img src="res/img/activities_icons/4.png"> - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus tempor eros lorem, - sit amet porttitor lacus porta id. Fusce eu faucibus enim, sed dapibus mi. - Nunc sed lectus sit amet orci egestas placerat. Suspendisse quam velit posuere. + <p>Les astronautes viennent de se poser sur la lune. Il faut désormais que le monde + entier puisse voir l'événement et que le président Nixon puisse apeller les astronautes. + A vous d'établir les communications nécessaires pour celà ! </p> </a> </li> diff --git a/launch.bat b/launch.bat new file mode 100644 index 0000000000000000000000000000000000000000..f4e3ade33a68395fc4468ec0f345fba713dc22bf --- /dev/null +++ b/launch.bat @@ -0,0 +1 @@ +python -m http.server \ No newline at end of file diff --git a/meca/satellite.stl b/meca/satellite.stl new file mode 100644 index 0000000000000000000000000000000000000000..bcecff9d6f14b3e5a114aa78ad5e172038bfbece Binary files /dev/null and b/meca/satellite.stl differ diff --git a/meca/usa.png b/meca/usa.png new file mode 100644 index 0000000000000000000000000000000000000000..6aa6176ad283c80d2b852d3a45f3205e2a8567b6 Binary files /dev/null and b/meca/usa.png differ diff --git a/res/activity_functions.js b/res/activity_functions.js index 7194c35b7fe55a014200959746057693f53332df..69e6cf970f2d473b978d93c3cc5c194b53b0c033 100644 --- a/res/activity_functions.js +++ b/res/activity_functions.js @@ -11,6 +11,7 @@ let textEncoder = new TextEncoder(); //Lance le code tel que rentré par le joueur function runCode() { + init_var(); var code = Blockly.JavaScript.workspaceToCode(workspace); //On récupère un code javascript var myInterpreter = new Interpreter(code, initApi); //Intanciation d'une VM avec fonctions réécrites myInterpreter.run(); //On lance le code de l'utilisateur dans la VM @@ -22,7 +23,15 @@ function runCode() { /************************************ FONCTIONS DE COMMUNICATION ARDUINO ************************************/ - + function displayConsignes(id) { + var x = document.getElementsByClassName("consignes"); + var i; + for (i = 0; i < x.length; i++) { + x[i].style.display = "none"; + } + var consignesDiv = document.getElementById(id); + consignesDiv.style.display = 'block'; + } //Envoie ce string à l'Arduino function sendString(str) { if (port !== undefined) { @@ -57,8 +66,23 @@ function waitForMessageFromArduino(message) { IMPLEMENTATION DES FONCTIONS DANS L'INTERPRETEUR JS ********************************************************/ +function changeVar(variable, value) { + variable = value; +} + //Interprétation des commandes par l'utiliseur (redéfinition des fonctions avec IO) function initApi(interpreter, scope) { + var wrapper = function(text) { + return displayConsignes(arguments.length ? text : ''); + }; + interpreter.setProperty(scope, 'displayConsignes', + interpreter.createNativeFunction(wrapper)); + // Add an API function for the changeVar() block. + var wrapper = function(text) { + return changeVar(arguments.length ? text : ''); + }; + interpreter.setProperty(scope, 'changeVar', + interpreter.createNativeFunction(wrapper)); // Add an API function for the alert() block. var wrapper = function(text) { return alert(arguments.length ? text : ''); @@ -110,7 +134,7 @@ document.addEventListener('DOMContentLoaded', event => { port.onReceive = data => { let textDecoder = new TextDecoder(); receivedMsg = textDecoder.decode(data); - //console.log("Reçu :" + receivedMsg); + console.log("Reçu :" + receivedMsg); } port.onReceiveError = error => { console.log('Receive error: ' + error); diff --git a/res/blocks/arduino_blocks_def.js b/res/blocks/arduino_blocks_def.js index 07da611f6f60f41051c15192e36c23e0e5c4bb16..f9369178047c8e229ecd78d52377937a610439d2 100644 --- a/res/blocks/arduino_blocks_def.js +++ b/res/blocks/arduino_blocks_def.js @@ -15,7 +15,7 @@ Blockly.Blocks['turn_led'] = { init: function() { this.appendDummyInput() .appendField("Mettre la LED en l'état") - .appendField(new Blockly.FieldDropdown([["allumée","on"], ["éteinte","off"]]), "val"); + .appendField(new Blockly.FieldDropdown([["allumée","1"], ["éteinte","0"]]), "val"); this.setPreviousStatement(true, null); this.setNextStatement(true, null); this.setColour(345); @@ -39,3 +39,124 @@ Blockly.Blocks['arduino_wait'] = { this.setHelpUrl(""); } }; + +Blockly.Blocks['turn_io'] = { + init: function() { + this.appendValueInput("IO") + .setCheck("Number") + .appendField("Turn io"); + this.appendValueInput("VAL") + .setCheck("Number") + .appendField("to val"); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(0); + this.setTooltip("Outil de debug"); + this.setHelpUrl(""); + } +}; + + + + +/* ACT 4 */ + +Blockly.Blocks['activate_camera'] = { + init: function() { + this.appendDummyInput() + .appendField("Démarrer la diffusion"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(0); + this.setTooltip("Active la caméra du module lunaire"); + this.setHelpUrl(""); + } +}; + +Blockly.Blocks['establish_telecoms'] = { + init: function() { + this.appendDummyInput() + .appendField("Etablir la communication") + .appendField(new Blockly.FieldDropdown([["Houston - Amarillo - Rapid City","1"], ["Houston - Little Rock","OPTIONNAME"], ["Houston - Jacksonville","OPTIONNAME"], ["Little Rock - Norman","OPTIONNAME"], ["Little Rock - Atlanta - Jacksonville","OPTIONNAME"], ["Norman - Rapid City","OPTIONNAME"], ["Norman - Louisville","OPTIONNAME"], ["Louisville - Chicago","OPTIONNAME"], ["Louisville - Washington","OPTIONNAME"], ["Louisville - Richmond","OPTIONNAME"], ["Chicago - Rapid City","OPTIONNAME"], ["Chicago - Bufallo","OPTIONNAME"], ["Bufallo - Washington","OPTIONNAME"], ["Jacksonville - Richmond","OPTIONNAME"]]), "val"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(0); + this.setTooltip("Fait passer le signal entre deux villes"); + this.setHelpUrl(""); + } +}; + +Blockly.Blocks['setup_camera_module'] = { + init: function() { + this.appendDummyInput() + .appendField("Mettre en place la caméra"); + this.setNextStatement(true, null); + this.setColour(0); + this.setTooltip("Déclenche un mécanisme"); + this.setHelpUrl(""); + } +}; + +Blockly.Blocks['open_hatch'] = { + init: function() { + this.appendDummyInput() + .appendField("Ouvrir la trappe du module lunaire"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(0); + this.setTooltip("Ouvre la porte qui permet aux astronautes de sortir"); + this.setHelpUrl(""); + } +}; + +Blockly.Blocks['activate_moon_signal'] = { + init: function() { + this.appendDummyInput() + .appendField("Envoyer le signal TV vers la Terre"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(0); + this.setTooltip("Envoie le signal vers la Terre par le biais d'une antenne"); + this.setHelpUrl(""); + } +}; + +Blockly.Blocks['call_phone'] = { + init: function() { + this.appendValueInput("NUM") + .setCheck(null) + .appendField("Appeler le téléphone au numéro"); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(0); + this.setTooltip("Appel le téléphone au numéro donné"); + this.setHelpUrl(""); + } +}; + +Blockly.Blocks['is_telecom_working'] = { + init: function() { + this.appendDummyInput() + .appendField("la liaison entre Washington et Louisville fonctionne"); + this.setOutput(true, null); + this.setColour(230); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +Blockly.Blocks['count_letter_in_string'] = { + init: function() { + this.appendValueInput("text") + .setCheck("String") + .appendField("Compter la lettre") + .appendField(new Blockly.FieldTextInput("a"), "letter") + .appendField("dans le texte"); + this.setOutput(true, "Number"); + this.setColour(230); + this.setTooltip("Compte le nombre d'apparitions de cette lettre dans un texte"); + this.setHelpUrl(""); + } +}; diff --git a/res/blocks/arduino_blocks_gen.js b/res/blocks/arduino_blocks_gen.js index 45a5cd607237fea18c537c7aea5c90b65123a869..7919e77fcb92280cd1913b03eadbe88f257e57fe 100644 --- a/res/blocks/arduino_blocks_gen.js +++ b/res/blocks/arduino_blocks_gen.js @@ -1,7 +1,7 @@ Blockly.JavaScript['sendtoarduino'] = function(block) { var value_message = Blockly.JavaScript.valueToCode(block, 'MESSAGE', Blockly.JavaScript.ORDER_ATOMIC); // TODO: Assemble JavaScript into code variable. - var code = 'sendString("'+ value_message + ';"); \n'; + var code = 'sendString("' + value_message + ';"); \n'; return code; }; @@ -18,3 +18,81 @@ Blockly.JavaScript['arduino_wait'] = function(block) { var code = 'sendString("DELAY_'+time_ms+';");\n waitForUnlockFromArduino();\n'; return code; }; + + +Blockly.JavaScript['turn_io'] = function(block) { + var value_io = Blockly.JavaScript.valueToCode(block, 'IO', Blockly.JavaScript.ORDER_ATOMIC); + var value_val = Blockly.JavaScript.valueToCode(block, 'VAL', Blockly.JavaScript.ORDER_ATOMIC); + // TODO: Assemble JavaScript into code variable. + var code = 'sendString("IO_'+ value_io + '_' + value_val + ';");\n'; + return code; +}; + + + + + +/* ACTIVITE 4 */ + +Blockly.JavaScript['activate_camera'] = function(block) { + // TODO: Assemble JavaScript into code variable. + var code = 'alert("Impossible de démarrer la diffusion ! Quelque chose ne va pas ! Le SAS est ouvert ? La caméra est en place ? Le signal est envoyé vers la Terre ?");'; + if (hatch_opened && moon_signal_activated && camera_setup) { + code = ' sendString("IO_3_1;");\n displayConsignes("desc_2"); \n'; + } + return code; +}; + +Blockly.JavaScript['setup_camera_module'] = function(block) { + // TODO: Assemble JavaScript into code variable. + camera_setup = true; + var code = 'camera_setup = true;\n'; + return code; +}; + +Blockly.JavaScript['open_hatch'] = function(block) { + // TODO: Assemble JavaScript into code variable. + hatch_opened = true; + var code = 'hatch_opened = true;\n'; + return code; +}; + + +Blockly.JavaScript['activate_moon_signal'] = function(block) { + // TODO: Assemble JavaScript into code variable. + moon_signal_activated = true; + var code = 'moon_signal_activated = true;\n'; + return code; +}; + + +Blockly.JavaScript['establish_telecoms'] = function(block) { + // TODO: Assemble JavaScript into code variable. + var dropdown_val = block.getFieldValue('val'); + var code = 'alert('+ dropdown_val + ');\n'; + return code; +}; + + +Blockly.JavaScript['call_phone'] = function(block) { + var value_num = Blockly.JavaScript.valueToCode(block, 'NUM', Blockly.JavaScript.ORDER_ATOMIC); + // TODO: Assemble JavaScript into code variable. + var code = 'sendString("RING_'+ value_num + ';");\n'; + return code; +}; + +Blockly.JavaScript['count_letter_in_string'] = function(block) { + var text_letter = block.getFieldValue('letter'); + var value_text = Blockly.JavaScript.valueToCode(block, 'text', Blockly.JavaScript.ORDER_ATOMIC); + var count = value_text.match(new RegExp(text_letter, "g")).length; + var code = count; + // TODO: Change ORDER_NONE to the correct strength. + return [code, Blockly.JavaScript.ORDER_ADDITION]; +}; + +Blockly.JavaScript['is_telecom_working'] = function(block) { + // TODO: Assemble JavaScript into code variable. + var code = false; + // TODO: Change ORDER_NONE to the correct strength. + return [code, Blockly.JavaScript.ORDER_NONE]; +}; diff --git a/res/lib/JS-Interpreter/demos/async.html b/res/lib/JS-Interpreter/demos/async.html deleted file mode 100644 index d166a080ba9b9b1c4f3e38207f68e7bd8c00aef5..0000000000000000000000000000000000000000 --- a/res/lib/JS-Interpreter/demos/async.html +++ /dev/null @@ -1,127 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>JS-Interpreter Async Demo</title> - <link href="style.css" rel="stylesheet" type="text/css"> - <script src="../acorn.js"></script> - <script src="../interpreter.js"></script> - <script> - var myInterpreter; - function initAlert(interpreter, scope) { - var wrapper = function(text) { - return alert(arguments.length ? text : ''); - }; - interpreter.setProperty(scope, 'alert', - interpreter.createNativeFunction(wrapper)); - - var wrapper = function(href, callback) { - var req = new XMLHttpRequest(); - req.open('GET', href, true); - req.onreadystatechange = function() { - if (req.readyState == 4 && req.status == 200) { - callback(req.responseText); - } - }; - req.send(null); - }; - interpreter.setProperty(scope, 'getXhr', - interpreter.createAsyncFunction(wrapper)); - } - - function parseButton() { - var code = document.getElementById('code').value; - myInterpreter = new Interpreter(code, initAlert); - disable(''); - } - - function stepButton() { - if (myInterpreter.stateStack.length) { - var node = - myInterpreter.stateStack[myInterpreter.stateStack.length - 1].node; - var start = node.start; - var end = node.end; - } else { - var start = 0; - var end = 0; - } - createSelection(start, end); - try { - var ok = myInterpreter.step(); - } finally { - if (!ok) { - disable('disabled'); - } - } - } - - function runButton() { - disable('disabled'); - if (myInterpreter.run()) { - // Ran until an async call. Give this call a chance to run. - // Then start running again later. - // 1000ms is waaay too long, but is used here to demo the pause. - setTimeout(runButton, 1000); - } - } - - function disable(disabled) { - document.getElementById('stepButton').disabled = disabled; - document.getElementById('runButton').disabled = disabled; - } - - function createSelection(start, end) { - var field = document.getElementById('code'); - if (field.createTextRange) { - var selRange = field.createTextRange(); - selRange.collapse(true); - selRange.moveStart('character', start); - selRange.moveEnd('character', end); - selRange.select(); - } else if (field.setSelectionRange) { - field.setSelectionRange(start, end); - } else if (field.selectionStart) { - field.selectionStart = start; - field.selectionEnd = end; - } - field.focus(); - } - </script> -</head> -<body> - <h1>JS-Interpreter Async Demo</h1> - - <p>Asynchronous function calls in the real world can be wrapped to appear - synchronous to code running in the JS-Interpreter. The example below - (see this page's source) creates a <code>getXhr</code> function that - fetches a URL and returns the content.</p> - - <p>This function is defined using <code>createAsyncFunction</code> during - initialization. When called, the interpreter is paused until the callback - occurs. During this paused state, <code>step</code> and <code>run</code> - will both do nothing, returning <code>true</code> to indicate that the program - still has code to execute.</p> - - <p>Click <em>Parse</em>, then either click <em>Step</em> repeatedly, - or click <em>Run</em> once. Open your browser's console for errors.</p> - - <p><textarea id="code"> -alert(getXhr('async.txt')); -</textarea><br> - <button onclick="parseButton()">Parse</button> - <button onclick="stepButton()" id="stepButton" disabled="disabled">Step</button> - <button onclick="runButton()" id="runButton" disabled="disabled">Run</button> - </p> - - <p>Back to the <a href="../docs.html">JS-Interpreter documentation</a>.</p> - - <script> - disable('disabled'); - if (location.protocol == 'file:' && - navigator.userAgent.indexOf('Firefox') == -1) { - alert('Warning: This page is loaded with the "file:" protocol.\n' + - 'Your browser might prevent XHR from working here.'); - } - </script> -</body> -</html> diff --git a/res/lib/JS-Interpreter/demos/async.txt b/res/lib/JS-Interpreter/demos/async.txt deleted file mode 100644 index 3dc3aa5164a7af0540f5869c4ae6a32ce270f31f..0000000000000000000000000000000000000000 --- a/res/lib/JS-Interpreter/demos/async.txt +++ /dev/null @@ -1 +0,0 @@ -It worked! diff --git a/res/lib/JS-Interpreter/demos/json.html b/res/lib/JS-Interpreter/demos/json.html deleted file mode 100644 index 5d3d3b4b516c893c4502b517ed6959a7589fb545..0000000000000000000000000000000000000000 --- a/res/lib/JS-Interpreter/demos/json.html +++ /dev/null @@ -1,122 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>JS-Interpreter JSON Demo</title> - <link href="style.css" rel="stylesheet" type="text/css"> - <script src="../acorn.js"></script> - <script src="../interpreter.js"></script> - <script> - var myInterpreter; - function initAlert(interpreter, scope) { - var wrapper = function(text) { - return alert(arguments.length ? text : ''); - }; - interpreter.setProperty(scope, 'alert', - interpreter.createNativeFunction(wrapper)); - - var wrapper = function() { - return document.getElementById('JSON_input').value; - }; - interpreter.setProperty(scope, 'getInput', - interpreter.createNativeFunction(wrapper)); - - var wrapper = function(text) { - document.getElementById('JSON_output').value = text; - }; - interpreter.setProperty(scope, 'setOutput', - interpreter.createNativeFunction(wrapper)); - } - - function parseButton() { - var code = document.getElementById('code').value; - myInterpreter = new Interpreter(code, initAlert); - disable(''); - } - - function stepButton() { - if (myInterpreter.stateStack.length) { - var node = - myInterpreter.stateStack[myInterpreter.stateStack.length - 1].node; - var start = node.start; - var end = node.end; - } else { - var start = 0; - var end = 0; - } - createSelection(start, end); - try { - var ok = myInterpreter.step(); - } finally { - if (!ok) { - disable('disabled'); - } - } - } - - function runButton() { - disable('disabled'); - if (myInterpreter.run()) { - // Async function hit. There's more code to run. - disable(''); - } - } - - function disable(disabled) { - document.getElementById('stepButton').disabled = disabled; - document.getElementById('runButton').disabled = disabled; - } - - function createSelection(start, end) { - var field = document.getElementById('code'); - if (field.createTextRange) { - var selRange = field.createTextRange(); - selRange.collapse(true); - selRange.moveStart('character', start); - selRange.moveEnd('character', end); - selRange.select(); - } else if (field.setSelectionRange) { - field.setSelectionRange(start, end); - } else if (field.selectionStart) { - field.selectionStart = start; - field.selectionEnd = end; - } - field.focus(); - } - </script> -</head> -<body> - <h1>JS-Interpreter JSON Demo</h1> - - <p>Moving primitive values (numbers, strings, booleans, etc) in and out of the - interpreter is easy, they may be passed back and forth in function calls. - By contrast, moving objects in and out of the interpreter is not advised. - Having two JavaScript environments with handles to the same mutable JS object - would be problematic. As a result, the best way to move objects (including - arrays) in and out of the interpreter is to serialize and deserialize them - as JSON. Below is a minimal example of round-tripping a JSON object though - the interpreter and back.</p> - - <p>Click <em>Parse</em>, then either click <em>Step</em> repeatedly, - or click <em>Run</em> once. Open your browser's console for errors.</p> - - <p><textarea id="code" style="height: 10em;"> -var data = JSON.parse(getInput()); -alert(Object.keys(data)); -setOutput(JSON.stringify(data)); -</textarea><br> - <button onclick="parseButton()">Parse</button> - <button onclick="stepButton()" id="stepButton" disabled="disabled">Step</button> - <button onclick="runButton()" id="runButton" disabled="disabled">Run</button> - </p> - - <p>JSON Input: <input id="JSON_input" style="width: 90%" value='{"apollo11":["Neil Armstrong","Buzz Aldrin"],"apollo12":["Pete Conrad","Alan Bean"],"apollo13":[],"apollo14":["Alan Shepard","Edgar Mitchell"],"apollo15":["David Scott","James Irwin"],"apollo16":["John W. Young","Charles Duke"],"apollo17":["Eugene Cernan","Harrison Schmitt"]}'></p> - <p>JSON Output: <input id="JSON_output" style="width: 90%" readonly="true"></p> - - <p>Back to the <a href="../docs.html">JS-Interpreter documentation</a>.</p> - - <script> - disable('disabled'); - </script> -</body> -</html> diff --git a/res/lib/JS-Interpreter/demos/node.js b/res/lib/JS-Interpreter/demos/node.js deleted file mode 100644 index 1d948e0b2313094f06dcd292c31329303d687bbe..0000000000000000000000000000000000000000 --- a/res/lib/JS-Interpreter/demos/node.js +++ /dev/null @@ -1,38 +0,0 @@ -// Minimal test of JS-Interpreter in Node. -global.acorn = require('../acorn'); -const JSInterpreter = require('../interpreter'); - -var myCode = ` -var result = []; -function fibonacci(n, output) { - var a = 1, b = 1, sum; - for (var i = 0; i < n; i++) { - output.push(a); - sum = a + b; - a = b; - b = sum; - } -} -fibonacci(16, result); -alert(result.join(', ')); -`; - -// Set up 'alert' as an interface to Node's console.log. -var initFunc = function(interpreter, scope) { - var wrapper = function(text) { - console.log(text); - }; - interpreter.setProperty(scope, 'alert', - interpreter.createNativeFunction(wrapper)); -}; - -var myInterpreter = new JSInterpreter.Interpreter(myCode, initFunc); - -var runToCompletion = function() { - if (myInterpreter.run()) { - // Ran until an async call. Give this call a chance to run. - // Then start running again later. - setTimeout(runToCompletion, 10); - } -}; -runToCompletion(); diff --git a/res/lib/JS-Interpreter/demos/regexp.html b/res/lib/JS-Interpreter/demos/regexp.html deleted file mode 100644 index 29c1ac93a246675accc7e242ee8e92cec26637f9..0000000000000000000000000000000000000000 --- a/res/lib/JS-Interpreter/demos/regexp.html +++ /dev/null @@ -1,159 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>JS-Interpreter RegExp Demo</title> - <link href="style.css" rel="stylesheet" type="text/css"> - <script src="../acorn.js"></script> - <script src="../interpreter.js"></script> - <script> - var myInterpreter = []; - function initAlert(interpreter, scope) { - var wrapper = function(text) { - return alert(arguments.length ? text : ''); - }; - interpreter.setProperty(scope, 'alert', - interpreter.createNativeFunction(wrapper)); - - var wrapper = function(href, callback) { - var req = new XMLHttpRequest(); - req.open('GET', href, true); - req.onreadystatechange = function() { - if (req.readyState == 4 && req.status == 200) { - callback(req.responseText); - } - }; - req.send(null); - }; - interpreter.setProperty(scope, 'getXhr', - interpreter.createAsyncFunction(wrapper)); - } - - function parseButton(n) { - var code = document.getElementById('code' + n).value; - myInterpreter[n] = new Interpreter(code, initAlert); - myInterpreter[n].REGEXP_MODE = n; - disable(n, ''); - } - - function stepButton(n) { - if (myInterpreter[n].stateStack.length) { - var node = - myInterpreter[n].stateStack[myInterpreter[n].stateStack.length - 1].node; - var start = node.start; - var end = node.end; - } else { - var start = 0; - var end = 0; - } - createSelection(n, start, end); - try { - var ok = myInterpreter[n].step(); - } finally { - if (!ok) { - disable(n, 'disabled'); - } - } - } - - function runButton(n) { - disable(n, 'disabled'); - if (myInterpreter[n].run()) { - // Ran until an async call. Give this call a chance to run. - // Then start running again later. - setTimeout(runButton, 100, n); - } - } - - function disable(n, disabled) { - document.getElementById('stepButton' + n).disabled = disabled; - document.getElementById('runButton' + n).disabled = disabled; - } - - function createSelection(n, start, end) { - var field = document.getElementById('code' + n); - if (field.createTextRange) { - var selRange = field.createTextRange(); - selRange.collapse(true); - selRange.moveStart('character', start); - selRange.moveEnd('character', end); - selRange.select(); - } else if (field.setSelectionRange) { - field.setSelectionRange(start, end); - } else if (field.selectionStart) { - field.selectionStart = start; - field.selectionEnd = end; - } - field.focus(); - } - </script> -</head> -<body> - <h1>JS-Interpreter RegExp Demo</h1> - - <p>Pathological regular expressions can execute in geometric time. - For example <code>'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac'.match(/^(a+)+b/)</code> - will effectively crash any JavaScript runtime. JS-Interpreter has three modes - for handling regular expressions.</p> - - <h2>REGEXP_MODE = 0</h2> - - <p>In mode 0, all regular expressions are disabled and throw an error. This - is safe and works in every environment.</p> - - <p><textarea id="code0"> -// All regular expressions will fail here. -try { - alert('hello'.search(/(.)\1+/)); -} catch (e) { - alert(e); -} -</textarea><br> - <button onclick="parseButton(0)">Parse</button> - <button onclick="stepButton(0)" id="stepButton0" disabled="disabled">Step</button> - <button onclick="runButton(0)" id="runButton0" disabled="disabled">Run</button> - </p> - - <h2>REGEXP_MODE = 1</h2> - - <p>In mode 1, all regular expressions are executed natively. This - is potentially <i>unsafe</i> and works in every environment.</p> - - <p><textarea id="code1"> -// This regular expression is fine and returns 'll'. -alert('hello'.match(/(.)\1+/)[0]); -</textarea><br> - <button onclick="parseButton(1)">Parse</button> - <button onclick="stepButton(1)" id="stepButton1" disabled="disabled">Step</button> - <button onclick="runButton(1)" id="runButton1" disabled="disabled">Run</button> - </p> - - <h2>REGEXP_MODE = 2 (default mode)</h2> - - <p>In mode 2, all regular expressions are executed in a separate environment. - In web browsers this means asynchronously in a Web Worker thread, in Node.js - this means synchronously in a VM. If a regular expression takes more than - REGEXP_THREAD_TIMEOUT (default 1000 ms) then it is terminated and an error - thrown. This is safe and works in most environments. If Web Workers or VM - is not supported (meaning IE 9 or IE 10), then all regular expressions throw - an error.</p> - - <p><textarea id="code2"> -// This regular expression is fine and returns 'aaac'. -alert('aaac'.split(/^(a+)+b/)); -try { - // This regular expression is pathological and hits the timeout. - alert('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac'.split(/^(a+)+b/)); -} catch (e) { - alert(e); -} -</textarea><br> - <button onclick="parseButton(2)">Parse</button> - <button onclick="stepButton(2)" id="stepButton2" disabled="disabled">Step</button> - <button onclick="runButton(2)" id="runButton2" disabled="disabled">Run</button> - </p> - - <p>Back to the <a href="../docs.html">JS-Interpreter documentation</a>.</p> - -</body> -</html> diff --git a/res/lib/JS-Interpreter/demos/serialize.html b/res/lib/JS-Interpreter/demos/serialize.html deleted file mode 100644 index d6dffd576ea39cd35b71e2375bd64a2822590f20..0000000000000000000000000000000000000000 --- a/res/lib/JS-Interpreter/demos/serialize.html +++ /dev/null @@ -1,137 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>JS-Interpreter Serialization Demo</title> - <link href="style.css" rel="stylesheet" type="text/css"> - <script src="../acorn.js"></script> - <script src="../interpreter.js"></script> - <script src="serialize.js"></script> - <script> - var myInterpreter; - function initAlert(interpreter, scope) { - var wrapper = function(text) { - return alert(arguments.length ? text : ''); - }; - interpreter.setProperty(scope, 'alert', - interpreter.createNativeFunction(wrapper)); - } - - function parseButton() { - var code = document.getElementById('code').value; - myInterpreter = new Interpreter(code, initAlert); - disable(''); - } - - function serializeButton() { - var json = serialize(myInterpreter); - document.getElementById('serializeTextarea').value = JSON.stringify(json); - } - - function deserializeButton() { - var text = document.getElementById('serializeTextarea').value; - try { - var json = JSON.parse(text); - } catch (e) { - alert('Invalid JSON\n' + e); - return; - } - // Create a clean interpreter with the same initialization functions. - parseButton(); - deserialize(json, myInterpreter); - } - - function stepButton() { - if (myInterpreter.stateStack.length) { - var node = - myInterpreter.stateStack[myInterpreter.stateStack.length - 1].node; - var start = node.start; - var end = node.end; - } else { - var start = 0; - var end = 0; - } - createSelection(start, end); - try { - var ok = myInterpreter.step(); - } finally { - if (!ok) { - disable('disabled'); - } - } - } - - function runButton() { - disable('disabled'); - if (myInterpreter.run()) { - // Async function hit. There's more code to run. - disable(''); - } - } - - function disable(disabled) { - document.getElementById('stepButton').disabled = disabled; - document.getElementById('runButton').disabled = disabled; - document.getElementById('serializeButton').disabled = disabled; - } - - function createSelection(start, end) { - var field = document.getElementById('code'); - if (field.createTextRange) { - var selRange = field.createTextRange(); - selRange.collapse(true); - selRange.moveStart('character', start); - selRange.moveEnd('character', end); - selRange.select(); - } else if (field.setSelectionRange) { - field.setSelectionRange(start, end); - } else if (field.selectionStart) { - field.selectionStart = start; - field.selectionEnd = end; - } - field.focus(); - } - </script> -</head> -<body> - <h1>JS-Interpreter Serialization Demo</h1> - - <p>The intepreter may be stopped at any time, the state serialized, then - deserialized at a later time, and the interpreter resumed. The functions - for this are in <a href="serialize.js">serialize.js</a>.</p> - - <ol> - <li>Click <em>Parse</em>, then click <em>Step</em> repeatedly.</li> - <li>At some point click <em>Serialize</em>.</li> - <li>Copy the serialized data structure to the clipboard, reload this page, - then paste the data structure back in its text area.</li> - <li>Click <em>Deserialize</em>.</li> - <li>Continue clicking <em>Step</em> repeatedly, or press <em>Run</em>.</li> - </ol> - <p>Open your browser's console for errors.</p> - - <p><textarea id="code" style="height: 10em;"> -var numbers = []; -for (var i = 0; i < 3; i++) { - numbers.push(i); -} -alert(numbers.join('-')); -</textarea><br> - <button onclick="parseButton()">Parse</button> - <button onclick="stepButton()" id="stepButton" disabled="disabled">Step</button> - <button onclick="runButton()" id="runButton" disabled="disabled">Run</button> - </p> - - <p> - <button onclick="serializeButton()" id="serializeButton" disabled="disabled">Serialize ↓</button> - <button onclick="deserializeButton()" id="deserializeButton">Deserialize ↑</button><br> - <textarea id="serializeTextarea" style="height: 10ex; width: 80ex;"></textarea> - </p> - - <p>Back to the <a href="../docs.html">JS-Interpreter documentation</a>.</p> - - <script> - disable('disabled'); - </script> -</body> -</html> diff --git a/res/lib/JS-Interpreter/demos/serialize.js b/res/lib/JS-Interpreter/demos/serialize.js deleted file mode 100644 index f307237dffe962a142db1ae15138df675da5d56a..0000000000000000000000000000000000000000 --- a/res/lib/JS-Interpreter/demos/serialize.js +++ /dev/null @@ -1,310 +0,0 @@ -/** - * @license - * JavaScript Interpreter: serialization and deserialization - * - * Copyright 2017 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Saving and restoring the state of a JS-Intepreter. - * @author fraser@google.com (Neil Fraser) - */ -'use strict'; - -function deserialize(json, interpreter) { - function decodeValue(value) { - if (value && typeof value === 'object') { - var data; - if ((data = value['#'])) { - // Object reference: {'#': 42} - value = objectList[data]; - if (!value) { - throw ReferenceError('Object reference not found: ' + data); - } - return value; - } - if ((data = value['Number'])) { - // Special number: {'Number': 'Infinity'} - return Number(data); - } - if ((data = value['Value'])) { - // Special value: {'Value': 'undefined'} - if (value['Value'] === 'undefined') { - return undefined; - } - } - } - return value; - } - var stack = interpreter.stateStack; - if (!Array.isArray(json)) { - throw TypeError('Top-level JSON is not a list.'); - } - if (!stack.length) { - // Require native functions to be present. - throw Error('Interpreter must be initialized prior to deserialization.'); - } - // Find all native functions in existing interpreter. - var objectList = []; - objectHunt_(stack, objectList); - var functionHash = Object.create(null); - for (var i = 0; i < objectList.length; i++) { - if (typeof objectList[i] == 'function') { - functionHash[objectList[i].id] = objectList[i]; - } - } - // First pass: Create object stubs for every object. - objectList = []; - for (var i = 0; i < json.length; i++) { - var jsonObj = json[i]; - var obj; - switch (jsonObj['type']) { - case 'Map': - obj = Object.create(null); - break; - case 'Object': - obj = {}; - break; - case 'ScopeReference': - obj = Interpreter.SCOPE_REFERENCE; - break; - case 'Function': - obj = functionHash[jsonObj['id']]; - if (!obj) { - throw RangeError('Function ID not found: ' + jsonObj['id']); - } - break; - case 'Array': - // Currently we assume that Arrays are not sparse. - obj = []; - break; - case 'Date': - obj = new Date(jsonObj['data']); - if (isNaN(obj)) { - throw TypeError('Invalid date: ' + jsonObj['data']); - } - break; - case 'RegExp': - obj = RegExp(jsonObj['source'], jsonObj['flags']); - break; - case 'PseudoObject': - obj = new Interpreter.Object(null); - break; - case 'State': - obj = new Interpreter.State(undefined, undefined); - break; - case 'Node': - obj = new interpreter.nodeConstructor(); - break; - default: - throw TypeError('Unknown type: ' + jsonObj['type']); - } - objectList[i] = obj; - } - // Second pass: Populate properties for every object. - for (var i = 0; i < json.length; i++) { - var jsonObj = json[i]; - var obj = objectList[i]; - // Repopulate objects. - var props = jsonObj['props']; - if (props) { - var nonConfigurable = jsonObj['nonConfigurable'] || []; - var nonEnumerable = jsonObj['nonEnumerable'] || []; - var nonWritable = jsonObj['nonWritable'] || []; - var names = Object.getOwnPropertyNames(props); - for (var j = 0; j < names.length; j++) { - var name = names[j]; - Object.defineProperty(obj, name, - {configurable: nonConfigurable.indexOf(name) === -1, - enumerable: nonEnumerable.indexOf(name) === -1, - writable: nonWritable.indexOf(name) === -1, - value: decodeValue(props[name])}); - } - } - // Repopulate arrays. - if (Array.isArray(obj)) { - var data = jsonObj['data']; - if (data) { - for (var j = 0; j < data.length; j++) { - obj.push(decodeValue(data[j])); - } - } - } - } - // First object is the interpreter. - var root = objectList[0]; - for (var prop in root) { - interpreter[prop] = root[prop]; - } -} - -function serialize(interpreter) { - function encodeValue(value) { - if (value && (typeof value === 'object' || typeof value === 'function')) { - var ref = objectList.indexOf(value); - if (ref === -1) { - throw RangeError('Object not found in table.'); - } - return {'#': ref}; - } - if (value === undefined) { - return {'Value': 'undefined'}; - } - if (typeof value === 'number') { - if (value === Infinity) { - return {'Number': 'Infinity'}; - } else if (value === -Infinity) { - return {'Number': '-Infinity'}; - } else if (isNaN(value)) { - return {'Number': 'NaN'}; - } else if (1 / value === -Infinity) { - return {'Number': '-0'}; - } - } - return value; - } - // Shallow-copy all properties of interest onto a root object. - var properties = [ - 'OBJECT', 'OBJECT_PROTO', - 'FUNCTION', 'FUNCTION_PROTO', - 'ARRAY', 'ARRAY_PROTO', - 'REGEXP', 'REGEXP_PROTO', - 'BOOLEAN', - 'DATE', - 'NUMBER', - 'STRING', - 'ERROR', - 'EVAL_ERROR', - 'RANGE_ERROR', - 'REFERENCE_ERROR', - 'SYNTAX_ERROR', - 'TYPE_ERROR', - 'URI_ERROR', - 'global', - 'stateStack' - ]; - var root = Object.create(null); - for (var i = 0; i < properties.length; i++) { - root[properties[i]] = interpreter[properties[i]]; - } - - // Find all objects. - var objectList = []; - objectHunt_(root, objectList); - // Serialize every object. - var json = []; - for (var i = 0; i < objectList.length; i++) { - var jsonObj = Object.create(null); - json.push(jsonObj); - var obj = objectList[i]; - // Uncomment this line for a debugging label. - //jsonObj['#'] = i; - switch (Object.getPrototypeOf(obj)) { - case null: - jsonObj['type'] = 'Map'; - break; - case Object.prototype: - if (obj === Interpreter.SCOPE_REFERENCE) { - jsonObj['type'] = 'ScopeReference'; - continue; // No need to index properties. - } else { - jsonObj['type'] = 'Object'; - } - break; - case Function.prototype: - jsonObj['type'] = 'Function'; - jsonObj['id'] = obj.id; - if (obj.id === undefined) { - throw Error('Native function has no ID: ' + obj); - } - continue; // No need to index properties. - case Array.prototype: - // Currently we assume that Arrays are not sparse. - jsonObj['type'] = 'Array'; - if (obj.length) { - jsonObj['data'] = obj.map(encodeValue); - } - continue; // No need to index properties. - case Date.prototype: - jsonObj['type'] = 'Date'; - jsonObj['data'] = obj.toJSON(); - continue; // No need to index properties. - case RegExp.prototype: - jsonObj['type'] = 'RegExp'; - jsonObj['source'] = obj.source; - jsonObj['flags'] = obj.flags; - continue; // No need to index properties. - case Interpreter.Object.prototype: - jsonObj['type'] = 'PseudoObject'; - break; - case Interpreter.State.prototype: - jsonObj['type'] = 'State'; - break; - case interpreter.nodeConstructor.prototype: - jsonObj['type'] = 'Node'; - break; - default: - throw TypeError('Unknown type: ' + obj); - } - var props = Object.create(null); - var nonConfigurable = []; - var nonEnumerable = []; - var nonWritable = []; - var names = Object.getOwnPropertyNames(obj); - for (var j = 0; j < names.length; j++) { - var name = names[j]; - props[name] = encodeValue(obj[name]); - var descriptor = Object.getOwnPropertyDescriptor(obj, name); - if (!descriptor.configurable) { - nonConfigurable.push(name); - } - if (!descriptor.enumerable) { - nonEnumerable.push(name); - } - if (!descriptor.writable) { - nonWritable.push(name); - } - } - if (names.length) { - jsonObj['props'] = props; - } - if (nonConfigurable.length) { - jsonObj['nonConfigurable'] = nonConfigurable; - } - if (nonEnumerable.length) { - jsonObj['nonEnumerable'] = nonEnumerable; - } - if (nonWritable.length) { - jsonObj['nonWritable'] = nonWritable; - } - } - return json; -} - -// Recursively search the stack to find all non-primitives. -function objectHunt_(node, objectList) { - if (node && (typeof node === 'object' || typeof node === 'function')) { - if (objectList.indexOf(node) != -1) { - return; - } - objectList.push(node); - if (typeof node === 'object') { // Recurse. - var names = Object.getOwnPropertyNames(node); - for (var i = 0; i < names.length; i++) { - objectHunt_(node[names[i]], objectList); - } - } - } -} diff --git a/res/lib/JS-Interpreter/demos/style.css b/res/lib/JS-Interpreter/demos/style.css deleted file mode 100644 index 0d14ba548e0736e1006ccf8609520582ea9e7e3d..0000000000000000000000000000000000000000 --- a/res/lib/JS-Interpreter/demos/style.css +++ /dev/null @@ -1,17 +0,0 @@ -body { - background-color: #fff; - font-family: sans-serif; -} -a:hover { - color: red; -} -h1, h2, h3 { - font-weight: normal; -} -textarea { - font-family: monospace; - font-size: larger; - height: 15em; - width: 100%; - max-width: 111ex; -} diff --git a/res/lib/JS-Interpreter/demos/thread.html b/res/lib/JS-Interpreter/demos/thread.html deleted file mode 100644 index fb1b2394b46dd5fd1f455d211a3d0e2dc1a1f701..0000000000000000000000000000000000000000 --- a/res/lib/JS-Interpreter/demos/thread.html +++ /dev/null @@ -1,140 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>JS-Interpreter Thread Demo</title> - <link href="style.css" rel="stylesheet" type="text/css"> - <script src="../acorn.js"></script> - <script src="../interpreter.js"></script> - <script> - function initAlert(interpreter, scope) { - var wrapper = function(text) { - return alert(arguments.length ? text : ''); - }; - interpreter.setProperty(scope, 'alert', - interpreter.createNativeFunction(wrapper)); - } - // Create an interpreter whose global scope will be the cross-thread global. - var myInterpreter = new Interpreter('', initAlert); - var threads = []; - - function parseButton(n) { - var code = document.getElementById('code' + n).value; - var intrp = new Interpreter(''); - // Replace this thread's global scope with the cross-thread global. - intrp.stateStack[0].scope = myInterpreter.global; - intrp.appendCode(code); - threads[n] = intrp.stateStack; - disable(n, ''); - } - - function stepButton(n) { - myInterpreter.stateStack = threads[n]; - if (myInterpreter.stateStack.length) { - var node = - myInterpreter.stateStack[myInterpreter.stateStack.length - 1].node; - var start = node.start; - var end = node.end; - } else { - var start = 0; - var end = 0; - } - createSelection(n, start, end); - try { - var ok = myInterpreter.step(); - } finally { - if (!ok) { - disable(n, 'disabled'); - } - } - } - - function disable(n, disabled) { - document.getElementById('stepButton' + n).disabled = disabled; - } - - function createSelection(n, start, end) { - var field = document.getElementById('code' + n); - if (field.createTextRange) { - var selRange = field.createTextRange(); - selRange.collapse(true); - selRange.moveStart('character', start); - selRange.moveEnd('character', end); - selRange.select(); - } else if (field.setSelectionRange) { - field.setSelectionRange(start, end); - } else if (field.selectionStart) { - field.selectionStart = start; - field.selectionEnd = end; - } - field.focus(); - } - </script> -</head> -<body> - <h1>JS-Interpreter Thread Demo</h1> - - <p>Creating two or more completely independent threads that run separately - from each other is trivial. Just create two instances of the Interpreter, - each with its own code, and alternate calling each interpreter's step function.</p> - - <p>This demo illustrates the slightly harder problem of creating two threads - that share the same global environment. This allows one to share functions - and variables, as well as to communicate between threads.</p> - - <ol> - <li>Click <em>Parse</em> on thread #1, then click <em>Step</em> repeatedly - until one gets past the var line.</li> - <li>Click <em>Parse</em> on thread #2, then click <em>Step</em> repeatedly - to alert the value of 'foo'.</li> - <li>Continue clicking <em>Step</em> repeatedly on either thread to set or - read 'foo'.</li> - </ol> - <p>Open your browser's console for errors.</p> - -<table style="width: 100%;"> - <tr> - <td> - Thread #1 - </td> - <td> - Thread #2 - </td> - </tr> - <tr> - <td> -<textarea id="code1" style="height: 6em; width: 100%;"> -var foo = 0; -while(true) { - foo++; -} -</textarea> - </td> - <td> -<textarea id="code2" style="height: 6em; width: 100%;"> -while(true) { - alert(foo); -} -</textarea> - </td> - </tr> - <tr> - <td> - <button onclick="parseButton(1)">Parse</button> - <button onclick="stepButton(1)" id="stepButton1" disabled="disabled">Step</button> - </td> - <td> - <button onclick="parseButton(2)">Parse</button> - <button onclick="stepButton(2)" id="stepButton2" disabled="disabled">Step</button> - </td> - </tr> -</table> - - <p>Back to the <a href="../docs.html">JS-Interpreter documentation</a>.</p> - - <script> - disable(1, 'disabled'); - disable(2, 'disabled'); - </script> -</body> -</html> diff --git a/res/lib/blockly/demos/accessible/icon.png b/res/lib/blockly/demos/accessible/icon.png deleted file mode 100644 index 0f4d66cbf5aa8a28efb14d86688fe2b59f1c979e..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/accessible/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/accessible/index.html b/res/lib/blockly/demos/accessible/index.html deleted file mode 100644 index bdc3cdd588f041054df4ccc5c8916e907ff3fa8f..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/accessible/index.html +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Refresh" content="0; url=https://github.com/google/blockly-experimental"> -</head> -<body> - <body> - <p>This demo has moved to a <a href="https://github.com/google/blockly-experimental">new repository</a>.</p> - </body> -</body> -</html> diff --git a/res/lib/blockly/demos/blockfactory/analytics.js b/res/lib/blockly/demos/blockfactory/analytics.js deleted file mode 100644 index e3d112f2042e840ccc634eb1e891f836b607269a..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/analytics.js +++ /dev/null @@ -1,208 +0,0 @@ -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Stubbed interface functions for analytics integration. - */ - -var BlocklyDevTools = BlocklyDevTools || Object.create(null); -BlocklyDevTools.Analytics = BlocklyDevTools.Analytics || Object.create(null); - -/** - * Whether these stub methods should log analytics calls to the console. - * @private - * @const - */ -BlocklyDevTools.Analytics.LOG_TO_CONSOLE_ = false; - -/** - * An import/export type id for a library of BlockFactory's original block - * save files (each a serialized workspace of block definition blocks). - * @package - * @const - */ -BlocklyDevTools.Analytics.BLOCK_FACTORY_LIBRARY = "Block Factory library"; -/** - * An import/export type id for a standard Blockly library of block - * definitions. - * @package - * @const - */ -BlocklyDevTools.Analytics.BLOCK_DEFINITIONS = "Block definitions"; -/** - * An import/export type id for a code generation function, or a - * boilerplate stub of the same. - * - * @package - * @const - */ -BlocklyDevTools.Analytics.GENERATOR = "Generator"; -/** - * An import/export type id for a Blockly Toolbox. - * - * @package - * @const - */ -BlocklyDevTools.Analytics.TOOLBOX = "Toolbox"; -/** - * An import/export type id for the serialized contents of a workspace. - * - * @package - * @const - */ -BlocklyDevTools.Analytics.WORKSPACE_CONTENTS = "Workspace contents"; - -/** - * Format id for imported/exported JavaScript resources. - * - * @package - * @const - */ -BlocklyDevTools.Analytics.FORMAT_JS = "JavaScript"; -/** - * Format id for imported/exported JSON resources. - * - * @package - * @const - */ -BlocklyDevTools.Analytics.FORMAT_JSON = "JSON"; -/** - * Format id for imported/exported XML resources. - * - * @package - * @const - */ -BlocklyDevTools.Analytics.FORMAT_XML = "XML"; - -/** - * Platform id for resources exported for use in Android projects. - * - * @package - * @const - */ -BlocklyDevTools.Analytics.PLATFORM_ANDROID = "Android"; -/** - * Platform id for resources exported for use in iOS projects. - * - * @package - * @const - */ -BlocklyDevTools.Analytics.PLATFORM_IOS = "iOS"; -/** - * Platform id for resources exported for use in web projects. - * - * @package - * @const - */ -BlocklyDevTools.Analytics.PLATFORM_WEB = "web"; - -/** - * Initializes the analytics framework, including noting that the page/app was - * opened. - * @package - */ -BlocklyDevTools.Analytics.init = function() { - // stub - this.LOG_TO_CONSOLE_ && console.log('Analytics.init'); -}; - -/** - * Event noting the user navigated to a specific view. - * - * @package - * @param viewId {string} An identifier for the view state. - */ -BlocklyDevTools.Analytics.onNavigateTo = function(viewId) { - // stub - this.LOG_TO_CONSOLE_ && - console.log('Analytics.onNavigateTo(' + viewId + ')'); -}; - -/** - * Event noting a project resource was saved. In the web Block Factory, this - * means saved to localStorage. - * - * @package - * @param typeId {string} An identifying string for the saved type. - */ -BlocklyDevTools.Analytics.onSave = function(typeId) { - // stub - this.LOG_TO_CONSOLE_ && console.log('Analytics.onSave(' + typeId + ')'); -}; - -/** - * Event noting the user attempted to import a resource file. - * - * @package - * @param typeId {string} An identifying string for the imported type. - * @param optMetadata {Object} Metadata about the import, such as format and - * platform. - */ -BlocklyDevTools.Analytics.onImport = function(typeId, optMetadata) { - // stub - this.LOG_TO_CONSOLE_ && console.log('Analytics.onImport(' + typeId + - (optMetadata ? '): ' + JSON.stringify(optMetadata) : ')')); -}; - -/** - * Event noting a project resource was saved. In the web Block Factory, this - * means downloaded to the user's system. - * - * @package - * @param typeId {string} An identifying string for the exported object type. - * @param optMetadata {Object} Metadata about the import, such as format and - * platform. - */ -BlocklyDevTools.Analytics.onExport = function(typeId, optMetadata) { - // stub - this.LOG_TO_CONSOLE_ && console.log('Analytics.onExport(' + typeId + - (optMetadata ? '): ' + JSON.stringify(optMetadata) : ')')); -}; - -/** - * Event noting the system encountered an error. It should attempt to send - * immediately. - * - * @package - * @param e {!Object} A value representing or describing the error. - */ -BlocklyDevTools.Analytics.onError = function(e) { - // stub - this.LOG_TO_CONSOLE_ && - console.log('Analytics.onError("' + e.toString() + '")'); -}; - -/** - * Event noting the user was notified with a warning. - * - * @package - * @param msg {string} The warning message, or a description thereof. - */ -BlocklyDevTools.Analytics.onWarning = function(msg) { - // stub - this.LOG_TO_CONSOLE_ && console.log('Analytics.onWarning("' + msg + '")'); -}; - -/** - * Request the analytics framework to send any queued events to the server. - * @package - */ -BlocklyDevTools.Analytics.sendQueued = function() { - // stub - this.LOG_TO_CONSOLE_ && console.log('Analytics.sendQueued'); -}; - diff --git a/res/lib/blockly/demos/blockfactory/app_controller.js b/res/lib/blockly/demos/blockfactory/app_controller.js deleted file mode 100644 index 3693b8dd6ba20c0f30e7e6645d2c9c93a7ec3a73..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/app_controller.js +++ /dev/null @@ -1,725 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview The AppController Class brings together the Block - * Factory, Block Library, and Block Exporter functionality into a single web - * app. - * - * @author quachtina96 (Tina Quach) - */ - -/** - * Controller for the Blockly Factory - * @constructor - */ -AppController = function() { - // Initialize Block Library - this.blockLibraryName = 'blockLibrary'; - this.blockLibraryController = - new BlockLibraryController(this.blockLibraryName); - this.blockLibraryController.populateBlockLibrary(); - - // Construct Workspace Factory Controller. - this.workspaceFactoryController = new WorkspaceFactoryController - ('workspacefactory_toolbox', 'toolbox_blocks', 'preview_blocks'); - - // Initialize Block Exporter - this.exporter = - new BlockExporterController(this.blockLibraryController.storage); - - // Map of tab type to the div element for the tab. - this.tabMap = Object.create(null); - this.tabMap[AppController.BLOCK_FACTORY] = - document.getElementById('blockFactory_tab'); - this.tabMap[AppController.WORKSPACE_FACTORY] = - document.getElementById('workspaceFactory_tab'); - this.tabMap[AppController.EXPORTER] = - document.getElementById('blocklibraryExporter_tab'); - - // Last selected tab. - this.lastSelectedTab = null; - // Selected tab. - this.selectedTab = AppController.BLOCK_FACTORY; -}; - -// Constant values representing the three tabs in the controller. -AppController.BLOCK_FACTORY = 'BLOCK_FACTORY'; -AppController.WORKSPACE_FACTORY = 'WORKSPACE_FACTORY'; -AppController.EXPORTER = 'EXPORTER'; - -/** - * Tied to the 'Import Block Library' button. Imports block library from file to - * Block Factory. Expects user to upload a single file of JSON mapping each - * block type to its XML text representation. - */ -AppController.prototype.importBlockLibraryFromFile = function() { - var self = this; - var files = document.getElementById('files'); - // If the file list is empty, the user likely canceled in the dialog. - if (files.files.length > 0) { - BlocklyDevTools.Analytics.onImport( - BlocklyDevTools.Analytics.BLOCK_FACTORY_LIBRARY, - { format: BlocklyDevTools.Analytics.FORMAT_XML }); - - // The input tag doesn't have the "multiple" attribute - // so the user can only choose 1 file. - var file = files.files[0]; - var fileReader = new FileReader(); - - // Create a map of block type to XML text from the file when it has been - // read. - fileReader.addEventListener('load', function(event) { - var fileContents = event.target.result; - // Create empty object to hold the read block library information. - var blockXmlTextMap = Object.create(null); - try { - // Parse the file to get map of block type to XML text. - blockXmlTextMap = self.formatBlockLibraryForImport_(fileContents); - } catch (e) { - var message = 'Could not load your block library file.\n' - window.alert(message + '\nFile Name: ' + file.name); - return; - } - - // Create a new block library storage object with inputted block library. - var blockLibStorage = new BlockLibraryStorage( - self.blockLibraryName, blockXmlTextMap); - - // Update block library controller with the new block library - // storage. - self.blockLibraryController.setBlockLibraryStorage(blockLibStorage); - // Update the block library dropdown. - self.blockLibraryController.populateBlockLibrary(); - // Update the exporter's block library storage. - self.exporter.setBlockLibraryStorage(blockLibStorage); - }); - // Read the file. - fileReader.readAsText(file); - } -}; - -/** - * Tied to the 'Export Block Library' button. Exports block library to file that - * contains JSON mapping each block type to its XML text representation. - */ -AppController.prototype.exportBlockLibraryToFile = function() { - // Get map of block type to XML. - var blockLib = this.blockLibraryController.getBlockLibrary(); - // Concatenate the XMLs, each separated by a blank line. - var blockLibText = this.formatBlockLibraryForExport_(blockLib); - // Get file name. - var filename = prompt('Enter the file name under which to save your block ' + - 'library.', 'library.xml'); - // Download file if all necessary parameters are provided. - if (filename) { - FactoryUtils.createAndDownloadFile(blockLibText, filename, 'xml'); - BlocklyDevTools.Analytics.onExport( - BlocklyDevTools.Analytics.BLOCK_FACTORY_LIBRARY, - { format: BlocklyDevTools.Analytics.FORMAT_XML }); - } else { - var msg = 'Could not export Block Library without file name under which ' + - 'to save library.'; - BlocklyDevTools.Analytics.onWarning(msg); - alert(msg); - } -}; - -/** - * Converts an object mapping block type to XML to text file for output. - * @param {!Object} blockXmlMap Object mapping block type to XML. - * @return {string} XML text containing the block XMLs. - * @private - */ -AppController.prototype.formatBlockLibraryForExport_ = function(blockXmlMap) { - // Create DOM for XML. - var xmlDom = Blockly.utils.xml.createElement('xml'); - - // Append each block node to XML DOM. - for (var blockType in blockXmlMap) { - var blockXmlDom = Blockly.Xml.textToDom(blockXmlMap[blockType]); - var blockNode = blockXmlDom.firstElementChild; - xmlDom.appendChild(blockNode); - } - - // Return the XML text. - return Blockly.Xml.domToText(xmlDom); -}; - -/** - * Converts imported block library to an object mapping block type to block XML. - * @param {string} xmlText String representation of an XML with each block as - * a child node. - * @return {!Object} Object mapping block type to XML text. - * @private - */ -AppController.prototype.formatBlockLibraryForImport_ = function(xmlText) { - var inputXml = Blockly.Xml.textToDom(xmlText); - // Convert the live HTMLCollection of child Elements into a static array, - // since the addition to editorWorkspaceXml below removes it from inputXml. - var inputChildren = Array.from(inputXml.children); - - // Create empty map. The line below creates a truly empy object. It doesn't - // have built-in attributes/functions such as length or toString. - var blockXmlTextMap = Object.create(null); - - // Populate map. - for (var i = 0, blockNode; blockNode = inputChildren[i]; i++) { - // Add outer XML tag to the block for proper injection in to the - // main workspace. - // Create DOM for XML. - var editorWorkspaceXml = Blockly.utils.xml.createElement('xml'); - editorWorkspaceXml.appendChild(blockNode); - - xmlText = Blockly.Xml.domToText(editorWorkspaceXml); - // All block types should be lowercase. - var blockType = this.getBlockTypeFromXml_(xmlText).toLowerCase(); - // Some names are invalid so fix them up. - blockType = FactoryUtils.cleanBlockType(blockType); - - blockXmlTextMap[blockType] = xmlText; - } - - return blockXmlTextMap; -}; - -/** - * Extracts out block type from XML text, the kind that is saved in block - * library storage. - * @param {string} xmlText A block's XML text. - * @return {string} The block type that corresponds to the provided XML text. - * @private - */ -AppController.prototype.getBlockTypeFromXml_ = function(xmlText) { - var xmlDom = Blockly.Xml.textToDom(xmlText); - // Find factory base block. - var factoryBaseBlockXml = xmlDom.getElementsByTagName('block')[0]; - // Get field elements from factory base. - var fields = factoryBaseBlockXml.getElementsByTagName('field'); - for (var i = 0; i < fields.length; i++) { - // The field whose name is 'NAME' holds the block type as its value. - if (fields[i].getAttribute('name') == 'NAME') { - return fields[i].childNodes[0].nodeValue; - } - } -}; - -/** - * Add click handlers to each tab to allow switching between the Block Factory, - * Workspace Factory, and Block Exporter tab. - * @param {!Object} tabMap Map of tab name to div element that is the tab. - */ -AppController.prototype.addTabHandlers = function(tabMap) { - var self = this; - for (var tabName in tabMap) { - var tab = tabMap[tabName]; - // Use an additional closure to correctly assign the tab callback. - tab.addEventListener('click', self.makeTabClickHandler_(tabName)); - } -}; - -/** - * Set the selected tab. - * @param {string} tabName AppController.BLOCK_FACTORY, - * AppController.WORKSPACE_FACTORY, or AppController.EXPORTER - * @private - */ -AppController.prototype.setSelected_ = function(tabName) { - this.lastSelectedTab = this.selectedTab; - this.selectedTab = tabName; -}; - -/** - * Creates the tab click handler specific to the tab specified. - * @param {string} tabName AppController.BLOCK_FACTORY, - * AppController.WORKSPACE_FACTORY, or AppController.EXPORTER - * @return {!Function} The tab click handler. - * @private - */ -AppController.prototype.makeTabClickHandler_ = function(tabName) { - var self = this; - return function() { - self.setSelected_(tabName); - self.onTab(); - }; -}; - -/** - * Called on each tab click. Hides and shows specific content based on which tab - * (Block Factory, Workspace Factory, or Exporter) is selected. - */ -AppController.prototype.onTab = function() { - // Get tab div elements. - var blockFactoryTab = this.tabMap[AppController.BLOCK_FACTORY]; - var exporterTab = this.tabMap[AppController.EXPORTER]; - var workspaceFactoryTab = this.tabMap[AppController.WORKSPACE_FACTORY]; - - // Warn user if they have unsaved changes when leaving Block Factory. - if (this.lastSelectedTab == AppController.BLOCK_FACTORY && - this.selectedTab != AppController.BLOCK_FACTORY) { - - var hasUnsavedChanges = - !FactoryUtils.savedBlockChanges(this.blockLibraryController); - if (hasUnsavedChanges) { - var msg = 'You have unsaved changes in Block Factory.'; - var continueAnyway = confirm(msg); - BlocklyDevTools.Analytics.onWarning(msg); - if (!continueAnyway) { - // If the user doesn't want to switch tabs with unsaved changes, - // stay on Block Factory Tab. - this.setSelected_(AppController.BLOCK_FACTORY); - this.lastSelectedTab = AppController.BLOCK_FACTORY; - return; - } - } - } - - // Only enable key events in workspace factory if workspace factory tab is - // selected. - this.workspaceFactoryController.keyEventsEnabled = - this.selectedTab == AppController.WORKSPACE_FACTORY; - - // Turn selected tab on and other tabs off. - this.styleTabs_(); - - if (this.selectedTab == AppController.EXPORTER) { - BlocklyDevTools.Analytics.onNavigateTo('Exporter'); - - // Hide other tabs. - FactoryUtils.hide('workspaceFactoryContent'); - FactoryUtils.hide('blockFactoryContent'); - // Show exporter tab. - FactoryUtils.show('blockLibraryExporter'); - - // Need accurate state in order to know which blocks are used in workspace - // factory. - this.workspaceFactoryController.saveStateFromWorkspace(); - - // Update exporter's list of the types of blocks used in workspace factory. - var usedBlockTypes = this.workspaceFactoryController.getAllUsedBlockTypes(); - this.exporter.setUsedBlockTypes(usedBlockTypes); - - // Update exporter's block selector to reflect current block library. - this.exporter.updateSelector(); - - // Update the exporter's preview to reflect any changes made to the blocks. - this.exporter.updatePreview(); - - } else if (this.selectedTab == AppController.BLOCK_FACTORY) { - BlocklyDevTools.Analytics.onNavigateTo('BlockFactory'); - - // Hide other tabs. - FactoryUtils.hide('blockLibraryExporter'); - FactoryUtils.hide('workspaceFactoryContent'); - // Show Block Factory. - FactoryUtils.show('blockFactoryContent'); - - } else if (this.selectedTab == AppController.WORKSPACE_FACTORY) { - // TODO: differentiate Workspace and Toolbox editor, based on the other tab state. - BlocklyDevTools.Analytics.onNavigateTo('WorkspaceFactory'); - - // Hide other tabs. - FactoryUtils.hide('blockLibraryExporter'); - FactoryUtils.hide('blockFactoryContent'); - // Show workspace factory container. - FactoryUtils.show('workspaceFactoryContent'); - // Update block library category. - var categoryXml = this.exporter.getBlockLibraryCategory(); - var blockTypes = this.blockLibraryController.getStoredBlockTypes(); - this.workspaceFactoryController.setBlockLibCategory(categoryXml, - blockTypes); - } - - // Resize to render workspaces' toolboxes correctly for all tabs. - window.dispatchEvent(new Event('resize')); -}; - -/** - * Called on each tab click. Styles the tabs to reflect which tab is selected. - * @private - */ -AppController.prototype.styleTabs_ = function() { - for (var tabName in this.tabMap) { - if (this.selectedTab == tabName) { - this.tabMap[tabName].classList.replace('taboff', 'tabon'); - } else { - this.tabMap[tabName].classList.replace('tabon', 'taboff'); - } - } -}; - -/** - * Assign button click handlers for the exporter. - */ -AppController.prototype.assignExporterClickHandlers = function() { - var self = this; - document.getElementById('button_setBlocks').addEventListener('click', - function() { - self.openModal('dropdownDiv_setBlocks'); - }); - - document.getElementById('dropdown_addAllUsed').addEventListener('click', - function() { - self.exporter.selectUsedBlocks(); - self.exporter.updatePreview(); - self.closeModal(); - }); - - document.getElementById('dropdown_addAllFromLib').addEventListener('click', - function() { - self.exporter.selectAllBlocks(); - self.exporter.updatePreview(); - self.closeModal(); - }); - - document.getElementById('clearSelectedButton').addEventListener('click', - function() { - self.exporter.clearSelectedBlocks(); - self.exporter.updatePreview(); - }); - - // Export blocks when the user submits the export settings. - document.getElementById('exporterSubmitButton').addEventListener('click', - function() { - self.exporter.export(); - }); -}; - -/** - * Assign change listeners for the exporter. These allow for the dynamic update - * of the exporter preview. - */ -AppController.prototype.assignExporterChangeListeners = function() { - var self = this; - - var blockDefCheck = document.getElementById('blockDefCheck'); - var genStubCheck = document.getElementById('genStubCheck'); - - // Select the block definitions and generator stubs on default. - blockDefCheck.checked = true; - genStubCheck.checked = true; - - // Checking the block definitions checkbox displays preview of code to export. - document.getElementById('blockDefCheck').addEventListener('change', - function(e) { - self.ifCheckedEnable(blockDefCheck.checked, - ['blockDefs', 'blockDefSettings']); - }); - - // Preview updates when user selects different block definition format. - document.getElementById('exportFormat').addEventListener('change', - function(e) { - self.exporter.updatePreview(); - }); - - // Checking the generator stub checkbox displays preview of code to export. - document.getElementById('genStubCheck').addEventListener('change', - function(e) { - self.ifCheckedEnable(genStubCheck.checked, - ['genStubs', 'genStubSettings']); - }); - - // Preview updates when user selects different generator stub language. - document.getElementById('exportLanguage').addEventListener('change', - function(e) { - self.exporter.updatePreview(); - }); -}; - -/** - * If given checkbox is checked, enable the given elements. Otherwise, disable. - * @param {boolean} enabled True if enabled, false otherwise. - * @param {!Array.<string>} idArray Array of element IDs to enable when - * checkbox is checked. - */ -AppController.prototype.ifCheckedEnable = function(enabled, idArray) { - for (var i = 0, id; id = idArray[i]; i++) { - var element = document.getElementById(id); - if (enabled) { - element.classList.remove('disabled'); - } else { - element.classList.add('disabled'); - } - var fields = element.querySelectorAll('input, textarea, select'); - for (var j = 0, field; field = fields[j]; j++) { - field.disabled = !enabled; - } - } -}; - -/** - * Assign button click handlers for the block library. - */ -AppController.prototype.assignLibraryClickHandlers = function() { - var self = this; - - // Button for saving block to library. - document.getElementById('saveToBlockLibraryButton').addEventListener('click', - function() { - self.blockLibraryController.saveToBlockLibrary(); - }); - - // Button for removing selected block from library. - document.getElementById('removeBlockFromLibraryButton').addEventListener( - 'click', - function() { - self.blockLibraryController.removeFromBlockLibrary(); - }); - - // Button for clearing the block library. - document.getElementById('clearBlockLibraryButton').addEventListener('click', - function() { - self.blockLibraryController.clearBlockLibrary(); - }); - - // Hide and show the block library dropdown. - document.getElementById('button_blockLib').addEventListener('click', - function() { - self.openModal('dropdownDiv_blockLib'); - }); -}; - -/** - * Assign button click handlers for the block factory. - */ -AppController.prototype.assignBlockFactoryClickHandlers = function() { - var self = this; - // Assign button event handlers for Block Factory. - document.getElementById('localSaveButton') - .addEventListener('click', function() { - self.exportBlockLibraryToFile(); - }); - - document.getElementById('helpButton').addEventListener('click', - function() { - open('https://developers.google.com/blockly/custom-blocks/block-factory', - 'BlockFactoryHelp'); - }); - - document.getElementById('files').addEventListener('change', - function() { - // Warn user. - var replace = confirm('This imported block library will ' + - 'replace your current block library.'); - if (replace) { - self.importBlockLibraryFromFile(); - // Clear this so that the change event still fires even if the - // same file is chosen again. If the user re-imports a file, we - // want to reload the workspace with its contents. - this.value = null; - } - }); - - document.getElementById('createNewBlockButton') - .addEventListener('click', function() { - // If there are unsaved changes warn user, check if they'd like to - // proceed with unsaved changes, and act accordingly. - var proceedWithUnsavedChanges = - self.blockLibraryController.warnIfUnsavedChanges(); - if (!proceedWithUnsavedChanges) { - return; - } - - BlockFactory.showStarterBlock(); - self.blockLibraryController.setNoneSelected(); - - // Close the Block Library Dropdown. - self.closeModal(); - }); -}; - -/** - * Add event listeners for the block factory. - */ -AppController.prototype.addBlockFactoryEventListeners = function() { - // Update code on changes to block being edited. - BlockFactory.mainWorkspace.addChangeListener(BlockFactory.updateLanguage); - - // Disable blocks not attached to the factory_base block. - BlockFactory.mainWorkspace.addChangeListener(Blockly.Events.disableOrphans); - - // Update the buttons on the screen based on whether - // changes have been saved. - var self = this; - BlockFactory.mainWorkspace.addChangeListener(function() { - self.blockLibraryController.updateButtons(FactoryUtils.savedBlockChanges( - self.blockLibraryController)); - }); - - document.getElementById('direction') - .addEventListener('change', BlockFactory.updatePreview); - document.getElementById('languageTA') - .addEventListener('change', BlockFactory.manualEdit); - document.getElementById('languageTA') - .addEventListener('keyup', BlockFactory.manualEdit); - document.getElementById('format') - .addEventListener('change', BlockFactory.formatChange); - document.getElementById('language') - .addEventListener('change', BlockFactory.updatePreview); -}; - -/** - * Handle Blockly Storage with App Engine. - */ -AppController.prototype.initializeBlocklyStorage = function() { - BlocklyStorage.HTTPREQUEST_ERROR = - 'There was a problem with the request.\n'; - BlocklyStorage.LINK_ALERT = - 'Share your blocks with this link:\n\n%1'; - BlocklyStorage.HASH_ERROR = - 'Sorry, "%1" doesn\'t correspond with any saved Blockly file.'; - BlocklyStorage.XML_ERROR = 'Could not load your saved file.\n' + - 'Perhaps it was created with a different version of Blockly?'; - var linkButton = document.getElementById('linkButton'); - linkButton.style.display = 'inline-block'; - linkButton.addEventListener('click', - function() { - BlocklyStorage.link(BlockFactory.mainWorkspace);}); - BlockFactory.disableEnableLink(); -}; - -/** - * Handle resizing of elements. - */ -AppController.prototype.onresize = function(event) { - if (this.selectedTab == AppController.BLOCK_FACTORY) { - // Handle resizing of Block Factory elements. - var expandList = [ - document.getElementById('blocklyPreviewContainer'), - document.getElementById('blockly'), - document.getElementById('blocklyMask'), - document.getElementById('preview'), - document.getElementById('languagePre'), - document.getElementById('languageTA'), - document.getElementById('generatorPre'), - ]; - for (var i = 0, expand; expand = expandList[i]; i++) { - expand.style.width = (expand.parentNode.offsetWidth - 2) + 'px'; - expand.style.height = (expand.parentNode.offsetHeight - 2) + 'px'; - } - } else if (this.selectedTab == AppController.EXPORTER) { - // Handle resize of Exporter block options. - this.exporter.view.centerPreviewBlocks(); - } -}; - -/** - * Handler for the window's 'beforeunload' event. When a user has unsaved - * changes and refreshes or leaves the page, confirm that they want to do so - * before actually refreshing. - * @param {!Event} e beforeunload event. - */ -AppController.prototype.confirmLeavePage = function(e) { - BlocklyDevTools.Analytics.sendQueued(); - if ((!BlockFactory.isStarterBlock() && - !FactoryUtils.savedBlockChanges(blocklyFactory.blockLibraryController)) || - blocklyFactory.workspaceFactoryController.hasUnsavedChanges()) { - - var confirmationMessage = 'You will lose any unsaved changes. ' + - 'Are you sure you want to exit this page?'; - BlocklyDevTools.Analytics.onWarning(confirmationMessage); - e.returnValue = confirmationMessage; - return confirmationMessage; - } -}; - -/** - * Show a modal element, usually a dropdown list. - * @param {string} id ID of element to show. - */ -AppController.prototype.openModal = function(id) { - Blockly.hideChaff(); - this.modalName_ = id; - document.getElementById(id).style.display = 'block'; - document.getElementById('modalShadow').style.display = 'block'; -}; - -/** - * Hide a previously shown modal element. - */ -AppController.prototype.closeModal = function() { - var id = this.modalName_; - if (!id) { - return; - } - document.getElementById(id).style.display = 'none'; - document.getElementById('modalShadow').style.display = 'none'; - this.modalName_ = null; -}; - -/** - * Name of currently open modal. - * @type {string?} - * @private - */ -AppController.prototype.modalName_ = null; - -/** - * Initialize Blockly and layout. Called on page load. - */ -AppController.prototype.init = function() { - var self = this; - // Handle Blockly Storage with App Engine. - if ('BlocklyStorage' in window) { - this.initializeBlocklyStorage(); - } - - // Assign click handlers. - this.assignExporterClickHandlers(); - this.assignLibraryClickHandlers(); - this.assignBlockFactoryClickHandlers(); - // Hide and show the block library dropdown. - document.getElementById('modalShadow').addEventListener('click', - function() { - self.closeModal(); - }); - - this.onresize(); - window.addEventListener('resize', function() { - self.onresize(); - }); - - // Inject Block Factory Main Workspace. - var toolbox = document.getElementById('blockfactory_toolbox'); - BlockFactory.mainWorkspace = Blockly.inject('blockly', - {collapse: false, - toolbox: toolbox, - comments: false, - disable: false, - media: '../../media/'}); - - // Add tab handlers for switching between Block Factory and Block Exporter. - this.addTabHandlers(this.tabMap); - - // Assign exporter change listeners. - this.assignExporterChangeListeners(); - - // Create the root block on Block Factory main workspace. - if ('BlocklyStorage' in window && window.location.hash.length > 1) { - BlocklyStorage.retrieveXml(window.location.hash.substring(1), - BlockFactory.mainWorkspace); - } else { - BlockFactory.showStarterBlock(); - } - BlockFactory.mainWorkspace.clearUndo(); - - // Add Block Factory event listeners. - this.addBlockFactoryEventListeners(); - - // Workspace Factory init. - WorkspaceFactoryInit.initWorkspaceFactory(this.workspaceFactoryController); -}; diff --git a/res/lib/blockly/demos/blockfactory/block_definition_extractor.js b/res/lib/blockly/demos/blockfactory/block_definition_extractor.js deleted file mode 100644 index f684c75df131cd4ba9d831709e0c41aefb522b6b..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/block_definition_extractor.js +++ /dev/null @@ -1,742 +0,0 @@ -/** - * Copyright 2017 Juan Carlos Orozco Arena - * Apache License Version 2.0 - */ - -/** - * @fileoverview - * The BlockDefinitionExtractor is a class that generates a workspace DOM - * suitable for the BlockFactory's block editor, derived from an example - * Blockly.Block. - * - * <code> - * var workspaceDom = new BlockDefinitionExtractor() - * .buildBlockFactoryWorkspace(exampleBlocklyBlock); - * Blockly.Xml.domToWorkspace(workspaceDom, BlockFactory.mainWorkspace); - * </code> - * - * The <code>exampleBlocklyBlock</code> is usually the block loaded into the - * preview workspace after manually entering the block definition. - * - * @author JC-Orozco (Juan Carlos Orozco), AnmAtAnm (Andrew n marshall) - */ -'use strict'; - -/** - * Namespace to contain all functions needed to extract block definition from - * the block preview data structure. - * @namespace - */ -var BlockDefinitionExtractor = BlockDefinitionExtractor || Object.create(null); - -/** - * Builds a BlockFactory workspace that reflects the block structure of the - * example block. - * - * @param {!Blockly.Block} block The reference block from which the definition - * will be extracted. - * @return {!Element} Returns the root workspace DOM <xml> for the block editor - * workspace. - */ -BlockDefinitionExtractor.buildBlockFactoryWorkspace = function(block) { - var workspaceXml = Blockly.utils.xml.createElement('xml'); - workspaceXml.append(BlockDefinitionExtractor.factoryBase_(block, block.type)); - return workspaceXml; -}; - -/** - * Helper function to create a new Element with the provided attributes and - * inner text. - * - * @param {string} name New element tag name. - * @param {!Object.<string, string>=} opt_attrs Optional list of attributes. - * @param {string=} opt_text Optional inner text. - * @return {!Element} The newly created element. - * @private - */ -BlockDefinitionExtractor.newDomElement_ = function(name, opt_attrs, opt_text) { - // Avoid createDom(..)'s attributes argument for being too HTML specific. - var elem = Blockly.utils.xml.createElement(name); - if (opt_attrs) { - for (var key in opt_attrs) { - elem.setAttribute(key, opt_attrs[key]); - } - } - if (opt_text) { - elem.append(opt_text); - } - return elem; -}; - -/** - * Creates an connection type constraint <block> Element representing the - * requested type. - * - * @param {string} type Type name of desired connection constraint. - * @return {!Element} The <block> representing the the constraint type. - * @private - */ -BlockDefinitionExtractor.buildBlockForType_ = function(type) { - switch (type) { - case 'Null': - return BlockDefinitionExtractor.typeNull_(); - case 'Boolean': - return BlockDefinitionExtractor.typeBoolean_(); - case 'Number': - return BlockDefinitionExtractor.typeNumber_(); - case 'String': - return BlockDefinitionExtractor.typeString_(); - case 'Array': - return BlockDefinitionExtractor.typeList_(); - default: - return BlockDefinitionExtractor.typeOther_(type); - } -}; - -/** - * Constructs a <block> element representing the type constraints of the - * provided connection. - * - * @param {!Blockly.Connection} connection The connection with desired - * connection constraints. - * @return {!Element} The root <block> element of the constraint definition. - * @private - */ -BlockDefinitionExtractor.buildTypeConstraintBlockForConnection_ = - function(connection) -{ - var typeBlock; - if (connection.check_) { - if (connection.check_.length < 1) { - typeBlock = BlockDefinitionExtractor.typeNullShadow_(); - } else if (connection.check_.length === 1) { - typeBlock = BlockDefinitionExtractor.buildBlockForType_( - connection.check_[0]); - } else if (connection.check_.length > 1 ) { - typeBlock = BlockDefinitionExtractor.typeGroup_(connection.check_); - } - } else { - typeBlock = BlockDefinitionExtractor.typeNullShadow_(); - } - return typeBlock; -}; - -/** - * Creates the root "factory_base" <block> element for the block definition. - * - * @param {!Blockly.Block} block The example block from which to extract the - * definition. - * @param {string} name Block name. - * @return {!Element} The factory_base block element. - * @private - */ -BlockDefinitionExtractor.factoryBase_ = function(block, name) { - BlockDefinitionExtractor.src = {root: block, current: block}; - var factoryBaseEl = - BlockDefinitionExtractor.newDomElement_('block', {type: 'factory_base'}); - factoryBaseEl.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'NAME'}, name)); - factoryBaseEl.append(BlockDefinitionExtractor.buildInlineField_(block)); - - BlockDefinitionExtractor.buildConnections_(block, factoryBaseEl); - - var inputsStatement = BlockDefinitionExtractor.newDomElement_( - 'statement', {name: 'INPUTS'}); - inputsStatement.append(BlockDefinitionExtractor.parseInputs_(block)); - factoryBaseEl.append(inputsStatement); - - var tooltipValue = - BlockDefinitionExtractor.newDomElement_('value', {name: 'TOOLTIP'}); - tooltipValue.append(BlockDefinitionExtractor.text_(block.tooltip)); - factoryBaseEl.append(tooltipValue); - - var helpUrlValue = - BlockDefinitionExtractor.newDomElement_('value', {name: 'HELPURL'}); - helpUrlValue.append(BlockDefinitionExtractor.text_(block.helpUrl)); - factoryBaseEl.append(helpUrlValue); - - // Convert colour_ to hue value 0-360 degrees - var colour_hue = block.getHue(); // May be null if not set via hue. - if (colour_hue) { - var colourBlock = BlockDefinitionExtractor.colourBlockFromHue_(colour_hue); - var colourInputValue = - BlockDefinitionExtractor.newDomElement_('value', {name: 'COLOUR'}); - colourInputValue.append(colourBlock); - factoryBaseEl.append(colourInputValue); - } else { - // Editor will not have a colour block and preview will render black. - // TODO: Support RGB colours in the block editor. - } - return factoryBaseEl; -}; - -/** - * Generates the appropriate <field> element for the block definition's - * CONNECTIONS field, which determines the next, previous, and output - * connections. - * - * @param {!Blockly.Block} block The example block from which to extract the - * definition. - * @param {!Element} factoryBaseEl The root of the block definition. - * @private - */ -BlockDefinitionExtractor.buildConnections_ = function(block, factoryBaseEl) { - var connections = 'NONE'; - if (block.outputConnection) { - connections = 'LEFT'; - } else { - if (block.previousConnection) { - if (block.nextConnection) { - connections = 'BOTH'; - } else { - connections = 'TOP'; - } - } else if (block.nextConnection) { - connections = 'BOTTOM'; - } - } - factoryBaseEl.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'CONNECTIONS'}, connections)); - - if (connections === 'LEFT') { - var inputValue = - BlockDefinitionExtractor.newDomElement_('value', {name: 'OUTPUTTYPE'}); - inputValue.append( - BlockDefinitionExtractor.buildTypeConstraintBlockForConnection_( - block.outputConnection)); - factoryBaseEl.append(inputValue); - } else { - if (connections === 'UP' || connections === 'BOTH') { - var inputValue = - BlockDefinitionExtractor.newDomElement_('value', {name: 'TOPTYPE'}); - inputValue.append( - BlockDefinitionExtractor.buildTypeConstraintBlockForConnection_( - block.previousConnection)); - factoryBaseEl.append(inputValue); - } - if (connections === 'DOWN' || connections === 'BOTH') { - var inputValue = BlockDefinitionExtractor.newDomElement_( - 'value', {name: 'BOTTOMTYPE'}); - inputValue.append( - BlockDefinitionExtractor.buildTypeConstraintBlockForConnection_( - block.nextConnection)); - factoryBaseEl.append(inputValue); - } - } -}; - -/** - * Generates the appropriate <field> element for the block definition's INLINE - * field. - * - * @param {!Blockly.Block} block The example block from which to extract the - * definition. - * @return {Element} The INLINE <field> with value 'AUTO', 'INT' (internal) or - * 'EXT' (external). - * @private - */ -BlockDefinitionExtractor.buildInlineField_ = function(block) { - var inline = 'AUTO'; // When block.inputsInlineDefault === undefined - if (block.inputsInlineDefault === true) { - inline = 'INT'; - } else if (block.inputsInlineDefault === false) { - inline = 'EXT'; - } - return BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'INLINE'}, inline); -}; - -/** - * Constructs a sequence of <block> elements that represent the inputs of the - * provided block. - * - * @param {!Blockly.Block} block The source block to copy the inputs of. - * @return {Element} The fist <block> element of the sequence - * (and the root of the constructed DOM). - * @private - */ -BlockDefinitionExtractor.parseInputs_ = function(block) { - var firstInputDefElement = null; - var lastInputDefElement = null; - for (var i = 0; i < block.inputList.length; i++) { - var input = block.inputList[i]; - var align = 'LEFT'; // Left alignment is the default. - if (input.align === Blockly.ALIGN_CENTRE) { - align = 'CENTRE'; - } else if (input.align === Blockly.ALIGN_RIGHT) { - align = 'RIGHT'; - } - - var inputDefElement = BlockDefinitionExtractor.input_(input, align); - if (lastInputDefElement) { - var next = BlockDefinitionExtractor.newDomElement_('next'); - next.append(inputDefElement); - lastInputDefElement.append(next); - } else { - firstInputDefElement = inputDefElement; - } - lastInputDefElement = inputDefElement; - } - return firstInputDefElement; -}; - -/** - * Creates a <block> element representing a block input. - * - * @param {!Blockly.Input} input The input object. - * @param {string} align Can be left, right or centre. - * @return {!Element} The <block> element that defines the input. - * @private - */ -BlockDefinitionExtractor.input_ = function(input, align) { - var isDummy = (input.type === Blockly.DUMMY_INPUT); - var inputTypeAttr = - isDummy ? 'input_dummy' : - (input.type === Blockly.INPUT_VALUE) ? 'input_value' : 'input_statement'; - var inputDefBlock = - BlockDefinitionExtractor.newDomElement_('block', {type: inputTypeAttr}); - - if (!isDummy) { - inputDefBlock.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'INPUTNAME'}, input.name)); - } - inputDefBlock.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'ALIGN'}, align)); - - var fieldsDef = BlockDefinitionExtractor.newDomElement_( - 'statement', {name: 'FIELDS'}); - var fieldsXml = BlockDefinitionExtractor.buildFields_(input.fieldRow); - fieldsDef.append(fieldsXml); - inputDefBlock.append(fieldsDef); - - if (!isDummy) { - var typeValue = BlockDefinitionExtractor.newDomElement_( - 'value', {name: 'TYPE'}); - typeValue.append( - BlockDefinitionExtractor.buildTypeConstraintBlockForConnection_( - input.connection)); - inputDefBlock.append(typeValue); - } - - return inputDefBlock; -}; - -/** - * Constructs a sequence <block> elements representing the field definition. - * @param {Array.<Blockly.Field>} fieldRow A list of fields in a Blockly.Input. - * @return {Element} The fist <block> element of the sequence - * (and the root of the constructed DOM). - * @private - */ -BlockDefinitionExtractor.buildFields_ = function(fieldRow) { - var firstFieldDefElement = null; - var lastFieldDefElement = null; - - for (var i = 0; i < fieldRow.length; i++) { - var field = fieldRow[i]; - var fieldDefElement = BlockDefinitionExtractor.buildFieldElement_(field); - - if (lastFieldDefElement) { - var next = BlockDefinitionExtractor.newDomElement_('next'); - next.append(fieldDefElement); - lastFieldDefElement.append(next); - } else { - firstFieldDefElement = fieldDefElement; - } - lastFieldDefElement = fieldDefElement; - } - - return firstFieldDefElement; -}; - -/** - * Constructs a <field> element that describes the provided Blockly.Field. - * @param {!Blockly.Field} field The field from which the definition is copied. - * @param {!Element} A <field> for the Field definition. - * @private - */ -BlockDefinitionExtractor.buildFieldElement_ = function(field) { - if (field instanceof Blockly.FieldLabel) { - return BlockDefinitionExtractor.buildFieldLabel_(field.text_); - } else if (field instanceof Blockly.FieldTextInput) { - return BlockDefinitionExtractor.buildFieldInput_(field.name, field.text_); - } else if (field instanceof Blockly.FieldNumber) { - return BlockDefinitionExtractor.buildFieldNumber_( - field.name, field.text_, field.min_, field.max_, field.presicion_); - } else if (field instanceof Blockly.FieldAngle) { - return BlockDefinitionExtractor.buildFieldAngle_(field.name, field.text_); - } else if (field instanceof Blockly.FieldCheckbox) { - return BlockDefinitionExtractor.buildFieldCheckbox_(field.name, field.state_); - } else if (field instanceof Blockly.FieldColour) { - return BlockDefinitionExtractor.buildFieldColour_(field.name, field.colour_); - } else if (field instanceof Blockly.FieldImage) { - return BlockDefinitionExtractor.buildFieldImage_( - field.src_, field.width_, field.height_, field.text_); - } else if (field instanceof Blockly.FieldVariable) { - // FieldVariable must be before FieldDropdown, because FieldVariable is a - // subclass. - return BlockDefinitionExtractor.buildFieldVariable_(field.name, field.text_); - } else if (field instanceof Blockly.FieldDropdown) { - return BlockDefinitionExtractor.buildFieldDropdown_(field); - } - throw Error('Unrecognized field class: ' + field.constructor.name); -}; - - -/** - * Creates a <block> element representing a FieldLabel definition. - * @param {string} text - * @return {Element} The XML for FieldLabel definition. - * @private - */ -BlockDefinitionExtractor.buildFieldLabel_ = function(text) { - var fieldBlock = - BlockDefinitionExtractor.newDomElement_('block', {type: 'field_static'}); - fieldBlock.append( - BlockDefinitionExtractor.newDomElement_('field', {name: 'TEXT'}, text)); - return fieldBlock; -}; - -/** - * Creates a <block> element representing a FieldInput (text input) definition. - * - * @param {string} fieldName The identifying name of the field. - * @param {string} text The default text string. - * @return {Element} The XML for FieldInput definition. - * @private - */ -BlockDefinitionExtractor.buildFieldInput_ = function(fieldName, text) { - var fieldInput = - BlockDefinitionExtractor.newDomElement_('block', {type: 'field_input'}); - fieldInput.append( - BlockDefinitionExtractor.newDomElement_('field', {name: 'TEXT'}, text)); - fieldInput.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'FIELDNAME'}, fieldName)); - return fieldInput; -}; - -/** - * Creates a <block> element representing a FieldNumber definition. - * - * @param {string} fieldName The identifying name of the field. - * @param {number} value The field's default value. - * @param {number} min The minimum allowed value, or negative infinity. - * @param {number} max The maximum allowed value, or positive infinity. - * @param {number} precision The precision allowed for the number. - * @return {Element} The XML for FieldNumber definition. - * @private - */ -BlockDefinitionExtractor.buildFieldNumber_ = - function(fieldName, value, min, max, precision) -{ - var fieldNumber = - BlockDefinitionExtractor.newDomElement_('block', {type: 'field_number'}); - fieldNumber.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'VALUE'}, value)); - fieldNumber.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'FIELDNAME'}, fieldName)); - fieldNumber.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'MIN'}, min)); - fieldNumber.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'MAX'}, max)); - fieldNumber.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'PRECISION'}, precision)); - return fieldNumber; -}; - -/** - * Creates a <block> element representing a FieldAngle definition. - * - * @param {string} fieldName The identifying name of the field. - * @param {number} angle The field's default value. - * @return {Element} The XML for FieldAngle definition. - * @private - */ -BlockDefinitionExtractor.buildFieldAngle_ = function(angle, fieldName) { - var fieldAngle = - BlockDefinitionExtractor.newDomElement_('block', {type: 'field_angle'}); - fieldAngle.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'ANGLE'}, angle)); - fieldAngle.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'FIELDNAME'}, fieldName)); - return fieldAngle; -}; - -/** - * Creates a <block> element representing a FieldDropdown definition. - * - * @param {Blockly.FieldDropdown} dropdown - * @return {Element} The <block> element representing a similar FieldDropdown. - * @private - */ -BlockDefinitionExtractor.buildFieldDropdown_ = function(dropdown) { - var menuGenerator = dropdown.menuGenerator_; - if (typeof menuGenerator === 'function') { - var options = menuGenerator(); - } else if (Array.isArray(menuGenerator)) { - var options = menuGenerator; - } else { - throw Error('Unrecognized type of menuGenerator: ' + menuGenerator); - } - - var fieldDropdown = BlockDefinitionExtractor.newDomElement_( - 'block', {type: 'field_dropdown'}); - var optionsStr = '['; - - var mutation = BlockDefinitionExtractor.newDomElement_('mutation'); - fieldDropdown.append(mutation); - fieldDropdown.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'FIELDNAME'}, dropdown.name)); - for (var i=0; i<options.length; i++) { - var option = options[i]; - if (typeof option[0] === "string") { - optionsStr += '"text",' - fieldDropdown.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'USER'+i}, option[0])); - } else { - optionsStr += '"image",'; - fieldDropdown.append( - BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'SRC'+i}, option[0].src)); - fieldDropdown.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'WIDTH'+i}, option[0].width)); - fieldDropdown.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'HEIGHT'+i}, option[0].height)); - fieldDropdown.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'ALT'+i}, option[0].alt)); - } - fieldDropdown.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'CPU'+i}, option[1])); - } - optionsStr = optionsStr.slice(0,-1); // Drop last comma - optionsStr += ']'; - mutation.setAttribute('options', optionsStr); - - return fieldDropdown; -}; - -/** - * Creates a <block> element representing a FieldCheckbox definition. - * - * @param {string} fieldName The identifying name of the field. - * @param {string} checked The field's default value, true or false. - * @return {Element} The XML for FieldCheckbox definition. - * @private - */ -BlockDefinitionExtractor.buildFieldCheckbox_ = - function(fieldName, checked) -{ - var fieldCheckbox = BlockDefinitionExtractor.newDomElement_( - 'block', {type: 'field_checkbox'}); - fieldCheckbox.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'CHECKED'}, checked)); - fieldCheckbox.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'FIELDNAME'}, fieldName)); - return fieldCheckbox; -}; - -/** - * Creates a <block> element representing a FieldColour definition. - * - * @param {string} fieldName The identifying name of the field. - * @param {string} colour The field's default value as a string. - * @return {Element} The XML for FieldColour definition. - * @private - */ -BlockDefinitionExtractor.buildFieldColour_ = - function(fieldName, colour) -{ - var fieldColour = BlockDefinitionExtractor.newDomElement_( - 'block', {type: 'field_colour'}); - fieldColour.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'COLOUR'}, colour)); - fieldColour.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'FIELDNAME'}, fieldName)); - return fieldColour; -}; - -/** - * Creates a <block> element representing a FieldVaraible definition. - * - * @param {string} fieldName The identifying name of the field. - * @param {string} varName The variables - * @return {Element} The <block> element representing the FieldVariable. - * @private - */ -BlockDefinitionExtractor.buildFieldVariable_ = function(fieldName, varName) { - var fieldVar = BlockDefinitionExtractor.newDomElement_( - 'block', {type: 'field_variable'}); - fieldVar.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'FIELDNAME'}, fieldName)); - fieldVar.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'TEXT'}, varName)); - return fieldVar; -}; - -/** - * Creates a <block> element representing a FieldImage definition. - * - * @param {string} src The URL of the field image. - * @param {number} width The pixel width of the source image - * @param {number} height The pixel height of the source image. - * @param {string} alt Alterante text to describe image. - * @private - */ -BlockDefinitionExtractor.buildFieldImage_ = - function(src, width, height, alt) -{ - var block1 = BlockDefinitionExtractor.newDomElement_( - 'block', {type: 'field_image'}); - block1.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'SRC'}, src)); - block1.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'WIDTH'}, width)); - block1.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'HEIGHT'}, height)); - block1.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'ALT'}, alt)); -}; - -/** - * Creates a <block> element a group of allowed connection constraint types. - * - * @param {Array.<string>} types List of type names in this group. - * @return {Element} The <block> element representing the group, with child - * types attached. - * @private - */ -BlockDefinitionExtractor.typeGroup_ = function(types) { - var typeGroupBlock = BlockDefinitionExtractor.newDomElement_( - 'block', {type: 'type_group'}); - typeGroupBlock.append(BlockDefinitionExtractor.newDomElement_( - 'mutation', {types:types.length})); - for (var i=0; i<types.length; i++) { - var typeBlock = BlockDefinitionExtractor.buildBlockForType_(types[i]); - var valueBlock = BlockDefinitionExtractor.newDomElement_( - 'value', {name:'TYPE'+i}); - valueBlock.append(typeBlock); - typeGroupBlock.append(valueBlock); - } - return typeGroupBlock; -}; - -/** - * Creates a <shadow> block element representing the default null connection - * constraint. - * @return {Element} The <block> element representing the "null" type - * constraint. - * @private - */ -BlockDefinitionExtractor.typeNullShadow_ = function() { - return BlockDefinitionExtractor.newDomElement_( - 'shadow', {type: 'type_null'}); -}; - -/** - * Creates a <block> element representing null in a connection constraint. - * @return {Element} The <block> element representing the "null" type - * constraint. - * @private - */ -BlockDefinitionExtractor.typeNull_ = function() { - return BlockDefinitionExtractor.newDomElement_('block', {type: 'type_null'}); -}; - -/** - * Creates a <block> element representing the a boolean in a connection - * constraint. - * @return {Element} The <block> element representing the "boolean" type - * constraint. - * @private - */ -BlockDefinitionExtractor.typeBoolean_ = function() { - return BlockDefinitionExtractor.newDomElement_( - 'block', {type: 'type_boolean'}); -}; - -/** - * Creates a <block> element representing the a number in a connection - * constraint. - * @return {Element} The <block> element representing the "number" type - * constraint. - * @private - */ -BlockDefinitionExtractor.typeNumber_ = function() { - return BlockDefinitionExtractor.newDomElement_( - 'block', {type: 'type_number'}); -}; - -/** - * Creates a <block> element representing the a string in a connection - * constraint. - * @return {Element} The <block> element representing the "string" type - * constraint. - * @private - */ -BlockDefinitionExtractor.typeString_ = function() { - return BlockDefinitionExtractor.newDomElement_( - 'block', {type: 'type_string'}); -}; - -/** - * Creates a <block> element representing the a list in a connection - * constraint. - * @return {Element} The <block> element representing the "list" type - * constraint. - * @private - */ -BlockDefinitionExtractor.typeList_ = function() { - return BlockDefinitionExtractor.newDomElement_('block', {type: 'type_list'}); -}; - -/** - * Creates a <block> element representing the given custom connection - * constraint type name. - * - * @param {string} type The connection constratin type name. - * @return {Element} The <block> element representing a custom input type - * constraint. - * @private - */ -BlockDefinitionExtractor.typeOther_ = function(type) { - var block = BlockDefinitionExtractor.newDomElement_( - 'block', {type: 'type_other'}); - block.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'TYPE'}, type)); - return block; -}; - -/** - * Creates a block Element for the color_hue block, with the given hue. - * @param hue {number} The hue value, from 0 to 360. - * @return {Element} The <block> Element representing a colour_hue block - * with the given hue. - * @private - */ -BlockDefinitionExtractor.colourBlockFromHue_ = function(hue) { - var colourBlock = BlockDefinitionExtractor.newDomElement_( - 'block', {type: 'colour_hue'}); - colourBlock.append(BlockDefinitionExtractor.newDomElement_('mutation', { - colour: Blockly.hueToRgb(hue) - })); - colourBlock.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'HUE'}, hue.toString())); - return colourBlock; -}; - -/** - * Creates a block Element for a text block with the given text. - * - * @param text {string} The text value of the block. - * @return {Element} The <block> element representing a "text" block. - * @private - */ -BlockDefinitionExtractor.text_ = function(text) { - var textBlock = - BlockDefinitionExtractor.newDomElement_('block', {type: 'text'}); - if (text) { - textBlock.append(BlockDefinitionExtractor.newDomElement_( - 'field', {name: 'TEXT'}, text)); - } // Else, use empty string default. - return textBlock; -}; diff --git a/res/lib/blockly/demos/blockfactory/block_exporter_controller.js b/res/lib/blockly/demos/blockfactory/block_exporter_controller.js deleted file mode 100644 index 37d2f15f67adf150a14e7da60952d27f87e4a67c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/block_exporter_controller.js +++ /dev/null @@ -1,324 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Javascript for the Block Exporter Controller class. Allows - * users to export block definitions and generator stubs of their saved blocks - * easily using a visual interface. Depends on Block Exporter View and Block - * Exporter Tools classes. Interacts with Export Settings in the index.html. - * - * @author quachtina96 (Tina Quach) - */ - -'use strict'; - -/** - * BlockExporter Controller Class - * @param {!BlockLibrary.Storage} blockLibStorage Block Library Storage. - * @constructor - */ -function BlockExporterController(blockLibStorage) { - // BlockLibrary.Storage object containing user's saved blocks. - this.blockLibStorage = blockLibStorage; - // Utils for generating code to export. - this.tools = new BlockExporterTools(); - // The ID of the block selector, a div element that will be populated with the - // block options. - this.selectorID = 'blockSelector'; - // Map of block types stored in block library to their corresponding Block - // Option objects. - this.blockOptions = this.tools.createBlockSelectorFromLib( - this.blockLibStorage, this.selectorID); - // View provides the block selector and export settings UI. - this.view = new BlockExporterView(this.blockOptions); -}; - -/** - * Set the block library storage object from which exporter exports. - * @param {!BlockLibraryStorage} blockLibStorage Block Library Storage object - * that stores the blocks. - */ -BlockExporterController.prototype.setBlockLibraryStorage = - function(blockLibStorage) { - this.blockLibStorage = blockLibStorage; -}; - -/** - * Get the block library storage object from which exporter exports. - * @return {!BlockLibraryStorage} blockLibStorage Block Library Storage object - * that stores the blocks. - */ -BlockExporterController.prototype.getBlockLibraryStorage = - function(blockLibStorage) { - return this.blockLibStorage; -}; - -/** - * Get selected blocks from block selector, pulls info from the Export - * Settings form in Block Exporter, and downloads code accordingly. - */ -BlockExporterController.prototype.export = function() { - // Get selected blocks' information. - var blockTypes = this.view.getSelectedBlockTypes(); - var blockXmlMap = this.blockLibStorage.getBlockXmlMap(blockTypes); - - // Pull block definition(s) settings from the Export Settings form. - var wantBlockDef = document.getElementById('blockDefCheck').checked; - var definitionFormat = document.getElementById('exportFormat').value; - var blockDef_filename = document.getElementById('blockDef_filename').value; - - // Pull block generator stub(s) settings from the Export Settings form. - var wantGenStub = document.getElementById('genStubCheck').checked; - var language = document.getElementById('exportLanguage').value; - var generatorStub_filename = document.getElementById( - 'generatorStub_filename').value; - - if (wantBlockDef) { - // User wants to export selected blocks' definitions. - if (!blockDef_filename) { - // User needs to enter filename. - var msg = 'Please enter a filename for your block definition(s) download.'; - BlocklyDevTools.Analytics.onWarning(msg); - alert(msg); - } else { - // Get block definition code in the selected format for the blocks. - var blockDefs = this.tools.getBlockDefinitions(blockXmlMap, - definitionFormat); - // Download the file, using .js file ending for JSON or Javascript. - FactoryUtils.createAndDownloadFile( - blockDefs, blockDef_filename, 'javascript'); - BlocklyDevTools.Analytics.onExport( - BlocklyDevTools.Analytics.BLOCK_DEFINITIONS, - { - format: (definitionFormat == 'JSON' ? - BlocklyDevTools.Analytics.FORMAT_JSON : - BlocklyDevTools.Analytics.FORMAT_JS) - }); - } - } - - if (wantGenStub) { - // User wants to export selected blocks' generator stubs. - if (!generatorStub_filename) { - // User needs to enter filename. - var msg = 'Please enter a filename for your generator stub(s) download.'; - BlocklyDevTools.Analytics.onWarning(msg); - alert(msg); - } else { - - // Get generator stub code in the selected language for the blocks. - var genStubs = this.tools.getGeneratorCode(blockXmlMap, - language); - - // Download the file. - FactoryUtils.createAndDownloadFile( - genStubs, generatorStub_filename + '.js', 'javascript'); - BlocklyDevTools.Analytics.onExport( - BlocklyDevTools.Analytics.GENERATOR, { format: BlocklyDevTools.Analytics.FORMAT_JS }); - } - } - -}; - -/** - * Update the Exporter's block selector with block options generated from blocks - * stored in block library. - */ -BlockExporterController.prototype.updateSelector = function() { - // Get previously selected block types. - var oldSelectedTypes = this.view.getSelectedBlockTypes(); - - // Generate options from block library and assign to view. - this.blockOptions = this.tools.createBlockSelectorFromLib( - this.blockLibStorage, this.selectorID); - this.addBlockOptionSelectHandlers(); - this.view.setBlockOptions(this.blockOptions); - - // Select all previously selected blocks. - for (var i = 0, blockType; blockType = oldSelectedTypes[i]; i++) { - if (this.blockOptions[blockType]) { - this.view.select(blockType); - } - } - - this.view.listSelectedBlocks(); -}; - -/** - * Tied to the 'Clear Selected Blocks' button in the Block Exporter. - * Deselects all blocks in the selector and updates text accordingly. - */ -BlockExporterController.prototype.clearSelectedBlocks = function() { - this.view.deselectAllBlocks(); - this.view.listSelectedBlocks(); -}; - -/** - * Tied to the 'All Stored' button in the Block Exporter 'Select' dropdown. - * Selects all blocks stored in block library for export. - */ -BlockExporterController.prototype.selectAllBlocks = function() { - var allBlockTypes = this.blockLibStorage.getBlockTypes(); - for (var i = 0, blockType; blockType = allBlockTypes[i]; i++) { - this.view.select(blockType); - } - this.view.listSelectedBlocks(); -}; - -/** - * Returns the category XML containing all blocks in the block library. - * @return {Element} XML for a category to be used in toolbox. - */ -BlockExporterController.prototype.getBlockLibraryCategory = function() { - return this.tools.generateCategoryFromBlockLib(this.blockLibStorage); -}; - -/** - * Add select handlers to each block option to update the view and the selected - * blocks accordingly. - */ -BlockExporterController.prototype.addBlockOptionSelectHandlers = function() { - var self = this; - - // Click handler for a block option. Toggles whether or not it's selected and - // updates helper text accordingly. - var updateSelectedBlockTypes_ = function(blockOption) { - // Toggle selected. - blockOption.setSelected(!blockOption.isSelected()); - - // Show currently selected blocks in helper text. - self.view.listSelectedBlocks(); - }; - - // Returns a block option select handler. - var makeBlockOptionSelectHandler_ = function(blockOption) { - return function() { - updateSelectedBlockTypes_(blockOption); - self.updatePreview(); - }; - }; - - // Assign a click handler to each block option. - for (var blockType in this.blockOptions) { - var blockOption = this.blockOptions[blockType]; - // Use an additional closure to correctly assign the tab callback. - blockOption.dom.addEventListener( - 'click', makeBlockOptionSelectHandler_(blockOption)); - } -}; - -/** - * Tied to the 'All Used' button in the Block Exporter's 'Select' button. - * Selects all blocks stored in block library and used in workspace factory. - */ -BlockExporterController.prototype.selectUsedBlocks = function() { - // Deselect all blocks. - this.view.deselectAllBlocks(); - - // Get list of block types that are in block library and used in workspace - // factory. - var storedBlockTypes = this.blockLibStorage.getBlockTypes(); - var sharedBlockTypes = []; - // Keep list of custom block types used but not in library. - var unstoredCustomBlockTypes = []; - - for (var i = 0, blockType; blockType = this.usedBlockTypes[i]; i++) { - if (storedBlockTypes.indexOf(blockType) != -1) { - sharedBlockTypes.push(blockType); - } else if (StandardCategories.coreBlockTypes.indexOf(blockType) == -1) { - unstoredCustomBlockTypes.push(blockType); - } - } - - // Select each shared block type. - for (var i = 0, blockType; blockType = sharedBlockTypes[i]; i++) { - this.view.select(blockType); - } - this.view.listSelectedBlocks(); - - if (unstoredCustomBlockTypes.length > 0) { - // Warn user to import block definitions and generator code for blocks - // not in their Block Library nor Blockly's standard library. - var blockTypesText = unstoredCustomBlockTypes.join(', '); - var customWarning = 'Custom blocks used in workspace factory but not ' + - 'stored in block library:\n ' + blockTypesText + - '\n\nDon\'t forget to include block definitions and generator code ' + - 'for these blocks.'; - alert(customWarning); - } -}; - -/** - * Set the array that holds the block types used in workspace factory. - * @param {!Array.<string>} usedBlockTypes Block types used in - */ -BlockExporterController.prototype.setUsedBlockTypes = - function(usedBlockTypes) { - this.usedBlockTypes = usedBlockTypes; -}; - -/** - * Updates preview code (block definitions and generator stubs) in the exporter - * preview to reflect selected blocks. - */ -BlockExporterController.prototype.updatePreview = function() { - // Generate preview code for selected blocks. - var blockDefs = this.getBlockDefinitionsOfSelected(); - var genStubs = this.getGeneratorStubsOfSelected(); - - // Update the text areas containing the code. - FactoryUtils.injectCode(blockDefs, 'blockDefs_textArea'); - FactoryUtils.injectCode(genStubs, 'genStubs_textArea'); -}; - -/** - * Returns a map of each selected block's type to its corresponding XML. - * @return {!Object} A map of each selected block's type (a string) to its - * corresponding XML element. - */ -BlockExporterController.prototype.getSelectedBlockXmlMap = function() { - var blockTypes = this.view.getSelectedBlockTypes(); - return this.blockLibStorage.getBlockXmlMap(blockTypes); -}; - -/** - * Get block definition code in the selected format for selected blocks. - * @return {string} The concatenation of each selected block's language code - * in the format specified in export settings. - */ -BlockExporterController.prototype.getBlockDefinitionsOfSelected = function() { - // Get selected blocks' information. - var blockXmlMap = this.getSelectedBlockXmlMap(); - - // Get block definition code in the selected format for the blocks. - var definitionFormat = document.getElementById('exportFormat').value; - return this.tools.getBlockDefinitions(blockXmlMap, definitionFormat); -}; - -/** - * Get generator stubs in the selected language for selected blocks. - * @return {string} The concatenation of each selected block's generator stub - * in the language specified in export settings. - */ -BlockExporterController.prototype.getGeneratorStubsOfSelected = function() { - // Get selected blocks' information. - var blockXmlMap = this.getSelectedBlockXmlMap(); - - // Get generator stub code in the selected language for the blocks. - var language = document.getElementById('exportLanguage').value; - return this.tools.getGeneratorCode(blockXmlMap, language); -}; diff --git a/res/lib/blockly/demos/blockfactory/block_exporter_tools.js b/res/lib/blockly/demos/blockfactory/block_exporter_tools.js deleted file mode 100644 index 495d772118f3d3660f1095750fc19aef03c3f280..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/block_exporter_tools.js +++ /dev/null @@ -1,225 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Javascript for the BlockExporter Tools class, which generates - * block definitions and generator stubs for given block types. Also generates - * toolbox XML for the exporter's workspace. Depends on the FactoryUtils for - * its code generation functions. - * - * @author quachtina96 (Tina Quach) - */ -'use strict'; - -/** - * Block Exporter Tools Class - * @constructor - */ -function BlockExporterTools() { - // Create container for hidden workspace. - this.container = document.createElement('div'); - this.container.id = 'blockExporterTools_hiddenWorkspace'; - this.container.style.display = 'none'; // Hide the hidden workspace. - document.body.appendChild(this.container); - /** - * Hidden workspace for the Block Exporter that holds pieces that make - * up the block - * @type {Blockly.Workspace} - */ - this.hiddenWorkspace = Blockly.inject(this.container.id, - {collapse: false, - media: '../../media/'}); -}; - -/** - * Get Blockly Block object from XML that encodes the blocks used to design - * the block. - * @param {!Element} xml XML element that encodes the blocks used to design - * the block. For example, the block XMLs saved in block library. - * @return {!Blockly.Block} Root block (factory_base block) which contains - * all information needed to generate block definition or null. - * @private - */ -BlockExporterTools.prototype.getRootBlockFromXml_ = function(xml) { - // Render XML in hidden workspace. - this.hiddenWorkspace.clear(); - Blockly.Xml.domToWorkspace(xml, this.hiddenWorkspace); - // Get root block. - var rootBlock = this.hiddenWorkspace.getTopBlocks()[0] || null; - return rootBlock; -}; - -/** - * Return the given language code of each block type in an array. - * @param {!Object} blockXmlMap Map of block type to XML. - * @param {string} definitionFormat 'JSON' or 'JavaScript' - * @return {string} The concatenation of each block's language code in the - * desired format. - */ -BlockExporterTools.prototype.getBlockDefinitions = - function(blockXmlMap, definitionFormat) { - var blockCode = []; - for (var blockType in blockXmlMap) { - var xml = blockXmlMap[blockType]; - if (xml) { - // Render and get block from hidden workspace. - var rootBlock = this.getRootBlockFromXml_(xml); - if (rootBlock) { - // Generate the block's definition. - var code = FactoryUtils.getBlockDefinition(blockType, rootBlock, - definitionFormat, this.hiddenWorkspace); - // Add block's definition to the definitions to return. - } else { - // Append warning comment and write to console. - var code = '// No block definition generated for ' + blockType + - '. Could not find root block in XML stored for this block.'; - console.log('No block definition generated for ' + blockType + - '. Could not find root block in XML stored for this block.'); - } - } else { - // Append warning comment and write to console. - var code = '// No block definition generated for ' + blockType + - '. Block was not found in Block Library Storage.'; - console.log('No block definition generated for ' + blockType + - '. Block was not found in Block Library Storage.'); - } - blockCode.push(code); - } - - // Surround json with [] and comma separate items. - if (definitionFormat == "JSON") { - return "[" + blockCode.join(",\n") + "]"; - } - return blockCode.join("\n\n"); -}; - -/** - * Return the generator code of each block type in an array in a given language. - * @param {!Object} blockXmlMap Map of block type to XML. - * @param {string} generatorLanguage E.g. 'JavaScript', 'Python', 'PHP', 'Lua', - * 'Dart' - * @return {string} The concatenation of each block's generator code in the - * desired format. - */ -BlockExporterTools.prototype.getGeneratorCode = - function(blockXmlMap, generatorLanguage) { - var multiblockCode = []; - // Define the custom blocks in order to be able to create instances of - // them in the exporter workspace. - this.addBlockDefinitions(blockXmlMap); - - for (var blockType in blockXmlMap) { - var xml = blockXmlMap[blockType]; - if (xml) { - // Render the preview block in the hidden workspace. - var tempBlock = - FactoryUtils.getDefinedBlock(blockType, this.hiddenWorkspace); - // Get generator stub for the given block and add to generator code. - var blockGenCode = - FactoryUtils.getGeneratorStub(tempBlock, generatorLanguage); - } else { - // Append warning comment and write to console. - var blockGenCode = '// No generator stub generated for ' + blockType + - '. Block was not found in Block Library Storage.'; - console.log('No block generator stub generated for ' + blockType + - '. Block was not found in Block Library Storage.'); - } - multiblockCode.push(blockGenCode); - } - return multiblockCode.join("\n\n"); -}; - -/** - * Evaluates block definition code of each block in given object mapping - * block type to XML. Called in order to be able to create instances of the - * blocks in the exporter workspace. - * @param {!Object} blockXmlMap Map of block type to XML. - */ -BlockExporterTools.prototype.addBlockDefinitions = function(blockXmlMap) { - var blockDefs = this.getBlockDefinitions(blockXmlMap, 'JavaScript'); - eval(blockDefs); -}; - -/** - * Generate XML for the workspace factory's category from imported block - * definitions. - * @param {!BlockLibraryStorage} blockLibStorage Block Library Storage object. - * @return {!Element} XML representation of a category. - */ -BlockExporterTools.prototype.generateCategoryFromBlockLib = - function(blockLibStorage) { - var allBlockTypes = blockLibStorage.getBlockTypes(); - // Object mapping block type to XML. - var blockXmlMap = blockLibStorage.getBlockXmlMap(allBlockTypes); - - // Define the custom blocks in order to be able to create instances of - // them in the exporter workspace. - this.addBlockDefinitions(blockXmlMap); - - // Get array of defined blocks. - var blocks = []; - for (var blockType in blockXmlMap) { - var block = FactoryUtils.getDefinedBlock(blockType, this.hiddenWorkspace); - blocks.push(block); - } - - return FactoryUtils.generateCategoryXml(blocks,'Block Library'); -}; - -/** - * Generate selector dom from block library storage. For each block in the - * library, it has a block option, which consists of a checkbox, a label, - * and a fixed size preview workspace. - * @param {!BlockLibraryStorage} blockLibStorage Block Library Storage object. - * @param {string} blockSelectorId ID of the div element that will contain - * the block options. - * @return {!Object} Map of block type to Block Option object. - */ -BlockExporterTools.prototype.createBlockSelectorFromLib = - function(blockLibStorage, blockSelectorId) { - // Object mapping each stored block type to XML. - var allBlockTypes = blockLibStorage.getBlockTypes(); - var blockXmlMap = blockLibStorage.getBlockXmlMap(allBlockTypes); - - // Define the custom blocks in order to be able to create instances of - // them in the exporter workspace. - this.addBlockDefinitions(blockXmlMap); - - var blockSelector = document.getElementById(blockSelectorId); - // Clear the block selector. - var child; - while ((child = blockSelector.firstChild)) { - blockSelector.removeChild(child); - } - - // Append each block option's dom to the selector. - var blockOptions = Object.create(null); - for (var blockType in blockXmlMap) { - // Get preview block's XML. - var block = FactoryUtils.getDefinedBlock(blockType, this.hiddenWorkspace); - var previewBlockXml = Blockly.Xml.workspaceToDom(this.hiddenWorkspace); - - // Create block option, inject block into preview workspace, and append - // option to block selector. - var blockOpt = new BlockOption(blockSelector, blockType, previewBlockXml); - blockOpt.createDom(); - blockSelector.appendChild(blockOpt.dom); - blockOpt.showPreviewBlock(); - blockOptions[blockType] = blockOpt; - } - return blockOptions; -}; diff --git a/res/lib/blockly/demos/blockfactory/block_exporter_view.js b/res/lib/blockly/demos/blockfactory/block_exporter_view.js deleted file mode 100644 index 39fa67c8182c6b5cf127f808aa3f77d873a23781..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/block_exporter_view.js +++ /dev/null @@ -1,114 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Javascript for the Block Exporter View class. Reads from and - * manages a block selector through which users select blocks to export. - * - * @author quachtina96 (Tina Quach) - */ - -'use strict'; - -/** - * BlockExporter View Class - * @param {!Object} blockOptions Map of block types to BlockOption objects. - * @constructor - */ -function BlockExporterView(blockOptions) { - // Map of block types to BlockOption objects to select from. - this.blockOptions = blockOptions; -}; - -/** - * Set the block options in the selector of this instance of - * BlockExporterView. - * @param {!Object} blockOptions Map of block types to BlockOption objects. - */ -BlockExporterView.prototype.setBlockOptions = function(blockOptions) { - this.blockOptions = blockOptions; -}; - -/** - * Updates the helper text to show list of currently selected blocks. - */ -BlockExporterView.prototype.listSelectedBlocks = function() { - - var selectedBlocksText = this.getSelectedBlockTypes().join(",\n "); - document.getElementById('selectedBlocksText').textContent = selectedBlocksText; -}; - -/** - * Selects a given block type in the selector. - * @param {string} blockType Type of block to selector. - */ -BlockExporterView.prototype.select = function(blockType) { - this.blockOptions[blockType].setSelected(true); -}; - -/** - * Deselects a block in the selector. - * @param {!Blockly.Block} block Type of block to add to selector workspce. - */ -BlockExporterView.prototype.deselect = function(blockType) { - this.blockOptions[blockType].setSelected(false); -}; - - -/** - * Deselects all blocks. - */ -BlockExporterView.prototype.deselectAllBlocks = function() { - for (var blockType in this.blockOptions) { - this.deselect(blockType); - } -}; - -/** - * Given an array of selected blocks, selects these blocks in the view, marking - * the checkboxes accordingly. - * @param {Array.<Blockly.Block>} blockTypes Array of block types to select. - */ -BlockExporterView.prototype.setSelectedBlockTypes = function(blockTypes) { - for (var i = 0, blockType; blockType = blockTypes[i]; i++) { - this.select(blockType); - } -}; - -/** - * Returns array of selected blocks. - * @return {!Array.<string>} Array of all selected block types. - */ -BlockExporterView.prototype.getSelectedBlockTypes = function() { - var selectedTypes = []; - for (var blockType in this.blockOptions) { - var blockOption = this.blockOptions[blockType]; - if (blockOption.isSelected()) { - selectedTypes.push(blockType); - } - } - return selectedTypes; -}; - -/** - * Centers the preview block of each block option in the exporter selector. - */ -BlockExporterView.prototype.centerPreviewBlocks = function() { - for (var blockType in this.blockOptions) { - this.blockOptions[blockType].centerBlock(); - } -}; diff --git a/res/lib/blockly/demos/blockfactory/block_library_controller.js b/res/lib/blockly/demos/blockfactory/block_library_controller.js deleted file mode 100644 index cdd32bca2689a019150af14cc3dc31434d4d3ca5..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/block_library_controller.js +++ /dev/null @@ -1,315 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Contains the code for Block Library Controller, which - * depends on Block Library Storage and Block Library UI. Provides the - * interfaces for the user to - * - save their blocks to the browser - * - re-open and edit saved blocks - * - delete blocks - * - clear their block library - * Depends on BlockFactory functions defined in factory.js. - * - * @author quachtina96 (Tina Quach) - */ -'use strict'; - -/** - * Block Library Controller Class - * @param {string} blockLibraryName Desired name of Block Library, also used - * to create the key for where it's stored in local storage. - * @param {!BlockLibraryStorage=} opt_blockLibraryStorage Optional storage - * object that allows user to import a block library. - * @constructor - */ -function BlockLibraryController(blockLibraryName, opt_blockLibraryStorage) { - this.name = blockLibraryName; - // Create a new, empty Block Library Storage object, or load existing one. - this.storage = opt_blockLibraryStorage || new BlockLibraryStorage(this.name); - // The BlockLibraryView object handles the proper updating and formatting of - // the block library dropdown. - this.view = new BlockLibraryView(); -}; - -/** - * Returns the block type of the block the user is building. - * @return {string} The current block's type. - * @private - */ -BlockLibraryController.prototype.getCurrentBlockType = function() { - var rootBlock = FactoryUtils.getRootBlock(BlockFactory.mainWorkspace); - var blockType = rootBlock.getFieldValue('NAME').trim().toLowerCase(); - // Replace invalid characters. - return FactoryUtils.cleanBlockType(blockType); -}; - -/** - * Removes current block from Block Library and updates the save and delete - * buttons so that user may save block to library and but not delete. - * @param {string} blockType Type of block. - */ -BlockLibraryController.prototype.removeFromBlockLibrary = function() { - var blockType = this.getCurrentBlockType(); - this.storage.removeBlock(blockType); - this.storage.saveToLocalStorage(); - this.populateBlockLibrary(); - this.view.updateButtons(blockType, false, false); -}; - -/** - * Updates the workspace to show the block user selected from library - * @param {string} blockType Block to edit on block factory. - */ -BlockLibraryController.prototype.openBlock = function(blockType) { - if (blockType) { - var xml = this.storage.getBlockXml(blockType); - BlockFactory.mainWorkspace.clear(); - Blockly.Xml.domToWorkspace(xml, BlockFactory.mainWorkspace); - BlockFactory.mainWorkspace.clearUndo(); - } else { - BlockFactory.showStarterBlock(); - this.view.setSelectedBlockType(null); - } -}; - -/** - * Returns type of block selected from library. - * @return {string} Type of block selected. - */ -BlockLibraryController.prototype.getSelectedBlockType = function() { - return this.view.getSelectedBlockType(); -}; - -/** - * Confirms with user before clearing the block library in local storage and - * updating the dropdown and displaying the starter block (factory_base). - */ -BlockLibraryController.prototype.clearBlockLibrary = function() { - var msg = 'Delete all blocks from library?'; - BlocklyDevTools.Analytics.onWarning(msg); - if (confirm(msg)) { - // Clear Block Library Storage. - this.storage.clear(); - this.storage.saveToLocalStorage(); - // Update dropdown. - this.view.clearOptions(); - // Show default block. - BlockFactory.showStarterBlock(); - // User may not save the starter block, but will get explicit instructions - // upon clicking the red save button. - this.view.updateButtons(null); - } -}; - -/** - * Saves current block to local storage and updates dropdown. - */ -BlockLibraryController.prototype.saveToBlockLibrary = function() { - var blockType = this.getCurrentBlockType(); - // If user has not changed the name of the starter block. - if (blockType == 'block_type') { - // Do not save block if it has the default type, 'block_type'. - var msg = 'You cannot save a block under the name "block_type". Try ' + - 'changing the name before saving. Then, click on the "Block Library"' + - ' button to view your saved blocks.'; - alert(msg); - BlocklyDevTools.Analytics.onWarning(msg); - return; - } - - // Create block XML. - var xmlElement = Blockly.utils.xml.createElement('xml'); - var block = FactoryUtils.getRootBlock(BlockFactory.mainWorkspace); - xmlElement.appendChild(Blockly.Xml.blockToDomWithXY(block)); - - // Do not add option again if block type is already in library. - if (!this.has(blockType)) { - this.view.addOption(blockType, true, true); - } - - // Save block. - this.storage.addBlock(blockType, xmlElement); - this.storage.saveToLocalStorage(); - - // Show saved block without other stray blocks sitting in Block Factory's - // main workspace. - this.openBlock(blockType); - - // Add select handler to the new option. - this.addOptionSelectHandler(blockType); - BlocklyDevTools.Analytics.onSave('Block'); -}; - -/** - * Checks to see if the given blockType is already in Block Library - * @param {string} blockType Type of block. - * @return {boolean} Boolean indicating whether or not block is in the library. - */ -BlockLibraryController.prototype.has = function(blockType) { - var blockLibrary = this.storage.blocks; - return (blockType in blockLibrary && blockLibrary[blockType] != null); -}; - -/** - * Populates the dropdown menu. - */ -BlockLibraryController.prototype.populateBlockLibrary = function() { - this.view.clearOptions(); - // Add an unselected option for each saved block. - var blockLibrary = this.storage.blocks; - for (var blockType in blockLibrary) { - this.view.addOption(blockType, false); - } - this.addOptionSelectHandlers(); -}; - -/** - * Return block library mapping block type to XML. - * @return {Object} Object mapping block type to XML text. - */ -BlockLibraryController.prototype.getBlockLibrary = function() { - return this.storage.getBlockXmlTextMap(); -}; - -/** - * Return stored XML of a given block type. - * @param {string} blockType The type of block. - * @return {!Element} XML element of a given block type or null. - */ -BlockLibraryController.prototype.getBlockXml = function(blockType) { - return this.storage.getBlockXml(blockType); -}; - -/** - * Set the block library storage object from which exporter exports. - * @param {!BlockLibraryStorage} blockLibStorage Block Library Storage object. - */ -BlockLibraryController.prototype.setBlockLibraryStorage - = function(blockLibStorage) { - this.storage = blockLibStorage; -}; - -/** - * Get the block library storage object from which exporter exports. - * @return {!BlockLibraryStorage} blockLibStorage Block Library Storage object - * that stores the blocks. - */ -BlockLibraryController.prototype.getBlockLibraryStorage = function() { - return this.blockLibStorage; -}; - -/** - * Get the block library storage object from which exporter exports. - * @return {boolean} True if the Block Library is empty, false otherwise. - */ -BlockLibraryController.prototype.hasEmptyBlockLibrary = function() { - return this.storage.isEmpty(); -}; - -/** - * Get all block types stored in block library. - * @return {!Array.<string>} Array of block types. - */ -BlockLibraryController.prototype.getStoredBlockTypes = function() { - return this.storage.getBlockTypes(); -}; - -/** - * Sets the currently selected block option to none. - */ -BlockLibraryController.prototype.setNoneSelected = function() { - this.view.setSelectedBlockType(null); -}; - -/** - * If there are unsaved changes to the block in open in Block Factory - * and the block is not the starter block, check if user wants to proceed, - * knowing that it will cause them to lose their changes. - * @return {boolean} Whether or not to proceed. - */ -BlockLibraryController.prototype.warnIfUnsavedChanges = function() { - if (!FactoryUtils.savedBlockChanges(this)) { - return confirm('You have unsaved changes. By proceeding without saving ' + - ' your block first, you will lose these changes.'); - } - return true; -}; - -/** - * Add select handler for an option of a given block type. The handler will to - * update the view and the selected block accordingly. - * @param {string} blockType The type of block represented by the option is for. - */ -BlockLibraryController.prototype.addOptionSelectHandler = function(blockType) { - var self = this; - - // Click handler for a block option. Sets the block option as the selected - // option and opens the block for edit in Block Factory. - var setSelectedAndOpen_ = function(blockOption) { - var blockType = blockOption.textContent; - self.view.setSelectedBlockType(blockType); - self.openBlock(blockType); - // The block is saved in the block library and all changes have been saved - // when the user opens a block from the block library dropdown. - // Thus, the buttons show up as a disabled update button and an enabled - // delete. - self.view.updateButtons(blockType, true, true); - blocklyFactory.closeModal(); - }; - - // Returns a block option select handler. - var makeOptionSelectHandler_ = function(blockOption) { - return function() { - // If there are unsaved changes warn user, check if they'd like to - // proceed with unsaved changes, and act accordingly. - var proceedWithUnsavedChanges = self.warnIfUnsavedChanges(); - if (!proceedWithUnsavedChanges) { - return; - } - setSelectedAndOpen_(blockOption); - }; - }; - - // Assign a click handler to the block option. - var blockOption = this.view.optionMap[blockType]; - // Use an additional closure to correctly assign the tab callback. - blockOption.addEventListener( - 'click', makeOptionSelectHandler_(blockOption)); -}; - -/** - * Add select handlers to each option to update the view and the selected - * blocks accordingly. - */ -BlockLibraryController.prototype.addOptionSelectHandlers = function() { - // Assign a click handler to each block option. - for (var blockType in this.view.optionMap) { - this.addOptionSelectHandler(blockType); - } -}; - -/** - * Update the save and delete buttons based on the current block type of the - * block the user is currently editing. - * @param {boolean} Whether changes to the block have been saved. - */ -BlockLibraryController.prototype.updateButtons = function(savedChanges) { - var blockType = this.getCurrentBlockType(); - var isInLibrary = this.has(blockType); - this.view.updateButtons(blockType, isInLibrary, savedChanges); -}; diff --git a/res/lib/blockly/demos/blockfactory/block_library_storage.js b/res/lib/blockly/demos/blockfactory/block_library_storage.js deleted file mode 100644 index 3330732a73bdb2e0a552ffe6fafc0705d1e13363..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/block_library_storage.js +++ /dev/null @@ -1,162 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Javascript for Block Library's Storage Class. - * Depends on Block Library for its namespace. - * - * @author quachtina96 (Tina Quach) - */ - -'use strict'; - -/** - * Represents a block library's storage. - * @param {string} blockLibraryName Desired name of Block Library, also used - * to create the key for where it's stored in local storage. - * @param {!Object=} opt_blocks Object mapping block type to XML. - * @constructor - */ -function BlockLibraryStorage(blockLibraryName, opt_blocks) { - // Add prefix to this.name to avoid collisions in local storage. - this.name = 'BlockLibraryStorage.' + blockLibraryName; - if (!opt_blocks) { - // Initialize this.blocks by loading from local storage. - this.loadFromLocalStorage(); - if (this.blocks == null) { - this.blocks = Object.create(null); - // The line above is equivalent of {} except that this object is TRULY - // empty. It doesn't have built-in attributes/functions such as length or - // toString. - this.saveToLocalStorage(); - } - } else { - this.blocks = opt_blocks; - this.saveToLocalStorage(); - } -}; - -/** - * Reads the named block library from local storage and saves it in this.blocks. - */ -BlockLibraryStorage.prototype.loadFromLocalStorage = function() { - var object = localStorage[this.name]; - this.blocks = object ? JSON.parse(object) : null; -}; - -/** - * Writes the current block library (this.blocks) to local storage. - */ -BlockLibraryStorage.prototype.saveToLocalStorage = function() { - localStorage[this.name] = JSON.stringify(this.blocks); -}; - -/** - * Clears the current block library. - */ -BlockLibraryStorage.prototype.clear = function() { - this.blocks = Object.create(null); - // The line above is equivalent of {} except that this object is TRULY - // empty. It doesn't have built-in attributes/functions such as length or - // toString. -}; - -/** - * Saves block to block library. - * @param {string} blockType Type of block. - * @param {Element} blockXML The block's XML pulled from workspace. - */ -BlockLibraryStorage.prototype.addBlock = function(blockType, blockXML) { - var prettyXml = Blockly.Xml.domToPrettyText(blockXML); - this.blocks[blockType] = prettyXml; -}; - -/** - * Removes block from current block library (this.blocks). - * @param {string} blockType Type of block. - */ -BlockLibraryStorage.prototype.removeBlock = function(blockType) { - delete this.blocks[blockType]; -}; - -/** - * Returns the XML of given block type stored in current block library - * (this.blocks). - * @param {string} blockType Type of block. - * @return {Element} The XML that represents the block type or null. - */ -BlockLibraryStorage.prototype.getBlockXml = function(blockType) { - var xml = this.blocks[blockType] || null; - if (xml) { - var xml = Blockly.Xml.textToDom(xml); - } - return xml; -}; - - -/** - * Returns map of each block type to its corresponding XML stored in current - * block library (this.blocks). - * @param {!Array.<string>} blockTypes Types of blocks. - * @return {!Object} Map of block type to corresponding XML. - */ -BlockLibraryStorage.prototype.getBlockXmlMap = function(blockTypes) { - var blockXmlMap = Object.create(null); - for (var i = 0; i < blockTypes.length; i++) { - var blockType = blockTypes[i]; - var xml = this.getBlockXml(blockType); - blockXmlMap[blockType] = xml; - } - return blockXmlMap; -}; - -/** - * Returns array of all block types stored in current block library. - * @return {!Array.<string>} Array of block types stored in library. - */ -BlockLibraryStorage.prototype.getBlockTypes = function() { - return Object.keys(this.blocks); -}; - -/** - * Checks to see if block library is empty. - * @return {boolean} True if empty, false otherwise. - */ -BlockLibraryStorage.prototype.isEmpty = function() { - for (var blockType in this.blocks) { - return false; - } - return true; -}; - -/** - * Returns array of all block types stored in current block library. - * @return {!Array.<string>} Map of block type to corresponding XML text. - */ -BlockLibraryStorage.prototype.getBlockXmlTextMap = function() { - return this.blocks; -}; - -/** - * Returns boolean of whether or not a given blockType is stored in block - * library. - * @param {string} blockType Type of block. - * @return {boolean} Whether or not blockType is stored in block library. - */ -BlockLibraryStorage.prototype.has = function(blockType) { - return !!this.blocks[blockType]; -}; diff --git a/res/lib/blockly/demos/blockfactory/block_library_view.js b/res/lib/blockly/demos/blockfactory/block_library_view.js deleted file mode 100644 index 2b914766af6a6d9d51b9d60e0780b507d39a63fe..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/block_library_view.js +++ /dev/null @@ -1,191 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Javascript for BlockLibraryView class. It manages the display - * of the Block Library dropdown, save, and delete buttons. - * - * @author quachtina96 (Tina Quach) - */ - -'use strict'; - -/** - * BlockLibraryView Class - * @constructor - */ -var BlockLibraryView = function() { - // Div element to contain the block types to choose from. - this.dropdown = document.getElementById('dropdownDiv_blockLib'); - // Map of block type to corresponding 'a' element that is the option in the - // dropdown. Used to quickly and easily get a specific option. - this.optionMap = Object.create(null); - // Save and delete buttons. - this.saveButton = document.getElementById('saveToBlockLibraryButton'); - this.deleteButton = document.getElementById('removeBlockFromLibraryButton'); - // Initially, user should not be able to delete a block. They must save a - // block or select a stored block first. - this.deleteButton.disabled = true; -}; - -/** - * Creates a node of a given element type and appends to the node with given ID. - * @param {string} blockType Type of block. - * @param {boolean} selected Whether or not the option should be selected on - * the dropdown. - */ -BlockLibraryView.prototype.addOption = function(blockType, selected) { - // Create option. - var option = document.createElement('a'); - option.id ='dropdown_' + blockType; - option.classList.add('blockLibOpt'); - option.textContent = blockType; - - // Add option to dropdown. - this.dropdown.appendChild(option); - this.optionMap[blockType] = option; - - // Select the block. - if (selected) { - this.setSelectedBlockType(blockType); - } -}; - -/** - * Sets a given block type to selected and all other blocks to deselected. - * If null, deselects all blocks. - * @param {string} blockTypeToSelect Type of block to select or null. - */ -BlockLibraryView.prototype.setSelectedBlockType = function(blockTypeToSelect) { - // Select given block type and deselect all others. Will deselect all blocks - // if null or invalid block type selected. - for (var blockType in this.optionMap) { - var option = this.optionMap[blockType]; - if (blockType == blockTypeToSelect) { - this.selectOption_(option); - } else { - this.deselectOption_(option); - } - } -}; - -/** - * Selects a given option. - * @param {!Element} option HTML 'a' element in the dropdown that represents - * a particular block type. - * @private - */ -BlockLibraryView.prototype.selectOption_ = function(option) { - option.classList.add('dropdown-content-selected'); -}; - -/** - * Deselects a given option. - * @param {!Element} option HTML 'a' element in the dropdown that represents - * a particular block type. - * @private - */ -BlockLibraryView.prototype.deselectOption_ = function(option) { - option.classList.remove('dropdown-content-selected'); -}; - -/** - * Updates the save and delete buttons to represent how the current block will - * be saved by including the block type in the button text as well as indicating - * whether the block is being saved or updated. - * @param {string} blockType The type of block being edited. - * @param {boolean} isInLibrary Whether the block type is in the library. - * @param {boolean} savedChanges Whether changes to block have been saved. - */ -BlockLibraryView.prototype.updateButtons = - function(blockType, isInLibrary, savedChanges) { - if (blockType) { - // User is editing a block. - - if (!isInLibrary) { - // Block type has not been saved to library yet. Disable the delete button - // and allow user to save. - this.saveButton.textContent = 'Save "' + blockType + '"'; - this.saveButton.disabled = false; - this.deleteButton.disabled = true; - } else { - // Block type has already been saved. Disable the save button unless the - // there are unsaved changes (checked below). - this.saveButton.textContent = 'Update "' + blockType + '"'; - this.saveButton.disabled = true; - this.deleteButton.disabled = false; - } - this.deleteButton.textContent = 'Delete "' + blockType + '"'; - - // If changes to block have been made and are not saved, make button - // green to encourage user to save the block. - if (!savedChanges) { - var buttonFormatClass = 'button_warn'; - - // If block type is the default, 'block_type', make button red to alert - // user. - if (blockType == 'block_type') { - buttonFormatClass = 'button_alert'; - } - this.saveButton.classList.add(buttonFormatClass); - this.saveButton.disabled = false; - - } else { - // No changes to save. - this.saveButton.classList.remove('button_alert', 'button_warn'); - this.saveButton.disabled = true; - } - - } -}; - -/** - * Removes option currently selected in dropdown from dropdown menu. - */ -BlockLibraryView.prototype.removeSelectedOption = function() { - var selectedOption = this.getSelectedOption(); - this.dropdown.removeNode(selectedOption); -}; - -/** - * Returns block type of selected block. - * @return {string} Type of block selected. - */ -BlockLibraryView.prototype.getSelectedBlockType = function() { - var selectedOption = this.getSelectedOption(); - var blockType = selectedOption.textContent; - return blockType; -}; - -/** - * Returns selected option. - * @return {!Element} HTML 'a' element that is the option for a block type. - */ -BlockLibraryView.prototype.getSelectedOption = function() { - return this.dropdown.getElementsByClassName('dropdown-content-selected')[0]; -}; - -/** - * Removes all options from dropdown. - */ -BlockLibraryView.prototype.clearOptions = function() { - var blockOpts = this.dropdown.getElementsByClassName('blockLibOpt'); - var option; - while ((option = blockOpts[0])) { - option.parentNode.removeChild(option); - } -}; diff --git a/res/lib/blockly/demos/blockfactory/block_option.js b/res/lib/blockly/demos/blockfactory/block_option.js deleted file mode 100644 index 8f6b0bbdf07f89ab39bb8f23949e243cac9fc945..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/block_option.js +++ /dev/null @@ -1,164 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Javascript for the BlockOption class, used to represent each - * of the various blocks that you may select in the Block Selector. Each block - * option has a checkbox, a label, and a preview workspace through which to - * view the block. - * - * @author quachtina96 (Tina Quach) - */ -'use strict'; - - /** - * BlockOption Class - * A block option includes checkbox, label, and div element that shows a preview - * of the block. - * @param {!Element} blockSelector Scrollable div that will contain the - * block options for the selector. - * @param {string} blockType Type of block for which to create an option. - * @param {!Element} previewBlockXml XML element containing the preview block. - * @constructor - */ -var BlockOption = function(blockSelector, blockType, previewBlockXml) { - // The div to contain the block option. - this.blockSelector = blockSelector; - // The type of block represented by the option. - this.blockType = blockType; - // The checkbox for the option. Set in createDom. - this.checkbox = null; - // The dom for the option. Set in createDom. - this.dom = null; - // Xml element containing the preview block. - this.previewBlockXml = previewBlockXml; - // Workspace containing preview of block. Set upon injection of workspace in - // showPreviewBlock. - this.previewWorkspace = null; - // Whether or not block the option is selected. - this.selected = false; - // Using this.selected rather than this.checkbox.checked allows for proper - // handling of click events on the block option; Without this, clicking - // directly on the checkbox does not toggle selection. -}; - -/** - * Creates the dom for a single block option. Includes checkbox, label, and div - * in which to inject the preview block. - * @return {!Element} Root node of the selector dom which consists of a - * checkbox, a label, and a fixed size preview workspace per block. - */ -BlockOption.prototype.createDom = function() { - // Create the div for the block option. - var blockOptContainer = document.createElement('div'); - blockOptContainer.id = this.blockType; - blockOptContainer.classList.add('blockOption'); - - // Create and append div in which to inject the workspace for viewing the - // block option. - var blockOptionPreview = document.createElement('div'); - blockOptionPreview.id = this.blockType + '_workspace'; - blockOptionPreview.classList.add('blockOption_preview'); - blockOptContainer.appendChild(blockOptionPreview); - - // Create and append container to hold checkbox and label. - var checkLabelContainer = document.createElement('div'); - checkLabelContainer.classList.add('blockOption_checkLabel'); - blockOptContainer.appendChild(checkLabelContainer); - - // Create and append container for checkbox. - var checkContainer = document.createElement('div'); - checkContainer.classList.add('blockOption_check'); - checkLabelContainer.appendChild(checkContainer); - - // Create and append checkbox. - this.checkbox = document.createElement('input'); - this.checkbox.id = this.blockType + '_check'; - this.checkbox.setAttribute('type', 'checkbox'); - checkContainer.appendChild(this.checkbox); - - // Create and append container for block label. - var labelContainer = document.createElement('div'); - labelContainer.classList.add('blockOption_label'); - checkLabelContainer.appendChild(labelContainer); - - // Create and append text node for the label. - var labelText = document.createElement('p'); - labelText.id = this.blockType + '_text'; - labelText.textContent = this.blockType; - labelContainer.appendChild(labelText); - - this.dom = blockOptContainer; - return this.dom; -}; - -/** - * Injects a workspace containing the block into the block option's preview div. - */ -BlockOption.prototype.showPreviewBlock = function() { - // Get ID of preview workspace. - var blockOptPreviewID = this.dom.id + '_workspace'; - - // Inject preview block. - var demoWorkspace = Blockly.inject(blockOptPreviewID, {readOnly:true}); - Blockly.Xml.domToWorkspace(this.previewBlockXml, demoWorkspace); - this.previewWorkspace = demoWorkspace; - - // Center the preview block in the workspace. - this.centerBlock(); -}; - -/** - * Centers the preview block in the workspace. - */ -BlockOption.prototype.centerBlock = function() { - // Get metrics. - var block = this.previewWorkspace.getTopBlocks()[0]; - var blockMetrics = block.getHeightWidth(); - var blockCoordinates = block.getRelativeToSurfaceXY(); - var workspaceMetrics = this.previewWorkspace.getMetrics(); - - // Calculate new coordinates. - var x = workspaceMetrics.viewWidth/2 - blockMetrics['width']/2 - - blockCoordinates.x; - var y = workspaceMetrics.viewHeight/2 - blockMetrics['height']/2 - - blockCoordinates.y; - - // Move block. - block.moveBy(x, y); -}; - -/** - * Selects or deselects the block option. - * @param {!boolean} selected True if selecting option, false if deselecting - * option. - */ -BlockOption.prototype.setSelected = function(selected) { - this.selected = selected; - if (this.checkbox) { - this.checkbox.checked = selected; - } -}; - -/** - * Returns boolean telling whether or not block is selected. - * @return {!boolean} True if selecting option, false if deselecting - * option. - */ -BlockOption.prototype.isSelected = function() { - return this.selected; -}; diff --git a/res/lib/blockly/demos/blockfactory/blocks.js b/res/lib/blockly/demos/blockfactory/blocks.js deleted file mode 100644 index c5106899bbb25554c2b047c599d4c315c0097fb1..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/blocks.js +++ /dev/null @@ -1,925 +0,0 @@ -/** - - * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Blocks for Blockly's Block Factory application. - * @author fraser@google.com (Neil Fraser) - */ -'use strict'; - -Blockly.Blocks['factory_base'] = { - // Base of new block. - init: function() { - this.setColour(120); - this.appendDummyInput() - .appendField('name') - .appendField(new Blockly.FieldTextInput('block_type'), 'NAME'); - this.appendStatementInput('INPUTS') - .setCheck('Input') - .appendField('inputs'); - var dropdown = new Blockly.FieldDropdown([ - ['automatic inputs', 'AUTO'], - ['external inputs', 'EXT'], - ['inline inputs', 'INT']]); - this.appendDummyInput() - .appendField(dropdown, 'INLINE'); - dropdown = new Blockly.FieldDropdown([ - ['no connections', 'NONE'], - ['↠left output', 'LEFT'], - ['↕ top+bottom connections', 'BOTH'], - ['↑ top connection', 'TOP'], - ['↓ bottom connection', 'BOTTOM']], - function(option) { - this.getSourceBlock().updateShape_(option); - // Connect a shadow block to this new input. - this.getSourceBlock().spawnOutputShadow_(option); - }); - this.appendDummyInput() - .appendField(dropdown, 'CONNECTIONS'); - this.appendValueInput('TOOLTIP') - .setCheck('String') - .appendField('tooltip'); - this.appendValueInput('HELPURL') - .setCheck('String') - .appendField('help url'); - this.appendValueInput('COLOUR') - .setCheck('Colour') - .appendField('colour'); - this.setTooltip('Build a custom block by plugging\n' + - 'fields, inputs and other blocks here.'); - this.setHelpUrl( - 'https://developers.google.com/blockly/guides/create-custom-blocks/block-factory'); - }, - mutationToDom: function() { - var container = Blockly.utils.xml.createElement('mutation'); - container.setAttribute('connections', this.getFieldValue('CONNECTIONS')); - return container; - }, - domToMutation: function(xmlElement) { - var connections = xmlElement.getAttribute('connections'); - this.updateShape_(connections); - }, - spawnOutputShadow_: function(option) { - // Helper method for deciding which type of outputs this block needs - // to attach shaddow blocks to. - switch (option) { - case 'LEFT': - this.connectOutputShadow_('OUTPUTTYPE'); - break; - case 'TOP': - this.connectOutputShadow_('TOPTYPE'); - break; - case 'BOTTOM': - this.connectOutputShadow_('BOTTOMTYPE'); - break; - case 'BOTH': - this.connectOutputShadow_('TOPTYPE'); - this.connectOutputShadow_('BOTTOMTYPE'); - break; - } - }, - connectOutputShadow_: function(outputType) { - // Helper method to create & connect shadow block. - var type = this.workspace.newBlock('type_null'); - type.setShadow(true); - type.outputConnection.connect(this.getInput(outputType).connection); - type.initSvg(); - type.render(); - }, - updateShape_: function(option) { - var outputExists = this.getInput('OUTPUTTYPE'); - var topExists = this.getInput('TOPTYPE'); - var bottomExists = this.getInput('BOTTOMTYPE'); - if (option == 'LEFT') { - if (!outputExists) { - this.addTypeInput_('OUTPUTTYPE', 'output type'); - } - } else if (outputExists) { - this.removeInput('OUTPUTTYPE'); - } - if (option == 'TOP' || option == 'BOTH') { - if (!topExists) { - this.addTypeInput_('TOPTYPE', 'top type'); - } - } else if (topExists) { - this.removeInput('TOPTYPE'); - } - if (option == 'BOTTOM' || option == 'BOTH') { - if (!bottomExists) { - this.addTypeInput_('BOTTOMTYPE', 'bottom type'); - } - } else if (bottomExists) { - this.removeInput('BOTTOMTYPE'); - } - }, - addTypeInput_: function(name, label) { - this.appendValueInput(name) - .setCheck('Type') - .appendField(label); - this.moveInputBefore(name, 'COLOUR'); - } -}; - -var FIELD_MESSAGE = 'fields %1 %2'; -var FIELD_ARGS = [ - { - "type": "field_dropdown", - "name": "ALIGN", - "options": [['left', 'LEFT'], ['right', 'RIGHT'], ['centre', 'CENTRE']], - }, - { - "type": "input_statement", - "name": "FIELDS", - "check": "Field" - } -]; - -var TYPE_MESSAGE = 'type %1'; -var TYPE_ARGS = [ - { - "type": "input_value", - "name": "TYPE", - "check": "Type", - "align": "RIGHT" - } -]; - -Blockly.Blocks['input_value'] = { - // Value input. - init: function() { - this.jsonInit({ - "message0": "value input %1 %2", - "args0": [ - { - "type": "field_input", - "name": "INPUTNAME", - "text": "NAME" - }, - { - "type": "input_dummy" - } - ], - "message1": FIELD_MESSAGE, - "args1": FIELD_ARGS, - "message2": TYPE_MESSAGE, - "args2": TYPE_ARGS, - "previousStatement": "Input", - "nextStatement": "Input", - "colour": 210, - "tooltip": "A value socket for horizontal connections.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=71" - }); - }, - onchange: function() { - inputNameCheck(this); - } -}; - -Blockly.Blocks['input_statement'] = { - // Statement input. - init: function() { - this.jsonInit({ - "message0": "statement input %1 %2", - "args0": [ - { - "type": "field_input", - "name": "INPUTNAME", - "text": "NAME" - }, - { - "type": "input_dummy" - }, - ], - "message1": FIELD_MESSAGE, - "args1": FIELD_ARGS, - "message2": TYPE_MESSAGE, - "args2": TYPE_ARGS, - "previousStatement": "Input", - "nextStatement": "Input", - "colour": 210, - "tooltip": "A statement socket for enclosed vertical stacks.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=246" - }); - }, - onchange: function() { - inputNameCheck(this); - } -}; - -Blockly.Blocks['input_dummy'] = { - // Dummy input. - init: function() { - this.jsonInit({ - "message0": "dummy input", - "message1": FIELD_MESSAGE, - "args1": FIELD_ARGS, - "previousStatement": "Input", - "nextStatement": "Input", - "colour": 210, - "tooltip": "For adding fields on a separate row with no " + - "connections. Alignment options (left, right, centre) " + - "apply only to multi-line fields.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=293" - }); - } -}; - -Blockly.Blocks['field_static'] = { - // Text value. - init: function() { - this.setColour(160); - this.appendDummyInput('FIRST') - .appendField('text') - .appendField(new Blockly.FieldTextInput(''), 'TEXT'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Static text that serves as a label.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=88'); - }, -}; - -Blockly.Blocks['field_label_serializable'] = { - // Text value that is saved to XML. - init: function() { - this.setColour(160); - this.appendDummyInput('FIRST') - .appendField('text') - .appendField(new Blockly.FieldTextInput(''), 'TEXT') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Static text that serves as a label, and is saved to' + - ' XML. Use only if you want to modify this label at runtime.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=88'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_input'] = { - // Text input. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('text input') - .appendField(new Blockly.FieldTextInput('default'), 'TEXT') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('An input field for the user to enter text.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=319'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_number'] = { - // Numeric input. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('numeric input') - .appendField(new Blockly.FieldNumber(0), 'VALUE') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.appendDummyInput() - .appendField('min') - .appendField(new Blockly.FieldNumber(-Infinity), 'MIN') - .appendField('max') - .appendField(new Blockly.FieldNumber(Infinity), 'MAX') - .appendField('precision') - .appendField(new Blockly.FieldNumber(0, 0), 'PRECISION'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('An input field for the user to enter a number.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=319'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_angle'] = { - // Angle input. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('angle input') - .appendField(new Blockly.FieldAngle('90'), 'ANGLE') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('An input field for the user to enter an angle.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=372'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_dropdown'] = { - // Dropdown menu. - init: function() { - this.appendDummyInput() - .appendField('dropdown') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.optionList_ = ['text', 'text', 'text']; - this.updateShape_(); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setMutator(new Blockly.Mutator(['field_dropdown_option_text', - 'field_dropdown_option_image'])); - this.setColour(160); - this.setTooltip('Dropdown menu with a list of options.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=386'); - }, - mutationToDom: function(workspace) { - // Create XML to represent menu options. - var container = Blockly.utils.xml.createElement('mutation'); - container.setAttribute('options', JSON.stringify(this.optionList_)); - return container; - }, - domToMutation: function(container) { - // Parse XML to restore the menu options. - var value = JSON.parse(container.getAttribute('options')); - if (typeof value == 'number') { - // Old format from before images were added. November 2016. - this.optionList_ = []; - for (var i = 0; i < value; i++) { - this.optionList_.push('text'); - } - } else { - this.optionList_ = value; - } - this.updateShape_(); - }, - decompose: function(workspace) { - // Populate the mutator's dialog with this block's components. - var containerBlock = workspace.newBlock('field_dropdown_container'); - containerBlock.initSvg(); - var connection = containerBlock.getInput('STACK').connection; - for (var i = 0; i < this.optionList_.length; i++) { - var optionBlock = workspace.newBlock( - 'field_dropdown_option_' + this.optionList_[i]); - optionBlock.initSvg(); - connection.connect(optionBlock.previousConnection); - connection = optionBlock.nextConnection; - } - return containerBlock; - }, - compose: function(containerBlock) { - // Reconfigure this block based on the mutator dialog's components. - var optionBlock = containerBlock.getInputTargetBlock('STACK'); - // Count number of inputs. - this.optionList_.length = 0; - var data = []; - while (optionBlock) { - if (optionBlock.type == 'field_dropdown_option_text') { - this.optionList_.push('text'); - } else if (optionBlock.type == 'field_dropdown_option_image') { - this.optionList_.push('image'); - } - data.push([optionBlock.userData_, optionBlock.cpuData_]); - optionBlock = optionBlock.nextConnection && - optionBlock.nextConnection.targetBlock(); - } - this.updateShape_(); - // Restore any data. - for (var i = 0; i < this.optionList_.length; i++) { - var userData = data[i][0]; - if (userData !== undefined) { - if (typeof userData == 'string') { - this.setFieldValue(userData || 'option', 'USER' + i); - } else { - this.setFieldValue(userData.src, 'SRC' + i); - this.setFieldValue(userData.width, 'WIDTH' + i); - this.setFieldValue(userData.height, 'HEIGHT' + i); - this.setFieldValue(userData.alt, 'ALT' + i); - } - this.setFieldValue(data[i][1] || 'OPTIONNAME', 'CPU' + i); - } - } - }, - saveConnections: function(containerBlock) { - // Store all data for each option. - var optionBlock = containerBlock.getInputTargetBlock('STACK'); - var i = 0; - while (optionBlock) { - optionBlock.userData_ = this.getUserData(i); - optionBlock.cpuData_ = this.getFieldValue('CPU' + i); - i++; - optionBlock = optionBlock.nextConnection && - optionBlock.nextConnection.targetBlock(); - } - }, - updateShape_: function() { - // Delete everything. - var i = 0; - while (this.getInput('OPTION' + i)) { - this.removeInput('OPTION' + i); - this.removeInput('OPTION_IMAGE' + i, true); - i++; - } - // Rebuild block. - var src = 'https://www.gstatic.com/codesite/ph/images/star_on.gif'; - for (var i = 0; i <= this.optionList_.length; i++) { - var type = this.optionList_[i]; - if (type == 'text') { - this.appendDummyInput('OPTION' + i) - .appendField('•') - .appendField(new Blockly.FieldTextInput('option'), 'USER' + i) - .appendField(',') - .appendField(new Blockly.FieldTextInput('OPTIONNAME'), 'CPU' + i); - } else if (type == 'image') { - this.appendDummyInput('OPTION' + i) - .appendField('•') - .appendField('image') - .appendField(new Blockly.FieldTextInput(src), 'SRC' + i); - this.appendDummyInput('OPTION_IMAGE' + i) - .appendField(' ') - .appendField('width') - .appendField(new Blockly.FieldNumber('15', 0, NaN, 1), 'WIDTH' + i) - .appendField('height') - .appendField(new Blockly.FieldNumber('15', 0, NaN, 1), 'HEIGHT' + i) - .appendField('alt text') - .appendField(new Blockly.FieldTextInput('*'), 'ALT' + i) - .appendField(',') - .appendField(new Blockly.FieldTextInput('OPTIONNAME'), 'CPU' + i); - } - } - }, - onchange: function() { - if (this.workspace && this.optionList_.length < 1) { - this.setWarningText('Drop down menu must\nhave at least one option.'); - } else { - fieldNameCheck(this); - } - }, - getUserData: function(n) { - if (this.optionList_[n] == 'text') { - return this.getFieldValue('USER' + n); - } - if (this.optionList_[n] == 'image') { - return { - src: this.getFieldValue('SRC' + n), - width: Number(this.getFieldValue('WIDTH' + n)), - height: Number(this.getFieldValue('HEIGHT' + n)), - alt: this.getFieldValue('ALT' + n) - }; - } - throw 'Unknown dropdown type'; - } -}; - -Blockly.Blocks['field_dropdown_container'] = { - // Container. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('add options'); - this.appendStatementInput('STACK'); - this.setTooltip('Add, remove, or reorder options\n' + - 'to reconfigure this dropdown menu.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=386'); - this.contextMenu = false; - } -}; - -Blockly.Blocks['field_dropdown_option_text'] = { - // Add text option. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('text option'); - this.setPreviousStatement(true); - this.setNextStatement(true); - this.setTooltip('Add a new text option to the dropdown menu.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=386'); - this.contextMenu = false; - } -}; - -Blockly.Blocks['field_dropdown_option_image'] = { - // Add image option. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('image option'); - this.setPreviousStatement(true); - this.setNextStatement(true); - this.setTooltip('Add a new image option to the dropdown menu.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=386'); - this.contextMenu = false; - } -}; - -Blockly.Blocks['field_checkbox'] = { - // Checkbox. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('checkbox') - .appendField(new Blockly.FieldCheckbox('TRUE'), 'CHECKED') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Checkbox field.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=485'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_colour'] = { - // Colour input. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('colour') - .appendField(new Blockly.FieldColour('#ff0000'), 'COLOUR') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Colour input field.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=495'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_date'] = { - // Date input. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('date') - .appendField(new Blockly.FieldDate(), 'DATE') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Date input field.'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_variable'] = { - // Dropdown for variables. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('variable') - .appendField(new Blockly.FieldTextInput('item'), 'TEXT') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Dropdown menu for variable names.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=510'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_image'] = { - // Image. - init: function() { - this.setColour(160); - var src = 'https://www.gstatic.com/codesite/ph/images/star_on.gif'; - this.appendDummyInput() - .appendField('image') - .appendField(new Blockly.FieldTextInput(src), 'SRC'); - this.appendDummyInput() - .appendField('width') - .appendField(new Blockly.FieldNumber('15', 0, NaN, 1), 'WIDTH') - .appendField('height') - .appendField(new Blockly.FieldNumber('15', 0, NaN, 1), 'HEIGHT') - .appendField('alt text') - .appendField(new Blockly.FieldTextInput('*'), 'ALT') - .appendField('flip RTL') - .appendField(new Blockly.FieldCheckbox('false'), 'FLIP_RTL'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Static image (JPEG, PNG, GIF, SVG, BMP).\n' + - 'Retains aspect ratio regardless of height and width.\n' + - 'Alt text is for when collapsed.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=567'); - } -}; - -Blockly.Blocks['type_group'] = { - // Group of types. - init: function() { - this.typeCount_ = 2; - this.updateShape_(); - this.setOutput(true, 'Type'); - this.setMutator(new Blockly.Mutator(['type_group_item'])); - this.setColour(230); - this.setTooltip('Allows more than one type to be accepted.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=677'); - }, - mutationToDom: function(workspace) { - // Create XML to represent a group of types. - var container = Blockly.utils.xml.createElement('mutation'); - container.setAttribute('types', this.typeCount_); - return container; - }, - domToMutation: function(container) { - // Parse XML to restore the group of types. - this.typeCount_ = parseInt(container.getAttribute('types'), 10); - this.updateShape_(); - for (var i = 0; i < this.typeCount_; i++) { - this.removeInput('TYPE' + i); - } - for (var i = 0; i < this.typeCount_; i++) { - var input = this.appendValueInput('TYPE' + i) - .setCheck('Type'); - if (i == 0) { - input.appendField('any of'); - } - } - }, - decompose: function(workspace) { - // Populate the mutator's dialog with this block's components. - var containerBlock = workspace.newBlock('type_group_container'); - containerBlock.initSvg(); - var connection = containerBlock.getInput('STACK').connection; - for (var i = 0; i < this.typeCount_; i++) { - var typeBlock = workspace.newBlock('type_group_item'); - typeBlock.initSvg(); - connection.connect(typeBlock.previousConnection); - connection = typeBlock.nextConnection; - } - return containerBlock; - }, - compose: function(containerBlock) { - // Reconfigure this block based on the mutator dialog's components. - var typeBlock = containerBlock.getInputTargetBlock('STACK'); - // Count number of inputs. - var connections = []; - while (typeBlock) { - connections.push(typeBlock.valueConnection_); - typeBlock = typeBlock.nextConnection && - typeBlock.nextConnection.targetBlock(); - } - // Disconnect any children that don't belong. - for (var i = 0; i < this.typeCount_; i++) { - var connection = this.getInput('TYPE' + i).connection.targetConnection; - if (connection && connections.indexOf(connection) == -1) { - connection.disconnect(); - } - } - this.typeCount_ = connections.length; - this.updateShape_(); - // Reconnect any child blocks. - for (var i = 0; i < this.typeCount_; i++) { - Blockly.Mutator.reconnect(connections[i], this, 'TYPE' + i); - } - }, - saveConnections: function(containerBlock) { - // Store a pointer to any connected child blocks. - var typeBlock = containerBlock.getInputTargetBlock('STACK'); - var i = 0; - while (typeBlock) { - var input = this.getInput('TYPE' + i); - typeBlock.valueConnection_ = input && input.connection.targetConnection; - i++; - typeBlock = typeBlock.nextConnection && - typeBlock.nextConnection.targetBlock(); - } - }, - updateShape_: function() { - // Modify this block to have the correct number of inputs. - // Add new inputs. - for (var i = 0; i < this.typeCount_; i++) { - if (!this.getInput('TYPE' + i)) { - var input = this.appendValueInput('TYPE' + i); - if (i == 0) { - input.appendField('any of'); - } - } - } - // Remove deleted inputs. - while (this.getInput('TYPE' + i)) { - this.removeInput('TYPE' + i); - i++; - } - } -}; - -Blockly.Blocks['type_group_container'] = { - // Container. - init: function() { - this.jsonInit({ - "message0": "add types %1 %2", - "args0": [ - {"type": "input_dummy"}, - {"type": "input_statement", "name": "STACK"} - ], - "colour": 230, - "tooltip": "Add, or remove allowed type.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=677" - }); - } -}; - -Blockly.Blocks['type_group_item'] = { - // Add type. - init: function() { - this.jsonInit({ - "message0": "type", - "previousStatement": null, - "nextStatement": null, - "colour": 230, - "tooltip": "Add a new allowed type.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=677" - }); - } -}; - -Blockly.Blocks['type_null'] = { - // Null type. - valueType: null, - init: function() { - this.jsonInit({ - "message0": "any", - "output": "Type", - "colour": 230, - "tooltip": "Any type is allowed.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602" - }); - } -}; - -Blockly.Blocks['type_boolean'] = { - // Boolean type. - valueType: 'Boolean', - init: function() { - this.jsonInit({ - "message0": "Boolean", - "output": "Type", - "colour": 230, - "tooltip": "Booleans (true/false) are allowed.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602" - }); - } -}; - -Blockly.Blocks['type_number'] = { - // Number type. - valueType: 'Number', - init: function() { - this.jsonInit({ - "message0": "Number", - "output": "Type", - "colour": 230, - "tooltip": "Numbers (int/float) are allowed.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602" - }); - } -}; - -Blockly.Blocks['type_string'] = { - // String type. - valueType: 'String', - init: function() { - this.jsonInit({ - "message0": "String", - "output": "Type", - "colour": 230, - "tooltip": "Strings (text) are allowed.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602" - }); - } -}; - -Blockly.Blocks['type_list'] = { - // List type. - valueType: 'Array', - init: function() { - this.jsonInit({ - "message0": "Array", - "output": "Type", - "colour": 230, - "tooltip": "Arrays (lists) are allowed.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602" - }); - } -}; - -Blockly.Blocks['type_other'] = { - // Other type. - init: function() { - this.jsonInit({ - "message0": "other %1", - "args0": [{"type": "field_input", "name": "TYPE", "text": ""}], - "output": "Type", - "colour": 230, - "tooltip": "Custom type to allow.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=702" - }); - } -}; - -Blockly.Blocks['colour_hue'] = { - // Set the colour of the block. - init: function() { - this.appendDummyInput() - .appendField('hue:') - .appendField(new Blockly.FieldAngle('0', this.validator), 'HUE'); - this.setOutput(true, 'Colour'); - this.setTooltip('Paint the block with this colour.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=55'); - }, - validator: function(text) { - // Update the current block's colour to match. - var hue = parseInt(text, 10); - if (!isNaN(hue)) { - this.getSourceBlock().setColour(hue); - } - }, - mutationToDom: function(workspace) { - var container = Blockly.utils.xml.createElement('mutation'); - container.setAttribute('colour', this.getColour()); - return container; - }, - domToMutation: function(container) { - this.setColour(container.getAttribute('colour')); - } -}; - -/** - * Check to see if more than one field has this name. - * Highly inefficient (On^2), but n is small. - * @param {!Blockly.Block} referenceBlock Block to check. - */ -function fieldNameCheck(referenceBlock) { - if (!referenceBlock.workspace) { - // Block has been deleted. - return; - } - var name = referenceBlock.getFieldValue('FIELDNAME').toLowerCase(); - var count = 0; - var blocks = referenceBlock.workspace.getAllBlocks(false); - for (var i = 0, block; block = blocks[i]; i++) { - var otherName = block.getFieldValue('FIELDNAME'); - if (!block.disabled && !block.getInheritedDisabled() && - otherName && otherName.toLowerCase() == name) { - count++; - } - } - var msg = (count > 1) ? - 'There are ' + count + ' field blocks\n with this name.' : null; - referenceBlock.setWarningText(msg); -} - -/** - * Check to see if more than one input has this name. - * Highly inefficient (On^2), but n is small. - * @param {!Blockly.Block} referenceBlock Block to check. - */ -function inputNameCheck(referenceBlock) { - if (!referenceBlock.workspace) { - // Block has been deleted. - return; - } - var name = referenceBlock.getFieldValue('INPUTNAME').toLowerCase(); - var count = 0; - var blocks = referenceBlock.workspace.getAllBlocks(false); - for (var i = 0, block; block = blocks[i]; i++) { - var otherName = block.getFieldValue('INPUTNAME'); - if (!block.disabled && !block.getInheritedDisabled() && - otherName && otherName.toLowerCase() == name) { - count++; - } - } - var msg = (count > 1) ? - 'There are ' + count + ' input blocks\n with this name.' : null; - referenceBlock.setWarningText(msg); -} diff --git a/res/lib/blockly/demos/blockfactory/cp.css b/res/lib/blockly/demos/blockfactory/cp.css deleted file mode 100644 index 508533e1627ba55e0e9b689ef2c5bb45866f91a1..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/cp.css +++ /dev/null @@ -1,46 +0,0 @@ -.cp_swatch { - border: outset 3px #888; - display: inline-block; - font-family: sans-serif; - height: 20px; - line-height: 1.4; - margin: 1px; - text-align: center; - width: 30px; - vertical-align: bottom; -} - -#cp_popup { - cursor: default; - font-family: sans-serif; - left: 0; - position: absolute; - text-align: center; - top: 0; - user-select: none; -} - -#cp_popup>table { - border: 2px solid #808080; - background-color: #808080; - border-collapse: collapse; -} - -#cp_popup>table>tbody>tr>td { - border: 1px solid #808080; - background-color: #fff; - width: 20px; - padding: 0; -} - -#cp_popup>table>tbody>tr>td>div { - border: 1px solid #808080; -} - -#cp_popup>table>tbody>tr>td>div:hover { - border-color: #fff; -} - -#cp_popup>table>tbody>tr>td>div.cp_current { - border: 1px solid #000; -} diff --git a/res/lib/blockly/demos/blockfactory/cp.js b/res/lib/blockly/demos/blockfactory/cp.js deleted file mode 100644 index 9ba012d4c6c61afd0e96167d019dc2226f4811c8..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/cp.js +++ /dev/null @@ -1,190 +0,0 @@ -/** - * Colour Picker v2.0 - * - * Copyright 2006 Neil Fraser - * https://neil.fraser.name/software/colourpicker/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Include at the top of your page: -// <script src="cp.js"></script> -// <link rel="stylesheet" href="cp.css"> -// Call with: -// <input name="mycolour" id="mycolour" value="ff00ff"> -// <script> -// cp_init('mycolour') -// </script> - -var cp_grid = [ - ['ffffff', 'ffcccc', 'ffcc99', 'ffff99', 'ffffcc', '99ff99', '99ffff', 'ccffff', 'ccccff', 'ffccff'], - ['cccccc', 'ff6666', 'ff9966', 'ffff66', 'ffff33', '66ff99', '33ffff', '66ffff', '9999ff', 'ff99ff'], - ['c0c0c0', 'ff0000', 'ff9900', 'ffcc66', 'ffff00', '33ff33', '66cccc', '33ccff', '6666cc', 'cc66cc'], - ['999999', 'cc0000', 'ff6600', 'ffcc33', 'ffcc00', '33cc00', '00cccc', '3366ff', '6633ff', 'cc33cc'], - ['666666', '990000', 'cc6600', 'cc9933', '999900', '009900', '339999', '3333ff', '6600cc', '993399'], - ['333333', '660000', '993300', '996633', '666600', '006600', '336666', '000099', '333399', '663366'], - ['000000', '330000', '663300', '663333', '333300', '003300', '003333', '000066', '330099', '330033'], - [''] -]; - -var cp_popupDom = null; -var cp_activeSwatch = null; -var cp_closePid = null; - -function cp_init(id) { - var input = document.getElementById(id); - if (!input) { - throw Error('Colour picker can\'t find "' + id + '"'); - } - if (!input.cp_swatch) { - // Hide the input. - input.type = 'hidden'; - // <img style="background-color: #ff0000; border: outset 3px #888;" - // src="1x1.gif" height=20 width=30 class="cp_swatch"> - var swatch = document.createElement('span'); - swatch.className = 'cp_swatch'; - swatch.addEventListener('click', cp_open); - swatch.addEventListener('mouseover', cp_cancelclose); - swatch.addEventListener('mouseout', cp_closesoon); - input.parentNode.insertBefore(swatch, input); - // Cross-link the swatch and input. - swatch.cp_input = input; - input.cp_swatch = swatch; - } - cp_updateSwatch(input.cp_swatch); -} - -function cp_updateSwatch(swatch) { - var colour = swatch.cp_input.value; - if (colour) { - swatch.style.backgroundColor = '#' + colour; - swatch.textContent = '\xa0'; - } else { - swatch.style.backgroundColor = '#fff'; - swatch.innerHTML = 'X'; - } -} - -function cp_open(e) { - // Create a table of colours. - if (cp_popupDom) { - cp_close(); - return; - } - cp_activeSwatch = e.currentTarget; - var currentColour = cp_activeSwatch.cp_input.value.toLowerCase(); - var element = cp_activeSwatch; - var posX = 0; - var posY = element.offsetHeight; - while (element) { - posX += element.offsetLeft; - posY += element.offsetTop; - element = element.offsetParent; - } - cp_popupDom = document.createElement('div'); - cp_popupDom.id = 'cp_popup'; - var table = document.createElement('table'); - table.addEventListener('mouseover', cp_cancelclose); - table.addEventListener('mouseout', cp_closesoon); - table.addEventListener('click', cp_onclick); - var tbody = document.createElement('tbody'); - var row, cell, div; - for (var y = 0; y < cp_grid.length; y++) { - row = document.createElement('tr'); - tbody.appendChild(row); - for (var x = 0; x < cp_grid[y].length; x++) { - var colour = cp_grid[y][x]; - if (colour === undefined) continue; - cell = document.createElement('td'); - row.appendChild(cell); - div = document.createElement('div'); - cell.appendChild(div); - cell.cp_colour = colour; - if (colour) { - div.style.backgroundColor = '#' + colour; - div.innerHTML = '\xa0'; - } else { - div.innerHTML = 'X'; - } - if (currentColour == colour.toLowerCase()) { - div.className = 'cp_current' - } - } - } - table.appendChild(tbody); - cp_popupDom.appendChild(table); - - document.body.appendChild(cp_popupDom); - // Don't widen the screen. - var rightOverhang = (posX + cp_popupDom.offsetWidth) - - (window.innerWidth + window.scrollX) + 15; // Scrollbar is 15px. - if (rightOverhang > 0) { - posX -= rightOverhang; - } - // Flip to above swatch if no room below. - if (posY + cp_popupDom.offsetHeight >= window.innerHeight + window.scrollY) { - posY -= cp_popupDom.offsetHeight + cp_activeSwatch.offsetHeight; - if (posY < window.scrollY) { - posY = window.scrollY; - } - } - cp_popupDom.style.left = posX + 'px'; - cp_popupDom.style.top = posY + 'px'; -} - -function cp_close() { - // Close the table now. - cp_cancelclose(); - if (cp_popupDom) { - document.body.removeChild(cp_popupDom) - } - cp_popupDom = null; - cp_activeSwatch = null; -} - -function cp_closesoon() { - // Close the table a split-second from now. - cp_closePid = setTimeout(cp_close, 250); -} - -function cp_cancelclose() { - // Don't close the colour table after all. - if (cp_closePid) { - clearTimeout(cp_closePid); - } -} - -function cp_onclick(e) { - // Clicked on a colour. - var element = e.target; - var colour; - // Walk up the DOM, looking for a colour. - while (element) { - colour = element.cp_colour; - if (colour !== undefined) { - break; - } - element = element.parentNode; - } - if (colour !== undefined) { - // Set the colour. - cp_activeSwatch.cp_input.value = colour; - cp_updateSwatch(cp_activeSwatch); - // Fire a change event. - var evt = document.createEvent('HTMLEvents'); - evt.initEvent('change', false, true); - cp_activeSwatch.cp_input.dispatchEvent(evt); - } - // Close the table. - cp_close(); -} diff --git a/res/lib/blockly/demos/blockfactory/factory.css b/res/lib/blockly/demos/blockfactory/factory.css deleted file mode 100644 index 751f6f0ed094e2b6abfb99375020969897164dcc..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/factory.css +++ /dev/null @@ -1,579 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -html, body { - height: 100%; - min-height: 375px; -} - -body { - background-color: #fff; - font-family: sans-serif; - margin: 0 5px; - overflow: hidden; -} - -h1 { - font-weight: normal; - font-size: 140%; -} - -h3 { - margin-top: 5px; - margin-bottom: 0; -} - -table { - border: none; - border-collapse: collapse; - height: 100%; - margin: 0; - padding: 0; - width: 100%; -} - -td { - vertical-align: top; - padding: 0; -} - -p { - display: block; - -webkit-margin-before: 0; - -webkit-margin-after: 0; - -webkit-margin-start: 0; - -webkit-margin-end: 0; - padding: 5px 0; -} - -#factoryHeader { - display: table; - height: 10%; -} - -#blockly { - position: absolute; -} - -#blocklyMask { - background-color: #000; - cursor: not-allowed; - display: none; - position: fixed; - opacity: 0.2; - z-index: 9; -} - -#preview { - position: absolute; -} - -pre, -#languageTA { - border: #ddd 1px solid; - margin-top: 0; - position: absolute; - overflow: scroll; -} - -#languageTA { - display: none; - font: 10pt monospace; -} - -.downloadButton { - padding: 5px; -} - -.disabled { - color: #888; -} - -button:disabled, .buttonStyle:disabled { - opacity: 0.6; -} - -button>*, .buttonStyle>* { - opacity: 1; - vertical-align: text-bottom; -} - -button, .buttonStyle { - border-radius: 4px; - border: 1px solid #ddd; - background-color: #eee; - color: #000; - padding: 10px; - margin: 10px 5px; - font-size: small; -} - -.buttonStyle:hover:not(:disabled), button:hover:not(:disabled) { - box-shadow: 2px 2px 5px #888; -} - -.buttonStyle:hover:not(:disabled)>*, button:hover:not(:disabled)>* { - opacity: 1; -} - -#linkButton { - display: none; -} - -#helpButton { - float: right; -} - -#blockFactoryContent { - height: 85%; - width: 100%; - overflow: hidden; -} - -#blockFactoryPreview { - height: 100%; - width: 100%; -} - -#blockLibraryContainer { - vertical-align: bottom; -} - -#blockLibraryControls { - text-align: right; - vertical-align: middle; -} - -#previewContainer { - vertical-align: bottom; -} - -#buttonContainer { - text-align: right; - vertical-align: middle; -} - -#files { - position: absolute; - visibility: hidden; -} - -.toolbox { - display: none; -} - -#blocklyWorkspaceContainer { - width: 50%; -} - -#workspaceFactoryContent { - clear: both; - display: none; - height: 90%; - overflow-x: hidden; - overflow-y: scroll; -} - -/* Exporter */ - -#blockLibraryExporter { - clear: both; - display: none; - height: 90%; - overflow-x: hidden; - overflow-y: scroll; -} - -#exportSelector { - display: inline-block; - float: left; - height: 70%; - width: 30%; -} - -#exportSettings { - float: left; - overflow: hidden; - padding-left: 16px; - width: 20%; -} - -#selectedBlocksTextContainer { - max-height: 200px; - overflow-y: scroll; - padding-bottom: 2em; -} - -::-webkit-scrollbar { - -webkit-appearance: none; - width: 7px; -} - -::-webkit-scrollbar-thumb { - border-radius: 4px; - background-color: #ccc; - -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5); -} - -.subsettings { - margin: 0 25px; -} - -#exporterHiddenWorkspace { - display: none; -} - -#exportPreview { - float: right; - height: 90%; - overflow: hidden; - width: 45%; -} - -.exportPreviewTextArea { - display: block; - float: right; - height: 40%; - width: 100%; -} - -#genStubs_textArea, #blockDefs_textArea { - display: block; - height: 80%; - margin-right: 20px; - max-height: 300px; - overflow: scroll; - position: static; -} - -#blockDefs_label, #genStubs_label { - display: block; -} - -#blockSelector { - background-color: #eee; - border: 1px solid lightgrey; - width: 80%; - height: 90%; - overflow-y: scroll; - position: relative; -} - -/* Exporter Block Option */ - -.blockOption { - background-color: #eee; - padding: 0px 20px; - width: 95%; -} - -.blockOption_check_label { - position: relative; -} - -.blockOption_check { - float: left; - display:inline; - padding: 4px; -} - -.blockOption_label { - display:inline; - max-width: inherit; - word-wrap: break-word; -} - -.blockOption_preview { - height: 100px; - padding-top: 10px; - width: 90%; -} - -/* Block Library */ - -#dropdownDiv_blockLib { - max-height: 65%; - overflow-y: scroll; -} - -#button_blockLib { - border-color: darkgrey; - font-size: large; -} - -.button_alert { - background-color: #fcc; - border-color: #f99; -} - -.button_warn { - background-color: #aea; - border-color: #5d5; -} - -/* Tabs */ - -.tab { - float: left; - padding: 5px 19px; -} - -.tab:hover:not(.tabon) { - background-color: #e8e8e8; -} - -.tab.tabon { - background-color: #ccc; -} - -.tab.taboff { - cursor: pointer; -} - -#tabContainer { - background-color: #f8f8f8; - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; - display: table; - width: 100%; -} - -/* Workspace Factory */ - -section { - float: left; -} - -aside { - float: right; -} - -#categoryTable>table { - border: 1px solid #ccc; - border-bottom: none; - width: auto; -} - -td.tabon { - background-color: #ccc; - border-bottom-color: #ccc; - padding: 5px 19px; -} - -td.taboff { - cursor: pointer; - padding: 5px 19px; -} - -td.taboff:hover { - background-color: #eee; -} - -.large { - font-size: large; -} - -.inputfile { - height: 0; - opacity: 0; - overflow: hidden; - position: absolute; - width: 0; - z-index: -1; -} -#wfactoryHeader { - height: 29%; - padding: 0.5%; -} - -#workspaceTabs { - background-color: #f8f8f8; - border: 1px solid #ccc; - display: table; - width: auto; -} - -#toolbox_section { - height: 85%; - width: 60%; -} - -#previewHelp { - padding: 10px; - width: 98%; -} - -#toolbox_blocks { - height: 100%; - width: 100%; -} - -#preview_blocks { - height: 80%; - padding: 10px; - width: 100%; -} - -#createDiv { - height: 79%; - padding: 0.5%; - width: 60%; -} - -#previewDiv { - border: 10px solid #eee; - height: 77%; - margin-right: 0.5%; - padding-bottom: 10px; - width: 35%; -} - -#previewBorder { - border: 5px solid #ddd; - height: 100%; - padding-right: 20px; -} - -.disabled { - background-color: white; - opacity: 0.5; -} - -#toolbox_div { - display: table; - height: auto; - margin-right: 5%; - overflow: hidden; - width: 35%; -} - -#preload_div { - display: table; - height: 75%; - margin-left: 2%; - margin-right: 2%; - max-height: 500px; - overflow: hidden; - overflow-y: scroll; - width: 30%; -} - -#shadowBlockDropdown { - height: 15%; -} - -#preloadHelp { - display: table-row; - height: 30%; -} - -#workspace_options { - display: table-row; - margin-top: 2%; -} - -#disable_div { - background-color: white; - height: 100%; - left: 0; - opacity: .5; - position: absolute; - top: 0; - width: 100%; - z-index: -1; /* Start behind workspace */ -} - -#grid_options, #zoom_options, #maxBlockNumber_option { - padding-left: 15px; -} - -#modalShadow { - display: none; - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - background: rgba(0, 0, 0, 0.1); - z-index: 100; -} - -/* The container <div> - needed to position the dropdown content */ -.dropdown { - display: inline-block; -} - -/* Dropdown Content (Hidden by Default) */ -.dropdown-content { - background-color: #fff; - box-shadow: 0 8px 16px 0 rgba(0,0,0,.2); - display: none; - min-width: 170px; - opacity: 1; - position: absolute; - z-index: 101; /* On top of the modal Shadow. */ -} - -/* Links inside the dropdown */ -.dropdown-content a, .dropdown-content label { - color: black; - display: block; - font-size: small; - padding: 12px 16px; - text-decoration: none; -} - -/* Change color of dropdown links on hover. */ -.dropdown-content a:hover, .dropdown-content label:hover { - background-color: #EEE; -} - -/* Change color of dropdown links on selected. */ -.dropdown-content-selected { - background-color: #DDD; -} - -/* Show the dropdown menu */ -.show { - display: block; -} - -#dropdownDiv_editCategory { - padding: 0 1ex; -} - -#dropdownDiv_editCategory>img { - vertical-align: middle; -} - -.cp_swatch { - vertical-align: middle !important; -} - -#cp_popup { - z-index: 999; -} - -.shadowBlock>.blocklyPath { - fill-opacity: .5; - stroke-opacity: .5; -} - -.shadowBlock>.blocklyPathLight, -.shadowBlock>.blocklyPathDark { - display: none; -} diff --git a/res/lib/blockly/demos/blockfactory/factory.js b/res/lib/blockly/demos/blockfactory/factory.js deleted file mode 100644 index 8218846f10ab2b00b1f090030a533f9cc7310007..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/factory.js +++ /dev/null @@ -1,337 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview JavaScript for Blockly's Block Factory application through - * which users can build blocks using a visual interface and dynamically - * generate a preview block and starter code for the block (block definition and - * generator stub. Uses the Block Factory namespace. Depends on the FactoryUtils - * for its code generation functions. - * - * @author fraser@google.com (Neil Fraser), quachtina96 (Tina Quach) - */ -'use strict'; - -/** - * Namespace for Block Factory. - */ -var BlockFactory = BlockFactory || Object.create(null); - -/** - * Workspace for user to build block. - * @type {Blockly.Workspace} - */ -BlockFactory.mainWorkspace = null; - -/** - * Workspace for preview of block. - * @type {Blockly.Workspace} - */ -BlockFactory.previewWorkspace = null; - -/** - * Name of block if not named. - * @type string - */ -BlockFactory.UNNAMED = 'unnamed'; - -/** - * Existing direction ('ltr' vs 'rtl') of preview. - * @type string - */ -BlockFactory.oldDir = null; - -/** - * Flag to signal that an update came from a manual update to the JSON or JavaScript. - * definition manually. - * @type boolean - */ -// TODO: Replace global state with parameter passed to functions. -BlockFactory.updateBlocksFlag = false; - -/** - * Delayed flag to avoid infinite update after updating the JSON or JavaScript. - * definition manually. - * @type boolean - */ -// TODO: Replace global state with parameter passed to functions. -BlockFactory.updateBlocksFlagDelayed = false; - -/* - * The starting XML for the Block Factory main workspace. Contains the - * unmovable, undeletable factory_base block. - */ -BlockFactory.STARTER_BLOCK_XML_TEXT = - '<xml xmlns="https://developers.google.com/blockly/xml">' + - '<block type="factory_base" deletable="false" movable="false">' + - '<value name="TOOLTIP">' + - '<block type="text" deletable="false" movable="false">' + - '<field name="TEXT"></field></block></value>' + - '<value name="HELPURL">' + - '<block type="text" deletable="false" movable="false">' + - '<field name="TEXT"></field></block></value>' + - '<value name="COLOUR">' + - '<block type="colour_hue">' + - '<mutation colour="#5b67a5"></mutation>' + - '<field name="HUE">230</field>' + - '</block></value></block></xml>'; - -/** - * Change the language code format. - */ -BlockFactory.formatChange = function() { - var mask = document.getElementById('blocklyMask'); - var languagePre = document.getElementById('languagePre'); - var languageTA = document.getElementById('languageTA'); - if (document.getElementById('format').value == 'Manual-JSON' || - document.getElementById('format').value == 'Manual-JS') { - Blockly.hideChaff(); - mask.style.display = 'block'; - languagePre.style.display = 'none'; - languageTA.style.display = 'block'; - var code = languagePre.textContent.trim(); - languageTA.value = code; - languageTA.focus(); - BlockFactory.updatePreview(); - } else { - mask.style.display = 'none'; - languageTA.style.display = 'none'; - languagePre.style.display = 'block'; - var code = languagePre.textContent.trim(); - languageTA.value = code; - - BlockFactory.updateLanguage(); - } - BlockFactory.disableEnableLink(); -}; - -/** - * Update the language code based on constructs made in Blockly. - */ -BlockFactory.updateLanguage = function() { - var rootBlock = FactoryUtils.getRootBlock(BlockFactory.mainWorkspace); - if (!rootBlock) { - return; - } - var blockType = rootBlock.getFieldValue('NAME').trim().toLowerCase(); - if (!blockType) { - blockType = BlockFactory.UNNAMED; - } - - if (!BlockFactory.updateBlocksFlag) { - var format = document.getElementById('format').value; - if (format == 'Manual-JSON') { - format = 'JSON'; - } else if (format == 'Manual-JS') { - format = 'JavaScript'; - } - - var code = FactoryUtils.getBlockDefinition(blockType, rootBlock, format, - BlockFactory.mainWorkspace); - FactoryUtils.injectCode(code, 'languagePre'); - if (!BlockFactory.updateBlocksFlagDelayed) { - var languagePre = document.getElementById('languagePre'); - var languageTA = document.getElementById('languageTA'); - code = languagePre.innerText.trim(); - languageTA.value = code; - } - } - - BlockFactory.updatePreview(); -}; - -/** - * Update the generator code. - * @param {!Blockly.Block} block Rendered block in preview workspace. - */ -BlockFactory.updateGenerator = function(block) { - var language = document.getElementById('language').value; - var generatorStub = FactoryUtils.getGeneratorStub(block, language); - FactoryUtils.injectCode(generatorStub, 'generatorPre'); -}; - -/** - * Update the preview display. - */ -BlockFactory.updatePreview = function() { - // Toggle between LTR/RTL if needed (also used in first display). - var newDir = document.getElementById('direction').value; - if (BlockFactory.oldDir != newDir) { - if (BlockFactory.previewWorkspace) { - BlockFactory.previewWorkspace.dispose(); - } - var rtl = newDir == 'rtl'; - BlockFactory.previewWorkspace = Blockly.inject('preview', - {rtl: rtl, - media: '../../media/', - scrollbars: true}); - BlockFactory.oldDir = newDir; - } - BlockFactory.previewWorkspace.clear(); - - var format = BlockFactory.getBlockDefinitionFormat(); - var code = document.getElementById('languageTA').value; - if (!code.trim()) { - // Nothing to render. Happens while cloud storage is loading. - return; - } - - // Backup Blockly.Blocks object so that main workspace and preview don't - // collide if user creates a 'factory_base' block, for instance. - var backupBlocks = Blockly.Blocks; - try { - // Make a shallow copy. - Blockly.Blocks = Object.create(null); - for (var prop in backupBlocks) { - Blockly.Blocks[prop] = backupBlocks[prop]; - } - - if (format == 'JSON') { - var json = JSON.parse(code); - Blockly.Blocks[json.type || BlockFactory.UNNAMED] = { - init: function() { - this.jsonInit(json); - } - }; - } else if (format == 'JavaScript') { - try { - eval(code); - } catch (e) { - // TODO: Display error in the UI - console.error("Error while evaluating JavaScript formatted block definition", e); - return; - } - } - - // Look for a block on Blockly.Blocks that does not match the backup. - var blockType = null; - for (var type in Blockly.Blocks) { - if (typeof Blockly.Blocks[type].init == 'function' && - Blockly.Blocks[type] != backupBlocks[type]) { - blockType = type; - break; - } - } - if (!blockType) { - return; - } - - // Create the preview block. - var previewBlock = BlockFactory.previewWorkspace.newBlock(blockType); - previewBlock.initSvg(); - previewBlock.render(); - previewBlock.setMovable(false); - previewBlock.setDeletable(false); - previewBlock.moveBy(15, 10); - BlockFactory.previewWorkspace.clearUndo(); - BlockFactory.updateGenerator(previewBlock); - - // Warn user only if their block type is already exists in Blockly's - // standard library. - var rootBlock = FactoryUtils.getRootBlock(BlockFactory.mainWorkspace); - if (StandardCategories.coreBlockTypes.indexOf(blockType) != -1) { - rootBlock.setWarningText('A core Blockly block already exists ' + - 'under this name.'); - - } else if (blockType == 'block_type') { - // Warn user to let them know they can't save a block under the default - // name 'block_type' - rootBlock.setWarningText('You cannot save a block with the default ' + - 'name, "block_type"'); - - } else { - rootBlock.setWarningText(null); - } - } catch(err) { - // TODO: Show error on the UI - console.log(err); - BlockFactory.updateBlocksFlag = false - BlockFactory.updateBlocksFlagDelayed = false - } finally { - Blockly.Blocks = backupBlocks; - } -}; - -/** - * Gets the format from the Block Definitions' format selector/drop-down. - * @return Either 'JavaScript' or 'JSON'. - * @throws If selector value is not recognized. - */ -BlockFactory.getBlockDefinitionFormat = function() { - switch (document.getElementById('format').value) { - case 'JSON': - case 'Manual-JSON': - return 'JSON'; - - case 'JavaScript': - case 'Manual-JS': - return 'JavaScript'; - - default: - throw 'Unknown format: ' + format; - } -} - -/** - * Disable link and save buttons if the format is 'Manual', enable otherwise. - */ -BlockFactory.disableEnableLink = function() { - var linkButton = document.getElementById('linkButton'); - var saveBlockButton = document.getElementById('localSaveButton'); - var saveToLibButton = document.getElementById('saveToBlockLibraryButton'); - var disabled = document.getElementById('format').value.substr(0, 6) == 'Manual'; - linkButton.disabled = disabled; - saveBlockButton.disabled = disabled; - saveToLibButton.disabled = disabled; -}; - -/** - * Render starter block (factory_base). - */ -BlockFactory.showStarterBlock = function() { - BlockFactory.mainWorkspace.clear(); - var xml = Blockly.Xml.textToDom(BlockFactory.STARTER_BLOCK_XML_TEXT); - Blockly.Xml.domToWorkspace(xml, BlockFactory.mainWorkspace); -}; - -/** - * Returns whether or not the current block open is the starter block. - */ -BlockFactory.isStarterBlock = function() { - var rootBlock = FactoryUtils.getRootBlock(BlockFactory.mainWorkspace); - return rootBlock && !( - // The starter block does not have blocks nested into the factory_base block. - rootBlock.getChildren().length > 0 || - // The starter block's name is the default, 'block_type'. - rootBlock.getFieldValue('NAME').trim().toLowerCase() != 'block_type' || - // The starter block has no connections. - rootBlock.getFieldValue('CONNECTIONS') != 'NONE' || - // The starter block has automatic inputs. - rootBlock.getFieldValue('INLINE') != 'AUTO' - ); -}; - -/** - * Updates blocks from the manually edited js or json from their text area. - */ -BlockFactory.manualEdit = function() { - // TODO(#1267): Replace these global state flags with parameters passed to - // the right functions. - BlockFactory.updateBlocksFlag = true; - BlockFactory.updateBlocksFlagDelayed = true; - BlockFactory.updateLanguage(); -} diff --git a/res/lib/blockly/demos/blockfactory/factory_utils.js b/res/lib/blockly/demos/blockfactory/factory_utils.js deleted file mode 100644 index dfed4578ee981d7447232bca61e55d5c0d9cda02..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/factory_utils.js +++ /dev/null @@ -1,1070 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview FactoryUtils is a namespace that holds block starter code - * generation functions shared by the Block Factory, Workspace Factory, and - * Exporter applications within Blockly Factory. Holds functions to generate - * block definitions and generator stubs and to create and download files. - * - * @author fraser@google.com (Neil Fraser), quachtina96 (Tina Quach), JC-Orozco - * (Juan Carlos Orozco) - */ -'use strict'; - -/** - * Namespace for FactoryUtils. - */ -var FactoryUtils = FactoryUtils || Object.create(null); - -/** - * Get block definition code for the current block. - * @param {string} blockType Type of block. - * @param {!Blockly.Block} rootBlock RootBlock from main workspace in which - * user uses Block Factory Blocks to create a custom block. - * @param {string} format 'JSON' or 'JavaScript'. - * @param {!Blockly.Workspace} workspace Where the root block lives. - * @return {string} Block definition. - */ -FactoryUtils.getBlockDefinition = function(blockType, rootBlock, format, workspace) { - blockType = FactoryUtils.cleanBlockType(blockType); - switch (format) { - case 'JSON': - var code = FactoryUtils.formatJson_(blockType, rootBlock); - break; - case 'JavaScript': - var code = FactoryUtils.formatJavaScript_(blockType, rootBlock, workspace); - break; - } - return code; -}; - -/** - * Convert invalid block name to a valid one. Replaces whitespace - * and prepend names that start with a digit with an '_'. - * @param {string} blockType Type of block. - * @return {string} Cleaned up block type. - */ -FactoryUtils.cleanBlockType = function(blockType) { - if (!blockType) { - return ''; - } - return blockType.replace(/\W/g, '_').replace(/^(\d)/, '_$1'); -}; - -/** - * Get the generator code for a given block. - * @param {!Blockly.Block} block Rendered block in preview workspace. - * @param {string} generatorLanguage 'JavaScript', 'Python', 'PHP', 'Lua', - * or 'Dart'. - * @return {string} Generator code for multiple blocks. - */ -FactoryUtils.getGeneratorStub = function(block, generatorLanguage) { - // Build factory blocks from block - if (BlockFactory.updateBlocksFlag) { // TODO: Move this to updatePreview() - BlockFactory.mainWorkspace.clear(); - var xml = BlockDefinitionExtractor.buildBlockFactoryWorkspace(block); - Blockly.Xml.domToWorkspace(xml, BlockFactory.mainWorkspace); - // Calculate timer to avoid infinite update loops - // TODO(#1267): Remove the global variables and any infinite loops. - BlockFactory.updateBlocksFlag = false; - setTimeout( - function() {BlockFactory.updateBlocksFlagDelayed = false;}, 3000); - } - BlockFactory.lastUpdatedBlock = block; // Variable to share the block value. - - function makeVar(root, name) { - name = name.toLowerCase().replace(/\W/g, '_'); - return ' var ' + root + '_' + name; - } - // The makevar function lives in the original update generator. - var language = generatorLanguage; - var code = []; - code.push("Blockly." + language + "['" + block.type + - "'] = function(block) {"); - - // Generate getters for any fields or inputs. - for (var i = 0, input; input = block.inputList[i]; i++) { - for (var j = 0, field; field = input.fieldRow[j]; j++) { - var name = field.name; - if (!name) { - continue; - } - if (field instanceof Blockly.FieldVariable) { - // Subclass of Blockly.FieldDropdown, must test first. - code.push(makeVar('variable', name) + - " = Blockly." + language + - ".variableDB_.getName(block.getFieldValue('" + name + - "'), Blockly.Variables.NAME_TYPE);"); - } else if (field instanceof Blockly.FieldAngle) { - // Subclass of Blockly.FieldTextInput, must test first. - code.push(makeVar('angle', name) + - " = block.getFieldValue('" + name + "');"); - } else if (Blockly.FieldDate && field instanceof Blockly.FieldDate) { - // Blockly.FieldDate may not be compiled into Blockly. - code.push(makeVar('date', name) + - " = block.getFieldValue('" + name + "');"); - } else if (field instanceof Blockly.FieldColour) { - code.push(makeVar('colour', name) + - " = block.getFieldValue('" + name + "');"); - } else if (field instanceof Blockly.FieldCheckbox) { - code.push(makeVar('checkbox', name) + - " = block.getFieldValue('" + name + "') == 'TRUE';"); - } else if (field instanceof Blockly.FieldDropdown) { - code.push(makeVar('dropdown', name) + - " = block.getFieldValue('" + name + "');"); - } else if (field instanceof Blockly.FieldNumber) { - code.push(makeVar('number', name) + - " = block.getFieldValue('" + name + "');"); - } else if (field instanceof Blockly.FieldTextInput) { - code.push(makeVar('text', name) + - " = block.getFieldValue('" + name + "');"); - } - } - var name = input.name; - if (name) { - if (input.type == Blockly.INPUT_VALUE) { - code.push(makeVar('value', name) + - " = Blockly." + language + ".valueToCode(block, '" + name + - "', Blockly." + language + ".ORDER_ATOMIC);"); - } else if (input.type == Blockly.NEXT_STATEMENT) { - code.push(makeVar('statements', name) + - " = Blockly." + language + ".statementToCode(block, '" + - name + "');"); - } - } - } - // Most languages end lines with a semicolon. Python & Lua do not. - var lineEnd = { - 'JavaScript': ';', - 'Python': '', - 'PHP': ';', - 'Lua': '', - 'Dart': ';' - }; - code.push(" // TODO: Assemble " + language + " into code variable."); - if (block.outputConnection) { - code.push(" var code = '...';"); - code.push(" // TODO: Change ORDER_NONE to the correct strength."); - code.push(" return [code, Blockly." + language + ".ORDER_NONE];"); - } else { - code.push(" var code = '..." + (lineEnd[language] || '') + "\\n';"); - code.push(" return code;"); - } - code.push("};"); - - return code.join('\n'); -}; - -/** - * Update the language code as JSON. - * @param {string} blockType Name of block. - * @param {!Blockly.Block} rootBlock Factory_base block. - * @return {string} Generanted language code. - * @private - */ -FactoryUtils.formatJson_ = function(blockType, rootBlock) { - var JS = {}; - // Type is not used by Blockly, but may be used by a loader. - JS.type = blockType; - // Generate inputs. - var message = []; - var args = []; - var contentsBlock = rootBlock.getInputTargetBlock('INPUTS'); - var lastInput = null; - while (contentsBlock) { - if (!contentsBlock.disabled && !contentsBlock.getInheritedDisabled()) { - var fields = FactoryUtils.getFieldsJson_( - contentsBlock.getInputTargetBlock('FIELDS')); - for (var i = 0; i < fields.length; i++) { - if (typeof fields[i] == 'string') { - message.push(fields[i].replace(/%/g, '%%')); - } else { - args.push(fields[i]); - message.push('%' + args.length); - } - } - - var input = {type: contentsBlock.type}; - // Dummy inputs don't have names. Other inputs do. - if (contentsBlock.type != 'input_dummy') { - input.name = contentsBlock.getFieldValue('INPUTNAME'); - } - var check = JSON.parse( - FactoryUtils.getOptTypesFrom(contentsBlock, 'TYPE') || 'null'); - if (check) { - input.check = check; - } - var align = contentsBlock.getFieldValue('ALIGN'); - if (align != 'LEFT') { - input.align = align; - } - args.push(input); - message.push('%' + args.length); - lastInput = contentsBlock; - } - contentsBlock = contentsBlock.nextConnection && - contentsBlock.nextConnection.targetBlock(); - } - // Remove last input if dummy and not empty. - if (lastInput && lastInput.type == 'input_dummy') { - var fields = lastInput.getInputTargetBlock('FIELDS'); - if (fields && FactoryUtils.getFieldsJson_(fields).join('').trim() != '') { - var align = lastInput.getFieldValue('ALIGN'); - if (align != 'LEFT') { - JS.lastDummyAlign0 = align; - } - args.pop(); - message.pop(); - } - } - JS.message0 = message.join(' '); - if (args.length) { - JS.args0 = args; - } - // Generate inline/external switch. - if (rootBlock.getFieldValue('INLINE') == 'EXT') { - JS.inputsInline = false; - } else if (rootBlock.getFieldValue('INLINE') == 'INT') { - JS.inputsInline = true; - } - // Generate output, or next/previous connections. - switch (rootBlock.getFieldValue('CONNECTIONS')) { - case 'LEFT': - JS.output = - JSON.parse( - FactoryUtils.getOptTypesFrom(rootBlock, 'OUTPUTTYPE') || 'null'); - break; - case 'BOTH': - JS.previousStatement = - JSON.parse( - FactoryUtils.getOptTypesFrom(rootBlock, 'TOPTYPE') || 'null'); - JS.nextStatement = - JSON.parse( - FactoryUtils.getOptTypesFrom(rootBlock, 'BOTTOMTYPE') || 'null'); - break; - case 'TOP': - JS.previousStatement = - JSON.parse( - FactoryUtils.getOptTypesFrom(rootBlock, 'TOPTYPE') || 'null'); - break; - case 'BOTTOM': - JS.nextStatement = - JSON.parse( - FactoryUtils.getOptTypesFrom(rootBlock, 'BOTTOMTYPE') || 'null'); - break; - } - // Generate colour. - var colourBlock = rootBlock.getInputTargetBlock('COLOUR'); - if (colourBlock && !colourBlock.disabled) { - var hue = parseInt(colourBlock.getFieldValue('HUE'), 10); - JS.colour = hue; - } - - JS.tooltip = FactoryUtils.getTooltipFromRootBlock_(rootBlock); - JS.helpUrl = FactoryUtils.getHelpUrlFromRootBlock_(rootBlock); - - return JSON.stringify(JS, null, ' '); -}; - -/** - * Update the language code as JavaScript. - * @param {string} blockType Name of block. - * @param {!Blockly.Block} rootBlock Factory_base block. - * @param {!Blockly.Workspace} workspace Where the root block lives. - * @return {string} Generated language code. - * @private - */ -FactoryUtils.formatJavaScript_ = function(blockType, rootBlock, workspace) { - var code = []; - code.push("Blockly.Blocks['" + blockType + "'] = {"); - code.push(" init: function() {"); - // Generate inputs. - var TYPES = {'input_value': 'appendValueInput', - 'input_statement': 'appendStatementInput', - 'input_dummy': 'appendDummyInput'}; - var contentsBlock = rootBlock.getInputTargetBlock('INPUTS'); - while (contentsBlock) { - if (!contentsBlock.disabled && !contentsBlock.getInheritedDisabled()) { - var name = ''; - // Dummy inputs don't have names. Other inputs do. - if (contentsBlock.type != 'input_dummy') { - name = - JSON.stringify(contentsBlock.getFieldValue('INPUTNAME')); - } - code.push(' this.' + TYPES[contentsBlock.type] + '(' + name + ')'); - var check = FactoryUtils.getOptTypesFrom(contentsBlock, 'TYPE'); - if (check) { - code.push(' .setCheck(' + check + ')'); - } - var align = contentsBlock.getFieldValue('ALIGN'); - if (align != 'LEFT') { - code.push(' .setAlign(Blockly.ALIGN_' + align + ')'); - } - var fields = FactoryUtils.getFieldsJs_( - contentsBlock.getInputTargetBlock('FIELDS')); - for (var i = 0; i < fields.length; i++) { - code.push(' .appendField(' + fields[i] + ')'); - } - // Add semicolon to last line to finish the statement. - code[code.length - 1] += ';'; - } - contentsBlock = contentsBlock.nextConnection && - contentsBlock.nextConnection.targetBlock(); - } - // Generate inline/external switch. - if (rootBlock.getFieldValue('INLINE') == 'EXT') { - code.push(' this.setInputsInline(false);'); - } else if (rootBlock.getFieldValue('INLINE') == 'INT') { - code.push(' this.setInputsInline(true);'); - } - // Generate output, or next/previous connections. - switch (rootBlock.getFieldValue('CONNECTIONS')) { - case 'LEFT': - code.push(FactoryUtils.connectionLineJs_('setOutput', 'OUTPUTTYPE', workspace)); - break; - case 'BOTH': - code.push( - FactoryUtils.connectionLineJs_('setPreviousStatement', 'TOPTYPE', workspace)); - code.push( - FactoryUtils.connectionLineJs_('setNextStatement', 'BOTTOMTYPE', workspace)); - break; - case 'TOP': - code.push( - FactoryUtils.connectionLineJs_('setPreviousStatement', 'TOPTYPE', workspace)); - break; - case 'BOTTOM': - code.push( - FactoryUtils.connectionLineJs_('setNextStatement', 'BOTTOMTYPE', workspace)); - break; - } - // Generate colour. - var colourBlock = rootBlock.getInputTargetBlock('COLOUR'); - if (colourBlock && !colourBlock.disabled) { - var hue = parseInt(colourBlock.getFieldValue('HUE'), 10); - if (!isNaN(hue)) { - code.push(' this.setColour(' + hue + ');'); - } - } - - var tooltip = FactoryUtils.getTooltipFromRootBlock_(rootBlock); - var helpUrl = FactoryUtils.getHelpUrlFromRootBlock_(rootBlock); - code.push(' this.setTooltip(' + JSON.stringify(tooltip) + ');'); - code.push(' this.setHelpUrl(' + JSON.stringify(helpUrl) + ');'); - code.push(' }'); - code.push('};'); - return code.join('\n'); -}; - -/** - * Create JS code required to create a top, bottom, or value connection. - * @param {string} functionName JavaScript function name. - * @param {string} typeName Name of type input. - * @param {!Blockly.Workspace} workspace Where the root block lives. - * @return {string} Line of JavaScript code to create connection. - * @private - */ -FactoryUtils.connectionLineJs_ = function(functionName, typeName, workspace) { - var type = FactoryUtils.getOptTypesFrom( - FactoryUtils.getRootBlock(workspace), typeName); - if (type) { - type = ', ' + type; - } else { - type = ''; - } - return ' this.' + functionName + '(true' + type + ');'; -}; - -/** - * Returns field strings and any config. - * @param {!Blockly.Block} block Input block. - * @return {!Array.<string>} Field strings. - * @private - */ -FactoryUtils.getFieldsJs_ = function(block) { - var fields = []; - while (block) { - if (!block.disabled && !block.getInheritedDisabled()) { - switch (block.type) { - case 'field_static': - // Result: 'hello' - fields.push(JSON.stringify(block.getFieldValue('TEXT'))); - break; - case 'field_label_serializable': - // Result: new Blockly.FieldLabelSerializable('Hello'), 'GREET' - fields.push('new Blockly.FieldLabelSerializable(' + - JSON.stringify(block.getFieldValue('TEXT')) + '), ' + - JSON.stringify(block.getFieldValue('FIELDNAME'))); - break; - case 'field_input': - // Result: new Blockly.FieldTextInput('Hello'), 'GREET' - fields.push('new Blockly.FieldTextInput(' + - JSON.stringify(block.getFieldValue('TEXT')) + '), ' + - JSON.stringify(block.getFieldValue('FIELDNAME'))); - break; - case 'field_number': - // Result: new Blockly.FieldNumber(10, 0, 100, 1), 'NUMBER' - var args = [ - Number(block.getFieldValue('VALUE')), - Number(block.getFieldValue('MIN')), - Number(block.getFieldValue('MAX')), - Number(block.getFieldValue('PRECISION')) - ]; - // Remove any trailing arguments that aren't needed. - if (args[3] == 0) { - args.pop(); - if (args[2] == Infinity) { - args.pop(); - if (args[1] == -Infinity) { - args.pop(); - } - } - } - fields.push('new Blockly.FieldNumber(' + args.join(', ') + '), ' + - JSON.stringify(block.getFieldValue('FIELDNAME'))); - break; - case 'field_angle': - // Result: new Blockly.FieldAngle(90), 'ANGLE' - fields.push('new Blockly.FieldAngle(' + - Number(block.getFieldValue('ANGLE')) + '), ' + - JSON.stringify(block.getFieldValue('FIELDNAME'))); - break; - case 'field_checkbox': - // Result: new Blockly.FieldCheckbox('TRUE'), 'CHECK' - fields.push('new Blockly.FieldCheckbox(' + - JSON.stringify(block.getFieldValue('CHECKED')) + - '), ' + - JSON.stringify(block.getFieldValue('FIELDNAME'))); - break; - case 'field_colour': - // Result: new Blockly.FieldColour('#ff0000'), 'COLOUR' - fields.push('new Blockly.FieldColour(' + - JSON.stringify(block.getFieldValue('COLOUR')) + - '), ' + - JSON.stringify(block.getFieldValue('FIELDNAME'))); - break; - case 'field_date': - // Result: new Blockly.FieldDate('2015-02-04'), 'DATE' - fields.push('new Blockly.FieldDate(' + - JSON.stringify(block.getFieldValue('DATE')) + '), ' + - JSON.stringify(block.getFieldValue('FIELDNAME'))); - break; - case 'field_variable': - // Result: new Blockly.FieldVariable('item'), 'VAR' - var varname - = JSON.stringify(block.getFieldValue('TEXT') || null); - fields.push('new Blockly.FieldVariable(' + varname + '), ' + - JSON.stringify(block.getFieldValue('FIELDNAME'))); - break; - case 'field_dropdown': - // Result: - // new Blockly.FieldDropdown([['yes', '1'], ['no', '0']]), 'TOGGLE' - var options = []; - for (var i = 0; i < block.optionList_.length; i++) { - options[i] = JSON.stringify([block.getUserData(i), - block.getFieldValue('CPU' + i)]); - } - if (options.length) { - fields.push('new Blockly.FieldDropdown([' + - options.join(', ') + ']), ' + - JSON.stringify(block.getFieldValue('FIELDNAME'))); - } - break; - case 'field_image': - // Result: new Blockly.FieldImage('http://...', 80, 60, '*') - var src = JSON.stringify(block.getFieldValue('SRC')); - var width = Number(block.getFieldValue('WIDTH')); - var height = Number(block.getFieldValue('HEIGHT')); - var alt = JSON.stringify(block.getFieldValue('ALT')); - var flipRtl = JSON.stringify(block.getFieldValue('FLIP_RTL')); - fields.push('new Blockly.FieldImage(' + - src + ', ' + width + ', ' + height + - ', { alt: ' + alt + ', flipRtl: ' + flipRtl + ' })'); - break; - } - } - block = block.nextConnection && block.nextConnection.targetBlock(); - } - return fields; -}; - -/** - * Returns field strings and any config. - * @param {!Blockly.Block} block Input block. - * @return {!Array.<string|!Object>} Array of static text and field configs. - * @private - */ -FactoryUtils.getFieldsJson_ = function(block) { - var fields = []; - while (block) { - if (!block.disabled && !block.getInheritedDisabled()) { - switch (block.type) { - case 'field_static': - // Result: 'hello' - fields.push(block.getFieldValue('TEXT')); - break; - case 'field_label_serializable': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - text: block.getFieldValue('TEXT') - }); - break; - case 'field_input': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - text: block.getFieldValue('TEXT') - }); - break; - case 'field_number': - var obj = { - type: block.type, - name: block.getFieldValue('FIELDNAME'), - value: Number(block.getFieldValue('VALUE')) - }; - var min = Number(block.getFieldValue('MIN')); - if (min > -Infinity) { - obj.min = min; - } - var max = Number(block.getFieldValue('MAX')); - if (max < Infinity) { - obj.max = max; - } - var precision = Number(block.getFieldValue('PRECISION')); - if (precision) { - obj.precision = precision; - } - fields.push(obj); - break; - case 'field_angle': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - angle: Number(block.getFieldValue('ANGLE')) - }); - break; - case 'field_checkbox': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - checked: block.getFieldValue('CHECKED') == 'TRUE' - }); - break; - case 'field_colour': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - colour: block.getFieldValue('COLOUR') - }); - break; - case 'field_date': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - date: block.getFieldValue('DATE') - }); - break; - case 'field_variable': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - variable: block.getFieldValue('TEXT') || null - }); - break; - case 'field_dropdown': - var options = []; - for (var i = 0; i < block.optionList_.length; i++) { - options[i] = [block.getUserData(i), - block.getFieldValue('CPU' + i)]; - } - if (options.length) { - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - options: options - }); - } - break; - case 'field_image': - fields.push({ - type: block.type, - src: block.getFieldValue('SRC'), - width: Number(block.getFieldValue('WIDTH')), - height: Number(block.getFieldValue('HEIGHT')), - alt: block.getFieldValue('ALT'), - flipRtl: block.getFieldValue('FLIP_RTL') == 'TRUE' - }); - break; - } - } - block = block.nextConnection && block.nextConnection.targetBlock(); - } - return fields; -}; - -/** - * Fetch the type(s) defined in the given input. - * Format as a string for appending to the generated code. - * @param {!Blockly.Block} block Block with input. - * @param {string} name Name of the input. - * @return {?string} String defining the types. - */ -FactoryUtils.getOptTypesFrom = function(block, name) { - var types = FactoryUtils.getTypesFrom_(block, name); - if (types.length == 0) { - return undefined; - } else if (types.indexOf('null') != -1) { - return 'null'; - } else if (types.length == 1) { - return types[0]; - } else { - return '[' + types.join(', ') + ']'; - } -}; - - -/** - * Fetch the type(s) defined in the given input. - * @param {!Blockly.Block} block Block with input. - * @param {string} name Name of the input. - * @return {!Array.<string>} List of types. - * @private - */ -FactoryUtils.getTypesFrom_ = function(block, name) { - var typeBlock = block.getInputTargetBlock(name); - var types; - if (!typeBlock || typeBlock.disabled) { - types = []; - } else if (typeBlock.type == 'type_other') { - types = [JSON.stringify(typeBlock.getFieldValue('TYPE'))]; - } else if (typeBlock.type == 'type_group') { - types = []; - for (var n = 0; n < typeBlock.typeCount_; n++) { - types = types.concat(FactoryUtils.getTypesFrom_(typeBlock, 'TYPE' + n)); - } - // Remove duplicates. - var hash = Object.create(null); - for (var n = types.length - 1; n >= 0; n--) { - if (hash[types[n]]) { - types.splice(n, 1); - } - hash[types[n]] = true; - } - } else { - types = [JSON.stringify(typeBlock.valueType)]; - } - return types; -}; - -/** - * Return the uneditable container block that everything else attaches to in - * given workspace. - * @param {!Blockly.Workspace} workspace Where the root block lives. - * @return {Blockly.Block} Root block. - */ -FactoryUtils.getRootBlock = function(workspace) { - var blocks = workspace.getTopBlocks(false); - for (var i = 0, block; block = blocks[i]; i++) { - if (block.type == 'factory_base') { - return block; - } - } - return null; -}; - -// TODO(quachtina96): Move hide, show, makeInvisible, and makeVisible to a new -// AppView namespace. - -/** - * Hides element so that it's invisible and doesn't take up space. - * @param {string} elementID ID of element to hide. - */ -FactoryUtils.hide = function(elementID) { - document.getElementById(elementID).style.display = 'none'; -}; - -/** - * Un-hides an element. - * @param {string} elementID ID of element to hide. - */ -FactoryUtils.show = function(elementID) { - document.getElementById(elementID).style.display = 'block'; -}; - -/** - * Hides element so that it's invisible but still takes up space. - * @param {string} elementID ID of element to hide. - */ -FactoryUtils.makeInvisible = function(elementID) { - document.getElementById(elementID).visibility = 'hidden'; -}; - -/** - * Makes element visible. - * @param {string} elementID ID of element to hide. - */ -FactoryUtils.makeVisible = function(elementID) { - document.getElementById(elementID).visibility = 'visible'; -}; - -/** - * Create a file with the given attributes and download it. - * @param {string} contents The contents of the file. - * @param {string} filename The name of the file to save to. - * @param {string} fileType The type of the file to save. - */ -FactoryUtils.createAndDownloadFile = function(contents, filename, fileType) { - var data = new Blob([contents], {type: 'text/' + fileType}); - var clickEvent = new MouseEvent("click", { - "view": window, - "bubbles": true, - "cancelable": false - }); - - var a = document.createElement('a'); - a.href = window.URL.createObjectURL(data); - a.download = filename; - a.textContent = 'Download file!'; - a.dispatchEvent(clickEvent); -}; - -/** - * Get Blockly Block by rendering pre-defined block in workspace. - * @param {!Element} blockType Type of block that has already been defined. - * @param {!Blockly.Workspace} workspace Workspace on which to render - * the block. - * @return {!Blockly.Block} The Blockly.Block of desired type. - */ -FactoryUtils.getDefinedBlock = function(blockType, workspace) { - workspace.clear(); - return workspace.newBlock(blockType); -}; - -/** - * Parses a block definition get the type of the block it defines. - * @param {string} blockDef A single block definition. - * @return {string} Type of block defined by the given definition. - */ -FactoryUtils.getBlockTypeFromJsDefinition = function(blockDef) { - var indexOfStartBracket = blockDef.indexOf('[\''); - var indexOfEndBracket = blockDef.indexOf('\']'); - if (indexOfStartBracket != -1 && indexOfEndBracket != -1) { - return blockDef.substring(indexOfStartBracket + 2, indexOfEndBracket); - } else { - throw Error('Could not parse block type out of JavaScript block ' + - 'definition. Brackets normally enclosing block type not found.'); - } -}; - -/** - * Generates a category containing blocks of the specified block types. - * @param {!Array.<!Blockly.Block>} blocks Blocks to include in the category. - * @param {string} categoryName Name to use for the generated category. - * @return {!Element} Category XML containing the given block types. - */ -FactoryUtils.generateCategoryXml = function(blocks, categoryName) { - // Create category DOM element. - var categoryElement = Blockly.utils.xml.createElement('category'); - categoryElement.setAttribute('name', categoryName); - - // For each block, add block element to category. - for (var i = 0, block; block = blocks[i]; i++) { - - // Get preview block XML. - var blockXml = Blockly.Xml.blockToDom(block); - blockXml.removeAttribute('id'); - - // Add block to category and category to XML. - categoryElement.appendChild(blockXml); - } - return categoryElement; -}; - -/** - * Parses a string containing JavaScript block definition(s) to create an array - * in which each element is a single block definition. - * @param {string} blockDefsString JavaScript block definition(s). - * @return {!Array.<string>} Array of block definitions. - */ -FactoryUtils.parseJsBlockDefinitions = function(blockDefsString) { - var blockDefArray = []; - var defStart = blockDefsString.indexOf('Blockly.Blocks'); - - while (blockDefsString.indexOf('Blockly.Blocks', defStart) != -1) { - var nextStart = blockDefsString.indexOf('Blockly.Blocks', defStart + 1); - if (nextStart == -1) { - // This is the last block definition. - nextStart = blockDefsString.length; - } - var blockDef = blockDefsString.substring(defStart, nextStart); - blockDefArray.push(blockDef); - defStart = nextStart; - } - return blockDefArray; -}; - -/** - * Parses a string containing JSON block definition(s) to create an array - * in which each element is a single block definition. Expected input is - * one or more block definitions in the form of concatenated, stringified - * JSON objects. - * @param {string} blockDefsString String containing JSON block - * definition(s). - * @return {!Array.<string>} Array of block definitions. - */ -FactoryUtils.parseJsonBlockDefinitions = function(blockDefsString) { - var blockDefArray = []; - var unbalancedBracketCount = 0; - var defStart = 0; - // Iterate through the blockDefs string. Keep track of whether brackets - // are balanced. - for (var i = 0; i < blockDefsString.length; i++) { - var currentChar = blockDefsString[i]; - if (currentChar == '{') { - unbalancedBracketCount++; - } - else if (currentChar == '}') { - unbalancedBracketCount--; - if (unbalancedBracketCount == 0 && i > 0) { - // The brackets are balanced. We've got a complete block defintion. - var blockDef = blockDefsString.substring(defStart, i + 1); - blockDefArray.push(blockDef); - defStart = i + 1; - } - } - } - return blockDefArray; -}; - -/** - * Define blocks from imported block definitions. - * @param {string} blockDefsString Block definition(s). - * @param {string} format Block definition format ('JSON' or 'JavaScript'). - * @return {!Array.<!Element>} Array of block types defined. - */ -FactoryUtils.defineAndGetBlockTypes = function(blockDefsString, format) { - var blockTypes = []; - - // Define blocks and get block types. - if (format == 'JSON') { - var blockDefArray = FactoryUtils.parseJsonBlockDefinitions(blockDefsString); - - // Populate array of blocktypes and define each block. - for (var i = 0, blockDef; blockDef = blockDefArray[i]; i++) { - var json = JSON.parse(blockDef); - blockTypes.push(json.type); - - // Define the block. - Blockly.Blocks[json.type] = { - init: function() { - this.jsonInit(json); - } - }; - } - } else if (format == 'JavaScript') { - var blockDefArray = FactoryUtils.parseJsBlockDefinitions(blockDefsString); - - // Populate array of block types. - for (var i = 0, blockDef; blockDef = blockDefArray[i]; i++) { - var blockType = FactoryUtils.getBlockTypeFromJsDefinition(blockDef); - blockTypes.push(blockType); - } - - // Define all blocks. - eval(blockDefsString); - } - - return blockTypes; -}; - -/** - * Inject code into a pre tag, with syntax highlighting. - * Safe from HTML/script injection. - * @param {string} code Lines of code. - * @param {string} id ID of <pre> element to inject into. - */ -FactoryUtils.injectCode = function(code, id) { - var pre = document.getElementById(id); - pre.textContent = code; - // Remove the 'prettyprinted' class, so that Prettify will recalculate. - pre.className = pre.className.replace('prettyprinted', ''); - PR.prettyPrint(); -}; - -/** - * Returns whether or not two blocks are the same based on their XML. Expects - * XML with a single child node that is a factory_base block, the XML found on - * Block Factory's main workspace. - * @param {!Element} blockXml1 An XML element with a single child node that - * is a factory_base block. - * @param {!Element} blockXml2 An XML element with a single child node that - * is a factory_base block. - * @return {boolean} Whether or not two blocks are the same based on their XML. - */ -FactoryUtils.sameBlockXml = function(blockXml1, blockXml2) { - // Each XML element should contain a single child element with a 'block' tag - if (blockXml1.tagName.toLowerCase() != 'xml' || - blockXml2.tagName.toLowerCase() != 'xml') { - throw Error('Expected two XML elements, received elements with tag ' + - 'names: ' + blockXml1.tagName + ' and ' + blockXml2.tagName + '.'); - } - - // Compare the block elements directly. The XML tags may include other meta - // information we want to ignore. - var blockElement1 = blockXml1.getElementsByTagName('block')[0]; - var blockElement2 = blockXml2.getElementsByTagName('block')[0]; - - if (!(blockElement1 && blockElement2)) { - throw Error('Could not get find block element in XML.'); - } - - var cleanBlockXml1 = FactoryUtils.cleanXml(blockElement1); - var cleanBlockXml2 = FactoryUtils.cleanXml(blockElement2); - - var blockXmlText1 = Blockly.Xml.domToText(cleanBlockXml1); - var blockXmlText2 = Blockly.Xml.domToText(cleanBlockXml2); - - // Strip white space. - blockXmlText1 = blockXmlText1.replace(/\s+/g, ''); - blockXmlText2 = blockXmlText2.replace(/\s+/g, ''); - - // Return whether or not changes have been saved. - return blockXmlText1 == blockXmlText2; -}; - -/** - * Strips the provided xml of any attributes that don't describe the - * 'structure' of the blocks (i.e. block order, field values, etc). - * @param {Node} xml The xml to clean. - * @return {Node} - */ -FactoryUtils.cleanXml = function(xml) { - var newXml = xml.cloneNode(true); - var node = newXml; - while (node) { - // Things like text inside tags are still treated as nodes, but they - // don't have attributes (or the removeAttribute function) so we can - // skip removing attributes from them. - if (node.removeAttribute) { - node.removeAttribute('xmlns'); - node.removeAttribute('x'); - node.removeAttribute('y'); - node.removeAttribute('id'); - } - - // Try to go down the tree - var nextNode = node.firstChild || node.nextSibling; - // If we can't go down, try to go back up the tree. - if (!nextNode) { - nextNode = node.parentNode; - while (nextNode) { - // We are valid again! - if (nextNode.nextSibling) { - nextNode = nextNode.nextSibling; - break; - } - // Try going up again. If parentNode is null that means we have - // reached the top, and we will break out of both loops. - nextNode = nextNode.parentNode; - } - } - node = nextNode; - } - return newXml; -}; - -/* - * Checks if a block has a variable field. Blocks with variable fields cannot - * be shadow blocks. - * @param {Blockly.Block} block The block to check if a variable field exists. - * @return {boolean} True if the block has a variable field, false otherwise. - */ -FactoryUtils.hasVariableField = function(block) { - if (!block) { - return false; - } - return block.getVars().length > 0; -}; - -/** - * Checks if a block is a procedures block. If procedures block names are - * ever updated or expanded, this function should be updated as well (no - * other known markers for procedure blocks beyond name). - * @param {Blockly.Block} block The block to check. - * @return {boolean} True if the block is a procedure block, false otherwise. - */ -FactoryUtils.isProcedureBlock = function(block) { - return block && - (block.type == 'procedures_defnoreturn' || - block.type == 'procedures_defreturn' || - block.type == 'procedures_callnoreturn' || - block.type == 'procedures_callreturn' || - block.type == 'procedures_ifreturn'); -}; - -/** - * Returns whether or not a modified block's changes has been saved to the - * Block Library. - * TODO(quachtina96): move into the Block Factory Controller once made. - * @param {!BlockLibraryController} blockLibraryController Block Library - * Controller storing custom blocks. - * @return {boolean} True if all changes made to the block have been saved to - * the given Block Library. - */ -FactoryUtils.savedBlockChanges = function(blockLibraryController) { - if (BlockFactory.isStarterBlock()) { - return true; - } - var blockType = blockLibraryController.getCurrentBlockType(); - var currentXml = Blockly.Xml.workspaceToDom(BlockFactory.mainWorkspace); - - if (blockLibraryController.has(blockType)) { - // Block is saved in block library. - var savedXml = blockLibraryController.getBlockXml(blockType); - return FactoryUtils.sameBlockXml(savedXml, currentXml); - } - return false; -}; - -/** - * Given the root block of the factory, return the tooltip specified by the user - * or the empty string if no tooltip is found. - * @param {!Blockly.Block} rootBlock Factory_base block. - * @return {string} The tooltip for the generated block, or the empty string. - */ -FactoryUtils.getTooltipFromRootBlock_ = function(rootBlock) { - var tooltipBlock = rootBlock.getInputTargetBlock('TOOLTIP'); - if (tooltipBlock && !tooltipBlock.disabled) { - return tooltipBlock.getFieldValue('TEXT'); - } - return ''; -}; - -/** - * Given the root block of the factory, return the help url specified by the - * user or the empty string if no tooltip is found. - * @param {!Blockly.Block} rootBlock Factory_base block. - * @return {string} The help url for the generated block, or the empty string. - */ -FactoryUtils.getHelpUrlFromRootBlock_ = function(rootBlock) { - var helpUrlBlock = rootBlock.getInputTargetBlock('HELPURL'); - if (helpUrlBlock && !helpUrlBlock.disabled) { - return helpUrlBlock.getFieldValue('TEXT'); - } - return ''; -}; diff --git a/res/lib/blockly/demos/blockfactory/icon.png b/res/lib/blockly/demos/blockfactory/icon.png deleted file mode 100644 index 2fcb25ed7fb5639cf6046929037d394f5c059f7e..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/blockfactory/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/blockfactory/index.html b/res/lib/blockly/demos/blockfactory/index.html deleted file mode 100644 index 0c1fc87b97137e582e3e54a6057310086b30710b..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/index.html +++ /dev/null @@ -1,763 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="target-densitydpi=device-dpi, height=660, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> - <title>Blockly Demo: Blockly Developer Tools</title> - <script src="../../blockly_compressed.js"></script> - <script src="../../javascript_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="analytics.js"></script> - <script src="block_definition_extractor.js"></script> - <script src="factory_utils.js"></script> - <script src="workspacefactory/wfactory_model.js"></script> - <script src="standard_categories.js"></script> - <script src="cp.js"></script> - <script src="workspacefactory/wfactory_controller.js"></script> - <script src="workspacefactory/wfactory_view.js"></script> - <script src="workspacefactory/wfactory_generator.js"></script> - <script src="workspacefactory/wfactory_init.js"></script> - <script src="block_option.js"></script> - <script src="factory.js"></script> - <script src="block_library_view.js"></script> - <script src="block_library_storage.js"></script> - <script src="block_library_controller.js"></script> - <script src="block_exporter_tools.js"></script> - <script src="block_exporter_view.js"></script> - <script src="block_exporter_controller.js"></script> - <script src="blocks.js"></script> - <script src="app_controller.js"></script> - <script src="/storage.js"></script> - <link rel="stylesheet" href="factory.css"> - <link rel="stylesheet" href="cp.css"> - <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script> - <script> - var blocklyFactory; - var init = function() { - BlocklyDevTools.Analytics.init(); - - blocklyFactory = new AppController(); - blocklyFactory.init(); - window.addEventListener('beforeunload', blocklyFactory.confirmLeavePage); - }; - window.addEventListener('load', init); - </script> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Blockly Developer Tools - <button id="helpButton" title="View documentation in new window."> - <span>Help</span> - </button> - </h1> - <div id="tabContainer"> - <div id="blockFactory_tab" class="tab tabon">Block Factory</div> - <div id="blocklibraryExporter_tab" class="tab taboff">Block Exporter</div> - <div id="workspaceFactory_tab" class="tab taboff">Workspace Factory</div> - </div> - - <!-- Exporter tab --> - <div id="blockLibraryExporter"> - <br> - <p> - First, select blocks from your block library by clicking on them. Then, use the Export Settings form to download starter code for selected blocks. - </p> - <div id="exportSelector"> - <br> - <h3>Block Selector</h3> - <div class="dropdown"> - <button id="button_setBlocks">Select</button> - <div id="dropdownDiv_setBlocks" class="dropdown-content"> - <a id="dropdown_addAllFromLib" title="Select all block library blocks.">All Stored in Block Library</a> - <a id="dropdown_addAllUsed" title="Select all block library blocks used in workspace factory.">All Used in Workspace Factory</a> - </div> - <button id="clearSelectedButton" title="Clear selected blocks.">Clear Selected</button> - </div> - - <div id="blockSelector"></div> - </div> - - <!-- Users may customize export settings through this form --> - <div id="exportSettings"> - <br> - <h3> Export Settings </h3> - <form id="exportSettingsForm"> - - <div id="selectedBlocksTextContainer"> - <p>Currently Selected:</p> - <p id="selectedBlocksText"></p> - </div> - <label><input type="checkbox" id="blockDefCheck">Block Definition(s)</label><br> - <div id="blockDefSettings" class="subsettings"> - <label>Format: - <select id="exportFormat"> - <option value="JSON">JSON</option> - <option value="JavaScript">JavaScript</option> - </select></label> - <br> - <label>File Name:<br> - <input type="text" id="blockDef_filename"></label> - </div> - <br> - - <label><input type="checkbox" id="genStubCheck">Generator Stub(s)</label><br> - <div id="genStubSettings" class="subsettings"> - <label>Language: - <select id="exportLanguage"> - <option value="JavaScript">JavaScript</option> - <option value="Python">Python</option> - <option value="PHP">PHP</option> - <option value="Lua">Lua</option> - <option value="Dart">Dart</option> - </select></label> - <br> - <label>File Name:<br> - <input type="text" id="generatorStub_filename"></label><br> - </div> - <br> - </form> - <button id="exporterSubmitButton" title="Download block starter code as specified in export settings.">Export</button> - </div> - <div id="exportPreview"> - <br> - <h3>Export Preview</h3> - <div id="blockDefs" class="exportPreviewTextArea"> - <p id="blockDefs_label">Block Definitions:</p> - <pre id="blockDefs_textArea" class="prettyprint lang-js"></pre> - </div> - <div id="genStubs" class="exportPreviewTextArea"> - <p id="genStubs_label">Generator Stubs:</p> - <pre id="genStubs_textArea" class="prettyprint lang-js"></pre> - </div> - </div> - </div> - - <!-- Workspace Factory tab --> - - <div id="workspaceFactoryContent"> - <div id="factoryHeader"> - <p> - <div class="dropdown"> - <button id="button_importBlocks">Import Custom Blocks</button> - <div id="dropdownDiv_importBlocks" class="dropdown-content"> - <input type="file" id="input_importBlocksJson" accept=".js, .json, .txt" class="inputfile"</input> - <label for="input_importBlocksJson">From JSON</label> - <input type="file" id="input_importBlocksJs" accept=".js, .txt" class="inputfile"</input> - <label for="input_importBlocksJs">From Javascript</label> - </div> - </div> - - <div class="dropdown"> - <button id="button_load">Load to Edit</button> - <div id="dropdownDiv_load" class="dropdown-content"> - <input type="file" id="input_loadToolbox" accept=".xml" class="inputfile"></input> - <label for="input_loadToolbox">Toolbox</label> - <input type="file" id="input_loadPreload" accept=".xml" class="inputfile"</input> - <label for="input_loadPreload">Workspace Blocks</label> - </div> - </div> - - <div class="dropdown"> - <button id="button_export">Export</button> - <div id="dropdownDiv_export" class="dropdown-content"> - <a id="dropdown_exportOptions">Starter Code</a> - <a id="dropdown_exportToolbox">Toolbox</a> - <a id="dropdown_exportPreload">Workspace Blocks</a> - <a id="dropdown_exportAll">All</a> - </div> - </div> - - <button id="button_clear">Clear</button> - </p> - </div> - - <section id="createDiv"> - <div id="createHeader"> - <h3>Edit</h3> - <p id="editHelpText">Drag blocks into the workspace to configure the toolbox in your custom workspace.</p> - </div> - <table id="workspaceTabs" style="width:auto; height:auto"> - <tr> - <td id="tab_toolbox" class="tabon">Toolbox</td> - <td id="tab_preload" class="taboff">Workspace</td> - </tr> - </table> - <section id="toolbox_section"> - <div id="toolbox_blocks"></div> - </section> - <aside id="toolbox_div"> - <p id="categoryHeader">You currently have no categories.</p> - <table id="categoryTable" style="width:auto; height:auto"> - </table> - <p> </p> - - <div class="dropdown"> - <button id="button_add" class="large">+</button> - <div id="dropdownDiv_add" class="dropdown-content"> - <a id="dropdown_newCategory">New Category</a> - <a id="dropdown_loadCategory">Standard Category</a> - <a id="dropdown_separator">Separator</a> - <a id="dropdown_loadStandardToolbox">Standard Toolbox</a> - </div> - </div> - - <button id="button_remove" class="large">-</button> - - <button id="button_up" class="large">↑</button> - <button id="button_down" class="large">↓</button> - - <br> - <div class="dropdown"> - <button id="button_editCategory">Edit Category...</button> - <div id="dropdownDiv_editCategory" class="dropdown-content"> - <input id="categoryName"> - <input id="categoryColour" value="000000"> - <button id="categorySave">Save</button> - </div> - </div> - - </aside> - - <button id="button_addShadow" style="display: none">Make Shadow</button> - <button id="button_removeShadow" style="display: none">Remove Shadow</button> - - <aside id="preload_div" style="display:none"> - <div id="preloadHelp"> - <p>Configure the options for your Blockly inject call.</p> - <button id="button_optionsHelp">Help</button> - <button class="small" id="button_standardOptions">Reset to Default</button> - </div> - <div id="workspace_options"> - <label><input type="checkbox" id="option_readOnly_checkbox">Read Only</label><br> - <label><input type="checkbox" id="option_grid_checkbox">Use Grid</label><br> - <div id="grid_options" style="display: none"> - <label>Spacing <input type="number" id="gridOption_spacing_number" style="width: 3em"></label><br> - <label>Length <input type="number" id="gridOption_length_number" style="width: 3em"></label><br> - <label>Colour <input type="text" id="gridOption_colour_text" style="width: 8em"></label><br> - <div id="readonly1"> - <label><input type="checkbox" id="gridOption_snap_checkbox">Snap</label><br> - </div> - </div> - <label>Path to Blockly Media <input type="text" id="option_media_text" style="width: 90%"></label><br> - <label><input type="checkbox" id="option_rtl_checkbox">Layout with RTL</label><br> - <label><input type="checkbox" id="option_scrollbars_checkbox">Scrollbars</label><br> - <label><input type="checkbox" id="option_zoom_checkbox">Zoom</label><br> - <div id="zoom_options" style="display: none"> - <label><input type="checkbox" id="zoomOption_controls_checkbox">Zoom Controls</label><br> - <label><input type="checkbox" id="zoomOption_wheel_checkbox">Zoom Wheel</label><br> - <label>Start Scale <input type="number" id="zoomOption_startScale_number" style="width: 4em"></label><br> - <label>Max Scale <input type="number" id="zoomOption_maxScale_number" style="width: 4em"></label><br> - <label>Min Scale <input type="number" id="zoomOption_minScale_number" style="width: 4em"></label><br> - <label>Scale Speed <input type="number" id="zoomOption_scaleSpeed_number" style="width: 4em"></label><br> - </div> - <label><input type="checkbox" id="option_css_checkbox">Use Blockly CSS</label><br> - <div id="readonly2"> - <label><input type="checkbox" id="option_collapse_checkbox">Collapsible Blocks</label><br> - <label><input type="checkbox" id="option_comments_checkbox">Comments for Blocks</label><br> - <label><input type="checkbox" id="option_disable_checkbox">Disabled Blocks</label><br> - <label><input type="checkbox" id="option_infiniteBlocks_checkbox">Infinite Blocks</label><br> - <div id="maxBlockNumber_option" style="display: none"> - <label>Max Blocks <input type="number" id="option_maxBlocks_number" style="width: 5em"></label><br> - </div> - <label><input type="checkbox" id="option_horizontalLayout_checkbox">Horizontal Toolbox</label><br> - <label><input type="checkbox" id="option_toolboxPosition_checkbox">Toolbox End</label><br> - <label><input type="checkbox" id="option_oneBasedIndex_checkbox">One-based index</label><br> - <label><input type="checkbox" id="option_sounds_checkbox">Sounds<br> - <label><input type="checkbox" id="option_trashcan_checkbox">Trashcan</label><br> - </div> - </div> - </aside> - - </section> - - <aside id="previewDiv"> - <div id="previewBorder"> - <div id="previewHelp"> - <h3>Preview</h3> - <p>This is what your custom workspace will look like.</p> - </div> - <div id="preview_blocks" class="content"></div> - </div> - </aside> - </div> - - <!-- Blockly Factory Tab --> - <table id="blockFactoryContent"> - <tr width="100%" height="10%"> - <td width="50%" height="5%"> - <table> - <tr id="blockLibrary"> - <td id="blockLibraryContainer"> - <span> - <div class="dropdown"> - <button id="button_blockLib">Block Library</button> - <div id="dropdownDiv_blockLib" class="dropdown-content"> - <a id="createNewBlockButton">Create New Block</a> - </div> - </div> - <select id="blockLibraryDropdown" style="display:none"> - </select> - </span> - </td> - <td id="blockLibraryControls"> - <button id="saveToBlockLibraryButton" title="Save block to Block Library."> - Save "block_type" - </button> - <button id="removeBlockFromLibraryButton" title="Remove block from Block Library."> - Delete "block_type" - </button> - </td> - </tr> - </table> - </td> - <td height="5%"> - <table id="blockFactoryPreview"> - <tr> - <td id="previewContainer"> - <h3>Preview: - <select id="direction"> - <option value="ltr">LTR</option> - <option value="rtl">RTL</option> - </select> - </h3> - </td> - <td id="buttonContainer"> - <button id="linkButton" title="Save and link to blocks."> - <img src="link.png" height="21" width="21"> - </button> - <button id="clearBlockLibraryButton" title="Clear Block Library."> - <span>Clear Library</span> - </button> - <label for="files" class="buttonStyle"> - <span class=>Import Block Library</span> - </label> - <input id="files" type="file" name="files" - accept="application/xml"> - <button id="localSaveButton" title="Save block library XML to a local file."> - <span>Download Block Library</span> - </button> - </td> - </tr> - </table> - </td> - </tr> - <tr height="80%"> - <td id="blocklyWorkspaceContainer"> - <div id="blockly"></div> - <div id="blocklyMask"></div> - </td> - <td width="50%"> - <table id="blocklyPreviewContainer"> - <tr> - <td height="30%"> - <div id="preview"></div> - </td> - </tr> - <tr> - <td height="5%"> - <h3>Block Definition: - <!-- TODO(#1268): Separate concerns of format and editable. - - Add "Editable" state toggle button? --> - <select id="format"> - <option value="JSON">JSON</option> - <option value="JavaScript">JavaScript</option> - <option value="Manual-JSON">Manual JSON…</option> - <script> - // Manual JavaScript works but requires use of eval(). - // TODO(#1269): Replace eval() with JS-Interpreter before - // re-enabling "Manual JavaScript" mode. - if (document.location.href.indexOf('file://') == 0) { - document.write( - '<option value="Manual-JS">Manual JavaScript…</option>'); - } - </script> - </select> - </h3> - </td> - </tr> - <tr> - <td height="30%"> - <pre id="languagePre" class="prettyprint lang-js"></pre> - <textarea id="languageTA"></textarea> - </td> - </tr> - <tr> - <td height="5%"> - <h3>Generator stub: - <select id="language"> - <option value="JavaScript">JavaScript</option> - <option value="Python">Python</option> - <option value="PHP">PHP</option> - <option value="Lua">Lua</option> - <option value="Dart">Dart</option> - </select> - </h3> - </td> - </tr> - <tr> - <td height="30%"> - <pre id="generatorPre" class="prettyprint lang-js"></pre> - </td> - </tr> - </table> - </td> - </tr> - </table> - - <div id="modalShadow"></div> - - <xml xmlns="https://developers.google.com/blockly/xml" id="blockfactory_toolbox" class="toolbox"> - <category name="Input"> - <block type="input_value"> - <value name="TYPE"> - <shadow type="type_null"></shadow> - </value> - </block> - <block type="input_statement"> - <value name="TYPE"> - <shadow type="type_null"></shadow> - </value> - </block> - <block type="input_dummy"></block> - </category> - <category name="Field"> - <block type="field_static"></block> - <block type="field_label_serializable"></block> - <block type="field_input"></block> - <block type="field_number"></block> - <block type="field_angle"></block> - <block type="field_dropdown"></block> - <block type="field_checkbox"></block> - <block type="field_colour"></block> - <!-- - Date picker commented out since it increases footprint by 60%. - Add it only if you need it. See also goog.require in blockly.js. - <block type="field_date"></block> - --> - <block type="field_variable"></block> - <block type="field_image"></block> - </category> - <category name="Type"> - <block type="type_group"></block> - <block type="type_null"></block> - <block type="type_boolean"></block> - <block type="type_number"></block> - <block type="type_string"></block> - <block type="type_list"></block> - <block type="type_other"></block> - </category> - <category name="Colour" id="colourCategory"> - <block type="colour_hue"><mutation colour="20"></mutation><field name="HUE">20</field></block> - <block type="colour_hue"><mutation colour="65"></mutation><field name="HUE">65</field></block> - <block type="colour_hue"><mutation colour="120"></mutation><field name="HUE">120</field></block> - <block type="colour_hue"><mutation colour="160"></mutation><field name="HUE">160</field></block> - <block type="colour_hue"><mutation colour="210"></mutation><field name="HUE">210</field></block> - <block type="colour_hue"><mutation colour="230"></mutation><field name="HUE">230</field></block> - <block type="colour_hue"><mutation colour="260"></mutation><field name="HUE">260</field></block> - <block type="colour_hue"><mutation colour="290"></mutation><field name="HUE">290</field></block> - <block type="colour_hue"><mutation colour="330"></mutation><field name="HUE">330</field></block> - </category> - </xml> - - <xml xmlns="https://developers.google.com/blockly/xml" id="workspacefactory_toolbox" class="toolbox"> - <category name="Logic" colour="210"> - <block type="controls_if"></block> - <block type="logic_compare"></block> - <block type="logic_operation"></block> - <block type="logic_negate"></block> - <block type="logic_boolean"></block> - <block type="logic_null"></block> - <block type="logic_ternary"></block> - </category> - <category name="Loops" colour="120"> - <block type="controls_repeat_ext"> - <value name="TIMES"> - <shadow type="math_number"> - <field name="NUM">10</field> - </shadow> - </value> - </block> - <block type="controls_whileUntil"></block> - <block type="controls_for"> - <value name="FROM"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="TO"> - <shadow type="math_number"> - <field name="NUM">10</field> - </shadow> - </value> - <value name="BY"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - </block> - <block type="controls_forEach"></block> - <block type="controls_flow_statements"></block> - </category> - <category name="Math" colour="230"> - <block type="math_number"></block> - <block type="math_arithmetic"> - <value name="A"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="B"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - </block> - <block type="math_single"> - <value name="NUM"> - <shadow type="math_number"> - <field name="NUM">9</field> - </shadow> - </value> - </block> - <block type="math_trig"> - <value name="NUM"> - <shadow type="math_number"> - <field name="NUM">45</field> - </shadow> - </value> - </block> - <block type="math_constant"></block> - <block type="math_number_property"> - <value name="NUMBER_TO_CHECK"> - <shadow type="math_number"> - <field name="NUM">0</field> - </shadow> - </value> - </block> - <block type="math_round"> - <value name="NUM"> - <shadow type="math_number"> - <field name="NUM">3.1</field> - </shadow> - </value> - </block> - <block type="math_on_list"></block> - <block type="math_modulo"> - <value name="DIVIDEND"> - <shadow type="math_number"> - <field name="NUM">64</field> - </shadow> - </value> - <value name="DIVISOR"> - <shadow type="math_number"> - <field name="NUM">10</field> - </shadow> - </value> - </block> - <block type="math_constrain"> - <value name="VALUE"> - <shadow type="math_number"> - <field name="NUM">50</field> - </shadow> - </value> - <value name="LOW"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="HIGH"> - <shadow type="math_number"> - <field name="NUM">100</field> - </shadow> - </value> - </block> - <block type="math_random_int"> - <value name="FROM"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="TO"> - <shadow type="math_number"> - <field name="NUM">100</field> - </shadow> - </value> - </block> - <block type="math_random_float"></block> - </category> - <category name="Text" colour="160"> - <block type="text"></block> - <block type="text_join"></block> - <block type="text_append"> - <value name="TEXT"> - <shadow type="text"></shadow> - </value> - </block> - <block type="text_length"> - <value name="VALUE"> - <shadow type="text"> - <field name="TEXT">abc</field> - </shadow> - </value> - </block> - <block type="text_isEmpty"> - <value name="VALUE"> - <shadow type="text"> - <field name="TEXT"></field> - </shadow> - </value> - </block> - <block type="text_indexOf"> - <value name="VALUE"> - <block type="variables_get"> - <field name="VAR">text</field> - </block> - </value> - <value name="FIND"> - <shadow type="text"> - <field name="TEXT">abc</field> - </shadow> - </value> - </block> - <block type="text_charAt"> - <value name="VALUE"> - <block type="variables_get"> - <field name="VAR">text</field> - </block> - </value> - </block> - <block type="text_getSubstring"> - <value name="STRING"> - <block type="variables_get"> - <field name="VAR">text</field> - </block> - </value> - </block> - <block type="text_changeCase"> - <value name="TEXT"> - <shadow type="text"> - <field name="TEXT">abc</field> - </shadow> - </value> - </block> - <block type="text_trim"> - <value name="TEXT"> - <shadow type="text"> - <field name="TEXT">abc</field> - </shadow> - </value> - </block> - <block type="text_print"> - <value name="TEXT"> - <shadow type="text"> - <field name="TEXT">abc</field> - </shadow> - </value> - </block> - <block type="text_prompt_ext"> - <value name="TEXT"> - <shadow type="text"> - <field name="TEXT">abc</field> - </shadow> - </value> - </block> - </category> - <category name="Lists" colour="260"> - <block type="lists_create_with"> - <mutation items="0"></mutation> - </block> - <block type="lists_create_with"></block> - <block type="lists_repeat"> - <value name="NUM"> - <shadow type="math_number"> - <field name="NUM">5</field> - </shadow> - </value> - </block> - <block type="lists_length"></block> - <block type="lists_isEmpty"></block> - <block type="lists_indexOf"> - <value name="VALUE"> - <block type="variables_get"> - <field name="VAR">list</field> - </block> - </value> - </block> - <block type="lists_getIndex"> - <value name="VALUE"> - <block type="variables_get"> - <field name="VAR">list</field> - </block> - </value> - </block> - <block type="lists_setIndex"> - <value name="LIST"> - <block type="variables_get"> - <field name="VAR">list</field> - </block> - </value> - </block> - <block type="lists_getSublist"> - <value name="LIST"> - <block type="variables_get"> - <field name="VAR">list</field> - </block> - </value> - </block> - <block type="lists_split"> - <value name="DELIM"> - <shadow type="text"> - <field name="TEXT">,</field> - </shadow> - </value> - </block> - <block type="lists_sort"></block> - </category> - <category name="Colour" colour="20"> - <block type="colour_picker"></block> - <block type="colour_random"></block> - <block type="colour_rgb"> - <value name="RED"> - <shadow type="math_number"> - <field name="NUM">100</field> - </shadow> - </value> - <value name="GREEN"> - <shadow type="math_number"> - <field name="NUM">50</field> - </shadow> - </value> - <value name="BLUE"> - <shadow type="math_number"> - <field name="NUM">0</field> - </shadow> - </value> - </block> - <block type="colour_blend"> - <value name="COLOUR1"> - <shadow type="colour_picker"> - <field name="COLOUR">#ff0000</field> - </shadow> - </value> - <value name="COLOUR2"> - <shadow type="colour_picker"> - <field name="COLOUR">#3333ff</field> - </shadow> - </value> - <value name="RATIO"> - <shadow type="math_number"> - <field name="NUM">0.5</field> - </shadow> - </value> - </block> - </category> - <sep></sep> - <category name="Variables" colour="330" custom="VARIABLE"></category> - <category name="Functions" colour="290" custom="PROCEDURE"></category> - <sep></sep> - <category name="Block Library" colour="260" id="blockLibCategory"></category> - </xml> - -</body> -</html> diff --git a/res/lib/blockly/demos/blockfactory/link.png b/res/lib/blockly/demos/blockfactory/link.png deleted file mode 100644 index 11dfd82845e582b4272969694e305b71226546ff..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/blockfactory/link.png and /dev/null differ diff --git a/res/lib/blockly/demos/blockfactory/standard_categories.js b/res/lib/blockly/demos/blockfactory/standard_categories.js deleted file mode 100644 index 95c33242fd3df285f842926084c4fa5089aa8194..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/standard_categories.js +++ /dev/null @@ -1,392 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Contains a map of standard Blockly categories used to load - * standard Blockly categories into the user's toolbox. The map is keyed by - * the lower case name of the category, and contains the Category object for - * that particular category. Also has a list of core block types provided - * by Blockly. - * - * @author Emma Dauterman (evd2014) - */ - 'use strict'; - -/** - * Namespace for StandardCategories - */ -var StandardCategories = StandardCategories || Object.create(null); - - -// Map of standard category information necessary to add a standard category -// to the toolbox. -StandardCategories.categoryMap = Object.create(null); - -StandardCategories.categoryMap['logic'] = - new ListElement(ListElement.TYPE_CATEGORY, 'Logic'); -StandardCategories.categoryMap['logic'].xml = - Blockly.Xml.textToDom( - '<xml xmlns="https://developers.google.com/blockly/xml">' + - '<block type="controls_if"></block>' + - '<block type="logic_compare"></block>' + - '<block type="logic_operation"></block>' + - '<block type="logic_negate"></block>' + - '<block type="logic_boolean"></block>' + - '<block type="logic_null"></block>' + - '<block type="logic_ternary"></block>' + - '</xml>'); -StandardCategories.categoryMap['logic'].hue = 210; - -StandardCategories.categoryMap['loops'] = - new ListElement(ListElement.TYPE_CATEGORY, 'Loops'); -StandardCategories.categoryMap['loops'].xml = - Blockly.Xml.textToDom( - '<xml xmlns="https://developers.google.com/blockly/xml">' + - '<block type="controls_repeat_ext">' + - '<value name="TIMES">' + - '<shadow type="math_number">' + - '<field name="NUM">10</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="controls_whileUntil"></block>' + - '<block type="controls_for">' + - '<value name="FROM">' + - '<shadow type="math_number">' + - '<field name="NUM">1</field>' + - '</shadow>' + - '</value>' + - '<value name="TO">' + - '<shadow type="math_number">' + - '<field name="NUM">10</field>' + - '</shadow>' + - '</value>' + - '<value name="BY">' + - '<shadow type="math_number">' + - '<field name="NUM">1</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="controls_forEach"></block>' + - '<block type="controls_flow_statements"></block>' + - '</xml>'); -StandardCategories.categoryMap['loops'].hue = 120; - -StandardCategories.categoryMap['math'] = - new ListElement(ListElement.TYPE_CATEGORY, 'Math'); -StandardCategories.categoryMap['math'].xml = - Blockly.Xml.textToDom( - '<xml xmlns="https://developers.google.com/blockly/xml">' + - '<block type="math_number"></block>' + - '<block type="math_arithmetic">' + - '<value name="A">' + - '<shadow type="math_number">' + - '<field name="NUM">1</field>' + - '</shadow>' + - '</value>' + - '<value name="B">' + - '<shadow type="math_number">' + - '<field name="NUM">1</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="math_single">' + - '<value name="NUM">' + - '<shadow type="math_number">' + - '<field name="NUM">9</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="math_trig">' + - '<value name="NUM">' + - '<shadow type="math_number">' + - '<field name="NUM">45</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="math_constant"></block>' + - '<block type="math_number_property">' + - '<value name="NUMBER_TO_CHECK">' + - '<shadow type="math_number">' + - '<field name="NUM">0</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="math_round">' + - '<value name="NUM">' + - '<shadow type="math_number">' + - '<field name="NUM">3.1</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="math_on_list"></block>' + - '<block type="math_modulo">' + - '<value name="DIVIDEND">' + - '<shadow type="math_number">' + - '<field name="NUM">64</field>' + - '</shadow>' + - '</value>' + - '<value name="DIVISOR">' + - '<shadow type="math_number">' + - '<field name="NUM">10</field>'+ - '</shadow>' + - '</value>' + - '</block>' + - '<block type="math_constrain">' + - '<value name="VALUE">' + - '<shadow type="math_number">' + - '<field name="NUM">50</field>' + - '</shadow>' + - '</value>' + - '<value name="LOW">' + - '<shadow type="math_number">' + - '<field name="NUM">1</field>' + - '</shadow>' + - '</value>' + - '<value name="HIGH">' + - '<shadow type="math_number">' + - '<field name="NUM">100</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="math_random_int">' + - '<value name="FROM">' + - '<shadow type="math_number">' + - '<field name="NUM">1</field>' + - '</shadow>' + - '</value>' + - '<value name="TO">' + - '<shadow type="math_number">' + - '<field name="NUM">100</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="math_random_float"></block>' + - '</xml>'); -StandardCategories.categoryMap['math'].hue = 230; - -StandardCategories.categoryMap['text'] = - new ListElement(ListElement.TYPE_CATEGORY, 'Text'); -StandardCategories.categoryMap['text'].xml = - Blockly.Xml.textToDom( - '<xml xmlns="https://developers.google.com/blockly/xml">' + - '<block type="text"></block>' + - '<block type="text_join"></block>' + - '<block type="text_append">' + - '<value name="TEXT">' + - '<shadow type="text"></shadow>' + - '</value>' + - '</block>' + - '<block type="text_length">' + - '<value name="VALUE">' + - '<shadow type="text">' + - '<field name="TEXT">abc</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="text_isEmpty">' + - '<value name="VALUE">' + - '<shadow type="text">' + - '<field name="TEXT"></field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="text_indexOf">' + - '<value name="VALUE">' + - '<block type="variables_get">' + - '<field name="VAR">text</field>' + - '</block>' + - '</value>' + - '<value name="FIND">' + - '<shadow type="text">' + - '<field name="TEXT">abc</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="text_charAt">' + - '<value name="VALUE">' + - '<block type="variables_get">' + - '<field name="VAR">text</field>' + - '</block>' + - '</value>' + - '</block>' + - '<block type="text_getSubstring">' + - '<value name="STRING">' + - '<block type="variables_get">' + - '<field name="VAR">text</field>' + - '</block>' + - '</value>' + - '</block>' + - '<block type="text_changeCase">' + - '<value name="TEXT">' + - '<shadow type="text">' + - '<field name="TEXT">abc</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="text_trim">' + - '<value name="TEXT">' + - '<shadow type="text">' + - '<field name="TEXT">abc</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="text_print">' + - '<value name="TEXT">' + - '<shadow type="text">' + - '<field name="TEXT">abc</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="text_prompt_ext">' + - '<value name="TEXT">' + - '<shadow type="text">' + - '<field name="TEXT">abc</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '</xml>'); -StandardCategories.categoryMap['text'].hue = 160; - -StandardCategories.categoryMap['lists'] = - new ListElement(ListElement.TYPE_CATEGORY, 'Lists'); -StandardCategories.categoryMap['lists'].xml = - Blockly.Xml.textToDom( - '<xml xmlns="https://developers.google.com/blockly/xml">' + - '<block type="lists_create_with">' + - '<mutation items="0"></mutation>' + - '</block>' + - '<block type="lists_create_with"></block>' + - '<block type="lists_repeat">' + - '<value name="NUM">' + - '<shadow type="math_number">' + - '<field name="NUM">5</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="lists_length"></block>' + - '<block type="lists_isEmpty"></block>' + - '<block type="lists_indexOf">' + - '<value name="VALUE">' + - '<block type="variables_get">' + - '<field name="VAR">list</field>' + - '</block>' + - '</value>' + - '</block>' + - '<block type="lists_getIndex">' + - '<value name="VALUE">' + - '<block type="variables_get">' + - '<field name="VAR">list</field>' + - '</block>' + - '</value>' + - '</block>' + - '<block type="lists_setIndex">' + - '<value name="LIST">' + - '<block type="variables_get">' + - '<field name="VAR">list</field>' + - '</block>' + - '</value>' + - '</block>' + - '<block type="lists_getSublist">' + - '<value name="LIST">' + - '<block type="variables_get">' + - '<field name="VAR">list</field>' + - '</block>' + - '</value>' + - '</block>' + - '<block type="lists_split">' + - '<value name="DELIM">' + - '<shadow type="text">' + - '<field name="TEXT">,</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="lists_sort"></block>' + - '</xml>'); -StandardCategories.categoryMap['lists'].hue = 260; - -StandardCategories.categoryMap['colour'] = - new ListElement(ListElement.TYPE_CATEGORY, 'Colour'); -StandardCategories.categoryMap['colour'].xml = - Blockly.Xml.textToDom( - '<xml xmlns="https://developers.google.com/blockly/xml">' + - '<block type="colour_picker"></block>' + - '<block type="colour_random"></block>' + - '<block type="colour_rgb">' + - '<value name="RED">' + - '<shadow type="math_number">' + - '<field name="NUM">100</field>' + - '</shadow>' + - '</value>' + - '<value name="GREEN">' + - '<shadow type="math_number">' + - '<field name="NUM">50</field>' + - '</shadow>' + - '</value>' + - '<value name="BLUE">' + - '<shadow type="math_number">' + - '<field name="NUM">0</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '<block type="colour_blend">' + - '<value name="COLOUR1">' + - '<shadow type="colour_picker">' + - '<field name="COLOUR">#ff0000</field>' + - '</shadow>' + - '</value>' + - '<value name="COLOUR2">' + - '<shadow type="colour_picker">' + - '<field name="COLOUR">#3333ff</field>' + - '</shadow>' + - '</value>' + - '<value name="RATIO">' + - '<shadow type="math_number">' + - '<field name="NUM">0.5</field>' + - '</shadow>' + - '</value>' + - '</block>' + - '</xml>'); -StandardCategories.categoryMap['colour'].hue = 20; - -StandardCategories.categoryMap['functions'] = - new ListElement(ListElement.TYPE_CATEGORY, 'Functions'); -StandardCategories.categoryMap['functions'].hue = 290; -StandardCategories.categoryMap['functions'].custom = 'PROCEDURE'; - -StandardCategories.categoryMap['variables'] = - new ListElement(ListElement.TYPE_CATEGORY, 'Variables'); -StandardCategories.categoryMap['variables'].hue = 330; -StandardCategories.categoryMap['variables'].custom = 'VARIABLE'; - -// All standard block types in provided in Blockly core. -StandardCategories.coreBlockTypes = ["controls_if", "logic_compare", - "logic_operation", "logic_negate", "logic_boolean", "logic_null", - "logic_ternary", "controls_repeat_ext", "controls_whileUntil", - "controls_for", "controls_forEach", "controls_flow_statements", - "math_number", "math_arithmetic", "math_single", "math_trig", - "math_constant", "math_number_property", "math_change", "math_round", - "math_on_list", "math_modulo", "math_constrain", "math_random_int", - "math_random_float", "text", "text_join", "text_append", "text_length", - "text_isEmpty", "text_indexOf", "variables_get", "text_charAt", - "text_getSubstring", "text_changeCase", "text_trim", "text_print", - "text_prompt_ext", "colour_picker", "colour_random", "colour_rgb", - "colour_blend", "lists_create_with", "lists_repeat", "lists_length", - "lists_isEmpty", "lists_indexOf", "lists_getIndex", "lists_setIndex", - "lists_getSublist", "lists_split", "lists_sort", "variables_set", - "procedures_defreturn", "procedures_ifreturn", "procedures_defnoreturn", - "procedures_callreturn"]; diff --git a/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_controller.js b/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_controller.js deleted file mode 100644 index c1305fde677e4bd62ac489834cc52ad1d7433cd6..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_controller.js +++ /dev/null @@ -1,1348 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Contains the controller code for workspace factory. Depends - * on the model and view objects (created as internal variables) and interacts - * with previewWorkspace and toolboxWorkspace (internal references stored to - * both). Also depends on standard_categories.js for standard Blockly - * categories. Provides the functionality for the actions the user can initiate: - * - adding and removing categories - * - switching between categories - * - printing and downloading configuration xml - * - updating the preview workspace - * - changing a category name - * - moving the position of a category. - * - * @author Emma Dauterman (evd2014) - */ - -/** - * Class for a WorkspaceFactoryController - * @param {string} toolboxName Name of workspace toolbox XML. - * @param {string} toolboxDiv Name of div to inject toolbox workspace in. - * @param {string} previewDiv Name of div to inject preview workspace in. - * @constructor - */ -WorkspaceFactoryController = function(toolboxName, toolboxDiv, previewDiv) { - // Toolbox XML element for the editing workspace. - this.toolbox = document.getElementById(toolboxName); - - // Workspace for user to drag blocks in for a certain category. - this.toolboxWorkspace = Blockly.inject(toolboxDiv, - {grid: - {spacing: 25, - length: 3, - colour: '#ccc', - snap: true}, - media: '../../media/', - toolbox: this.toolbox - }); - - // Workspace for user to preview their changes. - this.previewWorkspace = Blockly.inject(previewDiv, - {grid: - {spacing: 25, - length: 3, - colour: '#ccc', - snap: true}, - media: '../../media/', - toolbox: '<xml xmlns="https://developers.google.com/blockly/xml"></xml>', - zoom: - {controls: true, - wheel: true} - }); - - // Model to keep track of categories and blocks. - this.model = new WorkspaceFactoryModel(); - // Updates the category tabs. - this.view = new WorkspaceFactoryView(); - // Generates XML for categories. - this.generator = new WorkspaceFactoryGenerator(this.model); - // Tracks which editing mode the user is in. Toolbox mode on start. - this.selectedMode = WorkspaceFactoryController.MODE_TOOLBOX; - // True if key events are enabled, false otherwise. - this.keyEventsEnabled = true; - // True if there are unsaved changes in the toolbox, false otherwise. - this.hasUnsavedToolboxChanges = false; - // True if there are unsaved changes in the preloaded blocks, false otherwise. - this.hasUnsavedPreloadChanges = false; -}; - -// Toolbox editing mode. Changes the user makes to the workspace updates the -// toolbox. -WorkspaceFactoryController.MODE_TOOLBOX = 'toolbox'; -// Pre-loaded workspace editing mode. Changes the user makes to the workspace -// udpates the pre-loaded blocks. -WorkspaceFactoryController.MODE_PRELOAD = 'preload'; - -/** - * Currently prompts the user for a name, checking that it's valid (not used - * before), and then creates a tab and switches to it. - */ -WorkspaceFactoryController.prototype.addCategory = function() { - // Transfers the user's blocks to a flyout if it's the first category created. - this.transferFlyoutBlocksToCategory(); - - // After possibly creating a category, check again if it's the first category. - var isFirstCategory = !this.model.hasElements(); - // Get name from user. - var name = this.promptForNewCategoryName('Enter the name of your new category:'); - if (!name) { // Exit if cancelled. - return; - } - // Create category. - this.createCategory(name); - // Switch to category. - this.switchElement(this.model.getCategoryIdByName(name)); - - // Sets the default options for injecting the workspace - // when there are categories if adding the first category. - if (isFirstCategory) { - this.view.setCategoryOptions(this.model.hasElements()); - this.generateNewOptions(); - } - // Update preview. - this.updatePreview(); -}; - -/** - * Helper method for addCategory. Adds a category to the view given a name, ID, - * and a boolean for if it's the first category created. Assumes the category - * has already been created in the model. Does not switch to category. - * @param {string} name Name of category being added. - * @param {string} id The ID of the category being added. - */ -WorkspaceFactoryController.prototype.createCategory = function(name) { - // Create empty category - var category = new ListElement(ListElement.TYPE_CATEGORY, name); - this.model.addElementToList(category); - // Create new category. - var tab = this.view.addCategoryRow(name, category.id); - this.addClickToSwitch(tab, category.id); -}; - -/** - * Given a tab and a ID to be associated to that tab, adds a listener to - * that tab so that when the user clicks on the tab, it switches to the - * element associated with that ID. - * @param {!Element} tab The DOM element to add the listener to. - * @param {string} id The ID of the element to switch to when tab is clicked. - */ -WorkspaceFactoryController.prototype.addClickToSwitch = function(tab, id) { - var self = this; - var clickFunction = function(id) { // Keep this in scope for switchElement. - return function() { - self.switchElement(id); - }; - }; - this.view.bindClick(tab, clickFunction(id)); -}; - -/** - * Transfers the blocks in the user's flyout to a new category if - * the user is creating their first category and their workspace is not - * empty. Should be called whenever it is possible to switch from single flyout - * to categories (not including importing). - */ -WorkspaceFactoryController.prototype.transferFlyoutBlocksToCategory = - function() { - // Saves the user's blocks from the flyout in a category if there is no - // toolbox and the user has dragged in blocks. - if (!this.model.hasElements() && - this.toolboxWorkspace.getAllBlocks(false).length > 0) { - // Create the new category. - this.createCategory('Category 1', true); - // Set the new category as selected. - var id = this.model.getCategoryIdByName('Category 1'); - this.model.setSelectedById(id); - this.view.setCategoryTabSelection(id, true); - // Allow user to use the default options for injecting with categories. - this.view.setCategoryOptions(this.model.hasElements()); - this.generateNewOptions(); - // Update preview here in case exit early. - this.updatePreview(); - } -}; - -/** - * Attached to "-" button. Checks if the user wants to delete - * the current element. Removes the element and switches to another element. - * When the last element is removed, it switches to a single flyout mode. - */ -WorkspaceFactoryController.prototype.removeElement = function() { - // Check that there is a currently selected category to remove. - if (!this.model.getSelected()) { - return; - } - - // Check if user wants to remove current category. - var check = confirm('Are you sure you want to delete the currently selected ' - + this.model.getSelected().type + '?'); - if (!check) { // If cancelled, exit. - return; - } - - var selectedId = this.model.getSelectedId(); - var selectedIndex = this.model.getIndexByElementId(selectedId); - // Delete element visually. - this.view.deleteElementRow(selectedId, selectedIndex); - // Delete element in model. - this.model.deleteElementFromList(selectedIndex); - - // Find next logical element to switch to. - var next = this.model.getElementByIndex(selectedIndex); - if (!next && this.model.hasElements()) { - next = this.model.getElementByIndex(selectedIndex - 1); - } - var nextId = next ? next.id : null; - - // Open next element. - this.clearAndLoadElement(nextId); - - // If no element to switch to, display message, clear the workspace, and - // set a default selected element not in toolbox list in the model. - if (!nextId) { - alert('You currently have no categories or separators. All your blocks' + - ' will be displayed in a single flyout.'); - this.toolboxWorkspace.clear(); - this.toolboxWorkspace.clearUndo(); - this.model.createDefaultSelectedIfEmpty(); - } - // Update preview. - this.updatePreview(); -}; - -/** - * Gets a valid name for a new category from the user. - * @param {string} promptString Prompt for the user to enter a name. - * @param {string=} opt_oldName The current name. - * @return {string?} Valid name for a new category, or null if cancelled. - */ -WorkspaceFactoryController.prototype.promptForNewCategoryName = - function(promptString, opt_oldName) { - var defaultName = opt_oldName; - do { - var name = prompt(promptString, defaultName); - if (!name) { // If cancelled. - return null; - } - defaultName = name; - } while (this.model.hasCategoryByName(name)); - return name; -}; - -/** - * Switches to a new tab for the element given by ID. Stores XML and blocks - * to reload later, updates selected accordingly, and clears the workspace - * and clears undo, then loads the new element. - * @param {string} id ID of tab to be opened, must be valid element ID. - */ -WorkspaceFactoryController.prototype.switchElement = function(id) { - // Disables events while switching so that Blockly delete and create events - // don't update the preview repeatedly. - Blockly.Events.disable(); - // Caches information to reload or generate XML if switching to/from element. - // Only saves if a category is selected. - if (this.model.getSelectedId() != null && id != null) { - this.model.getSelected().saveFromWorkspace(this.toolboxWorkspace); - } - // Load element. - this.clearAndLoadElement(id); - // Enable Blockly events again. - Blockly.Events.enable(); -}; - -/** - * Switches to a new tab for the element by ID. Helper for switchElement. - * Updates selected, clears the workspace and clears undo, loads a new element. - * @param {string} id ID of category to load. - */ -WorkspaceFactoryController.prototype.clearAndLoadElement = function(id) { - // Unselect current tab if switching to and from an element. - if (this.model.getSelectedId() != null && id != null) { - this.view.setCategoryTabSelection(this.model.getSelectedId(), false); - } - - // If switching to another category, set category selection in the model and - // view. - if (id != null) { - // Set next category. - this.model.setSelectedById(id); - - // Clears workspace and loads next category. - this.clearAndLoadXml_(this.model.getSelectedXml()); - - // Selects the next tab. - this.view.setCategoryTabSelection(id, true); - - // Order blocks as shown in flyout. - this.toolboxWorkspace.cleanUp(); - - // Update category editing buttons. - this.view.updateState(this.model.getIndexByElementId - (this.model.getSelectedId()), this.model.getSelected()); - } else { - // Update category editing buttons for no categories. - this.view.updateState(-1, null); - } -}; - -/** - * Tied to "Export" button. Gets a file name from the user and downloads - * the corresponding configuration XML to that file. - * @param {string} exportMode The type of file to export - * (WorkspaceFactoryController.MODE_TOOLBOX for the toolbox configuration, - * and WorkspaceFactoryController.MODE_PRELOAD for the pre-loaded workspace - * configuration) - */ -WorkspaceFactoryController.prototype.exportXmlFile = function(exportMode) { - // Get file name. - if (exportMode == WorkspaceFactoryController.MODE_TOOLBOX) { - var fileName = prompt('File Name for toolbox XML:', 'toolbox.xml'); - } else { - var fileName = prompt('File Name for pre-loaded workspace XML:', - 'workspace.xml'); - } - if (!fileName) { // If cancelled. - return; - } - - // Generate XML. - if (exportMode == WorkspaceFactoryController.MODE_TOOLBOX) { - // Export the toolbox XML. - var configXml = Blockly.Xml.domToPrettyText( - this.generator.generateToolboxXml()); - this.hasUnsavedToolboxChanges = false; - } else if (exportMode == WorkspaceFactoryController.MODE_PRELOAD) { - // Export the pre-loaded block XML. - var configXml = Blockly.Xml.domToPrettyText( - this.generator.generateWorkspaceXml()); - this.hasUnsavedPreloadChanges = false; - } else { - // Unknown mode. Throw error. - var msg = 'Unknown export mode: ' + exportMode; - BlocklyDevTools.Analytics.onError(msg); - throw Error(msg); - } - - // Unpack self-closing tags. These tags fail when embedded in HTML. - // <block name="foo"/> -> <block name="foo"></block> - configXml = configXml.replace(/<(\w+)([^<]*)\/>/g, '<$1$2></$1>'); - - // Download file. - var data = new Blob([configXml], {type: 'text/xml'}); - this.view.createAndDownloadFile(fileName, data); - - if (exportMode == WorkspaceFactoryController.MODE_TOOLBOX) { - BlocklyDevTools.Analytics.onExport( - BlocklyDevTools.Analytics.TOOLBOX, - { format: BlocklyDevTools.Analytics.FORMAT_XML }); - } else if (exportMode == WorkspaceFactoryController.MODE_PRELOAD) { - BlocklyDevTools.Analytics.onExport( - BlocklyDevTools.Analytics.WORKSPACE_CONTENTS, - { format: BlocklyDevTools.Analytics.FORMAT_XML }); - } -}; - -/** - * Export the options object to be used for the Blockly inject call. Gets a - * file name from the user and downloads the options object to that file. - */ -WorkspaceFactoryController.prototype.exportInjectFile = function() { - var fileName = prompt('File Name for starter Blockly workspace code:', - 'workspace.js'); - if (!fileName) { // If cancelled. - return; - } - // Generate new options to remove toolbox XML from options object (if - // necessary). - this.generateNewOptions(); - var printableOptions = this.generator.generateInjectString() - var data = new Blob([printableOptions], {type: 'text/javascript'}); - this.view.createAndDownloadFile(fileName, data); - - BlocklyDevTools.Analytics.onExport( - BlocklyDevTools.Analytics.STARTER_CODE, - { - format: BlocklyDevTools.Analytics.FORMAT_JS, - platform: BlocklyDevTools.Analytics.PLATFORM_WEB - }); -}; - -/** - * Tied to "Print" button. Mainly used for debugging purposes. Prints - * the configuration XML to the console. - */ -WorkspaceFactoryController.prototype.printConfig = function() { - // Capture any changes made by user before generating XML. - this.saveStateFromWorkspace(); - // Print XML. - console.log(Blockly.Xml.domToPrettyText(this.generator.generateToolboxXml())); -}; - -/** - * Updates the preview workspace based on the toolbox workspace. If switching - * from no categories to categories or categories to no categories, reinjects - * Blockly with reinjectPreview, otherwise just updates without reinjecting. - * Called whenever a list element is created, removed, or modified and when - * Blockly move and delete events are fired. Do not call on create events - * or disabling will cause the user to "drop" their current blocks. Make sure - * that no changes have been made to the workspace since updating the model - * (if this might be the case, call saveStateFromWorkspace). - */ -WorkspaceFactoryController.prototype.updatePreview = function() { - // Disable events to stop updatePreview from recursively calling itself - // through event handlers. - Blockly.Events.disable(); - - // Only update the toolbox if not in read only mode. - if (!this.model.options['readOnly']) { - // Get toolbox XML. - var tree = Blockly.Options.parseToolboxTree( - this.generator.generateToolboxXml()); - - // No categories, creates a simple flyout. - if (tree.getElementsByTagName('category').length == 0) { - // No categories, creates a simple flyout. - if (this.previewWorkspace.toolbox_) { - this.reinjectPreview(tree); // Switch to simple flyout, expensive. - } else { - this.previewWorkspace.updateToolbox(tree); - } - } else { - // Uses categories, creates a toolbox. - if (!this.previewWorkspace.toolbox_) { - this.reinjectPreview(tree); // Create a toolbox, expensive. - } else { - // Close the toolbox before updating it so that the user has to reopen - // the flyout and see their updated toolbox (open flyout doesn't update) - this.previewWorkspace.toolbox_.clearSelection(); - this.previewWorkspace.updateToolbox(tree); - } - } - } - - // Update pre-loaded blocks in the preview workspace. - this.previewWorkspace.clear(); - Blockly.Xml.domToWorkspace(this.generator.generateWorkspaceXml(), - this.previewWorkspace); - - // Reenable events. - Blockly.Events.enable(); -}; - -/** - * Saves the state from the workspace depending on the current mode. Should - * be called after making changes to the workspace. - */ -WorkspaceFactoryController.prototype.saveStateFromWorkspace = function() { - if (this.selectedMode == WorkspaceFactoryController.MODE_TOOLBOX) { - // If currently editing the toolbox. - // Update flags if toolbox has been changed. - if (this.model.getSelectedXml() != - Blockly.Xml.workspaceToDom(this.toolboxWorkspace)) { - this.hasUnsavedToolboxChanges = true; - } - - this.model.getSelected().saveFromWorkspace(this.toolboxWorkspace); - - } else if (this.selectedMode == WorkspaceFactoryController.MODE_PRELOAD) { - // If currently editing the pre-loaded workspace. - // Update flags if preloaded blocks have been changed. - if (this.model.getPreloadXml() != - Blockly.Xml.workspaceToDom(this.toolboxWorkspace)) { - this.hasUnsavedPreloadChanges = true; - } - - this.model.savePreloadXml( - Blockly.Xml.workspaceToDom(this.toolboxWorkspace)); - } -}; - -/** - * Used to completely reinject the preview workspace. This should be used only - * when switching from simple flyout to categories, or categories to simple - * flyout. More expensive than simply updating the flyout or toolbox. - * @param {!Element} Tree of XML elements - * @package - */ -WorkspaceFactoryController.prototype.reinjectPreview = function(tree) { - this.previewWorkspace.dispose(); - var injectOptions = this.readOptions_(); - injectOptions['toolbox'] = Blockly.Xml.domToPrettyText(tree); - this.previewWorkspace = Blockly.inject('preview_blocks', injectOptions); - Blockly.Xml.domToWorkspace(this.generator.generateWorkspaceXml(), - this.previewWorkspace); -}; - -/** - * Changes the name and colour of the selected category. - * Return if selected element is a separator. - * @param {string} name New name for selected category. - * @param {?string} colour New colour for selected category, or null if none. - * Must be a valid CSS string, or '' for none. - */ -WorkspaceFactoryController.prototype.changeSelectedCategory = function(name, - colour) { - var selected = this.model.getSelected(); - // Return if a category is not selected. - if (selected.type != ListElement.TYPE_CATEGORY) { - return; - } - // Change colour of selected category. - selected.changeColor(colour); - this.view.setBorderColor(this.model.getSelectedId(), colour); - // Change category name. - selected.changeName(name); - this.view.updateCategoryName(name, this.model.getSelectedId()); - // Update preview. - this.updatePreview(); -}; - -/** - * Tied to arrow up and arrow down buttons. Swaps with the element above or - * below the currently selected element (offset categories away from the - * current element). Updates state to enable the correct element editing - * buttons. - * @param {number} offset The index offset from the currently selected element - * to swap with. Positive if the element to be swapped with is below, negative - * if the element to be swapped with is above. - */ -WorkspaceFactoryController.prototype.moveElement = function(offset) { - var curr = this.model.getSelected(); - if (!curr) { // Return if no selected element. - return; - } - var currIndex = this.model.getIndexByElementId(curr.id); - var swapIndex = this.model.getIndexByElementId(curr.id) + offset; - var swap = this.model.getElementByIndex(swapIndex); - if (!swap) { // Return if cannot swap in that direction. - return; - } - // Move currently selected element to index of other element. - // Indexes must be valid because confirmed that curr and swap exist. - this.moveElementToIndex(curr, swapIndex, currIndex); - // Update element editing buttons. - this.view.updateState(swapIndex, this.model.getSelected()); - // Update preview. - this.updatePreview(); -}; - -/** - * Moves a element to a specified index and updates the model and view - * accordingly. Helper functions throw an error if indexes are out of bounds. - * @param {!Element} element The element to move. - * @param {number} newIndex The index to insert the element at. - * @param {number} oldIndex The index the element is currently at. - */ -WorkspaceFactoryController.prototype.moveElementToIndex = function(element, - newIndex, oldIndex) { - this.model.moveElementToIndex(element, newIndex, oldIndex); - this.view.moveTabToIndex(element.id, newIndex, oldIndex); -}; - -/** - * Tied to the "Standard Category" dropdown option, this function prompts - * the user for a name of a standard Blockly category (case insensitive) and - * loads it as a new category and switches to it. Leverages StandardCategories. - */ -WorkspaceFactoryController.prototype.loadCategory = function() { - // Prompt user for the name of the standard category to load. - do { - var name = prompt('Enter the name of the category you would like to import ' - + '(Logic, Loops, Math, Text, Lists, Colour, Variables, or Functions)'); - if (!name) { - return; // Exit if cancelled. - } - } while (!this.isStandardCategoryName(name)); - - // Load category. - this.loadCategoryByName(name); -}; - -/** - * Loads a Standard Category by name and switches to it. Leverages - * StandardCategories. Returns if cannot load standard category. - * @param {string} name Name of the standard category to load. - */ -WorkspaceFactoryController.prototype.loadCategoryByName = function(name) { - // Check if the user can load that standard category. - if (!this.isStandardCategoryName(name)) { - return; - } - if (this.model.hasVariables() && name.toLowerCase() == 'variables') { - alert('A Variables category already exists. You cannot create multiple' + - ' variables categories.'); - return; - } - if (this.model.hasProcedures() && name.toLowerCase() == 'functions') { - alert('A Functions category already exists. You cannot create multiple' + - ' functions categories.'); - return; - } - // Check if the user can create a category with that name. - var standardCategory = StandardCategories.categoryMap[name.toLowerCase()] - if (this.model.hasCategoryByName(standardCategory.name)) { - alert('You already have a category with the name ' + standardCategory.name - + '. Rename your category and try again.'); - return; - } - if (!standardCategory.color && standardCategory.hue !== undefined) { - // Calculate the hex colour based on the hue. - standardCategory.color = Blockly.hueToHex(standardCategory.hue); - } - // Transfers current flyout blocks to a category if it's the first category - // created. - this.transferFlyoutBlocksToCategory(); - - var isFirstCategory = !this.model.hasElements(); - // Copy the standard category in the model. - var copy = standardCategory.copy(); - - // Add it to the model. - this.model.addElementToList(copy); - - // Update the copy in the view. - var tab = this.view.addCategoryRow(copy.name, copy.id); - this.addClickToSwitch(tab, copy.id); - // Color the category tab in the view. - if (copy.color) { - this.view.setBorderColor(copy.id, copy.color); - } - // Switch to loaded category. - this.switchElement(copy.id); - // Convert actual shadow blocks to user-generated shadow blocks. - this.convertShadowBlocks(); - // Save state from workspace before updating preview. - this.saveStateFromWorkspace(); - if (isFirstCategory) { - // Allow the user to use the default options for injecting the workspace - // when there are categories. - this.view.setCategoryOptions(this.model.hasElements()); - this.generateNewOptions(); - } - // Update preview. - this.updatePreview(); -}; - -/** - * Loads the standard Blockly toolbox into the editing space. Should only - * be called when the mode is set to toolbox. - */ -WorkspaceFactoryController.prototype.loadStandardToolbox = function() { - this.loadCategoryByName('Logic'); - this.loadCategoryByName('Loops'); - this.loadCategoryByName('Math'); - this.loadCategoryByName('Text'); - this.loadCategoryByName('Lists'); - this.loadCategoryByName('Colour'); - this.addSeparator(); - this.loadCategoryByName('Variables'); - this.loadCategoryByName('Functions'); -}; - -/** - * Given the name of a category, determines if it's the name of a standard - * category (case insensitive). - * @param {string} name The name of the category that should be checked if it's - * in StandardCategories categoryMap - * @return {boolean} True if name is a standard category name, false otherwise. - */ -WorkspaceFactoryController.prototype.isStandardCategoryName = function(name) { - return !!StandardCategories.categoryMap[name.toLowerCase()]; -}; - -/** - * Connected to the "add separator" dropdown option. If categories already - * exist, adds a separator to the model and view. Does not switch to select - * the separator, and updates the preview. - */ -WorkspaceFactoryController.prototype.addSeparator = function() { - // If adding the first element in the toolbox, transfers the user's blocks - // in a flyout to a category. - this.transferFlyoutBlocksToCategory(); - // Create the separator in the model. - var separator = new ListElement(ListElement.TYPE_SEPARATOR); - this.model.addElementToList(separator); - // Create the separator in the view. - var tab = this.view.addSeparatorTab(separator.id); - this.addClickToSwitch(tab, separator.id); - // Switch to the separator and update the preview. - this.switchElement(separator.id); - this.updatePreview(); -}; - -/** - * Connected to the import button. Given the file path inputted by the user - * from file input, if the import mode is for the toolbox, this function loads - * that toolbox XML to the workspace, creating category and separator tabs as - * necessary. If the import mode is for pre-loaded blocks in the workspace, - * this function loads that XML to the workspace to be edited further. This - * function switches mode to whatever the import mode is. Catches errors from - * file reading and prints an error message alerting the user. - * @param {string} file The path for the file to be imported into the workspace. - * Should contain valid toolbox XML. - * @param {string} importMode The mode corresponding to the type of file the - * user is importing (WorkspaceFactoryController.MODE_TOOLBOX or - * WorkspaceFactoryController.MODE_PRELOAD). - */ -WorkspaceFactoryController.prototype.importFile = function(file, importMode) { - // Exit if cancelled. - if (!file) { - return; - } - - Blockly.Events.disable(); - var controller = this; - var reader = new FileReader(); - - // To be executed when the reader has read the file. - reader.onload = function() { - // Try to parse XML from file and load it into toolbox editing area. - // Print error message if fail. - try { - var tree = Blockly.Xml.textToDom(reader.result); - if (importMode == WorkspaceFactoryController.MODE_TOOLBOX) { - // Switch mode. - controller.setMode(WorkspaceFactoryController.MODE_TOOLBOX); - - // Confirm that the user wants to override their current toolbox. - var hasToolboxElements = controller.model.hasElements() || - controller.toolboxWorkspace.getAllBlocks(false).length > 0; - if (hasToolboxElements) { - var msg = 'Are you sure you want to import? You will lose your ' + - 'current toolbox.'; - BlocklyDevTools.Analytics.onWarning(msg); - var continueAnyway = confirm(); - if (!continueAnyway) { - return; - } - } - // Import toolbox XML. - controller.importToolboxFromTree_(tree); - BlocklyDevTools.Analytics.onImport('Toolbox.xml'); - - } else if (importMode == WorkspaceFactoryController.MODE_PRELOAD) { - // Switch mode. - controller.setMode(WorkspaceFactoryController.MODE_PRELOAD); - - // Confirm that the user wants to override their current blocks. - if (controller.toolboxWorkspace.getAllBlocks(false).length > 0) { - var msg = 'Are you sure you want to import? You will lose your ' + - 'current workspace blocks.'; - var continueAnyway = confirm(msg); - BlocklyDevTools.Analytics.onWarning(msg); - if (!continueAnyway) { - return; - } - } - - // Import pre-loaded workspace XML. - controller.importPreloadFromTree_(tree); - BlocklyDevTools.Analytics.onImport('WorkspaceContents.xml'); - } else { - // Throw error if invalid mode. - throw Error('Unknown import mode: ' + importMode); - } - } catch(e) { - var msg = 'Cannot load XML from file.'; - alert(msg); - BlocklyDevTools.Analytics.onError(msg); - console.log(e); - } finally { - Blockly.Events.enable(); - } - } - - // Read the file asynchronously. - reader.readAsText(file); -}; - -/** - * Given a XML DOM tree, loads it into the toolbox editing area so that the - * user can continue editing their work. Assumes that tree is in valid toolbox - * XML format. Assumes that the mode is MODE_TOOLBOX. - * @param {!Element} tree XML tree to be loaded to toolbox editing area. - * @private - */ -WorkspaceFactoryController.prototype.importToolboxFromTree_ = function(tree) { - // Clear current editing area. - this.model.clearToolboxList(); - this.view.clearToolboxTabs(); - - if (tree.getElementsByTagName('category').length == 0) { - // No categories present. - // Load all the blocks into a single category evenly spaced. - Blockly.Xml.domToWorkspace(tree, this.toolboxWorkspace); - this.toolboxWorkspace.cleanUp(); - - // Convert actual shadow blocks to user-generated shadow blocks. - this.convertShadowBlocks(); - - // Add message to denote empty category. - this.view.addEmptyCategoryMessage(); - - } else { - // Categories/separators present. - for (var i = 0, item; item = tree.children[i]; i++) { - - if (item.tagName == 'category') { - // If the element is a category, create a new category and switch to it. - this.createCategory(item.getAttribute('name'), false); - var category = this.model.getElementByIndex(i); - this.switchElement(category.id); - - // Load all blocks in that category to the workspace to be evenly - // spaced and saved to that category. - for (var j = 0, blockXml; blockXml = item.children[j]; j++) { - Blockly.Xml.domToBlock(blockXml, this.toolboxWorkspace); - } - - // Evenly space the blocks. - this.toolboxWorkspace.cleanUp(); - - // Convert actual shadow blocks to user-generated shadow blocks. - this.convertShadowBlocks(); - - // Set category color. - if (item.getAttribute('colour')) { - category.changeColor(item.getAttribute('colour')); - this.view.setBorderColor(category.id, category.color); - } - // Set any custom tags. - if (item.getAttribute('custom')) { - this.model.addCustomTag(category, item.getAttribute('custom')); - } - } else { - // If the element is a separator, add the separator and switch to it. - this.addSeparator(); - this.switchElement(this.model.getElementByIndex(i).id); - } - } - } - this.view.updateState(this.model.getIndexByElementId - (this.model.getSelectedId()), this.model.getSelected()); - - this.saveStateFromWorkspace(); - - // Set default configuration options for a single flyout or multiple - // categories. - this.view.setCategoryOptions(this.model.hasElements()); - this.generateNewOptions(); - - this.updatePreview(); -}; - -/** - * Given a XML DOM tree, loads it into the pre-loaded workspace editing area. - * Assumes that tree is in valid XML format and that the selected mode is - * MODE_PRELOAD. - * @param {!Element} tree XML tree to be loaded to pre-loaded block editing - * area. - */ -WorkspaceFactoryController.prototype.importPreloadFromTree_ = function(tree) { - this.clearAndLoadXml_(tree); - this.model.savePreloadXml(tree); - this.updatePreview(); -}; - -/** - * Given a XML DOM tree, loads it into the pre-loaded workspace editing area. - * Assumes that tree is in valid XML format and that the selected mode is - * MODE_PRELOAD. - * @param {!Element} tree XML tree to be loaded to pre-loaded block editing - * area. - */ -WorkspaceFactoryController.prototype.importPreloadFromTree_ = function(tree) { - this.clearAndLoadXml_(tree); - this.model.savePreloadXml(tree); - this.saveStateFromWorkspace(); - this.updatePreview(); -}; - -/** - * Given a XML DOM tree, loads it into the pre-loaded workspace editing area. - * Assumes that tree is in valid XML format and that the selected mode is - * MODE_PRELOAD. - * @param {!Element} tree XML tree to be loaded to pre-loaded block editing - * area. - */ -WorkspaceFactoryController.prototype.importPreloadFromTree_ = function(tree) { - this.clearAndLoadXml_(tree); - this.model.savePreloadXml(tree); - this.saveStateFromWorkspace(); - this.updatePreview(); -}; - -/** - * Clears the editing area completely, deleting all categories and all - * blocks in the model and view and all pre-loaded blocks. Tied to the - * "Clear" button. - */ -WorkspaceFactoryController.prototype.clearAll = function() { - var msg = 'Are you sure you want to clear all of your work in Workspace' + - ' Factory?'; - BlocklyDevTools.Analytics.onWarning(msg); - if (!confirm(msg)) { - return; - } - var hasCategories = this.model.hasElements(); - this.model.clearToolboxList(); - this.view.clearToolboxTabs(); - this.model.savePreloadXml(Blockly.utils.xml.createElement('xml')); - this.view.addEmptyCategoryMessage(); - this.view.updateState(-1, null); - this.toolboxWorkspace.clear(); - this.toolboxWorkspace.clearUndo(); - this.saveStateFromWorkspace(); - this.hasUnsavedToolboxChanges = false; - this.hasUnsavedPreloadChanges = false; - this.view.setCategoryOptions(this.model.hasElements()); - this.generateNewOptions(); - this.updatePreview(); -}; - -/* - * Makes the currently selected block a user-generated shadow block. These - * blocks are not made into real shadow blocks, but recorded in the model - * and visually marked as shadow blocks, allowing the user to move and edit - * them (which would be impossible with actual shadow blocks). Updates the - * preview when done. - */ -WorkspaceFactoryController.prototype.addShadow = function() { - // No block selected to make a shadow block. - if (!Blockly.selected) { - return; - } - // Clear any previous warnings on the block (would only have warnings on - // a non-shadow block if it was nested inside another shadow block). - Blockly.selected.setWarningText(null); - // Set selected block and all children as shadow blocks. - this.addShadowForBlockAndChildren_(Blockly.selected); - - // Save and update the preview. - this.saveStateFromWorkspace(); - this.updatePreview(); -}; - -/** - * Sets a block and all of its children to be user-generated shadow blocks, - * both in the model and view. - * @param {!Blockly.Block} block The block to be converted to a user-generated - * shadow block. - * @private - */ -WorkspaceFactoryController.prototype.addShadowForBlockAndChildren_ = - function(block) { - // Convert to shadow block. - this.view.markShadowBlock(block); - this.model.addShadowBlock(block.id); - - if (FactoryUtils.hasVariableField(block)) { - block.setWarningText('Cannot make variable blocks shadow blocks.'); - } - - // Convert all children to shadow blocks recursively. - var children = block.getChildren(); - for (var i = 0; i < children.length; i++) { - this.addShadowForBlockAndChildren_(children[i]); - } -}; - -/** - * If the currently selected block is a user-generated shadow block, this - * function makes it a normal block again, removing it from the list of - * shadow blocks and loading the workspace again. Updates the preview again. - */ -WorkspaceFactoryController.prototype.removeShadow = function() { - // No block selected to modify. - if (!Blockly.selected) { - return; - } - this.model.removeShadowBlock(Blockly.selected.id); - this.view.unmarkShadowBlock(Blockly.selected); - - // If turning invalid shadow block back to normal block, remove warning. - Blockly.selected.setWarningText(null); - - this.saveStateFromWorkspace(); - this.updatePreview(); -}; - -/** - * Given a unique block ID, uses the model to determine if a block is a - * user-generated shadow block. - * @param {string} blockId The unique ID of the block to examine. - * @return {boolean} True if the block is a user-generated shadow block, false - * otherwise. - */ -WorkspaceFactoryController.prototype.isUserGenShadowBlock = function(blockId) { - return this.model.isShadowBlock(blockId); -}; - -/** - * Call when importing XML containing real shadow blocks. This function turns - * all real shadow blocks loaded in the workspace into user-generated shadow - * blocks, meaning they are marked as shadow blocks by the model and appear as - * shadow blocks in the view but are still editable and movable. - */ -WorkspaceFactoryController.prototype.convertShadowBlocks = function() { - var blocks = this.toolboxWorkspace.getAllBlocks(false); - for (var i = 0, block; block = blocks[i]; i++) { - if (block.isShadow()) { - block.setShadow(false); - // Delete the shadow DOM attached to the block so that the shadow block - // does not respawn. Dependent on implementation details. - var parentConnection = block.outputConnection ? - block.outputConnection.targetConnection : - block.previousConnection.targetConnection; - if (parentConnection) { - parentConnection.setShadowDom(null); - } - this.model.addShadowBlock(block.id); - this.view.markShadowBlock(block); - } - } -}; - -/** - * Sets the currently selected mode that determines what the toolbox workspace - * is being used to edit. Updates the view and then saves and loads XML - * to and from the toolbox and updates the help text. - * @param {string} tab The type of tab being switched to - * (WorkspaceFactoryController.MODE_TOOLBOX or - * WorkspaceFactoryController.MODE_PRELOAD). - */ -WorkspaceFactoryController.prototype.setMode = function(mode) { - // No work to change mode that's currently set. - if (this.selectedMode == mode) { - return; - } - - // No work to change mode that's currently set. - if (this.selectedMode == mode) { - return; - } - - // Set tab selection and display appropriate tab. - this.view.setModeSelection(mode); - - // Update selected tab. - this.selectedMode = mode; - - // Update help text above workspace. - this.view.updateHelpText(mode); - - if (mode == WorkspaceFactoryController.MODE_TOOLBOX) { - // Open the toolbox editing space. - this.model.savePreloadXml - (Blockly.Xml.workspaceToDom(this.toolboxWorkspace)); - this.clearAndLoadXml_(this.model.getSelectedXml()); - this.view.disableWorkspace(this.view.shouldDisableWorkspace - (this.model.getSelected())); - } else { - // Open the pre-loaded workspace editing space. - if (this.model.getSelected()) { - this.model.getSelected().saveFromWorkspace(this.toolboxWorkspace); - } - this.clearAndLoadXml_(this.model.getPreloadXml()); - this.view.disableWorkspace(false); - } -}; - -/** - * Clears the toolbox workspace and loads XML to it, marking shadow blocks - * as necessary. - * @private - * @param {!Element} xml The XML to be loaded to the workspace. - */ -WorkspaceFactoryController.prototype.clearAndLoadXml_ = function(xml) { - this.toolboxWorkspace.clear(); - this.toolboxWorkspace.clearUndo(); - Blockly.Xml.domToWorkspace(xml, this.toolboxWorkspace); - this.view.markShadowBlocks(this.model.getShadowBlocksInWorkspace - (this.toolboxWorkspace.getAllBlocks(false))); - this.warnForUndefinedBlocks_(); -}; - -/** - * Sets the standard default options for the options object and updates - * the preview workspace. The default values depends on if categories are - * present. - */ -WorkspaceFactoryController.prototype.setStandardOptionsAndUpdate = function() { - this.view.setBaseOptions(); - this.view.setCategoryOptions(this.model.hasElements()); - this.generateNewOptions(); -}; - -/** - * Generates a new options object for injecting a Blockly workspace based - * on user input. Should be called every time a change has been made to - * an input field. Updates the model and reinjects the preview workspace. - */ -WorkspaceFactoryController.prototype.generateNewOptions = function() { - this.model.setOptions(this.readOptions_()); - - this.reinjectPreview(Blockly.Options.parseToolboxTree( - this.generator.generateToolboxXml())); -}; - -/** - * Generates a new options object for injecting a Blockly workspace based on - * user input. - * @return {!Object} Blockly injection options object. - * @private - */ -WorkspaceFactoryController.prototype.readOptions_ = function() { - var optionsObj = Object.create(null); - - // Add all standard options to the options object. - // Use parse int to get numbers from value inputs. - var readonly = document.getElementById('option_readOnly_checkbox').checked; - if (readonly) { - optionsObj['readOnly'] = true; - } else { - optionsObj['collapse'] = - document.getElementById('option_collapse_checkbox').checked; - optionsObj['comments'] = - document.getElementById('option_comments_checkbox').checked; - optionsObj['disable'] = - document.getElementById('option_disable_checkbox').checked; - if (document.getElementById('option_infiniteBlocks_checkbox').checked) { - optionsObj['maxBlocks'] = Infinity; - } else { - var maxBlocksValue = - document.getElementById('option_maxBlocks_number').value; - optionsObj['maxBlocks'] = typeof maxBlocksValue == 'string' ? - parseInt(maxBlocksValue) : maxBlocksValue; - } - optionsObj['trashcan'] = - document.getElementById('option_trashcan_checkbox').checked; - optionsObj['horizontalLayout'] = - document.getElementById('option_horizontalLayout_checkbox').checked; - optionsObj['toolboxPosition'] = - document.getElementById('option_toolboxPosition_checkbox').checked ? - 'end' : 'start'; - } - - optionsObj['css'] = document.getElementById('option_css_checkbox').checked; - optionsObj['media'] = document.getElementById('option_media_text').value; - optionsObj['rtl'] = document.getElementById('option_rtl_checkbox').checked; - optionsObj['scrollbars'] = - document.getElementById('option_scrollbars_checkbox').checked; - optionsObj['sounds'] = - document.getElementById('option_sounds_checkbox').checked; - optionsObj['oneBasedIndex'] = - document.getElementById('option_oneBasedIndex_checkbox').checked; - - // If using a grid, add all grid options. - if (document.getElementById('option_grid_checkbox').checked) { - var grid = Object.create(null); - var spacingValue = - document.getElementById('gridOption_spacing_number').value; - grid['spacing'] = typeof spacingValue == 'string' ? - parseInt(spacingValue) : spacingValue; - var lengthValue = document.getElementById('gridOption_length_number').value; - grid['length'] = typeof lengthValue == 'string' ? - parseInt(lengthValue) : lengthValue; - grid['colour'] = document.getElementById('gridOption_colour_text').value; - if (!readonly) { - grid['snap'] = - document.getElementById('gridOption_snap_checkbox').checked; - } - optionsObj['grid'] = grid; - } - - // If using zoom, add all zoom options. - if (document.getElementById('option_zoom_checkbox').checked) { - var zoom = Object.create(null); - zoom['controls'] = - document.getElementById('zoomOption_controls_checkbox').checked; - zoom['wheel'] = - document.getElementById('zoomOption_wheel_checkbox').checked; - var startScaleValue = - document.getElementById('zoomOption_startScale_number').value; - zoom['startScale'] = typeof startScaleValue == 'string' ? - Number(startScaleValue) : startScaleValue; - var maxScaleValue = - document.getElementById('zoomOption_maxScale_number').value; - zoom['maxScale'] = typeof maxScaleValue == 'string' ? - Number(maxScaleValue) : maxScaleValue; - var minScaleValue = - document.getElementById('zoomOption_minScale_number').value; - zoom['minScale'] = typeof minScaleValue == 'string' ? - Number(minScaleValue) : minScaleValue; - var scaleSpeedValue = - document.getElementById('zoomOption_scaleSpeed_number').value; - zoom['scaleSpeed'] = typeof scaleSpeedValue == 'string' ? - Number(scaleSpeedValue) : scaleSpeedValue; - optionsObj['zoom'] = zoom; - } - - return optionsObj; -}; - -/** - * Imports blocks from a file, generating a category in the toolbox workspace - * to allow the user to use imported blocks in the toolbox and in pre-loaded - * blocks. - * @param {!File} file File object for the blocks to import. - * @param {string} format The format of the file to import, either 'JSON' or - * 'JavaScript'. - */ -WorkspaceFactoryController.prototype.importBlocks = function(file, format) { - // Generate category name from file name. - var categoryName = file.name; - - var controller = this; - var reader = new FileReader(); - - // To be executed when the reader has read the file. - reader.onload = function() { - try { - // Define blocks using block types from file. - var blockTypes = FactoryUtils.defineAndGetBlockTypes(reader.result, - format); - - // If an imported block type is already defined, check if the user wants - // to override the current block definition. - if (controller.model.hasDefinedBlockTypes(blockTypes)) { - var msg = 'An imported block uses the same name as a block ' - + 'already in your toolbox. Are you sure you want to override the ' - + 'currently defined block?'; - var continueAnyway = confirm(msg); - BlocklyDevTools.Analytics.onWarning(msg); - if (!continueAnyway) { - return; - } - } - - var blocks = controller.generator.getDefinedBlocks(blockTypes); - // Generate category XML and append to toolbox. - var categoryXml = FactoryUtils.generateCategoryXml(blocks, categoryName); - // Get random color for category between 0 and 360. Gives each imported - // category a different color. - var randomColor = Math.floor(Math.random() * 360); - categoryXml.setAttribute('colour', randomColor); - controller.toolbox.appendChild(categoryXml); - controller.toolboxWorkspace.updateToolbox(controller.toolbox); - // Update imported block types. - controller.model.addImportedBlockTypes(blockTypes); - // Reload current category to possibly reflect any newly defined blocks. - controller.clearAndLoadXml_ - (Blockly.Xml.workspaceToDom(controller.toolboxWorkspace)); - - BlocklyDevTools.Analytics.onImport('BlockDefinitions' + - (format == 'JSON' ? '.json' : '.js')); - } catch (e) { - msg = 'Cannot read blocks from file.'; - alert(msg); - BlocklyDevTools.Analytics.onError(msg); - window.console.log(e); - } - } - - // Read the file asynchronously. - reader.readAsText(file); -}; - -/* - * Updates the block library category in the toolbox workspace toolbox. - * @param {!Element} categoryXml XML for the block library category. - * @param {!Array.<string>} libBlockTypes Array of block types from the block - * library. - */ -WorkspaceFactoryController.prototype.setBlockLibCategory = - function(categoryXml, libBlockTypes) { - var blockLibCategory = document.getElementById('blockLibCategory'); - - // Set category ID so that it can be easily replaced, and set a standard, - // arbitrary block library color. - categoryXml.id = 'blockLibCategory'; - categoryXml.setAttribute('colour', 260); - - // Update the toolbox and toolboxWorkspace. - this.toolbox.replaceChild(categoryXml, blockLibCategory); - this.toolboxWorkspace.toolbox_.clearSelection(); - this.toolboxWorkspace.updateToolbox(this.toolbox); - - // Update the block library types. - this.model.updateLibBlockTypes(libBlockTypes); - - // Reload XML on page to account for blocks now defined or undefined in block - // library. - this.clearAndLoadXml_(Blockly.Xml.workspaceToDom(this.toolboxWorkspace)); -}; - -/** - * Return the block types used in the custom toolbox and pre-loaded workspace. - * @return {!Array.<string>} Block types used in the custom toolbox and - * pre-loaded workspace. - */ -WorkspaceFactoryController.prototype.getAllUsedBlockTypes = function() { - return this.model.getAllUsedBlockTypes(); -}; - -/** - * Determines if a block loaded in the workspace has a definition (if it - * is a standard block, is defined in the block library, or has a definition - * imported). - * @param {!Blockly.Block} block The block to examine. - */ -WorkspaceFactoryController.prototype.isDefinedBlock = function(block) { - return this.model.isDefinedBlockType(block.type); -}; - -/** - * Sets a warning on blocks loaded to the workspace that are not defined. - * @private - */ -WorkspaceFactoryController.prototype.warnForUndefinedBlocks_ = function() { - var blocks = this.toolboxWorkspace.getAllBlocks(false); - for (var i = 0, block; block = blocks[i]; i++) { - if (!this.isDefinedBlock(block)) { - block.setWarningText(block.type + ' is not defined (it is not a ' + - 'standard block,\nin your block library, or an imported block)'); - } - } -}; - -/* - * Determines if a standard variable category is in the custom toolbox. - * @return {boolean} True if a variables category is in use, false otherwise. - */ -WorkspaceFactoryController.prototype.hasVariablesCategory = function() { - return this.model.hasVariables(); -}; - -/** - * Determines if a standard procedures category is in the custom toolbox. - * @return {boolean} True if a procedures category is in use, false otherwise. - */ -WorkspaceFactoryController.prototype.hasProceduresCategory = function() { - return this.model.hasProcedures(); -}; - -/** - * Determines if there are any unsaved changes in workspace factory. - * @return {boolean} True if there are unsaved changes, false otherwise. - */ -WorkspaceFactoryController.prototype.hasUnsavedChanges = function() { - return this.hasUnsavedToolboxChanges || this.hasUnsavedPreloadChanges; -}; diff --git a/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_generator.js b/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_generator.js deleted file mode 100644 index a58c565c03d4c0bfa0677618cfb1b1546ee87308..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_generator.js +++ /dev/null @@ -1,237 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Generates the configuration XML used to update the preview - * workspace or print to the console or download to a file. Leverages - * Blockly.Xml and depends on information in the model (holds a reference). - * Depends on a hidden workspace created in the generator to load saved XML in - * order to generate toolbox XML. - * - * @author Emma Dauterman (evd2014) - */ - - -/** - * Class for a WorkspaceFactoryGenerator - * @constructor - */ -WorkspaceFactoryGenerator = function(model) { - // Model to share information about categories and shadow blocks. - this.model = model; - // Create hidden workspace to load saved XML to generate toolbox XML. - var hiddenBlocks = document.createElement('div'); - // Generate a globally unique ID for the hidden div element to avoid - // collisions. - var hiddenBlocksId = Blockly.utils.genUid(); - hiddenBlocks.id = hiddenBlocksId; - hiddenBlocks.style.display = 'none'; - document.body.appendChild(hiddenBlocks); - this.hiddenWorkspace = Blockly.inject(hiddenBlocksId); -}; - -/** - * Generates the XML for the toolbox or flyout with information from - * toolboxWorkspace and the model. Uses the hiddenWorkspace to generate XML. - * Save state of workspace in model (saveFromWorkspace) before calling if - * changes might have been made to the selected category. - * @param {!Blockly.workspace} toolboxWorkspace Toolbox editing workspace where - * blocks are added by user to be part of the toolbox. - * @return {!Element} XML element representing toolbox or flyout corresponding - * to toolbox workspace. - */ -WorkspaceFactoryGenerator.prototype.generateToolboxXml = function() { - // Create DOM for XML. - var xmlDom = Blockly.utils.xml.createElement('xml'); - xmlDom.id = 'toolbox'; - xmlDom.setAttribute('style', 'display: none'); - - if (!this.model.hasElements()) { - // Toolbox has no categories. Use XML directly from workspace. - this.loadToHiddenWorkspace_(this.model.getSelectedXml()); - this.appendHiddenWorkspaceToDom_(xmlDom); - } else { - // Toolbox has categories. - // Assert that selected != null - if (!this.model.getSelected()) { - throw Error('Selected is null when the toolbox is empty.'); - } - - var xml = this.model.getSelectedXml(); - var toolboxList = this.model.getToolboxList(); - - // Iterate through each category to generate XML for each using the - // hidden workspace. Load each category to the hidden workspace to make sure - // that all the blocks that are not top blocks are also captured as block - // groups in the flyout. - for (var i = 0; i < toolboxList.length; i++) { - var element = toolboxList[i]; - if (element.type == ListElement.TYPE_SEPARATOR) { - // If the next element is a separator. - var nextElement = Blockly.utils.xml.createElement('sep'); - } else if (element.type == ListElement.TYPE_CATEGORY) { - // If the next element is a category. - var nextElement = Blockly.utils.xml.createElement('category'); - nextElement.setAttribute('name', element.name); - // Add a colour attribute if one exists. - if (element.color != null) { - nextElement.setAttribute('colour', element.color); - } - // Add a custom attribute if one exists. - if (element.custom != null) { - nextElement.setAttribute('custom', element.custom); - } - // Load that category to hidden workspace, setting user-generated shadow - // blocks as real shadow blocks. - this.loadToHiddenWorkspace_(element.xml); - this.appendHiddenWorkspaceToDom_(nextElement); - } - xmlDom.appendChild(nextElement); - } - } - return xmlDom; - }; - - - /** - * Generates XML for the workspace (different from generateConfigXml in that - * it includes XY and ID attributes). Uses a workspace and converts user - * generated shadow blocks to actual shadow blocks. - * @return {!Element} XML element representing toolbox or flyout corresponding - * to toolbox workspace. - */ -WorkspaceFactoryGenerator.prototype.generateWorkspaceXml = function() { - // Load workspace XML to hidden workspace with user-generated shadow blocks - // as actual shadow blocks. - this.hiddenWorkspace.clear(); - Blockly.Xml.domToWorkspace(this.model.getPreloadXml(), this.hiddenWorkspace); - this.setShadowBlocksInHiddenWorkspace_(); - - // Generate XML and set attributes. - var xmlDom = Blockly.Xml.workspaceToDom(this.hiddenWorkspace); - xmlDom.id = 'workspaceBlocks'; - xmlDom.setAttribute('style', 'display: none'); - return xmlDom; -}; - -/** - * Generates a string representation of the options object for injecting the - * workspace and starter code. - * @return {string} String representation of starter code for injecting. - */ -WorkspaceFactoryGenerator.prototype.generateInjectString = function() { - var addAttributes = function(obj, tabChar) { - if (!obj) { - return '{}\n'; - } - var str = ''; - for (var key in obj) { - if (key == 'grid' || key == 'zoom') { - var temp = tabChar + key + ' : {\n' + addAttributes(obj[key], - tabChar + '\t') + tabChar + '}, \n'; - } else if (typeof obj[key] == 'string') { - var temp = tabChar + key + ' : \'' + obj[key] + '\', \n'; - } else { - var temp = tabChar + key + ' : ' + obj[key] + ', \n'; - } - str += temp; - } - var lastCommaIndex = str.lastIndexOf(','); - str = str.slice(0, lastCommaIndex) + '\n'; - return str; - }; - - var attributes = addAttributes(this.model.options, '\t'); - if (!this.model.options['readOnly']) { - attributes = '\ttoolbox : toolbox, \n' + - attributes; - } - var finalStr = '/* TODO: Change toolbox XML ID if necessary. Can export ' + - 'toolbox XML from Workspace Factory. */\n' + - 'var toolbox = document.getElementById("toolbox");\n\n'; - finalStr += 'var options = { \n' + attributes + '};'; - finalStr += '\n\n/* Inject your workspace */ \nvar workspace = Blockly.' + - 'inject(/* TODO: Add ID of div to inject Blockly into */, options);'; - finalStr += '\n\n/* Load Workspace Blocks from XML to workspace. ' + - 'Remove all code below if no blocks to load */\n\n' + - '/* TODO: Change workspace blocks XML ID if necessary. Can export' + - ' workspace blocks XML from Workspace Factory. */\n' + - 'var workspaceBlocks = document.getElementById("workspaceBlocks"); \n\n' + - '/* Load blocks to workspace. */\n' + - 'Blockly.Xml.domToWorkspace(workspaceBlocks, workspace);'; - return finalStr; -}; - -/** - * Loads the given XML to the hidden workspace and sets any user-generated - * shadow blocks to be actual shadow blocks. - * @param {!Element} xml The XML to be loaded to the hidden workspace. - * @private - */ -WorkspaceFactoryGenerator.prototype.loadToHiddenWorkspace_ = function(xml) { - this.hiddenWorkspace.clear(); - Blockly.Xml.domToWorkspace(xml, this.hiddenWorkspace); - this.setShadowBlocksInHiddenWorkspace_(); -}; - -/** - * Encodes blocks in the hidden workspace in a XML DOM element. Very - * similar to workspaceToDom, but doesn't capture IDs. Uses the top-level - * blocks loaded in hiddenWorkspace. - * @private - * @param {!Element} xmlDom Tree of XML elements to be appended to. - */ -WorkspaceFactoryGenerator.prototype.appendHiddenWorkspaceToDom_ = - function(xmlDom) { - var blocks = this.hiddenWorkspace.getTopBlocks(); - for (var i = 0, block; block = blocks[i]; i++) { - var blockChild = Blockly.Xml.blockToDom(block, /* opt_noId */ true); - xmlDom.appendChild(blockChild); - } -}; - -/** - * Sets the user-generated shadow blocks loaded into hiddenWorkspace to be - * actual shadow blocks. This is done so that blockToDom records them as - * shadow blocks instead of regular blocks. - * @private - */ -WorkspaceFactoryGenerator.prototype.setShadowBlocksInHiddenWorkspace_ = - function() { - var blocks = this.hiddenWorkspace.getAllBlocks(false); - for (var i = 0; i < blocks.length; i++) { - if (this.model.isShadowBlock(blocks[i].id)) { - blocks[i].setShadow(true); - } - } -}; - -/** - * Given a set of block types, gets the Blockly.Block objects for each block - * type. - * @param {!Array.<!Element>} blockTypes Array of blocks that have been defined. - * @return {!Array.<!Blockly.Block>} Array of Blockly.Block objects corresponding - * to the array of blockTypes. - */ -WorkspaceFactoryGenerator.prototype.getDefinedBlocks = function(blockTypes) { - var blocks = []; - for (var i = 0; i < blockTypes.length ; i++) { - blocks.push(FactoryUtils.getDefinedBlock(blockTypes[i], - this.hiddenWorkspace)); - } - return blocks; -}; diff --git a/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_init.js b/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_init.js deleted file mode 100644 index f99e85649a5aa409546fae486c140fdac2fac082..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_init.js +++ /dev/null @@ -1,554 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Contains the init functions for the workspace factory tab. - * Adds click handlers to buttons and dropdowns, adds event listeners for - * keydown events and Blockly events, and configures the initial setup of - * the page. - * - * @author Emma Dauterman (evd2014) - */ - -/** - * Namespace for workspace factory initialization methods. - * @namespace - */ -WorkspaceFactoryInit = {}; - -/** - * Initialization for workspace factory tab. - * @param {!FactoryController} controller The controller for the workspace - * factory tab. - */ -WorkspaceFactoryInit.initWorkspaceFactory = function(controller) { - // Disable category editing buttons until categories are created. - document.getElementById('button_remove').disabled = true; - document.getElementById('button_up').disabled = true; - document.getElementById('button_down').disabled = true; - document.getElementById('button_editCategory').disabled = true; - - this.initColourPicker_(controller); - this.addWorkspaceFactoryEventListeners_(controller); - this.assignWorkspaceFactoryClickHandlers_(controller); - this.addWorkspaceFactoryOptionsListeners_(controller); - - // Check standard options and apply the changes to update the view. - controller.setStandardOptionsAndUpdate(); -}; - -/** - * Initialize the colour picker in workspace factory. - * @param {!FactoryController} controller The controller for the workspace - * factory tab. - * @private - */ -WorkspaceFactoryInit.initColourPicker_ = function(controller) { - // Array of Blockly category colours, consistent with the colour defaults. - var colours = [20, 65, 120, 160, 210, 230, 260, 290, 330, '']; - // Convert hue numbers to RRGGBB strings. - for (var i = 0; i < colours.length; i++) { - if (colours[i] !== '') { - colours[i] = Blockly.hueToHex(colours[i]).substring(1); - } - } - // Convert to 2D array. - var maxCols = Math.ceil(Math.sqrt(colours.length)); - var grid = []; - var row = []; - for (var i = 0; i < colours.length; i++) { - row.push(colours[i]); - if (row.length == maxCols) { - grid.push(row); - row = []; - } - } - if (row.length) { - grid.push(row); - } - - // Override the default colours. - cp_grid = grid; -}; - -/** - * Assign click handlers for workspace factory. - * @param {!FactoryController} controller The controller for the workspace - * factory tab. - * @private - */ -WorkspaceFactoryInit.assignWorkspaceFactoryClickHandlers_ = - function(controller) { - - // Import Custom Blocks button. - document.getElementById('button_importBlocks').addEventListener - ('click', - function() { - blocklyFactory.openModal('dropdownDiv_importBlocks'); - }); - document.getElementById('input_importBlocksJson').addEventListener - ('change', - function() { - controller.importBlocks(event.target.files[0], 'JSON'); - }); - document.getElementById('input_importBlocksJson').addEventListener - ('click', function() {blocklyFactory.closeModal()}); - document.getElementById('input_importBlocksJs').addEventListener - ('change', - function() { - controller.importBlocks(event.target.files[0], 'JavaScript'); - }); - document.getElementById('input_importBlocksJs').addEventListener - ('click', function() {blocklyFactory.closeModal()}); - - // Load to Edit button. - document.getElementById('button_load').addEventListener - ('click', - function() { - blocklyFactory.openModal('dropdownDiv_load'); - }); - document.getElementById('input_loadToolbox').addEventListener - ('change', - function() { - controller.importFile(event.target.files[0], - WorkspaceFactoryController.MODE_TOOLBOX); - }); - document.getElementById('input_loadToolbox').addEventListener - ('click', function() {blocklyFactory.closeModal()}); - document.getElementById('input_loadPreload').addEventListener - ('change', - function() { - controller.importFile(event.target.files[0], - WorkspaceFactoryController.MODE_PRELOAD); - }); - document.getElementById('input_loadPreload').addEventListener - ('click', function() {blocklyFactory.closeModal()}); - - // Export button. - document.getElementById('dropdown_exportOptions').addEventListener - ('click', - function() { - controller.exportInjectFile(); - blocklyFactory.closeModal(); - }); - document.getElementById('dropdown_exportToolbox').addEventListener - ('click', - function() { - controller.exportXmlFile(WorkspaceFactoryController.MODE_TOOLBOX); - blocklyFactory.closeModal(); - }); - document.getElementById('dropdown_exportPreload').addEventListener - ('click', - function() { - controller.exportXmlFile(WorkspaceFactoryController.MODE_PRELOAD); - blocklyFactory.closeModal(); - }); - document.getElementById('dropdown_exportAll').addEventListener - ('click', - function() { - controller.exportInjectFile(); - controller.exportXmlFile(WorkspaceFactoryController.MODE_TOOLBOX); - controller.exportXmlFile(WorkspaceFactoryController.MODE_PRELOAD); - blocklyFactory.closeModal(); - }); - document.getElementById('button_export').addEventListener - ('click', - function() { - blocklyFactory.openModal('dropdownDiv_export'); - }); - - // Clear button. - document.getElementById('button_clear').addEventListener - ('click', - function() { - controller.clearAll(); - }); - - // Toolbox and Workspace tabs. - document.getElementById('tab_toolbox').addEventListener - ('click', - function() { - controller.setMode(WorkspaceFactoryController.MODE_TOOLBOX); - }); - document.getElementById('tab_preload').addEventListener - ('click', - function() { - controller.setMode(WorkspaceFactoryController.MODE_PRELOAD); - }); - - // '+' button. - document.getElementById('button_add').addEventListener - ('click', - function() { - blocklyFactory.openModal('dropdownDiv_add'); - }); - document.getElementById('dropdown_newCategory').addEventListener - ('click', - function() { - controller.addCategory(); - blocklyFactory.closeModal(); - }); - document.getElementById('dropdown_loadCategory').addEventListener - ('click', - function() { - controller.loadCategory(); - blocklyFactory.closeModal(); - }); - document.getElementById('dropdown_separator').addEventListener - ('click', - function() { - controller.addSeparator(); - blocklyFactory.closeModal(); - }); - document.getElementById('dropdown_loadStandardToolbox').addEventListener - ('click', - function() { - controller.loadStandardToolbox(); - blocklyFactory.closeModal(); - }); - - // '-' button. - document.getElementById('button_remove').addEventListener - ('click', - function() { - controller.removeElement(); - }); - - // Up/Down buttons. - document.getElementById('button_up').addEventListener - ('click', - function() { - controller.moveElement(-1); - }); - document.getElementById('button_down').addEventListener - ('click', - function() { - controller.moveElement(1); - }); - - // Edit Category button. - document.getElementById('button_editCategory').addEventListener - ('click', - function() { - var selected = controller.model.getSelected(); - // Return if a category is not selected. - if (selected.type != ListElement.TYPE_CATEGORY) { - return; - } - document.getElementById('categoryName').value = selected.name; - document.getElementById('categoryColour').value = selected.color ? - selected.color.substring(1).toLowerCase() : ''; - console.log(document.getElementById('categoryColour').value); - // Link the colour picker to the field. - cp_init('categoryColour'); - blocklyFactory.openModal('dropdownDiv_editCategory'); - }); - - document.getElementById('categorySave').addEventListener - ('click', - function() { - var name = document.getElementById('categoryName').value.trim(); - var colour = document.getElementById('categoryColour').value; - colour = colour ? '#' + colour : null; - controller.changeSelectedCategory(name, colour); - blocklyFactory.closeModal(); - }); - - // Make/Remove Shadow buttons. - document.getElementById('button_addShadow').addEventListener - ('click', - function() { - controller.addShadow(); - WorkspaceFactoryInit.displayAddShadow_(false); - WorkspaceFactoryInit.displayRemoveShadow_(true); - }); - document.getElementById('button_removeShadow').addEventListener - ('click', - function() { - controller.removeShadow(); - WorkspaceFactoryInit.displayAddShadow_(true); - WorkspaceFactoryInit.displayRemoveShadow_(false); - - // Disable shadow editing button if turning invalid shadow block back - // to normal block. - if (!Blockly.selected.getSurroundParent()) { - document.getElementById('button_addShadow').disabled = true; - } - }); - - // Help button on workspace tab. - document.getElementById('button_optionsHelp').addEventListener - ('click', function() { - open('https://developers.google.com/blockly/guides/get-started/web#configuration'); - }); - - // Reset to Default button on workspace tab. - document.getElementById('button_standardOptions').addEventListener - ('click', function() { - controller.setStandardOptionsAndUpdate(); - }); -}; - -/** - * Add event listeners for workspace factory. - * @param {!FactoryController} controller The controller for the workspace - * factory tab. - * @private - */ -WorkspaceFactoryInit.addWorkspaceFactoryEventListeners_ = function(controller) { - // Use up and down arrow keys to move categories. - window.addEventListener('keydown', function(e) { - // Don't let arrow keys have any effect if not in Workspace Factory - // editing the toolbox. - if (!(controller.keyEventsEnabled && controller.selectedMode - == WorkspaceFactoryController.MODE_TOOLBOX)) { - return; - } - - if (e.keyCode == 38) { - // Arrow up. - controller.moveElement(-1); - } else if (e.keyCode == 40) { - // Arrow down. - controller.moveElement(1); - } - }); - - // Determines if a block breaks shadow block placement rules. - // Breaks rules if (1) a shadow block no longer has a valid - // parent, or (2) a normal block is inside of a shadow block. - var isInvalidBlockPlacement = function(block) { - return ((controller.isUserGenShadowBlock(block.id) && - !block.getSurroundParent()) || - (!controller.isUserGenShadowBlock(block.id) && - block.getSurroundParent() && - controller.isUserGenShadowBlock(block.getSurroundParent().id))); - }; - - // Add change listeners for toolbox workspace in workspace factory. - controller.toolboxWorkspace.addChangeListener(function(e) { - // Listen for Blockly move and delete events to update preview. - // Not listening for Blockly create events because causes the user to drop - // blocks when dragging them into workspace. Could cause problems if ever - // load blocks into workspace directly without calling updatePreview. - if (e.type == Blockly.Events.BLOCK_MOVE || - e.type == Blockly.Events.BLOCK_DELETE || - e.type == Blockly.Events.BLOCK_CHANGE) { - controller.saveStateFromWorkspace(); - controller.updatePreview(); - } - - // Listen for Blockly UI events to correctly enable the "Edit Block" button. - // Only enable "Edit Block" when a block is selected and it has a - // surrounding parent, meaning it is nested in another block (blocks that - // are not nested in parents cannot be shadow blocks). - if (e.type == Blockly.Events.BLOCK_MOVE || (e.type == Blockly.Events.UI && - e.element == 'selected')) { - var selected = Blockly.selected; - - // Show shadow button if a block is selected. Show "Add Shadow" if - // a block is not a shadow block, show "Remove Shadow" if it is a - // shadow block. - if (selected) { - var isShadow = controller.isUserGenShadowBlock(selected.id); - WorkspaceFactoryInit.displayAddShadow_(!isShadow); - WorkspaceFactoryInit.displayRemoveShadow_(isShadow); - } else { - WorkspaceFactoryInit.displayAddShadow_(false); - WorkspaceFactoryInit.displayRemoveShadow_(false); - } - - if (selected != null && selected.getSurroundParent() != null && - !controller.isUserGenShadowBlock(selected.getSurroundParent().id)) { - // Selected block is a valid shadow block or could be a valid shadow - // block. - - // Enable block editing and remove warnings if the block is not a - // variable user-generated shadow block. - document.getElementById('button_addShadow').disabled = false; - document.getElementById('button_removeShadow').disabled = false; - - if (!FactoryUtils.hasVariableField(selected) && - controller.isDefinedBlock(selected)) { - selected.setWarningText(null); - } - } else { - // Selected block cannot be a valid shadow block. - - if (selected != null && isInvalidBlockPlacement(selected)) { - // Selected block breaks shadow block rules. - // Invalid shadow block if (1) a shadow block no longer has a valid - // parent, or (2) a normal block is inside of a shadow block. - - if (!controller.isUserGenShadowBlock(selected.id)) { - // Warn if a non-shadow block is nested inside a shadow block. - selected.setWarningText('Only shadow blocks can be nested inside\n' - + 'other shadow blocks.'); - } else if (!FactoryUtils.hasVariableField(selected)) { - // Warn if a shadow block is invalid only if not replacing - // warning for variables. - selected.setWarningText('Shadow blocks must be nested inside other' - + ' blocks.') - } - - // Give editing options so that the user can make an invalid shadow - // block a normal block. - document.getElementById('button_removeShadow').disabled = false; - document.getElementById('button_addShadow').disabled = true; - } else { - // Selected block does not break any shadow block rules, but cannot - // be a shadow block. - - // Remove possible 'invalid shadow block placement' warning. - if (selected != null && controller.isDefinedBlock(selected) && - (!FactoryUtils.hasVariableField(selected) || - !controller.isUserGenShadowBlock(selected.id))) { - selected.setWarningText(null); - } - - // No block selected that is a shadow block or could be a valid shadow - // block. Disable block editing. - document.getElementById('button_addShadow').disabled = true; - document.getElementById('button_removeShadow').disabled = true; - } - } - } - - // Convert actual shadow blocks added from the toolbox to user-generated - // shadow blocks. - if (e.type == Blockly.Events.BLOCK_CREATE) { - controller.convertShadowBlocks(); - - // Let the user create a Variables or Functions category if they use - // blocks from either category. - - // Get all children of a block and add them to childList. - var getAllChildren = function(block, childList) { - childList.push(block); - var children = block.getChildren(); - for (var i = 0, child; child = children[i]; i++) { - getAllChildren(child, childList); - } - }; - - var newBaseBlock = controller.toolboxWorkspace.getBlockById(e.blockId); - var allNewBlocks = []; - getAllChildren(newBaseBlock, allNewBlocks); - var variableCreated = false; - var procedureCreated = false; - - // Check if the newly created block or any of its children are variable - // or procedure blocks. - for (var i = 0, block; block = allNewBlocks[i]; i++) { - if (FactoryUtils.hasVariableField(block)) { - variableCreated = true; - } else if (FactoryUtils.isProcedureBlock(block)) { - procedureCreated = true; - } - } - - // If any of the newly created blocks are variable or procedure blocks, - // prompt the user to create the corresponding standard category. - if (variableCreated && !controller.hasVariablesCategory()) { - if (confirm('Your new block has a variables field. To use this block ' - + 'fully, you will need a Variables category. Do you want to add ' - + 'a Variables category to your custom toolbox?')) { - controller.setMode(WorkspaceFactoryController.MODE_TOOLBOX); - controller.loadCategoryByName('variables'); - } - } - - if (procedureCreated && !controller.hasProceduresCategory()) { - if (confirm('Your new block is a function block. To use this block ' - + 'fully, you will need a Functions category. Do you want to add ' - + 'a Functions category to your custom toolbox?')) { - controller.setMode(WorkspaceFactoryController.MODE_TOOLBOX); - controller.loadCategoryByName('functions'); - } - } - } - }); -}; - -/** - * Display or hide the add shadow button. - * @param {boolean} show True if the add shadow button should be shown, false - * otherwise. - */ -WorkspaceFactoryInit.displayAddShadow_ = function(show) { - document.getElementById('button_addShadow').style.display = - show ? 'inline-block' : 'none'; -}; - -/** - * Display or hide the remove shadow button. - * @param {boolean} show True if the remove shadow button should be shown, false - * otherwise. - */ -WorkspaceFactoryInit.displayRemoveShadow_ = function(show) { - document.getElementById('button_removeShadow').style.display = - show ? 'inline-block' : 'none'; -}; - -/** - * Add listeners for workspace factory options input elements. - * @param {!FactoryController} controller The controller for the workspace - * factory tab. - * @private - */ -WorkspaceFactoryInit.addWorkspaceFactoryOptionsListeners_ = - function(controller) { - // Checking the grid checkbox displays grid options. - document.getElementById('option_grid_checkbox').addEventListener('change', - function(e) { - document.getElementById('grid_options').style.display = - document.getElementById('option_grid_checkbox').checked ? - 'block' : 'none'; - }); - - // Checking the zoom checkbox displays zoom options. - document.getElementById('option_zoom_checkbox').addEventListener('change', - function(e) { - document.getElementById('zoom_options').style.display = - document.getElementById('option_zoom_checkbox').checked ? - 'block' : 'none'; - }); - - // Checking the readonly checkbox enables/disables other options. - document.getElementById('option_readOnly_checkbox').addEventListener('change', - function(e) { - var checkbox = document.getElementById('option_readOnly_checkbox'); - blocklyFactory.ifCheckedEnable(!checkbox.checked, - ['readonly1', 'readonly2']); - }); - - document.getElementById('option_infiniteBlocks_checkbox').addEventListener('change', - function(e) { - document.getElementById('maxBlockNumber_option').style.display = - document.getElementById('option_infiniteBlocks_checkbox').checked ? - 'none' : 'block'; - }); - - // Generate new options every time an options input is updated. - var div = document.getElementById('workspace_options'); - var options = div.getElementsByTagName('input'); - for (var i = 0, option; option = options[i]; i++) { - option.addEventListener('change', function() { - controller.generateNewOptions(); - }); - } -}; diff --git a/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_model.js b/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_model.js deleted file mode 100644 index a295a496a9b5009d1eb6d2e6b17247c6ab39e045..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_model.js +++ /dev/null @@ -1,561 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Stores and updates information about state and categories - * in workspace factory. Each list element is either a separator or a category, - * and each category stores its name, XML to load that category, color, - * custom tags, and a unique ID making it possible to change category names and - * move categories easily. Keeps track of the currently selected list - * element. Also keeps track of all the user-created shadow blocks and - * manipulates them as necessary. - * - * @author Emma Dauterman (evd2014) - */ - -/** - * Class for a WorkspaceFactoryModel - * @constructor - */ -WorkspaceFactoryModel = function() { - // Ordered list of ListElement objects. Empty if there is a single flyout. - this.toolboxList = []; - // ListElement for blocks in a single flyout. Null if a toolbox exists. - this.flyout = new ListElement(ListElement.TYPE_FLYOUT); - // Array of block IDs for all user created shadow blocks. - this.shadowBlocks = []; - // Reference to currently selected ListElement. Stored in this.toolboxList if - // there are categories, or in this.flyout if blocks are displayed in a single - // flyout. - this.selected = this.flyout; - // Boolean for if a Variable category has been added. - this.hasVariableCategory = false; - // Boolean for if a Procedure category has been added. - this.hasProcedureCategory = false; - // XML to be pre-loaded to workspace. Empty on default; - this.preloadXml = Blockly.utils.xml.createElement('xml'); - // Options object to be configured for Blockly inject call. - this.options = new Object(null); - // Block Library block types. - this.libBlockTypes = []; - // Imported block types. - this.importedBlockTypes = []; - // -}; - -/** - * Given a name, determines if it is the name of a category already present. - * Used when getting a valid category name from the user. - * @param {string} name String name to be compared against. - * @return {boolean} True if string is a used category name, false otherwise. - */ -WorkspaceFactoryModel.prototype.hasCategoryByName = function(name) { - for (var i = 0; i < this.toolboxList.length; i++) { - if (this.toolboxList[i].type == ListElement.TYPE_CATEGORY && - this.toolboxList[i].name == name) { - return true; - } - } - return false; -}; - -/** - * Determines if a category with the 'VARIABLE' tag exists. - * @return {boolean} True if there exists a category with the Variables tag, - * false otherwise. - */ -WorkspaceFactoryModel.prototype.hasVariables = function() { - return this.hasVariableCategory; -}; - -/** - * Determines if a category with the 'PROCEDURE' tag exists. - * @return {boolean} True if there exists a category with the Procedures tag, - * false otherwise. - */ -WorkspaceFactoryModel.prototype.hasProcedures = function() { - return this.hasProcedureCategory; -}; - -/** - * Determines if the user has any elements in the toolbox. Uses the length of - * toolboxList. - * @return {boolean} True if elements exist, false otherwise. - */ -WorkspaceFactoryModel.prototype.hasElements = function() { - return this.toolboxList.length > 0; -}; - -/** - * Given a ListElement, adds it to the toolbox list. - * @param {!ListElement} element The element to be added to the list. - */ -WorkspaceFactoryModel.prototype.addElementToList = function(element) { - // Update state if the copied category has a custom tag. - this.hasVariableCategory = element.custom == 'VARIABLE' ? true : - this.hasVariableCategory; - this.hasProcedureCategory = element.custom == 'PROCEDURE' ? true : - this.hasProcedureCategory; - // Add element to toolboxList. - this.toolboxList.push(element); - // Empty single flyout. - this.flyout = null; -}; - -/** - * Given an index, deletes a list element and all associated data. - * @param {number} index The index of the list element to delete. - */ -WorkspaceFactoryModel.prototype.deleteElementFromList = function(index) { - // Check if index is out of bounds. - if (index < 0 || index >= this.toolboxList.length) { - return; // No entry to delete. - } - // Check if need to update flags. - this.hasVariableCategory = this.toolboxList[index].custom == 'VARIABLE' ? - false : this.hasVariableCategory; - this.hasProcedureCategory = this.toolboxList[index].custom == 'PROCEDURE' ? - false : this.hasProcedureCategory; - // Remove element. - this.toolboxList.splice(index, 1); -}; - -/** - * Sets selected to be an empty category not in toolbox list if toolbox list - * is empty. Should be called when removing the last element from toolbox list. - * If the toolbox list is empty, selected stores the XML for the single flyout - * of blocks displayed. - */ -WorkspaceFactoryModel.prototype.createDefaultSelectedIfEmpty = function() { - if (this.toolboxList.length == 0) { - this.flyout = new ListElement(ListElement.TYPE_FLYOUT); - this.selected = this.flyout; - } -}; - -/** - * Moves a list element to a certain position in toolboxList by removing it - * and then inserting it at the correct index. Checks that indices are in - * bounds (throws error if not), but assumes that oldIndex is the correct index - * for list element. - * @param {!ListElement} element The element to move in toolboxList. - * @param {number} newIndex The index to insert the element at. - * @param {number} oldIndex The index the element is currently at. - */ -WorkspaceFactoryModel.prototype.moveElementToIndex = function(element, newIndex, - oldIndex) { - // Check that indexes are in bounds. - if (newIndex < 0 || newIndex >= this.toolboxList.length || oldIndex < 0 || - oldIndex >= this.toolboxList.length) { - throw Error('Index out of bounds when moving element in the model.'); - } - this.deleteElementFromList(oldIndex); - this.toolboxList.splice(newIndex, 0, element); -}; - -/** - * Returns the ID of the currently selected element. Returns null if there are - * no categories (if selected == null). - * @return {string} The ID of the element currently selected. - */ -WorkspaceFactoryModel.prototype.getSelectedId = function() { - return this.selected ? this.selected.id : null; -}; - -/** - * Returns the name of the currently selected category. Returns null if there - * are no categories (if selected == null) or the selected element is not - * a category (in which case its name is null). - * @return {string} The name of the category currently selected. - */ -WorkspaceFactoryModel.prototype.getSelectedName = function() { - return this.selected ? this.selected.name : null; -}; - -/** - * Returns the currently selected list element object. - * @return {ListElement} The currently selected ListElement - */ -WorkspaceFactoryModel.prototype.getSelected = function() { - return this.selected; -}; - -/** - * Sets list element currently selected by id. - * @param {string} id ID of list element that should now be selected. - */ -WorkspaceFactoryModel.prototype.setSelectedById = function(id) { - this.selected = this.getElementById(id); -}; - -/** - * Given an ID of a list element, returns the index of that list element in - * toolboxList. Returns -1 if ID is not present. - * @param {string} id The ID of list element to search for. - * @return {number} The index of the list element in toolboxList, or -1 if it - * doesn't exist. - */ -WorkspaceFactoryModel.prototype.getIndexByElementId = function(id) { - for (var i = 0; i < this.toolboxList.length; i++) { - if (this.toolboxList[i].id == id) { - return i; - } - } - return -1; // ID not present in toolboxList. -}; - -/** - * Given the ID of a list element, returns that ListElement object. - * @param {string} id The ID of element to search for. - * @return {ListElement} Corresponding ListElement object in toolboxList, or - * null if that element does not exist. - */ -WorkspaceFactoryModel.prototype.getElementById = function(id) { - for (var i = 0; i < this.toolboxList.length; i++) { - if (this.toolboxList[i].id == id) { - return this.toolboxList[i]; - } - } - return null; // ID not present in toolboxList. -}; - -/** - * Given the index of a list element in toolboxList, returns that ListElement - * object. - * @param {number} index The index of the element to return. - * @return {ListElement} The corresponding ListElement object in toolboxList. - */ -WorkspaceFactoryModel.prototype.getElementByIndex = function(index) { - if (index < 0 || index >= this.toolboxList.length) { - return null; - } - return this.toolboxList[index]; -}; - -/** - * Returns the XML to load the selected element. - * @return {!Element} The XML of the selected element, or null if there is - * no selected element. - */ -WorkspaceFactoryModel.prototype.getSelectedXml = function() { - return this.selected ? this.selected.xml : null; -}; - -/** - * Return ordered list of ListElement objects. - * @return {!Array.<!ListElement>} ordered list of ListElement objects - */ -WorkspaceFactoryModel.prototype.getToolboxList = function() { - return this.toolboxList; -}; - -/** - * Gets the ID of a category given its name. - * @param {string} name Name of category. - * @return {number} ID of category - */ -WorkspaceFactoryModel.prototype.getCategoryIdByName = function(name) { - for (var i = 0; i < this.toolboxList.length; i++) { - if (this.toolboxList[i].name == name) { - return this.toolboxList[i].id; - } - } - return null; // Name not present in toolboxList. -}; - -/** - * Clears the toolbox list, deleting all ListElements. - */ -WorkspaceFactoryModel.prototype.clearToolboxList = function() { - this.toolboxList = []; - this.hasVariableCategory = false; - this.hasProcedureCategory = false; - this.shadowBlocks = []; - this.selected.xml = Blockly.utils.xml.createElement('xml'); -}; - -/** - * Class for a ListElement - * Adds a shadow block to the list of shadow blocks. - * @param {string} blockId The unique ID of block to be added. - */ -WorkspaceFactoryModel.prototype.addShadowBlock = function(blockId) { - this.shadowBlocks.push(blockId); -}; - -/** - * Removes a shadow block ID from the list of shadow block IDs if that ID is - * in the list. - * @param {string} blockId The unique ID of block to be removed. - */ -WorkspaceFactoryModel.prototype.removeShadowBlock = function(blockId) { - for (var i = 0; i < this.shadowBlocks.length; i++) { - if (this.shadowBlocks[i] == blockId) { - this.shadowBlocks.splice(i, 1); - return; - } - } -}; - -/** - * Determines if a block is a shadow block given a unique block ID. - * @param {string} blockId The unique ID of the block to examine. - * @return {boolean} True if the block is a user-generated shadow block, false - * otherwise. - */ -WorkspaceFactoryModel.prototype.isShadowBlock = function(blockId) { - for (var i = 0; i < this.shadowBlocks.length; i++) { - if (this.shadowBlocks[i] == blockId) { - return true; - } - } - return false; -}; - -/** - * Given a set of blocks currently loaded, returns all blocks in the workspace - * that are user generated shadow blocks. - * @param {!<Blockly.Block>} blocks Array of blocks currently loaded. - * @return {!<Blockly.Block>} Array of user-generated shadow blocks currently - * loaded. - */ -WorkspaceFactoryModel.prototype.getShadowBlocksInWorkspace = - function(workspaceBlocks) { - var shadowsInWorkspace = []; - for (var i = 0; i < workspaceBlocks.length; i++) { - if (this.isShadowBlock(workspaceBlocks[i].id)) { - shadowsInWorkspace.push(workspaceBlocks[i]); - } - } - return shadowsInWorkspace; -}; - -/** - * Adds a custom tag to a category, updating state variables accordingly. - * Only accepts 'VARIABLE' and 'PROCEDURE' tags. - * @param {!ListElement} category The category to add the tag to. - * @param {string} tag The custom tag to add to the category. - */ -WorkspaceFactoryModel.prototype.addCustomTag = function(category, tag) { - // Only update list elements that are categories. - if (category.type != ListElement.TYPE_CATEGORY) { - return; - } - // Only update the tag to be 'VARIABLE' or 'PROCEDURE'. - if (tag == 'VARIABLE') { - this.hasVariableCategory = true; - category.custom = 'VARIABLE'; - } else if (tag == 'PROCEDURE') { - this.hasProcedureCategory = true; - category.custom = 'PROCEDURE'; - } -}; - -/** - * Have basic pre-loaded workspace working - * Saves XML as XML to be pre-loaded into the workspace. - * @param {!Element} xml The XML to be saved. - */ -WorkspaceFactoryModel.prototype.savePreloadXml = function(xml) { - this.preloadXml = xml -}; - -/** - * Gets the XML to be pre-loaded into the workspace. - * @return {!Element} The XML for the workspace. - */ -WorkspaceFactoryModel.prototype.getPreloadXml = function() { - return this.preloadXml; -}; - -/** - * Sets a new options object for injecting a Blockly workspace. - * @param {Object} options Options object for injecting a Blockly workspace. - */ -WorkspaceFactoryModel.prototype.setOptions = function(options) { - this.options = options; -}; - -/* - * Returns an array of all the block types currently being used in the toolbox - * and the pre-loaded blocks. No duplicates. - * TODO(evd2014): Move pushBlockTypesToList to FactoryUtils. - * @return {!Array.<string>} Array of block types currently being used. - */ -WorkspaceFactoryModel.prototype.getAllUsedBlockTypes = function() { - var blockTypeList = []; - - // Given XML for the workspace, adds all block types included in the XML - // to the list, not including duplicates. - var pushBlockTypesToList = function(xml, list) { - // Get all block XML nodes. - var blocks = xml.getElementsByTagName('block'); - - // Add block types if not already in list. - for (var i = 0; i < blocks.length; i++) { - var type = blocks[i].getAttribute('type'); - if (list.indexOf(type) == -1) { - list.push(type); - } - } - }; - - if (this.flyout) { - // If has a single flyout, add block types for the single flyout. - pushBlockTypesToList(this.getSelectedXml(), blockTypeList); - } else { - // If has categories, add block types for each category. - - for (var i = 0, category; category = this.toolboxList[i]; i++) { - if (category.type == ListElement.TYPE_CATEGORY) { - pushBlockTypesToList(category.xml, blockTypeList); - } - } - } - - // Add the block types from any pre-loaded blocks. - pushBlockTypesToList(this.getPreloadXml(), blockTypeList); - - return blockTypeList; -}; - -/** - * Adds new imported block types to the list of current imported block types. - * @param {!Array.<string>} blockTypes Array of block types imported. - */ -WorkspaceFactoryModel.prototype.addImportedBlockTypes = function(blockTypes) { - this.importedBlockTypes = this.importedBlockTypes.concat(blockTypes); -}; - -/** - * Updates block types in block library. - * @param {!Array.<string>} blockTypes Array of block types in block library. - */ -WorkspaceFactoryModel.prototype.updateLibBlockTypes = function(blockTypes) { - this.libBlockTypes = blockTypes; -}; - -/** - * Determines if a block type is defined as a standard block, in the block - * library, or as an imported block. - * @param {string} blockType Block type to check. - * @return {boolean} True if blockType is defined, false otherwise. - */ -WorkspaceFactoryModel.prototype.isDefinedBlockType = function(blockType) { - var isStandardBlock = StandardCategories.coreBlockTypes.indexOf(blockType) - != -1; - var isLibBlock = this.libBlockTypes.indexOf(blockType) != -1; - var isImportedBlock = this.importedBlockTypes.indexOf(blockType) != -1; - return (isStandardBlock || isLibBlock || isImportedBlock); -}; - -/** - * Checks if any of the block types are already defined. - * @param {!Array.<string>} blockTypes Array of block types. - * @return {boolean} True if a block type in the array is already defined, - * false if none of the blocks are already defined. - */ -WorkspaceFactoryModel.prototype.hasDefinedBlockTypes = function(blockTypes) { - for (var i = 0, blockType; blockType = blockTypes[i]; i++) { - if (this.isDefinedBlockType(blockType)) { - return true; - } - } - return false; -}; - -/** - * Class for a ListElement. - * @constructor - */ -ListElement = function(type, opt_name) { - this.type = type; - // XML DOM element to load the element. - this.xml = Blockly.utils.xml.createElement('xml'); - // Name of category. Can be changed by user. Null if separator. - this.name = opt_name ? opt_name : null; - // Unique ID of element. Does not change. - this.id = Blockly.utils.genUid(); - // Color of category. Default is no color. Null if separator. - this.color = null; - // Stores a custom tag, if necessary. Null if no custom tag or separator. - this.custom = null; -}; - -// List element types. -ListElement.TYPE_CATEGORY = 'category'; -ListElement.TYPE_SEPARATOR = 'separator'; -ListElement.TYPE_FLYOUT = 'flyout'; - -/** - * Saves a category by updating its XML (does not save XML for - * elements that are not categories). - * @param {!Blockly.workspace} workspace The workspace to save category entry - * from. - */ -ListElement.prototype.saveFromWorkspace = function(workspace) { - // Only save XML for categories and flyouts. - if (this.type == ListElement.TYPE_FLYOUT || - this.type == ListElement.TYPE_CATEGORY) { - this.xml = Blockly.Xml.workspaceToDom(workspace); - } -}; - - -/** - * Changes the name of a category object given a new name. Returns if - * not a category. - * @param {string} name New name of category. - */ -ListElement.prototype.changeName = function (name) { - // Only update list elements that are categories. - if (this.type != ListElement.TYPE_CATEGORY) { - return; - } - this.name = name; -}; - -/** - * Sets the color of a category. If tries to set the color of something other - * than a category, returns. - * @param {?string} color The color that should be used for that category, - * or null if none. - */ -ListElement.prototype.changeColor = function (color) { - if (this.type != ListElement.TYPE_CATEGORY) { - return; - } - this.color = color; -}; - -/** - * Makes a copy of the original element and returns it. Everything about the - * copy is identical except for its ID. - * @return {!ListElement} The copy of the ListElement. - */ -ListElement.prototype.copy = function() { - copy = new ListElement(this.type); - // Generate a unique ID for the element. - copy.id = Blockly.utils.genUid(); - // Copy all attributes except ID. - copy.name = this.name; - copy.xml = this.xml; - copy.color = this.color; - copy.custom = this.custom; - // Return copy. - return copy; -}; diff --git a/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_view.js b/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_view.js deleted file mode 100644 index 287fb3d261a4517b7b1fd1594096c5bf580f2802..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory/workspacefactory/wfactory_view.js +++ /dev/null @@ -1,438 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Controls the UI elements for workspace factory, mainly the category tabs. - * Also includes downloading files because that interacts directly with the DOM. - * Depends on WorkspaceFactoryController (for adding mouse listeners). Tabs for - * each category are stored in tab map, which associates a unique ID for a - * category with a particular tab. - * - * @author Emma Dauterman (edauterman) - */ - - -/** - * Class for a WorkspaceFactoryView - * @constructor - */ -WorkspaceFactoryView = function() { - // For each tab, maps ID of a ListElement to the td DOM element. - this.tabMap = Object.create(null); -}; - -/** - * Adds a category tab to the UI, and updates tabMap accordingly. - * @param {string} name The name of the category being created - * @param {string} id ID of category being created - * @return {!Element} DOM element created for tab - */ -WorkspaceFactoryView.prototype.addCategoryRow = function(name, id) { - var table = document.getElementById('categoryTable'); - var count = table.rows.length; - - // Delete help label and enable category buttons if it's the first category. - if (count == 0) { - document.getElementById('categoryHeader').textContent = 'Your categories:'; - } - - // Create tab. - var row = table.insertRow(count); - var nextEntry = row.insertCell(0); - // Configure tab. - nextEntry.id = this.createCategoryIdName(name); - nextEntry.textContent = name; - // Store tab. - this.tabMap[id] = table.rows[count].cells[0]; - // Return tab. - return nextEntry; -}; - -/** - * Deletes a category tab from the UI and updates tabMap accordingly. - * @param {string} id ID of category to be deleted. - * @param {string} name The name of the category to be deleted. - */ -WorkspaceFactoryView.prototype.deleteElementRow = function(id, index) { - // Delete tab entry. - delete this.tabMap[id]; - // Delete tab row. - var table = document.getElementById('categoryTable'); - var count = table.rows.length; - table.deleteRow(index); - - // If last category removed, add category help text and disable category - // buttons. - this.addEmptyCategoryMessage(); -}; - -/** - * If there are no toolbox elements created, adds a help message to show - * where categories will appear. Should be called when deleting list elements - * in case the last element is deleted. - */ -WorkspaceFactoryView.prototype.addEmptyCategoryMessage = function() { - var table = document.getElementById('categoryTable'); - if (!table.rows.length) { - document.getElementById('categoryHeader').textContent = - 'You currently have no categories.'; - } -}; - -/** - * Given the index of the currently selected element, updates the state of - * the buttons that allow the user to edit the list elements. Updates the edit - * and arrow buttons. Should be called when adding or removing elements - * or when changing to a new element or when swapping to a different element. - * TODO(evd2014): Switch to using CSS to add/remove styles. - * @param {number} selectedIndex The index of the currently selected category, - * -1 if no categories created. - * @param {ListElement} selected The selected ListElement. - */ -WorkspaceFactoryView.prototype.updateState = function(selectedIndex, selected) { - // Disable/enable editing buttons as necessary. - document.getElementById('button_editCategory').disabled = selectedIndex < 0 || - selected.type != ListElement.TYPE_CATEGORY; - document.getElementById('button_remove').disabled = selectedIndex < 0; - document.getElementById('button_up').disabled = selectedIndex <= 0; - var table = document.getElementById('categoryTable'); - document.getElementById('button_down').disabled = selectedIndex >= - table.rows.length - 1 || selectedIndex < 0; - // Disable/enable the workspace as necessary. - this.disableWorkspace(this.shouldDisableWorkspace(selected)); -}; - -/** - * Determines the DOM ID for a category given its name. - * @param {string} name Name of category - * @return {string} ID of category tab - */ -WorkspaceFactoryView.prototype.createCategoryIdName = function(name) { - return 'tab_' + name; -}; - -/** - * Switches a tab on or off. - * @param {string} id ID of the tab to switch on or off. - * @param {boolean} selected True if tab should be on, false if tab should be - * off. - */ -WorkspaceFactoryView.prototype.setCategoryTabSelection = - function(id, selected) { - if (!this.tabMap[id]) { - return; // Exit if tab does not exist. - } - this.tabMap[id].className = selected ? 'tabon' : 'taboff'; -}; - -/** - * Used to bind a click to a certain DOM element (used for category tabs). - * Taken directly from code.js - * @param {string|!Element} e1 Tab element or corresponding ID string. - * @param {!Function} func Function to be executed on click. - */ -WorkspaceFactoryView.prototype.bindClick = function(el, func) { - if (typeof el == 'string') { - el = document.getElementById(el); - } - el.addEventListener('click', func, true); - el.addEventListener('touchend', func, true); -}; - -/** - * Creates a file and downloads it. In some browsers downloads, and in other - * browsers, opens new tab with contents. - * @param {string} filename Name of file - * @param {!Blob} data Blob containing contents to download - */ -WorkspaceFactoryView.prototype.createAndDownloadFile = - function(filename, data) { - var clickEvent = new MouseEvent('click', { - 'view': window, - 'bubbles': true, - 'cancelable': false - }); - var a = document.createElement('a'); - a.href = window.URL.createObjectURL(data); - a.download = filename; - a.textContent = 'Download file!'; - a.dispatchEvent(clickEvent); -}; - -/** - * Given the ID of a certain category, updates the corresponding tab in - * the DOM to show a new name. - * @param {string} newName Name of string to be displayed on tab - * @param {string} id ID of category to be updated - */ -WorkspaceFactoryView.prototype.updateCategoryName = function(newName, id) { - this.tabMap[id].textContent = newName; - this.tabMap[id].id = this.createCategoryIdName(newName); -}; - -/** - * Moves a tab from one index to another. Adjusts index inserting before - * based on if inserting before or after. Checks that the indexes are in - * bounds, throws error if not. - * @param {string} id The ID of the category to move. - * @param {number} newIndex The index to move the category to. - * @param {number} oldIndex The index the category is currently at. - */ -WorkspaceFactoryView.prototype.moveTabToIndex = - function(id, newIndex, oldIndex) { - var table = document.getElementById('categoryTable'); - // Check that indexes are in bounds. - if (newIndex < 0 || newIndex >= table.rows.length || oldIndex < 0 || - oldIndex >= table.rows.length) { - throw Error('Index out of bounds when moving tab in the view.'); - } - - if (newIndex < oldIndex) { - // Inserting before. - var row = table.insertRow(newIndex); - row.appendChild(this.tabMap[id]); - table.deleteRow(oldIndex + 1); - } else { - // Inserting after. - var row = table.insertRow(newIndex + 1); - row.appendChild(this.tabMap[id]); - table.deleteRow(oldIndex); - } -}; - -/** - * Given a category ID and color, use that color to color the left border of the - * tab for that category. - * @param {string} id The ID of the category to color. - * @param {?string} colour The colour for to be used for the border of the tab, - * or null if none. Must be a valid CSS string. - */ -WorkspaceFactoryView.prototype.setBorderColor = function(id, colour) { - var style = this.tabMap[id].style; - if (colour) { - style.borderLeftWidth = '8px'; - style.borderLeftStyle = 'solid'; - style.borderColor = colour; - } else { - style.borderLeftWidth = ''; - style.borderLeftStyle = ''; - style.borderColor = ''; - } -}; - -/** - * Given a separator ID, creates a corresponding tab in the view, updates - * tab map, and returns the tab. - * @param {string} id The ID of the separator. - * @param {!Element} The td DOM element representing the separator. - */ -WorkspaceFactoryView.prototype.addSeparatorTab = function(id) { - var table = document.getElementById('categoryTable'); - var count = table.rows.length; - - if (count == 0) { - document.getElementById('categoryHeader').textContent = 'Your categories:'; - } - // Create separator. - var row = table.insertRow(count); - var nextEntry = row.insertCell(0); - // Configure separator. - nextEntry.style.height = '10px'; - // Store and return separator. - this.tabMap[id] = table.rows[count].cells[0]; - return nextEntry; -}; - -/** - * Disables or enables the workspace by putting a div over or under the - * toolbox workspace, depending on the value of disable. Used when switching - * to/from separators where the user shouldn't be able to drag blocks into - * the workspace. - * @param {boolean} disable True if the workspace should be disabled, false - * if it should be enabled. - */ -WorkspaceFactoryView.prototype.disableWorkspace = function(disable) { - if (disable) { - document.getElementById('toolbox_section').className = 'disabled'; - document.getElementById('toolbox_blocks').style.pointerEvents = 'none'; - } else { - document.getElementById('toolbox_section').className = ''; - document.getElementById('toolbox_blocks').style.pointerEvents = 'auto'; - } - -}; - -/** - * Determines if the workspace should be disabled. The workspace should be - * disabled if category is a separator or has VARIABLE or PROCEDURE tags. - * @return {boolean} True if the workspace should be disabled, false otherwise. - */ -WorkspaceFactoryView.prototype.shouldDisableWorkspace = function(category) { - return category != null && category.type != ListElement.TYPE_FLYOUT && - (category.type == ListElement.TYPE_SEPARATOR || - category.custom == 'VARIABLE' || category.custom == 'PROCEDURE'); -}; - -/** - * Removes all categories and separators in the view. Clears the tabMap to - * reflect this. - */ -WorkspaceFactoryView.prototype.clearToolboxTabs = function() { - this.tabMap = []; - var oldCategoryTable = document.getElementById('categoryTable'); - var newCategoryTable = document.createElement('table'); - newCategoryTable.id = 'categoryTable'; - newCategoryTable.style.width = 'auto'; - oldCategoryTable.parentElement.replaceChild(newCategoryTable, - oldCategoryTable); -}; - -/** - * Given a set of blocks currently loaded user-generated shadow blocks, visually - * marks them without making them actual shadow blocks (allowing them to still - * be editable and movable). - * @param {!Array.<!Blockly.Block>} blocks Array of user-generated shadow blocks - * currently loaded. - */ -WorkspaceFactoryView.prototype.markShadowBlocks = function(blocks) { - for (var i = 0; i < blocks.length; i++) { - this.markShadowBlock(blocks[i]); - } -}; - -/** - * Visually marks a user-generated shadow block as a shadow block in the - * workspace without making the block an actual shadow block (allowing it - * to be moved and edited). - * @param {!Blockly.Block} block The block that should be marked as a shadow - * block (must be rendered). - */ -WorkspaceFactoryView.prototype.markShadowBlock = function(block) { - // Add Blockly CSS for user-generated shadow blocks. - Blockly.utils.dom.addClass(block.svgGroup_, 'shadowBlock'); - // If not a valid shadow block, add a warning message. - if (!block.getSurroundParent()) { - block.setWarningText('Shadow blocks must be nested inside' + - ' other blocks to be displayed.'); - } - if (FactoryUtils.hasVariableField(block)) { - block.setWarningText('Cannot make variable blocks shadow blocks.'); - } -}; - -/** - * Removes visual marking for a shadow block given a rendered block. - * @param {!Blockly.Block} block The block that should be unmarked as a shadow - * block (must be rendered). - */ -WorkspaceFactoryView.prototype.unmarkShadowBlock = function(block) { - // Remove Blockly CSS for user-generated shadow blocks. - Blockly.utils.dom.removeClass(block.svgGroup_, 'shadowBlock'); -}; - -/** - * Sets the tabs for modes according to which mode the user is currenly - * editing in. - * @param {string} mode The mode being switched to - * (WorkspaceFactoryController.MODE_TOOLBOX or WorkspaceFactoryController.MODE_PRELOAD). - */ -WorkspaceFactoryView.prototype.setModeSelection = function(mode) { - document.getElementById('tab_preload').className = mode == - WorkspaceFactoryController.MODE_PRELOAD ? 'tabon' : 'taboff'; - document.getElementById('preload_div').style.display = mode == - WorkspaceFactoryController.MODE_PRELOAD ? 'block' : 'none'; - document.getElementById('tab_toolbox').className = mode == - WorkspaceFactoryController.MODE_TOOLBOX ? 'tabon' : 'taboff'; - document.getElementById('toolbox_div').style.display = mode == - WorkspaceFactoryController.MODE_TOOLBOX ? 'block' : 'none'; -}; - -/** - * Updates the help text above the workspace depending on the selected mode. - * @param {string} mode The selected mode (WorkspaceFactoryController.MODE_TOOLBOX or - * WorkspaceFactoryController.MODE_PRELOAD). - */ -WorkspaceFactoryView.prototype.updateHelpText = function(mode) { - if (mode == WorkspaceFactoryController.MODE_TOOLBOX) { - var helpText = 'Drag blocks into the workspace to configure the toolbox ' + - 'in your custom workspace.'; - } else { - var helpText = 'Drag blocks into the workspace to pre-load them in your ' + - 'custom workspace.' - } - document.getElementById('editHelpText').textContent = helpText; -}; - -/** - * Sets the basic options that are not dependent on if there are categories - * or a single flyout of blocks. Updates checkboxes and text fields. - */ -WorkspaceFactoryView.prototype.setBaseOptions = function() { - // Readonly mode. - document.getElementById('option_readOnly_checkbox').checked = false; - blocklyFactory.ifCheckedEnable(true, ['readonly1', 'readonly2']); - - // Set basic options. - document.getElementById('option_css_checkbox').checked = true; - document.getElementById('option_maxBlocks_number').value = 100; - document.getElementById('option_media_text').value = - 'https://blockly-demo.appspot.com/static/media/'; - document.getElementById('option_rtl_checkbox').checked = false; - document.getElementById('option_sounds_checkbox').checked = true; - document.getElementById('option_oneBasedIndex_checkbox').checked = true; - document.getElementById('option_horizontalLayout_checkbox').checked = false; - document.getElementById('option_toolboxPosition_checkbox').checked = false; - - // Check infinite blocks and hide suboption. - document.getElementById('option_infiniteBlocks_checkbox').checked = true; - document.getElementById('maxBlockNumber_option').style.display = - 'none'; - - // Uncheck grid and zoom options and hide suboptions. - document.getElementById('option_grid_checkbox').checked = false; - document.getElementById('grid_options').style.display = 'none'; - document.getElementById('option_zoom_checkbox').checked = false; - document.getElementById('zoom_options').style.display = 'none'; - - // Set grid options. - document.getElementById('gridOption_spacing_number').value = 20; - document.getElementById('gridOption_length_number').value = 1; - document.getElementById('gridOption_colour_text').value = '#888'; - document.getElementById('gridOption_snap_checkbox').checked = false; - - // Set zoom options. - document.getElementById('zoomOption_controls_checkbox').checked = true; - document.getElementById('zoomOption_wheel_checkbox').checked = true; - document.getElementById('zoomOption_startScale_number').value = 1.0; - document.getElementById('zoomOption_maxScale_number').value = 3; - document.getElementById('zoomOption_minScale_number').value = 0.3; - document.getElementById('zoomOption_scaleSpeed_number').value = 1.2; -}; - -/** - * Updates category specific options depending on if there are categories - * currently present. Updates checkboxes and text fields in the view. - * @param {boolean} hasCategories True if categories are present, false if all - * blocks are displayed in a single flyout. - */ -WorkspaceFactoryView.prototype.setCategoryOptions = function(hasCategories) { - document.getElementById('option_collapse_checkbox').checked = hasCategories; - document.getElementById('option_comments_checkbox').checked = hasCategories; - document.getElementById('option_disable_checkbox').checked = hasCategories; - document.getElementById('option_scrollbars_checkbox').checked = hasCategories; - document.getElementById('option_trashcan_checkbox').checked = hasCategories; -}; diff --git a/res/lib/blockly/demos/blockfactory_old/blocks.js b/res/lib/blockly/demos/blockfactory_old/blocks.js deleted file mode 100644 index 58c7ca38378ebdc1fd309b8cfa6b8028cb64e694..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory_old/blocks.js +++ /dev/null @@ -1,824 +0,0 @@ -/** - * @license - * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Blocks for Blockly's Block Factory application. - * @author fraser@google.com (Neil Fraser) - */ -'use strict'; - -Blockly.Blocks['factory_base'] = { - // Base of new block. - init: function() { - this.setColour(120); - this.appendDummyInput() - .appendField('name') - .appendField(new Blockly.FieldTextInput('block_type'), 'NAME'); - this.appendStatementInput('INPUTS') - .setCheck('Input') - .appendField('inputs'); - var dropdown = new Blockly.FieldDropdown([ - ['automatic inputs', 'AUTO'], - ['external inputs', 'EXT'], - ['inline inputs', 'INT']]); - this.appendDummyInput() - .appendField(dropdown, 'INLINE'); - dropdown = new Blockly.FieldDropdown([ - ['no connections', 'NONE'], - ['↠left output', 'LEFT'], - ['↕ top+bottom connections', 'BOTH'], - ['↑ top connection', 'TOP'], - ['↓ bottom connection', 'BOTTOM']], - function(option) { - this.sourceBlock_.updateShape_(option); - // Connect a shadow block to this new input. - this.sourceBlock_.spawnOutputShadow_(option); - }); - this.appendDummyInput() - .appendField(dropdown, 'CONNECTIONS'); - this.appendValueInput('COLOUR') - .setCheck('Colour') - .appendField('colour'); - this.setTooltip('Build a custom block by plugging\n' + - 'fields, inputs and other blocks here.'); - this.setHelpUrl( - 'https://developers.google.com/blockly/guides/create-custom-blocks/block-factory'); - }, - mutationToDom: function() { - var container = Blockly.utils.xml.createElement('mutation'); - container.setAttribute('connections', this.getFieldValue('CONNECTIONS')); - return container; - }, - domToMutation: function(xmlElement) { - var connections = xmlElement.getAttribute('connections'); - this.updateShape_(connections); - }, - spawnOutputShadow_: function(option) { - // Helper method for deciding which type of outputs this block needs - // to attach shaddow blocks to. - switch (option) { - case 'LEFT': - this.connectOutputShadow_('OUTPUTTYPE'); - break; - case 'TOP': - this.connectOutputShadow_('TOPTYPE'); - break; - case 'BOTTOM': - this.connectOutputShadow_('BOTTOMTYPE'); - break; - case 'BOTH': - this.connectOutputShadow_('TOPTYPE'); - this.connectOutputShadow_('BOTTOMTYPE'); - break; - } - }, - connectOutputShadow_: function(outputType) { - // Helper method to create & connect shadow block. - var type = this.workspace.newBlock('type_null'); - type.setShadow(true); - type.outputConnection.connect(this.getInput(outputType).connection); - type.initSvg(); - type.render(); - }, - updateShape_: function(option) { - var outputExists = this.getInput('OUTPUTTYPE'); - var topExists = this.getInput('TOPTYPE'); - var bottomExists = this.getInput('BOTTOMTYPE'); - if (option == 'LEFT') { - if (!outputExists) { - this.addTypeInput_('OUTPUTTYPE', 'output type'); - } - } else if (outputExists) { - this.removeInput('OUTPUTTYPE'); - } - if (option == 'TOP' || option == 'BOTH') { - if (!topExists) { - this.addTypeInput_('TOPTYPE', 'top type'); - } - } else if (topExists) { - this.removeInput('TOPTYPE'); - } - if (option == 'BOTTOM' || option == 'BOTH') { - if (!bottomExists) { - this.addTypeInput_('BOTTOMTYPE', 'bottom type'); - } - } else if (bottomExists) { - this.removeInput('BOTTOMTYPE'); - } - }, - addTypeInput_: function(name, label) { - this.appendValueInput(name) - .setCheck('Type') - .appendField(label); - this.moveInputBefore(name, 'COLOUR'); - } -}; - -var FIELD_MESSAGE = 'fields %1 %2'; -var FIELD_ARGS = [ - { - "type": "field_dropdown", - "name": "ALIGN", - "options": [['left', 'LEFT'], ['right', 'RIGHT'], ['centre', 'CENTRE']], - }, - { - "type": "input_statement", - "name": "FIELDS", - "check": "Field" - } -]; - -var TYPE_MESSAGE = 'type %1'; -var TYPE_ARGS = [ - { - "type": "input_value", - "name": "TYPE", - "check": "Type", - "align": "RIGHT" - } -]; - -Blockly.Blocks['input_value'] = { - // Value input. - init: function() { - this.jsonInit({ - "message0": "value input %1 %2", - "args0": [ - { - "type": "field_input", - "name": "INPUTNAME", - "text": "NAME" - }, - { - "type": "input_dummy" - } - ], - "message1": FIELD_MESSAGE, - "args1": FIELD_ARGS, - "message2": TYPE_MESSAGE, - "args2": TYPE_ARGS, - "previousStatement": "Input", - "nextStatement": "Input", - "colour": 210, - "tooltip": "A value socket for horizontal connections.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=71" - }); - }, - onchange: function() { - inputNameCheck(this); - } -}; - -Blockly.Blocks['input_statement'] = { - // Statement input. - init: function() { - this.jsonInit({ - "message0": "statement input %1 %2", - "args0": [ - { - "type": "field_input", - "name": "INPUTNAME", - "text": "NAME" - }, - { - "type": "input_dummy" - }, - ], - "message1": FIELD_MESSAGE, - "args1": FIELD_ARGS, - "message2": TYPE_MESSAGE, - "args2": TYPE_ARGS, - "previousStatement": "Input", - "nextStatement": "Input", - "colour": 210, - "tooltip": "A statement socket for enclosed vertical stacks.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=246" - }); - }, - onchange: function() { - inputNameCheck(this); - } -}; - -Blockly.Blocks['input_dummy'] = { - // Dummy input. - init: function() { - this.jsonInit({ - "message0": "dummy input", - "message1": FIELD_MESSAGE, - "args1": FIELD_ARGS, - "previousStatement": "Input", - "nextStatement": "Input", - "colour": 210, - "tooltip": "For adding fields on a separate row with no " + - "connections. Alignment options (left, right, centre) " + - "apply only to multi-line fields.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=293" - }); - } -}; - -Blockly.Blocks['field_static'] = { - // Text value. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('text') - .appendField(new Blockly.FieldTextInput(''), 'TEXT'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Static text that serves as a label.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=88'); - } -}; - -Blockly.Blocks['field_input'] = { - // Text input. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('text input') - .appendField(new Blockly.FieldTextInput('default'), 'TEXT') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('An input field for the user to enter text.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=319'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_number'] = { - // Numeric input. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('numeric input') - .appendField(new Blockly.FieldNumber(0), 'VALUE') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.appendDummyInput() - .appendField('min') - .appendField(new Blockly.FieldNumber(-Infinity), 'MIN') - .appendField('max') - .appendField(new Blockly.FieldNumber(Infinity), 'MAX') - .appendField('precision') - .appendField(new Blockly.FieldNumber(0, 0), 'PRECISION'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('An input field for the user to enter a number.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=319'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_angle'] = { - // Angle input. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('angle input') - .appendField(new Blockly.FieldAngle('90'), 'ANGLE') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('An input field for the user to enter an angle.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=372'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_dropdown'] = { - // Dropdown menu. - init: function() { - this.appendDummyInput() - .appendField('dropdown') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.optionCount_ = 3; - this.updateShape_(); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setMutator(new Blockly.Mutator(['field_dropdown_option'])); - this.setColour(160); - this.setTooltip('Dropdown menu with a list of options.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=386'); - }, - mutationToDom: function(workspace) { - // Create XML to represent menu options. - var container = Blockly.utils.xml.createElement('mutation'); - container.setAttribute('options', this.optionCount_); - return container; - }, - domToMutation: function(container) { - // Parse XML to restore the menu options. - this.optionCount_ = parseInt(container.getAttribute('options'), 10); - this.updateShape_(); - }, - decompose: function(workspace) { - // Populate the mutator's dialog with this block's components. - var containerBlock = workspace.newBlock('field_dropdown_container'); - containerBlock.initSvg(); - var connection = containerBlock.getInput('STACK').connection; - for (var i = 0; i < this.optionCount_; i++) { - var optionBlock = workspace.newBlock('field_dropdown_option'); - optionBlock.initSvg(); - connection.connect(optionBlock.previousConnection); - connection = optionBlock.nextConnection; - } - return containerBlock; - }, - compose: function(containerBlock) { - // Reconfigure this block based on the mutator dialog's components. - var optionBlock = containerBlock.getInputTargetBlock('STACK'); - // Count number of inputs. - var data = []; - while (optionBlock) { - data.push([optionBlock.userData_, optionBlock.cpuData_]); - optionBlock = optionBlock.nextConnection && - optionBlock.nextConnection.targetBlock(); - } - this.optionCount_ = data.length; - this.updateShape_(); - // Restore any data. - for (var i = 0; i < this.optionCount_; i++) { - this.setFieldValue(data[i][0] || 'option', 'USER' + i); - this.setFieldValue(data[i][1] || 'OPTIONNAME', 'CPU' + i); - } - }, - saveConnections: function(containerBlock) { - // Store names and values for each option. - var optionBlock = containerBlock.getInputTargetBlock('STACK'); - var i = 0; - while (optionBlock) { - optionBlock.userData_ = this.getFieldValue('USER' + i); - optionBlock.cpuData_ = this.getFieldValue('CPU' + i); - i++; - optionBlock = optionBlock.nextConnection && - optionBlock.nextConnection.targetBlock(); - } - }, - updateShape_: function() { - // Modify this block to have the correct number of options. - // Add new options. - for (var i = 0; i < this.optionCount_; i++) { - if (!this.getInput('OPTION' + i)) { - this.appendDummyInput('OPTION' + i) - .appendField(new Blockly.FieldTextInput('option'), 'USER' + i) - .appendField(',') - .appendField(new Blockly.FieldTextInput('OPTIONNAME'), 'CPU' + i); - } - } - // Remove deleted options. - while (this.getInput('OPTION' + i)) { - this.removeInput('OPTION' + i); - i++; - } - }, - onchange: function() { - if (this.workspace && this.optionCount_ < 1) { - this.setWarningText('Drop down menu must\nhave at least one option.'); - } else { - fieldNameCheck(this); - } - } -}; - -Blockly.Blocks['field_dropdown_container'] = { - // Container. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('add options'); - this.appendStatementInput('STACK'); - this.setTooltip('Add, remove, or reorder options\n' + - 'to reconfigure this dropdown menu.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=386'); - this.contextMenu = false; - } -}; - -Blockly.Blocks['field_dropdown_option'] = { - // Add option. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('option'); - this.setPreviousStatement(true); - this.setNextStatement(true); - this.setTooltip('Add a new option to the dropdown menu.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=386'); - this.contextMenu = false; - } -}; - -Blockly.Blocks['field_checkbox'] = { - // Checkbox. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('checkbox') - .appendField(new Blockly.FieldCheckbox('TRUE'), 'CHECKED') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Checkbox field.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=485'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_colour'] = { - // Colour input. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('colour') - .appendField(new Blockly.FieldColour('#ff0000'), 'COLOUR') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Colour input field.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=495'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_date'] = { - // Date input. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('date') - .appendField(new Blockly.FieldDate(), 'DATE') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Date input field.'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_variable'] = { - // Dropdown for variables. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('variable') - .appendField(new Blockly.FieldTextInput('item'), 'TEXT') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Dropdown menu for variable names.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=510'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - -Blockly.Blocks['field_image'] = { - // Image. - init: function() { - this.setColour(160); - var src = 'https://www.gstatic.com/codesite/ph/images/star_on.gif'; - this.appendDummyInput() - .appendField('image') - .appendField(new Blockly.FieldTextInput(src), 'SRC'); - this.appendDummyInput() - .appendField('width') - .appendField(new Blockly.FieldNumber('15', 0, NaN, 1), 'WIDTH') - .appendField('height') - .appendField(new Blockly.FieldNumber('15', 0, NaN, 1), 'HEIGHT') - .appendField('alt text') - .appendField(new Blockly.FieldTextInput('*'), 'ALT'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Static image (JPEG, PNG, GIF, SVG, BMP).\n' + - 'Retains aspect ratio regardless of height and width.\n' + - 'Alt text is for when collapsed.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=567'); - } -}; - -Blockly.Blocks['type_group'] = { - // Group of types. - init: function() { - this.typeCount_ = 2; - this.updateShape_(); - this.setOutput(true, 'Type'); - this.setMutator(new Blockly.Mutator(['type_group_item'])); - this.setColour(230); - this.setTooltip('Allows more than one type to be accepted.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=677'); - }, - mutationToDom: function(workspace) { - // Create XML to represent a group of types. - var container = Blockly.utils.xml.createElement('mutation'); - container.setAttribute('types', this.typeCount_); - return container; - }, - domToMutation: function(container) { - // Parse XML to restore the group of types. - this.typeCount_ = parseInt(container.getAttribute('types'), 10); - this.updateShape_(); - for (var i = 0; i < this.typeCount_; i++) { - this.removeInput('TYPE' + i); - } - for (var i = 0; i < this.typeCount_; i++) { - var input = this.appendValueInput('TYPE' + i) - .setCheck('Type'); - if (i == 0) { - input.appendField('any of'); - } - } - }, - decompose: function(workspace) { - // Populate the mutator's dialog with this block's components. - var containerBlock = workspace.newBlock('type_group_container'); - containerBlock.initSvg(); - var connection = containerBlock.getInput('STACK').connection; - for (var i = 0; i < this.typeCount_; i++) { - var typeBlock = workspace.newBlock('type_group_item'); - typeBlock.initSvg(); - connection.connect(typeBlock.previousConnection); - connection = typeBlock.nextConnection; - } - return containerBlock; - }, - compose: function(containerBlock) { - // Reconfigure this block based on the mutator dialog's components. - var typeBlock = containerBlock.getInputTargetBlock('STACK'); - // Count number of inputs. - var connections = []; - while (typeBlock) { - connections.push(typeBlock.valueConnection_); - typeBlock = typeBlock.nextConnection && - typeBlock.nextConnection.targetBlock(); - } - // Disconnect any children that don't belong. - for (var i = 0; i < this.typeCount_; i++) { - var connection = this.getInput('TYPE' + i).connection.targetConnection; - if (connection && connections.indexOf(connection) == -1) { - connection.disconnect(); - } - } - this.typeCount_ = connections.length; - this.updateShape_(); - // Reconnect any child blocks. - for (var i = 0; i < this.typeCount_; i++) { - Blockly.Mutator.reconnect(connections[i], this, 'TYPE' + i); - } - }, - saveConnections: function(containerBlock) { - // Store a pointer to any connected child blocks. - var typeBlock = containerBlock.getInputTargetBlock('STACK'); - var i = 0; - while (typeBlock) { - var input = this.getInput('TYPE' + i); - typeBlock.valueConnection_ = input && input.connection.targetConnection; - i++; - typeBlock = typeBlock.nextConnection && - typeBlock.nextConnection.targetBlock(); - } - }, - updateShape_: function() { - // Modify this block to have the correct number of inputs. - // Add new inputs. - for (var i = 0; i < this.typeCount_; i++) { - if (!this.getInput('TYPE' + i)) { - var input = this.appendValueInput('TYPE' + i); - if (i == 0) { - input.appendField('any of'); - } - } - } - // Remove deleted inputs. - while (this.getInput('TYPE' + i)) { - this.removeInput('TYPE' + i); - i++; - } - } -}; - -Blockly.Blocks['type_group_container'] = { - // Container. - init: function() { - this.jsonInit({ - "message0": "add types %1 %2", - "args0": [ - {"type": "input_dummy"}, - {"type": "input_statement", "name": "STACK"} - ], - "colour": 230, - "tooltip": "Add, or remove allowed type.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=677" - }); - } -}; - -Blockly.Blocks['type_group_item'] = { - // Add type. - init: function() { - this.jsonInit({ - "message0": "type", - "previousStatement": null, - "nextStatement": null, - "colour": 230, - "tooltip": "Add a new allowed type.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=677" - }); - } -}; - -Blockly.Blocks['type_null'] = { - // Null type. - valueType: null, - init: function() { - this.jsonInit({ - "message0": "any", - "output": "Type", - "colour": 230, - "tooltip": "Any type is allowed.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602" - }); - } -}; - -Blockly.Blocks['type_boolean'] = { - // Boolean type. - valueType: 'Boolean', - init: function() { - this.jsonInit({ - "message0": "Boolean", - "output": "Type", - "colour": 230, - "tooltip": "Booleans (true/false) are allowed.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602" - }); - } -}; - -Blockly.Blocks['type_number'] = { - // Number type. - valueType: 'Number', - init: function() { - this.jsonInit({ - "message0": "Number", - "output": "Type", - "colour": 230, - "tooltip": "Numbers (int/float) are allowed.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602" - }); - } -}; - -Blockly.Blocks['type_string'] = { - // String type. - valueType: 'String', - init: function() { - this.jsonInit({ - "message0": "String", - "output": "Type", - "colour": 230, - "tooltip": "Strings (text) are allowed.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602" - }); - } -}; - -Blockly.Blocks['type_list'] = { - // List type. - valueType: 'Array', - init: function() { - this.jsonInit({ - "message0": "Array", - "output": "Type", - "colour": 230, - "tooltip": "Arrays (lists) are allowed.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602" - }); - } -}; - -Blockly.Blocks['type_other'] = { - // Other type. - init: function() { - this.jsonInit({ - "message0": "other %1", - "args0": [{"type": "field_input", "name": "TYPE", "text": ""}], - "output": "Type", - "colour": 230, - "tooltip": "Custom type to allow.", - "helpUrl": "https://www.youtube.com/watch?v=s2_xaEvcVI0#t=702" - }); - } -}; - -Blockly.Blocks['colour_hue'] = { - // Set the colour of the block. - init: function() { - this.appendDummyInput() - .appendField('hue:') - .appendField(new Blockly.FieldAngle('0', this.validator), 'HUE'); - this.setOutput(true, 'Colour'); - this.setTooltip('Paint the block with this colour.'); - this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=55'); - }, - validator: function(text) { - // Update the current block's colour to match. - var hue = parseInt(text, 10); - if (!isNaN(hue)) { - this.sourceBlock_.setColour(hue); - } - }, - mutationToDom: function(workspace) { - var container = Blockly.utils.xml.createElement('mutation'); - container.setAttribute('colour', this.getColour()); - return container; - }, - domToMutation: function(container) { - this.setColour(container.getAttribute('colour')); - } -}; - -/** - * Check to see if more than one field has this name. - * Highly inefficient (On^2), but n is small. - * @param {!Blockly.Block} referenceBlock Block to check. - */ -function fieldNameCheck(referenceBlock) { - if (!referenceBlock.workspace) { - // Block has been deleted. - return; - } - var name = referenceBlock.getFieldValue('FIELDNAME').toLowerCase(); - var count = 0; - var blocks = referenceBlock.workspace.getAllBlocks(false); - for (var i = 0, block; block = blocks[i]; i++) { - var otherName = block.getFieldValue('FIELDNAME'); - if (!block.disabled && !block.getInheritedDisabled() && - otherName && otherName.toLowerCase() == name) { - count++; - } - } - var msg = (count > 1) ? - 'There are ' + count + ' field blocks\n with this name.' : null; - referenceBlock.setWarningText(msg); -} - -/** - * Check to see if more than one input has this name. - * Highly inefficient (On^2), but n is small. - * @param {!Blockly.Block} referenceBlock Block to check. - */ -function inputNameCheck(referenceBlock) { - if (!referenceBlock.workspace) { - // Block has been deleted. - return; - } - var name = referenceBlock.getFieldValue('INPUTNAME').toLowerCase(); - var count = 0; - var blocks = referenceBlock.workspace.getAllBlocks(false); - for (var i = 0, block; block = blocks[i]; i++) { - var otherName = block.getFieldValue('INPUTNAME'); - if (!block.disabled && !block.getInheritedDisabled() && - otherName && otherName.toLowerCase() == name) { - count++; - } - } - var msg = (count > 1) ? - 'There are ' + count + ' input blocks\n with this name.' : null; - referenceBlock.setWarningText(msg); -} diff --git a/res/lib/blockly/demos/blockfactory_old/factory.js b/res/lib/blockly/demos/blockfactory_old/factory.js deleted file mode 100644 index fce170a821f6f0cc0eee79723f939bdf0c305bb1..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory_old/factory.js +++ /dev/null @@ -1,848 +0,0 @@ -/** - * @license - * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview JavaScript for Blockly's Block Factory application. - * @author fraser@google.com (Neil Fraser) - */ -'use strict'; - -/** - * Workspace for user to build block. - * @type {Blockly.Workspace} - */ -var mainWorkspace = null; - -/** - * Workspace for preview of block. - * @type {Blockly.Workspace} - */ -var previewWorkspace = null; - -/** - * Name of block if not named. - */ -var UNNAMED = 'unnamed'; - -/** - * Change the language code format. - */ -function formatChange() { - var mask = document.getElementById('blocklyMask'); - var languagePre = document.getElementById('languagePre'); - var languageTA = document.getElementById('languageTA'); - if (document.getElementById('format').value == 'Manual') { - Blockly.hideChaff(); - mask.style.display = 'block'; - languagePre.style.display = 'none'; - languageTA.style.display = 'block'; - var code = languagePre.textContent.trim(); - languageTA.value = code; - languageTA.focus(); - updatePreview(); - } else { - mask.style.display = 'none'; - languageTA.style.display = 'none'; - languagePre.style.display = 'block'; - updateLanguage(); - } - disableEnableLink(); -} - -/** - * Update the language code based on constructs made in Blockly. - */ -function updateLanguage() { - var rootBlock = getRootBlock(); - if (!rootBlock) { - return; - } - var blockType = rootBlock.getFieldValue('NAME').trim().toLowerCase(); - if (!blockType) { - blockType = UNNAMED; - } - blockType = blockType.replace(/\W/g, '_').replace(/^(\d)/, '_\\1'); - switch (document.getElementById('format').value) { - case 'JSON': - var code = formatJson_(blockType, rootBlock); - break; - case 'JavaScript': - var code = formatJavaScript_(blockType, rootBlock); - break; - } - injectCode(code, 'languagePre'); - updatePreview(); -} - -/** - * Update the language code as JSON. - * @param {string} blockType Name of block. - * @param {!Blockly.Block} rootBlock Factory_base block. - * @return {string} Generanted language code. - * @private - */ -function formatJson_(blockType, rootBlock) { - var JS = {}; - // Type is not used by Blockly, but may be used by a loader. - JS.type = blockType; - // Generate inputs. - var message = []; - var args = []; - var contentsBlock = rootBlock.getInputTargetBlock('INPUTS'); - var lastInput = null; - while (contentsBlock) { - if (!contentsBlock.disabled && !contentsBlock.getInheritedDisabled()) { - var fields = getFieldsJson_(contentsBlock.getInputTargetBlock('FIELDS')); - for (var i = 0; i < fields.length; i++) { - if (typeof fields[i] == 'string') { - message.push(fields[i].replace(/%/g, '%%')); - } else { - args.push(fields[i]); - message.push('%' + args.length); - } - } - - var input = {type: contentsBlock.type}; - // Dummy inputs don't have names. Other inputs do. - if (contentsBlock.type != 'input_dummy') { - input.name = contentsBlock.getFieldValue('INPUTNAME'); - } - var check = JSON.parse(getOptTypesFrom(contentsBlock, 'TYPE') || 'null'); - if (check) { - input.check = check; - } - var align = contentsBlock.getFieldValue('ALIGN'); - if (align != 'LEFT') { - input.align = align; - } - args.push(input); - message.push('%' + args.length); - lastInput = contentsBlock; - } - contentsBlock = contentsBlock.nextConnection && - contentsBlock.nextConnection.targetBlock(); - } - // Remove last input if dummy and not empty. - if (lastInput && lastInput.type == 'input_dummy') { - var fields = lastInput.getInputTargetBlock('FIELDS'); - if (fields && getFieldsJson_(fields).join('').trim() != '') { - var align = lastInput.getFieldValue('ALIGN'); - if (align != 'LEFT') { - JS.lastDummyAlign0 = align; - } - args.pop(); - message.pop(); - } - } - JS.message0 = message.join(' '); - if (args.length) { - JS.args0 = args; - } - // Generate inline/external switch. - if (rootBlock.getFieldValue('INLINE') == 'EXT') { - JS.inputsInline = false; - } else if (rootBlock.getFieldValue('INLINE') == 'INT') { - JS.inputsInline = true; - } - // Generate output, or next/previous connections. - switch (rootBlock.getFieldValue('CONNECTIONS')) { - case 'LEFT': - JS.output = - JSON.parse(getOptTypesFrom(rootBlock, 'OUTPUTTYPE') || 'null'); - break; - case 'BOTH': - JS.previousStatement = - JSON.parse(getOptTypesFrom(rootBlock, 'TOPTYPE') || 'null'); - JS.nextStatement = - JSON.parse(getOptTypesFrom(rootBlock, 'BOTTOMTYPE') || 'null'); - break; - case 'TOP': - JS.previousStatement = - JSON.parse(getOptTypesFrom(rootBlock, 'TOPTYPE') || 'null'); - break; - case 'BOTTOM': - JS.nextStatement = - JSON.parse(getOptTypesFrom(rootBlock, 'BOTTOMTYPE') || 'null'); - break; - } - // Generate colour. - var colourBlock = rootBlock.getInputTargetBlock('COLOUR'); - if (colourBlock && !colourBlock.disabled) { - var hue = parseInt(colourBlock.getFieldValue('HUE'), 10); - JS.colour = hue; - } - JS.tooltip = ''; - JS.helpUrl = 'http://www.example.com/'; - return JSON.stringify(JS, null, ' '); -} - -/** - * Update the language code as JavaScript. - * @param {string} blockType Name of block. - * @param {!Blockly.Block} rootBlock Factory_base block. - * @return {string} Generanted language code. - * @private - */ -function formatJavaScript_(blockType, rootBlock) { - var code = []; - code.push("Blockly.Blocks['" + blockType + "'] = {"); - code.push(" init: function() {"); - // Generate inputs. - var TYPES = {'input_value': 'appendValueInput', - 'input_statement': 'appendStatementInput', - 'input_dummy': 'appendDummyInput'}; - var contentsBlock = rootBlock.getInputTargetBlock('INPUTS'); - while (contentsBlock) { - if (!contentsBlock.disabled && !contentsBlock.getInheritedDisabled()) { - var name = ''; - // Dummy inputs don't have names. Other inputs do. - if (contentsBlock.type != 'input_dummy') { - name = escapeString(contentsBlock.getFieldValue('INPUTNAME')); - } - code.push(' this.' + TYPES[contentsBlock.type] + '(' + name + ')'); - var check = getOptTypesFrom(contentsBlock, 'TYPE'); - if (check) { - code.push(' .setCheck(' + check + ')'); - } - var align = contentsBlock.getFieldValue('ALIGN'); - if (align != 'LEFT') { - code.push(' .setAlign(Blockly.ALIGN_' + align + ')'); - } - var fields = getFieldsJs_(contentsBlock.getInputTargetBlock('FIELDS')); - for (var i = 0; i < fields.length; i++) { - code.push(' .appendField(' + fields[i] + ')'); - } - // Add semicolon to last line to finish the statement. - code[code.length - 1] += ';'; - } - contentsBlock = contentsBlock.nextConnection && - contentsBlock.nextConnection.targetBlock(); - } - // Generate inline/external switch. - if (rootBlock.getFieldValue('INLINE') == 'EXT') { - code.push(' this.setInputsInline(false);'); - } else if (rootBlock.getFieldValue('INLINE') == 'INT') { - code.push(' this.setInputsInline(true);'); - } - // Generate output, or next/previous connections. - switch (rootBlock.getFieldValue('CONNECTIONS')) { - case 'LEFT': - code.push(connectionLineJs_('setOutput', 'OUTPUTTYPE')); - break; - case 'BOTH': - code.push(connectionLineJs_('setPreviousStatement', 'TOPTYPE')); - code.push(connectionLineJs_('setNextStatement', 'BOTTOMTYPE')); - break; - case 'TOP': - code.push(connectionLineJs_('setPreviousStatement', 'TOPTYPE')); - break; - case 'BOTTOM': - code.push(connectionLineJs_('setNextStatement', 'BOTTOMTYPE')); - break; - } - // Generate colour. - var colourBlock = rootBlock.getInputTargetBlock('COLOUR'); - if (colourBlock && !colourBlock.disabled) { - var hue = parseInt(colourBlock.getFieldValue('HUE'), 10); - if (!isNaN(hue)) { - code.push(' this.setColour(' + hue + ');'); - } - } - code.push(" this.setTooltip('');"); - code.push(" this.setHelpUrl('http://www.example.com/');"); - code.push(' }'); - code.push('};'); - return code.join('\n'); -} - -/** - * Create JS code required to create a top, bottom, or value connection. - * @param {string} functionName JavaScript function name. - * @param {string} typeName Name of type input. - * @return {string} Line of JavaScript code to create connection. - * @private - */ -function connectionLineJs_(functionName, typeName) { - var type = getOptTypesFrom(getRootBlock(), typeName); - if (type) { - type = ', ' + type; - } else { - type = ''; - } - return ' this.' + functionName + '(true' + type + ');'; -} - -/** - * Returns field strings and any config. - * @param {!Blockly.Block} block Input block. - * @return {!Array.<string>} Field strings. - * @private - */ -function getFieldsJs_(block) { - var fields = []; - while (block) { - if (!block.disabled && !block.getInheritedDisabled()) { - switch (block.type) { - case 'field_static': - // Result: 'hello' - fields.push(escapeString(block.getFieldValue('TEXT'))); - break; - case 'field_input': - // Result: new Blockly.FieldTextInput('Hello'), 'GREET' - fields.push('new Blockly.FieldTextInput(' + - escapeString(block.getFieldValue('TEXT')) + '), ' + - escapeString(block.getFieldValue('FIELDNAME'))); - break; - case 'field_number': - // Result: new Blockly.FieldNumber(10, 0, 100, 1), 'NUMBER' - var args = [ - Number(block.getFieldValue('VALUE')), - Number(block.getFieldValue('MIN')), - Number(block.getFieldValue('MAX')), - Number(block.getFieldValue('PRECISION')) - ]; - // Remove any trailing arguments that aren't needed. - if (args[3] == 0) { - args.pop(); - if (args[2] == Infinity) { - args.pop(); - if (args[1] == -Infinity) { - args.pop(); - } - } - } - fields.push('new Blockly.FieldNumber(' + args.join(', ') + '), ' + - escapeString(block.getFieldValue('FIELDNAME'))); - break; - case 'field_angle': - // Result: new Blockly.FieldAngle(90), 'ANGLE' - fields.push('new Blockly.FieldAngle(' + - Number(block.getFieldValue('ANGLE')) + '), ' + - escapeString(block.getFieldValue('FIELDNAME'))); - break; - case 'field_checkbox': - // Result: new Blockly.FieldCheckbox('TRUE'), 'CHECK' - fields.push('new Blockly.FieldCheckbox(' + - escapeString(block.getFieldValue('CHECKED')) + '), ' + - escapeString(block.getFieldValue('FIELDNAME'))); - break; - case 'field_colour': - // Result: new Blockly.FieldColour('#ff0000'), 'COLOUR' - fields.push('new Blockly.FieldColour(' + - escapeString(block.getFieldValue('COLOUR')) + '), ' + - escapeString(block.getFieldValue('FIELDNAME'))); - break; - case 'field_date': - // Result: new Blockly.FieldDate('2015-02-04'), 'DATE' - fields.push('new Blockly.FieldDate(' + - escapeString(block.getFieldValue('DATE')) + '), ' + - escapeString(block.getFieldValue('FIELDNAME'))); - break; - case 'field_variable': - // Result: new Blockly.FieldVariable('item'), 'VAR' - var varname = escapeString(block.getFieldValue('TEXT') || null); - fields.push('new Blockly.FieldVariable(' + varname + '), ' + - escapeString(block.getFieldValue('FIELDNAME'))); - break; - case 'field_dropdown': - // Result: - // new Blockly.FieldDropdown([['yes', '1'], ['no', '0']]), 'TOGGLE' - var options = []; - for (var i = 0; i < block.optionCount_; i++) { - options[i] = '[' + escapeString(block.getFieldValue('USER' + i)) + - ', ' + escapeString(block.getFieldValue('CPU' + i)) + ']'; - } - if (options.length) { - fields.push('new Blockly.FieldDropdown([' + - options.join(', ') + ']), ' + - escapeString(block.getFieldValue('FIELDNAME'))); - } - break; - case 'field_image': - // Result: new Blockly.FieldImage('http://...', 80, 60, '*') - var src = escapeString(block.getFieldValue('SRC')); - var width = Number(block.getFieldValue('WIDTH')); - var height = Number(block.getFieldValue('HEIGHT')); - var alt = escapeString(block.getFieldValue('ALT')); - fields.push('new Blockly.FieldImage(' + - src + ', ' + width + ', ' + height + ', ' + alt + ')'); - break; - } - } - block = block.nextConnection && block.nextConnection.targetBlock(); - } - return fields; -} - -/** - * Returns field strings and any config. - * @param {!Blockly.Block} block Input block. - * @return {!Array.<string|!Object>} Array of static text and field configs. - * @private - */ -function getFieldsJson_(block) { - var fields = []; - while (block) { - if (!block.disabled && !block.getInheritedDisabled()) { - switch (block.type) { - case 'field_static': - // Result: 'hello' - fields.push(block.getFieldValue('TEXT')); - break; - case 'field_input': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - text: block.getFieldValue('TEXT') - }); - break; - case 'field_number': - var obj = { - type: block.type, - name: block.getFieldValue('FIELDNAME'), - value: Number(block.getFieldValue('VALUE')) - }; - var min = Number(block.getFieldValue('MIN')); - if (min > -Infinity) { - obj.min = min; - } - var max = Number(block.getFieldValue('MAX')); - if (max < Infinity) { - obj.max = max; - } - var precision = Number(block.getFieldValue('PRECISION')); - if (precision) { - obj.precision = precision; - } - fields.push(obj); - break; - case 'field_angle': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - angle: Number(block.getFieldValue('ANGLE')) - }); - break; - case 'field_checkbox': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - checked: block.getFieldValue('CHECKED') == 'TRUE' - }); - break; - case 'field_colour': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - colour: block.getFieldValue('COLOUR') - }); - break; - case 'field_date': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - date: block.getFieldValue('DATE') - }); - break; - case 'field_variable': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - variable: block.getFieldValue('TEXT') || null - }); - break; - case 'field_dropdown': - var options = []; - for (var i = 0; i < block.optionCount_; i++) { - options[i] = [block.getFieldValue('USER' + i), - block.getFieldValue('CPU' + i)]; - } - if (options.length) { - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - options: options - }); - } - break; - case 'field_image': - fields.push({ - type: block.type, - src: block.getFieldValue('SRC'), - width: Number(block.getFieldValue('WIDTH')), - height: Number(block.getFieldValue('HEIGHT')), - alt: block.getFieldValue('ALT') - }); - break; - } - } - block = block.nextConnection && block.nextConnection.targetBlock(); - } - return fields; -} - -/** - * Escape a string. - * @param {string} string String to escape. - * @return {string} Escaped string surrouned by quotes. - */ -function escapeString(string) { - return JSON.stringify(string); -} - -/** - * Fetch the type(s) defined in the given input. - * Format as a string for appending to the generated code. - * @param {!Blockly.Block} block Block with input. - * @param {string} name Name of the input. - * @return {?string} String defining the types. - */ -function getOptTypesFrom(block, name) { - var types = getTypesFrom_(block, name); - if (types.length == 0) { - return undefined; - } else if (types.indexOf('null') != -1) { - return 'null'; - } else if (types.length == 1) { - return types[0]; - } else { - return '[' + types.join(', ') + ']'; - } -} - -/** - * Fetch the type(s) defined in the given input. - * @param {!Blockly.Block} block Block with input. - * @param {string} name Name of the input. - * @return {!Array.<string>} List of types. - * @private - */ -function getTypesFrom_(block, name) { - var typeBlock = block.getInputTargetBlock(name); - var types; - if (!typeBlock || typeBlock.disabled) { - types = []; - } else if (typeBlock.type == 'type_other') { - types = [escapeString(typeBlock.getFieldValue('TYPE'))]; - } else if (typeBlock.type == 'type_group') { - types = []; - for (var i = 0; i < typeBlock.typeCount_; i++) { - types = types.concat(getTypesFrom_(typeBlock, 'TYPE' + i)); - } - // Remove duplicates. - var hash = Object.create(null); - for (var n = types.length - 1; n >= 0; n--) { - if (hash[types[n]]) { - types.splice(n, 1); - } - hash[types[n]] = true; - } - } else { - types = [escapeString(typeBlock.valueType)]; - } - return types; -} - -/** - * Update the generator code. - * @param {!Blockly.Block} block Rendered block in preview workspace. - */ -function updateGenerator(block) { - function makeVar(root, name) { - name = name.toLowerCase().replace(/\W/g, '_'); - return ' var ' + root + '_' + name; - } - var language = document.getElementById('language').value; - var code = []; - code.push("Blockly." + language + "['" + block.type + - "'] = function(block) {"); - - // Generate getters for any fields or inputs. - for (var i = 0, input; input = block.inputList[i]; i++) { - for (var j = 0, field; field = input.fieldRow[j]; j++) { - var name = field.name; - if (!name) { - continue; - } - if (field instanceof Blockly.FieldVariable) { - // Subclass of Blockly.FieldDropdown, must test first. - code.push(makeVar('variable', name) + - " = Blockly." + language + - ".variableDB_.getName(block.getFieldValue('" + name + - "'), Blockly.Variables.NAME_TYPE);"); - } else if (field instanceof Blockly.FieldAngle) { - // Subclass of Blockly.FieldTextInput, must test first. - code.push(makeVar('angle', name) + - " = block.getFieldValue('" + name + "');"); - } else if (Blockly.FieldDate && field instanceof Blockly.FieldDate) { - // Blockly.FieldDate may not be compiled into Blockly. - code.push(makeVar('date', name) + - " = block.getFieldValue('" + name + "');"); - } else if (field instanceof Blockly.FieldColour) { - code.push(makeVar('colour', name) + - " = block.getFieldValue('" + name + "');"); - } else if (field instanceof Blockly.FieldCheckbox) { - code.push(makeVar('checkbox', name) + - " = block.getFieldValue('" + name + "') == 'TRUE';"); - } else if (field instanceof Blockly.FieldDropdown) { - code.push(makeVar('dropdown', name) + - " = block.getFieldValue('" + name + "');"); - } else if (field instanceof Blockly.FieldNumber) { - code.push(makeVar('number', name) + - " = block.getFieldValue('" + name + "');"); - } else if (field instanceof Blockly.FieldTextInput) { - code.push(makeVar('text', name) + - " = block.getFieldValue('" + name + "');"); - } - } - var name = input.name; - if (name) { - if (input.type == Blockly.INPUT_VALUE) { - code.push(makeVar('value', name) + - " = Blockly." + language + ".valueToCode(block, '" + name + - "', Blockly." + language + ".ORDER_ATOMIC);"); - } else if (input.type == Blockly.NEXT_STATEMENT) { - code.push(makeVar('statements', name) + - " = Blockly." + language + ".statementToCode(block, '" + - name + "');"); - } - } - } - // Most languages end lines with a semicolon. Python does not. - var lineEnd = { - 'JavaScript': ';', - 'Python': '', - 'PHP': ';', - 'Dart': ';' - }; - code.push(" // TODO: Assemble " + language + " into code variable."); - if (block.outputConnection) { - code.push(" var code = '...';"); - code.push(" // TODO: Change ORDER_NONE to the correct strength."); - code.push(" return [code, Blockly." + language + ".ORDER_NONE];"); - } else { - code.push(" var code = '..." + (lineEnd[language] || '') + "\\n';"); - code.push(" return code;"); - } - code.push("};"); - - injectCode(code.join('\n'), 'generatorPre'); -} - -/** - * Existing direction ('ltr' vs 'rtl') of preview. - */ -var oldDir = null; - -/** - * Update the preview display. - */ -function updatePreview() { - // Toggle between LTR/RTL if needed (also used in first display). - var newDir = document.getElementById('direction').value; - if (oldDir != newDir) { - if (previewWorkspace) { - previewWorkspace.dispose(); - } - var rtl = newDir == 'rtl'; - previewWorkspace = Blockly.inject('preview', - {rtl: rtl, - media: '../../media/', - scrollbars: true}); - oldDir = newDir; - } - previewWorkspace.clear(); - - // Fetch the code and determine its format (JSON or JavaScript). - var format = document.getElementById('format').value; - if (format == 'Manual') { - var code = document.getElementById('languageTA').value; - // If the code is JSON, it will parse, otherwise treat as JS. - try { - JSON.parse(code); - format = 'JSON'; - } catch (e) { - format = 'JavaScript'; - } - } else { - var code = document.getElementById('languagePre').textContent; - } - if (!code.trim()) { - // Nothing to render. Happens while cloud storage is loading. - return; - } - - // Backup Blockly.Blocks object so that main workspace and preview don't - // collide if user creates a 'factory_base' block, for instance. - var backupBlocks = Blockly.Blocks; - try { - // Make a shallow copy. - Blockly.Blocks = {}; - for (var prop in backupBlocks) { - Blockly.Blocks[prop] = backupBlocks[prop]; - } - - if (format == 'JSON') { - var json = JSON.parse(code); - Blockly.Blocks[json.type || UNNAMED] = { - init: function() { - this.jsonInit(json); - } - }; - } else if (format == 'JavaScript') { - eval(code); - } else { - throw 'Unknown format: ' + format; - } - - // Look for a block on Blockly.Blocks that does not match the backup. - var blockType = null; - for (var type in Blockly.Blocks) { - if (typeof Blockly.Blocks[type].init == 'function' && - Blockly.Blocks[type] != backupBlocks[type]) { - blockType = type; - break; - } - } - if (!blockType) { - return; - } - - // Create the preview block. - var previewBlock = previewWorkspace.newBlock(blockType); - previewBlock.initSvg(); - previewBlock.render(); - previewBlock.setMovable(false); - previewBlock.setDeletable(false); - previewBlock.moveBy(15, 10); - previewWorkspace.clearUndo(); - - updateGenerator(previewBlock); - } finally { - Blockly.Blocks = backupBlocks; - } -} - -/** - * Inject code into a pre tag, with syntax highlighting. - * Safe from HTML/script injection. - * @param {string} code Lines of code. - * @param {string} id ID of <pre> element to inject into. - */ -function injectCode(code, id) { - var pre = document.getElementById(id); - pre.textContent = code; - // Remove the 'prettyprinted' class, so that Prettify will recalculate. - pre.className = pre.className.replace('prettyprinted', ''); - PR.prettyPrint(); -} - -/** - * Return the uneditable container block that everything else attaches to. - * @return {Blockly.Block} - */ -function getRootBlock() { - var blocks = mainWorkspace.getTopBlocks(false); - for (var i = 0, block; block = blocks[i]; i++) { - if (block.type == 'factory_base') { - return block; - } - } - return null; -} - -/** - * Disable the link button if the format is 'Manual', enable otherwise. - */ -function disableEnableLink() { - var linkButton = document.getElementById('linkButton'); - linkButton.disabled = document.getElementById('format').value == 'Manual'; -} - -/** - * Initialize Blockly and layout. Called on page load. - */ -function init() { - if ('BlocklyStorage' in window) { - BlocklyStorage.HTTPREQUEST_ERROR = - 'There was a problem with the request.\n'; - BlocklyStorage.LINK_ALERT = - 'Share your blocks with this link:\n\n%1'; - BlocklyStorage.HASH_ERROR = - 'Sorry, "%1" doesn\'t correspond with any saved Blockly file.'; - BlocklyStorage.XML_ERROR = 'Could not load your saved file.\n'+ - 'Perhaps it was created with a different version of Blockly?'; - var linkButton = document.getElementById('linkButton'); - linkButton.style.display = 'inline-block'; - linkButton.addEventListener('click', - function() {BlocklyStorage.link(mainWorkspace);}); - disableEnableLink(); - } - - document.getElementById('helpButton').addEventListener('click', - function() { - open('https://developers.google.com/blockly/guides/create-custom-blocks/block-factory', - 'BlockFactoryHelp'); - }); - - var expandList = [ - document.getElementById('blockly'), - document.getElementById('blocklyMask'), - document.getElementById('preview'), - document.getElementById('languagePre'), - document.getElementById('languageTA'), - document.getElementById('generatorPre') - ]; - var onresize = function(e) { - for (var i = 0, expand; expand = expandList[i]; i++) { - expand.style.width = (expand.parentNode.offsetWidth - 2) + 'px'; - expand.style.height = (expand.parentNode.offsetHeight - 2) + 'px'; - } - }; - onresize(); - window.addEventListener('resize', onresize); - - var toolbox = document.getElementById('toolbox'); - mainWorkspace = Blockly.inject('blockly', - {collapse: false, - toolbox: toolbox, - media: '../../media/'}); - - // Create the root block. - if ('BlocklyStorage' in window && window.location.hash.length > 1) { - BlocklyStorage.retrieveXml(window.location.hash.substring(1), - mainWorkspace); - } else { - var xml = '<xml xmlns="https://developers.google.com/blockly/xml"><block type="factory_base" deletable="false" movable="false"></block></xml>'; - Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(xml), mainWorkspace); - } - mainWorkspace.clearUndo(); - - mainWorkspace.addChangeListener(Blockly.Events.disableOrphans); - mainWorkspace.addChangeListener(updateLanguage); - document.getElementById('direction') - .addEventListener('change', updatePreview); - document.getElementById('languageTA') - .addEventListener('change', updatePreview); - document.getElementById('languageTA') - .addEventListener('keyup', updatePreview); - document.getElementById('format') - .addEventListener('change', formatChange); - document.getElementById('language') - .addEventListener('change', updatePreview); -} -window.addEventListener('load', init); diff --git a/res/lib/blockly/demos/blockfactory_old/icon.png b/res/lib/blockly/demos/blockfactory_old/icon.png deleted file mode 100644 index 4f8b72f41ed08a623502a97f09813f5dff5c9069..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/blockfactory_old/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/blockfactory_old/index.html b/res/lib/blockly/demos/blockfactory_old/index.html deleted file mode 100644 index b03db9127bb9515106a87b15924615c2f375d32d..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/blockfactory_old/index.html +++ /dev/null @@ -1,229 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="target-densitydpi=device-dpi, height=660, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> - <title>Blockly Demo: Block Factory</title> - <script src="/storage.js"></script> - <script src="factory.js"></script> - <script src="../../blockly_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <script src="blocks.js"></script> - <style> - html, body { - height: 100%; - } - body { - background-color: #fff; - font-family: sans-serif; - margin: 0 5px; - overflow: hidden - } - h1 { - font-weight: normal; - font-size: 140%; - } - h3 { - margin-top: 5px; - margin-bottom: 0; - } - table { - height: 100%; - width: 100%; - } - td { - vertical-align: top; - padding: 0; - } - #blockly { - position: fixed; - } - #blocklyMask { - background-color: #000; - cursor: not-allowed; - display: none; - position: fixed; - opacity: 0.2; - z-index: 9; - } - #preview { - position: absolute; - } - pre, - #languageTA { - border: #ddd 1px solid; - margin-top: 0; - position: absolute; - overflow: scroll; - } - #languageTA { - display: none; - font-family: monospace; - font-size: 10pt; - } - - button { - border-radius: 4px; - border: 1px solid #ddd; - background-color: #eee; - color: #000; - padding: 10px; - margin: 0 5px; - font-size: large; - } - button:hover:not(:disabled) { - box-shadow: 2px 2px 5px #888; - } - button:disabled { - opacity: 0.6; - } - button>* { - opacity: 0.6; - vertical-align: text-bottom; - } - button:hover:not(:disabled)>* { - opacity: 1; - } - #linkButton { - display: none; - } - </style> - <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script> -</head> -<body> - <table> - <tr> - <td width="50%" height="5%"> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Block Factory</h1> - </td> - <td width="50%" height="5%"> - <table> - <tr> - <td style="vertical-align: bottom;"> - <h3>Preview: - <select id="direction"> - <option value="ltr">LTR</option> - <option value="rtl">RTL</option> - </select> - </h3> - </td> - <td style="vertical-align: middle; text-align: right;"> - <button id="linkButton" title="Save and link to blocks."> - <img src="link.png" height="21" width="21"> - </button> - <button id="linkButton" title="Save and link to blocks."> - <img src="link.png" height="21" width="21"> - </button> - <button id="helpButton" title="View documentation in new window."> - <span>Help</span> - </button> - </td> - </tr> - </table> - </td> - </tr> - <tr> - <td width="50%" height="95%" style="padding: 2px;"> - <div id="blockly"></div> - <div id="blocklyMask"></div> - </td> - <td width="50%" height="95%"> - <table> - <tr> - <td height="30%"> - <div id="preview"></div> - </td> - </tr> - <tr> - <td height="5%"> - <h3>Language code: - <select id="format"> - <option value="JSON">JSON</option> - <option value="JavaScript">JavaScript</option> - <option value="Manual">Manual edit…</option> - </select> - </h3> - </td> - </tr> - <tr> - <td height="30%"> - <pre id="languagePre" class="prettyprint lang-js"></pre> - <textarea id="languageTA"></textarea> - </td> - </tr> - <tr> - <td height="5%"> - <h3>Generator stub: - <select id="language"> - <option value="JavaScript">JavaScript</option> - <option value="Python">Python</option> - <option value="PHP">PHP</option> - <option value="Lua">Lua</option> - <option value="Dart">Dart</option> - </select> - </h3> - </td> - </tr> - <tr> - <td height="30%"> - <pre id="generatorPre" class="prettyprint lang-js"></pre> - </td> - </tr> - </table> - </td> - </tr> - </table> - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <category name="Input"> - <block type="input_value"> - <value name="TYPE"> - <shadow type="type_null"></shadow> - </value> - </block> - <block type="input_statement"> - <value name="TYPE"> - <shadow type="type_null"></shadow> - </value> - </block> - <block type="input_dummy"></block> - </category> - <category name="Field"> - <block type="field_static"></block> - <block type="field_input"></block> - <block type="field_number"></block> - <block type="field_angle"></block> - <block type="field_dropdown"></block> - <block type="field_checkbox"></block> - <block type="field_colour"></block> - <!-- - Date picker commented out since it increases footprint by 60%. - Add it only if you need it. See also goog.require in blockly.js. - <block type="field_date"></block> - --> - <block type="field_variable"></block> - <block type="field_image"></block> - </category> - <category name="Type"> - <block type="type_group"></block> - <block type="type_null"></block> - <block type="type_boolean"></block> - <block type="type_number"></block> - <block type="type_string"></block> - <block type="type_list"></block> - <block type="type_other"></block> - </category> - <category name="Colour" id="colourCategory"> - <block type="colour_hue"><mutation colour="20"></mutation><field name="HUE">20</field></block> - <block type="colour_hue"><mutation colour="65"></mutation><field name="HUE">65</field></block> - <block type="colour_hue"><mutation colour="120"></mutation><field name="HUE">120</field></block> - <block type="colour_hue"><mutation colour="160"></mutation><field name="HUE">160</field></block> - <block type="colour_hue"><mutation colour="210"></mutation><field name="HUE">210</field></block> - <block type="colour_hue"><mutation colour="230"></mutation><field name="HUE">230</field></block> - <block type="colour_hue"><mutation colour="260"></mutation><field name="HUE">260</field></block> - <block type="colour_hue"><mutation colour="290"></mutation><field name="HUE">290</field></block> - <block type="colour_hue"><mutation colour="330"></mutation><field name="HUE">330</field></block> - </category> - </xml> -</body> -</html> diff --git a/res/lib/blockly/demos/blockfactory_old/link.png b/res/lib/blockly/demos/blockfactory_old/link.png deleted file mode 100644 index 11dfd82845e582b4272969694e305b71226546ff..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/blockfactory_old/link.png and /dev/null differ diff --git a/res/lib/blockly/demos/code/code.js b/res/lib/blockly/demos/code/code.js deleted file mode 100644 index 67cace73cbb2bcf9ce33f34789bb6478f20ed2cc..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/code.js +++ /dev/null @@ -1,550 +0,0 @@ -/** - * @license - * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview JavaScript for Blockly's Code demo. - * @author fraser@google.com (Neil Fraser) - */ -'use strict'; - -/** - * Create a namespace for the application. - */ -var Code = {}; - -/** - * Lookup for names of supported languages. Keys should be in ISO 639 format. - */ -Code.LANGUAGE_NAME = { - 'ar': 'العربية', - 'be-tarask': 'TaraÅ¡kievica', - 'br': 'Brezhoneg', - 'ca': 'Català ', - 'cs': 'ÄŒesky', - 'da': 'Dansk', - 'de': 'Deutsch', - 'el': 'Ελληνικά', - 'en': 'English', - 'es': 'Español', - 'et': 'Eesti', - 'fa': 'ÙØ§Ø±Ø³ÛŒ', - 'fr': 'Français', - 'he': 'עברית', - 'hrx': 'Hunsrik', - 'hu': 'Magyar', - 'ia': 'Interlingua', - 'is': 'Ãslenska', - 'it': 'Italiano', - 'ja': '日本語', - 'kab': 'Kabyle', - 'ko': '한êµì–´', - 'mk': 'МакедонÑки', - 'ms': 'Bahasa Melayu', - 'nb': 'Norsk BokmÃ¥l', - 'nl': 'Nederlands, Vlaams', - 'oc': 'Lenga d\'òc', - 'pl': 'Polski', - 'pms': 'Piemontèis', - 'pt-br': 'Português Brasileiro', - 'ro': 'Română', - 'ru': 'РуÑÑкий', - 'sc': 'Sardu', - 'sk': 'SlovenÄina', - 'sr': 'СрпÑки', - 'sv': 'Svenska', - 'ta': 'தமிழà¯', - 'th': 'ภาษาไทย', - 'tlh': 'tlhIngan Hol', - 'tr': 'Türkçe', - 'uk': 'УкраїнÑька', - 'vi': 'Tiếng Việt', - 'zh-hans': 'ç®€ä½“ä¸æ–‡', - 'zh-hant': 'æ£é«”䏿–‡' -}; - -/** - * List of RTL languages. - */ -Code.LANGUAGE_RTL = ['ar', 'fa', 'he', 'lki']; - -/** - * Blockly's main workspace. - * @type {Blockly.WorkspaceSvg} - */ -Code.workspace = null; - -/** - * Extracts a parameter from the URL. - * If the parameter is absent default_value is returned. - * @param {string} name The name of the parameter. - * @param {string} defaultValue Value to return if parameter not found. - * @return {string} The parameter value or the default value if not found. - */ -Code.getStringParamFromUrl = function(name, defaultValue) { - var val = location.search.match(new RegExp('[?&]' + name + '=([^&]+)')); - return val ? decodeURIComponent(val[1].replace(/\+/g, '%20')) : defaultValue; -}; - -/** - * Get the language of this user from the URL. - * @return {string} User's language. - */ -Code.getLang = function() { - var lang = Code.getStringParamFromUrl('lang', ''); - if (Code.LANGUAGE_NAME[lang] === undefined) { - // Default to English. - lang = 'en'; - } - return lang; -}; - -/** - * Is the current language (Code.LANG) an RTL language? - * @return {boolean} True if RTL, false if LTR. - */ -Code.isRtl = function() { - return Code.LANGUAGE_RTL.indexOf(Code.LANG) != -1; -}; - -/** - * Load blocks saved on App Engine Storage or in session/local storage. - * @param {string} defaultXml Text representation of default blocks. - */ -Code.loadBlocks = function(defaultXml) { - try { - var loadOnce = window.sessionStorage.loadOnceBlocks; - } catch(e) { - // Firefox sometimes throws a SecurityError when accessing sessionStorage. - // Restarting Firefox fixes this, so it looks like a bug. - var loadOnce = null; - } - if ('BlocklyStorage' in window && window.location.hash.length > 1) { - // An href with #key trigers an AJAX call to retrieve saved blocks. - BlocklyStorage.retrieveXml(window.location.hash.substring(1)); - } else if (loadOnce) { - // Language switching stores the blocks during the reload. - delete window.sessionStorage.loadOnceBlocks; - var xml = Blockly.Xml.textToDom(loadOnce); - Blockly.Xml.domToWorkspace(xml, Code.workspace); - } else if (defaultXml) { - // Load the editor with default starting blocks. - var xml = Blockly.Xml.textToDom(defaultXml); - Blockly.Xml.domToWorkspace(xml, Code.workspace); - } else if ('BlocklyStorage' in window) { - // Restore saved blocks in a separate thread so that subsequent - // initialization is not affected from a failed load. - window.setTimeout(BlocklyStorage.restoreBlocks, 0); - } -}; - -/** - * Save the blocks and reload with a different language. - */ -Code.changeLanguage = function() { - // Store the blocks for the duration of the reload. - // MSIE 11 does not support sessionStorage on file:// URLs. - if (window.sessionStorage) { - var xml = Blockly.Xml.workspaceToDom(Code.workspace); - var text = Blockly.Xml.domToText(xml); - window.sessionStorage.loadOnceBlocks = text; - } - - var languageMenu = document.getElementById('languageMenu'); - var newLang = encodeURIComponent( - languageMenu.options[languageMenu.selectedIndex].value); - var search = window.location.search; - if (search.length <= 1) { - search = '?lang=' + newLang; - } else if (search.match(/[?&]lang=[^&]*/)) { - search = search.replace(/([?&]lang=)[^&]*/, '$1' + newLang); - } else { - search = search.replace(/\?/, '?lang=' + newLang + '&'); - } - - window.location = window.location.protocol + '//' + - window.location.host + window.location.pathname + search; -}; - -/** - * Bind a function to a button's click event. - * On touch enabled browsers, ontouchend is treated as equivalent to onclick. - * @param {!Element|string} el Button element or ID thereof. - * @param {!Function} func Event handler to bind. - */ -Code.bindClick = function(el, func) { - if (typeof el == 'string') { - el = document.getElementById(el); - } - el.addEventListener('click', func, true); - el.addEventListener('touchend', func, true); -}; - -/** - * Load the Prettify CSS and JavaScript. - */ -Code.importPrettify = function() { - var script = document.createElement('script'); - script.setAttribute('src', 'https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js'); - document.head.appendChild(script); -}; - -/** - * Compute the absolute coordinates and dimensions of an HTML element. - * @param {!Element} element Element to match. - * @return {!Object} Contains height, width, x, and y properties. - * @private - */ -Code.getBBox_ = function(element) { - var height = element.offsetHeight; - var width = element.offsetWidth; - var x = 0; - var y = 0; - do { - x += element.offsetLeft; - y += element.offsetTop; - element = element.offsetParent; - } while (element); - return { - height: height, - width: width, - x: x, - y: y - }; -}; - -/** - * User's language (e.g. "en"). - * @type {string} - */ -Code.LANG = Code.getLang(); - -/** - * List of tab names. - * @private - */ -Code.TABS_ = ['blocks', 'javascript', 'php', 'python', 'dart', 'lua', 'xml']; - -Code.selected = 'blocks'; - -/** - * Switch the visible pane when a tab is clicked. - * @param {string} clickedName Name of tab clicked. - */ -Code.tabClick = function(clickedName) { - // If the XML tab was open, save and render the content. - if (document.getElementById('tab_xml').className == 'tabon') { - var xmlTextarea = document.getElementById('content_xml'); - var xmlText = xmlTextarea.value; - var xmlDom = null; - try { - xmlDom = Blockly.Xml.textToDom(xmlText); - } catch (e) { - var q = - window.confirm(MSG['badXml'].replace('%1', e)); - if (!q) { - // Leave the user on the XML tab. - return; - } - } - if (xmlDom) { - Code.workspace.clear(); - Blockly.Xml.domToWorkspace(xmlDom, Code.workspace); - } - } - - if (document.getElementById('tab_blocks').className == 'tabon') { - Code.workspace.setVisible(false); - } - // Deselect all tabs and hide all panes. - for (var i = 0; i < Code.TABS_.length; i++) { - var name = Code.TABS_[i]; - document.getElementById('tab_' + name).className = 'taboff'; - document.getElementById('content_' + name).style.visibility = 'hidden'; - } - - // Select the active tab. - Code.selected = clickedName; - document.getElementById('tab_' + clickedName).className = 'tabon'; - // Show the selected pane. - document.getElementById('content_' + clickedName).style.visibility = - 'visible'; - Code.renderContent(); - if (clickedName == 'blocks') { - Code.workspace.setVisible(true); - } - Blockly.svgResize(Code.workspace); -}; - -/** - * Populate the currently selected pane with content generated from the blocks. - */ -Code.renderContent = function() { - var content = document.getElementById('content_' + Code.selected); - // Initialize the pane. - if (content.id == 'content_xml') { - var xmlTextarea = document.getElementById('content_xml'); - var xmlDom = Blockly.Xml.workspaceToDom(Code.workspace); - var xmlText = Blockly.Xml.domToPrettyText(xmlDom); - xmlTextarea.value = xmlText; - xmlTextarea.focus(); - } else if (content.id == 'content_javascript') { - Code.attemptCodeGeneration(Blockly.JavaScript); - } else if (content.id == 'content_python') { - Code.attemptCodeGeneration(Blockly.Python); - } else if (content.id == 'content_php') { - Code.attemptCodeGeneration(Blockly.PHP); - } else if (content.id == 'content_dart') { - Code.attemptCodeGeneration(Blockly.Dart); - } else if (content.id == 'content_lua') { - Code.attemptCodeGeneration(Blockly.Lua); - } - if (typeof PR == 'object') { - PR.prettyPrint(); - } -}; - -/** - * Attempt to generate the code and display it in the UI, pretty printed. - * @param generator {!Blockly.Generator} The generator to use. - */ -Code.attemptCodeGeneration = function(generator) { - var content = document.getElementById('content_' + Code.selected); - content.textContent = ''; - if (Code.checkAllGeneratorFunctionsDefined(generator)) { - var code = generator.workspaceToCode(Code.workspace); - content.textContent = code; - // Remove the 'prettyprinted' class, so that Prettify will recalculate. - content.className = content.className.replace('prettyprinted', ''); - } -}; - -/** - * Check whether all blocks in use have generator functions. - * @param generator {!Blockly.Generator} The generator to use. - */ -Code.checkAllGeneratorFunctionsDefined = function(generator) { - var blocks = Code.workspace.getAllBlocks(false); - var missingBlockGenerators = []; - for (var i = 0; i < blocks.length; i++) { - var blockType = blocks[i].type; - if (!generator[blockType]) { - if (missingBlockGenerators.indexOf(blockType) == -1) { - missingBlockGenerators.push(blockType); - } - } - } - - var valid = missingBlockGenerators.length == 0; - if (!valid) { - var msg = 'The generator code for the following blocks not specified for ' + - generator.name_ + ':\n - ' + missingBlockGenerators.join('\n - '); - Blockly.alert(msg); // Assuming synchronous. No callback. - } - return valid; -}; - -/** - * Initialize Blockly. Called on page load. - */ -Code.init = function() { - Code.initLanguage(); - - var rtl = Code.isRtl(); - var container = document.getElementById('content_area'); - var onresize = function(e) { - var bBox = Code.getBBox_(container); - for (var i = 0; i < Code.TABS_.length; i++) { - var el = document.getElementById('content_' + Code.TABS_[i]); - el.style.top = bBox.y + 'px'; - el.style.left = bBox.x + 'px'; - // Height and width need to be set, read back, then set again to - // compensate for scrollbars. - el.style.height = bBox.height + 'px'; - el.style.height = (2 * bBox.height - el.offsetHeight) + 'px'; - el.style.width = bBox.width + 'px'; - el.style.width = (2 * bBox.width - el.offsetWidth) + 'px'; - } - // Make the 'Blocks' tab line up with the toolbox. - if (Code.workspace && Code.workspace.toolbox_.width) { - document.getElementById('tab_blocks').style.minWidth = - (Code.workspace.toolbox_.width - 38) + 'px'; - // Account for the 19 pixel margin and on each side. - } - }; - window.addEventListener('resize', onresize, false); - - // The toolbox XML specifies each category name using Blockly's messaging - // format (eg. `<category name="%{BKY_CATLOGIC}">`). - // These message keys need to be defined in `Blockly.Msg` in order to - // be decoded by the library. Therefore, we'll use the `MSG` dictionary that's - // been defined for each language to import each category name message - // into `Blockly.Msg`. - // TODO: Clean up the message files so this is done explicitly instead of - // through this for-loop. - for (var messageKey in MSG) { - if (messageKey.indexOf('cat') == 0) { - Blockly.Msg[messageKey.toUpperCase()] = MSG[messageKey]; - } - } - - // Construct the toolbox XML, replacing translated variable names. - var toolboxText = document.getElementById('toolbox').outerHTML; - toolboxText = toolboxText.replace(/(^|[^%]){(\w+)}/g, - function(m, p1, p2) {return p1 + MSG[p2];}); - var toolboxXml = Blockly.Xml.textToDom(toolboxText); - - Code.workspace = Blockly.inject('content_blocks', - {grid: - {spacing: 25, - length: 3, - colour: '#ccc', - snap: true}, - media: '../../media/', - rtl: rtl, - toolbox: toolboxXml, - zoom: - {controls: true, - wheel: true} - }); - - // Add to reserved word list: Local variables in execution environment (runJS) - // and the infinite loop detection function. - Blockly.JavaScript.addReservedWords('code,timeouts,checkTimeout'); - - Code.loadBlocks(''); - - if ('BlocklyStorage' in window) { - // Hook a save function onto unload. - BlocklyStorage.backupOnUnload(Code.workspace); - } - - Code.tabClick(Code.selected); - - Code.bindClick('trashButton', - function() {Code.discard(); Code.renderContent();}); - Code.bindClick('runButton', Code.runJS); - // Disable the link button if page isn't backed by App Engine storage. - var linkButton = document.getElementById('linkButton'); - if ('BlocklyStorage' in window) { - BlocklyStorage['HTTPREQUEST_ERROR'] = MSG['httpRequestError']; - BlocklyStorage['LINK_ALERT'] = MSG['linkAlert']; - BlocklyStorage['HASH_ERROR'] = MSG['hashError']; - BlocklyStorage['XML_ERROR'] = MSG['xmlError']; - Code.bindClick(linkButton, - function() {BlocklyStorage.link(Code.workspace);}); - } else if (linkButton) { - linkButton.className = 'disabled'; - } - - for (var i = 0; i < Code.TABS_.length; i++) { - var name = Code.TABS_[i]; - Code.bindClick('tab_' + name, - function(name_) {return function() {Code.tabClick(name_);};}(name)); - } - onresize(); - Blockly.svgResize(Code.workspace); - - // Lazy-load the syntax-highlighting. - window.setTimeout(Code.importPrettify, 1); -}; - -/** - * Initialize the page language. - */ -Code.initLanguage = function() { - // Set the HTML's language and direction. - var rtl = Code.isRtl(); - document.dir = rtl ? 'rtl' : 'ltr'; - document.head.parentElement.setAttribute('lang', Code.LANG); - - // Sort languages alphabetically. - var languages = []; - for (var lang in Code.LANGUAGE_NAME) { - languages.push([Code.LANGUAGE_NAME[lang], lang]); - } - var comp = function(a, b) { - // Sort based on first argument ('English', 'РуÑÑкий', '简体å—', etc). - if (a[0] > b[0]) return 1; - if (a[0] < b[0]) return -1; - return 0; - }; - languages.sort(comp); - // Populate the language selection menu. - var languageMenu = document.getElementById('languageMenu'); - languageMenu.options.length = 0; - for (var i = 0; i < languages.length; i++) { - var tuple = languages[i]; - var lang = tuple[tuple.length - 1]; - var option = new Option(tuple[0], lang); - if (lang == Code.LANG) { - option.selected = true; - } - languageMenu.options.add(option); - } - languageMenu.addEventListener('change', Code.changeLanguage, true); - - // Inject language strings. - document.title += ' ' + MSG['title']; - document.getElementById('title').textContent = MSG['title']; - document.getElementById('tab_blocks').textContent = MSG['blocks']; - - document.getElementById('linkButton').title = MSG['linkTooltip']; - document.getElementById('runButton').title = MSG['runTooltip']; - document.getElementById('trashButton').title = MSG['trashTooltip']; -}; - -/** - * Execute the user's code. - * Just a quick and dirty eval. Catch infinite loops. - */ -Code.runJS = function() { - Blockly.JavaScript.INFINITE_LOOP_TRAP = 'checkTimeout();\n'; - var timeouts = 0; - var checkTimeout = function() { - if (timeouts++ > 1000000) { - throw MSG['timeout']; - } - }; - var code = Blockly.JavaScript.workspaceToCode(Code.workspace); - Blockly.JavaScript.INFINITE_LOOP_TRAP = null; - try { - eval(code); - } catch (e) { - alert(MSG['badCode'].replace('%1', e)); - } -}; - -/** - * Discard all blocks from the workspace. - */ -Code.discard = function() { - var count = Code.workspace.getAllBlocks(false).length; - if (count < 2 || - window.confirm(Blockly.Msg['DELETE_ALL_BLOCKS'].replace('%1', count))) { - Code.workspace.clear(); - if (window.location.hash) { - window.location.hash = ''; - } - } -}; - -// Load the Code demo's language strings. -document.write('<script src="msg/' + Code.LANG + '.js"></script>\n'); -// Load Blockly's language strings. -document.write('<script src="../../msg/js/' + Code.LANG + '.js"></script>\n'); - -window.addEventListener('load', Code.init); diff --git a/res/lib/blockly/demos/code/icon.png b/res/lib/blockly/demos/code/icon.png deleted file mode 100644 index feaa92996a439f2fa07ebe8625adca5554125b68..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/code/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/code/icons.png b/res/lib/blockly/demos/code/icons.png deleted file mode 100644 index 7cced7a7ea9a7ebcddf86680cd93166de6b06dcb..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/code/icons.png and /dev/null differ diff --git a/res/lib/blockly/demos/code/index.html b/res/lib/blockly/demos/code/index.html deleted file mode 100644 index fdf083e9520a67df6be5af264f10990834916c33..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/index.html +++ /dev/null @@ -1,388 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <meta name="google" value="notranslate"> - <title>Blockly Demo:</title> - <link rel="stylesheet" href="style.css"> - <script src="/storage.js"></script> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../javascript_compressed.js"></script> - <script src="../../python_compressed.js"></script> - <script src="../../php_compressed.js"></script> - <script src="../../lua_compressed.js"></script> - <script src="../../dart_compressed.js"></script> - <script src="code.js"></script> -</head> -<body> - <table width="100%" height="100%"> - <tr> - <td> - <h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > - <a href="../index.html">Demos</a>‏ > - <span id="title">...</span> - </h1> - </td> - <td class="farSide"> - <select id="languageMenu"></select> - </td> - </tr> - <tr> - <td colspan=2> - <table width="100%"> - <tr id="tabRow" height="1em"> - <td id="tab_blocks" class="tabon">...</td> - <td class="tabmin"> </td> - <td id="tab_javascript" class="taboff">JavaScript</td> - <td class="tabmin"> </td> - <td id="tab_python" class="taboff">Python</td> - <td class="tabmin"> </td> - <td id="tab_php" class="taboff">PHP</td> - <td class="tabmin"> </td> - <td id="tab_lua" class="taboff">Lua</td> - <td class="tabmin"> </td> - <td id="tab_dart" class="taboff">Dart</td> - <td class="tabmin"> </td> - <td id="tab_xml" class="taboff">XML</td> - <td class="tabmax"> - <button id="trashButton" class="notext" title="..."> - <img src='../../media/1x1.gif' class="trash icon21"> - </button> - <button id="linkButton" class="notext" title="..."> - <img src='../../media/1x1.gif' class="link icon21"> - </button> - <button id="runButton" class="notext primary" title="..."> - <img src='../../media/1x1.gif' class="run icon21"> - </button> - </td> - </tr> - </table> - </td> - </tr> - <tr> - <td height="99%" colspan=2 id="content_area"> - </td> - </tr> - </table> - <div id="content_blocks" class="content"></div> - <pre id="content_javascript" class="content prettyprint lang-js"></pre> - <pre id="content_python" class="content prettyprint lang-py"></pre> - <pre id="content_php" class="content prettyprint lang-php"></pre> - <pre id="content_lua" class="content prettyprint lang-lua"></pre> - <pre id="content_dart" class="content prettyprint lang-dart"></pre> - <textarea id="content_xml" class="content" wrap="off"></textarea> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <category name="%{BKY_CATLOGIC}" colour="%{BKY_LOGIC_HUE}"> - <block type="controls_if"></block> - <block type="logic_compare"></block> - <block type="logic_operation"></block> - <block type="logic_negate"></block> - <block type="logic_boolean"></block> - <block type="logic_null"></block> - <block type="logic_ternary"></block> - </category> - <category name="%{BKY_CATLOOPS}" colour="%{BKY_LOOPS_HUE}"> - <block type="controls_repeat_ext"> - <value name="TIMES"> - <shadow type="math_number"> - <field name="NUM">10</field> - </shadow> - </value> - </block> - <block type="controls_whileUntil"></block> - <block type="controls_for"> - <value name="FROM"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="TO"> - <shadow type="math_number"> - <field name="NUM">10</field> - </shadow> - </value> - <value name="BY"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - </block> - <block type="controls_forEach"></block> - <block type="controls_flow_statements"></block> - </category> - <category name="%{BKY_CATMATH}" colour="%{BKY_MATH_HUE}"> - <block type="math_number"> - <field name="NUM">123</field> - </block> - <block type="math_arithmetic"> - <value name="A"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="B"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - </block> - <block type="math_single"> - <value name="NUM"> - <shadow type="math_number"> - <field name="NUM">9</field> - </shadow> - </value> - </block> - <block type="math_trig"> - <value name="NUM"> - <shadow type="math_number"> - <field name="NUM">45</field> - </shadow> - </value> - </block> - <block type="math_constant"></block> - <block type="math_number_property"> - <value name="NUMBER_TO_CHECK"> - <shadow type="math_number"> - <field name="NUM">0</field> - </shadow> - </value> - </block> - <block type="math_round"> - <value name="NUM"> - <shadow type="math_number"> - <field name="NUM">3.1</field> - </shadow> - </value> - </block> - <block type="math_on_list"></block> - <block type="math_modulo"> - <value name="DIVIDEND"> - <shadow type="math_number"> - <field name="NUM">64</field> - </shadow> - </value> - <value name="DIVISOR"> - <shadow type="math_number"> - <field name="NUM">10</field> - </shadow> - </value> - </block> - <block type="math_constrain"> - <value name="VALUE"> - <shadow type="math_number"> - <field name="NUM">50</field> - </shadow> - </value> - <value name="LOW"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="HIGH"> - <shadow type="math_number"> - <field name="NUM">100</field> - </shadow> - </value> - </block> - <block type="math_random_int"> - <value name="FROM"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="TO"> - <shadow type="math_number"> - <field name="NUM">100</field> - </shadow> - </value> - </block> - <block type="math_random_float"></block> - <block type="math_atan2"> - <value name="X"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="Y"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - </block> - </category> - <category name="%{BKY_CATTEXT}" colour="%{BKY_TEXTS_HUE}"> - <block type="text"></block> - <block type="text_join"></block> - <block type="text_append"> - <value name="TEXT"> - <shadow type="text"></shadow> - </value> - </block> - <block type="text_length"> - <value name="VALUE"> - <shadow type="text"> - <field name="TEXT">abc</field> - </shadow> - </value> - </block> - <block type="text_isEmpty"> - <value name="VALUE"> - <shadow type="text"> - <field name="TEXT"></field> - </shadow> - </value> - </block> - <block type="text_indexOf"> - <value name="VALUE"> - <block type="variables_get"> - <field name="VAR">{textVariable}</field> - </block> - </value> - <value name="FIND"> - <shadow type="text"> - <field name="TEXT">abc</field> - </shadow> - </value> - </block> - <block type="text_charAt"> - <value name="VALUE"> - <block type="variables_get"> - <field name="VAR">{textVariable}</field> - </block> - </value> - </block> - <block type="text_getSubstring"> - <value name="STRING"> - <block type="variables_get"> - <field name="VAR">{textVariable}</field> - </block> - </value> - </block> - <block type="text_changeCase"> - <value name="TEXT"> - <shadow type="text"> - <field name="TEXT">abc</field> - </shadow> - </value> - </block> - <block type="text_trim"> - <value name="TEXT"> - <shadow type="text"> - <field name="TEXT">abc</field> - </shadow> - </value> - </block> - <block type="text_print"> - <value name="TEXT"> - <shadow type="text"> - <field name="TEXT">abc</field> - </shadow> - </value> - </block> - <block type="text_prompt_ext"> - <value name="TEXT"> - <shadow type="text"> - <field name="TEXT">abc</field> - </shadow> - </value> - </block> - </category> - <category name="%{BKY_CATLISTS}" colour="%{BKY_LISTS_HUE}"> - <block type="lists_create_with"> - <mutation items="0"></mutation> - </block> - <block type="lists_create_with"></block> - <block type="lists_repeat"> - <value name="NUM"> - <shadow type="math_number"> - <field name="NUM">5</field> - </shadow> - </value> - </block> - <block type="lists_length"></block> - <block type="lists_isEmpty"></block> - <block type="lists_indexOf"> - <value name="VALUE"> - <block type="variables_get"> - <field name="VAR">{listVariable}</field> - </block> - </value> - </block> - <block type="lists_getIndex"> - <value name="VALUE"> - <block type="variables_get"> - <field name="VAR">{listVariable}</field> - </block> - </value> - </block> - <block type="lists_setIndex"> - <value name="LIST"> - <block type="variables_get"> - <field name="VAR">{listVariable}</field> - </block> - </value> - </block> - <block type="lists_getSublist"> - <value name="LIST"> - <block type="variables_get"> - <field name="VAR">{listVariable}</field> - </block> - </value> - </block> - <block type="lists_split"> - <value name="DELIM"> - <shadow type="text"> - <field name="TEXT">,</field> - </shadow> - </value> - </block> - <block type="lists_sort"></block> - </category> - <category name="%{BKY_CATCOLOUR}" colour="%{BKY_COLOUR_HUE}"> - <block type="colour_picker"></block> - <block type="colour_random"></block> - <block type="colour_rgb"> - <value name="RED"> - <shadow type="math_number"> - <field name="NUM">100</field> - </shadow> - </value> - <value name="GREEN"> - <shadow type="math_number"> - <field name="NUM">50</field> - </shadow> - </value> - <value name="BLUE"> - <shadow type="math_number"> - <field name="NUM">0</field> - </shadow> - </value> - </block> - <block type="colour_blend"> - <value name="COLOUR1"> - <shadow type="colour_picker"> - <field name="COLOUR">#ff0000</field> - </shadow> - </value> - <value name="COLOUR2"> - <shadow type="colour_picker"> - <field name="COLOUR">#3333ff</field> - </shadow> - </value> - <value name="RATIO"> - <shadow type="math_number"> - <field name="NUM">0.5</field> - </shadow> - </value> - </block> - </category> - <sep></sep> - <category name="%{BKY_CATVARIABLES}" colour="%{BKY_VARIABLES_HUE}" custom="VARIABLE"></category> - <category name="%{BKY_CATFUNCTIONS}" colour="%{BKY_PROCEDURES_HUE}" custom="PROCEDURE"></category> - </xml> - -</body> -</html> diff --git a/res/lib/blockly/demos/code/msg/ar.js b/res/lib/blockly/demos/code/msg/ar.js deleted file mode 100644 index 952198b21d6e534697e3fa79db71f82f36ab763c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/ar.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "كود", - blocks: "البلوكات", - linkTooltip: "اØÙظ ووصلة إلى البلوكات.", - runTooltip: "شغل البرنامج المعر٠بواسطة البلوكات ÙÙŠ Ù…Ø³Ø§ØØ© العمل.", - badCode: "خطأ ÙÙŠ البرنامج:\n %1", - timeout: "تم تجاوز Ø§Ù„ØØ¯ الأقصى لتكرارات التنÙيذ .", - trashTooltip: "تجاهل كل البلوكات.", - catLogic: "منطق", - catLoops: "الØÙ„قات", - catMath: "رياضيات", - catText: "نص", - catLists: "قوائم", - catColour: "لون", - catVariables: "متغيرات", - catFunctions: "إجراءات", - listVariable: "قائمة", - textVariable: "نص", - httpRequestError: "كانت هناك مشكلة مع هذا الطلب.", - linkAlert: "مشاركة كود بلوكلي الخاص بك مع هذا الرابط:\n %1", - hashError: "عذراً،ال '%1' لا تتواÙÙ‚ مع أي برنامج تم ØÙظه.", - xmlError: "تعذر تØÙ…يل المل٠المØÙوظة الخاصة بك. ربما تم إنشاؤه باستخدام إصدار مختل٠من بلوكلي؟", - badXml: "خطأ ÙÙŠ توزيع ال \"XML\":\n %1\n\nØØ¯Ø¯ 'مواÙÙ‚' للتخلي عن التغييرات أو 'إلغاء الأمر' لمواصلة ØªØØ±ÙŠØ± ال\"XML\"." -}; diff --git a/res/lib/blockly/demos/code/msg/be-tarask.js b/res/lib/blockly/demos/code/msg/be-tarask.js deleted file mode 100644 index 5c8d72264a00b9577973f47cacf568aa12cae06b..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/be-tarask.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Код", - blocks: "Блёкі", - linkTooltip: "Захаваць Ñ– зьвÑзаць з блёкамі.", - runTooltip: "ЗапуÑьціце праграму, вызначаную блёкамі Ñž працоўнай воблаÑьці.", - badCode: "Памылка праграмы:\n%1", - timeout: "Перавышана макÑÑ‹Ð¼Ð°Ð»ÑŒÐ½Ð°Ñ ÐºÐ¾Ð»ÑŒÐºÐ°Ñьць Ñ–Ñ‚ÑрацыÑÑž.", - trashTooltip: "Выдаліць уÑе блёкі.", - catLogic: "Лёгіка", - catLoops: "Петлі", - catMath: "МатÑÐ¼Ð°Ñ‚Ñ‹Ñ‡Ð½Ñ‹Ñ Ñ„Ð¾Ñ€Ð¼ÑƒÐ»Ñ‹", - catText: "ТÑкÑÑ‚", - catLists: "СьпіÑÑ‹", - catColour: "Колер", - catVariables: "ЗьменныÑ", - catFunctions: "Функцыі", - listVariable: "ÑьпіÑ", - textVariable: "Ñ‚ÑкÑÑ‚", - httpRequestError: "Узьнікла праблема з запытам.", - linkAlert: "ПадзÑліцца Вашым блёкам праз гÑтую ÑпаÑылку:\n\n%1", - hashError: "Прабачце, '%1' не адпавÑдае ніводнай захаванай праграме.", - xmlError: "Ðе атрымалаÑÑ Ð·Ð°Ð³Ñ€ÑƒÐ·Ñ–Ñ†ÑŒ захаваны файл. Магчыма, ён быў Ñтвораны з іншай вÑÑ€ÑÑ–Ñй Блёклі?", - badXml: "Памылка ÑынтакÑічнага аналізу XML:\n%1\n\nÐбÑрыце \"ОК\", каб адмовіцца ад зьменаў ці \"СкаÑаваць\" Ð´Ð»Ñ Ð´Ð°Ð»ÐµÐ¹ÑˆÐ°Ð³Ð° Ñ€ÑÐ´Ð°Ð³Ð°Ð²Ð°Ð½ÑŒÐ½Ñ XML." -}; diff --git a/res/lib/blockly/demos/code/msg/br.js b/res/lib/blockly/demos/code/msg/br.js deleted file mode 100644 index 321e28e58dc7338b45ed10c9c164b535501f1bfa..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/br.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Kod", - blocks: "Bloc'hoù", - linkTooltip: "Enrollañ ha liammañ d'ar bloc'hadoù.", - runTooltip: "Lañsañ ar programm termenet gant ar bloc'hadoù en takad labour.", - badCode: "Fazi programm :\n%1", - timeout: "Tizhet eo bet an niver brasañ a iteradurioù seveniñ aotreet.", - trashTooltip: "Disteurel an holl vloc'hoù.", - catLogic: "Poell", - catLoops: "Boukloù", - catMath: "Matematik", - catText: "Testenn", - catLists: "Rolloù", - catColour: "Liv", - catVariables: "Argemmennoù", - catFunctions: "Arc'hwelioù", - listVariable: "roll", - textVariable: "testenn", - httpRequestError: "Ur gudenn zo gant ar reked.", - linkAlert: "Rannañ ho ploc'hoù gant al liamm-mañ :\n\n%1", - hashError: "Digarezit. \"%1\" ne glot gant programm enrollet ebet.", - xmlError: "Ne c'haller ket kargañ ho restr enrollet. Marteze e oa bet krouet gant ur stumm disheñvel eus Blockly ?", - badXml: "Fazi dielfennañ XML :\n%1\n\nDibabit \"Mat eo\" evit dilezel ar c'hemmoù-se pe \"Nullañ\" evit kemmañ an XML c'hoazh." -}; diff --git a/res/lib/blockly/demos/code/msg/ca.js b/res/lib/blockly/demos/code/msg/ca.js deleted file mode 100644 index 2b6d9738eed238ca0fe5f7134b568c959c200dbc..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/ca.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Codi", - blocks: "Blocs", - linkTooltip: "Desa i enllaça als blocs.", - runTooltip: "Executa el programa definit pels blocs de l'à rea de treball.", - badCode: "Error de programa:\n %1", - timeout: "S'ha superat el nombre mà xim d'iteracions d'execució.", - trashTooltip: "Descarta tots els blocs.", - catLogic: "Lògica", - catLoops: "Bucles", - catMath: "Matemà tiques", - catText: "Text", - catLists: "Llistes", - catColour: "Color", - catVariables: "Variables", - catFunctions: "Procediments", - listVariable: "llista", - textVariable: "text", - httpRequestError: "Hi ha hagut un problema amb la sol·licitud.", - linkAlert: "Comparteix els teus blocs amb aquest enllaç: %1", - hashError: "Ho sentim, '%1' no es correspon amb cap fitxer desat de Blockly.", - xmlError: "No s'ha pogut carregar el teu fitxer desat. Potser va ser creat amb una versió diferent de Blockly?", - badXml: "Error d'anà lisi XML:\n%1\n\nSeleccioneu 'Acceptar' per abandonar els vostres canvis, o 'Cancel·lar' per continuar editant l'XML." -}; diff --git a/res/lib/blockly/demos/code/msg/cs.js b/res/lib/blockly/demos/code/msg/cs.js deleted file mode 100644 index 1026511e3a74e32b2949b87d2f80647a3729075a..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/cs.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Kód", - blocks: "Bloky", - linkTooltip: "Ulož a spoj bloky..", - runTooltip: "", - badCode: "Chyba programu:\n%1", - timeout: "Maximum execution iterations exceeded.", - trashTooltip: "Zahodit vÅ¡echny bloky.", - catLogic: "Logika", - catLoops: "SmyÄky", - catMath: "Matematika", - catText: "Text", - catLists: "Seznamy", - catColour: "Barva", - catVariables: "PromÄ›nné", - catFunctions: "Procedury", - listVariable: "seznam", - textVariable: "text", - httpRequestError: "DoÅ¡lo k potÞÃm s požadavkem.", - linkAlert: "SdÃlej bloky tÃmto odkazem: \n\n%1", - hashError: "Omlouváme se, '%1' nesouhlasà s žádným z uložených souborů.", - xmlError: "NepodaÅ™ilo se uložit vás soubor. PravdÄ›podobnÄ› byl vytvoÅ™en jinou verzà Blockly?", - badXml: "Chyba parsovánà XML:\n%1\n\nVybrat \"OK\" pro zahozenà vaÅ¡ich zmÄ›n nebo 'Cancel' k dalÅ¡Ãmu upravovánà XML." -}; diff --git a/res/lib/blockly/demos/code/msg/da.js b/res/lib/blockly/demos/code/msg/da.js deleted file mode 100644 index 089450b2db94152481c076e3e56505d7d00d3c19..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/da.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Kode", - blocks: "Blokke", - linkTooltip: "Gem og link til blokke.", - runTooltip: "Kør programmet, der er defineret af blokkene i arbejdsomrÃ¥det.", - badCode: "Programfejl:\n%1", - timeout: "Maksimale antal udførelsesgentagelser overskredet.", - trashTooltip: "Kassér alle blokke.", - catLogic: "Logik", - catLoops: "Løkker", - catMath: "Matematik", - catText: "Tekst", - catLists: "Lister", - catColour: "Farve", - catVariables: "Variabler", - catFunctions: "Funktioner", - listVariable: "liste", - textVariable: "tekst", - httpRequestError: "Der var et problem med forespørgslen.", - linkAlert: "Del dine blokke med dette link:\n\n%1", - hashError: "Beklager, '%1' passer ikke med nogen gemt Blockly fil.", - xmlError: "Kunne ikke hente din gemte fil. MÃ¥ske er den lavet med en anden udgave af Blockly?", - badXml: "Fejl under fortolkningen af XML:\n%1\n\nVælg 'OK' for at opgive dine ændringer eller 'Afbryd' for at redigere XML-filen yderligere." -}; diff --git a/res/lib/blockly/demos/code/msg/de.js b/res/lib/blockly/demos/code/msg/de.js deleted file mode 100644 index 422f9187d195e77b82df05a3f0d1b72dafc5bf5d..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/de.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Code", - blocks: "Bausteine", - linkTooltip: "Speichern und auf Bausteine verlinken.", - runTooltip: "Das Programm ausführen, das von den Bausteinen im Arbeitsbereich definiert ist.", - badCode: "Programmfehler:\n%1", - timeout: "Die maximalen Ausführungswiederholungen wurden überschritten.", - trashTooltip: "Alle Bausteine verwerfen.", - catLogic: "Logik", - catLoops: "Schleifen", - catMath: "Mathematik", - catText: "Text", - catLists: "Listen", - catColour: "Farbe", - catVariables: "Variablen", - catFunctions: "Funktionen", - listVariable: "Liste", - textVariable: "Text", - httpRequestError: "Mit der Anfrage gab es ein Problem.", - linkAlert: "Teile deine Bausteine mit diesem Link:\n\n%1", - hashError: "„%1“ stimmt leider mit keinem gespeicherten Programm überein.", - xmlError: "Deine gespeicherte Datei konnte nicht geladen werden. Vielleicht wurde sie mit einer anderen Version von Blockly erstellt.", - badXml: "Fehler beim Parsen von XML:\n%1\n\nWähle 'OK' zum Verwerfen deiner Änderungen oder 'Abbrechen' zum weiteren Bearbeiten des XML." -}; diff --git a/res/lib/blockly/demos/code/msg/el.js b/res/lib/blockly/demos/code/msg/el.js deleted file mode 100644 index c63b7a6851f7df29415b6640150cea5ebac128c3..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/el.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Κώδικας", - blocks: "Μπλοκ", - linkTooltip: "ΑποθηκεÏει και συνδÎει σε μπλοκ.", - runTooltip: "Εκτελεί το Ï€ÏόγÏαμμα που οÏίζεται από τα μπλοκ στον χώÏο εÏγασίας.", - badCode: "Σφάλμα Ï€ÏογÏάμματος:\n%1", - timeout: "ΥπÎÏβαση μÎγιστου αÏÎ¹Î¸Î¼Î¿Ï ÎµÏ€Î±Î½Î±Î»Î®ÏˆÎµÏ‰Î½.", - trashTooltip: "ΑπόÏÏιψη όλων των μπλοκ.", - catLogic: "Λογική", - catLoops: "Επαναλήψεις", - catMath: "Μαθηματικά", - catText: "Κείμενο", - catLists: "Λίστες", - catColour: "ΧÏώμα", - catVariables: "ΜεταβλητÎÏ‚", - catFunctions: "ΣυναÏτήσεις", - listVariable: "λίστα", - textVariable: "κείμενο", - httpRequestError: "ΥπήÏξε Ï€Ïόβλημα με το αίτημα.", - linkAlert: "Κοινοποίησε τα μπλοκ σου με αυτόν τον σÏνδεσμο:\n\n%1", - hashError: "Λυπάμαι, το «%1» δεν αντιστοιχεί σε κανÎνα αποθηκευμÎνο Ï€ÏόγÏαμμα.", - xmlError: "Δεν μποÏÏŽ να φοÏτώσω το αποθηκευμÎνο αÏχείο σου. Μήπως δημιουÏγήθηκε από μία παλιότεÏη Îκδοση του Blockly;", - badXml: "Σφάλμα ανάλυσης XML:\n%1\n\nΕπίλεξε «Εντάξει» για να εγκαταλείψεις τις αλλαγÎÏ‚ σου ή «ΑκÏÏωση» για να επεξεÏγαστείς το XML κι άλλο." -}; diff --git a/res/lib/blockly/demos/code/msg/en.js b/res/lib/blockly/demos/code/msg/en.js deleted file mode 100644 index 8d52cf333059cff024ca6aedcfb81ca04c458a30..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/en.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Code", - blocks: "Blocks", - linkTooltip: "Save and link to blocks.", - runTooltip: "Run the program defined by the blocks in the workspace.", - badCode: "Program error:\n%1", - timeout: "Maximum execution iterations exceeded.", - trashTooltip: "Discard all blocks.", - catLogic: "Logic", - catLoops: "Loops", - catMath: "Math", - catText: "Text", - catLists: "Lists", - catColour: "Colour", - catVariables: "Variables", - catFunctions: "Functions", - listVariable: "list", - textVariable: "text", - httpRequestError: "There was a problem with the request.", - linkAlert: "Share your blocks with this link:\n\n%1", - hashError: "Sorry, '%1' doesn't correspond with any saved program.", - xmlError: "Could not load your saved file. Perhaps it was created with a different version of Blockly?", - badXml: "Error parsing XML:\n%1\n\nSelect 'OK' to abandon your changes or 'Cancel' to further edit the XML." -}; diff --git a/res/lib/blockly/demos/code/msg/es.js b/res/lib/blockly/demos/code/msg/es.js deleted file mode 100644 index 24358e368dfc7c290c11f52f12544a236d64a2bb..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/es.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Código", - blocks: "Bloques", - linkTooltip: "Guarda conexión a los bloques.", - runTooltip: "Ejecute el programa definido por los bloques en el área de trabajo.", - badCode: "Error del programa:\n%1", - timeout: "Se excedio el máximo de iteraciones ejecutadas permitidas.", - trashTooltip: "Descartar todos los bloques.", - catLogic: "Lógica", - catLoops: "Secuencias", - catMath: "Matemáticas", - catText: "Texto", - catLists: "Listas", - catColour: "Color", - catVariables: "Variables", - catFunctions: "Funciones", - listVariable: "lista", - textVariable: "texto", - httpRequestError: "Hubo un problema con la petición.", - linkAlert: "Comparte tus bloques con este enlace:\n\n%1", - hashError: "«%1» no corresponde con ningún programa guardado.", - xmlError: "No se pudo cargar el archivo guardado. ¿Quizá fue creado con otra versión de Blockly?", - badXml: "Error de análisis XML:\n%1\n\nSelecciona OK para abandonar tus cambios o Cancelar para seguir editando el XML." -}; diff --git a/res/lib/blockly/demos/code/msg/et.js b/res/lib/blockly/demos/code/msg/et.js deleted file mode 100644 index 320c39174268442f2517b209cb107d7eb42f387a..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/et.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Kood", - blocks: "Plokid", - linkTooltip: "Salvesta ja tekita link plokkidele.", - runTooltip: "Käivita töölaual olevate plokkidega defineeritud programm.", - badCode: "Viga programmis:\n%1", - timeout: "Käivitatavate iteratsioonide maksimaalne arv on ületatud.", - trashTooltip: "Eemalda kõik plokid.", - catLogic: "Loogika", - catLoops: "Kordus", - catMath: "Matemaatika", - catText: "Tekst", - catLists: "Loendid", - catColour: "Värv", - catVariables: "Muutujad", - catFunctions: "Funktsioonid", - listVariable: "loend", - textVariable: "tekst", - httpRequestError: "Probleem päringuga.", - linkAlert: "Oma plokke saad jagada selle lingiga:\n\n%1", - hashError: "Vabandust, kuid '%1' ei vasta ühelegi salvestatud programmile.", - xmlError: "Su salvestatud faili ei õnnestunud laadida. Võibolla on see loodud mõne teise Blockly versiooniga?", - badXml: "Viga XML-i parsimisel:\n%1\n\nTehtud muudatustest loobumiseks vajuta 'OK', XML-i muudatuste tegemise jätkamiseks 'Katkesta'." -}; diff --git a/res/lib/blockly/demos/code/msg/fa.js b/res/lib/blockly/demos/code/msg/fa.js deleted file mode 100644 index 96dd966b00341889f36be61ad9979bd356cc95d9..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/fa.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "کد", - blocks: "بلوک‌ها", - linkTooltip: "ذخیره Ùˆ پیوند به بلوک‌ها.", - runTooltip: "اجرای برنامهٔ تعریÙ‌شده توسط بلوک‌ها در ÙØ¶Ø§ÛŒ کار.", - badCode: "خطای برنامه:\n%1", - timeout: "ØØ¯Ø§Ú©Ø«Ø± تکرارهای اجرا رد شده‌است.", - trashTooltip: "دورریختن همهٔ بلوک‌ها.", - catLogic: "منطق", - catLoops: "ØÙ„قه‌ها", - catMath: "ریاضی", - catText: "متن", - catLists: "Ùهرست‌ها", - catColour: "رنگ", - catVariables: "متغییرها", - catFunctions: "توابع", - listVariable: "Ùهرست", - textVariable: "متن", - httpRequestError: "مشکلی با درخواست وجود داشت.", - linkAlert: "اشتراک‌گذاری بلاک‌هایتان با این پیوند:\n\n%1", - hashError: "شرمنده، «%1» با هیچ برنامهٔ ذخیره‌شده‌ای تطبیق پیدا نکرد.", - xmlError: "نتوانست پروندهٔ ذخیرهٔ شما بارگیری شود. Ø§ØØªÙ…الاً با نسخهٔ Ù…ØªÙØ§ÙˆØªÛŒ از بلوکی درست شده‌است؟", - badXml: "خطای تجزیهٔ اکس‌ام‌ال:\n%1\n\n«باشد» را برای ذخیره Ùˆ Â«ÙØ³Ø®Â» را برای ویرایش بیشتر اکس‌ام‌ال انتخاب کنید." -}; diff --git a/res/lib/blockly/demos/code/msg/fr.js b/res/lib/blockly/demos/code/msg/fr.js deleted file mode 100644 index 60181131adbaedda78d85693c8b32e27a7241d16..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/fr.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Code", - blocks: "Blocs", - linkTooltip: "Sauvegarder et lier aux blocs.", - runTooltip: "Lancer le programme défini par les blocs dans l’espace de travail.", - badCode: "Erreur du programme :\n%1", - timeout: "Nombre maximum d’itérations d’exécution dépassé.", - trashTooltip: "Jeter tous les blocs.", - catLogic: "Logique", - catLoops: "Boucles", - catMath: "Math", - catText: "Texte", - catLists: "Listes", - catColour: "Couleur", - catVariables: "Variables", - catFunctions: "Fonctions", - listVariable: "liste", - textVariable: "texte", - httpRequestError: "Il y a eu un problème avec la demande.", - linkAlert: "Partagez vos blocs grâce à ce lien:\n\n%1", - hashError: "Désolé, '%1' ne correspond à aucun programme sauvegardé.", - xmlError: "Impossible de charger le fichier de sauvegarde. Peut être a t-il été créé avec une autre version de Blockly?", - badXml: "Erreur d’analyse du XML :\n%1\n\nSélectionner 'OK' pour abandonner vos modifications ou 'Annuler' pour continuer à modifier le XML." -}; diff --git a/res/lib/blockly/demos/code/msg/he.js b/res/lib/blockly/demos/code/msg/he.js deleted file mode 100644 index dc2826620db8f999baf1ce4de0b3a0fa53293150..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/he.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "קוד", - blocks: "קטעי קוד", - linkTooltip: "שמירה וקישור לקטעי קוד.", - runTooltip: "הרצת ×”×ª×›× ×™×ª שהוגדרה על ידי קטעי הקוד שבמרחב העבודה.", - badCode: "שגי××” ×‘×ª×›× ×™×ª: %1", - timeout: "חריגה ממספר פעולות חוזרות ×פשריות.", - trashTooltip: "השלך ×ת כל קטעי הקוד.", - catLogic: "לוגיקה", - catLoops: "לול×ות", - catMath: "מתמטיקה", - catText: "טקסט", - catLists: "רשימות", - catColour: "צבע", - catVariables: "×ž×©×ª× ×™×", - catFunctions: "×¤×•× ×§×¦×™×•×ª", - listVariable: "רשימה", - textVariable: "טקסט", - httpRequestError: "הבקשה × ×›×©×œ×”.", - linkAlert: "× ×™×ª×Ÿ לשתף ×ת קטעי הקוד שלך ב×מצעות קישור ×–×”:\n\n%1", - hashError: "×œ×¦×¢×¨× ×•, '%1' ××™× × ×• מת××™× ×œ××£ ×חת ×ž×”×ª×•×›× ×™×•×ª השמורות", - xmlError: "× ×¡×™×•×Ÿ ×”×˜×¢×™× ×” של הקובץ השמור שלך × ×›×©×œ. ×”×× ×™×™×ª×›×Ÿ ×©×”×•× × ×•×¦×¨ ×‘×’×¨×¡× ×©×•× ×” של בלוקלי?", - badXml: "תקלה ×‘×¤×¢× ×•×— XML:\n\n%1\n\n× × ×œ×‘×—×•×¨ '×ישור' כדי ×œ× ×˜×•×© ×ת ×”×©×™× ×•×™×™× ×©×œ×š ×ו 'ביטול' כדי להמשיך ולערוך ×ת ×”Ö¾XML." -}; diff --git a/res/lib/blockly/demos/code/msg/hrx.js b/res/lib/blockly/demos/code/msg/hrx.js deleted file mode 100644 index ca0dea3fc3c2a40185e2ddd70ec02488f5126ce9..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/hrx.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Code", - blocks: "Bausten", - linkTooltip: "Speichre und auf Bausten verlinke.", - runTooltip: "Das Programm ausfüahre, das von den Bausten im Oorweitsbereich definiert ist.", - badCode: "Programmfehler:\n%1", - timeout: "Die maximale Ausführungswiederholunge woore üwerschritt.", - trashTooltip: "All Bausten verwerfe.", - catLogic: "Logik", - catLoops: "Schleife", - catMath: "Mathematik", - catText: "Text", - catLists: "Liste", - catColour: "Farreb", - catVariables: "Variable", - catFunctions: "Funktione", - listVariable: "List", - textVariable: "Text", - httpRequestError: "Mit der Oonfroch hots en Problem geb.", - linkAlert: "Tel von dein Bausten mit dem Link:\n\n%1", - hashError: "„%1“ stimmt leider mit kenem üweren gespeicherte Programm.", - xmlError: "Dein gespeicherte Datei könnt net gelood sin. Vielleicht woard se mit ener annre Version von Blockly erstellt.", - badXml: "Fehler beim Parse von XML:\n%1\n\nWähle 'OK' zum Verwerfe von deiner Ändrunge orrer 'Abbreche' zum XML weiter beoorbeite." -}; diff --git a/res/lib/blockly/demos/code/msg/hu.js b/res/lib/blockly/demos/code/msg/hu.js deleted file mode 100644 index eee1868634a74965abb09e4caf2ae1145cd9bd71..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/hu.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "KódszerkesztÅ‘", - blocks: "Blokkok", - linkTooltip: "Hivatkozás létrehozása", - runTooltip: "Program futtatása.", - badCode: "Program hiba:\n%1", - timeout: "A program elérte a maximális végrehajtási idÅ‘t.", - trashTooltip: "Összes blokk törlése.", - catLogic: "Logikai műveletek", - catLoops: "Ciklusok", - catMath: "Matematikai műveletek", - catText: "Sztring műveletek", - catLists: "Listakezelés", - catColour: "SzÃnek", - catVariables: "Változók", - catFunctions: "Eljárások", - listVariable: "lista", - textVariable: "szöveg", - httpRequestError: "A kéréssel kapcsolatban probléma merült fel.", - linkAlert: "Ezzel a hivatkozással tudod megosztani a programodat:\n\n%1", - hashError: "Sajnos a '%1' hivatkozás nem tartozik egyetlen programhoz sem.", - xmlError: "A programodat nem lehet betölteni. ElképzelhetÅ‘, hogy a Blockly egy másik verziójában készült?", - badXml: "Hiba az XML feldolgozásakor:\n%1\n\nVáltozások elvetése?" -}; diff --git a/res/lib/blockly/demos/code/msg/ia.js b/res/lib/blockly/demos/code/msg/ia.js deleted file mode 100644 index 5938458bb93ef12d81370ed68d35fbfc7cac3c9e..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/ia.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Codice", - blocks: "Blocos", - linkTooltip: "Salveguardar e ligar a blocos.", - runTooltip: "Executar le programma definite per le blocos in le spatio de travalio.", - badCode: "Error del programma:\n%1", - timeout: "Le numero de iterationes executate ha excedite le maximo.", - trashTooltip: "Abandonar tote le blocos.", - catLogic: "Logica", - catLoops: "Buclas", - catMath: "Mathematica", - catText: "Texto", - catLists: "Listas", - catColour: "Color", - catVariables: "Variabiles", - catFunctions: "Functiones", - listVariable: "lista", - textVariable: "texto", - httpRequestError: "Il habeva un problema con le requesta.", - linkAlert: "Divide tu blocos con iste ligamine:\n\n%1", - hashError: "Infelicemente, '%1' non corresponde a alcun programma salveguardate.", - xmlError: "Impossibile cargar le file salveguardate. Pote esser que illo ha essite create con un altere version de Blockly?", - badXml: "Error de analyse del XML:\n%1\n\nSelige 'OK' pro abandonar le modificationes o 'Cancellar' pro continuar a modificar le codice XML." -}; diff --git a/res/lib/blockly/demos/code/msg/is.js b/res/lib/blockly/demos/code/msg/is.js deleted file mode 100644 index fa5c40d80a34b36d6f8e28fdeb5ee76bbe31ab32..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/is.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Kóði", - blocks: "Kubbar", - linkTooltip: "Vista og tengja við kubba.", - runTooltip: "Keyra forritið sem kubbarnir á vinnusvæðinu mynda.", - badCode: "Villa à forriti:\n%1", - timeout: "Forritið hefur endurtekið sig of oft.", - trashTooltip: "Fleygja öllum kubbum.", - catLogic: "RökvÃsi", - catLoops: "Lykkjur", - catMath: "Reikningur", - catText: "Texti", - catLists: "Listar", - catColour: "Litir", - catVariables: "Breytur", - catFunctions: "Stefjur", - listVariable: "listi", - textVariable: "texti", - httpRequestError: "Það kom upp vandamál með beiðnina.", - linkAlert: "Deildu kubbunum þÃnum með þessari krækju:", - hashError: "Þvà miður, '%1' passar ekki við neitt vistað forrit.", - xmlError: "Gat ekki hlaðið vistuðu skrána þÃna. Var hún kannske búin til à annarri útgáfu af Blockly?", - badXml: "Villa við úrvinnslu XML:\n%1\n\nVeldu 'à lagi' til að sleppa breytingum eða 'Hætta við' til að halda áfram með XML." -}; diff --git a/res/lib/blockly/demos/code/msg/it.js b/res/lib/blockly/demos/code/msg/it.js deleted file mode 100644 index cd69b66b318aec19b0ecad3b6eecd0cb7fc3489d..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/it.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Codice", - blocks: "Blocchi", - linkTooltip: "Salva e collega ai blocchi.", - runTooltip: "Esegui il programma definito dai blocchi nell'area di lavoro.", - badCode: "Errore programma:\n%1", - timeout: "È stato superato il numero massimo consentito di interazioni eseguite.", - trashTooltip: "Elimina tutti i blocchi.", - catLogic: "Logica", - catLoops: "Cicli", - catMath: "Matematica", - catText: "Testo", - catLists: "Elenchi", - catColour: "Colore", - catVariables: "Variabili", - catFunctions: "Funzioni", - listVariable: "elenco", - textVariable: "testo", - httpRequestError: "La richiesta non è stata soddisfatta.", - linkAlert: "Condividi i tuoi blocchi con questo collegamento:\n\n%1", - hashError: "Mi spiace, '%1' non corrisponde ad alcun programma salvato.", - xmlError: "Non è stato possibile caricare il documento. Forse è stato creato con una versione diversa di Blockly?", - badXml: "Errore durante l'analisi XML:\n%1\n\nSeleziona 'OK' per abbandonare le modifiche o 'Annulla' per continuare a modificare l'XML." -}; diff --git a/res/lib/blockly/demos/code/msg/ja.js b/res/lib/blockly/demos/code/msg/ja.js deleted file mode 100644 index 6d50419825dc2e85ed85fa8d69be525fa026a7d5..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/ja.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "コード", - blocks: "ブãƒãƒƒã‚¯", - linkTooltip: "ブãƒãƒƒã‚¯ã®çŠ¶æ…‹ã‚’ä¿å˜ã—ã¦ãƒªãƒ³ã‚¯ã‚’å–å¾—ã—ã¾ã™ã€‚", - runTooltip: "ブãƒãƒƒã‚¯ã§ä½œæˆã—ãŸãƒ—ãƒã‚°ãƒ©ãƒ を実行ã—ã¾ã™ã€‚", - badCode: "プãƒã‚°ãƒ©ãƒ ã®ã‚¨ãƒ©ãƒ¼:\n%1", - timeout: "命令ã®å®Ÿè¡Œå›žæ•°ãŒåˆ¶é™å€¤ã‚’è¶…ãˆã¾ã—ãŸã€‚", - trashTooltip: "ã™ã¹ã¦ã®ãƒ–ãƒãƒƒã‚¯ã‚’消ã—ã¾ã™ã€‚", - catLogic: "è«–ç†", - catLoops: "繰り返ã—", - catMath: "æ•°å¦", - catText: "テã‚スト", - catLists: "リスト", - catColour: "色", - catVariables: "変数", - catFunctions: "関数", - listVariable: "リスト", - textVariable: "テã‚スト", - httpRequestError: "ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯æŽ¥ç¶šã®ã‚¨ãƒ©ãƒ¼ã§ã™ã€‚", - linkAlert: "ブãƒãƒƒã‚¯ã®çŠ¶æ…‹ã‚’ã“ã®ãƒªãƒ³ã‚¯ã§å…±æœ‰ã§ãã¾ã™:\n\n%1", - hashError: "ã™ã¿ã¾ã›ã‚“。「%1ã€ã¨ã„ã†åå‰ã®ãƒ—ãƒã‚°ãƒ©ãƒ ã¯ä¿å˜ã•れã¦ã„ã¾ã›ã‚“。", - xmlError: "ä¿å˜ã•れãŸãƒ•ァイルをèªã¿è¾¼ã‚ã¾ã›ã‚“ã§ã—ãŸã€‚別ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ãƒ–ãƒãƒƒã‚¯ãƒªãƒ¼ã§ä½œæˆã•れãŸå¯èƒ½æ€§ãŒã‚りã¾ã™ã€‚", - badXml: "XML ã®ã‚¨ãƒ©ãƒ¼ã§ã™:\n%1\n\nXML ã®å¤‰æ›´ã‚’ã‚„ã‚ã‚‹ã«ã¯ã€ŒOKã€ã€ç·¨é›†ã‚’ç¶šã‘ã‚‹ã«ã¯ã€Œã‚ャンセルã€ã‚’é¸ã‚“ã§ãã ã•ã„。" -}; diff --git a/res/lib/blockly/demos/code/msg/kab.js b/res/lib/blockly/demos/code/msg/kab.js deleted file mode 100644 index 648ff7fb8370d76f9ab359c28b9c54f429ae95c7..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/kab.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Tangalt", - blocks: "Iḥedran", - linkTooltip: "Sekles sakin cudd ar iḥedran.", - runTooltip: "Senker ahil i d-sbadun iḥedran di tallunt n umahil.", - badCode: "Tuccá¸a deg ahil :\n%1", - timeout: "Amá¸an afellay n wallusen n uselkem iÉ›eddan.", - trashTooltip: "Ḍeggeá¹› akk iḥedran.", - catLogic: "Tameẓla", - catLoops: "Tineddicin", - catMath: "Tusnakt", - catText: "Aá¸ris", - catLists: "Tibdarin", - catColour: "Ini", - catVariables: "Imuttiyen", - catFunctions: "Tiwiriwin", - listVariable: "tabdart", - textVariable: "aá¸ris", - httpRequestError: "yella ugur deg usuter.", - linkAlert: "Bá¸u iḥedran-ik s useqdec n useÉ£wen-agi:\n\n%1", - hashError: "Suref-aÉ£, '%1' ur imená¹aḠulad d yiwen n wahil yettwaskelsen.", - xmlError: "Ur izmir ara ad d-isali afaylu n usekles. Ahatyettwarna s lqem-nniá¸en n Blockly?", - badXml: "Tuccá¸a di tesleá¸t n XML :\n%1\n\nFren 'IH' akken ad tzgleḠasnifel-ik 'Sefsex' akken ad tkemmleḠasnifel n XML." -}; diff --git a/res/lib/blockly/demos/code/msg/ko.js b/res/lib/blockly/demos/code/msg/ko.js deleted file mode 100644 index 990cb6f236b9f3571d29b0097d7abed88ce9c529..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/ko.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "코드", - blocks: "블ë¡", - linkTooltip: "블ë¡ì„ ì €ìž¥í•˜ê³ ë§í¬ë¥¼ ê°€ì ¸ì˜µë‹ˆë‹¤.", - runTooltip: "작업 공간ì—서 블ë¡ìœ¼ë¡œ ì •ì˜ëœ í”„ë¡œê·¸ëž¨ì„ ì‹¤í–‰í•©ë‹ˆë‹¤.", - badCode: "프로그램 오류:\n%1", - timeout: "최대 실행 ë°˜ë³µì„ ì´ˆê³¼í–ˆìŠµë‹ˆë‹¤.", - trashTooltip: "ëª¨ë“ ë¸”ë¡ì„ 버립니다.", - catLogic: "논리", - catLoops: "반복", - catMath: "수학", - catText: "í…스트", - catLists: "목ë¡", - catColour: "색", - catVariables: "변수", - catFunctions: "기능", - listVariable: "목ë¡", - textVariable: "í…스트", - httpRequestError: "ìš”ì²ì— ë¬¸ì œê°€ 있습니다.", - linkAlert: "ë‹¤ìŒ ë§í¬ë¡œ 블ë¡ì„ ê³µìœ í•˜ì„¸ìš”:\n\n%1", - hashError: "죄송하지만 '%1'ì€ ì–´ë–¤ ì €ìž¥ëœ í”„ë¡œê·¸ëž¨ìœ¼ë¡œ ì¼ì¹˜í•˜ì§€ 않습니다.", - xmlError: "ì €ìž¥ëœ íŒŒì¼ì„ 불러올 수 없습니다. 혹시 블ë¡ë¦¬ì˜ 다른 ë²„ì „ìœ¼ë¡œ 만들었습니까?", - badXml: "XML 구문 ë¶„ì„ ì˜¤ë¥˜:\n%1\n\në°”ë€œì„ í¬ê¸°í•˜ë ¤ë©´ '확ì¸'ì„ ì„ íƒí•˜ê³ XMLì„ ë” íŽ¸ì§‘í•˜ë ¤ë©´ '취소'를 ì„ íƒí•˜ì„¸ìš”." -}; diff --git a/res/lib/blockly/demos/code/msg/mk.js b/res/lib/blockly/demos/code/msg/mk.js deleted file mode 100644 index cc344a69ca2b5b65790ae8d8ae4f1c7a79b6b028..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/mk.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Код", - blocks: "Блокчиња", - linkTooltip: "Зачувај и Ñтави врÑка до блокчињата.", - runTooltip: "Пушти го програмот определен од блокчињата во работниот проÑтор.", - badCode: "Грешка во програмот:\n%1", - timeout: "Го надминавте допуштениот број на повторувања во извршувањето.", - trashTooltip: "ОтÑтрани ги Ñите блокчиња.", - catLogic: "Логика", - catLoops: "Јамки", - catMath: "Математика", - catText: "ТекÑÑ‚", - catLists: "СпиÑоци", - catColour: "Боја", - catVariables: "Променливи", - catFunctions: "Функции", - listVariable: "ÑпиÑок", - textVariable: "текÑÑ‚", - httpRequestError: "Се појави проблем во барањето.", - linkAlert: "Споделете ги вашите блокчиња Ñо оваа врÑка:\n\n%1", - hashError: "„%1“ не одговара на ниеден зачуван програм.", - xmlError: "Ðе можев да ја вчитам зачуваната податотека. Да не Ñте ја Ñоздале Ñо друга верзија на Blockly?", - badXml: "Грешка при раÑчленувањето на XML:\n%1\n\nСтиÑнете на „ОК“ за да ги напуштите промените или на „Откажи“ ако Ñакате уште да ја уредувате XML-податотеката." -}; diff --git a/res/lib/blockly/demos/code/msg/ms.js b/res/lib/blockly/demos/code/msg/ms.js deleted file mode 100644 index 87ee8deef40b79f5661c7bd1b257be548343de00..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/ms.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Kod", - blocks: "Blok", - linkTooltip: "Simpan dan pautkan kepada blok.", - runTooltip: "Jalankan aturcara yang ditetapkan oleh blok-blok di dalam ruang kerja.", - badCode: "Ralat aturcara:\n%1", - timeout: "Takat maksimum lelaran pelaksanaan dicecah.", - trashTooltip: "Buang semua Blok.", - catLogic: "Logik", - catLoops: "Gelung", - catMath: "Matematik", - catText: "Teks", - catLists: "Senarai", - catColour: "Warna", - catVariables: "Pemboleh ubah", - catFunctions: "Fungsi", - listVariable: "senarai", - textVariable: "teks", - httpRequestError: "Permintaan itu terdapat masalah.", - linkAlert: "Kongsikan blok-blok anda dengan pautan ini:\n\n%1", - hashError: "Maaf, '%1' tidak berpadanan dengan sebarang aturcara yang disimpan.", - xmlError: "Fail simpanan anda tidak dapat dimuatkan. Jangan-jangan ia dicipta dengan versi Blockly yang berlainan?", - badXml: "Ralat ketika menghuraikan XML:\n%1\n\nPilih 'OK' untuk melucutkan suntingan anda atau 'Batal' untuk bersambung menyunting XML-nya." -}; diff --git a/res/lib/blockly/demos/code/msg/nb.js b/res/lib/blockly/demos/code/msg/nb.js deleted file mode 100644 index 60ac0394d630856f24b473f68663f7f836ec3fb4..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/nb.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Kode", - blocks: "Blokker", - linkTooltip: "Lagre og lenke til blokker.", - runTooltip: "Kjør programmet definert av blokken i arbeidsomrÃ¥det.", - badCode: "Programfeil:\n%1", - timeout: "Det maksimale antallet utførte looper er oversteget.", - trashTooltip: "Fjern alle blokker", - catLogic: "Logikk", - catLoops: "Looper", - catMath: "Matte", - catText: "Tekst", - catLists: "Lister", - catColour: "Farge", - catVariables: "Variabler", - catFunctions: "Funksjoner", - listVariable: "Liste", - textVariable: "Tekst", - httpRequestError: "Det oppsto et problem med forespørselen din", - linkAlert: "Del dine blokker med denne lenken:\n\n%1", - hashError: "Beklager, '%1' samsvarer ikke med noe lagret program.", - xmlError: "Kunne ikke laste inn filen. Kanskje den ble laget med en annen versjon av Blockly?", - badXml: "Feil ved parsering av XML:\n%1\n\nVelg 'OK' for Ã¥ avbryte endringene eller 'Cancel' for Ã¥ fortsette Ã¥ redigere XML-koden." -}; diff --git a/res/lib/blockly/demos/code/msg/nl.js b/res/lib/blockly/demos/code/msg/nl.js deleted file mode 100644 index 339a5e8827ba737a329a7060ba4298890f9c4b41..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/nl.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Code", - blocks: "Blokken", - linkTooltip: "Opslaan en koppelen naar blokken.", - runTooltip: "Voer het programma uit dat met de blokken in de werkruimte is gemaakt.", - badCode: "Programmafout:\n%1", - timeout: "Het maximale aantal iteraties is overschreden.", - trashTooltip: "Alle blokken verwijderen", - catLogic: "Logica", - catLoops: "Lussen", - catMath: "Formules", - catText: "Tekst", - catLists: "Lijsten", - catColour: "Kleur", - catVariables: "Variabelen", - catFunctions: "Functies", - listVariable: "lijst", - textVariable: "tekst", - httpRequestError: "Er is een probleem opgetreden tijdens het verwerken van het verzoek.", - linkAlert: "Deel uw blokken via deze koppeling:\n\n%1", - hashError: "\"%1\" komt helaas niet overeen met een opgeslagen bestand.", - xmlError: "Uw opgeslagen bestand kan niet geladen worden. Is het misschien gemaakt met een andere versie van Blockly?", - badXml: "Fout tijdens het verwerken van de XML:\n%1\n\nSelecteer \"OK\" om uw wijzigingen te negeren of \"Annuleren\" om de XML verder te bewerken." -}; diff --git a/res/lib/blockly/demos/code/msg/oc.js b/res/lib/blockly/demos/code/msg/oc.js deleted file mode 100644 index c184ac8fb27bca4445ea3c1a8cec375c2347ef55..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/oc.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Còde", - blocks: "Blòts", - linkTooltip: "Salva e liga als blòts.", - runTooltip: "Aviar lo programa definit pels blòts dins l’espaci de trabalh.", - badCode: "Error del programa :\n%1", - timeout: "Nombre maximum d’iteracions d’execucion depassat.", - trashTooltip: "Getar totes los blòts.", - catLogic: "Logic", - catLoops: "Boclas", - catMath: "Math", - catText: "Tèxte", - catLists: "Listas", - catColour: "Color", - catVariables: "Variablas", - catFunctions: "Foncions", - listVariable: "lista", - textVariable: "tèxte", - httpRequestError: "I a agut un problèma amb la demanda.", - linkAlert: "Partejatz vòstres blòts grà cia a aqueste ligam :\n\n%1", - hashError: "O planhèm, '%1' correspond pas a un fichièr Blockly salvament.", - xmlError: "Impossible de cargar lo fichièr de salvament. Benlèu qu'es estat creat amb una autra version de Blockly ?", - badXml: "Error d’analisi del XML :\n%1\n\nSeleccionar 'D'acòrdi' per abandonar vòstras modificacions o 'Anullar' per modificar encara lo XML." -}; diff --git a/res/lib/blockly/demos/code/msg/pl.js b/res/lib/blockly/demos/code/msg/pl.js deleted file mode 100644 index 83bb05d2f9f2f62df05f8719d3877f397e21d9de..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/pl.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Kod", - blocks: "Bloki", - linkTooltip: "Zapisz i podlinkuj do bloków", - runTooltip: "Uruchom program zdefinowany przez bloki w obszarze roboczym", - badCode: "Błąd programu:\n%1", - timeout: "Maksymalna liczba iteracji wykonywaÅ„ przekroczona", - trashTooltip: "Odrzuć wszystkie bloki.", - catLogic: "Logika", - catLoops: "PÄ™tle", - catMath: "Matematyka", - catText: "Tekst", - catLists: "Listy", - catColour: "Kolor", - catVariables: "Zmienne", - catFunctions: "Funkcje", - listVariable: "lista", - textVariable: "tekst", - httpRequestError: "WystÄ…piÅ‚ problem z żądaniem.", - linkAlert: "UdpostÄ™pnij swoje bloki korzystajÄ…c z poniższego linku : \n\n\n%1", - hashError: "Przepraszamy, \"%1\" nie odpowiada żadnemu zapisanemu programowi.", - xmlError: "Nie można zaÅ‚adować zapisanego pliku. Być może zostaÅ‚ utworzony za pomocÄ… innej wersji Blockly?", - badXml: "Błąd parsowania XML : \n%1\n\nZaznacz 'OK' aby odrzucić twoje zmiany lub 'Cancel', żeby w przyszÅ‚oÅ›ci edytować XML." -}; diff --git a/res/lib/blockly/demos/code/msg/pms.js b/res/lib/blockly/demos/code/msg/pms.js deleted file mode 100644 index a7704f764d03c94e098b50675628967b0afb147d..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/pms.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Còdes", - blocks: "Blòch", - linkTooltip: "Argistré e lijé ai blòch.", - runTooltip: "Fé andé ël programa definì dai blòch ant lë spassi ëd travaj.", - badCode: "Eror dël programa:\n%1", - timeout: "Nùmer mà ssim d'arpetission d'esecussion sorpassà .", - trashTooltip: "Scarté tuti ij blòch.", - catLogic: "Lògica", - catLoops: "Liasse", - catMath: "Matemà tica", - catText: "Test", - catLists: "Liste", - catColour: "Color", - catVariables: "Varià bij", - catFunctions: "Fonsion", - listVariable: "lista", - textVariable: "test", - httpRequestError: "A-i é staje un problema con l'arcesta.", - linkAlert: "Ch'a partagia ij sò blòch grassie a sta liura: %1", - hashError: "An dëspias, '%1 a corëspond a gnun programa salvà .", - xmlError: "A l'é nen podusse carié so archivi salvà . Miraco a l'é stà it creà con na version diferenta ëd Blockly?", - badXml: "Eror d'anà lisi dl'XML:\n%1\n\nSelessioné 'Va bin' për lassé perde toe modìfiche o 'Anulé' për modifiché ancora l'XML." -}; diff --git a/res/lib/blockly/demos/code/msg/pt-br.js b/res/lib/blockly/demos/code/msg/pt-br.js deleted file mode 100644 index 9b18d6360062c51db3dae5fe8b0b30193fe331ed..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/pt-br.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Código", - blocks: "Blocos", - linkTooltip: "Salvar e ligar aos blocos.", - runTooltip: "Execute o programa definido pelos blocos na área de trabalho.", - badCode: "Erro no programa:\n%1", - timeout: "Máximo de iterações de execução excedido.", - trashTooltip: "Descartar todos os blocos.", - catLogic: "Lógica", - catLoops: "Laços", - catMath: "Matemática", - catText: "Texto", - catLists: "Listas", - catColour: "Cor", - catVariables: "Variáveis", - catFunctions: "Funções", - listVariable: "lista", - textVariable: "texto", - httpRequestError: "Houve um problema com a requisição.", - linkAlert: "Compartilhe seus blocos com este link:\n\n%1", - hashError: "Desculpe, '%1' não corresponde a um programa salvo.", - xmlError: "Não foi possÃvel carregar seu arquivo salvo. Talvez ele tenha sido criado com uma versão diferente do Blockly?", - badXml: "Erro de análise XML:\n%1\n\nSelecione 'OK' para abandonar suas mudanças ou 'Cancelar' para editar o XML." -}; diff --git a/res/lib/blockly/demos/code/msg/ro.js b/res/lib/blockly/demos/code/msg/ro.js deleted file mode 100644 index cd3de11d790aeca518a4a178ba39e10e27e10d27..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/ro.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Cod", - blocks: "Blocuri", - linkTooltip: "Salvează È™i adaugă la blocuri.", - runTooltip: "Execută programul definit de către blocuri în spaÈ›iul de lucru.", - badCode: "Eroare de program:\n%1", - timeout: "Numărul maxim de iteraÈ›ii a fost depășit.", - trashTooltip: "Șterge toate blocurile.", - catLogic: "Logic", - catLoops: "Bucle", - catMath: "Matematică", - catText: "Text", - catLists: "Liste", - catColour: "Culoare", - catVariables: "Variabile", - catFunctions: "FuncÈ›ii", - listVariable: "listă", - textVariable: "text", - httpRequestError: "A apărut o problemă la solicitare.", - linkAlert: "Distribuie-È›i blocurile folosind această legătură:\n\n%1", - hashError: "Scuze, „%1†nu corespunde nici unui program salvat.", - xmlError: "Sistemul nu a putut încărca fiÈ™ierul salvat. Poate că a fost creat cu o altă versiune de Blockly?", - badXml: "Eroare de parsare XML:\n%1\n\nAlege „OK†pentru a renunÈ›a la modificările efectuate sau „Revocare†pentru a modifica în continuare fiÈ™ierul XML." -}; diff --git a/res/lib/blockly/demos/code/msg/ru.js b/res/lib/blockly/demos/code/msg/ru.js deleted file mode 100644 index 389e9052a337a4474dbd971c01172c031517536f..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/ru.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Код", - blocks: "Блоки", - linkTooltip: "Сохранить и показать ÑÑылку на блоки.", - runTooltip: "ЗапуÑтить программу, заданную блоками в рабочей облаÑти.", - badCode: "Ошибка программы:\n%1", - timeout: "Превышено макÑимальное количеÑтво итераций.", - trashTooltip: "Удалить вÑе блоки.", - catLogic: "ЛогичеÑкие", - catLoops: "Циклы", - catMath: "Математика", - catText: "ТекÑÑ‚", - catLists: "СпиÑки", - catColour: "Цвет", - catVariables: "Переменные", - catFunctions: "Функции", - listVariable: "ÑпиÑок", - textVariable: "текÑÑ‚", - httpRequestError: "Произошла проблема при запроÑе.", - linkAlert: "ПоделитеÑÑŒ Ñвоими блоками по Ñтой ÑÑылке:\n\n%1", - hashError: "К Ñожалению, «%1» не ÑоответÑтвует ни одному Ñохраненному файлу Блокли.", - xmlError: "Ðе удалоÑÑŒ загрузить ваш Ñохраненный файл. Возможно, он был Ñоздан в другой верÑии Блокли?", - badXml: "Ошибка ÑинтакÑичеÑкого анализа XML:\n%1\n\nВыберите 'ОК', чтобы отказатьÑÑ Ð¾Ñ‚ изменений или 'Cancel' Ð´Ð»Ñ Ð´Ð°Ð»ÑŒÐ½ÐµÐ¹ÑˆÐµÐ³Ð¾ Ñ€ÐµÐ´Ð°ÐºÑ‚Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ XML." -}; diff --git a/res/lib/blockly/demos/code/msg/sc.js b/res/lib/blockly/demos/code/msg/sc.js deleted file mode 100644 index 82f94d61d053744a5f9f9cbd5a1c65fe3cb4736d..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/sc.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Còdixi", - blocks: "Brocus", - linkTooltip: "Sarva e alliòngia a is brocus.", - runTooltip: "Arròllia su programa cumpostu de is brocus in s'à rea de traballu.", - badCode: "Errori in su Programa:\n%1", - timeout: "Giai lòmpius a su mà ssimu numeru de repicus.", - trashTooltip: "Boganci totu is brocus.", - catLogic: "Lògica", - catLoops: "Lòrigas", - catMath: "Matemà tica", - catText: "Testu", - catLists: "Lista", - catColour: "Colori", - catVariables: "Variabilis", - catFunctions: "Funtzionis", - listVariable: "lista", - textVariable: "testu", - httpRequestError: "Ddui fut unu problema cun sa pregunta", - linkAlert: "Poni is brocus tuus in custu acà piu:\n\n%1", - hashError: "Mi dispraxit, '%1' non torrat a pari cun nimancu unu de is programas sarvaus.", - xmlError: "Non potzu carrigai su file sarvau. Fortzis est stètiu fatu cun d-una versioni diferenti de Blockly?", - badXml: "Errori in s'anà lisi XML:\n%1\n\nCraca 'OK' po perdi is mudà ntzias 'Anudda' po sighì a scriri su XML." -}; diff --git a/res/lib/blockly/demos/code/msg/sk.js b/res/lib/blockly/demos/code/msg/sk.js deleted file mode 100644 index 3917df293eedebb63f4b506a1bd1c08a3702816a..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/sk.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Kód", - blocks: "Bloky", - linkTooltip: "UložiÅ¥ a zdieľaÅ¥ odkaz na tento program.", - runTooltip: "SpustiÅ¥ program, zložený z dielcov na pracovnej ploche.", - badCode: "Chyba v programe:\n%1", - timeout: "Bol prekroÄený maximálny poÄet opakovanÃ.", - trashTooltip: "ZahodiÅ¥ vÅ¡etky dielce.", - catLogic: "Logika", - catLoops: "Cykly", - catMath: "Matematické", - catText: "Text", - catLists: "Zoznamy", - catColour: "Farby", - catVariables: "Premenné", - catFunctions: "Funkcie", - listVariable: "zoznam", - textVariable: "text", - httpRequestError: "Problém so spracovanÃm požiadavky.", - linkAlert: "ZdieľaÅ¥ tento program skopÃrovanÃm odkazu\n\n%1", - hashError: "PrepáÄ, '%1' nie je meno žiadnemu uloženému programu.", - xmlError: "Nebolo možné naÄÃtaÅ¥ uložený súbor. Možno bol vytvorený v inej verzii Blocky.", - badXml: "Chyba pri parsovanà XML:\n%1\n\nStlaÄte 'OK' ak chcete zruÅ¡iÅ¥ zmeny alebo 'ZruÅ¡iÅ¥' pre pokraÄovanie v úpravách XML." -}; diff --git a/res/lib/blockly/demos/code/msg/sr.js b/res/lib/blockly/demos/code/msg/sr.js deleted file mode 100644 index f9a026ca0880384a6f9ecb65dd905e8742bf7dd7..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/sr.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Кôд", - blocks: "Блокови", - linkTooltip: "Сачувајте и повежите Ñа блоковима.", - runTooltip: "Покрените програм заÑнован на блоковима у радном проÑтору.", - badCode: "Грешка у програму:\n%1", - timeout: "ДоÑтигнут је макÑималан број понављања у извршавању.", - trashTooltip: "Одбаците Ñве блокове.", - catLogic: "Логика", - catLoops: "Петље", - catMath: "Математика", - catText: "ТекÑÑ‚", - catLists: "СпиÑкови", - catColour: "Боја", - catVariables: "Променљиве", - catFunctions: "Процедуре", - listVariable: "ÑпиÑак", - textVariable: "текÑÑ‚", - httpRequestError: "Дошло је до проблема у захтеву.", - linkAlert: "Делите Ñвоје блокове овом везом:\n\n%1", - hashError: "„%1“ не одговара ниједном Ñачуваном програму.", - xmlError: "Ðе могу да учитам Ñачувану датотеку. Можда је направљена другом верзијом Blockly-ја.", - badXml: "Грешка при рашчлањивању XML-а:\n%1\n\nПритиÑните „У реду“ да напуÑтите измене или „Откажи“ да наÑтавите Ñа уређивањем XML датотеке." -}; diff --git a/res/lib/blockly/demos/code/msg/sv.js b/res/lib/blockly/demos/code/msg/sv.js deleted file mode 100644 index 4134a4c7dcd6d5049cc34dfd11efa6dcc532f563..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/sv.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Kod", - blocks: "Block", - linkTooltip: "Spara och länka till block.", - runTooltip: "Kör programmet som definierats av blocken i arbetsytan.", - badCode: "Programfel:\n%1", - timeout: "Det maximala antalet utförda loopar har överskridits.", - trashTooltip: "Släng alla block.", - catLogic: "Logik", - catLoops: "Loopar", - catMath: "Matematik", - catText: "Text", - catLists: "Listor", - catColour: "Färg", - catVariables: "Variabler", - catFunctions: "Funktioner", - listVariable: "lista", - textVariable: "text", - httpRequestError: "Det uppstod ett problem med begäran.", - linkAlert: "Dela dina block med denna länk: \n\n%1", - hashError: "Tyvärr, '%1' överensstämmer inte med nÃ¥got sparat program.", - xmlError: "Kunde inte läsa din sparade fil. Den skapades kanske med en annan version av Blockly?", - badXml: "Fel vid parsning av XML:\n%1\n\nKlicka pÃ¥ 'OK' för att strunta i dina ändringar eller 'Avbryt' för att fortsätta redigera XML-koden." -}; diff --git a/res/lib/blockly/demos/code/msg/ta.js b/res/lib/blockly/demos/code/msg/ta.js deleted file mode 100644 index ff472e2b7e2c9fff2a7bdf7b57174c295e69c587..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/ta.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "கணினி நிரலà¯", //Code - blocks: "நிரல௠தà¯à®£à¯à®Ÿà¯", //block - linkTooltip: "சேமிதà¯à®¤à¯ நிரல௠தà¯à®£à¯à®Ÿà®¿à®±à¯à®•௠இணைகà¯à®•", //save and link to block - runTooltip: "பணிமனை நினைவகதà¯à®¤à®¿à®²à¯ இயகà¯à®•à¯à®•", //Run the program defined by the blocks in the workspace. - badCode: "கணினி நிரல௠கோளாறà¯:\n%1", - timeout: "அதிகபடà¯à®š அடà¯à®•à¯à®•ின௠அளவை மீரியதà¯", //max iters reached/exceeded - trashTooltip: "நீகà¯à®•à¯", - catLogic: "தரà¯à®• வகை", - catLoops: "மடகà¯à®•௠வாகà¯à®•ியமà¯", - catMath: "கணிதமà¯", - catText: "உரை", - catLists: "படà¯à®Ÿà®¿à®¯à®²à¯", - catColour: "வணà¯à®£à®®à¯", - catVariables: "மாறிகளà¯", - catFunctions: "சாரà¯à®ªà¯à®•ளà¯", - listVariable: "படà¯à®Ÿà®¿à®¯à®²à¯ மாறி", - textVariable: "உரை சரமà¯", - httpRequestError: "இநà¯à®¤ செயலை இயகà¯à®•à¯à®µà®¤à®¿à®²à¯ கோளாற௠à®à®±à¯à®ªà®Ÿà¯à®Ÿà®¤à¯", - linkAlert: "இநà¯à®¤ சà¯à®Ÿà¯à®Ÿà®¿ வழியாக நிரல௠தà¯à®£à¯à®Ÿà¯à®•ளை பகிரவà¯à®®à¯:\n\n%1", - hashError: "'%1' : இத௠சேமிதà¯à®¤ நிரலாக தெரியவிலà¯à®²à¯ˆ.", - xmlError: "உஙà¯à®•ளத௠நிரலை காணவிலà¯à®²à¯ˆ; வேற௠Blockly அதà¯à®¤à®¿à®¯à®¾à®¯à®¤à¯à®¤à®¿à®²à¯ சேமிதà¯à®¤à¯€à®°à®¾?", - badXml: "XML பகà¯à®ªà¯à®ªà®¤à®¿à®²à¯ கோளாறà¯:\n%1\n\nOK' கிளிக௠செயà¯à®¤à®¾à®²à¯ மாறà¯à®±à®™à¯à®•ள௠இழபà¯à®ªà¯€à®°à¯à®•ளà¯; பிழைகளà¯à®Ÿà®©à¯ தொடர 'Cancel' கிளிக௠செயà¯à®¯à®µà¯à®®à¯." -}; diff --git a/res/lib/blockly/demos/code/msg/th.js b/res/lib/blockly/demos/code/msg/th.js deleted file mode 100644 index 1ac36245bdde189cdbf40d07d811d66cf6621426..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/th.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "เขียนโปรà¹à¸à¸£à¸¡", - blocks: "บล็à¸à¸", - linkTooltip: "บันทึà¸à¹à¸¥à¸°à¸ªà¸£à¹‰à¸²à¸‡à¸¥à¸´à¸‡à¸à¹Œà¸¡à¸²à¸¢à¸±à¸‡à¸šà¸¥à¹‡à¸à¸à¹€à¸«à¸¥à¹ˆà¸²à¸™à¸µà¹‰", - runTooltip: "เรียà¸à¹ƒà¸Šà¹‰à¹‚ปรà¹à¸à¸£à¸¡à¸•ามที่à¸à¸³à¸«à¸™à¸”ไว้ด้วยบล็à¸à¸à¸—ี่à¸à¸¢à¸¹à¹ˆà¹ƒà¸™à¸žà¸·à¹‰à¸™à¸—ี่ทำงาน", - badCode: "โปรà¹à¸à¸£à¸¡à¹€à¸à¸´à¸”ข้à¸à¸œà¸´à¸”พลาด:\n%1", - timeout: "โปรà¹à¸à¸£à¸¡à¸—ำงานซ้ำคำสั่งเดิมมาà¸à¹€à¸à¸´à¸™à¹„ป", - trashTooltip: "ยà¸à¹€à¸¥à¸´à¸à¸šà¸¥à¹‡à¸à¸à¸—ั้งหมด", - catLogic: "ตรรà¸à¸°", - catLoops: "à¸à¸²à¸£à¸§à¸™à¸‹à¹‰à¸³", - catMath: "คณิตศาสตร์", - catText: "ข้à¸à¸„วาม", - catLists: "รายà¸à¸²à¸£", - catColour: "สี", - catVariables: "ตัวà¹à¸›à¸£", - catFunctions: "ฟังà¸à¹Œà¸Šà¸±à¸™", - listVariable: "รายà¸à¸²à¸£", - textVariable: "ข้à¸à¸„วาม", - httpRequestError: "มีปัà¸à¸«à¸²à¹€à¸à¸µà¹ˆà¸¢à¸§à¸à¸±à¸šà¸à¸²à¸£à¸£à¹‰à¸à¸‡à¸‚à¸", - linkAlert: "à¹à¸šà¹ˆà¸‡à¸›à¸±à¸™à¸šà¸¥à¹‡à¸à¸à¸‚à¸à¸‡à¸„ุณด้วยลิงà¸à¹Œà¸™à¸µà¹‰:\n\n%1", - hashError: "เสียใจด้วย '%1' ไม่ตรงà¸à¸±à¸šà¹‚ปรà¹à¸à¸£à¸¡à¹ƒà¸”ๆ ที่เคยบันทึà¸à¹€à¸à¸²à¹„ว้เลย", - xmlError: "ไม่สามารถโหลดไฟล์ที่บันทึà¸à¹„ว้ขà¸à¸‡à¸„ุณได้ บางทีมันà¸à¸²à¸ˆà¸ˆà¸°à¸–ูà¸à¸ªà¸£à¹‰à¸²à¸‡à¸‚ึ้นด้วย Blockly รุ่นà¸à¸·à¹ˆà¸™à¸—ี่à¹à¸•à¸à¸•่างà¸à¸±à¸™?", - badXml: "เà¸à¸´à¸”ข้à¸à¸œà¸´à¸”พลาดในà¸à¸²à¸£à¹à¸¢à¸à¸§à¸´à¹€à¸„ราะห์ XML:\n%1\n\nเลืà¸à¸ 'ตà¸à¸¥à¸‡' เพื่à¸à¸¥à¸°à¸—ิ้งà¸à¸²à¸£à¹€à¸›à¸¥à¸µà¹ˆà¸¢à¸™à¹à¸›à¸¥à¸‡à¸•่างๆ ที่ทำไว้ หรืà¸à¹€à¸¥à¸·à¸à¸ 'ยà¸à¹€à¸¥à¸´à¸' เพื่à¸à¹à¸à¹‰à¹„ข XML ต่à¸à¹„ป" -}; diff --git a/res/lib/blockly/demos/code/msg/tlh.js b/res/lib/blockly/demos/code/msg/tlh.js deleted file mode 100644 index 8d0c056f9307bc5319d515a9cb16e523ddde8122..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/tlh.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "ngoq", - blocks: "ngoghmey", - linkTooltip: "", - runTooltip: "", - badCode: "Qagh:\n%1", - timeout: "tlhoy nI'qu' poH.", - trashTooltip: "", - catLogic: "meq", - catLoops: "vIHtaHbogh ghomey", - catMath: "mI'QeD", - catText: "ghItlhHommey", - catLists: "tetlhmey", - catColour: "rItlh", - catVariables: "lIwmey", - catFunctions: "mIwmey", - listVariable: "tetlh", - textVariable: "ghItlhHom", - httpRequestError: "Qapbe' tlhobmeH QIn.", - linkAlert: "latlhvaD ngoghmeylIj DangeHmeH Quvvam yIlo':\n\n%1", - hashError: "Do'Ha', ngogh nab pollu'pu'bogh 'oHbe'law' \"%1\"'e'.", - xmlError: "ngogh nablIj pollu'pu'bogh chu'qa'laHbe' vay'. chaq pollu'pu'DI' ghunmeH ngogh pIm lo'lu'pu'.", - badXml: "XML yajchu'laHbe' vay':\n%1\n\nchoHmeylIj DalonmeH \"ruch\" yIwIv pagh XML DachoHqa'meH \"qIl\" yIwIv." -}; diff --git a/res/lib/blockly/demos/code/msg/tr.js b/res/lib/blockly/demos/code/msg/tr.js deleted file mode 100644 index 14483009222c357ec42f38e8e487cab9195e011c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/tr.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Kod", - blocks: "Bloklar", - linkTooltip: "Blokları ve baÄŸlantı adresini kaydet.", - runTooltip: "Çalışma alanında bloklar tarafından tanımlanan programını çalıştırın.", - badCode: "Program hatası:\n %1", - timeout: "Maksimum yürütme yinelemeleri aşıldı.", - trashTooltip: "Bütün blokları at.", - catLogic: "Mantık", - catLoops: "Döngüler", - catMath: "Matematik", - catText: "Metin", - catLists: "Listeler", - catColour: "Renk", - catVariables: "DeÄŸiÅŸkenler", - catFunctions: "İşlevler", - listVariable: "liste", - textVariable: "metin", - httpRequestError: "İstek ile ilgili bir problem var.", - linkAlert: "Bloklarını bu baÄŸlantı ile paylaÅŸ:\n\n%1", - hashError: "Üzgünüz, '%1' hiç bir kaydedilmiÅŸ program ile uyuÅŸmuyor.", - xmlError: "Kaydedilen dosyanız yüklenemiyor\nBlockly'nin önceki sürümü ile kaydedilmiÅŸ olabilir mi?", - badXml: "XML ayrıştırma hatası:\n%1\n\nDeÄŸiÅŸikliklerden vazgeçmek için 'Tamam'ı, düzenlemeye devam etmek için 'İptal' seçeneÄŸini seçiniz." -}; diff --git a/res/lib/blockly/demos/code/msg/uk.js b/res/lib/blockly/demos/code/msg/uk.js deleted file mode 100644 index 6b34627215265ee18b9f96348625b2d7e9805084..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/uk.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Код", - blocks: "Блоки", - linkTooltip: "Зберегти Ñ– пов'Ñзати з блоками.", - runTooltip: "ЗапуÑтіть програму, визначену блоками у робочій облаÑті.", - badCode: "Помилка програми:\n%1", - timeout: "МакÑимальне Ð²Ð¸ÐºÐ¾Ð½Ð°Ð½Ð½Ñ Ñ–Ñ‚ÐµÑ€Ð°Ñ†Ñ–Ð¹ перевищено.", - trashTooltip: "Відкинути вÑÑ– блоки.", - catLogic: "Логіка", - catLoops: "Петлі", - catMath: "Математика", - catText: "ТекÑÑ‚", - catLists: "СпиÑки", - catColour: "Колір", - catVariables: "Змінні", - catFunctions: "Функції", - listVariable: "ÑпиÑок", - textVariable: "текÑÑ‚", - httpRequestError: "Виникла проблема із запитом.", - linkAlert: "ПоділитиÑÑ Ð²Ð°ÑˆÐ¸Ð¼ блоками через поÑиланнÑ:\n\n%1", - hashError: "Ðа жаль, \"%1\" не відповідає жодній збереженій програмі.", - xmlError: "Ðе вдалоÑÑ Ð·Ð°Ð²Ð°Ð½Ñ‚Ð°Ð¶Ð¸Ñ‚Ð¸ ваш збережений файл. Можливо, він був Ñтворений з іншої верÑÑ–Ñ— Blockly?", - badXml: "Помилка ÑинтакÑичного аналізу XML:\n%1\n\nВиберіть \"Гаразд\", щоб відмовитиÑÑ Ð²Ñ–Ð´ змін або 'СкаÑувати' Ð´Ð»Ñ Ð¿Ð¾Ð´Ð°Ð»ÑŒÑˆÐ¾Ð³Ð¾ Ñ€ÐµÐ´Ð°Ð³ÑƒÐ²Ð°Ð½Ð½Ñ XML." -}; diff --git a/res/lib/blockly/demos/code/msg/vi.js b/res/lib/blockly/demos/code/msg/vi.js deleted file mode 100644 index 952d024b4ce5d97433d9d6c1d903bf51115a8718..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/vi.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "Chương trình", - blocks: "Các mảnh", - linkTooltip: "Lưu và lấy địa chỉ liên kết.", - runTooltip: "Chạy chương trình.", - badCode: "'Lá»—i chương trình:\n%1", - timeout: "Äã vượt quá số lần lặp cho phép.", - trashTooltip: "Xóa tất cả má»i mảnh.", - catLogic: "Logic", - catLoops: "Vòng lặp", - catMath: "Công thức toán", - catText: "Văn bản", - catLists: "Danh sách", - catColour: "Mà u", - catVariables: "Biến", - catFunctions: "Hà m", - listVariable: "danh sách", - textVariable: "văn bản", - httpRequestError: "Hoạt động bị trục trặc, không thá»±c hiện được yêu cầu cá»§a bạn.", - linkAlert: "Chia sẻ chương trình cá»§a bạn vá»›i liên kết sau:\n\n %1", - hashError: "Không tìm thấy chương trình được lưu ở '%1'.", - xmlError: "Không mở được chương trình cá»§a bạn. Có thể nó nằm trong má»™t phiên bản khác cá»§a Blockly?", - badXml: "Lá»—i sá» lý XML:\n %1\n\nChá»n 'OK' để từ bá» các thay đổi hoặc 'Há»§y' để tiếp tục chỉnh sá»a các XML." -}; diff --git a/res/lib/blockly/demos/code/msg/zh-hans.js b/res/lib/blockly/demos/code/msg/zh-hans.js deleted file mode 100644 index abf8a6589b0a76a1a74d82f12d55a5a53c818645..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/zh-hans.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "代ç ", - blocks: "å—", - linkTooltip: "ä¿å˜æ¨¡å—并生æˆé“¾æŽ¥ã€‚", - runTooltip: "于工作区ä¸è¿è¡Œå—所定义的程å¼ã€‚", - badCode: "程åºé”™è¯¯ï¼š\n%1", - timeout: "超过最大执行行数。", - trashTooltip: "放弃所有å—。", - catLogic: "逻辑", - catLoops: "循环", - catMath: "æ•°å¦", - catText: "文本", - catLists: "列表", - catColour: "颜色", - catVariables: "å˜é‡", - catFunctions: "函数", - listVariable: "列表", - textVariable: "文本", - httpRequestError: "请求å˜åœ¨é—®é¢˜ã€‚", - linkAlert: "通过这个链接分享您的模å—:\n\n%1", - hashError: "对ä¸èµ·ï¼Œæ²¡æœ‰ä»»ä½•å·²ä¿å˜çš„程åºå¯¹åº”'%1' 。", - xmlError: "æ— æ³•è½½å…¥æ‚¨ä¿å˜çš„æ–‡ä»¶ã€‚您是å¦ä½¿ç”¨å…¶ä»–版本的Blockly创建该文件的?", - badXml: "XMLè§£æžé”™è¯¯ï¼š\n%1\n\n选择“确定â€ä»¥å–消您对XMLçš„ä¿®æ”¹ï¼Œæˆ–é€‰æ‹©â€œå–æ¶ˆâ€ä»¥ç»§ç»ç¼–辑XML。" -}; diff --git a/res/lib/blockly/demos/code/msg/zh-hant.js b/res/lib/blockly/demos/code/msg/zh-hant.js deleted file mode 100644 index 48a8b527272600a716a1215bae9b328f510b0ad1..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/msg/zh-hant.js +++ /dev/null @@ -1,24 +0,0 @@ -var MSG = { - title: "程å¼ç¢¼", - blocks: "ç©æœ¨", - linkTooltip: "儲å˜ç©æœ¨çµ„並æä¾›é€£çµã€‚", - runTooltip: "於工作å€ä¸åŸ·è¡Œç©æœ¨çµ„所定義的程å¼ã€‚", - badCode: "程å¼éŒ¯èª¤ï¼š\n%1", - timeout: "è¶…éŽæœ€å¤§åŸ·è¡Œæ•¸ã€‚", - trashTooltip: "æ¨æ£„æ‰€æœ‰ç©æœ¨ã€‚", - catLogic: "é‚輯", - catLoops: "迴圈", - catMath: "數å¸å¼", - catText: "æ–‡å—", - catLists: "列表", - catColour: "é¡è‰²", - catVariables: "變é‡", - catFunctions: "æµç¨‹", - listVariable: "列表", - textVariable: "æ–‡å—", - httpRequestError: "命令出ç¾éŒ¯èª¤ã€‚", - linkAlert: "é€éŽæ¤é€£çµåˆ†äº«æ‚¨çš„ç©æœ¨çµ„:\n\n%1", - hashError: "å°ä¸èµ·ï¼Œã€Œ%1ã€ä¸¦æœªå°æ‡‰ä»»ä½•å·²ä¿å˜çš„程å¼ã€‚", - xmlError: "未能載入您ä¿å˜çš„æª”案。或許它是由其他版本的Blockly創建?", - badXml: "è§£æž XML 時出ç¾éŒ¯èª¤ï¼š\n%1\n\n鏿“‡'確定'ä»¥æ”¾æ£„æ‚¨çš„æ›´æ”¹ï¼Œæˆ–é¸æ“‡'å–æ¶ˆ'以進一æ¥ç·¨è¼¯ XML。" -}; diff --git a/res/lib/blockly/demos/code/style.css b/res/lib/blockly/demos/code/style.css deleted file mode 100644 index 4098dbf28c76a0621ca5c7e186869c87ffa16cf4..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/code/style.css +++ /dev/null @@ -1,164 +0,0 @@ -html, body { - height: 100%; -} - -body { - background-color: #fff; - font-family: sans-serif; - margin: 0; - overflow: hidden; -} - -.farSide { - text-align: right; -} - -html[dir="RTL"] .farSide { - text-align: left; -} - -/* Buttons */ -button { - margin: 5px; - padding: 10px; - border-radius: 4px; - border: 1px solid #ddd; - font-size: large; - background-color: #eee; - color: #000; -} -button.primary { - border: 1px solid #dd4b39; - background-color: #dd4b39; - color: #fff; -} -button.primary>img { - opacity: 1; -} -button>img { - opacity: 0.6; - vertical-align: text-bottom; -} -button:hover>img { - opacity: 1; -} -button:active { - border: 1px solid #888 !important; -} -button:hover { - box-shadow: 2px 2px 5px #888; -} -button.disabled:hover>img { - opacity: 0.6; -} -button.disabled { - display: none; -} -button.notext { - font-size: 10%; -} - -h1 { - font-weight: normal; - font-size: 140%; - margin-left: 5px; - margin-right: 5px; -} - -/* Tabs */ -#tabRow>td { - border: 1px solid #ccc; - border-bottom: none; -} -td.tabon { - border-bottom-color: #ddd !important; - background-color: #ddd; - padding: 5px 19px; -} -td.taboff { - cursor: pointer; - padding: 5px 19px; -} -td.taboff:hover { - background-color: #eee; -} -td.tabmin { - border-top-style: none !important; - border-left-style: none !important; - border-right-style: none !important; -} -td.tabmax { - border-top-style: none !important; - border-left-style: none !important; - border-right-style: none !important; - width: 99%; - padding-left: 10px; - padding-right: 10px; - text-align: right; -} -html[dir=rtl] td.tabmax { - text-align: left; -} - -table { - border-collapse: collapse; - margin: 0; - padding: 0; - border: none; -} -td { - padding: 0; - vertical-align: top; -} -.content { - visibility: hidden; - margin: 0; - padding: 1ex; - position: absolute; - direction: ltr; -} -pre.content { - border: 1px solid #ccc; - overflow: scroll; -} -#content_blocks { - padding: 0; -} -.blocklySvg { - border-top: none !important; -} -#content_xml { - resize: none; - outline: none; - border: 1px solid #ccc; - font-family: monospace; - overflow: scroll; -} -#languageMenu { - vertical-align: top; - margin-left: 15px; - margin-right: 15px; - margin-top: 15px; -} - -/* Buttons */ -button { - padding: 1px 10px; - margin: 1px 5px; -} - -/* Sprited icons. */ -.icon21 { - height: 21px; - width: 21px; - background-image: url(icons.png); -} -.trash { - background-position: 0px 0px; -} -.link { - background-position: -21px 0px; -} -.run { - background-position: -42px 0px; -} diff --git a/res/lib/blockly/demos/codelab/README.md b/res/lib/blockly/demos/codelab/README.md deleted file mode 100644 index 2a5e9131529863c22338f1e63f340faaaf0b0c0c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/codelab/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Blockly for the Web codelab - -Code for the [Blockly for the Web codelab](https://developers.google.com/TODO). - -In this codelab, you'll learn how to use Blockly JavaScript library -to add a block code editor to a web application. - -## What you'll learn - -* How to add Blockly to a sample web app. -* How to set up a Blockly workspace. -* How to create a new block in Blockly. -* How to generate and run JavaScript code from blocks. - -Example code for each step of the codelab is available from -the [completed](completed/) directory. diff --git a/res/lib/blockly/demos/codelab/app-complete/index.html b/res/lib/blockly/demos/codelab/app-complete/index.html deleted file mode 100644 index d5780e19d038738f6197c69f28e247a017a1ee0d..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/codelab/app-complete/index.html +++ /dev/null @@ -1,73 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Blockly for the Web Codelab</title> - - <link rel="stylesheet" href="https://code.getmdl.io/1.2.1/material.indigo-pink.min.css"> - <link rel="stylesheet" href="styles/index.css"> -</head> - -<body mode="maker"> - <header class="mdl-color--cyan-500"> - <h1 class="mode-maker">Music Maker</h1> - <h1 class="mode-edit mode-blockly">Music Maker Configuration</h1> - </header> - - <main> - <button class="mode-maker mdl-button" id="edit">Edit</button> - <button class="mode-edit mdl-button mdl-js-button" id="done">Done</button> - <button class="mode-blockly mdl-button mdl-js-button" id="save">Save</button> - <p class="hint mode-edit">Tap any button to edit its code. <br/>When complete, press Done.</p> - - <div class="maker"> - <div> - <div class="button mdl-color--amber-500">1</div> - <div class="button mdl-color--yellow-500">2</div> - <div class="button mdl-color--lime-500">3</div> - </div> - <div> - <div class="button mdl-color--pink-500">4</div> - <div class="button mdl-color--red-500">5</div> - <div class="button mdl-color--light-green-500">6</div> - </div> - <div> - <div class="button mdl-color--cyan-500">7</div> - <div class="button mdl-color--teal-500">8</div> - <div class="button mdl-color--green-500">9</div> - </div> - </div> - - <div class="blockly-editor"> - <div id="blockly-div" style="height: 480px; width: 400px;"></div> - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <category name="Loops" colour="120"> - <block type="controls_repeat_ext"> - <value name="TIMES"> - <shadow type="math_number"> - <field name="NUM">5</field> - </shadow> - </value> - </block> - </category> - <category name="Sounds" colour="355"> - <block type="play_sound"></block> - </category> - </xml> - </div> - </main> - - <script src="../../../blockly_compressed.js"></script> - <script src="../../../blocks_compressed.js"></script> - <script src="../../../javascript_compressed.js"></script> - <script src="../../../msg/js/en.js"></script> - - <script src="scripts/music_maker.js"></script> - <script src="scripts/sound_blocks.js"></script> - <script src="scripts/main.js"></script> - -</body> -</html> diff --git a/res/lib/blockly/demos/codelab/app-complete/scripts/main.js b/res/lib/blockly/demos/codelab/app-complete/scripts/main.js deleted file mode 100644 index 795dd1a68dd1e2c583f1396d331b9d561896ed00..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/codelab/app-complete/scripts/main.js +++ /dev/null @@ -1,88 +0,0 @@ -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - (function() { - - let currentButton; - - function handlePlay(event) { - loadWorkspace(event.target); - Blockly.JavaScript.addReservedWords('code'); - var code = Blockly.JavaScript.workspaceToCode(Blockly.getMainWorkspace()); - code += 'MusicMaker.play();'; - // Eval can be dangerous. For more controlled execution, check - // https://github.com/NeilFraser/JS-Interpreter. - try { - eval(code); - } catch (error) { - console.log(error); - } - } - - function loadWorkspace(button) { - let workspace = Blockly.getMainWorkspace(); - workspace.clear(); - if (button.blocklyXml) { - Blockly.Xml.domToWorkspace(button.blocklyXml, workspace); - } - } - - function save(button) { - let xml = Blockly.Xml.workspaceToDom(Blockly.getMainWorkspace()); - button.blocklyXml = xml; - } - - function handleSave() { - document.body.setAttribute('mode', 'edit'); - save(currentButton); - } - - function enableEditMode() { - document.body.setAttribute('mode', 'edit'); - document.querySelectorAll('.button').forEach(btn => { - btn.removeEventListener('click', handlePlay); - btn.addEventListener('click', enableBlocklyMode); - }); - } - - function enableMakerMode() { - document.body.setAttribute('mode', 'maker'); - document.querySelectorAll('.button').forEach(btn => { - btn.addEventListener('click', handlePlay); - btn.removeEventListener('click', enableBlocklyMode); - }); - } - - function enableBlocklyMode(e) { - document.body.setAttribute('mode', 'blockly'); - currentButton = e.target; - loadWorkspace(currentButton); - } - - document.querySelector('#edit').addEventListener('click', enableEditMode); - document.querySelector('#done').addEventListener('click', enableMakerMode); - document.querySelector('#save').addEventListener('click', handleSave); - - enableMakerMode(); - - Blockly.inject('blockly-div', { - media: '../../../media/', - toolbox: document.getElementById('toolbox'), - toolboxPosition: 'end', - horizontalLayout: true, - scrollbars: false - }); -})(); diff --git a/res/lib/blockly/demos/codelab/app-complete/scripts/music_maker.js b/res/lib/blockly/demos/codelab/app-complete/scripts/music_maker.js deleted file mode 100644 index e3d4effe0348a0b3f5d58b1dd7ab7f8915464c98..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/codelab/app-complete/scripts/music_maker.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - const MusicMaker = { - queue_: [], - player_: new Audio(), - queueSound: function(soundUrl) { - this.queue_.push(soundUrl); - }, - play: function() { - let next = this.queue_.shift(); - if (next) { - this.player_.src = next; - this.player_.play(); - } - }, -}; - -MusicMaker.player_.addEventListener( - 'ended', MusicMaker.play.bind(MusicMaker)); diff --git a/res/lib/blockly/demos/codelab/app-complete/scripts/sound_blocks.js b/res/lib/blockly/demos/codelab/app-complete/scripts/sound_blocks.js deleted file mode 100644 index 55462267b9aa48b03ce6eb95110fdd4bd7f64979..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/codelab/app-complete/scripts/sound_blocks.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -Blockly.defineBlocksWithJsonArray([ - // Block for colour picker. - { - "type": "play_sound", - "message0": "Play %1", - "args0": [ - { - "type": "field_dropdown", - "name": "VALUE", - "options": [ - ["C4", "sounds/c4.m4a"], - ["D4", "sounds/d4.m4a"], - ["E4", "sounds/e4.m4a"], - ["F4", "sounds/f4.m4a"], - ["G4", "sounds/g4.m4a"], - ["A5", "sounds/a5.m4a"], - ["B5", "sounds/b5.m4a"], - ["C5", "sounds/c5.m4a"] - ] - } - ], - "previousStatement": null, - "nextStatement": null, - "colour": 355, - "tooltip": "", - "helpUrl": "" - } -]); - -Blockly.JavaScript['play_sound'] = function(block) { - var value = '\'' + block.getFieldValue('VALUE') + '\''; - return 'MusicMaker.queueSound(' + value + ');\n'; -}; diff --git a/res/lib/blockly/demos/codelab/app-complete/sounds/c4.m4a b/res/lib/blockly/demos/codelab/app-complete/sounds/c4.m4a deleted file mode 100644 index 33941cfae1550c1971a1713664e5f41cbd74531c..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/codelab/app-complete/sounds/c4.m4a and /dev/null differ diff --git a/res/lib/blockly/demos/codelab/app-complete/sounds/c5.m4a b/res/lib/blockly/demos/codelab/app-complete/sounds/c5.m4a deleted file mode 100644 index 49721cd31dfcb6154563e05a4ddfb4c3c7c03fa3..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/codelab/app-complete/sounds/c5.m4a and /dev/null differ diff --git a/res/lib/blockly/demos/codelab/app-complete/sounds/d4.m4a b/res/lib/blockly/demos/codelab/app-complete/sounds/d4.m4a deleted file mode 100644 index 51bcad6c2f1f7ec315caba656373064f7c9f050a..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/codelab/app-complete/sounds/d4.m4a and /dev/null differ diff --git a/res/lib/blockly/demos/codelab/app-complete/sounds/e4.m4a b/res/lib/blockly/demos/codelab/app-complete/sounds/e4.m4a deleted file mode 100644 index d910052ef9fe9dbededf8bb949e813d2491c608e..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/codelab/app-complete/sounds/e4.m4a and /dev/null differ diff --git a/res/lib/blockly/demos/codelab/app-complete/sounds/f4.m4a b/res/lib/blockly/demos/codelab/app-complete/sounds/f4.m4a deleted file mode 100644 index c80a0bfd3b28a1cfe18f5eaab27a7829b78b48c7..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/codelab/app-complete/sounds/f4.m4a and /dev/null differ diff --git a/res/lib/blockly/demos/codelab/app-complete/sounds/g4.m4a b/res/lib/blockly/demos/codelab/app-complete/sounds/g4.m4a deleted file mode 100644 index 45ea4483021bdee6827f4f2cdaea22e5983979d6..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/codelab/app-complete/sounds/g4.m4a and /dev/null differ diff --git a/res/lib/blockly/demos/codelab/app-complete/styles/index.css b/res/lib/blockly/demos/codelab/app-complete/styles/index.css deleted file mode 100644 index 0ef8f3bfc908d2373822dffcade414c2e51fed3e..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/codelab/app-complete/styles/index.css +++ /dev/null @@ -1,75 +0,0 @@ -main { - width: 400px; - position: relative; - margin: 0 auto; - overflow:hidden; - height: 600px; -} - -header { - background-color: green; - width: 100%; -} - -h1 { - width: 400px; - position: relative; - margin: 0 auto; - color: #fff; - font-size: 1.8em; - line-height: 2.4em; -} - -.mode-edit, -.mode-maker, -.mode-blockly { - display: none; -} - -[mode="maker"] .mode-maker, -[mode="edit"] .mode-edit, -[mode="blockly"] .mode-blockly { - display: block; -} - -.blockly-editor { - position: absolute; - top: 64px; - left: -400px; - transition: left .4s; - height: 460px; - width: 400px; - background-color: #eee; -} - -[mode="blockly"] .blockly-editor { - left: 0; -} - -.maker { - display: flex; - flex-flow: column; - justify-content: space-between; - height: 460px; - width: 400px; -} - -.maker > div { - display: flex; - justify-content: space-between; -} - -.button { - width: 120px; - height: 140px; - color: #fff; - font-size: 3em; - text-align: center; - vertical-align: middle; - line-height: 140px; -} - -.mdl-button { - margin: 1em 0; - float: right; -} diff --git a/res/lib/blockly/demos/codelab/app/index.html b/res/lib/blockly/demos/codelab/app/index.html deleted file mode 100644 index 31eeff776d555fbf947a59d5183b8328d8675167..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/codelab/app/index.html +++ /dev/null @@ -1,53 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Blockly for the Web Codelab</title> - - <link rel="stylesheet" href="https://code.getmdl.io/1.2.1/material.indigo-pink.min.css"> - <link rel="stylesheet" href="styles/index.css"> -</head> - -<body mode="maker"> - <header class="mdl-color--cyan-500"> - <h1 class="mode-maker">Music Maker</h1> - <h1 class="mode-edit mode-blockly">Music Maker Configuration</h1> - </header> - - <main> - <button class="mode-maker mdl-button" id="edit">Edit</button> - <button class="mode-edit mdl-button mdl-js-button" id="done">Done</button> - <button class="mode-blockly mdl-button mdl-js-button" id="save">Save</button> - <p class="hint mode-edit">Tap any button to edit its code. <br/>When complete, press Done.</p> - - <div class="maker"> - <div> - <div class="button mdl-color--amber-500">1</div> - <div class="button mdl-color--yellow-500">2</div> - <div class="button mdl-color--lime-500">3</div> - </div> - <div> - <div class="button mdl-color--pink-500">4</div> - <div class="button mdl-color--red-500">5</div> - <div class="button mdl-color--light-green-500">6</div> - </div> - <div> - <div class="button mdl-color--cyan-500">7</div> - <div class="button mdl-color--teal-500">8</div> - <div class="button mdl-color--green-500">9</div> - </div> - </div> - - <div class="blockly-editor"> - <div id="blockly-div" style="height: 480px; width: 400px;"></div> - </div> - </main> - - <script src="scripts/music_maker.js"></script> - <script src="scripts/main.js"></script> - -</body> -</html> diff --git a/res/lib/blockly/demos/codelab/app/scripts/main.js b/res/lib/blockly/demos/codelab/app/scripts/main.js deleted file mode 100644 index 21b884830c4b688fcd4dc22ae227d194110f7eab..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/codelab/app/scripts/main.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - (function() { - - let currentButton; - - function handlePlay(event) { - // Add code for playing sound. - } - - function save(button) { - // Add code for saving the behavior of a button. - } - - function handleSave() { - document.body.setAttribute('mode', 'edit'); - save(currentButton); - } - - function enableEditMode() { - document.body.setAttribute('mode', 'edit'); - document.querySelectorAll('.button').forEach(btn => { - btn.removeEventListener('click', handlePlay); - btn.addEventListener('click', enableBlocklyMode); - }); - } - - function enableMakerMode() { - document.body.setAttribute('mode', 'maker'); - document.querySelectorAll('.button').forEach(btn => { - btn.addEventListener('click', handlePlay); - btn.removeEventListener('click', enableBlocklyMode); - }); - } - - function enableBlocklyMode(e) { - document.body.setAttribute('mode', 'blockly'); - currentButton = e.target; - } - - document.querySelector('#edit').addEventListener('click', enableEditMode); - document.querySelector('#done').addEventListener('click', enableMakerMode); - document.querySelector('#save').addEventListener('click', handleSave); - - enableMakerMode(); - -})(); diff --git a/res/lib/blockly/demos/codelab/app/scripts/music_maker.js b/res/lib/blockly/demos/codelab/app/scripts/music_maker.js deleted file mode 100644 index e3d4effe0348a0b3f5d58b1dd7ab7f8915464c98..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/codelab/app/scripts/music_maker.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - const MusicMaker = { - queue_: [], - player_: new Audio(), - queueSound: function(soundUrl) { - this.queue_.push(soundUrl); - }, - play: function() { - let next = this.queue_.shift(); - if (next) { - this.player_.src = next; - this.player_.play(); - } - }, -}; - -MusicMaker.player_.addEventListener( - 'ended', MusicMaker.play.bind(MusicMaker)); diff --git a/res/lib/blockly/demos/codelab/app/sounds/c4.m4a b/res/lib/blockly/demos/codelab/app/sounds/c4.m4a deleted file mode 100644 index 33941cfae1550c1971a1713664e5f41cbd74531c..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/codelab/app/sounds/c4.m4a and /dev/null differ diff --git a/res/lib/blockly/demos/codelab/app/sounds/c5.m4a b/res/lib/blockly/demos/codelab/app/sounds/c5.m4a deleted file mode 100644 index 49721cd31dfcb6154563e05a4ddfb4c3c7c03fa3..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/codelab/app/sounds/c5.m4a and /dev/null differ diff --git a/res/lib/blockly/demos/codelab/app/sounds/d4.m4a b/res/lib/blockly/demos/codelab/app/sounds/d4.m4a deleted file mode 100644 index 51bcad6c2f1f7ec315caba656373064f7c9f050a..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/codelab/app/sounds/d4.m4a and /dev/null differ diff --git a/res/lib/blockly/demos/codelab/app/sounds/e4.m4a b/res/lib/blockly/demos/codelab/app/sounds/e4.m4a deleted file mode 100644 index d910052ef9fe9dbededf8bb949e813d2491c608e..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/codelab/app/sounds/e4.m4a and /dev/null differ diff --git a/res/lib/blockly/demos/codelab/app/sounds/f4.m4a b/res/lib/blockly/demos/codelab/app/sounds/f4.m4a deleted file mode 100644 index c80a0bfd3b28a1cfe18f5eaab27a7829b78b48c7..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/codelab/app/sounds/f4.m4a and /dev/null differ diff --git a/res/lib/blockly/demos/codelab/app/sounds/g4.m4a b/res/lib/blockly/demos/codelab/app/sounds/g4.m4a deleted file mode 100644 index 45ea4483021bdee6827f4f2cdaea22e5983979d6..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/codelab/app/sounds/g4.m4a and /dev/null differ diff --git a/res/lib/blockly/demos/codelab/app/styles/index.css b/res/lib/blockly/demos/codelab/app/styles/index.css deleted file mode 100644 index 0ef8f3bfc908d2373822dffcade414c2e51fed3e..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/codelab/app/styles/index.css +++ /dev/null @@ -1,75 +0,0 @@ -main { - width: 400px; - position: relative; - margin: 0 auto; - overflow:hidden; - height: 600px; -} - -header { - background-color: green; - width: 100%; -} - -h1 { - width: 400px; - position: relative; - margin: 0 auto; - color: #fff; - font-size: 1.8em; - line-height: 2.4em; -} - -.mode-edit, -.mode-maker, -.mode-blockly { - display: none; -} - -[mode="maker"] .mode-maker, -[mode="edit"] .mode-edit, -[mode="blockly"] .mode-blockly { - display: block; -} - -.blockly-editor { - position: absolute; - top: 64px; - left: -400px; - transition: left .4s; - height: 460px; - width: 400px; - background-color: #eee; -} - -[mode="blockly"] .blockly-editor { - left: 0; -} - -.maker { - display: flex; - flex-flow: column; - justify-content: space-between; - height: 460px; - width: 400px; -} - -.maker > div { - display: flex; - justify-content: space-between; -} - -.button { - width: 120px; - height: 140px; - color: #fff; - font-size: 3em; - text-align: center; - vertical-align: middle; - line-height: 140px; -} - -.mdl-button { - margin: 1em 0; - float: right; -} diff --git a/res/lib/blockly/demos/custom-dialogs/custom-dialog.js b/res/lib/blockly/demos/custom-dialogs/custom-dialog.js deleted file mode 100644 index 99c66be0a6da8549ecf8df60da4d4fd47f85fe5e..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-dialogs/custom-dialog.js +++ /dev/null @@ -1,172 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * An example implementation of how one might replace Blockly's browser - * dialogs. This is just an example, and applications are not encouraged to use - * it verbatim. - * - * @namespace - */ -CustomDialog = {}; - -/** Override Blockly.alert() with custom implementation. */ -Blockly.alert = function(message, callback) { - console.log('Alert: ' + message); - CustomDialog.show('Alert', message, { - onCancel: callback - }); -}; - -/** Override Blockly.confirm() with custom implementation. */ -Blockly.confirm = function(message, callback) { - console.log('Confirm: ' + message); - CustomDialog.show('Confirm', message, { - showOkay: true, - onOkay: function() { - callback(true); - }, - showCancel: true, - onCancel: function() { - callback(false); - } - }); -}; - -/** Override Blockly.prompt() with custom implementation. */ -Blockly.prompt = function(message, defaultValue, callback) { - console.log('Prompt: ' + message); - CustomDialog.show('Prompt', message, { - showInput: true, - showOkay: true, - onOkay: function() { - callback(CustomDialog.inputField.value); - }, - showCancel: true, - onCancel: function() { - callback(null); - } - }); - CustomDialog.inputField.value = defaultValue; -}; - -/** Hides any currently visible dialog. */ -CustomDialog.hide = function() { - if (CustomDialog.backdropDiv_) { - CustomDialog.backdropDiv_.style.display = 'none'; - CustomDialog.dialogDiv_.style.display = 'none'; - } -}; - -/** - * Shows the dialog. - * Allowed options: - * - showOkay: Whether to show the OK button. - * - showCancel: Whether to show the Cancel button. - * - showInput: Whether to show the text input field. - * - onOkay: Callback to handle the okay button. - * - onCancel: Callback to handle the cancel button and backdrop clicks. - */ -CustomDialog.show = function(title, message, options) { - var backdropDiv = CustomDialog.backdropDiv_; - var dialogDiv = CustomDialog.dialogDiv_; - if (!dialogDiv) { - // Generate HTML - backdropDiv = document.createElement('div'); - backdropDiv.id = 'customDialogBackdrop'; - backdropDiv.style.cssText = - 'position: absolute;' + - 'top: 0; left: 0; right: 0; bottom: 0;' + - 'background-color: rgba(0, 0, 0, .7);' + - 'z-index: 100;'; - document.body.appendChild(backdropDiv); - - dialogDiv = document.createElement('div'); - dialogDiv.id = 'customDialog'; - dialogDiv.style.cssText = - 'background-color: #fff;' + - 'width: 400px;' + - 'margin: 20px auto 0;' + - 'padding: 10px;'; - backdropDiv.appendChild(dialogDiv); - - dialogDiv.onclick = function(event) { - event.stopPropagation(); - }; - - CustomDialog.backdropDiv_ = backdropDiv; - CustomDialog.dialogDiv_ = dialogDiv; - } - backdropDiv.style.display = 'block'; - dialogDiv.style.display = 'block'; - - dialogDiv.innerHTML = - '<header class="customDialogTitle"></header>' + - '<p class="customDialogMessage"></p>' + - (options.showInput ? '<div><input id="customDialogInput"></div>' : '') + - '<div class="customDialogButtons">' + - (options.showCancel ? '<button id="customDialogCancel">Cancel</button>': '') + - (options.showOkay ? '<button id="customDialogOkay">OK</button>': '') + - '</div>'; - dialogDiv.getElementsByClassName('customDialogTitle')[0] - .appendChild(document.createTextNode(title)); - dialogDiv.getElementsByClassName('customDialogMessage')[0] - .appendChild(document.createTextNode(message)); - - var onOkay = function(event) { - CustomDialog.hide(); - options.onOkay && options.onOkay(); - event && event.stopPropagation(); - }; - var onCancel = function(event) { - CustomDialog.hide(); - options.onCancel && options.onCancel(); - event && event.stopPropagation(); - }; - - var dialogInput = document.getElementById('customDialogInput'); - CustomDialog.inputField = dialogInput; - if (dialogInput) { - dialogInput.focus(); - - dialogInput.onkeyup = function(event) { - if (event.keyCode == 13) { - // Process as OK when user hits enter. - onOkay(); - return false; - } else if (event.keyCode == 27) { - // Process as cancel when user hits esc. - onCancel(); - return false; - } - }; - } else { - var okay = document.getElementById('customDialogOkay'); - okay && okay.focus(); - } - - if (options.showOkay) { - document.getElementById('customDialogOkay') - .addEventListener('click', onOkay); - } - if (options.showCancel) { - document.getElementById('customDialogCancel') - .addEventListener('click', onCancel); - } - - backdropDiv.onclick = onCancel; -}; diff --git a/res/lib/blockly/demos/custom-dialogs/icon.png b/res/lib/blockly/demos/custom-dialogs/icon.png deleted file mode 100644 index ba49746e43f8f8e77adb0dd4526b4898bc6ae861..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/custom-dialogs/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/custom-dialogs/index.html b/res/lib/blockly/demos/custom-dialogs/index.html deleted file mode 100644 index 9c171802efca96380ab188a081b6f66a475153cb..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-dialogs/index.html +++ /dev/null @@ -1,62 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Custom Dialog</title> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <style> - body { - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Custom Dialog</h1> - - <p>This is a simple demo of replacing modal browser dialogs with HTML. - To see how it works, see the source code in - <a href="custom-dialog.js">custom-dialog.js</a> - </p> - - <p>Try creating new variables, creating variables with names already in - use, or deleting multiple blocks on the workspace. - </p> - - <div id="blocklyDiv" style="height: 480px; width: 600px;"></div> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <category name="Inputs" colour="%{BKY_MATH_HUE}"> - <block type="math_number" gap="32"> - <field name="NUM">123</field> - </block> - <block type="text"></block> - <block type="text_prompt_ext"> - <value name="TEXT"> - <shadow type="text"> - <field name="TEXT">abc</field> - </shadow> - </value> - </block> - </category> - <sep></sep> - <category name="Variables" colour="%{BKY_VARIABLES_HUE}" custom="VARIABLE"></category> - <category name="Functions" colour="%{BKY_PROCEDURES_HUE}" custom="PROCEDURE"></category> - </xml> - - <script> - var demoWorkspace = Blockly.inject('blocklyDiv', - {media: '../../media/', - toolbox: document.getElementById('toolbox')}); - </script> - <script src="custom-dialog.js"></script> - -</body> -</html> diff --git a/res/lib/blockly/demos/custom-fields/icon.png b/res/lib/blockly/demos/custom-fields/icon.png deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/res/lib/blockly/demos/custom-fields/index.html b/res/lib/blockly/demos/custom-fields/index.html deleted file mode 100644 index 9e681a8b605e6d440e9cecc7d8b65b96612eefda..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/index.html +++ /dev/null @@ -1,54 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Custom Fields</title> - <style> - body { - margin: 0 10%; - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - td { - padding: 1ex; - } - img { - border: none; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Custom Fields</h1> - - <p>These demos are intended for developers who want creating custom block fields.</p> - - <table> - <tr> - <td> - <a href="turtle/index.html"> - <img src="turtle/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="turtle/index.html">Turtle Field</a></div> - </td> - </tr> - - <tr> - <td> - <a href="pitch/index.html"> - <img src="pitch/media/notes.png" height=40 width=100> - </a> - </td> - <td> - <div><a href="pitch/index.html">Pitch Field</a></div> - </td> - </tr> - </table> -</body> -</html> diff --git a/res/lib/blockly/demos/custom-fields/pitch/blocks.js b/res/lib/blockly/demos/custom-fields/pitch/blocks.js deleted file mode 100644 index 3e02ac80a850ed68f555cba3698dad9770a6fc35..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/pitch/blocks.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Pitch field demo blocks. - * @author samelh@gmail.com (Sam El-Husseini) - */ - -Blockly.Blocks['test_pitch_field'] = { - init: function() { - this.appendDummyInput() - .appendField('pitch') - .appendField(new CustomFields.FieldPitch('7'), 'PITCH'); - this.setStyle('loop_blocks'); - } -}; diff --git a/res/lib/blockly/demos/custom-fields/pitch/field_pitch.js b/res/lib/blockly/demos/custom-fields/pitch/field_pitch.js deleted file mode 100644 index b69789d5270bcd7b4494475b19d7c87a6871a844..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/pitch/field_pitch.js +++ /dev/null @@ -1,230 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * https://github.com/google/blockly-games - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Music pitch input field. Borrowed from Blockly Games. - * @author fraser@google.com (Neil Fraser) - * @author samelh@google.com (Sam El-Husseini) - */ -'use strict'; - -goog.provide('CustomFields.FieldPitch'); - -goog.require('Blockly.FieldTextInput'); -goog.require('Blockly.utils.math'); -goog.require('Blockly.utils.object'); - -var CustomFields = CustomFields || {}; - -/** - * Class for an editable pitch field. - * @param {string} text The initial content of the field. - * @extends {Blockly.FieldTextInput} - * @constructor - */ -CustomFields.FieldPitch = function(text) { - CustomFields.FieldPitch.superClass_.constructor.call(this, text); -}; -Blockly.utils.object.inherits(CustomFields.FieldPitch, Blockly.FieldTextInput); - -/** - * Construct a FieldPitch from a JSON arg object. - * @param {!Object} options A JSON object with options (pitch). - * @return {!CustomFields.FieldPitch} The new field instance. - * @package - * @nocollapse - */ -CustomFields.FieldPitch.fromJson = function(options) { - return new CustomFields.FieldPitch(options['pitch']); -}; - -/** - * All notes available for the picker. - */ -CustomFields.FieldPitch.NOTES = 'C3 D3 E3 F3 G3 A3 B3 C4 D4 E4 F4 G4 A4'.split(/ /); - -/** - * Show the inline free-text editor on top of the text and the note picker. - * @private - */ -CustomFields.FieldPitch.prototype.showEditor_ = function() { - CustomFields.FieldPitch.superClass_.showEditor_.call(this); - - var div = Blockly.WidgetDiv.DIV; - if (!div.firstChild) { - // Mobile interface uses Blockly.prompt. - return; - } - // Build the DOM. - var editor = this.dropdownCreate_(); - Blockly.DropDownDiv.getContentDiv().appendChild(editor); - - var border = this.sourceBlock_.getColourBorder(); - border = border.colourBorder || border.colourLight; - Blockly.DropDownDiv.setColour(this.sourceBlock_.getColour(), border); - - Blockly.DropDownDiv.showPositionedByField( - this, this.dropdownDispose_.bind(this)); - - // The note picker is different from other fields in that it updates on - // mousemove even if it's not in the middle of a drag. In future we may - // change this behaviour. For now, using bindEvent_ instead of - // bindEventWithChecks_ allows it to work without a mousedown/touchstart. - this.clickWrapper_ = - Blockly.bindEvent_(this.imageElement_, 'click', this, - this.hide_); - this.moveWrapper_ = - Blockly.bindEvent_(this.imageElement_, 'mousemove', this, - this.onMouseMove); - - this.updateGraph_(); -}; - -/** - * Create the pitch editor. - * @return {!Element} The newly created pitch picker. - * @private - */ -CustomFields.FieldPitch.prototype.dropdownCreate_ = function() { - this.imageElement_ = document.createElement('div'); - this.imageElement_.id = 'notePicker'; - - return this.imageElement_; -}; - -/** - * Dispose of events belonging to the pitch editor. - * @private - */ -CustomFields.FieldPitch.prototype.dropdownDispose_ = function() { - Blockly.unbindEvent_(this.clickWrapper_); - Blockly.unbindEvent_(this.moveWrapper_); -}; - -/** - * Hide the editor. - * @private - */ -CustomFields.FieldPitch.prototype.hide_ = function() { - Blockly.WidgetDiv.hide(); - Blockly.DropDownDiv.hideWithoutAnimation(); -}; - -/** - * Set the note to match the mouse's position. - * @param {!Event} e Mouse move event. - */ -CustomFields.FieldPitch.prototype.onMouseMove = function(e) { - var bBox = this.imageElement_.getBoundingClientRect(); - var dy = e.clientY - bBox.top; - var note = Blockly.utils.math.clamp(Math.round(13.5 - dy / 7.5), 0, 12); - this.imageElement_.style.backgroundPosition = (-note * 37) + 'px 0'; - this.setEditorValue_(note); -}; - -/** - * Convert the machine-readable value (0-12) to human-readable text (C3-A4). - * @param {number|string} value The provided value. - * @return {string|undefined} The respective note, or undefined if invalid. - */ -CustomFields.FieldPitch.prototype.valueToNote = function(value) { - return CustomFields.FieldPitch.NOTES[Number(value)]; -}; - -/** - * Convert the human-readable text (C3-A4) to machine-readable value (0-12). - * @param {string} text The provided note. - * @return {number|undefined} The respective value, or undefined if invalid. - */ -CustomFields.FieldPitch.prototype.noteToValue = function(text) { - var normalizedText = text.trim().toUpperCase(); - var i = CustomFields.FieldPitch.NOTES.indexOf(normalizedText); - return i > -1 ? i : undefined; -}; - -/** - * Get the text to be displayed on the field node. - * @return {?string} The HTML value if we're editing, otherwise null. Null means - * the super class will handle it, likely a string cast of value. - * @protected - */ -CustomFields.FieldPitch.prototype.getText_ = function() { - if (this.isBeingEdited_) { - return CustomFields.FieldPitch.superClass_.getText_.call(this); - } - return this.valueToNote(this.getValue()) || null; -}; - -/** - * Transform the provided value into a text to show in the HTML input. - * @param {*} value The value stored in this field. - * @returns {string} The text to show on the HTML input. - */ -CustomFields.FieldPitch.prototype.getEditorText_ = function(value) { - return this.valueToNote(value); -}; - -/** - * Transform the text received from the HTML input (note) into a value - * to store in this field. - * @param {string} text Text received from the HTML input. - * @returns {*} The value to store. - */ -CustomFields.FieldPitch.prototype.getValueFromEditorText_ = function(text) { - return this.noteToValue(text); -}; - -/** - * Updates the graph when the field rerenders. - * @private - * @override - */ -CustomFields.FieldPitch.prototype.render_ = function() { - CustomFields.FieldPitch.superClass_.render_.call(this); - this.updateGraph_(); -}; - -/** - * Redraw the note picker with the current note. - * @private - */ -CustomFields.FieldPitch.prototype.updateGraph_ = function() { - if (!this.imageElement_) { - return; - } - var i = this.getValue(); - this.imageElement_.style.backgroundPosition = (-i * 37) + 'px 0'; -}; - -/** - * Ensure that only a valid value may be entered. - * @param {*} opt_newValue The input value. - * @return {*} A valid value, or null if invalid. - */ -CustomFields.FieldPitch.prototype.doClassValidation_ = function(opt_newValue) { - if (opt_newValue === null || opt_newValue === undefined) { - return null; - } - var note = this.valueToNote(opt_newValue); - if (note) { - return opt_newValue; - } - return null; -}; - -Blockly.fieldRegistry.register('field_pitch', CustomFields.FieldPitch); diff --git a/res/lib/blockly/demos/custom-fields/pitch/index.html b/res/lib/blockly/demos/custom-fields/pitch/index.html deleted file mode 100644 index 642482cd6ec9df5abba500e2bd02401c62433070..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/pitch/index.html +++ /dev/null @@ -1,120 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="UTF-8"> - <title>Blockly Demo: Custom Pitch Field</title> - <script src="../../../blockly_uncompressed.js"></script> - <script src="blocks.js"></script> - <script src="field_pitch.js"></script> - <script src="../../../msg/js/en.js"></script> - <style> - body { - margin: 0 10%; - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - td { - padding: 1ex; - } - img { - border: none; - } - </style> - <link rel="stylesheet" type="text/css" href="pitch.css"> - </head> - <body onload="start()"> - <h1> - <a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../../index.html">Demos</a> > - <a href="../index.html">Custom Fields</a> > Pitch Field</h1> - - - <p>This is a demo of creating custom block fields. In this case the field - is used to select a note pitch. - </p> - - <p>All of the custom field implementation is in - demos/custom-fields/pitch/field_pitch.js, including comments on each required - function. - </p> - - <p> - <input type="button" value="Export to XML" onclick="toXml()"> - <input type="button" value="Import from XML" onclick="fromXml()"> - </p> - - <table> - <tr> - <td> - <textarea id="importExport" - style="width: 200px; height: 480px;" - onchange="textAreaChange();" - onkeyup="textAreaChange()"></textarea> - </td> - <td> - <div id="blocklyDiv" style="width: 600px; height: 480px;"></div> - </td> - </tr> - </table> - - <script> - function toXml() { - var output = document.getElementById('importExport'); - var xml = Blockly.Xml.workspaceToDom(workspace); - output.value = Blockly.Xml.domToPrettyText(xml); - output.focus(); - output.select(); - } - - function fromXml() { - var input = document.getElementById('importExport'); - var xml = Blockly.Xml.textToDom(input.value); - Blockly.Xml.domToWorkspace(xml, workspace); - } - - function appendDom() { - var blocks = document.getElementById('workspace-blocks'); - if (blocks.firstElementChild) { - Blockly.Xml.appendDomToWorkspace(blocks, workspace); - } - } - - function start() { - workspace = Blockly.inject('blocklyDiv', options); - appendDom(); - workspace.scrollCenter(); - } - - var options = { - media: '../../../media/', - grid: { - spacing: 25, - length: 3, - colour: '#ccc' - }, - move: { - scrollbars: true, - drag: true, - wheel: true, - }, - zoom: { - controls: true, - startScale: 1.0, - maxScale: 4, - minScale: 0.25, - scaleSpeed: 1.1 - } - /*toolbox: document.getElementById('toolbox')*/ - } - - </script> - - <xml xmlns="https://developers.google.com/blockly/xml" id="workspace-blocks" style="display: none"> - <block type="test_pitch_field"></block> - </xml> - </body> -</html> diff --git a/res/lib/blockly/demos/custom-fields/pitch/media/notes.png b/res/lib/blockly/demos/custom-fields/pitch/media/notes.png deleted file mode 100644 index b9a57b59eca4c7dc8cd55c242dcd7fc60004b370..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/custom-fields/pitch/media/notes.png and /dev/null differ diff --git a/res/lib/blockly/demos/custom-fields/pitch/pitch.css b/res/lib/blockly/demos/custom-fields/pitch/pitch.css deleted file mode 100644 index 586c6cdb5dbafd272a05992dc86f0943886fb09e..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/pitch/pitch.css +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#notePicker { - background-image: url(media/notes.png); - border: 1px solid #ccc; - height: 109px; - width: 46px; -} \ No newline at end of file diff --git a/res/lib/blockly/demos/custom-fields/turtle/blocks.js b/res/lib/blockly/demos/custom-fields/turtle/blocks.js deleted file mode 100644 index ef8b245ae220b74c34dc7a45c1b9b54c58bae9f6..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/turtle/blocks.js +++ /dev/null @@ -1,103 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Turtle field demo blocks.. - * @author bekawestberg@gmail.com (Beka Westberg) - */ - -Blockly.Blocks['turtle_basic'] = { - init: function() { - this.appendDummyInput() - .appendField('simple turtle'); - this.appendDummyInput() - .setAlign(Blockly.ALIGN_CENTRE) - .appendField(new CustomFields.FieldTurtle(), 'TURTLE'); - this.setStyle('loop_blocks'); - this.setCommentText('Demonstrates a turtle field with no validator.'); - } -}; - -Blockly.Blocks['turtle_nullifier'] = { - init: function() { - this.appendDummyInput() - .appendField('no trademarks'); - this.appendDummyInput() - .setAlign(Blockly.ALIGN_CENTRE) - .appendField(new CustomFields.FieldTurtle(null, null, null, this.validate) - , 'TURTLE'); - this.setStyle('loop_blocks'); - this.setCommentText('Validates combinations of names and hats to null' + - ' (invalid) if they could be considered infringe-y. This turns the' + - ' turtle field red. Infringe-y combinations are: (Leonardo, Mask),' + - ' (Yertle, Crown), and (Franklin, Propeller).'); - }, - - validate: function(newValue) { - this.cachedValidatedValue_ = { - turtleName: newValue.turtleName, - pattern: newValue.pattern, - hat: newValue.hat, - }; - if ((newValue.turtleName == 'Leonardo' && newValue.hat == 'Mask') || - (newValue.turtleName == 'Yertle' && newValue.hat == 'Crown') || - (newValue.turtleName == 'Franklin') && newValue.hat == 'Propeller') { - - var currentValue = this.getValue(); - if (newValue.turtleName != currentValue.turtleName) { - // Turtle name changed. - this.cachedValidatedValue_.turtleName = null; - } else { - // Hat must have changed. - this.cachedValidatedValue_.hat = null; - } - - return null; - } - return newValue; - } -}; - -Blockly.Blocks['turtle_changer'] = { - init: function() { - this.appendDummyInput() - .setAlign(Blockly.ALIGN_CENTRE) - .appendField('force hats'); - this.appendDummyInput() - .appendField(new CustomFields.FieldTurtle( - 'Dots', 'Crown', 'Yertle', this.validate), 'TURTLE'); - this.setStyle('loop_blocks'); - this.setCommentText('Validates the input so that certain names always' + - ' have specific hats. The name-hat combinations are: (Leonardo, Mask),' + - ' (Yertle, Crown), (Franklin, Propeller).'); - }, - - validate: function(newValue) { - switch(newValue.turtleName) { - case 'Leonardo': - newValue.hat = 'Mask'; - break; - case 'Yertle': - newValue.hat = 'Crown'; - break; - case 'Franklin': - newValue.hat = 'Propeller'; - break; - } - return newValue; - } -}; diff --git a/res/lib/blockly/demos/custom-fields/turtle/field_turtle.js b/res/lib/blockly/demos/custom-fields/turtle/field_turtle.js deleted file mode 100644 index 8a4a08301d400dd07aeb879fc3c15b65ef83a8b9..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/turtle/field_turtle.js +++ /dev/null @@ -1,757 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview A field used to customize a turtle. - * @author bekawestberg@gmail.com (Beka Westberg) - */ -'use strict'; - -// You must provide the constructor for your custom field. -goog.provide('CustomFields.FieldTurtle'); - -// You must require the abstract field class to inherit from. -goog.require('Blockly.Field'); -goog.require('Blockly.fieldRegistry'); -goog.require('Blockly.utils'); -goog.require('Blockly.utils.dom'); -goog.require('Blockly.utils.object'); -goog.require('Blockly.utils.Size'); - -var CustomFields = CustomFields || {}; - -// Generally field's values should be optional, and have logical defaults. -// If this is not possible (for example image fields can't have logical -// defaults) the field should throw a clear error when a value is not provided. -// Editable fields also generally accept validators, so we will accept a -// validator. -CustomFields.FieldTurtle = function( - opt_pattern, opt_hat, opt_turtleName, opt_validator) { - - // The turtle field contains an object as its value, so we need to compile - // the parameters into an object. - var value = {}; - value.pattern = opt_pattern || CustomFields.FieldTurtle.PATTERNS[0]; - value.hat = opt_hat || CustomFields.FieldTurtle.HATS[0]; - value.turtleName = opt_turtleName || CustomFields.FieldTurtle.NAMES[0]; - - // A field constructor should always call its parent constructor, because - // that helps keep the code organized and DRY. - CustomFields.FieldTurtle.superClass_.constructor.call( - this, value, opt_validator); - - /** - * The size of the area rendered by the field. - * @type {Blockly.utils.Size} - * @protected - * @override - */ - this.size_ = new Blockly.utils.Size(0, 0); -}; -Blockly.utils.object.inherits(CustomFields.FieldTurtle, Blockly.Field); - -// This allows the field to be constructed using a JSON block definition. -CustomFields.FieldTurtle.fromJson = function(options) { - // In this case we simply pass the JSON options along to the constructor, - // but you can also use this to get message references, and other such things. - return new CustomFields.FieldTurtle( - options['pattern'], - options['hat'], - options['turtleName']); -}; - -// Since this field is editable we must also define serializable as true -// (for backwards compatibility reasons serializable is false by default). -CustomFields.FieldTurtle.prototype.SERIALIZABLE = true; - -// The cursor property defines what the mouse will look like when the user -// hovers over the field. By default the cursor will be whatever -// .blocklyDraggable's cursor is defined as (vis. grab). Most fields define -// this property as 'default'. -CustomFields.FieldTurtle.prototype.CURSOR = 'pointer'; - -// How far to move the text to keep it to the right of the turtle. -// May change if the turtle gets fancy enough. -CustomFields.FieldTurtle.prototype.TEXT_OFFSET_X = 80; - -// Padding that the border rect adds around the turtle and its name. -CustomFields.FieldTurtle.prototype.PADDING = Blockly.Field.X_PADDING; - -// These are the different options for our turtle. Being declared this way -// means they are static, and not translatable. If you want to do something -// similar, but make it translatable you should set up your options like a -// dropdown field, with language-neutral keys and human-readable values. -CustomFields.FieldTurtle.PATTERNS = - ['Dots', 'Stripes', 'Hexagons']; -CustomFields.FieldTurtle.HATS = - ['Stovepipe', 'Crown', 'Propeller', 'Mask', 'Fedora']; -CustomFields.FieldTurtle.NAMES = - ['Yertle', 'Franklin', 'Crush', 'Leonardo', 'Bowser', 'Squirtle', 'Oogway']; - -// Used to keep track of our editor event listeners, so they can be -// properly disposed of when the field closes. You can keep track of your -// listeners however you want, just be sure to dispose of them! -CustomFields.FieldTurtle.prototype.editorListeners_ = []; - -// Used to create the DOM of our field. -CustomFields.FieldTurtle.prototype.initView = function() { - // Because we want to have both a borderRect_ (background) and a - // textElement_ (text) we can call the super-function. If we only wanted - // one or the other, we could call their individual createX functions. - CustomFields.FieldTurtle.superClass_.initView.call(this); - - // Note that the field group is created by the abstract field's init_ - // function. This means that *all elements* should be children of the - // fieldGroup_. - this.createView_(); -}; - -// Updates how the field looks depending on if it is editable or not. -CustomFields.FieldTurtle.prototype.updateEditable = function() { - if (!this.fieldGroup_) { - // Not initialized yet. - return; - } - // The default functionality just makes it so the borderRect_ does not - // highlight when hovered. - Blockly.FieldColour.superClass_.updateEditable.call(this); - // Things like this are best applied to the clickTarget_. By default the - // click target is the same as getSvgRoot, which by default is the - // fieldGroup_. - var group = this.getClickTarget_(); - if (!this.isCurrentlyEditable()) { - group.style.cursor = 'not-allowed'; - } else { - group.style.cursor = this.CURSOR; - } -}; - -// Gets the text to display when the block is collapsed -CustomFields.FieldTurtle.prototype.getText = function() { - var text = this.value_.turtleName + ' wearing a ' + this.value_.hat; - if (this.value_.hat == 'Stovepipe' || this.value_.hat == 'Propeller') { - text += ' hat'; - } - return text; -}; - -// Makes sure new field values (given to setValue) are valid, meaning -// something this field can legally "hold". Class validators can either change -// the input value, or return null if the input value is invalid. Called by -// the setValue() function. -CustomFields.FieldTurtle.prototype.doClassValidation_ = function(newValue) { - // Undefined signals that we want the value to remain unchanged. This is a - // special feature of turtle fields, but could be useful for other - // multi-part fields. - if (newValue.pattern == undefined) { - newValue.pattern = this.displayValue_ && this.displayValue_.pattern; - // We only want to allow patterns that are part of our pattern list. - // Anything else is invalid, so we return null. - } else if (CustomFields.FieldTurtle.PATTERNS.indexOf(newValue.pattern) == -1) { - newValue.pattern = null; - } - - if (newValue.hat == undefined) { - newValue.hat = this.displayValue_ && this.displayValue_.hat; - } else if (CustomFields.FieldTurtle.HATS.indexOf(newValue.hat) == -1) { - newValue.hat = null; - } - - if (newValue.turtleName == undefined) { - newValue.turtleName = this.displayValue_ && this.displayValue_.turtleName; - } else if (CustomFields.FieldTurtle.NAMES.indexOf(newValue.turtleName) == -1) { - newValue.turtleName = null; - } - - // This is a strategy for dealing with defaults on multi-part values. - // The class validator sets individual properties of the object to null - // to indicate that they are invalid, and then caches that object to the - // cachedValidatedValue_ property. This way the field can, for - // example, properly handle an invalid pattern, combined with a valid hat. - // This can also be done with local validators. - this.cachedValidatedValue_ = newValue; - - // Always be sure to return! - if (!newValue.pattern || !newValue.hat || !newValue.turtleName) { - return null; - } - return newValue; -}; - -// Saves the new field value. Called by the setValue function. -CustomFields.FieldTurtle.prototype.doValueUpdate_ = function(newValue) { - // The default function sets this field's this.value_ property to the - // newValue, and its this.isDirty_ property to true. The isDirty_ property - // tells the setValue function whether the field needs to be re-rendered. - CustomFields.FieldTurtle.superClass_.doValueUpdate_.call(this, newValue); - this.displayValue_ = newValue; - // Since this field has custom UI for invalid values, we also want to make - // sure it knows it is now valid. - this.isValueInvalid_ = false; -}; - -// Notifies that the field that the new value was invalid. Called by -// setValue function. Can either be triggered by the class validator, or the -// local validator. -CustomFields.FieldTurtle.prototype.doValueInvalid_ = function(invalidValue) { - // By default this function is no-op, meaning if the new value is invalid - // the field simply won't be updated. This field has custom UI for invalid - // values, so we override this function. - - // We want the value to be displayed like normal. - // But we want to flag it as invalid, so the render_ function knows to - // make the borderRect_ red. - this.displayValue_ = invalidValue; - this.isDirty_ = true; - this.isValueInvalid_ = true; -}; - -// Updates the field's on-block display based on the current display value. -CustomFields.FieldTurtle.prototype.render_ = function() { - var value = this.displayValue_; - - // Always do editor updates inside render. This makes sure the editor - // always displays the correct value, even if a validator changes it. - if (this.editor_) { - this.renderEditor_(); - } - - this.stovepipe_.style.display = 'none'; - this.crown_.style.display = 'none'; - this.mask_.style.display = 'none'; - this.propeller_.style.display = 'none'; - this.fedora_.style.display = 'none'; - switch(value.hat) { - case 'Stovepipe': - this.stovepipe_.style.display = ''; - this.turtleGroup_.setAttribute('transform', 'translate(0,12)'); - this.textElement_.setAttribute( - 'transform', 'translate(' + this.TEXT_OFFSET_X + ',20)'); - break; - case 'Crown': - this.crown_.style.display = ''; - this.turtleGroup_.setAttribute('transform', 'translate(0,9)'); - this.textElement_.setAttribute( - 'transform', 'translate(' + this.TEXT_OFFSET_X + ',16)'); - break; - case 'Mask': - this.mask_.style.display = ''; - this.turtleGroup_.setAttribute('transform', 'translate(0,1.2)'); - this.textElement_.setAttribute('transform', - 'translate(' + this.TEXT_OFFSET_X + ',4)'); - break; - case 'Propeller': - this.propeller_.style.display = ''; - this.turtleGroup_.setAttribute('transform', 'translate(0,6)'); - this.textElement_.setAttribute('transform', - 'translate(' + this.TEXT_OFFSET_X + ',12)'); - break; - case 'Fedora': - this.fedora_.style.display = ''; - this.turtleGroup_.setAttribute('transform', 'translate(0,6)'); - this.textElement_.setAttribute('transform', - 'translate(' + this.TEXT_OFFSET_X + ',12)'); - break; - } - - switch(value.pattern) { - case 'Dots': - this.shellPattern_.setAttribute('fill', 'url(#polkadots)'); - break; - case 'Stripes': - this.shellPattern_.setAttribute('fill', 'url(#stripes)'); - break; - case 'Hexagons': - this.shellPattern_.setAttribute('fill', 'url(#hexagons)'); - break; - } - - // Always modify the textContent_ rather than the textElement_. This - // allows fields to append DOM to the textElement (e.g. the angle field). - this.textContent_.nodeValue = value.turtleName; - - if (this.isValueInvalid_) { - this.borderRect_.style.fill = '#f99'; - this.borderRect_.style.fillOpacity = 1; - } else { - this.borderRect_.style.fill = '#fff'; - this.borderRect_.style.fillOpacity = 0.6; - } - - this.updateSize_(); -}; - -CustomFields.FieldTurtle.prototype.renderEditor_ = function() { - var value = this.displayValue_; - - // .textElement is a property assigned to the element. - // It allows the text to be edited without destroying the warning icon. - this.editor_.patternText.textElement.nodeValue = value.pattern; - this.editor_.hatText.textElement.nodeValue = value.hat; - this.editor_.turtleNameText.textElement.nodeValue = value.turtleName; - - this.editor_.patternText.warningIcon.style.display = - this.cachedValidatedValue_.pattern ? 'none' : ''; - this.editor_.hatText.warningIcon.style.display = - this.cachedValidatedValue_.hat ? 'none' : ''; - this.editor_.turtleNameText.warningIcon.style.display = - this.cachedValidatedValue_.turtleName ? 'none' : ''; -}; - -// Used to update the size of the field. This function's logic could be simply -// included inside render_ (it is not called anywhere else), but it is -// usually separated to keep code more organized. -CustomFields.FieldTurtle.prototype.updateSize_ = function() { - var bbox = this.movableGroup_.getBBox(); - var width = bbox.width; - var height = bbox.height; - if (this.borderRect_) { - width += this.PADDING; - height += this.PADDING; - this.borderRect_.setAttribute('width', width); - this.borderRect_.setAttribute('height', height); - } - // Note how both the width and the height can be dynamic. - this.size_.width = width; - this.size_.height = height; -}; - -// Called when the field is clicked. It is usually used to show an editor, -// but it can also be used for other things e.g. the checkbox field uses -// this function to check/uncheck itself. -CustomFields.FieldTurtle.prototype.showEditor_ = function() { - this.editor_ = this.dropdownCreate_(); - this.renderEditor_(); - Blockly.DropDownDiv.getContentDiv().appendChild(this.editor_); - - // These allow us to have the editor match the block's colour. - var fillColour = this.sourceBlock_.getColour(); - // This is technically a package function, meaning it could change. - var borderColours = this.sourceBlock_.getColourBorder(); - var borderColour = borderColours.colourBorder || borderColours.colourDark; - Blockly.DropDownDiv.setColour(fillColour, borderColour); - - // Always pass the dropdown div a dispose function so that you can clean - // up event listeners when the editor closes. - Blockly.DropDownDiv.showPositionedByField( - this, this.dropdownDispose_.bind(this)); -}; - -// Creates the UI of the editor, and adds event listeners to it. -CustomFields.FieldTurtle.prototype.dropdownCreate_ = function() { - var createRow = function(table) { - var row = table.appendChild(document.createElement('tr')); - row.className = 'row'; - return row; - }; - var createLeftArrow = function(row) { - var cell = document.createElement('div'); - cell.className = 'arrow'; - var leftArrow = document.createElement('button'); - leftArrow.setAttribute('type', 'button'); - leftArrow.textContent = '<'; - cell.appendChild(leftArrow); - row.appendChild(cell); - return cell; - }; - var createTextNode = function(row, text) { - var cell = document.createElement('div'); - cell.className = 'text'; - var text = document.createTextNode(text); - cell.appendChild(text); - cell.textElement = text; - var warning = document.createElement('img'); - warning.setAttribute('src', 'media/warning.svg'); - warning.setAttribute('height', '16px'); - warning.setAttribute('width', '16px'); - warning.style.marginLeft = '4px'; - cell.appendChild(warning); - cell.warningIcon = warning; - row.appendChild(cell); - return cell; - }; - var createRightArrow = function(row) { - var cell = document.createElement('div'); - cell.className = 'arrow'; - var rightArrow = document.createElement('button'); - rightArrow.setAttribute('type', 'button'); - rightArrow.textContent = '>'; - cell.appendChild(rightArrow); - row.appendChild(cell); - return cell; - }; - var createArrowListener = function(variable, array, direction) { - return function() { - var currentIndex = array.indexOf(this.displayValue_[variable]); - currentIndex += direction; - if (currentIndex <= -1) { - currentIndex = array.length - 1; - } else if (currentIndex >= array.length) { - currentIndex = 0; - } - var value = {}; - value[variable] = array[currentIndex]; - this.setValue(value); - }; - }; - - var widget = document.createElement('div'); - widget.className = 'customFieldsTurtleWidget blocklyNonSelectable'; - - var table = document.createElement('div'); - table.className = 'table'; - widget.appendChild(table); - - var row = createRow(table); - var leftArrow = createLeftArrow(row); - widget.patternText = createTextNode(row, this.displayValue_.pattern); - var rightArrow = createRightArrow(row); - this.editorListeners_.push(Blockly.bindEvent_(leftArrow, 'mouseup', this, - createArrowListener('pattern', CustomFields.FieldTurtle.PATTERNS, -1))); - this.editorListeners_.push(Blockly.bindEvent_(rightArrow, 'mouseup', this, - createArrowListener('pattern', CustomFields.FieldTurtle.PATTERNS, 1))); - - row = createRow(table); - leftArrow = createLeftArrow(row); - widget.hatText = createTextNode(row, this.displayValue_.hat); - rightArrow = createRightArrow(row); - this.editorListeners_.push(Blockly.bindEvent_(leftArrow, 'mouseup', this, - createArrowListener('hat', CustomFields.FieldTurtle.HATS, -1))); - this.editorListeners_.push(Blockly.bindEvent_(rightArrow, 'mouseup', this, - createArrowListener('hat', CustomFields.FieldTurtle.HATS, 1))); - - row = createRow(table); - leftArrow = createLeftArrow(row); - widget.turtleNameText = createTextNode(row, this.displayValue_.turtleName); - rightArrow = createRightArrow(row); - this.editorListeners_.push(Blockly.bindEvent_(leftArrow, 'mouseup', this, - createArrowListener('turtleName', CustomFields.FieldTurtle.NAMES, -1))); - this.editorListeners_.push(Blockly.bindEvent_(rightArrow, 'mouseup', this, - createArrowListener('turtleName', CustomFields.FieldTurtle.NAMES, 1))); - - var randomizeButton = document.createElement('button'); - randomizeButton.className = 'randomize'; - randomizeButton.setAttribute('type', 'button'); - randomizeButton.textContent = 'randomize turtle'; - this.editorListeners_.push(Blockly.bindEvent_(randomizeButton, 'mouseup', this, - function() { - var value = {}; - value.pattern = CustomFields.FieldTurtle.PATTERNS[ - Math.floor(Math.random() * CustomFields.FieldTurtle.PATTERNS.length)]; - - value.hat = CustomFields.FieldTurtle.HATS[ - Math.floor(Math.random() * CustomFields.FieldTurtle.HATS.length)]; - - value.turtleName = CustomFields.FieldTurtle.NAMES[ - Math.floor(Math.random() * CustomFields.FieldTurtle.NAMES.length)]; - - this.setValue(value); - })); - widget.appendChild(randomizeButton); - - return widget; -}; - -// Cleans up any event listeners that were attached to the now hidden editor. -CustomFields.FieldTurtle.prototype.dropdownDispose_ = function() { - for (var i = this.editorListeners_.length, listener; - listener = this.editorListeners_[i]; i--) { - Blockly.unbindEvent_(listener); - this.editorListeners_.pop(); - } -}; - -// Updates the field's colour based on the colour of the block. Called by -// block.updateColour. -CustomFields.FieldTurtle.prototype.updateColour = function() { - if (!this.sourceBlock_) { - return; - } - // The getColourX functions are the best way to access the colours of a block. - var isShadow = this.sourceBlock_.isShadow(); - var fillColour = isShadow ? - this.sourceBlock_.getColourShadow() : this.sourceBlock_.getColour(); - // This is technically a package function, meaning it could change. - var borderColours = this.sourceBlock_.getColourBorder(); - var borderColour = isShadow ? fillColour : - borderColours.colourBorder || borderColours.colourDark; - - var child = this.turtleGroup_.firstChild; - while(child) { - // If it is a text node, continue. - if (child.nodeType == 3) { - child = child.nextSibling; - continue; - } - // Or if it is a non-turtle node, continue. - var className = child.getAttribute('class'); - if (!className || className.indexOf('turtleBody') == -1) { - child = child.nextSibling; - continue; - } - - child.style.fill = fillColour; - child.style.stroke = borderColour; - child = child.nextSibling; - } -}; - -// Saves the field's value to an XML node. Allows for custom serialization. -CustomFields.FieldTurtle.prototype.toXml = function(fieldElement) { - // The default implementation of this function creates a node that looks - // like this: (where value is returned by getValue()) - // <field name="FIELDNAME">value</field> - // But this doesn't work for our field because it stores an /object/. - - fieldElement.setAttribute('pattern', this.value_.pattern); - fieldElement.setAttribute('hat', this.value_.hat); - // The textContent usually contains whatever is closest to the field's - // 'value'. The textContent doesn't need to contain anything, but saving - // something to it does aid in readability. - fieldElement.textContent = this.value_.turtleName; - - // Always return the element! - return fieldElement; -}; - -// Sets the field's value based on an XML node. Allows for custom -// de-serialization. -CustomFields.FieldTurtle.prototype.fromXml = function(fieldElement) { - // Because we had to do custom serialization for this field, we also need - // to do custom de-serialization. - - var value = {}; - value.pattern = fieldElement.getAttribute('pattern'); - value.hat = fieldElement.getAttribute('hat'); - value.turtleName = fieldElement.textContent; - // The end goal is to call this.setValue() - this.setValue(value); -}; - -// Blockly needs to know the JSON name of this field. Usually this is -// registered at the bottom of the field class. -Blockly.fieldRegistry.register('field_turtle', CustomFields.FieldTurtle); - -// Called by initView to create all of the SVGs. This is just used to keep -// the code more organized. -CustomFields.FieldTurtle.prototype.createView_ = function() { - this.movableGroup_ = Blockly.utils.dom.createSvgElement('g', - { - 'transform': 'translate(0,5)' - }, this.fieldGroup_); - var scaleGroup = Blockly.utils.dom.createSvgElement('g', - { - 'transform': 'scale(1.5)' - }, this.movableGroup_); - this.turtleGroup_ = Blockly.utils.dom.createSvgElement('g', - { - // Makes the smaller turtle graphic align with the hats. - 'class': 'turtleBody' - }, scaleGroup); - var tail = Blockly.utils.dom.createSvgElement('path', - { - 'class': 'turtleBody', - 'd': 'M7,27.5H0.188c3.959-2,6.547-2.708,8.776-5.237', - 'transform': 'translate(0.312 -12.994)' - }, this.turtleGroup_); - var legLeft = Blockly.utils.dom.createSvgElement('rect', - { - 'class': 'turtleBody', - 'x': 8.812, - 'y': 12.506, - 'width': 4, - 'height': 10 - }, this.turtleGroup_); - var legRight = Blockly.utils.dom.createSvgElement('rect', - { - 'class': 'turtleBody', - 'x': 28.812, - 'y': 12.506, - 'width': 4, - 'height': 10 - }, this.turtleGroup_); - var head = Blockly.utils.dom.createSvgElement('path', - { - 'class': 'turtleBody', - 'd': 'M47.991,17.884c0,1.92-2.144,3.477-4.788,3.477a6.262,6.262,0,0,1-2.212-.392c-0.2-.077-1.995,2.343-4.866,3.112a17.019,17.019,0,0,1-6.01.588c-4.413-.053-2.5-3.412-2.745-3.819-0.147-.242,2.232.144,6.126-0.376a7.392,7.392,0,0,0,4.919-2.588c0-1.92,2.144-3.477,4.788-3.477S47.991,15.964,47.991,17.884Z', - 'transform': 'translate(0.312 -12.994)' - }, this.turtleGroup_); - var smile = Blockly.utils.dom.createSvgElement('path', - { - 'class': 'turtleBody', - 'd': 'M42.223,18.668a3.614,3.614,0,0,0,2.728,2.38', - 'transform': 'translate(0.312 -12.994)' - }, this.turtleGroup_); - var sclera = Blockly.utils.dom.createSvgElement('ellipse', - { - 'cx': 43.435, - 'cy': 2.61, - 'rx': 2.247, - 'ry': 2.61, - 'fill': '#fff' - }, this.turtleGroup_); - var pupil = Blockly.utils.dom.createSvgElement('ellipse', - { - 'cx': 44.166, - 'cy': 3.403, - 'rx': 1.318, - 'ry': 1.62 - }, this.turtleGroup_); - var shell = Blockly.utils.dom.createSvgElement('path', - { - 'class': 'turtleBody', - 'd': 'M33.4,27.5H7.193c0-6,5.866-13.021,13.1-13.021S33.4,21.5,33.4,27.5Z', - 'transform': 'translate(0.312 -12.994)' - }, this.turtleGroup_); - this.shellPattern_ = Blockly.utils.dom.createSvgElement('path', - { - 'd': 'M33.4,27.5H7.193c0-6,5.866-13.021,13.1-13.021S33.4,21.5,33.4,27.5Z', - 'transform': 'translate(0.312 -12.994)' - }, this.turtleGroup_); - - this.stovepipe_ = Blockly.utils.dom.createSvgElement('image', - { - 'width': '50', - 'height': '18' - }, scaleGroup); - this.stovepipe_.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', - 'media/stovepipe.svg'); - this.crown_ = Blockly.utils.dom.createSvgElement('image', - { - 'width': '50', - 'height': '15' - }, scaleGroup); - this.crown_.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', - 'media/crown.svg'); - this.mask_ = Blockly.utils.dom.createSvgElement('image', - { - 'width': '50', - 'height': '14' - }, scaleGroup); - this.mask_.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', - 'media/mask.svg'); - this.propeller_ = Blockly.utils.dom.createSvgElement('image', - { - 'width': '50', - 'height': '11' - }, scaleGroup); - this.propeller_.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', - 'media/propeller.svg'); - this.fedora_ = Blockly.utils.dom.createSvgElement('image', - { - 'width': '50', - 'height': '12' - }, scaleGroup); - this.fedora_.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', - 'media/fedora.svg'); - - // Even if we're not going to display it right away, we want to create all - // of our DOM elements inside this function. - this.crown_.style.display = 'none'; - this.mask_.style.display = 'none'; - this.propeller_.style.display = 'none'; - this.fedora_.style.display = 'none'; - - this.movableGroup_.appendChild(this.textElement_); - this.textElement_.setAttribute( - 'transform', 'translate(' + this.TEXT_OFFSET_X + ',20)'); - - this.defs_ = Blockly.utils.dom.createSvgElement('defs', {}, this.fieldGroup_); - this.polkadotPattern_ = Blockly.utils.dom.createSvgElement('pattern', - { - 'id': 'polkadots', - 'patternUnits': 'userSpaceOnUse', - 'width': 10, - 'height': 10 - }, this.defs_); - this.polkadotGroup_ = Blockly.utils.dom.createSvgElement( - 'g', {}, this.polkadotPattern_); - Blockly.utils.dom.createSvgElement('circle', - { - 'cx': 2.5, - 'cy': 2.5, - 'r': 2.5, - 'fill': '#000', - 'fill-opacity': .3 - }, this.polkadotGroup_); - Blockly.utils.dom.createSvgElement('circle', - { - 'cx': 7.5, - 'cy': 7.5, - 'r': 2.5, - 'fill': '#000', - 'fill-opacity': .3 - }, this.polkadotGroup_); - - this.hexagonPattern_ = Blockly.utils.dom.createSvgElement('pattern', - { - 'id': 'hexagons', - 'patternUnits': 'userSpaceOnUse', - 'width': 10, - 'height': 8.68, - 'patternTransform': 'translate(2) rotate(45)' - }, this.defs_); - Blockly.utils.dom.createSvgElement('polygon', - { - 'id': 'hex', - 'points': '4.96,4.4 7.46,5.84 7.46,8.74 4.96,10.18 2.46,8.74 2.46,5.84', - 'stroke': '#000', - 'stroke-opacity': .3, - 'fill-opacity': 0 - }, this.hexagonPattern_); - var use = Blockly.utils.dom.createSvgElement('use', - { - 'x': 5, - }, this.hexagonPattern_); - use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#hex'); - use = Blockly.utils.dom.createSvgElement('use', - { - 'x': -5, - }, this.hexagonPattern_); - use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#hex'); - use = Blockly.utils.dom.createSvgElement('use', - { - 'x': 2.5, - 'y': -4.34 - }, this.hexagonPattern_); - use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#hex'); - use = Blockly.utils.dom.createSvgElement('use', - { - 'x': -2.5, - 'y': -4.34 - }, this.hexagonPattern_); - use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#hex'); - - this.stripesPattern_ = Blockly.utils.dom.createSvgElement('pattern', - { - 'id': 'stripes', - 'patternUnits': 'userSpaceOnUse', - 'width': 5, - 'height': 10, - 'patternTransform': 'rotate(45)' - }, this.defs_); - Blockly.utils.dom.createSvgElement('line', - { - 'x1': 0, - 'y1': 0, - 'x2': 0, - 'y2': 10, - 'stroke-width': 4, - 'stroke': '#000', - 'stroke-opacity': .3 - }, this.stripesPattern_); -}; diff --git a/res/lib/blockly/demos/custom-fields/turtle/icon.png b/res/lib/blockly/demos/custom-fields/turtle/icon.png deleted file mode 100644 index 3a7314ac970453def5ae544be3c41722a44e2303..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/custom-fields/turtle/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/custom-fields/turtle/index.html b/res/lib/blockly/demos/custom-fields/turtle/index.html deleted file mode 100644 index 682eb8aa84a0ae29a9dd13509ad1f03b4206a11d..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/turtle/index.html +++ /dev/null @@ -1,174 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="UTF-8"> - <title>Blockly Demo: Custom Turtle Field</title> - <script src="../../../blockly_uncompressed.js"></script> - <script src="blocks.js"></script> - <script src="field_turtle.js"></script> - <script src="../../../msg/js/en.js"></script> - <style> - body { - margin: 0 10%; - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - td { - padding: 1ex; - } - img { - border: none; - } - </style> - <link rel="stylesheet" type="text/css" href="turtle.css"> - </head> - <body onload="start()"> - <h1> - <a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../../index.html">Demos</a> > - <a href="../index.html">Custom Fields</a> > Turtle Field</h1> - - - <p>This is a demo of creating custom block fields. In this case the field - is used to define a turtle. - </p> - - <p>All of the custom field implementation is in - demos/custom-fields/turtle/field_turtle.js, including comments on each required - function. - </p> - - <p>Click on the blocks' comment icons to learn what they are demonstrating. - Use the buttons below to see how the fields react to changes. - </p> - - <p> - <input type="button" value="set random style" onclick="setRandomStyle()"> - <input type="button" value="toggle shadow" onclick="toggleShadow()"> - <input type="button" value="toggle enabled" onclick="toggleEnabled()"> - <input type="button" value="toggle editable" onclick="toggleEditable()"> - <input type="button" value="toggle collapsed" onclick="toggleCollapsed()"> - </p> - - <p> - <input type="button" value="Export to XML" onclick="toXml()"> - <input type="button" value="Import from XML" onclick="fromXml()"> - </p> - - <table> - <tr> - <td> - <textarea id="importExport" - style="width: 200px; height: 480px;" - onchange="textAreaChange();" - onkeyup="textAreaChange()"></textarea> - </td> - <td> - <div id="blocklyDiv" style="width: 600px; height: 480px;"></div> - </td> - </tr> - </table> - - <script> - function toXml() { - var output = document.getElementById('importExport'); - var xml = Blockly.Xml.workspaceToDom(workspace); - output.value = Blockly.Xml.domToPrettyText(xml); - output.focus(); - output.select(); - } - - function fromXml() { - var input = document.getElementById('importExport'); - var xml = Blockly.Xml.textToDom(input.value); - Blockly.Xml.domToWorkspace(xml, workspace); - } - - function setRandomStyle() { - var blocks = workspace.getAllBlocks(); - var styles = Object.keys(workspace.getTheme().getAllBlockStyles()); - styles.splice(styles.indexOf(blocks[0].getStyleName()), 1); - var style = styles[Math.floor(Math.random() * styles.length)]; - for(var i = 0, block; block = blocks[i]; i++) { - block.setStyle(style); - } - } - - function toggleShadow() { - var blocks = workspace.getAllBlocks(); - for(var i = 0, block; block = blocks[i]; i++) { - block.setShadow(!block.isShadow()); - } - } - - function toggleEnabled() { - var blocks = workspace.getAllBlocks(); - for(var i = 0, block; block = blocks[i]; i++) { - block.setEnabled(!block.isEnabled()); - } - } - - function toggleEditable() { - Blockly.hideChaff(); - var blocks = workspace.getAllBlocks(); - for(var i = 0, block; block = blocks[i]; i++) { - block.setEditable(!block.isEditable()); - } - } - - function toggleCollapsed() { - Blockly.hideChaff(); - var blocks = workspace.getAllBlocks(); - for(var i = 0, block; block = blocks[i]; i++) { - block.setCollapsed(!block.isCollapsed()); - } - } - - function appendDom() { - var blocks = document.getElementById('workspace-blocks'); - if (blocks.firstElementChild) { - Blockly.Xml.appendDomToWorkspace(blocks, workspace); - } - } - - function start() { - workspace = Blockly.inject('blocklyDiv', options); - appendDom(); - workspace.scrollCenter(); - } - - var options = { - media: '../../../media/', - grid: { - spacing: 25, - length: 3, - colour: '#ccc' - }, - move: { - scrollbars: true, - drag: true, - wheel: true, - }, - zoom: { - controls: true, - startScale: 1.0, - maxScale: 4, - minScale: 0.25, - scaleSpeed: 1.1 - } - /*toolbox: document.getElementById('toolbox')*/ - } - - </script> - - <xml xmlns="https://developers.google.com/blockly/xml" id="workspace-blocks" style="display: none"> - <block type="turtle_basic"></block> - <block type="turtle_nullifier" y="120"></block> - <block type="turtle_changer" y="230"></block> - </xml> - </body> -</html> diff --git a/res/lib/blockly/demos/custom-fields/turtle/media/crown.svg b/res/lib/blockly/demos/custom-fields/turtle/media/crown.svg deleted file mode 100644 index 3eebccb9228b70c139dea1e9270f2ae769c3f90f..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/turtle/media/crown.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 15"><defs><style>.a{fill:#fff200;}.b{fill:#f3bd1f;}</style></defs><title>crown</title><polygon class="a" points="38.778 13.941 46.824 9.457 44.8 1.575 43.401 7.589 38.826 4.23 39.147 9.918 33.292 8.096 38.778 13.941"/><circle class="a" cx="33.228" cy="7.972" r="1.194" transform="translate(0.253 16.931) rotate(-28.691)"/><circle class="a" cx="38.785" cy="4.3" r="1.194" transform="translate(2.698 19.148) rotate(-28.691)"/><circle class="a" cx="44.662" cy="1.663" r="1.194" transform="translate(4.685 21.646) rotate(-28.691)"/><polygon class="b" points="37.846 12.954 46.508 8.199 46.154 6.836 36.888 11.921 37.846 12.954"/></svg> \ No newline at end of file diff --git a/res/lib/blockly/demos/custom-fields/turtle/media/fedora.svg b/res/lib/blockly/demos/custom-fields/turtle/media/fedora.svg deleted file mode 100644 index 4a354491bd828b06499ff62cafd42ba9a01e762d..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/turtle/media/fedora.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 12"><defs><style>.a{fill:#8b5e3c;}.b{fill:#3c2415;}.c{fill:none;stroke:#754c29;stroke-linecap:round;stroke-miterlimit:10;}</style></defs><title>fedora</title><polygon class="a" points="38.548 9.742 38.264 4.844 41.403 5.223 42.508 1.407 47.846 5.918 46.334 7.664 38.548 9.742"/><path class="b" d="M41.133,8.362l1.1,0.236c1.9-1.066,3.844-2.051,4.741-3.392L45.78,4.193A22.044,22.044,0,0,1,41.133,8.362Z"/><path class="c" d="M37.233,11.3A12.1,12.1,0,0,1,40.4,9.09c1.7-.743,3.625-0.71,5.325-1.3a5.62,5.62,0,0,0,2.678-2.5"/></svg> \ No newline at end of file diff --git a/res/lib/blockly/demos/custom-fields/turtle/media/mask.svg b/res/lib/blockly/demos/custom-fields/turtle/media/mask.svg deleted file mode 100644 index eb4fded1c7afff1fd94bb58ddd67753373f8e40e..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/turtle/media/mask.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 14"><defs><style>.a{fill:#00aeef;}</style></defs><title>mask</title><path class="a" d="M43.5,0.94C42.329,1.2,39.032,3.75,39,4.531a21.249,21.249,0,0,0,3.5,1.811,10.847,10.847,0,0,0,4.065,0c0.751-.189,2.812-1.03,2.729-1.893-0.116-1.2-1.7-2.561-2.478-3.007A4.983,4.983,0,0,0,43.5.94Zm0.64,5.29a2.409,2.409,0,0,1-2.251-2.564,2.272,2.272,0,1,1,4.493,0A2.4,2.4,0,0,1,44.139,6.23Z"/><polygon class="a" points="38.996 4.531 42.106 9.154 40.018 13.776 38.996 4.531"/><polygon class="a" points="38.996 4.531 37.456 9.544 33.559 11.437 38.996 4.531"/></svg> \ No newline at end of file diff --git a/res/lib/blockly/demos/custom-fields/turtle/media/propeller.svg b/res/lib/blockly/demos/custom-fields/turtle/media/propeller.svg deleted file mode 100644 index bf0a433fd2b0531fa60acfa9eee9c5b57ddaed77..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/turtle/media/propeller.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 11"><defs><style>.a{fill:#00aeef;}.b{fill:#ed1c24;}.c{fill:#fff200;}</style></defs><title>propeller</title><path class="a" d="M39.974,3.854c-2.022.99-2.948,3.89-1.509,6.828L40.716,9.56A10.329,10.329,0,0,1,39.974,3.854Z"/><path class="b" d="M39.974,3.854c1.975-.967,4.846-0.012,6.319,3L44.277,7.873A8.089,8.089,0,0,0,39.974,3.854Z"/><path class="c" d="M39.974,3.854a8.088,8.088,0,0,1,4.3,4.02l-3.55,1.71A10.011,10.011,0,0,1,39.974,3.854Z"/><path class="c" d="M35.795,4.493a3.81,3.81,0,0,1,1.016-.871A3.548,3.548,0,0,1,38.032,3.1a4.2,4.2,0,0,0,1.483-.434,9.15,9.15,0,0,0,1.245-.92A4.585,4.585,0,0,1,41.926,1.1a3.941,3.941,0,0,1,1.3-.3L43.364,1.1a3.941,3.941,0,0,1-1.031.84,4.585,4.585,0,0,1-1.219.53,9.149,9.149,0,0,0-1.49.419,4.194,4.194,0,0,0-1.252.905,3.549,3.549,0,0,1-1.164.642A3.81,3.81,0,0,1,35.9,4.7Z"/></svg> \ No newline at end of file diff --git a/res/lib/blockly/demos/custom-fields/turtle/media/stovepipe.svg b/res/lib/blockly/demos/custom-fields/turtle/media/stovepipe.svg deleted file mode 100644 index 6971ff7fdb6552c4d2a551ff69d6539081de90dd..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/turtle/media/stovepipe.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 18"><defs><style>.a,.c{fill:#231f20;stroke:#231f20;}.a,.b,.c{stroke-linejoin:round;}.b{fill:#fff;stroke:#fff;}.c{stroke-linecap:round;}</style></defs><title>stovepipe</title><rect class="a" x="33.995" y="2.114" width="8.322" height="11.675" transform="translate(0.82 19.139) rotate(-28.453)"/><rect class="b" x="36.206" y="10.835" width="8.322" height="2.394" transform="translate(-0.856 20.686) rotate(-28.453)"/><line class="c" x1="35.164" y1="16.971" x2="47.341" y2="10.373"/></svg> \ No newline at end of file diff --git a/res/lib/blockly/demos/custom-fields/turtle/media/warning.svg b/res/lib/blockly/demos/custom-fields/turtle/media/warning.svg deleted file mode 100644 index 11136c1ef33958e47c327a18da5a62a76a7a1088..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/turtle/media/warning.svg +++ /dev/null @@ -1,5 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> - <path style="fill: #00c; stroke: #fff; stroke-width: 1px;" d="M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"></path> - <path style="fill: #fff;" d="m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"></path> - <rect style="fill: #fff;" x="7" y="11" height="2" width="2"></rect> -</svg> diff --git a/res/lib/blockly/demos/custom-fields/turtle/turtle.css b/res/lib/blockly/demos/custom-fields/turtle/turtle.css deleted file mode 100644 index c5e5e589ad9baa6640e200b921e4a075e2d09f4d..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/custom-fields/turtle/turtle.css +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -.customFieldsTurtleWidget { - width: 150px; -} - -.customFieldsTurtleWidget button { - border-radius: 4px; - border: none; - background-color: #fff; - opacity: .6; - color: #000; -} - -.customFieldsTurtleWidget .table { - width: 100%; -} - -.customFieldsTurtleWidget .row { - width: 100%; - display: flex; -} - -.customFieldsTurtleWidget .arrow { - text-align: center; - padding: 0; - flex-grow: 0; -} - -.customFieldsTurtleWidget .text { - height: 20px; - color: #fff; - flex-grow: 1; - text-align: center; -} - -.customFieldsTurtleWidget .randomize { - width: 100%; -} - -.blocklyNonEditableText text, -.blocklyEditableText text { - fill: #000; -} diff --git a/res/lib/blockly/demos/fixed/icon.png b/res/lib/blockly/demos/fixed/icon.png deleted file mode 100644 index 0a80ef9a3b8bca5d1765fb924f1c076598623bd8..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/fixed/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/fixed/index.html b/res/lib/blockly/demos/fixed/index.html deleted file mode 100644 index 85d634608f4c17f96a4db7229d6111a91fef0732..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/fixed/index.html +++ /dev/null @@ -1,49 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Fixed Blockly</title> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <style> - body { - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Fixed Blockly</h1> - - <p>This is a simple demo of injecting Blockly into a fixed-sized 'div' element.</p> - - <p>→ More info on <a href="https://developers.google.com/blockly/guides/configure-blockly/web/fixed-size">injecting fixed-sized Blockly</a>…</p> - - <div id="blocklyDiv" style="height: 480px; width: 600px;"></div> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <block type="controls_if"></block> - <block type="logic_compare"></block> - <block type="controls_repeat_ext"></block> - <block type="math_number"> - <field name="NUM">123</field> - </block> - <block type="math_arithmetic"></block> - <block type="text"></block> - <block type="text_print"></block> - </xml> - - <script> - var demoWorkspace = Blockly.inject('blocklyDiv', - {media: '../../media/', - toolbox: document.getElementById('toolbox')}); - </script> - -</body> -</html> diff --git a/res/lib/blockly/demos/generator/icon.png b/res/lib/blockly/demos/generator/icon.png deleted file mode 100644 index c1a84f03427fe3ba4964f317187637caca66407a..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/generator/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/generator/index.html b/res/lib/blockly/demos/generator/index.html deleted file mode 100644 index 6f8744398d0f700eca8d9deae684229e23669b26..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/generator/index.html +++ /dev/null @@ -1,148 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Generating JavaScript</title> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../javascript_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <style> - body { - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Generating JavaScript</h1> - - <p>This is a simple demo of generating code from blocks and running - the code in a sandboxed JavaScript interpreter.</p> - - <p>→ More info on <a href="https://developers.google.com/blockly/guides/configure/web/code-generators">Code Generators</a> and <a href="https://developers.google.com/blockly/guides/app-integration/running-javascript">Running JavaScript</a>.</p> - - <p> - <button onclick="showCode()">Show JavaScript</button> - <button onclick="runCode()">Run JavaScript</button> - </p> - - <div id="blocklyDiv" style="height: 480px; width: 600px;"></div> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <category name="Logic" colour="%{BKY_LOGIC_HUE}"> - <block type="controls_if"></block> - <block type="logic_compare"></block> - <block type="logic_operation"></block> - <block type="logic_negate"></block> - <block type="logic_boolean"></block> - </category> - <category name="Loops" colour="%{BKY_LOOPS_HUE}"> - <block type="controls_repeat_ext"> - <value name="TIMES"> - <block type="math_number"> - <field name="NUM">10</field> - </block> - </value> - </block> - <block type="controls_whileUntil"></block> - </category> - <category name="Math" colour="%{BKY_MATH_HUE}"> - <block type="math_number"> - <field name="NUM">123</field> - </block> - <block type="math_arithmetic"></block> - <block type="math_single"></block> - </category> - <category name="Text" colour="%{BKY_TEXTS_HUE}"> - <block type="text"></block> - <block type="text_length"></block> - <block type="text_print"></block> - </category> - </xml> - - <xml xmlns="https://developers.google.com/blockly/xml" id="startBlocks" style="display: none"> - <block type="controls_if" inline="false" x="20" y="20"> - <mutation else="1"></mutation> - <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"> - <block type="text_print" inline="false"> - <value name="TEXT"> - <block type="text"> - <field name="TEXT">Don't panic</field> - </block> - </value> - </block> - </statement> - <statement name="ELSE"> - <block type="text_print" inline="false"> - <value name="TEXT"> - <block type="text"> - <field name="TEXT">Panic</field> - </block> - </value> - </block> - </statement> - </block> - </xml> - - <script> - var demoWorkspace = Blockly.inject('blocklyDiv', - {media: '../../media/', - toolbox: document.getElementById('toolbox')}); - Blockly.Xml.domToWorkspace(document.getElementById('startBlocks'), - demoWorkspace); - - function showCode() { - // Generate JavaScript code and display it. - Blockly.JavaScript.INFINITE_LOOP_TRAP = null; - var code = Blockly.JavaScript.workspaceToCode(demoWorkspace); - alert(code); - } - - function runCode() { - // Generate JavaScript code and run it. - window.LoopTrap = 1000; - Blockly.JavaScript.INFINITE_LOOP_TRAP = - 'if (--window.LoopTrap == 0) throw "Infinite loop.";\n'; - var code = Blockly.JavaScript.workspaceToCode(demoWorkspace); - Blockly.JavaScript.INFINITE_LOOP_TRAP = null; - try { - eval(code); - } catch (e) { - alert(e); - } - } - </script> - -</body> -</html> diff --git a/res/lib/blockly/demos/graph/icon.png b/res/lib/blockly/demos/graph/icon.png deleted file mode 100644 index 7828463dee6708147350f6920901c5e4534dc16c..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/graph/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/graph/index.html b/res/lib/blockly/demos/graph/index.html deleted file mode 100644 index 2e68c847537541ae7c1c97a9997e1bbc6e56a757..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/graph/index.html +++ /dev/null @@ -1,364 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Graph</title> - <script src="https://www.google.com/jsapi"></script> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../javascript_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <style> - body { - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - #funcText { - margin-top: 1em; - margin-left: 1.5em; - font-family: sans-serif; - } - #funcText>img { - height: 3px; - width: 15px; - vertical-align: middle; - margin-right: .5em; - } - #y1 { - background-color: #36c; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Graph</h1> - - <p>This is a demo of giving instant feedback as blocks are changed.</p> - - <p>→ More info on <a href="https://developers.google.com/blockly/guides/configure/web/code-generators#generating_code">Realtime generation</a>…</p> - - <table> - <tr> - <td> - <div id="visualization" style="width: 400px"></div> - </td> - <td> - <div id="blocklyDiv" style="height: 400px"></div> - </td> - </tr> - </table> - - <div id="funcText"> - <img id="y1" src="../../media/1x1.gif"> - ... - </div> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <category name="Math" colour="%{BKY_MATH_HUE}"> - <block type="math_number"> - <field name="NUM">123</field> - </block> - <block type="math_arithmetic"> - <value name="A"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="B"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - </block> - <block type="math_single"> - <value name="NUM"> - <shadow type="math_number"> - <field name="NUM">9</field> - </shadow> - </value> - </block> - <block type="math_trig"> - <value name="NUM"> - <shadow type="math_number"> - <field name="NUM">45</field> - </shadow> - </value> - </block> - <block type="math_constant"></block> - <block type="math_number_property"> - <value name="NUMBER_TO_CHECK"> - <shadow type="math_number"> - <field name="NUM">0</field> - </shadow> - </value> - </block> - <block type="math_round"> - <value name="NUM"> - <shadow type="math_number"> - <field name="NUM">3.1</field> - </shadow> - </value> - </block> - <block type="math_modulo"> - <value name="DIVIDEND"> - <shadow type="math_number"> - <field name="NUM">64</field> - </shadow> - </value> - <value name="DIVISOR"> - <shadow type="math_number"> - <field name="NUM">10</field> - </shadow> - </value> - </block> - <block type="math_constrain"> - <value name="VALUE"> - <shadow type="math_number"> - <field name="NUM">50</field> - </shadow> - </value> - <value name="LOW"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="HIGH"> - <shadow type="math_number"> - <field name="NUM">100</field> - </shadow> - </value> - </block> - <block type="math_random_int"> - <value name="FROM"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="TO"> - <shadow type="math_number"> - <field name="NUM">100</field> - </shadow> - </value> - </block> - <block type="math_random_float"></block> - <block type="math_atan2"> - <value name="X"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="Y"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - </block> - </category> - <category name="Variables" colour="%{BKY_VARIABLES_HUE}"> - <block type="graph_get_x"></block> - </category> - <category name="Logic" colour="%{BKY_LOGIC_HUE}"> - <block type="logic_compare"></block> - <block type="logic_operation"></block> - <block type="logic_negate"></block> - <block type="logic_boolean"></block> - <block type="logic_ternary"></block> - </category> - </xml> - - <xml xmlns="https://developers.google.com/blockly/xml" id="startBlocks" style="display: none"> - <block type="graph_set_y" deletable="false" x="100" y="100"> - <value name="VALUE"> - <block type="math_arithmetic"> - <field name="OP">POWER</field> - <value name="A"> - <block type="graph_get_x"></block> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="B"> - <block type="math_number"> - <field name="NUM">2</field> - </block> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - </block> - </value> - </block> - </xml> - - <script> -// Load the Google Chart Tools Visualization API and the chart package. -if (typeof google == 'object') { - google.load('visualization', '1', {packages: ['corechart']}); -} else { - alert('Unable to load Google\'s chart API.\n' + - 'Are you connected to the Internet?'); -} - -// Define the custom blocks and their JS generators. -Blockly.defineBlocksWithJsonArray([{ - "type": "graph_get_x", - "message0": "x", - "output": "Number", - "colour": Blockly.Msg['VARIABLES_HUE'], - "tooltip": Blockly.Msg['VARIABLES_GET_TOOLTIP'], - "helpUrl": Blockly.Msg['VARIABLES_GET_HELPURL'] -}]); - -Blockly.JavaScript['graph_get_x'] = function(block) { - // x variable getter. - return ['x', Blockly.JavaScript.ORDER_ATOMIC]; -}; - -Blockly.defineBlocksWithJsonArray([{ - "type": "graph_set_y", - "message0": "y = %1", - "args0": [ - { - "type": "input_value", - "name": "VALUE", - "check": "Number" - } - ], - "colour": Blockly.Msg['VARIABLES_HUE'], - "tooltip": Blockly.Msg['VARIABLES_SET_TOOLTIP'], - "helpUrl": Blockly.Msg['VARIABLES_SET_HELPURL'] -}]); - -Blockly.JavaScript['graph_set_y'] = function(block) { - // y variable setter. - var argument0 = Blockly.JavaScript.valueToCode(block, 'VALUE', - Blockly.JavaScript.ORDER_ASSIGNMENT) || ''; - return 'y = ' + argument0 + ';'; -}; - -/** - * Create a namespace for the application. - */ -var Graph = {}; - -/** - * Main Blockly workspace. - * @type {Blockly.WorkspaceSvg} - */ -Graph.workspace = null; - -/** - * Cached copy of the function string. - * @type {?string} - * @private - */ -Graph.oldFormula_ = null; - -/** - * Drawing options for the Chart API. - * @type {!Object} - * @private - */ -Graph.options_ = { - //curveType: 'function', - width: 400, height: 400, - chartArea: {left: '10%', width: '85%', height: '85%'} -}; - -/** - * Visualize the graph of y = f(x) using Google Chart Tools. - * For more documentation on Google Chart Tools, see this linechart example: - * https://developers.google.com/chart/interactive/docs/gallery/linechart - */ -Graph.drawVisualization = function() { - var formula = Blockly.JavaScript.workspaceToCode(Graph.workspace); - if (formula === Graph.oldFormula_) { - // No change in the formula, don't recompute. - return; - } - Graph.oldFormula_ = formula; - - // Create and populate the data table. - var data = google.visualization.arrayToDataTable(Graph.plot(formula)); - // Create and draw the visualization, passing in the data and options. - new google.visualization.LineChart(document.getElementById('visualization')). - draw(data, Graph.options_); - - // Create the "y = ..." label. Find the relevant part of the code. - formula = formula.substring(formula.indexOf('y = ')); - formula = formula.substring(0, formula.indexOf(';')); - var funcText = document.getElementById('funcText'); - funcText.replaceChild(document.createTextNode(formula), funcText.lastChild); -}; - -/** - * Plot points on the function y = f(x). - * @param {string} code JavaScript code. - * @return {!Array.<!Array>} 2D Array of points on the graph. - */ -Graph.plot = function(code) { - // Initialize a table with two column headings. - var table = []; - var y; - // TODO: Improve range and scale of graph. - for (var x = -10; x <= 10; x = Math.round((x + 0.1) * 10) / 10) { - try { - eval(code); - } catch (e) { - y = NaN; - } - if (!isNaN(y)) { - // Prevent y from being displayed inconsistently, some in decimals, some - // in scientific notation, often when y has accumulated rounding errors. - y = Math.round(y * Math.pow(10, 14)) / Math.pow(10, 14); - table.push([x, y]); - } - } - // Add column heading to table. - if (table.length) { - table.unshift(['x', 'y']); - } else { - // If the table is empty, add a [0, 0] row to prevent graph error. - table.unshift(['x', 'y'], [0, 0]); - } - return table; -}; - -/** - * Force Blockly to resize into the available width. - */ -Graph.resize = function() { - var width = Math.max(window.innerWidth - 440, 250); - document.getElementById('blocklyDiv').style.width = width + 'px'; - Blockly.svgResize(Graph.workspace); -}; - -/** - * Initialize Blockly and the graph. Called on page load. - */ -Graph.init = function() { - Graph.workspace = Blockly.inject('blocklyDiv', - {collapse: false, - disable: false, - media: '../../media/', - toolbox: document.getElementById('toolbox')}); - Blockly.Xml.domToWorkspace(document.getElementById('startBlocks'), - Graph.workspace); - Graph.workspace.clearUndo(); - - // When Blockly changes, update the graph. - Graph.workspace.addChangeListener(Graph.drawVisualization); - Graph.workspace.addChangeListener(Blockly.Events.disableOrphans); - Graph.resize(); -}; - -window.addEventListener('load', Graph.init); -window.addEventListener('resize', Graph.resize); - </script> - -</body> -</html> diff --git a/res/lib/blockly/demos/headless/icon.png b/res/lib/blockly/demos/headless/icon.png deleted file mode 100644 index f431dc40c1399cabc28efcae31199f7c7c731be8..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/headless/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/headless/index.html b/res/lib/blockly/demos/headless/index.html deleted file mode 100644 index 174537c37ca389a9ef6f68ec24916e4ce67be6eb..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/headless/index.html +++ /dev/null @@ -1,120 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Headless</title> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../python_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <style> - body { - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - td { - vertical-align: top; - } - textarea { - width: 100%; - height: 20em; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Headless</h1> - - <p>This is a simple demo of generating Python code from XML with no graphics. - This might be useful for server-side code generation.</p> - - <table style="width: 100%"> - <tr> - <td style="width:50%"> - <textarea id="xml_input"> -<xml xmlns="https://developers.google.com/blockly/xml"> - <block type="controls_if" inline="false" x="20" y="20"> - <mutation else="1"></mutation> - <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"> - <block type="text_print" inline="false"> - <value name="TEXT"> - <block type="text"> - <field name="TEXT">Don't panic</field> - </block> - </value> - </block> - </statement> - <statement name="ELSE"> - <block type="text_print" inline="false"> - <value name="TEXT"> - <block type="text"> - <field name="TEXT">Panic</field> - </block> - </value> - </block> - </statement> - </block> -</xml> - </textarea> - </td> - <td> - </td> - <td style="width:50%"> - <textarea id="code_output" readonly></textarea> - </td> - </tr> - </table> - - <div style="text-align: center"> - <button onclick="generate()">Generate Python ⤴</button> - </div> - - <script> - function generate() { - // Parse the XML into a tree. - var xmlText = document.getElementById('xml_input').value; - try { - var xml = Blockly.Xml.textToDom(xmlText) - } catch (e) { - alert(e); - return; - } - // Create a headless workspace. - var demoWorkspace = new Blockly.Workspace(); - Blockly.Xml.domToWorkspace(xml, demoWorkspace); - var code = Blockly.Python.workspaceToCode(demoWorkspace); - document.getElementById('code_output').value = code; - } - </script> - -</body> -</html> diff --git a/res/lib/blockly/demos/index.html b/res/lib/blockly/demos/index.html deleted file mode 100644 index 1b22326a39a01aec68bcbff8959f5a0b8288f0fe..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/index.html +++ /dev/null @@ -1,248 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demos</title> - <style> - body { - margin: 0 10%; - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - td { - padding: 1ex; - } - img { - border: none; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > Demos</h1> - - <p>These demos are intended for developers who want to integrate Blockly with - their own applications.</p> - - <table> - <tr> - <td> - <a href="fixed/index.html"> - <img src="fixed/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="fixed/index.html">Fixed Blockly</a></div> - <div>Inject Blockly into a page as a fixed element.</div> - </td> - </tr> - - <tr> - <td> - <a href="resizable/index.html"> - <img src="resizable/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="resizable/index.html">Resizable Blockly</a></div> - <div>Inject Blockly into a page as a resizable element.</div> - </td> - </tr> - - <tr> - <td> - <a href="toolbox/index.html"> - <img src="toolbox/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="toolbox/index.html">Defining the Toolbox</a></div> - <div>Organize blocks into categories for the user.</div> - </td> - </tr> - - <tr> - <td> - <a href="maxBlocks/index.html"> - <img src="maxBlocks/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="maxBlocks/index.html">Maximum Block Limit</a></div> - <div>Limit the total number of blocks allowed (for academic exercises).</div> - </td> - </tr> - - <tr> - <td> - <a href="generator/index.html"> - <img src="generator/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="generator/index.html">Generate JavaScript</a></div> - <div>Turn blocks into code and execute it.</div> - </td> - </tr> - - <tr> - <td> - <a href="headless/index.html"> - <img src="headless/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="headless/index.html">Headless</a></div> - <div>Generate code from XML without graphics.</div> - </td> - </tr> - - <tr> - <td> - <a href="interpreter/index.html"> - <img src="interpreter/icon.png" height=80 width=100> - </a> - </td> - <td> - <div style="font-weight: bold">JS Interpreter</div> - <div>Demo #1: <a href="interpreter/step-execution.html">Step by step execution in JavaScript.</a></div> - <div>Demo #2: <a href="interpreter/async-execution.html">Asynchronous execution in JavaScript.</a></div> - </td> - </tr> - - <tr> - <td> - <a href="graph/index.html"> - <img src="graph/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="graph/index.html">Graph</a></div> - <div>Instant updates when blocks are changed.</div> - </td> - </tr> - - <tr> - <td> - <a href="rtl/index.html"> - <img src="rtl/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="rtl/index.html">RTL</a></div> - <div>See what Blockly looks like in right-to-left mode (for Arabic and Hebrew).</div> - </td> - </tr> - - <tr> - <td> - <a href="custom-dialogs/index.html"> - <img src="custom-dialogs/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="custom-dialogs/index.html">Custom Dialogs</a></div> - <div>Override Blockly browser dialogs with custom implementations.</div> - </td> - </tr> - - <tr> - <td> - <a href="custom-fields/index.html"> - <img src="custom-fields/turtle/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="custom-fields/index.html">Custom Fields</a></div> - <div>Implement a custom field.</div> - </td> - </tr> - - <tr> - <td> - <a href="storage/index.html"> - <img src="storage/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="storage/index.html">Cloud Storage</a></div> - <div>Save and load blocks with App Engine.</div> - </td> - </tr> - - <tr> - <td> - <a href="mirror/index.html"> - <img src="mirror/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="mirror/index.html">Mirrored Blockly</a></div> - <div>Two Blockly instances connected as master-slave.</div> - </td> - </tr> - - <tr> - <td> - <a href="accessible/index.html"> - <img src="accessible/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="accessible/index.html">Accessible Blockly</a></div> - <div>Version of Blockly accessible to screen readers.</div> - </td> - </tr> - - <tr> - <td> - <a href="plane/index.html"> - <img src="plane/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="plane/index.html">Plane</a></div> - <div>Using Closure Templates to support 35 languages.</div> - </td> - </tr> - - <tr> - <td> - <a href="code/index.html"> - <img src="code/icon.png" height=80 width=100> - </a> - </td> - <td> - <div><a href="code/index.html">Code Editor</a></div> - <div>Export a Blockly program into JavaScript, Python, PHP, Lua, Dart, or XML.</div> - </td> - </tr> - - <tr> - <td> - <a href="blockfactory/index.html"> - <img src="blockfactory/icon.png" height=80 width=173> - </a> - </td> - <td> - <div><a href="blockfactory/index.html">Blockly Developer Tools</a></div> - <div>Build custom blocks and setup a toolbox using Blockly.</div> - </td> - </tr> - <tr> - <td> - <a href="keyboard_nav/index.html"> - <img src="keyboard_nav/icon.png" height=80 width=150> - </a> - </td> - <td> - <div><a href="keyboard_nav/index.html">Keyboard Navigation</a></div> - <div>Demos keyboard navigation.</div> - </td> - </tr> - </table> -</body> -</html> diff --git a/res/lib/blockly/demos/interpreter/acorn_interpreter.js b/res/lib/blockly/demos/interpreter/acorn_interpreter.js deleted file mode 100644 index 81e521b071339dda51938ce9037137271d09455a..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/interpreter/acorn_interpreter.js +++ /dev/null @@ -1,169 +0,0 @@ -// Acorn: Copyright 2012 Marijn Haverbeke, MIT License -var mod$$inline_58=function(a){function b(a){n=a||{};for(var b in Ua)Object.prototype.hasOwnProperty.call(n,b)||(n[b]=Ua[b]);wa=n.sourceFile||null}function c(a,b){var c=Ab(k,a);b+=" ("+c.line+":"+c.column+")";var d=new SyntaxError(b);d.pos=a;d.loc=c;d.raisedAt=f;throw d;}function d(a){function b(a){if(1==a.length)return c+="return str === "+JSON.stringify(a[0])+";";c+="switch(str){";for(var va=0;va<a.length;++va)c+="case "+JSON.stringify(a[va])+":";c+="return true}return false;"}a=a.split(" ");var c= -"",d=[],e=0;a:for(;e<a.length;++e){for(var g=0;g<d.length;++g)if(d[g][0].length==a[e].length){d[g].push(a[e]);continue a}d.push([a[e]])}if(3<d.length){d.sort(function(a,b){return b.length-a.length});c+="switch(str.length){";for(e=0;e<d.length;++e)a=d[e],c+="case "+a[0].length+":",b(a);c+="}"}else b(a);return new Function("str",c)}function e(){this.line=G;this.column=f-D}function g(a,b){X=f;n.locations&&(ia=new e);p=a;l();H=b;R=a.beforeExpr}function h(){for(var a=f,b=n.onComment&&n.locations&&new e, -c=k.charCodeAt(f+=2);f<S&&10!==c&&13!==c&&8232!==c&&8233!==c;)++f,c=k.charCodeAt(f);if(n.onComment)n.onComment(!1,k.slice(a+2,f),a,f,b,n.locations&&new e)}function l(){for(;f<S;){var a=k.charCodeAt(f);if(32===a)++f;else if(13===a)++f,a=k.charCodeAt(f),10===a&&++f,n.locations&&(++G,D=f);else if(10===a||8232===a||8233===a)++f,n.locations&&(++G,D=f);else if(8<a&&14>a)++f;else if(47===a)if(a=k.charCodeAt(f+1),42===a){var a=n.onComment&&n.locations&&new e,b=f,d=k.indexOf("*/",f+=2);-1===d&&c(f-2,"Unterminated comment"); -f=d+2;if(n.locations){Y.lastIndex=b;for(var g=void 0;(g=Y.exec(k))&&g.index<f;)++G,D=g.index+g[0].length}if(n.onComment)n.onComment(!0,k.slice(b+2,d),b,f,a,n.locations&&new e)}else if(47===a)h();else break;else if(160===a)++f;else if(5760<=a&&Bb.test(String.fromCharCode(a)))++f;else break}}function m(a){switch(a){case 46:return a=k.charCodeAt(f+1),48<=a&&57>=a?a=P(!0):(++f,a=g(xa)),a;case 40:return++f,g(I);case 41:return++f,g(E);case 59:return++f,g(J);case 44:return++f,g(L);case 91:return++f,g(ja); -case 93:return++f,g(ka);case 123:return++f,g(Z);case 125:return++f,g(T);case 58:return++f,g(aa);case 63:return++f,g(ya);case 48:if(a=k.charCodeAt(f+1),120===a||88===a)return f+=2,a=B(16),null==a&&c(x+2,"Expected hexadecimal number"),la(k.charCodeAt(f))&&c(f,"Identifier directly after number"),a=g(ba,a);case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return P(!1);case 34:case 39:a:{f++;for(var b="";;){f>=S&&c(x,"Unterminated string constant");var d=k.charCodeAt(f);if(d===a){++f; -a=g(da,b);break a}if(92===d){var d=k.charCodeAt(++f),e=/^[0-7]+/.exec(k.slice(f,f+3));for(e&&(e=e[0]);e&&255<parseInt(e,8);)e=e.slice(0,-1);"0"===e&&(e=null);++f;if(e)C&&c(f-2,"Octal literal in strict mode"),b+=String.fromCharCode(parseInt(e,8)),f+=e.length-1;else switch(d){case 110:b+="\n";break;case 114:b+="\r";break;case 120:b+=String.fromCharCode(ma(2));break;case 117:b+=String.fromCharCode(ma(4));break;case 85:b+=String.fromCharCode(ma(8));break;case 116:b+="\t";break;case 98:b+="\b";break;case 118:b+= -"\x0B";break;case 102:b+="\f";break;case 48:b+="\x00";break;case 13:10===k.charCodeAt(f)&&++f;case 10:n.locations&&(D=f,++G);break;default:b+=String.fromCharCode(d)}}else 13!==d&&10!==d&&8232!==d&&8233!==d||c(x,"Unterminated string constant"),b+=String.fromCharCode(d),++f}}return a;case 47:return a=k.charCodeAt(f+1),R?(++f,a=K()):a=61===a?t(U,2):t(za,1),a;case 37:case 42:return a=k.charCodeAt(f+1),a=61===a?t(U,2):t(Cb,1),a;case 124:case 38:return b=k.charCodeAt(f+1),a=b===a?t(124===a?Va:Wa,2):61=== -b?t(U,2):t(124===a?Db:Eb,1),a;case 94:return a=k.charCodeAt(f+1),a=61===a?t(U,2):t(Fb,1),a;case 43:case 45:return b=k.charCodeAt(f+1),b===a?45==b&&62==k.charCodeAt(f+2)&&na.test(k.slice(M,f))?(f+=3,h(),l(),a=z()):a=t(Gb,2):a=61===b?t(U,2):t(Hb,1),a;case 60:case 62:return b=k.charCodeAt(f+1),d=1,b===a?(d=62===a&&62===k.charCodeAt(f+2)?3:2,a=61===k.charCodeAt(f+d)?t(U,d+1):t(Ib,d)):33==b&&60==a&&45==k.charCodeAt(f+2)&&45==k.charCodeAt(f+3)?(f+=4,h(),l(),a=z()):(61===b&&(d=61===k.charCodeAt(f+2)?3:2), -a=t(Jb,d)),a;case 61:case 33:return b=k.charCodeAt(f+1),a=61===b?t(Kb,61===k.charCodeAt(f+2)?3:2):t(61===a?Aa:Xa,1),a;case 126:return t(Xa,1)}return!1}function z(a){a?f=x+1:x=f;n.locations&&(oa=new e);if(a)return K();if(f>=S)return g(pa);var b=k.charCodeAt(f);if(la(b)||92===b)return Ya();a=m(b);if(!1===a){b=String.fromCharCode(b);if("\\"===b||Za.test(b))return Ya();c(f,"Unexpected character '"+b+"'")}return a}function t(a,b){var c=k.slice(f,f+b);f+=b;g(a,c)}function K(){for(var a,b,d=f;;){f>=S&&c(d, -"Unterminated regular expression");var e=k.charAt(f);na.test(e)&&c(d,"Unterminated regular expression");if(a)a=!1;else{if("["===e)b=!0;else if("]"===e&&b)b=!1;else if("/"===e&&!b)break;a="\\"===e}++f}a=k.slice(d,f);++f;(b=$a())&&!/^[gmsiy]*$/.test(b)&&c(d,"Invalid regexp flag");return g(Ba,new RegExp(a,b))}function B(a,b){for(var c=f,d=0,e=0,g=null==b?Infinity:b;e<g;++e){var h=k.charCodeAt(f),h=97<=h?h-97+10:65<=h?h-65+10:48<=h&&57>=h?h-48:Infinity;if(h>=a)break;++f;d=d*a+h}return f===c||null!=b&& -f-c!==b?null:d}function P(a){var b=f,d=!1,e=48===k.charCodeAt(f);a||null!==B(10)||c(b,"Invalid number");46===k.charCodeAt(f)&&(++f,B(10),d=!0);a=k.charCodeAt(f);if(69===a||101===a)a=k.charCodeAt(++f),43!==a&&45!==a||++f,null===B(10)&&c(b,"Invalid number"),d=!0;la(k.charCodeAt(f))&&c(f,"Identifier directly after number");a=k.slice(b,f);var h;d?h=parseFloat(a):e&&1!==a.length?/[89]/.test(a)||C?c(b,"Invalid number"):h=parseInt(a,8):h=parseInt(a,10);return g(ba,h)}function ma(a){a=B(16,a);null===a&&c(x, -"Bad character escape sequence");return a}function $a(){ca=!1;for(var a,b=!0,d=f;;){var e=k.charCodeAt(f);if(ab(e))ca&&(a+=k.charAt(f)),++f;else if(92===e){ca||(a=k.slice(d,f));ca=!0;117!=k.charCodeAt(++f)&&c(f,"Expecting Unicode escape sequence \\uXXXX");++f;var e=ma(4),g=String.fromCharCode(e);g||c(f-1,"Invalid Unicode escape");(b?la(e):ab(e))||c(f-4,"Invalid Unicode escape");a+=g}else break;b=!1}return ca?a:k.slice(d,f)}function Ya(){var a=$a(),b=V;ca||(Lb(a)?b=Ca[a]:(n.forbidReserved&&(3===n.ecmaVersion? -Mb:Nb)(a)||C&&bb(a))&&c(x,"The keyword '"+a+"' is reserved"));return g(b,a)}function r(){Da=x;M=X;Ea=ia;z()}function Fa(a){C=a;f=M;if(n.locations)for(;f<D;)D=k.lastIndexOf("\n",D-2)+1,--G;l();z()}function cb(){this.type=null;this.start=x;this.end=null}function db(){this.start=oa;this.end=null;null!==wa&&(this.source=wa)}function y(){var a=new cb;n.locations&&(a.loc=new db);n.directSourceFile&&(a.sourceFile=n.directSourceFile);n.ranges&&(a.range=[x,0]);return a}function Q(a){var b=new cb;b.start=a.start; -n.locations&&(b.loc=new db,b.loc.start=a.loc.start);n.ranges&&(b.range=[a.range[0],0]);return b}function q(a,b){a.type=b;a.end=M;n.locations&&(a.loc.end=Ea);n.ranges&&(a.range[1]=M);return a}function Ga(a){return 5<=n.ecmaVersion&&"ExpressionStatement"===a.type&&"Literal"===a.expression.type&&"use strict"===a.expression.value}function u(a){if(p===a)return r(),!0}function qa(){return!n.strictSemicolons&&(p===pa||p===T||na.test(k.slice(M,x)))}function W(){u(J)||qa()||N()}function v(a){p===a?r():N()} -function N(){c(x,"Unexpected token")}function ra(a){"Identifier"!==a.type&&"MemberExpression"!==a.type&&c(a.start,"Assigning to rvalue");C&&"Identifier"===a.type&&sa(a.name)&&c(a.start,"Assigning to "+a.name+" in strict mode")}function F(){(p===za||p===U&&"/="==H)&&z(!0);var a=p,b=y();switch(a){case Ha:case eb:r();var d=a===Ha;u(J)||qa()?b.label=null:p!==V?N():(b.label=O(),W());for(var e=0;e<w.length;++e){var g=w[e];if(null==b.label||g.name===b.label.name){if(null!=g.kind&&(d||"loop"===g.kind))break; -if(b.label&&d)break}}e===w.length&&c(b.start,"Unsyntactic "+a.keyword);return q(b,d?"BreakStatement":"ContinueStatement");case fb:return r(),W(),q(b,"DebuggerStatement");case gb:return r(),w.push(Ia),b.body=F(),w.pop(),v(Ja),b.test=ea(),W(),q(b,"DoWhileStatement");case hb:r();w.push(Ia);v(I);if(p===J)return Ka(b,null);if(p===La)return a=y(),r(),ib(a,!0),q(a,"VariableDeclaration"),1===a.declarations.length&&u(ta)?jb(b,a):Ka(b,a);a=A(!1,!0);return u(ta)?(ra(a),jb(b,a)):Ka(b,a);case Ma:return r(),Na(b, -!0);case kb:return r(),b.test=ea(),b.consequent=F(),b.alternate=u(lb)?F():null,q(b,"IfStatement");case mb:return fa||c(x,"'return' outside of function"),r(),u(J)||qa()?b.argument=null:(b.argument=A(),W()),q(b,"ReturnStatement");case Oa:r();b.discriminant=ea();b.cases=[];v(Z);for(w.push(Ob);p!=T;)p===Pa||p===nb?(a=p===Pa,e&&q(e,"SwitchCase"),b.cases.push(e=y()),e.consequent=[],r(),a?e.test=A():(d&&c(Da,"Multiple default clauses"),d=!0,e.test=null),v(aa)):(e||N(),e.consequent.push(F()));e&&q(e,"SwitchCase"); -r();w.pop();return q(b,"SwitchStatement");case ob:return r(),na.test(k.slice(M,x))&&c(M,"Illegal newline after throw"),b.argument=A(),W(),q(b,"ThrowStatement");case pb:return r(),b.block=ga(),b.handler=null,p===qb&&(a=y(),r(),v(I),a.param=O(),C&&sa(a.param.name)&&c(a.param.start,"Binding "+a.param.name+" in strict mode"),v(E),a.guard=null,a.body=ga(),b.handler=q(a,"CatchClause")),b.guardedHandlers=rb,b.finalizer=u(sb)?ga():null,b.handler||b.finalizer||c(b.start,"Missing catch or finally clause"), -q(b,"TryStatement");case La:return r(),ib(b),W(),q(b,"VariableDeclaration");case Ja:return r(),b.test=ea(),w.push(Ia),b.body=F(),w.pop(),q(b,"WhileStatement");case tb:return C&&c(x,"'with' in strict mode"),r(),b.object=ea(),b.body=F(),q(b,"WithStatement");case Z:return ga();case J:return r(),q(b,"EmptyStatement");default:d=H;g=A();if(a===V&&"Identifier"===g.type&&u(aa)){for(e=0;e<w.length;++e)w[e].name===d&&c(g.start,"Label '"+d+"' is already declared");a=p.isLoop?"loop":p===Oa?"switch":null;w.push({name:d, -kind:a});b.body=F();w.pop();b.label=g;return q(b,"LabeledStatement")}b.expression=g;W();return q(b,"ExpressionStatement")}}function ea(){v(I);var a=A();v(E);return a}function ga(a){var b=y(),c=!0,d=!1,e;b.body=[];for(v(Z);!u(T);){var g=F();b.body.push(g);c&&a&&Ga(g)&&(e=d,Fa(d=!0));c=!1}d&&!e&&Fa(!1);return q(b,"BlockStatement")}function Ka(a,b){a.init=b;v(J);a.test=p===J?null:A();v(J);a.update=p===E?null:A();v(E);a.body=F();w.pop();return q(a,"ForStatement")}function jb(a,b){a.left=b;a.right=A(); -v(E);a.body=F();w.pop();return q(a,"ForInStatement")}function ib(a,b){a.declarations=[];for(a.kind="var";;){var d=y();d.id=O();C&&sa(d.id.name)&&c(d.id.start,"Binding "+d.id.name+" in strict mode");d.init=u(Aa)?A(!0,b):null;a.declarations.push(q(d,"VariableDeclarator"));if(!u(L))break}return a}function A(a,b){var c=Qa(b);if(!a&&p===L){var d=Q(c);for(d.expressions=[c];u(L);)d.expressions.push(Qa(b));return q(d,"SequenceExpression")}return c}function Qa(a){var b;b=a;var c;c=b;c=Ra(Sa(),-1,c);if(u(ya)){var d= -Q(c);d.test=c;d.consequent=A(!0);v(aa);d.alternate=A(!0,b);b=q(d,"ConditionalExpression")}else b=c;return p.isAssign?(c=Q(b),c.operator=H,c.left=b,r(),c.right=Qa(a),ra(b),q(c,"AssignmentExpression")):b}function Ra(a,b,c){var d=p.binop;if(null!=d&&(!c||p!==ta)&&d>b){var e=Q(a);e.left=a;e.operator=H;a=p;r();e.right=Ra(Sa(),d,c);d=q(e,a===Va||a===Wa?"LogicalExpression":"BinaryExpression");return Ra(d,b,c)}return a}function Sa(){if(p.prefix){var a=y(),b=p.isUpdate;a.operator=H;R=a.prefix=!0;r();a.argument= -Sa();b?ra(a.argument):C&&"delete"===a.operator&&"Identifier"===a.argument.type&&c(a.start,"Deleting local variable in strict mode");return q(a,b?"UpdateExpression":"UnaryExpression")}for(b=ha(ua());p.postfix&&!qa();)a=Q(b),a.operator=H,a.prefix=!1,a.argument=b,ra(b),r(),b=q(a,"UpdateExpression");return b}function ha(a,b){if(u(xa)){var c=Q(a);c.object=a;c.property=O(!0);c.computed=!1;return ha(q(c,"MemberExpression"),b)}return u(ja)?(c=Q(a),c.object=a,c.property=A(),c.computed=!0,v(ka),ha(q(c,"MemberExpression"), -b)):!b&&u(I)?(c=Q(a),c.callee=a,c.arguments=Ta(E,!1),ha(q(c,"CallExpression"),b)):a}function ua(){switch(p){case ub:var a=y();r();return q(a,"ThisExpression");case V:return O();case ba:case da:case Ba:return a=y(),a.value=H,a.raw=k.slice(x,X),r(),q(a,"Literal");case vb:case wb:case xb:return a=y(),a.value=p.atomValue,a.raw=p.keyword,r(),q(a,"Literal");case I:var a=oa,b=x;r();var d=A();d.start=b;d.end=X;n.locations&&(d.loc.start=a,d.loc.end=ia);n.ranges&&(d.range=[b,X]);v(E);return d;case ja:return a= -y(),r(),a.elements=Ta(ka,!0,!0),q(a,"ArrayExpression");case Z:a=y();b=!0;d=!1;a.properties=[];for(r();!u(T);){if(b)b=!1;else if(v(L),n.allowTrailingCommas&&u(T))break;var e={key:p===ba||p===da?ua():O(!0)},g=!1,h;u(aa)?(e.value=A(!0),h=e.kind="init"):5<=n.ecmaVersion&&"Identifier"===e.key.type&&("get"===e.key.name||"set"===e.key.name)?(g=d=!0,h=e.kind=e.key.name,e.key=p===ba||p===da?ua():O(!0),p!==I&&N(),e.value=Na(y(),!1)):N();if("Identifier"===e.key.type&&(C||d))for(var f=0;f<a.properties.length;++f){var l= -a.properties[f];if(l.key.name===e.key.name){var m=h==l.kind||g&&"init"===l.kind||"init"===h&&("get"===l.kind||"set"===l.kind);m&&!C&&"init"===h&&"init"===l.kind&&(m=!1);m&&c(e.key.start,"Redefinition of property")}}a.properties.push(e)}return a=q(a,"ObjectExpression");case Ma:return a=y(),r(),Na(a,!1);case yb:return a=y(),r(),a.callee=ha(ua(),!0),u(I)?a.arguments=Ta(E,!1):a.arguments=rb,a=q(a,"NewExpression");default:N()}}function Na(a,b){p===V?a.id=O():b?N():a.id=null;a.params=[];var d=!0;for(v(I);!u(E);)d? -d=!1:v(L),a.params.push(O());var d=fa,e=w;fa=!0;w=[];a.body=ga(!0);fa=d;w=e;if(C||a.body.body.length&&Ga(a.body.body[0]))for(d=a.id?-1:0;d<a.params.length;++d)if(e=0>d?a.id:a.params[d],(bb(e.name)||sa(e.name))&&c(e.start,"Defining '"+e.name+"' in strict mode"),0<=d)for(var g=0;g<d;++g)e.name===a.params[g].name&&c(e.start,"Argument name clash in strict mode");return q(a,b?"FunctionDeclaration":"FunctionExpression")}function Ta(a,b,c){for(var d=[],e=!0;!u(a);){if(e)e=!1;else if(v(L),b&&n.allowTrailingCommas&& -u(a))break;c&&p===L?d.push(null):d.push(A(!0))}return d}function O(a){var b=y();b.name=p===V?H:a&&!n.forbidReserved&&p.keyword||N();R=!1;r();return q(b,"Identifier")}a.version="0.4.1";var n,k,S,wa;a.parse=function(a,c){k=String(a);S=k.length;b(c);G=1;f=D=0;R=!0;l();var d,g=n.program;Da=M=f;n.locations&&(Ea=new e);fa=C=null;w=[];z();d=g||y();var h=!0;g||(d.body=[]);for(;p!==pa;)g=F(),d.body.push(g),h&&Ga(g)&&Fa(!0),h=!1;return d=q(d,"Program")};var Ua=a.defaultOptions={ecmaVersion:5,strictSemicolons:!1, -allowTrailingCommas:!0,forbidReserved:!1,locations:!1,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null},Ab=a.getLineInfo=function(a,b){for(var c=1,d=0;;){Y.lastIndex=d;var e=Y.exec(a);if(e&&e.index<b)++c,d=e.index+e[0].length;else break}return{line:c,column:b-d}};a.tokenize=function(a,c){function d(a){z(a);e.start=x;e.end=X;e.startLoc=oa;e.endLoc=ia;e.type=p;e.value=H;return e}k=String(a);S=k.length;b(c);G=1;f=D=0;R=!0;l();var e={};d.jumpTo=function(a,b){f=a;if(n.locations){G= -1;D=Y.lastIndex=0;for(var c;(c=Y.exec(k))&&c.index<a;)++G,D=c.index+c[0].length}R=b;l()};return d};var f,x,X,oa,ia,p,H,R,G,D,Da,M,Ea,fa,w,C,rb=[],ba={type:"num"},Ba={type:"regexp"},da={type:"string"},V={type:"name"},pa={type:"eof"},Ha={keyword:"break"},Pa={keyword:"case",beforeExpr:!0},qb={keyword:"catch"},eb={keyword:"continue"},fb={keyword:"debugger"},nb={keyword:"default"},gb={keyword:"do",isLoop:!0},lb={keyword:"else",beforeExpr:!0},sb={keyword:"finally"},hb={keyword:"for",isLoop:!0},Ma={keyword:"function"}, -kb={keyword:"if"},mb={keyword:"return",beforeExpr:!0},Oa={keyword:"switch"},ob={keyword:"throw",beforeExpr:!0},pb={keyword:"try"},La={keyword:"var"},Ja={keyword:"while",isLoop:!0},tb={keyword:"with"},yb={keyword:"new",beforeExpr:!0},ub={keyword:"this"},vb={keyword:"null",atomValue:null},wb={keyword:"true",atomValue:!0},xb={keyword:"false",atomValue:!1},ta={keyword:"in",binop:7,beforeExpr:!0},Ca={"break":Ha,"case":Pa,"catch":qb,"continue":eb,"debugger":fb,"default":nb,"do":gb,"else":lb,"finally":sb, -"for":hb,"function":Ma,"if":kb,"return":mb,"switch":Oa,"throw":ob,"try":pb,"var":La,"while":Ja,"with":tb,"null":vb,"true":wb,"false":xb,"new":yb,"in":ta,"instanceof":{keyword:"instanceof",binop:7,beforeExpr:!0},"this":ub,"typeof":{keyword:"typeof",prefix:!0,beforeExpr:!0},"void":{keyword:"void",prefix:!0,beforeExpr:!0},"delete":{keyword:"delete",prefix:!0,beforeExpr:!0}},ja={type:"[",beforeExpr:!0},ka={type:"]"},Z={type:"{",beforeExpr:!0},T={type:"}"},I={type:"(",beforeExpr:!0},E={type:")"},L={type:",", -beforeExpr:!0},J={type:";",beforeExpr:!0},aa={type:":",beforeExpr:!0},xa={type:"."},ya={type:"?",beforeExpr:!0},za={binop:10,beforeExpr:!0},Aa={isAssign:!0,beforeExpr:!0},U={isAssign:!0,beforeExpr:!0},Gb={postfix:!0,prefix:!0,isUpdate:!0},Xa={prefix:!0,beforeExpr:!0},Va={binop:1,beforeExpr:!0},Wa={binop:2,beforeExpr:!0},Db={binop:3,beforeExpr:!0},Fb={binop:4,beforeExpr:!0},Eb={binop:5,beforeExpr:!0},Kb={binop:6,beforeExpr:!0},Jb={binop:7,beforeExpr:!0},Ib={binop:8,beforeExpr:!0},Hb={binop:9,prefix:!0, -beforeExpr:!0},Cb={binop:10,beforeExpr:!0};a.tokTypes={bracketL:ja,bracketR:ka,braceL:Z,braceR:T,parenL:I,parenR:E,comma:L,semi:J,colon:aa,dot:xa,question:ya,slash:za,eq:Aa,name:V,eof:pa,num:ba,regexp:Ba,string:da};for(var zb in Ca)a.tokTypes["_"+zb]=Ca[zb];var Mb=d("abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile"),Nb=d("class enum extends super const export import"), -bb=d("implements interface let package private protected public static yield"),sa=d("eval arguments"),Lb=d("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"),Bb=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Za=RegExp("[\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]"), -Pb=RegExp("[\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc\u0300-\u036f\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u0620-\u0649\u0672-\u06d3\u06e7-\u06e8\u06fb-\u06fc\u0730-\u074a\u0800-\u0814\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0840-\u0857\u08e4-\u08fe\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962-\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09d7\u09df-\u09e0\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5f-\u0b60\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2-\u0ce3\u0ce6-\u0cef\u0d02\u0d03\u0d46-\u0d48\u0d57\u0d62-\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e34-\u0e3a\u0e40-\u0e45\u0e50-\u0e59\u0eb4-\u0eb9\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f41-\u0f47\u0f71-\u0f84\u0f86-\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1029\u1040-\u1049\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u170e-\u1710\u1720-\u1730\u1740-\u1750\u1772\u1773\u1780-\u17b2\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1920-\u192b\u1930-\u193b\u1951-\u196d\u19b0-\u19c0\u19c8-\u19c9\u19d0-\u19d9\u1a00-\u1a15\u1a20-\u1a53\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1b46-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1bb0-\u1bb9\u1be6-\u1bf3\u1c00-\u1c22\u1c40-\u1c49\u1c5b-\u1c7d\u1cd0-\u1cd2\u1d00-\u1dbe\u1e01-\u1f15\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2d81-\u2d96\u2de0-\u2dff\u3021-\u3028\u3099\u309a\ua640-\ua66d\ua674-\ua67d\ua69f\ua6f0-\ua6f1\ua7f8-\ua800\ua806\ua80b\ua823-\ua827\ua880-\ua881\ua8b4-\ua8c4\ua8d0-\ua8d9\ua8f3-\ua8f7\ua900-\ua909\ua926-\ua92d\ua930-\ua945\ua980-\ua983\ua9b3-\ua9c0\uaa00-\uaa27\uaa40-\uaa41\uaa4c-\uaa4d\uaa50-\uaa59\uaa7b\uaae0-\uaae9\uaaf2-\uaaf3\uabc0-\uabe1\uabec\uabed\uabf0-\uabf9\ufb20-\ufb28\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f]"), -na=/[\n\r\u2028\u2029]/,Y=/\r\n|[\n\r\u2028\u2029]/g,la=a.isIdentifierStart=function(a){return 65>a?36===a:91>a?!0:97>a?95===a:123>a?!0:170<=a&&Za.test(String.fromCharCode(a))},ab=a.isIdentifierChar=function(a){return 48>a?36===a:58>a?!0:65>a?!1:91>a?!0:97>a?95===a:123>a?!0:170<=a&&Pb.test(String.fromCharCode(a))},ca,Ia={kind:"loop"},Ob={kind:"switch"}}; -"object"==typeof exports&&"object"==typeof module?mod$$inline_58(exports):"function"==typeof define&&define.amd?define(["exports"],mod$$inline_58):mod$$inline_58(this.acorn||(this.acorn={})); -// JS-Interpreter: Copyright 2013 Google LLC, Apache 2.0 -var Interpreter=function(a,b){"string"==typeof a&&(a=acorn.parse(a,Interpreter.PARSE_OPTIONS));this.ast=a;this.initFunc_=b;this.paused_=!1;this.polyfills_=[];this.UNDEFINED=new Interpreter.Primitive(void 0,this);this.NULL=new Interpreter.Primitive(null,this);this.NAN=new Interpreter.Primitive(NaN,this);this.TRUE=new Interpreter.Primitive(!0,this);this.FALSE=new Interpreter.Primitive(!1,this);this.NUMBER_ZERO=new Interpreter.Primitive(0,this);this.NUMBER_ONE=new Interpreter.Primitive(1,this);this.STRING_EMPTY= -new Interpreter.Primitive("",this);b=this.createScope(this.ast,null);this.NAN.parent=this.NUMBER;this.TRUE.parent=this.BOOLEAN;this.FALSE.parent=this.BOOLEAN;this.NUMBER_ZERO.parent=this.NUMBER;this.NUMBER_ONE.parent=this.NUMBER;this.STRING_EMPTY.parent=this.STRING;this.ast=acorn.parse(this.polyfills_.join("\n"),Interpreter.PARSE_OPTIONS);this.polyfills_=void 0;this.stripLocations_(this.ast);this.stateStack=[{node:this.ast,scope:b,thisExpression:b,done:!1}];this.run();this.value=this.UNDEFINED;this.ast= -a;this.stateStack=[{node:this.ast,scope:b,thisExpression:b,done:!1}]};Interpreter.PARSE_OPTIONS={ecmaVersion:5};Interpreter.READONLY_DESCRIPTOR={configurable:!0,enumerable:!0,writable:!1};Interpreter.NONENUMERABLE_DESCRIPTOR={configurable:!0,enumerable:!1,writable:!0};Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR={configurable:!0,enumerable:!1,writable:!1}; -Interpreter.prototype.appendCode=function(a){var b=this.stateStack[this.stateStack.length-1];if(!b||"Program"!=b.node.type)throw Error("Expecting original AST to start with a Program node.");"string"==typeof a&&(a=acorn.parse(a,Interpreter.PARSE_OPTIONS));if(!a||"Program"!=a.type)throw Error("Expecting new AST to start with a Program node.");this.populateScope_(a,b.scope);for(var c=0,d;d=a.body[c];c++)b.node.body.push(d);b.done=!1}; -Interpreter.prototype.step=function(){var a=this.stateStack[0];if(!a||"Program"==a.node.type&&a.done)return!1;if(this.paused_)return!0;this["step"+a.node.type]();return a.node.end?!0:this.step()};Interpreter.prototype.run=function(){for(;!this.paused_&&this.step(););return this.paused_}; -Interpreter.prototype.initGlobalScope=function(a){this.setProperty(a,"Infinity",this.createPrimitive(Infinity),Interpreter.READONLY_DESCRIPTOR);this.setProperty(a,"NaN",this.NAN,Interpreter.READONLY_DESCRIPTOR);this.setProperty(a,"undefined",this.UNDEFINED,Interpreter.READONLY_DESCRIPTOR);this.setProperty(a,"window",a,Interpreter.READONLY_DESCRIPTOR);this.setProperty(a,"self",a);this.initFunction(a);this.initObject(a);a.parent=this.OBJECT;this.initArray(a);this.initNumber(a);this.initString(a);this.initBoolean(a); -this.initDate(a);this.initMath(a);this.initRegExp(a);this.initJSON(a);this.initError(a);var b=this,c;c=function(a){a=a||b.UNDEFINED;return b.createPrimitive(isNaN(a.toNumber()))};this.setProperty(a,"isNaN",this.createNativeFunction(c));c=function(a){a=a||b.UNDEFINED;return b.createPrimitive(isFinite(a.toNumber()))};this.setProperty(a,"isFinite",this.createNativeFunction(c));this.setProperty(a,"parseFloat",this.getProperty(this.NUMBER,"parseFloat"));this.setProperty(a,"parseInt",this.getProperty(this.NUMBER, -"parseInt"));c=this.createObject(this.FUNCTION);c.eval=!0;this.setProperty(c,"length",this.NUMBER_ONE,Interpreter.READONLY_DESCRIPTOR);this.setProperty(a,"eval",c);for(var d=[[escape,"escape"],[unescape,"unescape"],[decodeURI,"decodeURI"],[decodeURIComponent,"decodeURIComponent"],[encodeURI,"encodeURI"],[encodeURIComponent,"encodeURIComponent"]],h=0;h<d.length;h++)c=function(a){return function(c){c=(c||b.UNDEFINED).toString();try{c=a(c)}catch(r){b.throwException(b.URI_ERROR,r.message)}return b.createPrimitive(c)}}(d[h][0]), -this.setProperty(a,d[h][1],this.createNativeFunction(c));this.initFunc_&&this.initFunc_(this,a)}; -Interpreter.prototype.initFunction=function(a){var b=this,c;c=function(a){for(var c=this.parent==b.FUNCTION?this:b.createObject(b.FUNCTION),d=arguments.length?arguments[arguments.length-1].toString():"",p=[],r=0;r<arguments.length-1;r++)p.push(arguments[r].toString());p=p.join(", ");if(-1!=p.indexOf(")"))throw SyntaxError("Function arg string contains parenthesis");c.parentScope=b.stateStack[b.stateStack.length-1].scope;d=acorn.parse("$ = function("+p+") {"+d+"};",Interpreter.PARSE_OPTIONS);c.node= -d.body[0].expression.right;b.setProperty(c,"length",b.createPrimitive(c.node.length),Interpreter.READONLY_DESCRIPTOR);return c};this.FUNCTION=this.createObject(null);this.setProperty(a,"Function",this.FUNCTION);this.FUNCTION.type="function";this.setProperty(this.FUNCTION,"prototype",this.createObject(null));this.FUNCTION.nativeFunc=c;c=function(a,c){var d=b.stateStack[0];d.func_=this;d.funcThis_=a;d.arguments=[];if(c)if(b.isa(c,b.ARRAY))for(a=0;a<c.length;a++)d.arguments[a]=b.getProperty(c,a);else b.throwException(b.TYPE_ERROR, -"CreateListFromArrayLike called on non-object");d.doneArgs_=!0;d.doneExec_=!1};this.setNativeFunctionPrototype(this.FUNCTION,"apply",c);c=function(a,c){var d=b.stateStack[0];d.func_=this;d.funcThis_=a;d.arguments=[];for(var h=1;h<arguments.length;h++)d.arguments.push(arguments[h]);d.doneArgs_=!0;d.doneExec_=!1};this.setNativeFunctionPrototype(this.FUNCTION,"call",c);c=function(a,c){var d=b.createFunction(this.node,this.parentScope);a&&(d.boundThis_=a);d.boundArgs_=[];for(var h=1;h<arguments.length;h++)d.boundArgs_.push(arguments[h]); -return d};this.setNativeFunctionPrototype(this.FUNCTION,"bind",c);c=function(){return b.createPrimitive(this.toString())};this.setNativeFunctionPrototype(this.FUNCTION,"toString",c);this.setProperty(this.FUNCTION,"toString",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(){return b.createPrimitive(this.valueOf())};this.setNativeFunctionPrototype(this.FUNCTION,"valueOf",c);this.setProperty(this.FUNCTION,"valueOf",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR)}; -Interpreter.prototype.initObject=function(a){var b=this,c;c=function(a){if(!a||a==b.UNDEFINED||a==b.NULL)return this.parent==b.OBJECT?this:b.createObject(b.OBJECT);if(a.isPrimitive){var c=b.createObject(a.parent);c.data=a.data;return c}return a};this.OBJECT=this.createNativeFunction(c);this.setProperty(a,"Object",this.OBJECT);c=function(a){var c=b.createObject(b.ARRAY),d=0,p;for(p in a.properties)b.setProperty(c,d,b.createPrimitive(p)),d++;return c};this.setProperty(this.OBJECT,"getOwnPropertyNames", -this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a){var c=b.createObject(b.ARRAY),d=0,p;for(p in a.properties)a.notEnumerable[p]||(b.setProperty(c,d,b.createPrimitive(p)),d++);return c};this.setProperty(this.OBJECT,"keys",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a,c,g){c=(c||b.UNDEFINED).toString();if(g instanceof Interpreter.Object)if(!a.properties[c]&&a.preventExtensions)b.throwException(b.TYPE_ERROR,"Can't define property "+c+", object is not extensible"); -else{var d=b.getProperty(g,"value");d==b.UNDEFINED&&(d=null);var h=b.getProperty(g,"get"),v=b.getProperty(g,"set");g={configurable:b.pseudoToNative(b.getProperty(g,"configurable")),enumerable:b.pseudoToNative(b.getProperty(g,"enumerable")),writable:b.pseudoToNative(b.getProperty(g,"writable")),get:h==b.UNDEFINED?void 0:h,set:v==b.UNDEFINED?void 0:v};b.setProperty(a,c,d,g);return a}else b.throwException(b.TYPE_ERROR,"Property description must be an object.")};this.setProperty(this.OBJECT,"defineProperty", -this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);this.polyfills_.push("Object.defineProperty(Array.prototype, 'defineProperties', {configurable: true, value:","function(obj, props) {","var keys = Object.keys(props);","for (var i = 0; i < keys.length; i++) {","Object.defineProperty(obj, keys[i], props[keys[i]]);","}","return obj;","}","});","");c=function(a,c){c=(c||b.UNDEFINED).toString();if(!(c in a.properties))return b.UNDEFINED;var d=!a.notConfigurable[c],h=!a.notEnumerable[c], -r=!a.notWritable[c],v=a.getter[c],w=a.setter[c],q=b.createObject(b.OBJECT);b.setProperty(q,"configurable",b.createPrimitive(d));b.setProperty(q,"enumerable",b.createPrimitive(h));v||w?(b.setProperty(q,"getter",v),b.setProperty(q,"setter",w)):(b.setProperty(q,"writable",b.createPrimitive(r)),b.setProperty(q,"value",b.getProperty(a,c)));return q};this.setProperty(this.OBJECT,"getOwnPropertyDescriptor",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a){return a.parent&& -a.parent.properties&&a.parent.properties.prototype?a.parent.properties.prototype:b.NULL};this.setProperty(this.OBJECT,"getPrototypeOf",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a){return b.createPrimitive(!a.preventExtensions)};this.setProperty(this.OBJECT,"isExtensible",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a){a.isPrimitive||(a.preventExtensions=!0);return a};this.setProperty(this.OBJECT,"preventExtensions",this.createNativeFunction(c), -Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(){return b.createPrimitive(this.toString())};this.setNativeFunctionPrototype(this.OBJECT,"toString",c);c=function(){return b.createPrimitive(this.toString())};this.setNativeFunctionPrototype(this.OBJECT,"toLocaleString",c);c=function(){return b.createPrimitive(this.valueOf())};this.setNativeFunctionPrototype(this.OBJECT,"valueOf",c);c=function(a){if(this==b.NULL||this==b.UNDEFINED)b.throwException(b.TYPE_ERROR,"Cannot convert undefined or null to object"); -else return a=(a||b.UNDEFINED).toString(),a in this.properties?b.TRUE:b.FALSE};this.setNativeFunctionPrototype(this.OBJECT,"hasOwnProperty",c);c=function(a){a=(a||b.UNDEFINED).toString();a=a in this.properties&&!this.notEnumerable[a];return b.createPrimitive(a)};this.setNativeFunctionPrototype(this.OBJECT,"propertyIsEnumerable",c);c=function(a){for(;;)if(a.parent&&a.parent.properties&&a.parent.properties.prototype){if(a=a.parent.properties.prototype,a==this)return b.createPrimitive(!0)}else return b.createPrimitive(!1)}; -this.setNativeFunctionPrototype(this.OBJECT,"isPrototypeOf",c)}; -Interpreter.prototype.initArray=function(a){var b=this,c=function(a,b){a=a?Math.floor(a.toNumber()):b;isNaN(a)&&(a=b);return a},d;d=function(a){var c=this.parent==b.ARRAY?this:b.createObject(b.ARRAY),d=arguments[0];if(d&&"number"==d.type)isNaN(b.arrayIndex(d))&&b.throwException(b.RANGE_ERROR,"Invalid array length"),c.length=d.data;else{for(d=0;d<arguments.length;d++)c.properties[d]=arguments[d];c.length=d}return c};this.ARRAY=this.createNativeFunction(d);this.setProperty(a,"Array",this.ARRAY);d=function(a){return b.createPrimitive(b.isa(a, -b.ARRAY))};this.setProperty(this.ARRAY,"isArray",this.createNativeFunction(d),Interpreter.NONENUMERABLE_DESCRIPTOR);d=function(){if(this.length){var a=this.properties[this.length-1];delete this.properties[this.length-1];this.length--}else a=b.UNDEFINED;return a};this.setNativeFunctionPrototype(this.ARRAY,"pop",d);d=function(a){for(var c=0;c<arguments.length;c++)this.properties[this.length]=arguments[c],this.length++;return b.createPrimitive(this.length)};this.setNativeFunctionPrototype(this.ARRAY, -"push",d);d=function(){if(this.length){for(var a=this.properties[0],c=1;c<this.length;c++)this.properties[c-1]=this.properties[c];this.length--;delete this.properties[this.length]}else a=b.UNDEFINED;return a};this.setNativeFunctionPrototype(this.ARRAY,"shift",d);d=function(a){for(var c=this.length-1;0<=c;c--)this.properties[c+arguments.length]=this.properties[c];this.length+=arguments.length;for(c=0;c<arguments.length;c++)this.properties[c]=arguments[c];return b.createPrimitive(this.length)};this.setNativeFunctionPrototype(this.ARRAY, -"unshift",d);d=function(){for(var a=0;a<this.length/2;a++){var b=this.properties[this.length-a-1];this.properties[this.length-a-1]=this.properties[a];this.properties[a]=b}return this};this.setNativeFunctionPrototype(this.ARRAY,"reverse",d);d=function(a,d,p){a=c(a,0);a=0>a?Math.max(this.length+a,0):Math.min(a,this.length);d=c(d,Infinity);d=Math.min(d,this.length-a);for(var g=b.createObject(b.ARRAY),h=a;h<a+d;h++)g.properties[g.length++]=this.properties[h],this.properties[h]=this.properties[h+d];for(h= -a+d;h<this.length-d;h++)this.properties[h]=this.properties[h+d];for(h=this.length-d;h<this.length;h++)delete this.properties[h];this.length-=d;for(h=this.length-1;h>=a;h--)this.properties[h+arguments.length-2]=this.properties[h];this.length+=arguments.length-2;for(h=2;h<arguments.length;h++)this.properties[a+h-2]=arguments[h];return g};this.setNativeFunctionPrototype(this.ARRAY,"splice",d);d=function(a,d){var g=b.createObject(b.ARRAY),h=c(a,0);0>h&&(h=this.length+h);h=Math.max(0,Math.min(h,this.length)); -d=c(d,this.length);0>d&&(d=this.length+d);d=Math.max(0,Math.min(d,this.length));for(a=0;h<d;h++){var v=b.getProperty(this,h);b.setProperty(g,a++,v)}return g};this.setNativeFunctionPrototype(this.ARRAY,"slice",d);d=function(a){a=a&&void 0!==a.data?a.toString():void 0;for(var c=[],d=0;d<this.length;d++)c[d]=this.properties[d];return b.createPrimitive(c.join(a))};this.setNativeFunctionPrototype(this.ARRAY,"join",d);d=function(a){for(var c=b.createObject(b.ARRAY),d=0,h=0;h<this.length;h++){var v=b.getProperty(this, -h);b.setProperty(c,d++,v)}for(h=0;h<arguments.length;h++){var w=arguments[h];if(b.isa(w,b.ARRAY))for(var q=0;q<w.length;q++)v=b.getProperty(w,q),b.setProperty(c,d++,v);else b.setProperty(c,d++,w)}return c};this.setNativeFunctionPrototype(this.ARRAY,"concat",d);d=function(a,d){a=a||b.UNDEFINED;d=c(d,0);0>d&&(d=this.length+d);for(d=Math.max(0,d);d<this.length;d++){var h=b.getProperty(this,d);if(h.isPrimitive&&a.isPrimitive?h.data===a.data:h===a)return b.createPrimitive(d)}return b.createPrimitive(-1)}; -this.setNativeFunctionPrototype(this.ARRAY,"indexOf",d);d=function(a,d){a=a||b.UNDEFINED;d=c(d,this.length);0>d&&(d=this.length+d);for(d=Math.min(d,this.length-1);0<=d;d--){var h=b.getProperty(this,d);if(h.isPrimitive&&a.isPrimitive?h.data===a.data:h===a)return b.createPrimitive(d)}return b.createPrimitive(-1)};this.setNativeFunctionPrototype(this.ARRAY,"lastIndexOf",d);this.polyfills_.push("Object.defineProperty(Array.prototype, 'every', {configurable: true, value:","function(callbackfn, thisArg) {", -"if (this == null || typeof callbackfn !== 'function') throw new TypeError;","var T, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O && !callbackfn.call(T, O[k], k, O)) return false;","k++;","}","return true;","}","});","Object.defineProperty(Array.prototype, 'filter', {configurable: true, value:","function(fun/*, thisArg*/) {","if (this === void 0 || this === null || typeof fun !== 'function') throw new TypeError;", -"var t = Object(this);","var len = t.length >>> 0;","var res = [];","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t) {","var val = t[i];","if (fun.call(thisArg, val, i, t)) res.push(val);","}","}","return res;","}","});","Object.defineProperty(Array.prototype, 'forEach', {configurable: true, value:","function(callback, thisArg) {","if (this == null || typeof callback !== 'function') throw new TypeError;","var T, k;","var O = Object(this);", -"var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O) callback.call(T, O[k], k, O);","k++;","}","}","});","Object.defineProperty(Array.prototype, 'map', {configurable: true, value:","function(callback, thisArg) {","if (this == null || typeof callback !== 'function') new TypeError;","var T, A, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","A = new Array(len);","k = 0;","while (k < len) {","if (k in O) A[k] = callback.call(T, O[k], k, O);", -"k++;","}","return A;","}","});","Object.defineProperty(Array.prototype, 'reduce', {configurable: true, value:","function(callback /*, initialValue*/) {","if (this == null || typeof callback !== 'function') throw new TypeError;","var t = Object(this), len = t.length >>> 0, k = 0, value;","if (arguments.length == 2) {","value = arguments[1];","} else {","while (k < len && !(k in t)) k++;","if (k >= len) {","throw new TypeError('Reduce of empty array with no initial value');","}","value = t[k++];", -"}","for (; k < len; k++) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'reduceRight', {configurable: true, value:","function(callback /*, initialValue*/) {","if (null === this || 'undefined' === typeof this || 'function' !== typeof callback) throw new TypeError;","var t = Object(this), len = t.length >>> 0, k = len - 1, value;","if (arguments.length >= 2) {","value = arguments[1];","} else {","while (k >= 0 && !(k in t)) k--;", -"if (k < 0) {","throw new TypeError('Reduce of empty array with no initial value');","}","value = t[k--];","}","for (; k >= 0; k--) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'some', {configurable: true, value:","function(fun/*, thisArg*/) {","if (this == null || typeof fun !== 'function') throw new TypeError;","var t = Object(this);","var len = t.length >>> 0;","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;", -"for (var i = 0; i < len; i++) {","if (i in t && fun.call(thisArg, t[i], i, t)) {","return true;","}","}","return false;","}","});","Object.defineProperty(Array.prototype, 'sort', {configurable: true, value:","function(opt_comp) {","for (var i = 0; i < this.length; i++) {","var changes = 0;","for (var j = 0; j < this.length - i - 1; j++) {","if (opt_comp ?opt_comp(this[j], this[j + 1]) > 0 : this[j] > this[j + 1]) {","var swap = this[j];","this[j] = this[j + 1];","this[j + 1] = swap;","changes++;", -"}","}","if (changes <= 1) break;","}","return this;","}","});","Object.defineProperty(Array.prototype, 'toLocaleString', {configurable: true, value:","function() {","var out = [];","for (var i = 0; i < this.length; i++) {","out[i] = (this[i] === null || this[i] === undefined) ? '' : this[i].toLocaleString();","}","return out.join(',');","}","});","")}; -Interpreter.prototype.initNumber=function(a){var b=this,c;c=function(a){a=a?a.toNumber():0;if(this.parent!=b.NUMBER)return b.createPrimitive(a);this.data=a;return this};this.NUMBER=this.createNativeFunction(c);this.setProperty(a,"Number",this.NUMBER);a=["MAX_VALUE","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"];for(c=0;c<a.length;c++)this.setProperty(this.NUMBER,a[c],this.createPrimitive(Number[a[c]]));c=function(a){a=a||b.UNDEFINED;return b.createPrimitive(parseFloat(a.toString()))}; -this.setProperty(this.NUMBER,"parseFloat",this.createNativeFunction(c));c=function(a,c){a=a||b.UNDEFINED;c=c||b.UNDEFINED;return b.createPrimitive(parseInt(a.toString(),c.toNumber()))};this.setProperty(this.NUMBER,"parseInt",this.createNativeFunction(c));c=function(a){a=a?a.toNumber():void 0;var c=this.toNumber();return b.createPrimitive(c.toExponential(a))};this.setNativeFunctionPrototype(this.NUMBER,"toExponential",c);c=function(a){a=a?a.toNumber():void 0;var c=this.toNumber();return b.createPrimitive(c.toFixed(a))}; -this.setNativeFunctionPrototype(this.NUMBER,"toFixed",c);c=function(a){a=a?a.toNumber():void 0;var c=this.toNumber();return b.createPrimitive(c.toPrecision(a))};this.setNativeFunctionPrototype(this.NUMBER,"toPrecision",c);c=function(a){a=a?a.toNumber():10;var c=this.toNumber();return b.createPrimitive(c.toString(a))};this.setNativeFunctionPrototype(this.NUMBER,"toString",c);c=function(a,c){a=a?b.pseudoToNative(a):void 0;c=c?b.pseudoToNative(c):void 0;return b.createPrimitive(this.toNumber().toLocaleString(a, -c))};this.setNativeFunctionPrototype(this.NUMBER,"toLocaleString",c)}; -Interpreter.prototype.initString=function(a){var b=this,c;c=function(a){a=a?a.toString():"";if(this.parent!=b.STRING)return b.createPrimitive(a);this.data=a;return this};this.STRING=this.createNativeFunction(c);this.setProperty(a,"String",this.STRING);c=function(a){for(var c=0;c<arguments.length;c++)arguments[c]=arguments[c].toNumber();return b.createPrimitive(String.fromCharCode.apply(String,arguments))};this.setProperty(this.STRING,"fromCharCode",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR); -a=["toLowerCase","toUpperCase","toLocaleLowerCase","toLocaleUpperCase"];for(var d=0;d<a.length;d++)c=function(a){return function(){return b.createPrimitive(a.apply(this))}}(String.prototype[a[d]]),this.setNativeFunctionPrototype(this.STRING,a[d],c);c=function(){var a=this.toString();return b.createPrimitive(a.replace(/^\s+|\s+$/g,""))};this.setNativeFunctionPrototype(this.STRING,"trim",c);c=function(){var a=this.toString();return b.createPrimitive(a.replace(/^\s+/g,""))};this.setNativeFunctionPrototype(this.STRING, -"trimLeft",c);c=function(){var a=this.toString();return b.createPrimitive(a.replace(/\s+$/g,""))};this.setNativeFunctionPrototype(this.STRING,"trimRight",c);a=["charAt","charCodeAt","substring","slice","substr"];for(d=0;d<a.length;d++)c=function(a){return function(){for(var c=0;c<arguments.length;c++)arguments[c]=arguments[c].toNumber();return b.createPrimitive(a.apply(this,arguments))}}(String.prototype[a[d]]),this.setNativeFunctionPrototype(this.STRING,a[d],c);c=function(a,c){var d=this.toString(); -a=(a||b.UNDEFINED).toString();c=c?c.toNumber():void 0;return b.createPrimitive(d.indexOf(a,c))};this.setNativeFunctionPrototype(this.STRING,"indexOf",c);c=function(a,c){var d=this.toString();a=(a||b.UNDEFINED).toString();c=c?c.toNumber():void 0;return b.createPrimitive(d.lastIndexOf(a,c))};this.setNativeFunctionPrototype(this.STRING,"lastIndexOf",c);c=function(a,c,d){a=(a||b.UNDEFINED).toString();c=c?b.pseudoToNative(c):void 0;d=d?b.pseudoToNative(d):void 0;return b.createPrimitive(this.toString().localeCompare(a, -c,d))};this.setNativeFunctionPrototype(this.STRING,"localeCompare",c);c=function(a,c){var d=this.toString();a=a?b.isa(a,b.REGEXP)?a.data:a.toString():void 0;c=c?c.toNumber():void 0;a=d.split(a,c);c=b.createObject(b.ARRAY);for(d=0;d<a.length;d++)b.setProperty(c,d,b.createPrimitive(a[d]));return c};this.setNativeFunctionPrototype(this.STRING,"split",c);c=function(a){for(var c=this.toString(),d=0;d<arguments.length;d++)c+=arguments[d].toString();return b.createPrimitive(c)};this.setNativeFunctionPrototype(this.STRING, -"concat",c);c=function(a){var c=this.toString();a=a?a.data:void 0;a=c.match(a);if(null===a)return b.NULL;for(var c=b.createObject(b.ARRAY),d=0;d<a.length;d++)b.setProperty(c,d,b.createPrimitive(a[d]));return c};this.setNativeFunctionPrototype(this.STRING,"match",c);c=function(a){var c=this.toString();a=a?a.data:void 0;return b.createPrimitive(c.search(a))};this.setNativeFunctionPrototype(this.STRING,"search",c);c=function(a,c){var d=this.toString();a=(a||b.UNDEFINED).valueOf();c=(c||b.UNDEFINED).toString(); -return b.createPrimitive(d.replace(a,c))};this.setNativeFunctionPrototype(this.STRING,"replace",c)};Interpreter.prototype.initBoolean=function(a){var b=this,c;c=function(a){a=a?a.toBoolean():!1;if(this.parent!=b.BOOLEAN)return b.createPrimitive(a);this.data=a;return this};this.BOOLEAN=this.createNativeFunction(c);this.setProperty(a,"Boolean",this.BOOLEAN)}; -Interpreter.prototype.initDate=function(a){var b=this,c;c=function(a,c,d,r,v,w,q){if(this.parent==b.DATE)var g=this;else return b.createPrimitive(Date());if(arguments.length)if(1!=arguments.length||"string"!=a.type&&!b.isa(a,b.STRING)){for(var h=[null],p=0;p<arguments.length;p++)h[p+1]=arguments[p]?arguments[p].toNumber():void 0;g.data=new (Function.prototype.bind.apply(Date,h))}else g.data=new Date(a.toString());else g.data=new Date;return g};this.DATE=this.createNativeFunction(c);this.setProperty(a, -"Date",this.DATE);c=function(){return b.createPrimitive((new Date).getTime())};this.setProperty(this.DATE,"now",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a){a=a?a.toString():void 0;return b.createPrimitive(Date.parse(a))};this.setProperty(this.DATE,"parse",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a,c,d,r,v,w,q){for(var g=[],h=0;h<arguments.length;h++)g[h]=arguments[h]?arguments[h].toNumber():void 0;return b.createPrimitive(Date.UTC.apply(Date, -g))};this.setProperty(this.DATE,"UTC",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);a="getDate getDay getFullYear getHours getMilliseconds getMinutes getMonth getSeconds getTime getTimezoneOffset getUTCDate getUTCDay getUTCFullYear getUTCHours getUTCMilliseconds getUTCMinutes getUTCMonth getUTCSeconds getYear setDate setFullYear setHours setMilliseconds setMinutes setMonth setSeconds setTime setUTCDate setUTCFullYear setUTCHours setUTCMilliseconds setUTCMinutes setUTCMonth setUTCSeconds setYear toDateString toISOString toJSON toGMTString toLocaleDateString toLocaleString toLocaleTimeString toTimeString toUTCString".split(" "); -for(var d=0;d<a.length;d++)c=function(a){return function(c){for(var d=[],g=0;g<arguments.length;g++)d[g]=b.pseudoToNative(arguments[g]);return b.createPrimitive(this.data[a].apply(this.data,d))}}(a[d]),this.setNativeFunctionPrototype(this.DATE,a[d],c)}; -Interpreter.prototype.initMath=function(a){var b=this,c=this.createObject(this.OBJECT);this.setProperty(a,"Math",c);var d="E LN2 LN10 LOG2E LOG10E PI SQRT1_2 SQRT2".split(" ");for(a=0;a<d.length;a++)this.setProperty(c,d[a],this.createPrimitive(Math[d[a]]),Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);d="abs acos asin atan atan2 ceil cos exp floor log max min pow random round sin sqrt tan".split(" ");for(a=0;a<d.length;a++){var h=function(a){return function(){for(var c=0;c<arguments.length;c++)arguments[c]= -arguments[c].toNumber();return b.createPrimitive(a.apply(Math,arguments))}}(Math[d[a]]);this.setProperty(c,d[a],this.createNativeFunction(h),Interpreter.NONENUMERABLE_DESCRIPTOR)}}; -Interpreter.prototype.initRegExp=function(a){var b=this,c;c=function(a,c){var d=this.parent==b.REGEXP?this:b.createObject(b.REGEXP);a=a?a.toString():"";c=c?c.toString():"";return b.populateRegExp_(d,new RegExp(a,c))};this.REGEXP=this.createNativeFunction(c);this.setProperty(a,"RegExp",this.REGEXP);this.setProperty(this.REGEXP.properties.prototype,"global",this.UNDEFINED,Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);this.setProperty(this.REGEXP.properties.prototype,"ignoreCase",this.UNDEFINED,Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR); -this.setProperty(this.REGEXP.properties.prototype,"multiline",this.UNDEFINED,Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);this.setProperty(this.REGEXP.properties.prototype,"source",this.createPrimitive("(?:)"),Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);c=function(a){a=a.toString();return b.createPrimitive(this.data.test(a))};this.setNativeFunctionPrototype(this.REGEXP,"test",c);c=function(a){a=a.toString();this.data.lastIndex=b.getProperty(this,"lastIndex").toNumber();a=this.data.exec(a);b.setProperty(this, -"lastIndex",b.createPrimitive(this.data.lastIndex));if(a){for(var c=b.createObject(b.ARRAY),d=0;d<a.length;d++)b.setProperty(c,d,b.createPrimitive(a[d]));b.setProperty(c,"index",b.createPrimitive(a.index));b.setProperty(c,"input",b.createPrimitive(a.input));return c}return b.NULL};this.setNativeFunctionPrototype(this.REGEXP,"exec",c)}; -Interpreter.prototype.initJSON=function(a){var b=this,c=b.createObject(this.OBJECT);this.setProperty(a,"JSON",c);a=function(a){try{var c=JSON.parse(a.toString())}catch(g){b.throwException(b.SYNTAX_ERROR,g.message);return}return b.nativeToPseudo(c)};this.setProperty(c,"parse",this.createNativeFunction(a));a=function(a){a=b.pseudoToNative(a);return b.createPrimitive(JSON.stringify(a))};this.setProperty(c,"stringify",this.createNativeFunction(a))}; -Interpreter.prototype.initError=function(a){var b=this;this.ERROR=this.createNativeFunction(function(a){var c=this.parent==b.ERROR?this:b.createObject(b.ERROR);a&&b.setProperty(c,"message",b.createPrimitive(String(a)),Interpreter.NONENUMERABLE_DESCRIPTOR);return c});this.setProperty(a,"Error",this.ERROR);this.setProperty(this.ERROR.properties.prototype,"message",this.STRING_EMPTY,Interpreter.NONENUMERABLE_DESCRIPTOR);this.setProperty(this.ERROR.properties.prototype,"name",this.createPrimitive("Error"), -Interpreter.NONENUMERABLE_DESCRIPTOR);var c=function(c){var d=b.createNativeFunction(function(a){var c=b.isa(this.parent,b.ERROR)?this:b.createObject(d);a&&b.setProperty(c,"message",b.createPrimitive(String(a)),Interpreter.NONENUMERABLE_DESCRIPTOR);return c});b.setProperty(d,"prototype",b.createObject(b.ERROR));b.setProperty(d.properties.prototype,"name",b.createPrimitive(c),Interpreter.NONENUMERABLE_DESCRIPTOR);b.setProperty(a,c,d);return d};c("EvalError");this.RANGE_ERROR=c("RangeError");this.REFERENCE_ERROR= -c("ReferenceError");this.SYNTAX_ERROR=c("SyntaxError");this.TYPE_ERROR=c("TypeError");this.URI_ERROR=c("URIError")};Interpreter.prototype.isa=function(a,b){if(!a||!b)return!1;for(;a.parent!=b;){if(!a.parent||!a.parent.properties.prototype)return!1;a=a.parent.properties.prototype}return!0}; -Interpreter.prototype.comp=function(a,b){if(a.isPrimitive&&isNaN(a.data)||b.isPrimitive&&isNaN(b.data))return NaN;if(a===b)return 0;a=a.isPrimitive?a.data:a.toString();b=b.isPrimitive?b.data:b.toString();return a<b?-1:a>b?1:0};Interpreter.prototype.arrayIndex=function(a){a=Number(a);return!isFinite(a)||a!=Math.floor(a)||0>a?NaN:a}; -Interpreter.Primitive=function(a,b){var c=typeof a;this.data=a;this.type=c;"number"==c?this.parent=b.NUMBER:"string"==c?this.parent=b.STRING:"boolean"==c&&(this.parent=b.BOOLEAN)};Interpreter.Primitive.prototype.data=void 0;Interpreter.Primitive.prototype.type="undefined";Interpreter.Primitive.prototype.parent=null;Interpreter.Primitive.prototype.isPrimitive=!0;Interpreter.Primitive.prototype.toBoolean=function(){return!!this.data};Interpreter.Primitive.prototype.toNumber=function(){return Number(this.data)}; -Interpreter.Primitive.prototype.toString=function(){return String(this.data)};Interpreter.Primitive.prototype.valueOf=function(){return this.data};Interpreter.prototype.createPrimitive=function(a){return void 0===a?this.UNDEFINED:null===a?this.NULL:!0===a?this.TRUE:!1===a?this.FALSE:0===a?this.NUMBER_ZERO:1===a?this.NUMBER_ONE:""===a?this.STRING_EMPTY:a instanceof RegExp?this.populateRegExp_(this.createObject(this.REGEXP),a):new Interpreter.Primitive(a,this)}; -Interpreter.Object=function(a){this.notConfigurable=Object.create(null);this.notEnumerable=Object.create(null);this.notWritable=Object.create(null);this.getter=Object.create(null);this.setter=Object.create(null);this.properties=Object.create(null);this.parent=a};Interpreter.Object.prototype.type="object";Interpreter.Object.prototype.parent=null;Interpreter.Object.prototype.isPrimitive=!1;Interpreter.Object.prototype.data=void 0;Interpreter.Object.prototype.toBoolean=function(){return!0}; -Interpreter.Object.prototype.toNumber=function(){return Number(void 0===this.data?this.toString():this.data)};Interpreter.Object.prototype.toString=function(){return void 0===this.data?"["+this.type+"]":String(this.data)};Interpreter.Object.prototype.valueOf=function(){return void 0===this.data?this:this.data}; -Interpreter.prototype.createObject=function(a){a=new Interpreter.Object(a);this.isa(a,this.FUNCTION)&&(a.type="function",this.setProperty(a,"prototype",this.createObject(this.OBJECT||null)));this.isa(a,this.ARRAY)&&(a.length=0,a.toString=function(){for(var a=[],c=0;c<this.length;c++){var d=this.properties[c];a[c]=!d||d.isPrimitive&&(null===d.data||void 0===d.data)?"":d.toString()}return a.join(",")});return a}; -Interpreter.prototype.populateRegExp_=function(a,b){a.data=b;this.setProperty(a,"lastIndex",this.createPrimitive(b.lastIndex),Interpreter.NONENUMERABLE_DESCRIPTOR);this.setProperty(a,"source",this.createPrimitive(b.source),Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);this.setProperty(a,"global",this.createPrimitive(b.global),Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);this.setProperty(a,"ignoreCase",this.createPrimitive(b.ignoreCase),Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);this.setProperty(a, -"multiline",this.createPrimitive(b.multiline),Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);a.toString=function(){return String(this.data)};a.valueOf=function(){return this.data};return a};Interpreter.prototype.createFunction=function(a,b){var c=this.createObject(this.FUNCTION);c.parentScope=b||this.getScope();c.node=a;this.setProperty(c,"length",this.createPrimitive(c.node.params.length),Interpreter.READONLY_DESCRIPTOR);return c}; -Interpreter.prototype.createNativeFunction=function(a){var b=this.createObject(this.FUNCTION);b.nativeFunc=a;this.setProperty(b,"length",this.createPrimitive(a.length),Interpreter.READONLY_DESCRIPTOR);return b};Interpreter.prototype.createAsyncFunction=function(a){var b=this.createObject(this.FUNCTION);b.asyncFunc=a;this.setProperty(b,"length",this.createPrimitive(a.length),Interpreter.READONLY_DESCRIPTOR);return b}; -Interpreter.prototype.nativeToPseudo=function(a){if("boolean"==typeof a||"number"==typeof a||"string"==typeof a||null===a||void 0===a||a instanceof RegExp)return this.createPrimitive(a);var b;if(a instanceof Array){b=this.createObject(this.ARRAY);for(var c=0;c<a.length;c++)this.setProperty(b,c,this.nativeToPseudo(a[c]))}else for(c in b=this.createObject(this.OBJECT),a)this.setProperty(b,c,this.nativeToPseudo(a[c]));return b}; -Interpreter.prototype.pseudoToNative=function(a){if(a.isPrimitive||this.isa(a,this.NUMBER)||this.isa(a,this.STRING)||this.isa(a,this.BOOLEAN))return a.data;var b;if(this.isa(a,this.ARRAY)){b=[];for(var c=0;c<a.length;c++)b[c]=this.pseudoToNative(a.properties[c])}else for(c in b={},a.properties)b[c]=this.pseudoToNative(a.properties[c]);return b}; -Interpreter.prototype.getProperty=function(a,b){b=b.toString();if(a==this.UNDEFINED||a==this.NULL)return this.throwException(this.TYPE_ERROR,"Cannot read property '"+b+"' of "+a),null;if(this.isa(a,this.STRING)){if("length"==b)return this.createPrimitive(a.data.length);var c=this.arrayIndex(b);if(!isNaN(c)&&c<a.data.length)return this.createPrimitive(a.data[c])}else if(this.isa(a,this.ARRAY)&&"length"==b)return this.createPrimitive(a.length);for(;;){if(a.properties&&b in a.properties)return(c=a.getter[b])? -(c.isGetter=!0,c):a.properties[b];if(a.parent&&a.parent.properties&&a.parent.properties.prototype)a=a.parent.properties.prototype;else break}return this.UNDEFINED}; -Interpreter.prototype.hasProperty=function(a,b){b=b.toString();if(a.isPrimitive)throw TypeError("Primitive data type has no properties");if("length"==b&&(this.isa(a,this.STRING)||this.isa(a,this.ARRAY)))return!0;if(this.isa(a,this.STRING)){var c=this.arrayIndex(b);if(!isNaN(c)&&c<a.data.length)return!0}for(;;){if(a.properties&&b in a.properties)return!0;if(a.parent&&a.parent.properties&&a.parent.properties.prototype)a=a.parent.properties.prototype;else break}return!1}; -Interpreter.prototype.setProperty=function(a,b,c,d){b=b.toString();d&&a.notConfigurable[b]&&this.throwException(this.TYPE_ERROR,"Cannot redefine property: "+b);if("object"!=typeof c)throw Error("Failure to wrap a value: "+c);a!=this.UNDEFINED&&a!=this.NULL||this.throwException(this.TYPE_ERROR,"Cannot set property '"+b+"' of "+a);d&&(d.get||d.set)&&(c||void 0!==d.writable)&&this.throwException(this.TYPE_ERROR,"Invalid property descriptor. Cannot both specify accessors and a value or writable attribute"); -if(!a.isPrimitive){if(this.isa(a,this.STRING)){var h=this.arrayIndex(b);if("length"==b||!isNaN(h)&&h<a.data.length)return}if(this.isa(a,this.ARRAY)){var g;if("length"==b){b=this.arrayIndex(c.toNumber());isNaN(b)&&this.throwException(this.RANGE_ERROR,"Invalid array length");if(b<a.length)for(g in a.properties)g=this.arrayIndex(g),!isNaN(g)&&b<=g&&delete a.properties[g];a.length=b;return}isNaN(g=this.arrayIndex(b))||(a.length=Math.max(a.length,g+1))}if(!a.properties[b]&&a.preventExtensions)a=this.getScope(), -a.strict&&this.throwException(this.TYPE_ERROR,"Can't add property "+b+", object is not extensible");else if(d)a.properties[b]=c,d.configurable||(a.notConfigurable[b]=!0),(c=d.get)?a.getter[b]=c:delete a.getter[b],(g=d.set)?a.setter[b]=g:delete a.setter[b],(h=d.enumerable||!1)?delete a.notEnumerable[b]:a.notEnumerable[b]=!0,c||g?(delete a.notWritable[b],a.properties[b]=this.UNDEFINED):(d=d.writable||!1)?delete a.notWritable[b]:a.notWritable[b]=!0;else{for(d=a;;){if(d.setter&&d.setter[b])return d.setter[b]; -if(d.parent&&d.parent.properties&&d.parent.properties.prototype)d=d.parent.properties.prototype;else break}a.notWritable[b]||(a.properties[b]=c)}}};Interpreter.prototype.setNativeFunctionPrototype=function(a,b,c){this.setProperty(a.properties.prototype,b,this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR)};Interpreter.prototype.deleteProperty=function(a,b){b=b.toString();return a.isPrimitive||a.notWritable[b]||"length"==b&&this.isa(a,this.ARRAY)?!1:delete a.properties[b]}; -Interpreter.prototype.getScope=function(){for(var a=0;a<this.stateStack.length;a++)if(this.stateStack[a].scope)return this.stateStack[a].scope;throw Error("No scope found.");};Interpreter.prototype.createScope=function(a,b){var c=this.createObject(null);(c.parentScope=b)||this.initGlobalScope(c);this.populateScope_(a,c);c.strict=!1;b&&b.strict?c.strict=!0:(a=a.body&&a.body[0])&&a.expression&&"Literal"==a.expression.type&&"use strict"==a.expression.value&&(c.strict=!0);return c}; -Interpreter.prototype.createSpecialScope=function(a,b){if(!a)throw Error("parentScope required");b=b||this.createObject(null);b.parentScope=a;b.strict=a.strict;return b};Interpreter.prototype.getValueFromScope=function(a){var b=this.getScope();for(a=a.toString();b;){if(a in b.properties)return b.properties[a];b=b.parentScope}this.throwException(this.REFERENCE_ERROR,a+" is not defined");return null}; -Interpreter.prototype.setValueToScope=function(a,b){var c=this.getScope(),d=c.strict;for(a=a.toString();c;){if(a in c.properties||!d&&!c.parentScope){c.notWritable[a]||(c.properties[a]=b);return}c=c.parentScope}this.throwException(this.REFERENCE_ERROR,a+" is not defined")}; -Interpreter.prototype.populateScope_=function(a,b){if("VariableDeclaration"==a.type)for(var c=0;c<a.declarations.length;c++)this.setProperty(b,a.declarations[c].id.name,this.UNDEFINED);else{if("FunctionDeclaration"==a.type){this.setProperty(b,a.id.name,this.createFunction(a,b));return}if("FunctionExpression"==a.type)return}var d=a.constructor,h;for(h in a){var g=a[h];if(g&&"object"==typeof g)if(g instanceof Array)for(c=0;c<g.length;c++)g[c]&&g[c].constructor==d&&this.populateScope_(g[c],b);else g.constructor== -d&&this.populateScope_(g,b)}};Interpreter.prototype.stripLocations_=function(a){delete a.start;delete a.end;for(var b in a)if(a.hasOwnProperty(b)){var c=a[b];c&&"object"==typeof c&&this.stripLocations_(c)}};Interpreter.prototype.getValue=function(a){if(a instanceof Array){var b=a[0];a=a[1];return this.getProperty(b,a)}return this.getValueFromScope(a)};Interpreter.prototype.setValue=function(a,b){if(a instanceof Array){var c=a[0];a=a[1];return this.setProperty(c,a,b)}this.setValueToScope(a,b)}; -Interpreter.prototype.throwException=function(a,b){if(this.stateStack[0].interpreter)try{this.stateStack[0].interpreter.throwException(a,b);return}catch(c){}void 0!==b&&(a=this.createObject(a),this.setProperty(a,"message",this.createPrimitive(b),Interpreter.NONENUMERABLE_DESCRIPTOR));this.executeException(a)}; -Interpreter.prototype.executeException=function(a){do{this.stateStack.shift();var b=this.stateStack[0];if("TryStatement"==b.node.type){b.throwValue=a;return}}while(b&&"Program"!=b.node.type);if(this.isa(a,this.ERROR)){var b={EvalError:EvalError,RangeError:RangeError,ReferenceError:ReferenceError,SyntaxError:SyntaxError,TypeError:TypeError,URIError:URIError},c=this.getProperty(a,"name").toString();a=this.getProperty(a,"message").valueOf();b=b[c]||Error;a=b(a)}else a=a.toString();throw a;}; -Interpreter.prototype.stepArrayExpression=function(){var a=this.stateStack[0],b=a.node,c=a.n||0;a.array?a.value&&this.setProperty(a.array,c-1,a.value):a.array=this.createObject(this.ARRAY);c<b.elements.length?(a.n=c+1,b.elements[c]?this.stateStack.unshift({node:b.elements[c]}):a.value=void 0):(a.array.length=a.n||0,this.stateStack.shift(),this.stateStack[0].value=a.array)}; -Interpreter.prototype.stepAssignmentExpression=function(){var a=this.stateStack[0],b=a.node;if(a.doneLeft)if(a.doneRight)if(a.doneSetter_)this.stateStack.shift(),this.stateStack[0].value=a.doneSetter_;else{var c=a.value;if("="==b.operator)b=c;else{var d=a.leftValue.toNumber(),h=c.toNumber();if("+="==b.operator)"string"==a.leftValue.type||"string"==c.type?(b=a.leftValue.toString(),c=c.toString()):(b=d,c=h),b+=c;else if("-="==b.operator)b=d-h;else if("*="==b.operator)b=d*h;else if("/="==b.operator)b= -d/h;else if("%="==b.operator)b=d%h;else if("<<="==b.operator)b=d<<h;else if(">>="==b.operator)b=d>>h;else if(">>>="==b.operator)b=d>>>h;else if("&="==b.operator)b=d&h;else if("^="==b.operator)b=d^h;else if("|="==b.operator)b=d|h;else throw SyntaxError("Unknown assignment expression: "+b.operator);b=this.createPrimitive(b)}(c=this.setValue(a.leftSide,b))?(a.doneSetter_=b,this.stateStack.unshift({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:a.leftSide[0],func_:c,doneArgs_:!0,arguments:[b]})): -(this.stateStack.shift(),this.stateStack[0].value=b)}else{a.leftSide||(a.leftSide=a.value);a.doneGetter_&&(a.leftValue=a.value);if(!a.doneGetter_&&"="!=b.operator&&(a.leftValue=this.getValue(a.leftSide),a.leftValue.isGetter)){a.leftValue.isGetter=!1;a.doneGetter_=!0;this.stateStack.unshift({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:a.leftSide[0],func_:a.leftValue,doneArgs_:!0,arguments:[]});return}a.doneRight=!0;this.stateStack.unshift({node:b.right})}else a.doneLeft=!0,this.stateStack.unshift({node:b.left, -components:!0})}; -Interpreter.prototype.stepBinaryExpression=function(){var a=this.stateStack[0],b=a.node;if(a.doneLeft)if(a.doneRight){this.stateStack.shift();var c=a.leftValue,a=a.value,d=this.comp(c,a);if("=="==b.operator||"!="==b.operator)c=c.isPrimitive&&a.isPrimitive?c.data==a.data:0===d,"!="==b.operator&&(c=!c);else if("==="==b.operator||"!=="==b.operator)c=c.isPrimitive&&a.isPrimitive?c.data===a.data:c===a,"!=="==b.operator&&(c=!c);else if(">"==b.operator)c=1==d;else if(">="==b.operator)c=1==d||0===d;else if("<"== -b.operator)c=-1==d;else if("<="==b.operator)c=-1==d||0===d;else if("+"==b.operator)c=c.isPrimitive?c.data:c.toString(),a=a.isPrimitive?a.data:a.toString(),c+=a;else if("in"==b.operator)c=this.hasProperty(a,c);else if("instanceof"==b.operator)this.isa(a,this.FUNCTION)||this.throwException(this.TYPE_ERROR,"Expecting a function in instanceof check"),c=this.isa(c,a);else if(c=c.toNumber(),a=a.toNumber(),"-"==b.operator)c-=a;else if("*"==b.operator)c*=a;else if("/"==b.operator)c/=a;else if("%"==b.operator)c%= -a;else if("&"==b.operator)c&=a;else if("|"==b.operator)c|=a;else if("^"==b.operator)c^=a;else if("<<"==b.operator)c<<=a;else if(">>"==b.operator)c>>=a;else if(">>>"==b.operator)c>>>=a;else throw SyntaxError("Unknown binary operator: "+b.operator);this.stateStack[0].value=this.createPrimitive(c)}else a.doneRight=!0,a.leftValue=a.value,this.stateStack.unshift({node:b.right});else a.doneLeft=!0,this.stateStack.unshift({node:b.left})}; -Interpreter.prototype.stepBlockStatement=function(){var a=this.stateStack[0],b=a.node,c=a.n_||0;b.body[c]?(a.done=!1,a.n_=c+1,this.stateStack.unshift({node:b.body[c]})):(a.done=!0,"Program"!=a.node.type&&this.stateStack.shift())}; -Interpreter.prototype.stepBreakStatement=function(){var a=this.stateStack.shift(),a=a.node,b=null;a.label&&(b=a.label.name);for(a=this.stateStack.shift();a&&"CallExpression"!=a.node.type&&"NewExpression"!=a.node.type;){if(b?b==a.label:a.isLoop||a.isSwitch)return;a=this.stateStack.shift()}throw SyntaxError("Illegal break statement");}; -Interpreter.prototype.stepCallExpression=function(){var a=this.stateStack[0],b=a.node;if(a.doneCallee_){if(!a.func_){if("function"==a.value.type)a.func_=a.value;else{a.value.length&&(a.member_=a.value[0]);a.func_=this.getValue(a.value);if(!a.func_)return;if("function"!=a.func_.type){this.throwException(this.TYPE_ERROR,(a.value&&a.value.type)+" is not a function");return}}"NewExpression"==a.node.type?(a.funcThis_=this.createObject(a.func_),a.isConstructor_=!0):a.funcThis_=a.func_.boundThis_?a.func_.boundThis_: -a.value.length?a.value[0]:this.stateStack[this.stateStack.length-1].thisExpression;a.arguments=a.func_.boundArgs_?a.func_.boundArgs_.concat():[];a.n_=0}if(!a.doneArgs_){0!=a.n_&&a.arguments.push(a.value);if(b.arguments[a.n_]){this.stateStack.unshift({node:b.arguments[a.n_]});a.n_++;return}a.doneArgs_=!0}if(a.doneExec_)this.stateStack.shift(),this.stateStack[0].value=a.isConstructor_&&"object"!==a.value.type?a.funcThis_:a.value;else if(a.doneExec_=!0,a.func_.node){for(var b=this.createScope(a.func_.node.body, -a.func_.parentScope),c=0;c<a.func_.node.params.length;c++){var d=this.createPrimitive(a.func_.node.params[c].name),h=a.arguments.length>c?a.arguments[c]:this.UNDEFINED;this.setProperty(b,d,h)}d=this.createObject(this.ARRAY);for(c=0;c<a.arguments.length;c++)this.setProperty(d,this.createPrimitive(c),a.arguments[c]);this.setProperty(b,"arguments",d);b={node:a.func_.node.body,scope:b,thisExpression:a.funcThis_};this.stateStack.unshift(b);a.value=this.UNDEFINED}else if(a.func_.nativeFunc)a.value=a.func_.nativeFunc.apply(a.funcThis_, -a.arguments);else if(a.func_.asyncFunc){var g=this,b=function(b){a.value=b||g.UNDEFINED;g.paused_=!1},b=a.arguments.concat(b);a.func_.asyncFunc.apply(a.funcThis_,b);this.paused_=!0}else if(a.func_.eval)(b=a.arguments[0])?b.isPrimitive?(b=new Interpreter(b.toString()),b.stateStack[0].scope=this.getScope(),a={node:{type:"Eval_"},interpreter:b},this.stateStack.unshift(a)):a.value=b:a.value=this.UNDEFINED;else throw TypeError("function not a function (huh?)");}else a.doneCallee_=!0,this.stateStack.unshift({node:b.callee, -components:!0})};Interpreter.prototype.stepCatchClause=function(){var a=this.stateStack[0],b=a.node;if(a.doneBody)this.stateStack.shift();else{a.doneBody=!0;var c;if(b.param){c=this.createSpecialScope(this.getScope());var d=this.createPrimitive(b.param.name);this.setProperty(c,d,a.throwValue)}this.stateStack.unshift({node:b.body,scope:c})}}; -Interpreter.prototype.stepConditionalExpression=function(){var a=this.stateStack[0];a.done?(this.stateStack.shift(),"ConditionalExpression"==a.node.type&&(this.stateStack[0].value=a.value)):a.test?(a.done=!0,a.value.toBoolean()&&a.node.consequent?this.stateStack.unshift({node:a.node.consequent}):!a.value.toBoolean()&&a.node.alternate&&this.stateStack.unshift({node:a.node.alternate})):(a.test=!0,this.stateStack.unshift({node:a.node.test}))}; -Interpreter.prototype.stepContinueStatement=function(){var a=this.stateStack[0].node,b=null;a.label&&(b=a.label.name);for(a=this.stateStack[0];a&&"CallExpression"!=a.node.type&&"NewExpression"!=a.node.type;){if(a.isLoop&&(!b||b==a.label))return;this.stateStack.shift();a=this.stateStack[0]}throw SyntaxError("Illegal continue statement");}; -Interpreter.prototype.stepDoWhileStatement=function(){var a=this.stateStack[0];a.isLoop=!0;"DoWhileStatement"==a.node.type&&void 0===a.test&&(a.value=this.TRUE,a.test=!0);a.test?(a.test=!1,a.value.toBoolean()?a.node.body&&this.stateStack.unshift({node:a.node.body}):this.stateStack.shift()):(a.test=!0,this.stateStack.unshift({node:a.node.test}))};Interpreter.prototype.stepEmptyStatement=function(){this.stateStack.shift()}; -Interpreter.prototype.stepEval_=function(){var a=this.stateStack[0];a.interpreter.step()||(this.stateStack.shift(),this.stateStack[0].value=a.interpreter.value||this.UNDEFINED)};Interpreter.prototype.stepExpressionStatement=function(){var a=this.stateStack[0];a.done?(this.stateStack.shift(),this.value=a.value):(a.done=!0,this.stateStack.unshift({node:a.node.expression}))}; -Interpreter.prototype.stepForInStatement=function(){var a=this.stateStack[0];a.isLoop=!0;var b=a.node;if(a.doneVariable_)if(a.doneObject_){"undefined"==typeof a.iterator&&(a.object=a.value,a.iterator=0);var c=null;a:do{var d=a.iterator,h;for(h in a.object.properties)if(!a.object.notEnumerable[h]){if(0==d){c=h;break a}d--}a.object=a.object.parent&&a.object.parent.properties.prototype;a.iterator=0}while(a.object);a.iterator++;null===c?this.stateStack.shift():(this.setValueToScope(a.variable,this.createPrimitive(c)), -b.body&&this.stateStack.unshift({node:b.body}))}else a.doneObject_=!0,a.variable=a.value,this.stateStack.unshift({node:b.right});else a.doneVariable_=!0,a=b.left,"VariableDeclaration"==a.type&&(a=a.declarations[0].id),this.stateStack.unshift({node:a,components:!0})}; -Interpreter.prototype.stepForStatement=function(){var a=this.stateStack[0];a.isLoop=!0;var b=a.node,c=a.mode||0;0==c?(a.mode=1,b.init&&this.stateStack.unshift({node:b.init})):1==c?(a.mode=2,b.test&&this.stateStack.unshift({node:b.test})):2==c?(a.mode=3,b.test&&a.value&&!a.value.toBoolean()?this.stateStack.shift():b.body&&this.stateStack.unshift({node:b.body})):3==c&&(a.mode=1,b.update&&this.stateStack.unshift({node:b.update}))};Interpreter.prototype.stepFunctionDeclaration=function(){this.stateStack.shift()}; -Interpreter.prototype.stepFunctionExpression=function(){var a=this.stateStack.shift();this.stateStack[0].value=this.createFunction(a.node)};Interpreter.prototype.stepIdentifier=function(){var a=this.stateStack.shift(),b=this.createPrimitive(a.node.name);this.stateStack[0].value=a.components?b:this.getValueFromScope(b)};Interpreter.prototype.stepIfStatement=Interpreter.prototype.stepConditionalExpression; -Interpreter.prototype.stepLabeledStatement=function(){var a=this.stateStack.shift();this.stateStack.unshift({node:a.node.body,label:a.node.label.name})};Interpreter.prototype.stepLiteral=function(){var a=this.stateStack.shift();this.stateStack[0].value=this.createPrimitive(a.node.value)}; -Interpreter.prototype.stepLogicalExpression=function(){var a=this.stateStack[0],b=a.node;if("&&"!=b.operator&&"||"!=b.operator)throw SyntaxError("Unknown logical operator: "+b.operator);a.doneLeft_?a.doneRight_?(this.stateStack.shift(),this.stateStack[0].value=a.value):"&&"==b.operator&&!a.value.toBoolean()||"||"==b.operator&&a.value.toBoolean()?(this.stateStack.shift(),this.stateStack[0].value=a.value):(a.doneRight_=!0,this.stateStack.unshift({node:b.right})):(a.doneLeft_=!0,this.stateStack.unshift({node:b.left}))}; -Interpreter.prototype.stepMemberExpression=function(){var a=this.stateStack[0],b=a.node;a.doneObject_?a.doneProperty_?(this.stateStack.shift(),a.components?this.stateStack[0].value=[a.object,a.value]:(b=this.getProperty(a.object,a.value))?b.isGetter?(b.isGetter=!1,this.stateStack.unshift({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:a.object,func_:b,doneArgs_:!0,arguments:[]})):this.stateStack[0].value=b:(this.stateStack.unshift({}),this.throwException(this.TYPE_ERROR,"Cannot read property '"+ -a.value+"' of "+a.object.toString()))):(a.doneProperty_=!0,a.object=a.value,this.stateStack.unshift({node:b.property,components:!b.computed})):(a.doneObject_=!0,this.stateStack.unshift({node:b.object}))};Interpreter.prototype.stepNewExpression=Interpreter.prototype.stepCallExpression; -Interpreter.prototype.stepObjectExpression=function(){var a=this.stateStack[0],b=a.node,c=a.valueToggle,d=a.n||0;a.object?c?a.key=a.value:(a.properties[a.key]||(a.properties[a.key]={}),a.properties[a.key][a.kind]=a.value):(a.object=this.createObject(this.OBJECT),a.properties=Object.create(null));if(b.properties[d])c?(a.n=d+1,this.stateStack.unshift({node:b.properties[d].value})):(a.kind=b.properties[d].kind,this.stateStack.unshift({node:b.properties[d].key,components:!0})),a.valueToggle=!c;else{for(var h in a.properties)b= -a.properties[h],"get"in b||"set"in b?(b={configurable:!0,enumerable:!0,get:b.get,set:b.set},this.setProperty(a.object,h,null,b)):this.setProperty(a.object,h,b.init);this.stateStack.shift();this.stateStack[0].value=a.object}};Interpreter.prototype.stepProgram=Interpreter.prototype.stepBlockStatement; -Interpreter.prototype.stepReturnStatement=function(){var a=this.stateStack[0],b=a.node;if(b.argument&&!a.done)a.done=!0,this.stateStack.unshift({node:b.argument});else{b=a.value||this.UNDEFINED;do{this.stateStack.shift();if(0==this.stateStack.length)throw SyntaxError("Illegal return statement");a=this.stateStack[0]}while("CallExpression"!=a.node.type&&"NewExpression"!=a.node.type);a.value=b}}; -Interpreter.prototype.stepSequenceExpression=function(){var a=this.stateStack[0],b=a.node,c=a.n||0;b.expressions[c]?(a.n=c+1,this.stateStack.unshift({node:b.expressions[c]})):(this.stateStack.shift(),this.stateStack[0].value=a.value)}; -Interpreter.prototype.stepSwitchStatement=function(){var a=this.stateStack[0];a.checked=a.checked||[];a.isSwitch=!0;if(a.test){a.switchValue||(a.switchValue=a.value);var b=a.index||0,c=a.node.cases[b];if(c)if(a.done||a.checked[b]||!c.test){if(a.done||!c.test||0==this.comp(a.value,a.switchValue)){a.done=!0;var d=a.n||0;if(c.consequent[d]){this.stateStack.unshift({node:c.consequent[d]});a.n=d+1;return}}a.n=0;a.index=b+1}else a.checked[b]=!0,this.stateStack.unshift({node:c.test});else this.stateStack.shift()}else a.test= -!0,this.stateStack.unshift({node:a.node.discriminant})};Interpreter.prototype.stepThisExpression=function(){this.stateStack.shift();for(var a=0;a<this.stateStack.length;a++)if(this.stateStack[a].thisExpression){this.stateStack[0].value=this.stateStack[a].thisExpression;return}throw Error("No this expression found.");};Interpreter.prototype.stepThrowStatement=function(){var a=this.stateStack[0],b=a.node;a.argument?this.throwException(a.value):(a.argument=!0,this.stateStack.unshift({node:b.argument}))}; -Interpreter.prototype.stepTryStatement=function(){var a=this.stateStack[0],b=a.node;a.doneBlock?a.throwValue&&!a.doneHandler&&b.handler?(a.doneHandler=!0,this.stateStack.unshift({node:b.handler,throwValue:a.throwValue}),a.throwValue=null):!a.doneFinalizer&&b.finalizer?(a.doneFinalizer=!0,this.stateStack.unshift({node:b.finalizer})):a.throwValue?this.executeException(a.throwValue):this.stateStack.shift():(a.doneBlock=!0,this.stateStack.unshift({node:b.block}))}; -Interpreter.prototype.stepUnaryExpression=function(){var a=this.stateStack[0],b=a.node;if(a.done){this.stateStack.shift();if("-"==b.operator)b=-a.value.toNumber();else if("+"==b.operator)b=a.value.toNumber();else if("!"==b.operator)b=!a.value.toBoolean();else if("~"==b.operator)b=~a.value.toNumber();else if("delete"==b.operator||"typeof"==b.operator){if(a.value.length)var c=a.value[0],a=a.value[1];else c=this.getScope(),a=a.value;b="delete"==b.operator?this.deleteProperty(c,a):this.getProperty(c, -a).type}else if("void"==b.operator)b=void 0;else throw SyntaxError("Unknown unary operator: "+b.operator);this.stateStack[0].value=this.createPrimitive(b)}else{a.done=!0;c={node:b.argument};if("delete"==b.operator||"typeof"==b.operator)c.components=!0;this.stateStack.unshift(c)}}; -Interpreter.prototype.stepUpdateExpression=function(){var a=this.stateStack[0],b=a.node;if(a.doneLeft){a.leftSide||(a.leftSide=a.value);a.doneGetter_&&(a.leftValue=a.value);if(!a.doneGetter_){a.leftValue=this.getValue(a.leftSide);if(!a.leftValue)return;if(a.leftValue.isGetter){a.leftValue.isGetter=!1;a.doneGetter_=!0;this.stateStack.unshift({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:a.leftSide[0],func_:a.leftValue,doneArgs_:!0,arguments:[]});return}}if(a.doneSetter_)this.stateStack.shift(), -this.stateStack[0].value=a.doneSetter_;else{var c=a.leftValue.toNumber(),d;if("++"==b.operator)d=this.createPrimitive(c+1);else if("--"==b.operator)d=this.createPrimitive(c-1);else throw SyntaxError("Unknown update expression: "+b.operator);b=b.prefix?d:this.createPrimitive(c);(c=this.setValue(a.leftSide,d))?(a.doneSetter_=b,this.stateStack.unshift({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:a.leftSide[0],func_:c,doneArgs_:!0,arguments:[d]})):(this.stateStack.shift(),this.stateStack[0].value= -b)}}else a.doneLeft=!0,this.stateStack.unshift({node:b.argument,components:!0})};Interpreter.prototype.stepVariableDeclaration=function(){var a=this.stateStack[0],b=a.node,c=a.n||0;b.declarations[c]?(a.n=c+1,this.stateStack.unshift({node:b.declarations[c]})):this.stateStack.shift()}; -Interpreter.prototype.stepVariableDeclarator=function(){var a=this.stateStack[0],b=a.node;b.init&&!a.done?(a.done=!0,this.stateStack.unshift({node:b.init})):(b.init&&this.setValue(this.createPrimitive(b.id.name),a.value),this.stateStack.shift())}; -Interpreter.prototype.stepWithStatement=function(){var a=this.stateStack[0],b=a.node;a.doneObject?a.doneBody?this.stateStack.shift():(a.doneBody=!0,a=this.createSpecialScope(this.getScope(),a.value),this.stateStack.unshift({node:b.body,scope:a})):(a.doneObject=!0,this.stateStack.unshift({node:b.object}))};Interpreter.prototype.stepWhileStatement=Interpreter.prototype.stepDoWhileStatement;this.Interpreter=Interpreter;Interpreter.prototype.appendCode=Interpreter.prototype.appendCode; -Interpreter.prototype.createAsyncFunction=Interpreter.prototype.createAsyncFunction;Interpreter.prototype.step=Interpreter.prototype.step;Interpreter.prototype.run=Interpreter.prototype.run; diff --git a/res/lib/blockly/demos/interpreter/async-execution.html b/res/lib/blockly/demos/interpreter/async-execution.html deleted file mode 100644 index 52b8433aebaf9102c3e014fdfdecda9df57cf6a9..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/interpreter/async-execution.html +++ /dev/null @@ -1,267 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Asynchronous Execution with JS Interpreter</title> - <script src="acorn_interpreter.js"></script> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../javascript_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <script src="wait_block.js"></script> - <style> - body { - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Asynchronous Execution with JS Interpreter</h1> - - <p>This is a demo of executing code asychronously (e.g., waiting for delays or user input) using the JavaScript interpreter.</p> - - <p>→ <a href="https://developers.google.com/blockly/guides/configure-blockly/web/running-javascript#js_interpreter">More info on running code with JS Interpreter</a></p> - - <p> - <button onclick="runCode()" id="runButton">Run JavaScript</button> - </p> - - <div style="width: 100%"> - <div id="blocklyDiv" - style="display: inline-block; height: 480px; width: 58%"></div> - <textarea id="output" disabled="disabled" - style="display: inline-block; height: 480px; width: 38%;"> - </textarea> - </div> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <category name="Logic" colour="%{BKY_LOGIC_HUE}"> - <block type="controls_if"></block> - <block type="logic_compare"></block> - <block type="logic_operation"></block> - <block type="logic_negate"></block> - <block type="logic_boolean"></block> - </category> - <category name="Loops" colour="%{BKY_LOOPS_HUE}"> - <block type="controls_repeat_ext"> - <value name="TIMES"> - <block type="math_number"> - <field name="NUM">10</field> - </block> - </value> - </block> - <block type="controls_whileUntil"></block> - </category> - <category name="Math" colour="%{BKY_MATH_HUE}"> - <block type="math_number"> - <field name="NUM">123</field> - </block> - <block type="math_arithmetic"></block> - <block type="math_single"></block> - </category> - <category name="Text" colour="%{BKY_TEXTS_HUE}"> - <block type="text"></block> - <block type="text_length"></block> - <block type="text_print"></block> - <block type="text_prompt_ext"> - <value name="TEXT"> - <block type="text"></block> - </value> - </block> - </category> - <sep></sep> - <category name="Variables" custom="VARIABLE" colour="%{BKY_VARIABLES_HUE}"> - </category> - <category name="Functions" custom="PROCEDURE" colour="%{BKY_PROCEDURES_HUE}"> - </category> - </xml> - - <xml xmlns="https://developers.google.com/blockly/xml" id="startBlocks" style="display: none"> - <block type="variables_set" id="set_n_initial" inline="true" x="20" y="20"> - <field name="VAR">n</field> - <value name="VALUE"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - <next> - <block type="controls_repeat_ext" id="repeat" inline="true"> - <value name="TIMES"> - <block type="math_number"> - <field name="NUM">4</field> - </block> - </value> - <statement name="DO"> - <block type="wait_seconds" id="wait"> - <field name="SECONDS">1.0</field> - <next> - <block type="variables_set" id="set_n_update" inline="true"> - <field name="VAR">n</field> - <value name="VALUE"> - <block type="math_arithmetic" inline="true"> - <field name="OP">MULTIPLY</field> - <value name="A"> - <block type="variables_get"> - <field name="VAR">n</field> - </block> - </value> - <value name="B"> - <block type="math_number"> - <field name="NUM">2</field> - </block> - </value> - </block> - </value> - <next> - <block type="text_print" id="print" inline="false"> - <value name="TEXT"> - <block type="variables_get"> - <field name="VAR">n</field> - </block> - </value> - </block> - </next> - </block> - </next> - </block> - </statement> - </block> - </next> - </block> - </xml> - - <script> - var demoWorkspace = Blockly.inject('blocklyDiv', - {media: '../../media/', - toolbox: document.getElementById('toolbox')}); - Blockly.Xml.domToWorkspace(document.getElementById('startBlocks'), - demoWorkspace); - - // Exit is used to signal the end of a script. - Blockly.JavaScript.addReservedWords('exit'); - - var outputArea = document.getElementById('output'); - var runButton = document.getElementById('runButton'); - var myInterpreter = null; - var runner; - - function initApi(interpreter, scope) { - // Add an API function for the alert() block, generated for "text_print" blocks. - var wrapper = function(text) { - text = text ? text.toString() : ''; - outputArea.value = outputArea.value + '\n' + text; - }; - interpreter.setProperty(scope, 'alert', - interpreter.createNativeFunction(wrapper)); - - // Add an API function for the prompt() block. - var wrapper = function(text) { - text = text ? text.toString() : ''; - return interpreter.createPrimitive(prompt(text)); - }; - interpreter.setProperty(scope, 'prompt', - interpreter.createNativeFunction(wrapper)); - - // Add an API for the wait block. See wait_block.js - initInterpreterWaitForSeconds(interpreter, scope); - - // Add an API function for highlighting blocks. - var wrapper = function(id) { - id = id ? id.toString() : ''; - return interpreter.createPrimitive(highlightBlock(id)); - }; - interpreter.setProperty(scope, 'highlightBlock', - interpreter.createNativeFunction(wrapper)); - } - - var highlightPause = false; - var latestCode = ''; - - function highlightBlock(id) { - demoWorkspace.highlightBlock(id); - highlightPause = true; - } - - function resetStepUi(clearOutput) { - demoWorkspace.highlightBlock(null); - highlightPause = false; - runButton.disabled = ''; - - if (clearOutput) { - outputArea.value = 'Program output:\n================='; - } - } - - function generateCodeAndLoadIntoInterpreter() { - // Generate JavaScript code and parse it. - Blockly.JavaScript.STATEMENT_PREFIX = 'highlightBlock(%1);\n'; - Blockly.JavaScript.addReservedWords('highlightBlock'); - latestCode = Blockly.JavaScript.workspaceToCode(demoWorkspace); - - resetStepUi(true); - } - - function resetInterpreter() { - myInterpreter = null; - if (runner) { - clearTimeout(runner); - runner = null; - } - } - - function runCode() { - if (!myInterpreter) { - // First statement of this code. - // Clear the program output. - resetStepUi(true); - runButton.disabled = 'disabled'; - - // And then show generated code in an alert. - // In a timeout to allow the outputArea.value to reset first. - setTimeout(function() { - alert('Ready to execute the following code\n' + - '===================================\n' + - latestCode); - - // Begin execution - highlightPause = false; - myInterpreter = new Interpreter(latestCode, initApi); - runner = function() { - if (myInterpreter) { - var hasMore = myInterpreter.run(); - if (hasMore) { - // Execution is currently blocked by some async call. - // Try again later. - setTimeout(runner, 10); - } else { - // Program is complete. - outputArea.value += '\n\n<< Program complete >>'; - resetInterpreter(); - resetStepUi(false); - } - } - }; - runner(); - }, 1); - return; - } - } - - // Load the interpreter now, and upon future changes. - generateCodeAndLoadIntoInterpreter(); - demoWorkspace.addChangeListener(function(event) { - if (!(event instanceof Blockly.Events.Ui)) { - // Something changed. Parser needs to be reloaded. - resetInterpreter(); - generateCodeAndLoadIntoInterpreter(); - } - }); - </script> -</body> -</html> diff --git a/res/lib/blockly/demos/interpreter/icon.png b/res/lib/blockly/demos/interpreter/icon.png deleted file mode 100644 index b70d1b03595c140780326fed3509a5bfffdadeb8..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/interpreter/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/interpreter/index.html b/res/lib/blockly/demos/interpreter/index.html deleted file mode 100644 index 2245057c03ef6979d483a54ba7cb6a7725c1ed8c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/interpreter/index.html +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"/> - <title>Redirecting...</title> - <meta http-equiv="refresh" content="0;URL='step-execution.html'"/> -</head> -<body> -Redirecting to <a href="step-execution.html">step execution jsinterpreter demo</a>. -</body> -</html> diff --git a/res/lib/blockly/demos/interpreter/step-execution.html b/res/lib/blockly/demos/interpreter/step-execution.html deleted file mode 100644 index 42ae50398f8b02784f11572e368f78a59be1d53d..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/interpreter/step-execution.html +++ /dev/null @@ -1,255 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Step Execution with JS Interpreter</title> - <script src="acorn_interpreter.js"></script> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../javascript_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <style> - body { - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Step Execution with JS Interpreter</h1> - - <p>This is a demo of executing code step-by-step with a sandboxed JavaScript interpreter.</p> - - <p>The generator's <code>Blockly.JavaScript.STATEMENT_PREFIX</code> is assigned <code>'highlightBlock(%1);\n'</code>, - where <code>%1</code> is the block id. The call to <code>highlightBlock()</code> will highlight the identified block - and set the variable <code>highlightPause</code> to <code>true</code>.</p> - - <p>"Parse JavaScript" will generate the code and load it into the interpreter. Then, each press of the - "Step JavaScript" button will run the interpreter one step until the <code>highlightPause</code> is true. - That is, until <code>highlightBlock()</code> has highlighted the block that will be executed on the next step.</p> - - <p>→ <a href="https://developers.google.com/blockly/guides/configure-blockly/web/running-javascript#js_interpreter">More info on running code with JS Interpreter</a></p> - - <p> - <button onclick="stepCode()" id="stepButton">Step JavaScript</button> - </p> - - <div style="width: 100%"> - <div id="blocklyDiv" - style="display: inline-block; height: 480px; width: 58%"></div> - <textarea id="output" disabled="disabled" - style="display: inline-block; height: 480px; width: 38%;"> - </textarea> - </div> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <category name="Logic" colour="%{BKY_LOGIC_HUE}"> - <block type="controls_if"></block> - <block type="logic_compare"></block> - <block type="logic_operation"></block> - <block type="logic_negate"></block> - <block type="logic_boolean"></block> - </category> - <category name="Loops" colour="%{BKY_LOOPS_HUE}"> - <block type="controls_repeat_ext"> - <value name="TIMES"> - <block type="math_number"> - <field name="NUM">10</field> - </block> - </value> - </block> - <block type="controls_whileUntil"></block> - </category> - <category name="Math" colour="%{BKY_MATH_HUE}"> - <block type="math_number"> - <field name="NUM">123</field> - </block> - <block type="math_arithmetic"></block> - <block type="math_single"></block> - </category> - <category name="Text" colour="%{BKY_TEXTS_HUE}"> - <block type="text"></block> - <block type="text_length"></block> - <block type="text_print"></block> - <block type="text_prompt_ext"> - <value name="TEXT"> - <block type="text"></block> - </value> - </block> - </category> - <sep></sep> - <category name="Variables" custom="VARIABLE" colour="%{BKY_VARIABLES_HUE}"> - </category> - <category name="Functions" custom="PROCEDURE" colour="%{BKY_PROCEDURES_HUE}"> - </category> - </xml> - - <xml xmlns="https://developers.google.com/blockly/xml" id="startBlocks" style="display: none"> - <block type="variables_set" id="set_n_initial" inline="true" x="20" y="20"> - <field name="VAR">n</field> - <value name="VALUE"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - <next> - <block type="controls_repeat_ext" id="repeat" inline="true"> - <value name="TIMES"> - <block type="math_number"> - <field name="NUM">4</field> - </block> - </value> - <statement name="DO"> - <block type="variables_set" id="set_n_update" inline="true"> - <field name="VAR">n</field> - <value name="VALUE"> - <block type="math_arithmetic" inline="true"> - <field name="OP">MULTIPLY</field> - <value name="A"> - <block type="variables_get"> - <field name="VAR">n</field> - </block> - </value> - <value name="B"> - <block type="math_number"> - <field name="NUM">2</field> - </block> - </value> - </block> - </value> - <next> - <block type="text_print" id="print"> - <value name="TEXT"> - <block type="variables_get"> - <field name="VAR">n</field> - </block> - </value> - </block> - </next> - </block> - </statement> - </block> - </next> - </block> - </xml> - - <script> - var demoWorkspace = Blockly.inject('blocklyDiv', - {media: '../../media/', - toolbox: document.getElementById('toolbox')}); - Blockly.Xml.domToWorkspace(document.getElementById('startBlocks'), - demoWorkspace); - - var outputArea = document.getElementById('output'); - var stepButton = document.getElementById('stepButton'); - var myInterpreter = null; - - function initApi(interpreter, scope) { - // Add an API function for the alert() block, generated for "text_print" blocks. - interpreter.setProperty(scope, 'alert', - interpreter.createNativeFunction(function(text) { - text = text ? text.toString() : ''; - outputArea.value += '\n' + text; - })); - - // Add an API function for the prompt() block. - var wrapper = function(text) { - text = text ? text.toString() : ''; - return interpreter.createPrimitive(prompt(text)); - }; - interpreter.setProperty(scope, 'prompt', - interpreter.createNativeFunction(wrapper)); - - // Add an API function for highlighting blocks. - var wrapper = function(id) { - id = id ? id.toString() : ''; - return interpreter.createPrimitive(highlightBlock(id)); - }; - interpreter.setProperty(scope, 'highlightBlock', - interpreter.createNativeFunction(wrapper)); - } - - var highlightPause = false; - var latestCode = ''; - - function highlightBlock(id) { - demoWorkspace.highlightBlock(id); - highlightPause = true; - } - - function resetStepUi(clearOutput) { - demoWorkspace.highlightBlock(null); - highlightPause = false; - - if (clearOutput) { - outputArea.value = 'Program output:\n================='; - } - } - - function generateCodeAndLoadIntoInterpreter() { - // Generate JavaScript code and parse it. - Blockly.JavaScript.STATEMENT_PREFIX = 'highlightBlock(%1);\n'; - Blockly.JavaScript.addReservedWords('highlightBlock'); - latestCode = Blockly.JavaScript.workspaceToCode(demoWorkspace); - resetStepUi(true); - } - - function stepCode() { - if (!myInterpreter) { - // First statement of this code. - // Clear the program output. - resetStepUi(true); - myInterpreter = new Interpreter(latestCode, initApi); - - // And then show generated code in an alert. - // In a timeout to allow the outputArea.value to reset first. - setTimeout(function() { - alert('Ready to execute the following code\n' + - '===================================\n' + latestCode); - highlightPause = true; - stepCode(); - }, 1); - return; - } - highlightPause = false; - do { - try { - var hasMoreCode = myInterpreter.step(); - } finally { - if (!hasMoreCode) { - // Program complete, no more code to execute. - outputArea.value += '\n\n<< Program complete >>'; - - myInterpreter = null; - resetStepUi(false); - - // Cool down, to discourage accidentally restarting the program. - stepButton.disabled = 'disabled'; - setTimeout(function() { - stepButton.disabled = ''; - }, 2000); - - return; - } - } - // Keep executing until a highlight statement is reached, - // or the code completes or errors. - } while (hasMoreCode && !highlightPause); - } - - // Load the interpreter now, and upon future changes. - generateCodeAndLoadIntoInterpreter(); - demoWorkspace.addChangeListener(function(event) { - if (!(event instanceof Blockly.Events.Ui)) { - // Something changed. Parser needs to be reloaded. - generateCodeAndLoadIntoInterpreter(); - } - }); - </script> -</body> -</html> diff --git a/res/lib/blockly/demos/interpreter/wait_block.js b/res/lib/blockly/demos/interpreter/wait_block.js deleted file mode 100644 index 4f49d8afc86b9bbd86744fccd2f71fd61c2a79b2..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/interpreter/wait_block.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Example "wait" block that will pause the interpreter for a - * number of seconds. Because wait is a blocking behavior, such blocks will - * only work in interpreted environments. - * - * See https://neil.fraser.name/software/JS-Interpreter/docs.html - */ -Blockly.defineBlocksWithJsonArray([{ - "type": "wait_seconds", - "message0": " wait %1 seconds", - "args0": [{ - "type": "field_number", - "name": "SECONDS", - "min": 0, - "max": 600, - "value": 1 - }], - "previousStatement": null, - "nextStatement": null, - "colour": "%{BKY_LOOPS_HUE}" -}]); - -/** - * Generator for wait block creates call to new method - * <code>waitForSeconds()</code>. - */ -Blockly.JavaScript['wait_seconds'] = function(block) { - var seconds = Number(block.getFieldValue('SECONDS')); - var code = 'waitForSeconds(' + seconds + ');\n'; - return code; -}; - -/** - * Register the interpreter asynchronous function - * <code>waitForSeconds()</code>. - */ -function initInterpreterWaitForSeconds(interpreter, scope) { - // Ensure function name does not conflict with variable names. - Blockly.JavaScript.addReservedWords('waitForSeconds'); - - var wrapper = interpreter.createAsyncFunction( - function(timeInSeconds, callback) { - // Delay the call to the callback. - setTimeout(callback, timeInSeconds * 1000); - }); - interpreter.setProperty(scope, 'waitForSeconds', wrapper); -} \ No newline at end of file diff --git a/res/lib/blockly/demos/keyboard_nav/basic_cursor.js b/res/lib/blockly/demos/keyboard_nav/basic_cursor.js deleted file mode 100644 index feaa53ea2177ca488e8411985ba2e3e36c50bf66..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/keyboard_nav/basic_cursor.js +++ /dev/null @@ -1,209 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview The class representing a basic cursor. - * Used to demo switching between different cursors. - * @author aschmiedt@google.com (Abby Schmiedt) - */ -'use strict'; - - -/** - * Class for a basic cursor. - * This will allow the user to get to all nodes in the AST by hitting next or - * previous. - * @constructor - * @extends {Blockly.Cursor} - */ -Blockly.BasicCursor = function() { - Blockly.BasicCursor.superClass_.constructor.call(this); -}; -Blockly.utils.object.inherits(Blockly.BasicCursor, Blockly.Cursor); - -/** - * Decides what nodes to traverse and which ones to skip. Currently, it - * skips output, stack and workspace nodes. - * @param {Blockly.ASTNode} node The AST node to check whether it is valid. - * @return {boolean} True if the node should be visited, false otherwise. - * @private - */ -Blockly.BasicCursor.prototype.validNode_ = function(node) { - var isValid = false; - var type = node && node.getType(); - if (type == Blockly.ASTNode.types.OUTPUT || - type == Blockly.ASTNode.types.INPUT || - type == Blockly.ASTNode.types.FIELD || - type == Blockly.ASTNode.types.NEXT || - type == Blockly.ASTNode.types.PREVIOUS || - type == Blockly.ASTNode.types.WORKSPACE) { - isValid = true; - } - return isValid; -}; - -/** - * From the given node find either the next valid sibling or parent. - * @param {Blockly.ASTNode} node The current position in the AST. - * @return {Blockly.ASTNode} The parent AST node or null if there are no - * valid parents. - * @private - */ -Blockly.BasicCursor.prototype.findSiblingOrParent_ = function(node) { - if (!node) { - return null; - } - var nextNode = node.next(); - if (nextNode) { - return nextNode; - } - return this.findSiblingOrParent_(node.out()); -}; - -/** - * Uses pre order traversal to navigate the Blockly AST. This will allow - * a user to easily navigate the entire Blockly AST without having to go in - * and out levels on the tree. - * @param {Blockly.ASTNode} node The current position in the AST. - * @return {Blockly.ASTNode} The next node in the traversal. - * @private - */ -Blockly.BasicCursor.prototype.getNextNode_ = function(node) { - if (!node) { - return null; - } - var newNode = node.in() || node.next(); - if (this.validNode_(newNode)) { - return newNode; - } else if (newNode) { - return this.getNextNode_(newNode); - } - var siblingOrParent = this.findSiblingOrParent_(node.out()); - if (this.validNode_(siblingOrParent)) { - return siblingOrParent; - } else if (siblingOrParent) { - return this.getNextNode_(siblingOrParent); - } - return null; -}; - -/** - * Get the right most child of a node. - * @param {Blockly.ASTNode} node The node to find the right most child of. - * @return {Blockly.ASTNode} The right most child of the given node, or the node - * if no child exists. - * @private - */ -Blockly.BasicCursor.prototype.getRightMostChild_ = function(node) { - if (!node.in()) { - return node; - } - var newNode = node.in(); - while (newNode.next()) { - newNode = newNode.next(); - } - return this.getRightMostChild_(newNode); - -}; - -/** - * Reverses the pre order traversal in order to find the previous node. This will - * allow a user to easily navigate the entire Blockly AST without having to go in - * and out levels on the tree. - * @param {Blockly.ASTNode} node The current position in the AST. - * @return {Blockly.ASTNode} The previous node in the traversal or null if no - * previous node exists. - * @private - */ -Blockly.BasicCursor.prototype.getPreviousNode_ = function(node) { - if (!node) { - return null; - } - var newNode = node.prev(); - - if (newNode) { - newNode = this.getRightMostChild_(newNode); - } else { - newNode = node.out(); - } - if (this.validNode_(newNode)) { - return newNode; - } else if (newNode) { - return this.getPreviousNode_(newNode); - } - return null; -}; - -/** - * Find the next node in the pre order traversal. - * @return {Blockly.ASTNode} The next node, or null if the current node is - * not set or there is no next value. - * @override - */ -Blockly.BasicCursor.prototype.next = function() { - var curNode = this.getCurNode(); - if (!curNode) { - return null; - } - var newNode = this.getNextNode_(curNode); - - if (newNode) { - this.setCurNode(newNode); - } - return newNode; -}; - -/** - * For a basic cursor we only have the ability to go next and previous, so - * in will also allow the user to get to the next node in the pre order traversal. - * @return {Blockly.ASTNode} The next node, or null if the current node is - * not set or there is no next value. - * @override - */ -Blockly.BasicCursor.prototype.in = function() { - return this.next(); -}; - -/** - * Find the previous node in the pre order traversal. - * @return {Blockly.ASTNode} The previous node, or null if the current node - * is not set or there is no previous value. - * @override - */ -Blockly.BasicCursor.prototype.prev = function() { - var curNode = this.getCurNode(); - if (!curNode) { - return null; - } - var newNode = this.getPreviousNode_(curNode); - - if (newNode) { - this.setCurNode(newNode); - } - return newNode; -}; - -/** - * For a basic cursor we only have the ability to go next and previou, so - * out will allow the user to get to the previous node in the pre order traversal. - * @return {Blockly.ASTNode} The previous node, or null if the current node is - * not set or there is no previous value. - * @override - */ -Blockly.BasicCursor.prototype.out = function() { - return this.prev(); -}; diff --git a/res/lib/blockly/demos/keyboard_nav/icon.png b/res/lib/blockly/demos/keyboard_nav/icon.png deleted file mode 100644 index ff96ab5ca958b55a4d542ba1c19372d6af87a314..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/keyboard_nav/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/keyboard_nav/index.html b/res/lib/blockly/demos/keyboard_nav/index.html deleted file mode 100644 index 4be13c5c8b747f51c1dcab881aaab78e13a1074c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/keyboard_nav/index.html +++ /dev/null @@ -1,566 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Keyboard Navigation</title> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../javascript_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <script src="basic_cursor.js"></script> - <style> - body { - background-color: #fff; - font-family: sans-serif; - } - - h1 { - font-weight: normal; - font-size: 140%; - } - .wrapper { - display: flex; - } - #keyboard_nav { - background-color: #ededed; - border: 1px solid black; - padding: 1em; - } - #keyboard_announce { - font-size: 1.5em; - font-weight: 500; - text-align: center; - } - #keyboard_mappings { - font-size: 1.3em; - font-weight: 400; - } - label { - margin-right: .5em; - min-width: 100px; - } - div[data-actionname] { - display: flex; - width: 100%; - } - select { - font-size: .8em; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Keyboard Navigation</h1> - - <p>Keyboard Navigation is our first step towards an accessible Blockly.<br /> - You can enter accessibility mode by <b>shift clicking anywhere on the - workspace or on a block</b>. <br />Some basic commands for moving around are below. - More complete documentation is still in progress.<br /><br /> - <b>Workspace Navigation</b><br /> - W: Previous block/field/input at the same level<br /> - A: Up one level (Field (or input) -> Block -> Input (or field) -> Block -> - Stack -> Workspace)<br /> - S: Next block/field/input at the same level<br /> - D: Down one level (Workspace -> Stack -> Block -> Input (or field) -> Block - -> Field (or input))<br /> - T: Will open the toolbox. Once in there you can moving around using the WASD keys. And insert a block by hitting Enter<br /> - X: While on a connection hit X to disconnect the block after the cursor<br /><br /> - - <b>Pre Order Traversal</b><br /> - Feel free to just play around in accessibility mode or hit the button below to see the demo. - The demo uses <a href="https://en.wikipedia.org/wiki/Tree_traversal#Pre-order_(NLR)">preorder tree traversal</a> - as an alternative way to navigate the blocks, - connections, and fields on the workspace.<br /><br /> - - <!-- TODO: Update when we add keyboard navigation to site --> - <!-- <p>→ More info on <a href="">Keyboard Navigation</a>.</p> --> - - <b>Cursor</b><br /> - The cursor controls how the user navigates the blocks, inputs, fields and connections on a workspace. - This demo shows two different cursors:<br /> - <b>Default Cursor:</b> Allow the user to go to the previous, next, in or out location.<br /> - <b>Basic Cursor:</b> Using the pre order traversal allows the user to go to the next and previous location. - </p> - - <p> - <label for="accessibilityModeCheck">Enable Accessibility Mode:</label> - <input type="checkbox" onclick="toggleAccessibilityMode(this.checked)" id="accessibilityModeCheck"> - <select id="cursorChanger" name="cursor" onchange="changeCursor(this.value)"> - <option value="default">Default Cursor</option> - <option value="basic">Basic Cursor</option> - </select> - - <button onclick="preOrderDemo()">Start Pre-order Demo</button> - <button onclick="stopDemo()">Stop Pre-order Demo</button> - <label for="displayKeyMappings">Open Key Mappings:</label> - <input type="checkbox" onclick="toggleDisplayKeyMappings(this.checked)" id="displayKeyMappings"> - </p> - - <div class="wrapper"> - <div id="blocklyDiv" style="height: 480px; width: 600px;"></div> - <div id="keyboard_nav" style="display:none"> - <p id="keyboard_announce" aria-live="assertive">Set key mappings below</p> - <form id="keyboard_mappings"></form> - </div> - </div> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <category name="Logic" colour="%{BKY_LOGIC_HUE}"> - <block type="controls_if"></block> - <block type="logic_compare"></block> - <block type="logic_operation"></block> - <block type="logic_negate"></block> - <block type="logic_boolean"></block> - </category> - <category name="Loops" colour="%{BKY_LOOPS_HUE}"> - <block type="controls_repeat_ext"> - <value name="TIMES"> - <block type="math_number"> - <field name="NUM">10</field> - </block> - </value> - </block> - <block type="controls_whileUntil"></block> - </category> - <category name="Math" colour="%{BKY_MATH_HUE}"> - <block type="math_number"> - <field name="NUM">123</field> - </block> - <block type="math_arithmetic"></block> - <block type="math_single"></block> - </category> - <category name="Text" colour="%{BKY_TEXTS_HUE}"> - <block type="text"></block> - <block type="text_length"></block> - <block type="text_print"></block> - </category> - </xml> - - <xml xmlns="https://developers.google.com/blockly/xml" id="startBlocks" style="display: none"> - <variables> - <variable id="~GNXm@Z(wclI]t3zTf.g">list</variable> - <variable id="8]s[S+Gy+%k7HoFup])m">item</variable> - </variables> - <block type="controls_if" x="37" y="162"> - <value name="IF0"> - <block type="logic_compare"> - <field name="OP">EQ</field> - <value name="A"> - <block type="math_arithmetic"> - <field name="OP">ADD</field> - <value name="A"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="B"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - </block> - </value> - <value name="B"> - <block type="math_single"> - <field name="OP">ROOT</field> - <value name="NUM"> - <shadow type="math_number"> - <field name="NUM">9</field> - </shadow> - <block type="math_number"> - <field name="NUM">123</field> - </block> - </value> - </block> - </value> - </block> - </value> - <statement name="DO0"> - <block type="lists_setIndex"> - <mutation at="true"></mutation> - <field name="MODE">SET</field> - <field name="WHERE">FROM_START</field> - <value name="LIST"> - <block type="variables_get"> - <field name="VAR" id="~GNXm@Z(wclI]t3zTf.g">list</field> - </block> - </value> - <next> - <block type="text_append"> - <field name="VAR" id="8]s[S+Gy+%k7HoFup])m">item</field> - <value name="TEXT"> - <shadow type="text"> - <field name="TEXT"></field> - </shadow> - </value> - </block> - </next> - </block> - </statement> - <next> - <block type="controls_repeat_ext"> - <value name="TIMES"> - <shadow type="math_number"> - <field name="NUM">10</field> - </shadow> - </value> - </block> - </next> - </block> - </xml> - - <script> - var demoWorkspace = Blockly.inject('blocklyDiv', - {media: '../../media/', - toolbox: document.getElementById('toolbox')}); - Blockly.Xml.domToWorkspace(document.getElementById('startBlocks'), - demoWorkspace); - var timeout; - - var actions = [ - Blockly.navigation.ACTION_PREVIOUS, - Blockly.navigation.ACTION_OUT, - Blockly.navigation.ACTION_NEXT, - Blockly.navigation.ACTION_IN, - Blockly.navigation.ACTION_INSERT, - Blockly.navigation.ACTION_MARK, - Blockly.navigation.ACTION_DISCONNECT, - Blockly.navigation.ACTION_TOOLBOX, - Blockly.navigation.ACTION_EXIT - ]; - createKeyMappingList(actions); - - /** - * Shows the next node in the tree traversal every second. - * @package - */ - function demo() { - var doNext = function() { - var node = Blockly.getMainWorkspace().getCursor().next(); - if (node) { - timeout = setTimeout(doNext, 1000); - } - } - doNext(); - } - - /** - * Stop the running demo. - * @package - */ - function stopDemo() { - clearTimeout(timeout); - document.getElementById('accessibilityModeCheck').disabled = false; - }; - - /** - * Sets up accessibility mode and change the cursor to basic cursor so that - * the demo can successfully run. - * @package - */ - function preOrderDemo() { - changeCursor('basic'); - document.getElementById('accessibilityModeCheck').disabled = true; - setTimeout(demo, 1000); - } - - /** - * Turn on/off accessibility mode depending on the state. - * @param {boolean} state True to turn on accessibility mode, false otherwise. - * @package - */ - function toggleAccessibilityMode(state) { - if (state) { - Blockly.navigation.enableKeyboardAccessibility(); - } else { - Blockly.navigation.disableKeyboardAccessibility(); - } - } - - /** - * Change the type of the cursor and set to the location of the old cursor. - * Changing the cursor changes how a user navigates the blocks on the workspace. - * @param {string} cursorType The type of the cursor. - * @package - */ - function changeCursor(cursorType) { - Blockly.navigation.enableKeyboardAccessibility(); - document.getElementById('accessibilityModeCheck').checked = true; - document.getElementById('cursorChanger').value = cursorType; - var oldCurNode = Blockly.getMainWorkspace().getCursor().getCurNode(); - - if (cursorType === "basic") { - Blockly.getMainWorkspace().setCursor(new Blockly.BasicCursor()); - } else { - Blockly.getMainWorkspace().setCursor(new Blockly.Cursor()); - } - if (oldCurNode) { - Blockly.getMainWorkspace().getCursor().setCurNode(oldCurNode); - } - document.activeElement.blur(); - } - - // Start key mapping demo functions - - /** - * Save the current key map in session storage. - * @package - */ - function saveKeyMap() { - var currentMap = Blockly.user.keyMap.getKeyMap(); - if (sessionStorage) { - sessionStorage.setItem('keyMap', JSON.stringify(currentMap)); - } - } - - /** - * Set the key map to the map from session storage. - * @package - */ - function restoreKeyMap() { - var defaultMap = Blockly.user.keyMap.map_; - var stringifiedMap = sessionStorage.getItem('keyMap'); - var restoredMap = {}; - if (sessionStorage && stringifiedMap) { - var keyMap = JSON.parse(stringifiedMap); - var keys = Object.keys(keyMap); - for (var i = 0, key; key = keys[i]; i++) { - restoredMap[key] = Object.assign(new Blockly.Action, keyMap[key]); - } - Blockly.user.keyMap.setKeyMap(restoredMap); - } - } - - /** - * Given the three dropdowns create the serialized key that will be stored - * in the key map. - * @param {Array.<Element>} selectDivs The three dropdown divs that display - * the key combination. - * @package - */ - function serializeKey(selectDivs) { - var modifiers = Blockly.utils.object.values(Blockly.user.keyMap.modifierKeys); - var newModifiers = []; - var newKeyCode = ''; - var keyValue = selectDivs[2].value; - - // Get the new modifiers from the first two dropdowns. - for (var i = 0; i < 2; i++) { - var selectDiv = selectDivs[i]; - var key = selectDiv.value; - if (key !== 'None') { - newModifiers.push(key); - } - } - // Get the key code from the last dropdown. - if (keyValue !== 'None') { - if (keyValue === 'Escape') { - newKeyCode = Blockly.utils.KeyCodes.ESC; - } else if (keyValue === 'Enter') { - newKeyCode = Blockly.utils.KeyCodes.ENTER; - } else { - newKeyCode = keyValue.toUpperCase().charCodeAt(0); - } - } - return Blockly.user.keyMap.createSerializedKey(newKeyCode, newModifiers); - } - - /** - * Set all dropdowns for that action to none. - * We clear dropdowns when a user chooses the same key combination for a - * second action. - * @param {Blockly.Action} action The action that we want to clear the - * dropdowns for. - * @package - */ - function clearDropdown(action) { - var actionDiv = document.querySelectorAll('[data-actionname='+ action.name +']')[0]; - var selectDivs = actionDiv.getElementsByTagName('select'); - for (var i = 0, selectDiv; selectDiv = selectDivs[i]; i++) { - selectDiv.value = 'None'; - } - } - - /** - * Given the three dropdowns create a human readable string so the screen reader - * can read it out. - * @param {Array.<Element>} selectDivs The three dropdown divs that display - * the key combination. - * @package - */ - function getReadableKey(selectDivs) { - var readableKey = ''; - - for (var i = 0, selectDiv; selectDiv = selectDivs[i]; i++) { - if (selectDiv.value !== 'None') { - readableKey += selectDiv.value + ' '; - } - } - return readableKey; - } - - /** - * Update the key in the key map when the user selects a new value in one of the - * dropdowns. - * @param {Event} e The event dispatched from changing a dropdown. - * @package - */ - function updateKey(e) { - var keyboardAnnouncerText = ''; - var actionDiv = e.srcElement.parentElement; - var action = actionDiv.action; - var selectDivs = actionDiv.getElementsByTagName('select'); - var key = serializeKey(selectDivs); - var oldAction = Blockly.user.keyMap.getActionByKeyCode(key); - - if (oldAction) { - keyboardAnnouncerText += oldAction.name + ' action key was overwritten. \n'; - clearDropdown(oldAction); - } - keyboardAnnouncerText += action.name + ' key was set to ' + getReadableKey(selectDivs); - document.getElementById('keyboard_announce').innerText = keyboardAnnouncerText; - Blockly.user.keyMap.setActionForKey(key, action); - saveKeyMap(); - document.activeElement.blur(); - } - - /** - * Set the key to be the correct value from the key map. - * @param {string} actionKey The serialized key for a given action. - * @param {Element} keyDropdown The dropdown that displays the primary key. - * @package - */ - function setKeyDropdown(actionKey, keyDropdown) { - // Strip off any modifier to just get the key code. - var keyCode = actionKey.match(/\d+/)[0]; - var keyValue = String.fromCharCode(keyCode); - if (parseInt(keyCode) === Blockly.utils.KeyCodes.ESC) { - keyValue = 'Escape'; - } else if (parseInt(keyCode) === Blockly.utils.KeyCodes.ENTER) { - keyValue = 'Enter'; - } - keyDropdown.value = keyValue; - } - - /** - * Set the modifiers to be the correct value from the key map. - * @param {string} actionKey The key code holding the modifiers and key. - * @param {Array.<Element>} modifierDropdowns A list of dropdowns for - * the modifier values. - * @package - */ - function setModifiers(actionKey, modifierDropdowns) { - var modifiers = Blockly.utils.object.values(Blockly.user.keyMap.modifierKeys); - for (var i = 0; i < 2; i++) { - var modifierDropdown = modifierDropdowns[i]; - for (var j = 0, modifier; modifier = modifiers[j]; j++) { - if (actionKey.indexOf(modifier) > -1) { - modifierDropdown.value = modifier; - actionKey = actionKey.replace(modifier, ''); - break; - } - } - } - } - - /** - * Set the dropdowns to display the correct combination of modifiers and - * keys for the action key. - * @param {Blockly.Action} action The Blockly action. - * @param {Element} actionDiv The div holding the dropdowns and label for the - * given action. - * @param {string} actionKey The key corresponding to the given action. - * @package - */ - function setDropdowns(action, actionDiv, actionKey) { - var selectDivs = actionDiv.getElementsByTagName('select'); - if (actionKey) { - setModifiers(actionKey, selectDivs); - setKeyDropdown(actionKey, selectDivs[selectDivs.length - 1]); - } else { - clearDropdown(action); - } - } - - /** - * Create a dropdown with the given list of possible keys. - * @param {Blockly.Action} action The Blockly action. - * @param {Element} actionDiv The div holding the dropdowns and labels for - * a given action. - * @param {Array.<string>} keys The list of keys to add to the dropdown. - * @package - */ - function createDropdown(action, actionDiv, keys) { - var select = document.createElement('select'); - select.addEventListener('change', updateKey); - select.setAttribute('aria-labelledby', action.name + '_label'); - for (var i = 0, key; key = keys[i]; i++) { - select.options.add(new Option(key, key)); - } - actionDiv.appendChild(select); - } - - /** - * Create two dropdowns that display possible modifiers and a single dropdown - * displaying a list of keys. - * @param {Blockly.Action} action The Blockly action. - * @param {string} actionKey The key corresponding to the given action. - * @param {Element} actionDiv The div holding the dropdowns and label for the - * given action. - * @package - */ - function createDropdowns(action, actionKey, actionDiv) { - var modifiers = ['None'].concat(Blockly.utils.object.values(Blockly.user.keyMap.modifierKeys)); - var keys = ['None', 'Enter', 'Escape'].concat("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".split('')); - createDropdown(action, actionDiv, modifiers); - createDropdown(action, actionDiv, modifiers); - createDropdown(action, actionDiv, keys); - setDropdowns(action, actionDiv, actionKey); - } - - /** - * For each action create a row of 3 dropdowns and an action label. Update - * the dropdowns to reflect the value in the key map. - * @param {Array.<Blockly.Action>} actions List of blockly actions. - * @package - */ - function createKeyMappingList(actions) { - // Update the key map to reflect the key map saved in session storage. - restoreKeyMap(); - var keyMapDiv = document.getElementById('keyboard_mappings'); - for (var i = 0, action; action = actions[i]; i++) { - var actionDiv = document.createElement('div'); - actionDiv.setAttribute('data-actionname', action.name); - actionDiv.action = action; - - var labelDiv = document.createElement('label'); - labelDiv.innerText = action.name; - labelDiv.setAttribute('id', action.name + '_label'); - - actionDiv.appendChild(labelDiv); - keyMapDiv.appendChild(actionDiv); - - var actionKey = Blockly.user.keyMap.getKeyByAction(action); - createDropdowns(action, actionKey, actionDiv); - } - } - - /** - * Hide/show the key map panel. - * @param {boolean} state The state of the checkbox. True if checked, false - * otherwise. - * @package - */ - function toggleDisplayKeyMappings(state) { - if (state) { - document.getElementById('keyboard_nav').style.display = 'block'; - } else { - document.getElementById('keyboard_nav').style.display = 'none'; - } - } - // End key mapping demo functions - - </script> - -</body> -</html> diff --git a/res/lib/blockly/demos/maxBlocks/icon.png b/res/lib/blockly/demos/maxBlocks/icon.png deleted file mode 100644 index b90c79615013a248f06deff22ceb89516657ab6b..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/maxBlocks/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/maxBlocks/index.html b/res/lib/blockly/demos/maxBlocks/index.html deleted file mode 100644 index dc94f2f452875267022873bf6cd80271eb7f7855..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/maxBlocks/index.html +++ /dev/null @@ -1,100 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Maximum Block Limit</title> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <style> - body { - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - #capacity { - color: red; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Maximum Block Limit</h1> - - <p>This is a demo of Blockly which has been restricted to a maximum of - five blocks.</p> - - <p><b>You have <span id="capacity"></span> block(s) left.</b></p> - - <div id="blocklyDiv" style="height: 480px; width: 600px;"></div> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <category name="Logic" colour="%{BKY_LOGIC_HUE}"> - <block type="controls_if"></block> - <block type="logic_compare"></block> - <block type="logic_operation"></block> - <block type="logic_negate"></block> - <block type="logic_boolean"></block> - </category> - <category name="Loops" colour="%{BKY_LOOPS_HUE}"> - <block type="controls_repeat_ext"> - <value name="TIMES"> - <block type="math_number"> - <field name="NUM">10</field> - </block> - </value> - </block> - <block type="controls_whileUntil"></block> - <block type="controls_for"> - <field name="VAR">i</field> - <value name="FROM"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - <value name="TO"> - <block type="math_number"> - <field name="NUM">10</field> - </block> - </value> - <value name="BY"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - </block> - </category> - <category name="Math" colour="%{BKY_MATH_HUE}"> - <block type="math_number"> - <field name="NUM">123</field> - </block> - <block type="math_arithmetic"></block> - <block type="math_single"></block> - </category> - <category name="Text" colour="%{BKY_TEXTS_HUE}"> - <block type="text"></block> - <block type="text_length"></block> - <block type="text_print"></block> - </category> - </xml> - - <script> - var demoWorkspace = Blockly.inject('blocklyDiv', - {media: '../../media/', - maxBlocks: 5, - toolbox: document.getElementById('toolbox')}); - - function onchange(event) { - document.getElementById('capacity').textContent = - demoWorkspace.remainingCapacity(); - } - - demoWorkspace.addChangeListener(onchange); - onchange(); - </script> - -</body> -</html> diff --git a/res/lib/blockly/demos/minimap/icon.png b/res/lib/blockly/demos/minimap/icon.png deleted file mode 100644 index 870caa070d8e4a9f1a295cad8c4570d8132694cf..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/minimap/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/minimap/index.html b/res/lib/blockly/demos/minimap/index.html deleted file mode 100644 index 2f4e163e9661bf58b212b1c2fa475c1ce907d16c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/minimap/index.html +++ /dev/null @@ -1,91 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Minimap</title> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <script src="minimap.js"></script> - <style> - body { - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Minimap</h1> - - <p>This is a simple demo showing how a minimap can be implemented.</p> - - <table width="100%"> - <tr> - <td> - <div id="masterDiv" style="height: 480px; width: 900px;"></div> - </td> - <td> - <div id="mapDiv" style="height: 480px; width: 200px;"></div> - </td> - </tr> - </table> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <block type="controls_if"></block> - <block type="logic_compare"></block> - <block type="controls_repeat_ext"></block> - <block type="math_number"> - <field name="NUM">123</field> - </block> - <block type="math_arithmetic"></block> - <block type="text"></block> - <block type="text_print"></block> - <block type="variables_get"><field name="VAR">i</field></block> - <block type="variables_get"><field name="VAR">j</field></block> - <block type="variables_get"><field name="VAR">k</field></block> - </xml> - - <script> - // Inject master workspace. - var masterWorkspace = Blockly.inject('masterDiv', { - media: '../../media/', - scrollbars: true, - toolbox: document.getElementById('toolbox') - }); - - // Inject workspace for minimap. - var minimapWorkspace = Blockly.inject('mapDiv', { - media: '../../media/', - readOnly: true, - zoom: { - controls: false, - wheel: true, - startScale: 0.1, // Change this according to your needs. - maxScale: 0.1, - minScale: 0.01 - } - }); - - // Initialize the minimap. - Minimap.init(masterWorkspace,minimapWorkspace); - </script> - <style> - .minimap{ - position: absolute; - } - .mapDragger{ - cursor: move; - fill: rgb(0,0,255); - stroke-width: .5; - stroke: rgb(0,0,0); - fill-opacity: .1; - } - </style> - -</body> -</html> diff --git a/res/lib/blockly/demos/minimap/minimap.js b/res/lib/blockly/demos/minimap/minimap.js deleted file mode 100644 index 05e00bb7ac85d98dfafb67516ab95161fbb3ee6b..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/minimap/minimap.js +++ /dev/null @@ -1,312 +0,0 @@ -/** - - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview JavaScript for Blockly's Minimap demo. - * @author karnpurohit@gmail.com (Karan Purohit) - */ -'use strict'; - -/** - * Creating a separate namespace for minimap. - */ -var Minimap = {}; - -/** - * Initialize the workspace and minimap. - * @param {!Workspace} workspace The main workspace of the user. - * @param {!Workspace} minimap The workspace that will be used as a minimap. - */ -Minimap.init = function(workspace, minimap) { - this.workspace = workspace; - this.minimap = minimap; - - // Adding scroll callback functionality to vScroll and hScroll just for this demo. - // IMPORTANT: This should be changed when there is proper UI event handling - // API available and should be handled by workspace's event listeners. - this.workspace.scrollbar.vScroll.setHandlePosition = function(newPosition) { - this.handlePosition_ = newPosition; - this.svgHandle_.setAttribute(this.positionAttribute_, this.handlePosition_); - - // Code above is same as the original setHandlePosition function in core/scrollbar.js. - // New code starts from here. - - // Get the absolutePosition. - var absolutePosition = (this.handlePosition_ / this.ratio_); - - // Firing the scroll change listener. - Minimap.onScrollChange(absolutePosition, this.horizontal_); - }; - - // Adding call back for horizontal scroll. - this.workspace.scrollbar.hScroll.setHandlePosition = function(newPosition) { - this.handlePosition_ = newPosition; - this.svgHandle_.setAttribute(this.positionAttribute_, this.handlePosition_); - - // Code above is same as the original setHandlePosition function in core/scrollbar.js. - // New code starts from here. - - // Get the absolutePosition. - var absolutePosition = (this.handlePosition_ / this.ratio_); - - // Firing the scroll change listener. - Minimap.onScrollChange(absolutePosition, this.horizontal_); - }; - - - // Required to stop a positive feedback loop when user clicks minimap - // and the scroll changes, which in turn may change minimap. - this.disableScrollChange = false; - - // Listen to events on the main workspace. - this.workspace.addChangeListener(Minimap.mirrorEvent); - - //Get rectangle bounding the minimap div. - this.rect = document.getElementById('mapDiv').getBoundingClientRect(); - - // Create a svg overlay on the top of mapDiv for the minimap. - this.svg = Blockly.utils.dom.createSvgElement('svg', { - 'xmlns': Blockly.utils.dom.SVG_NS, - 'xmlns:html': Blockly.utils.dom.HTML_NS, - 'xmlns:xlink': Blockly.utils.dom.XLINK_NS, - 'version': '1.1', - 'height': this.rect.bottom-this.rect.top, - 'width': this.rect.right-this.rect.left, - 'class': 'minimap', - }, document.getElementById('mapDiv')); - this.svg.style.top = this.rect.top + 'px'; - this.svg.style.left = this.rect.left + 'px'; - - // Creating a rectangle in the minimap that represents current view. - Blockly.utils.dom.createSvgElement('rect', { - 'width': 100, - 'height': 100, - 'class': 'mapDragger' - }, this.svg); - - // Rectangle in the minimap that represents current view. - this.mapDragger = this.svg.childNodes[0]; - - // Adding mouse events to the rectangle, to make it Draggable. - // Using Blockly.bindEvent_ to attach mouse/touch listeners. - Blockly.bindEvent_(this.mapDragger, 'mousedown', null, Minimap.mousedown); - - //When the window change, we need to resize the minimap window. - window.addEventListener('resize', Minimap.repositionMinimap); - - // Mouse up event for the minimap. - this.svg.addEventListener('mouseup', Minimap.updateMapDragger); - - //Boolean to check whether I am dragging the surface or not. - this.isDragging = false; -}; - -Minimap.mousedown = function(e) { - // Using Blockly.bindEvent_ to attach mouse/touch listeners. - Minimap.mouseMoveBindData = - Blockly.bindEvent_(document, 'mousemove', null, Minimap.mousemove); - Minimap.mouseUpBindData = - Blockly.bindEvent_(document, 'mouseup', null, Minimap.mouseup); - - Minimap.isDragging = true; - e.stopPropagation(); -}; - -Minimap.mouseup = function(e) { - Minimap.isDragging = false; - // Removing listeners. - Blockly.unbindEvent_(Minimap.mouseUpBindData); - Blockly.unbindEvent_(Minimap.mouseMoveBindData); - Minimap.updateMapDragger(e); - e.stopPropagation(); -}; - -Minimap.mousemove = function(e) { - if (Minimap.isDragging) { - Minimap.updateMapDragger(e); - e.stopPropagation(); - } -}; - -/** - * Run non-UI events from the main workspace on the minimap. - * @param {!Event} event Event that triggered in the main workspace. - */ -Minimap.mirrorEvent = function(event) { - if (event.type == Blockly.Events.UI) { - return; // Don't mirror UI events. - } - // Convert event to JSON. This could then be transmitted across the net. - var json = event.toJson(); - // Convert JSON back into an event, then execute it. - var minimapEvent = Blockly.Events.fromJson(json, Minimap.minimap); - minimapEvent.run(true); - Minimap.scaleMinimap(); - Minimap.setDraggerHeight(); - Minimap.setDraggerWidth(); -}; - -/** - * Called when window is resized. Repositions the minimap overlay. - */ -Minimap.repositionMinimap = function() { - Minimap.rect = document.getElementById('mapDiv').getBoundingClientRect(); - Minimap.svg.style.top = Minimap.rect.top + 'px'; - Minimap.svg.style.left = Minimap.rect.left + 'px'; -}; - -/** - * Updates the rectangle's height. - */ -Minimap.setDraggerHeight = function() { - var workspaceMetrics = Minimap.workspace.getMetrics(); - var draggerHeight = (workspaceMetrics.viewHeight / Minimap.workspace.scale) * - Minimap.minimap.scale; - // It's zero when first block is placed. - if (draggerHeight == 0) { - return; - } - Minimap.mapDragger.setAttribute('height', draggerHeight); -}; - -/** - * Updates the rectangle's width. - */ -Minimap.setDraggerWidth = function() { - var workspaceMetrics = Minimap.workspace.getMetrics(); - var draggerWidth = (workspaceMetrics.viewWidth / Minimap.workspace.scale) * - Minimap.minimap.scale; - // It's zero when first block is placed. - if (draggerWidth == 0) { - return; - } - Minimap.mapDragger.setAttribute('width', draggerWidth); -}; - - -/** - * Updates the overall position of the viewport of the minimap by appropriately - * using translate functions. - */ -Minimap.scaleMinimap = function() { - var minimapBoundingBox = Minimap.minimap.getBlocksBoundingBox(); - var workspaceBoundingBox = Minimap.workspace.getBlocksBoundingBox(); - var workspaceMetrics = Minimap.workspace.getMetrics(); - var minimapMetrics = Minimap.minimap.getMetrics(); - - // Scaling the mimimap such that all the blocks can be seen in the viewport. - // This padding is default because this is how to scrollbar(in main workspace) - // is implemented. - var topPadding = (workspaceMetrics.viewHeight) * Minimap.minimap.scale / - (2 * Minimap.workspace.scale); - var sidePadding = (workspaceMetrics.viewWidth) * Minimap.minimap.scale / - (2 * Minimap.workspace.scale); - - // If actual padding is more than half view ports height, - // change it to actual padding. - if ((workspaceBoundingBox.y * Minimap.workspace.scale - - workspaceMetrics.contentTop) * - Minimap.minimap.scale / Minimap.workspace.scale > topPadding) { - topPadding = (workspaceBoundingBox.y * Minimap.workspace.scale - - workspaceMetrics.contentTop) * - Minimap.minimap.scale / Minimap.workspace.scale; - } - - // If actual padding is more than half view ports height, - // change it to actual padding. - if ((workspaceBoundingBox.x * Minimap.workspace.scale - - workspaceMetrics.contentLeft) * - Minimap.minimap.scale / Minimap.workspace.scale > sidePadding) { - sidePadding = (workspaceBoundingBox.x * Minimap.workspace.scale - - workspaceMetrics.contentLeft) * - Minimap.minimap.scale / Minimap.workspace.scale; - } - - var scalex = (minimapMetrics.viewWidth - 2 * sidePadding) / - minimapBoundingBox.width; - var scaley = (minimapMetrics.viewHeight - 2 * topPadding) / - minimapBoundingBox.height; - Minimap.minimap.setScale(Math.min(scalex, scaley)); - - // Translating the minimap. - Minimap.minimap.translate( - -minimapMetrics.contentLeft * Minimap.minimap.scale + sidePadding, - -minimapMetrics.contentTop * Minimap.minimap.scale + topPadding); -}; - -/** - * Handles the onclick event on the minimapBoundingBox. - * Changes mapDraggers position. - * @param {!Event} e Event from the mouse click. - */ -Minimap.updateMapDragger = function(e) { - var y = e.clientY; - var x = e.clientX; - var draggerHeight = Minimap.mapDragger.getAttribute('height'); - var draggerWidth = Minimap.mapDragger.getAttribute('width'); - - var finalY = y - Minimap.rect.top - draggerHeight / 2; - var finalX = x - Minimap.rect.left - draggerWidth / 2; - - var maxValidY = (Minimap.workspace.getMetrics().contentHeight - - Minimap.workspace.getMetrics().viewHeight) * Minimap.minimap.scale; - var maxValidX = (Minimap.workspace.getMetrics().contentWidth - - Minimap.workspace.getMetrics().viewWidth) * Minimap.minimap.scale; - - if (y + draggerHeight / 2 > Minimap.rect.bottom) { - finalY = Minimap.rect.bottom - Minimap.rect.top - draggerHeight; - } else if (y < Minimap.rect.top + draggerHeight / 2) { - finalY = 0; - } - - if (x + draggerWidth / 2 > Minimap.rect.right) { - finalX = Minimap.rect.right - Minimap.rect.left - draggerWidth; - } else if (x < Minimap.rect.left + draggerWidth / 2) { - finalX = 0; - } - - // Do not go below lower bound of scrollbar. - if (finalY > maxValidY) { - finalY = maxValidY; - } - if (finalX > maxValidX) { - finalX = maxValidX; - } - Minimap.mapDragger.setAttribute('y', finalY); - Minimap.mapDragger.setAttribute('x', finalX); - // Required, otherwise creates a feedback loop. - Minimap.disableScrollChange = true; - Minimap.workspace.scrollbar.vScroll.set((finalY * Minimap.workspace.scale) / - Minimap.minimap.scale); - Minimap.workspace.scrollbar.hScroll.set((finalX * Minimap.workspace.scale) / - Minimap.minimap.scale); - Minimap.disableScrollChange = false; -}; - -/** - * Handles the onclick event on the minimapBoundingBox, parameters are passed by - * the event handler. - * @param {number} position This is the absolute position of the scrollbar. - * @param {boolean} horizontal Informs if the change event if for - * horizontal (true) or vertical (false) scrollbar. - */ -Minimap.onScrollChange = function(position, horizontal) { - if (!Minimap.disableScrollChange) { - Minimap.mapDragger.setAttribute(horizontal ? 'x' : 'y', - position * Minimap.minimap.scale / Minimap.workspace.scale); - } -}; diff --git a/res/lib/blockly/demos/mirror/icon.png b/res/lib/blockly/demos/mirror/icon.png deleted file mode 100644 index 45e2a9a290cd7378b3c933f5e5e9e1dbf0df4a16..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/mirror/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/mirror/index.html b/res/lib/blockly/demos/mirror/index.html deleted file mode 100644 index 10c23df029ee6398f1b07277fd0b3f3009351ff4..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mirror/index.html +++ /dev/null @@ -1,81 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Mirrored Blockly</title> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <style> - body { - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Mirrored Blockly</h1> - - <p>This is a simple demo of a primary Blockly instance that controls a secondary Blockly instance with events. - Open the JavaScript console to see the event passing.</p> - - <p>→ More info on <a href="https://developers.google.com/blockly/guides/configure/web/events">events</a>…</p> - - <table width="100%"> - <tr> - <td> - <div id="primaryDiv" style="height: 480px; width: 600px;"></div> - </td> - <td> - <div id="secondaryDiv" style="height: 480px; width: 430px;"></div> - </td> - </tr> - </table> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <block type="controls_if"></block> - <block type="logic_compare"></block> - <block type="controls_repeat_ext"></block> - <block type="math_number"> - <field name="NUM">123</field> - </block> - <block type="math_arithmetic"></block> - <block type="text"></block> - <block type="text_print"></block> - <block type="variables_get"><field name="VAR">i</field></block> - <block type="variables_get"><field name="VAR">j</field></block> - <block type="variables_get"><field name="VAR">k</field></block> - </xml> - - <script> - // Inject primary workspace. - var primaryWorkspace = Blockly.inject('primaryDiv', - {media: '../../media/', - toolbox: document.getElementById('toolbox')}); - // Inject secondary workspace. - var secondaryWorkspace = Blockly.inject('secondaryDiv', - {media: '../../media/', - readOnly: true}); - // Listen to events on primary workspace. - primaryWorkspace.addChangeListener(mirrorEvent); - - function mirrorEvent(primaryEvent) { - if (primaryEvent.type == Blockly.Events.UI) { - return; // Don't mirror UI events. - } - // Convert event to JSON. This could then be transmitted across the net. - var json = primaryEvent.toJson(); - console.log(json); - // Convert JSON back into an event, then execute it. - var secondaryEvent = Blockly.Events.fromJson(json, secondaryWorkspace); - secondaryEvent.run(true); - } -</script> - -</body> -</html> diff --git a/res/lib/blockly/demos/mobile/README.md b/res/lib/blockly/demos/mobile/README.md deleted file mode 100644 index bab09606b5f730c1b84ea32a162837c4afca06ab..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# Blockly on Mobile Devices - -This directory contains three examples of running the Blockly library on mobile -devices. The `html/` directory is a example of configuring a webpage for touch -devices, with a Blockly workspace that fills the screen. - -The `mobile/html/` is also the basis for the Android and iOS demos. Each native -app copies this demo into the app's local resources, and required Blockly -library files, and hosts them in an embedded WebView. - -Thus, developers can quickly iterate within the `mobile/html/` directory, and -see changes in both the Android and iOS native apps. - -## Running the Mobile HTML Demo - -Before running the mobile HTML demo, you need to create some symbolic links -in your local file system. Run the `mobile/html/ln_resources.sh` file from -the `mobile/html/` directory. This mimicks the relative locations of the -Blockly files seen when loading the page in a native app's embedded WebView. - -After doing this, opening `mobile/html/index.html` should open normally, -filling the page with one large Blockly workspace. - -## The Android App - -### Build and Run - -Open the `demos/mobile/android/` directory in Android Studio. The project -files in the directory should be ready to build and run the demo in an emulator -or connected device. - -### Android Copy Tasks - -If you edit the `mobile/html/` demo to include new files, you will need to -update the native app project files to also copy those files. - -In the Android project, two Gradle tasks are responsible for the copies. -In `mobile/android/app/build.gradle`, the tasks `copyBlocklyHtmlFile` and -`copyBlocklyMoreFiles` configure the copy actions. - -## The iOS App - -### Build and Run - -Open the `demos/mobile/iOS/` directory in XCode. The project files in the -directory should be ready to build and run the demo in a simulator or connected -device. - -### iOS Copy Script - -The XCode project call out to `mobile/ios/cp_resources.sh` to copy the required -HTML and related files. If you've edited the `mobile/html/` demo to require new -files, update this script to copy these files, too. diff --git a/res/lib/blockly/demos/mobile/android/.gitignore b/res/lib/blockly/demos/mobile/android/.gitignore deleted file mode 100644 index 3ba2b2b61bdb87b65a1a19307d7579502412c0fc..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -/build -/captures -/app/src/main/assets/blockly -.settings -.project - -# Local Settings -local.properties - -# Project files -*.komodoproject -.gradle -*.iml -.idea - -# Build files -*.pyc -*.apk -*.ap_ -*.class -*.dex - -# OSX Files -.DS_Store - -# Windows Files -Thumb.db diff --git a/res/lib/blockly/demos/mobile/android/README.md b/res/lib/blockly/demos/mobile/android/README.md deleted file mode 100644 index 31f968feab47b22c595612e198885cb88917cfd9..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# Blockly in an Android WebView - -This code demonstrates how to get Blockly running in an Android app by -embedding it in a WebView. - -### BlocklyWebViewFragment - -Most of the work is done within the fragment class `BlocklyWebViewFragment`. -This fragment instantiates the WebView, loads the HTML -(`assets/blockly/webview.html`, copied from `demos/mobile/html/index.html`), -and provides a few helper methods. - -### Copying web assets with gradle - -This android project copies the necessary files from the main Blockly -repository (i.e., parent directory). In `app/build.gradle`, note the -`copyBlocklyHtmlFile` and `copyBlocklyMoreFiles` tasks. - -In your own project, the HTML and related files can be placed directly in the -`assets/blockly` directory without the copy step. However, using the copy tasks -simplifies the synchronization with an iOS app using the same files. - -### Loading Block Definitions and Generator functions - -The `webview.html` loads the block definitions and generator functions directly -into the page, without support or coordination with the Android classes. This -assumes the app will always utilize the same blocks. This does not mean all -blocks are visible to the user all the time; that is controlled by the toolbox -and workspace files. This should accommodate almost all applications. - -This does mean loading your own block definitions and generators will involve -editing the HTML, adding you own `<script>` tag, and possibly removing -the `blocks_compressed.js` if you do not use any standard blocks. - -### Connecting a Developer Console - -While the console output of the WebView will be visible in the Android log -(i.e., `logcat`), some times a more intrusive approach is required to isolate -a problem. For instructions on connecting the WebView to Chrome's Developer -Tools, see this article: - - https://developers.google.com/web/tools/chrome-devtools/remote-debugging/ - -The WebView must be visible in the connect device or emulator before the -WebView will included in the list of available pages to connect to. \ No newline at end of file diff --git a/res/lib/blockly/demos/mobile/android/app/.gitignore b/res/lib/blockly/demos/mobile/android/app/.gitignore deleted file mode 100644 index 8a24dfadbc86a221cd24de11bab720223c9a2239..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/build - -# Files copied during build: -src/main/assets/blockly/blockly_compressed.js -src/main/assets/blockly/blocks_compressed.js -src/main/assets/blockly/media -src/main/assets/blockly/webview.html diff --git a/res/lib/blockly/demos/mobile/android/app/build.gradle b/res/lib/blockly/demos/mobile/android/app/build.gradle deleted file mode 100644 index f21403dc91df64e91c486ed0c7ad0e38cd9350c3..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/build.gradle +++ /dev/null @@ -1,50 +0,0 @@ -apply plugin: 'com.android.application' - -android { - compileSdkVersion 27 - defaultConfig { - applicationId 'com.google.blockly.android.webview.demo' - minSdkVersion 19 - targetSdkVersion 27 - versionCode 1 - versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - productFlavors { - } -} - -task copyBlocklyHtmlFile(type: Copy) { - from('../../html') { - include 'index.html', 'toolbox_standard.js' - } - into project(':app').file('./src/main/assets/blockly') - rename('index.html', 'webview.html') -} - -task copyBlocklyMoreFiles(type: Copy) { - from('../../../..') { - include 'blockly_compressed.js', 'blocks_compressed.js', 'msg/js/**', 'media/**' - exclude 'media/test_*' - } - into project(':app').file('./src/main/assets/blockly') -} - -project.afterEvaluate { - preBuild.dependsOn(copyBlocklyHtmlFile, copyBlocklyMoreFiles) -} - -dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.android.support:appcompat-v7:27.1.1' - implementation 'com.android.support.constraint:constraint-layout:1.1.3' - testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' -} diff --git a/res/lib/blockly/demos/mobile/android/app/proguard-rules.pro b/res/lib/blockly/demos/mobile/android/app/proguard-rules.pro deleted file mode 100644 index f1b424510da51fd82143bc74a0a801ae5a1e2fcd..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/res/lib/blockly/demos/mobile/android/app/src/androidTest/java/com/example/blocklywebview/ExampleInstrumentedTest.java b/res/lib/blockly/demos/mobile/android/app/src/androidTest/java/com/example/blocklywebview/ExampleInstrumentedTest.java deleted file mode 100644 index 5875566324c89d73c0bcc448e8c86b3db4315c1a..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/androidTest/java/com/example/blocklywebview/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.blocklywebview; - -import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getTargetContext(); - - assertEquals("com.example.blocklywebview", appContext.getPackageName()); - } -} diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/AndroidManifest.xml b/res/lib/blockly/demos/mobile/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index 1531ff2dd73319800f30407b040225c5dbdb3467..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.blocklywebview"> - - <application - android:allowBackup="true" - android:icon="@mipmap/ic_launcher" - android:label="@string/app_name" - android:roundIcon="@mipmap/ic_launcher_round" - android:supportsRtl="true" - android:theme="@style/AppTheme"> - <activity android:name="com.google.blockly.android.webview.demo.MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - </activity> - </application> - -</manifest> \ No newline at end of file diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/BlocklyWebViewFragment.java b/res/lib/blockly/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/BlocklyWebViewFragment.java deleted file mode 100644 index e4f6f763f8209c92dee65e0f277d8fc1aaeb455a..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/BlocklyWebViewFragment.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.google.blockly.android.webview; - -import android.annotation.SuppressLint; -import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.webkit.WebSettings; -import android.webkit.WebView; - -/** - * This fragments contains and manages the web view that hosts Blockly. - */ -public class BlocklyWebViewFragment extends Fragment { - protected @Nullable WebView mWebView = null; - - @SuppressLint("SetJavaScriptEnabled") - @Nullable - @Override - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, - @Nullable Bundle savedInstanceState) { - mWebView = new WebView(inflater.getContext()); - mWebView.setWebChromeClient(new WebChromeClient()); - WebSettings webSettings = mWebView.getSettings(); - webSettings.setJavaScriptEnabled(true); - mWebView.loadUrl("file:///android_asset/blockly/webview.html"); - return mWebView; - } - - // TODO: Method to invoke code generation - // TODO: Method to load workspace from string (or InputStream?) - // TODO: Method to serialize workspace to string (or OutputStream?) - // TODO: Clear / reset workspace - // TODO: Load toolbox - // TODO: Listener for event JSON - // TODO: Method to evaluate JavaScript string in the WebView -} diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/JsDialogHelper.java b/res/lib/blockly/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/JsDialogHelper.java deleted file mode 100644 index 0849d0a2786efec630c34d1f6c15cc3469a7b3d9..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/JsDialogHelper.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.blockly.android.webview; - -import android.app.Activity; -import android.content.Context; -import android.content.DialogInterface; -import android.os.Message; -import android.support.annotation.Nullable; -import android.support.v7.app.AlertDialog; -import android.util.Log; -import android.view.KeyEvent; -import android.view.LayoutInflater; -import android.view.View; -import android.view.inputmethod.EditorInfo; -import android.webkit.JsPromptResult; -import android.webkit.JsResult; -import android.webkit.WebView; -import android.widget.EditText; -import android.widget.TextView; - -import com.example.blocklywebview.R; - -/** - * Helper class to create JavaScript dialogs. - * Adapted from android-9.0.0_r10/core/java/android/webkit/JsDialogHelper.java. - * Removes dialog title (page domain) and uses a larger prompt message area than original. - */ -public class JsDialogHelper { - private static final String TAG = "JsDialogHelper"; - // Dialog types - /** An alert dialog, for console.alert(..). */ - public static final int ALERT = 1; - /** An alert dialog, for console.confirm(..). */ - public static final int CONFIRM = 2; - /** An alert dialog, for console.prompt(..). */ - public static final int PROMPT = 3; - - private final @Nullable String mDefaultValue; - private final JsResult mResult; - private final String mMessage; - private final int mType; - private final String mUrl; - - public JsDialogHelper(JsResult result, int type, @Nullable String defaultValue, - String message, String url) { - if (type == PROMPT && !(result instanceof JsPromptResult)) { - throw new IllegalArgumentException("JsDialogHelper PROMPT requires JsPromptResult"); - } - mResult = result; - mDefaultValue = defaultValue; - mMessage = message; - mType = type; - mUrl = url; - } - - public JsDialogHelper(JsResult result, Message msg) { - mResult = result; - mDefaultValue = msg.getData().getString("default"); - mMessage = msg.getData().getString("message"); - mType = msg.getData().getInt("type"); - mUrl = msg.getData().getString("url"); - } - - public boolean invokeCallback(WebChromeClient client, WebView webView) { - switch (mType) { - case ALERT: - return client.onJsAlert(webView, mUrl, mMessage, mResult); - case CONFIRM: - return client.onJsConfirm(webView, mUrl, mMessage, mResult); - case PROMPT: - return client.onJsPrompt(webView, mUrl, mMessage, mDefaultValue, (JsPromptResult) mResult); - default: - throw new IllegalArgumentException("Unexpected type: " + mType); - } - } - - public void showDialog(Context context) { - if (!canShowAlertDialog(context)) { - Log.w(TAG, "Cannot create a dialog, the WebView context is not an Activity"); - mResult.cancel(); - return; - } - final EditText edit; - AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setOnCancelListener(new CancelListener()); - if (mType != PROMPT) { - edit = null; - builder.setMessage(mMessage); - builder.setPositiveButton(android.R.string.ok, new PositiveListener(null)); - } else { - final View view = LayoutInflater.from(context).inflate(R.layout.js_prompt, null); - edit = view.findViewById(R.id.js_prompt_value); - edit.setText(mDefaultValue); - builder.setPositiveButton(android.R.string.ok, new PositiveListener(edit)); - ((TextView) view.findViewById(R.id.js_prompt_message)).setText(mMessage); - builder.setView(view); - - // TODO: Open keyboard and place text cursor. - } - if (mType != ALERT) { - builder.setNegativeButton(android.R.string.cancel, new CancelListener()); - } - final AlertDialog dialog = builder.show(); - } - - private class CancelListener implements DialogInterface.OnCancelListener, - DialogInterface.OnClickListener { - @Override - public void onCancel(DialogInterface dialog) { - mResult.cancel(); - } - @Override - public void onClick(DialogInterface dialog, int which) { - mResult.cancel(); - } - } - - private class PositiveListener implements DialogInterface.OnClickListener { - private final EditText mEdit; - public PositiveListener(EditText edit) { - mEdit = edit; - } - @Override - public void onClick(DialogInterface dialog, int which) { - if (mEdit == null) { - mResult.confirm(); - } else { - ((JsPromptResult) mResult).confirm(mEdit.getText().toString()); - } - } - } - - private static boolean canShowAlertDialog(Context context) { - return context instanceof Activity; - } -} diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/WebChromeClient.java b/res/lib/blockly/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/WebChromeClient.java deleted file mode 100644 index 7cc0f226e817957a5cea3b89e0168a4d7e8eeae1..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/WebChromeClient.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.google.blockly.android.webview; - -import android.webkit.JsPromptResult; -import android.webkit.JsResult; -import android.webkit.WebView; - -/** - * Provides native hooks for JavaScript console dialog functions. - */ -public class WebChromeClient extends android.webkit.WebChromeClient { - @Override - public boolean onJsAlert(WebView view, String url, String message, JsResult result) { - new JsDialogHelper(result, JsDialogHelper.ALERT, null, message, url) - .showDialog(view.getContext()); - return true; - } - - @Override - public boolean onJsConfirm(WebView view, String url, String message, JsResult result) { - new JsDialogHelper(result, JsDialogHelper.CONFIRM, null, message, url) - .showDialog(view.getContext()); - return true; - } - - @Override - public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, - JsPromptResult result) { - new JsDialogHelper(result, JsDialogHelper.PROMPT, defaultValue, message, url) - .showDialog(view.getContext()); - return true; - } -} diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/demo/MainActivity.java b/res/lib/blockly/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/demo/MainActivity.java deleted file mode 100644 index ea7bf5659e9e91091707d81dc30285f69c6006c7..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/demo/MainActivity.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.google.blockly.android.webview.demo; - -import android.support.v7.app.AppCompatActivity; -import android.os.Bundle; - -import com.example.blocklywebview.R; - -/** - * The primary activity of the demo application. The activity embeds the - * {@link com.google.blockly.android.webview.BlocklyWebViewFragment}. - */ -public class MainActivity extends AppCompatActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - } -} diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/res/lib/blockly/demos/mobile/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index c3903edf4390bd81668cb895f3118cde6f60a104..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,34 +0,0 @@ -<vector xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:aapt="http://schemas.android.com/aapt" - android:width="108dp" - android:height="108dp" - android:viewportHeight="108" - android:viewportWidth="108"> - <path - android:fillType="evenOdd" - android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z" - android:strokeColor="#00000000" - android:strokeWidth="1"> - <aapt:attr name="android:fillColor"> - <gradient - android:endX="78.5885" - android:endY="90.9159" - android:startX="48.7653" - android:startY="61.0927" - android:type="linear"> - <item - android:color="#44000000" - android:offset="0.0"/> - <item - android:color="#00000000" - android:offset="1.0"/> - </gradient> - </aapt:attr> - </path> - <path - android:fillColor="#FFFFFF" - android:fillType="nonZero" - android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> -</vector> diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/drawable/ic_launcher_background.xml b/res/lib/blockly/demos/mobile/android/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 9d478f4c2eb1c30035601f33e46cbdcc8c9d89ea..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<vector - xmlns:android="http://schemas.android.com/apk/res/android" - android:width="108dp" - android:height="108dp" - android:viewportHeight="108" - android:viewportWidth="108"> - <path android:fillColor="#26A69A" - android:pathData="M0,0h108v108h-108z"/> - <path android:fillColor="#00000000" android:pathData="M9,0L9,108" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M19,0L19,108" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M29,0L29,108" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M39,0L39,108" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M49,0L49,108" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M59,0L59,108" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M69,0L69,108" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M79,0L79,108" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M89,0L89,108" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M99,0L99,108" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M0,9L108,9" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M0,19L108,19" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M0,29L108,29" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M0,39L108,39" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M0,49L108,49" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M0,59L108,59" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M0,69L108,69" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M0,79L108,79" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M0,89L108,89" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M0,99L108,99" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M19,29L89,29" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M19,39L89,39" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M19,49L89,49" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M19,59L89,59" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M19,69L89,69" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M19,79L89,79" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M29,19L29,89" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M39,19L39,89" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M49,19L49,89" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M59,19L59,89" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M69,19L69,89" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> - <path android:fillColor="#00000000" android:pathData="M79,19L79,89" - android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/> -</vector> diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/layout/activity_main.xml b/res/lib/blockly/demos/mobile/android/app/src/main/res/layout/activity_main.xml deleted file mode 100644 index 37dc152b0dff128e47f3d657e4a1f19aba374612..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<android.support.constraint.ConstraintLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context="com.google.blockly.android.webview.demo.MainActivity"> - - <fragment - android:id="@+id/blockly_webview" - android:layout_height="match_parent" - android:layout_width="match_parent" - android:name="com.google.blockly.android.webview.BlocklyWebViewFragment" - /> - -</android.support.constraint.ConstraintLayout> \ No newline at end of file diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/layout/js_prompt.xml b/res/lib/blockly/demos/mobile/android/app/src/main/res/layout/js_prompt.xml deleted file mode 100644 index 759295bccec128746ccb4c981081f1fea85e088f..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/res/layout/js_prompt.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2008 The Android Open Source Project - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center_horizontal" -> - <TextView android:id="@+id/js_prompt_message" - style="?android:attr/textAppearanceMedium" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:padding="5dip" - /> - <EditText android:id="@+id/js_prompt_value" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textStyle="bold" - android:inputType="text" - android:selectAllOnFocus="true" - android:scrollHorizontally="true" - android:layout_marginTop="6dip" - /> - -</LinearLayout> \ No newline at end of file diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index bbd3e021239ce758474da78cfc2ca3cf85ed0d91..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> - <background android:drawable="@drawable/ic_launcher_background"/> - <foreground android:drawable="@drawable/ic_launcher_foreground"/> -</adaptive-icon> \ No newline at end of file diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index bbd3e021239ce758474da78cfc2ca3cf85ed0d91..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> - <background android:drawable="@drawable/ic_launcher_background"/> - <foreground android:drawable="@drawable/ic_launcher_foreground"/> -</adaptive-icon> \ No newline at end of file diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index a2f5908281d070150700378b64a84c7db1f97aa1..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 1b523998081149a985cef0cdf89045b9ed29964a..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index ff10afd6e182edb2b1a63c8f984e9070d9f950ba..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index 115a4c768a20c9e13185c17043f4c4d12dd4632a..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index dcd3cd8083358269d6ed7894726283bb9bcbbfea..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 459ca609d3ae0d3943ab44cdc27feef9256dc6d7..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 8ca12fe024be86e868d14e91120a6902f8e88ac6..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 8e19b410a1b15ff180f3dacac19395fe3046cdec..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index b824ebdd48db917eea2e67a82260a100371f8a24..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 4c19a13c239cb67b8a2134ddd5f325db1d2d5bee..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/values/colors.xml b/res/lib/blockly/demos/mobile/android/app/src/main/res/values/colors.xml deleted file mode 100644 index 3ab3e9cbce07f7cdc941fc8ba424c05e83ed80f0..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <color name="colorPrimary">#3F51B5</color> - <color name="colorPrimaryDark">#303F9F</color> - <color name="colorAccent">#FF4081</color> -</resources> diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/values/js_dialog_helper.xml b/res/lib/blockly/demos/mobile/android/app/src/main/res/values/js_dialog_helper.xml deleted file mode 100644 index 1d401fc6349e1f51a1cd4d14741e3e60a02d4c4e..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/res/values/js_dialog_helper.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <!-- Title for a JavaScript dialog. "The page at <url of current page> says:" --> - <string name="js_dialog_title">The page at \"<xliff:g id="title">%s</xliff:g>\" says:</string> - <!-- Default title for a javascript dialog --> - <string name="js_dialog_title_default">JavaScript</string> -</resources> \ No newline at end of file diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/values/strings.xml b/res/lib/blockly/demos/mobile/android/app/src/main/res/values/strings.xml deleted file mode 100644 index b4a84c15163c057a150de4fed279e57e22a4bf02..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ -<resources> - <string name="app_name">Blockly WebView</string> -</resources> diff --git a/res/lib/blockly/demos/mobile/android/app/src/main/res/values/styles.xml b/res/lib/blockly/demos/mobile/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 5885930df6d10edf3d6df40d6556297d11f953da..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ -<resources> - - <!-- Base application theme. --> - <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> - <!-- Customize your theme here. --> - <item name="colorPrimary">@color/colorPrimary</item> - <item name="colorPrimaryDark">@color/colorPrimaryDark</item> - <item name="colorAccent">@color/colorAccent</item> - </style> - -</resources> diff --git a/res/lib/blockly/demos/mobile/android/app/src/test/java/com/example/blocklywebview/ExampleUnitTest.java b/res/lib/blockly/demos/mobile/android/app/src/test/java/com/example/blocklywebview/ExampleUnitTest.java deleted file mode 100644 index a2d19cf5c76fb89eafa94dc303fec0004851ea97..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/app/src/test/java/com/example/blocklywebview/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.example.blocklywebview; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/res/lib/blockly/demos/mobile/android/build.gradle b/res/lib/blockly/demos/mobile/android/build.gradle deleted file mode 100644 index 4e8009dbd3f82be23c95250fd0203955270756b0..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - - repositories { - google() - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:3.2.0' - - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - google() - jcenter() - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/res/lib/blockly/demos/mobile/android/gradle.properties b/res/lib/blockly/demos/mobile/android/gradle.properties deleted file mode 100644 index 743d692ce151e0dbf591cbbf498164ecc8055439..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/gradle.properties +++ /dev/null @@ -1,13 +0,0 @@ -# Project-wide Gradle settings. -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx1536m -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true diff --git a/res/lib/blockly/demos/mobile/android/gradle/wrapper/gradle-wrapper.jar b/res/lib/blockly/demos/mobile/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7a3265ee94c0ab25cf079ac8ccdf87f41d455d42..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/mobile/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/res/lib/blockly/demos/mobile/android/gradle/wrapper/gradle-wrapper.properties b/res/lib/blockly/demos/mobile/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 2e05a4e32815ac3e5871a4e4a131adfcbeda3e86..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Thu Oct 04 16:59:44 PDT 2018 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip diff --git a/res/lib/blockly/demos/mobile/android/gradlew b/res/lib/blockly/demos/mobile/android/gradlew deleted file mode 100644 index cccdd3d517fc5249beaefa600691cf150f2fa3e6..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/res/lib/blockly/demos/mobile/android/gradlew.bat b/res/lib/blockly/demos/mobile/android/gradlew.bat deleted file mode 100644 index e95643d6a2ca62258464e83c72f5156dc941c609..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/res/lib/blockly/demos/mobile/android/settings.gradle b/res/lib/blockly/demos/mobile/android/settings.gradle deleted file mode 100644 index e7b4def49cb53d9aa04228dd3edb14c9e635e003..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/android/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app' diff --git a/res/lib/blockly/demos/mobile/html/.gitignore b/res/lib/blockly/demos/mobile/html/.gitignore deleted file mode 100644 index 72077a6d636db305ee442e7e7adead99b2570cc5..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/html/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/blockly_compressed.js -/blocks_compressed.js -/media -/msg diff --git a/res/lib/blockly/demos/mobile/html/index.html b/res/lib/blockly/demos/mobile/html/index.html deleted file mode 100644 index 55906503d615fe96734cb458bd4660a6d50113ec..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/html/index.html +++ /dev/null @@ -1,31 +0,0 @@ -<!DOCTYPE html> -<!-- HTML file to host Blockly in a mobile WebView. --> -<html> -<head> - <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> - <style type="text/css"> - html, body, #blocklyDiv { - border: 0; - height: 100%; - margin: 0; - padding: 0; - width: 100%; - } - </style> - <script src="blockly_compressed.js"></script> - <script src="blocks_compressed.js"></script> - <!-- TODO: Select msg file based on locale. --> - <script src="msg/js/en.js"></script> - <script src="toolbox_standard.js"></script> -</head> -<body> - <div id="blocklyDiv"></div> - <script type="text/javascript"> - var workspacePlayground = Blockly.inject('blocklyDiv', { - media: 'media/', - toolbox: BLOCKLY_TOOLBOX_XML['standard'], - zoom: {controls: true} - }); - </script> -</body> -</html> \ No newline at end of file diff --git a/res/lib/blockly/demos/mobile/html/ln_resources.sh b/res/lib/blockly/demos/mobile/html/ln_resources.sh deleted file mode 100644 index c4c3b605d4e75548674d858e616da191c083749d..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/html/ln_resources.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -e -# -# Create symbolic links in this directory for the -# Blockly library files used by this demo's index.html. - -if [[ ! -e ../../../blockly_compressed.js ]]; then - echo "ERROR: Could not locate blockly_compressed.js. Run from demos/mobile/html/" 1>&2 - exit 1 # terminate and indicate error -fi - -if [ ! -L blockly_compressed.js ]; then - ln -s ../../../blockly_compressed.js blockly_compressed.js -fi -if [ ! -L blocks_compressed.js ]; then - ln -s ../../../blocks_compressed.js blocks_compressed.js -fi -if [ ! -L media ]; then - ln -s ../../../media media -fi -if [ ! -L msg ]; then - ln -s ../../../msg msg -fi diff --git a/res/lib/blockly/demos/mobile/html/toolbox_standard.js b/res/lib/blockly/demos/mobile/html/toolbox_standard.js deleted file mode 100644 index 20326882fc574b24457d594e660cb7968f48ff04..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/html/toolbox_standard.js +++ /dev/null @@ -1,333 +0,0 @@ - -var BLOCKLY_TOOLBOX_XML = BLOCKLY_TOOLBOX_XML || Object.create(null); - -/* BEGINNING BLOCKLY_TOOLBOX_XML ASSIGNMENT. DO NOT EDIT. USE BLOCKLY DEVTOOLS. */ -BLOCKLY_TOOLBOX_XML['standard'] = -// From XML string/file, replace ^\s?(\s*)?(<.*>)$ with \+$1'$2' -// Tweak first and last line. -'<xml xmlns="https://developers.google.com/blockly/xml">' -+ '<category name="Logic" colour="%{BKY_LOGIC_HUE}">' -+ '<block type="controls_if"></block>' -+ '<block type="logic_compare"></block>' -+ '<block type="logic_operation"></block>' -+ '<block type="logic_negate"></block>' -+ '<block type="logic_boolean"></block>' -+ '<block type="logic_null" disabled="true"></block>' -+ '<block type="logic_ternary"></block>' -+ '</category>' -+ '<category name="Loops" colour="%{BKY_LOOPS_HUE}">' -+ '<block type="controls_repeat_ext">' -+ '<value name="TIMES">' -+ '<shadow type="math_number">' -+ '<field name="NUM">10</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="controls_repeat" disabled="true"></block>' -+ '<block type="controls_whileUntil"></block>' -+ '<block type="controls_for">' -+ '<value name="FROM">' -+ '<shadow type="math_number">' -+ '<field name="NUM">1</field>' -+ '</shadow>' -+ '</value>' -+ '<value name="TO">' -+ '<shadow type="math_number">' -+ '<field name="NUM">10</field>' -+ '</shadow>' -+ '</value>' -+ '<value name="BY">' -+ '<shadow type="math_number">' -+ '<field name="NUM">1</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="controls_forEach"></block>' -+ '<block type="controls_flow_statements"></block>' -+ '</category>' -+ '<category name="Math" colour="%{BKY_MATH_HUE}">' -+ '<block type="math_number" gap="32">' -+ '<field name="NUM">123</field>' -+ '</block>' -+ '<block type="math_arithmetic">' -+ '<value name="A">' -+ '<shadow type="math_number">' -+ '<field name="NUM">1</field>' -+ '</shadow>' -+ '</value>' -+ '<value name="B">' -+ '<shadow type="math_number">' -+ '<field name="NUM">1</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="math_single">' -+ '<value name="NUM">' -+ '<shadow type="math_number">' -+ '<field name="NUM">9</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="math_trig">' -+ '<value name="NUM">' -+ '<shadow type="math_number">' -+ '<field name="NUM">45</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="math_constant"></block>' -+ '<block type="math_number_property">' -+ '<value name="NUMBER_TO_CHECK">' -+ '<shadow type="math_number">' -+ '<field name="NUM">0</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="math_round">' -+ '<value name="NUM">' -+ '<shadow type="math_number">' -+ '<field name="NUM">3.1</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="math_on_list"></block>' -+ '<block type="math_modulo">' -+ '<value name="DIVIDEND">' -+ '<shadow type="math_number">' -+ '<field name="NUM">64</field>' -+ '</shadow>' -+ '</value>' -+ '<value name="DIVISOR">' -+ '<shadow type="math_number">' -+ '<field name="NUM">10</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="math_constrain">' -+ '<value name="VALUE">' -+ '<shadow type="math_number">' -+ '<field name="NUM">50</field>' -+ '</shadow>' -+ '</value>' -+ '<value name="LOW">' -+ '<shadow type="math_number">' -+ '<field name="NUM">1</field>' -+ '</shadow>' -+ '</value>' -+ '<value name="HIGH">' -+ '<shadow type="math_number">' -+ '<field name="NUM">100</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="math_random_int">' -+ '<value name="FROM">' -+ '<shadow type="math_number">' -+ '<field name="NUM">1</field>' -+ '</shadow>' -+ '</value>' -+ '<value name="TO">' -+ '<shadow type="math_number">' -+ '<field name="NUM">100</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="math_random_float"></block>' -+ '</category>' -+ '<category name="Text" colour="%{BKY_TEXTS_HUE}">' -+ '<block type="text"></block>' -+ '<block type="text_join"></block>' -+ '<block type="text_append">' -+ '<value name="TEXT">' -+ '<shadow type="text"></shadow>' -+ '</value>' -+ '</block>' -+ '<block type="text_length">' -+ '<value name="VALUE">' -+ '<shadow type="text">' -+ '<field name="TEXT">abc</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="text_isEmpty">' -+ '<value name="VALUE">' -+ '<shadow type="text">' -+ '<field name="TEXT"></field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="text_indexOf">' -+ '<value name="VALUE">' -+ '<block type="variables_get">' -+ '<field name="VAR">text</field>' -+ '</block>' -+ '</value>' -+ '<value name="FIND">' -+ '<shadow type="text">' -+ '<field name="TEXT">abc</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="text_charAt">' -+ '<value name="VALUE">' -+ '<block type="variables_get">' -+ '<field name="VAR">text</field>' -+ '</block>' -+ '</value>' -+ '</block>' -+ '<block type="text_getSubstring">' -+ '<value name="STRING">' -+ '<block type="variables_get">' -+ '<field name="VAR">text</field>' -+ '</block>' -+ '</value>' -+ '</block>' -+ '<block type="text_changeCase">' -+ '<value name="TEXT">' -+ '<shadow type="text">' -+ '<field name="TEXT">abc</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="text_trim">' -+ '<value name="TEXT">' -+ '<shadow type="text">' -+ '<field name="TEXT">abc</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="text_count">' -+ '<value name="SUB">' -+ '<shadow type="text"></shadow>' -+ '</value>' -+ '<value name="TEXT">' -+ '<shadow type="text"></shadow>' -+ '</value>' -+ '</block>' -+ '<block type="text_replace">' -+ '<value name="FROM">' -+ '<shadow type="text"></shadow>' -+ '</value>' -+ '<value name="TO">' -+ '<shadow type="text"></shadow>' -+ '</value>' -+ '<value name="TEXT">' -+ '<shadow type="text"></shadow>' -+ '</value>' -+ '</block>' -+ '<block type="text_reverse">' -+ '<value name="TEXT">' -+ '<shadow type="text"></shadow>' -+ '</value>' -+ '</block>' -+ '<label text="Input/Output:" web-class="ioLabel"></label>' -+ '<block type="text_print">' -+ '<value name="TEXT">' -+ '<shadow type="text">' -+ '<field name="TEXT">abc</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="text_prompt_ext">' -+ '<value name="TEXT">' -+ '<shadow type="text">' -+ '<field name="TEXT">abc</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '</category>' -+ '<category name="Lists" colour="%{BKY_LISTS_HUE}">' -+ '<block type="lists_create_with">' -+ '<mutation items="0"></mutation>' -+ '</block>' -+ '<block type="lists_create_with"></block>' -+ '<block type="lists_repeat">' -+ '<value name="NUM">' -+ '<shadow type="math_number">' -+ '<field name="NUM">5</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="lists_length"></block>' -+ '<block type="lists_isEmpty"></block>' -+ '<block type="lists_indexOf">' -+ '<value name="VALUE">' -+ '<block type="variables_get">' -+ '<field name="VAR">list</field>' -+ '</block>' -+ '</value>' -+ '</block>' -+ '<block type="lists_getIndex">' -+ '<value name="VALUE">' -+ '<block type="variables_get">' -+ '<field name="VAR">list</field>' -+ '</block>' -+ '</value>' -+ '</block>' -+ '<block type="lists_setIndex">' -+ '<value name="LIST">' -+ '<block type="variables_get">' -+ '<field name="VAR">list</field>' -+ '</block>' -+ '</value>' -+ '</block>' -+ '<block type="lists_getSublist">' -+ '<value name="LIST">' -+ '<block type="variables_get">' -+ '<field name="VAR">list</field>' -+ '</block>' -+ '</value>' -+ '</block>' -+ '<block type="lists_split">' -+ '<value name="DELIM">' -+ '<shadow type="text">' -+ '<field name="TEXT">,</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="lists_sort"></block>' -+ '<block type="lists_reverse"></block>' -+ '</category>' -+ '<category name="Colour" colour="%{BKY_COLOUR_HUE}">' -+ '<block type="colour_picker"></block>' -+ '<block type="colour_random"></block>' -+ '<block type="colour_rgb">' -+ '<value name="RED">' -+ '<shadow type="math_number">' -+ '<field name="NUM">100</field>' -+ '</shadow>' -+ '</value>' -+ '<value name="GREEN">' -+ '<shadow type="math_number">' -+ '<field name="NUM">50</field>' -+ '</shadow>' -+ '</value>' -+ '<value name="BLUE">' -+ '<shadow type="math_number">' -+ '<field name="NUM">0</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '<block type="colour_blend">' -+ '<value name="COLOUR1">' -+ '<shadow type="colour_picker">' -+ '<field name="COLOUR">#ff0000</field>' -+ '</shadow>' -+ '</value>' -+ '<value name="COLOUR2">' -+ '<shadow type="colour_picker">' -+ '<field name="COLOUR">#3333ff</field>' -+ '</shadow>' -+ '</value>' -+ '<value name="RATIO">' -+ '<shadow type="math_number">' -+ '<field name="NUM">0.5</field>' -+ '</shadow>' -+ '</value>' -+ '</block>' -+ '</category>' -+ '<sep></sep>' -+ '<category name="Variables" colour="%{BKY_VARIABLES_HUE}" custom="VARIABLE"></category>' -+ '<category name="Functions" colour="%{BKY_PROCEDURES_HUE}" custom="PROCEDURE"></category>' -+ '</xml>'; -/* END BLOCKLY_TOOLBOX_XML ASSIGNMENT. DO NOT EDIT. */ diff --git a/res/lib/blockly/demos/mobile/ios/.gitignore b/res/lib/blockly/demos/mobile/ios/.gitignore deleted file mode 100644 index 6c1f837691d4f23c4b2d720561e63f4a486af957..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/ios/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -# Files copied by cp_resources.sh -/Resources/Non-Localized/Blockly - - -# Xcode.gitignore - -## User settings -xcuserdata/ - -## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) -*.xcscmblueprint -*.xccheckout - -## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) -build/ -DerivedData/ -*.moved-aside -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 diff --git a/res/lib/blockly/demos/mobile/ios/Blockly WebView.xcodeproj/project.pbxproj b/res/lib/blockly/demos/mobile/ios/Blockly WebView.xcodeproj/project.pbxproj deleted file mode 100644 index a3f72fcd43157c6d3418f74257d6bb06f531e19f..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/ios/Blockly WebView.xcodeproj/project.pbxproj +++ /dev/null @@ -1,390 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 50; - objects = { - -/* Begin PBXBuildFile section */ - AB036C55211B89D600CCC9D8 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB036C54211B89D600CCC9D8 /* WebKit.framework */; }; - AB980111211A37B50025AFF2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB980110211A37B50025AFF2 /* AppDelegate.swift */; }; - AB980113211A37B50025AFF2 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB980112211A37B50025AFF2 /* ViewController.swift */; }; - AB980116211A37B50025AFF2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB980114211A37B50025AFF2 /* Main.storyboard */; }; - AB980118211A37B70025AFF2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AB980117211A37B70025AFF2 /* Assets.xcassets */; }; - AB98011B211A37B70025AFF2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB980119211A37B70025AFF2 /* LaunchScreen.storyboard */; }; - ABA1B7FC212214E7000D3CC5 /* Blockly in Resources */ = {isa = PBXBuildFile; fileRef = ABA1B7FB212214E7000D3CC5 /* Blockly */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - AB036C54211B89D600CCC9D8 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; - AB98010D211A37B50025AFF2 /* Blockly WebView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Blockly WebView.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - AB980110211A37B50025AFF2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; - AB980112211A37B50025AFF2 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; - AB980115211A37B50025AFF2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; - AB980117211A37B70025AFF2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; - AB98011A211A37B70025AFF2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; - AB98011C211A37B70025AFF2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; - ABA1B7FB212214E7000D3CC5 /* Blockly */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Blockly; path = "Resources/Non-Localized/Blockly"; sourceTree = SOURCE_ROOT; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - AB98010A211A37B50025AFF2 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - AB036C55211B89D600CCC9D8 /* WebKit.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - AB036C53211B89D500CCC9D8 /* Frameworks */ = { - isa = PBXGroup; - children = ( - AB036C54211B89D600CCC9D8 /* WebKit.framework */, - ); - name = Frameworks; - sourceTree = "<group>"; - }; - AB980104211A37B50025AFF2 = { - isa = PBXGroup; - children = ( - AB98010F211A37B50025AFF2 /* Blockly WebView */, - AB98010E211A37B50025AFF2 /* Products */, - AB036C53211B89D500CCC9D8 /* Frameworks */, - ); - sourceTree = "<group>"; - }; - AB98010E211A37B50025AFF2 /* Products */ = { - isa = PBXGroup; - children = ( - AB98010D211A37B50025AFF2 /* Blockly WebView.app */, - ); - name = Products; - sourceTree = "<group>"; - }; - AB98010F211A37B50025AFF2 /* Blockly WebView */ = { - isa = PBXGroup; - children = ( - ABA1B7F9212214B9000D3CC5 /* Resources */, - AB980110211A37B50025AFF2 /* AppDelegate.swift */, - AB980112211A37B50025AFF2 /* ViewController.swift */, - AB980114211A37B50025AFF2 /* Main.storyboard */, - AB980117211A37B70025AFF2 /* Assets.xcassets */, - AB980119211A37B70025AFF2 /* LaunchScreen.storyboard */, - AB98011C211A37B70025AFF2 /* Info.plist */, - ); - path = "Blockly WebView"; - sourceTree = "<group>"; - }; - ABA1B7F9212214B9000D3CC5 /* Resources */ = { - isa = PBXGroup; - children = ( - ABA1B7FA212214C6000D3CC5 /* Non-Localized */, - ); - path = Resources; - sourceTree = "<group>"; - }; - ABA1B7FA212214C6000D3CC5 /* Non-Localized */ = { - isa = PBXGroup; - children = ( - ABA1B7FB212214E7000D3CC5 /* Blockly */, - ); - path = "Non-Localized"; - sourceTree = "<group>"; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - AB98010C211A37B50025AFF2 /* Blockly WebView */ = { - isa = PBXNativeTarget; - buildConfigurationList = AB98011F211A37B70025AFF2 /* Build configuration list for PBXNativeTarget "Blockly WebView" */; - buildPhases = ( - AB980109211A37B50025AFF2 /* Sources */, - AB98010A211A37B50025AFF2 /* Frameworks */, - ABEDABD1212372E700A66667 /* ShellScript */, - AB98010B211A37B50025AFF2 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "Blockly WebView"; - productName = "Blockly WebView"; - productReference = AB98010D211A37B50025AFF2 /* Blockly WebView.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - AB980105211A37B50025AFF2 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0940; - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Google; - TargetAttributes = { - AB98010C211A37B50025AFF2 = { - CreatedOnToolsVersion = 9.4.1; - }; - }; - }; - buildConfigurationList = AB980108211A37B50025AFF2 /* Build configuration list for PBXProject "Blockly WebView" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = AB980104211A37B50025AFF2; - productRefGroup = AB98010E211A37B50025AFF2 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - AB98010C211A37B50025AFF2 /* Blockly WebView */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - AB98010B211A37B50025AFF2 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AB98011B211A37B70025AFF2 /* LaunchScreen.storyboard in Resources */, - AB980118211A37B70025AFF2 /* Assets.xcassets in Resources */, - AB980116211A37B50025AFF2 /* Main.storyboard in Resources */, - ABA1B7FC212214E7000D3CC5 /* Blockly in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - ABEDABD1212372E700A66667 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = ./cp_resources.sh; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - AB980109211A37B50025AFF2 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AB980113211A37B50025AFF2 /* ViewController.swift in Sources */, - AB980111211A37B50025AFF2 /* AppDelegate.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - AB980114211A37B50025AFF2 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - AB980115211A37B50025AFF2 /* Base */, - ); - name = Main.storyboard; - sourceTree = "<group>"; - }; - AB980119211A37B70025AFF2 /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - AB98011A211A37B70025AFF2 /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = "<group>"; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - AB98011D211A37B70025AFF2 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.4; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - AB98011E211A37B70025AFF2 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.4; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - AB980120211A37B70025AFF2 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 3KZF7Q7Q49; - INFOPLIST_FILE = "Blockly WebView/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.google.kidscoding.Blockly-WebView"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - AB980121211A37B70025AFF2 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 3KZF7Q7Q49; - INFOPLIST_FILE = "Blockly WebView/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.google.kidscoding.Blockly-WebView"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - AB980108211A37B50025AFF2 /* Build configuration list for PBXProject "Blockly WebView" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - AB98011D211A37B70025AFF2 /* Debug */, - AB98011E211A37B70025AFF2 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - AB98011F211A37B70025AFF2 /* Build configuration list for PBXNativeTarget "Blockly WebView" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - AB980120211A37B70025AFF2 /* Debug */, - AB980121211A37B70025AFF2 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = AB980105211A37B50025AFF2 /* Project object */; -} diff --git a/res/lib/blockly/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/res/lib/blockly/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 2a4f4ae836af692a7f3a13142de808afa57df336..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Workspace - version = "1.0"> - <FileRef - location = "self:Blockly WebView.xcodeproj"> - </FileRef> -</Workspace> diff --git a/res/lib/blockly/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/res/lib/blockly/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003d68d0546c4804ac2ff47dd97c6e7921..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IDEDidComputeMac32BitWarning</key> - <true/> -</dict> -</plist> diff --git a/res/lib/blockly/demos/mobile/ios/Blockly WebView/AppDelegate.swift b/res/lib/blockly/demos/mobile/ios/Blockly WebView/AppDelegate.swift deleted file mode 100644 index 1f2bf6eedce1282c7902b8e25aba90a9f82bbce5..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/ios/Blockly WebView/AppDelegate.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// AppDelegate.swift -// Blockly WebView -// -// Created by Andrew Marshall on 8/7/18. -// Copyright © 2018 Google. All rights reserved. -// - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. - return true - } - - func applicationWillResignActive(_ application: UIApplication) { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. - } - - func applicationDidEnterBackground(_ application: UIApplication) { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. - } - - func applicationWillEnterForeground(_ application: UIApplication) { - // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. - } - - func applicationDidBecomeActive(_ application: UIApplication) { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. - } - - func applicationWillTerminate(_ application: UIApplication) { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. - } - - -} - diff --git a/res/lib/blockly/demos/mobile/ios/Blockly WebView/Assets.xcassets/AppIcon.appiconset/Contents.json b/res/lib/blockly/demos/mobile/ios/Blockly WebView/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index d8db8d65fd79fd541b2b7eba75c7378af3448f9c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/ios/Blockly WebView/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "83.5x83.5", - "scale" : "2x" - }, - { - "idiom" : "ios-marketing", - "size" : "1024x1024", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/res/lib/blockly/demos/mobile/ios/Blockly WebView/Assets.xcassets/Contents.json b/res/lib/blockly/demos/mobile/ios/Blockly WebView/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c918651cdd1e11dca5cc62c333f097601..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/ios/Blockly WebView/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/res/lib/blockly/demos/mobile/ios/Blockly WebView/Base.lproj/LaunchScreen.storyboard b/res/lib/blockly/demos/mobile/ios/Blockly WebView/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index f83f6fd5810b9c852cf98563d82d5ed1e84ff893..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/ios/Blockly WebView/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> - <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/> - <capability name="Safe area layout guides" minToolsVersion="9.0"/> - <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> - </dependencies> - <scenes> - <!--View Controller--> - <scene sceneID="EHf-IW-A2E"> - <objects> - <viewController id="01J-lp-oVM" sceneMemberID="viewController"> - <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> - </view> - </viewController> - <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> - </objects> - <point key="canvasLocation" x="53" y="375"/> - </scene> - </scenes> -</document> diff --git a/res/lib/blockly/demos/mobile/ios/Blockly WebView/Base.lproj/Main.storyboard b/res/lib/blockly/demos/mobile/ios/Blockly WebView/Base.lproj/Main.storyboard deleted file mode 100644 index 35c8fdddfc278634c4a74e5455af822be5d62dc9..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/ios/Blockly WebView/Base.lproj/Main.storyboard +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r"> - <device id="retina4_7" orientation="portrait"> - <adaptation id="fullscreen"/> - </device> - <dependencies> - <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/> - <capability name="Safe area layout guides" minToolsVersion="9.0"/> - <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> - </dependencies> - <scenes> - <!--View Controller--> - <scene sceneID="tne-QT-ifu"> - <objects> - <viewController id="BYZ-38-t0r" customClass="ViewController" customModule="Blockly_WebView" customModuleProvider="target" sceneMemberID="viewController"> - <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <subviews> - <wkWebView multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="HmE-ZW-QKv"> - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> - <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> - <color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - <wkWebViewConfiguration key="configuration" allowsAirPlayForMediaPlayback="NO"> - <dataDetectorTypes key="dataDetectorTypes"/> - <audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/> - <wkPreferences key="preferences"/> - </wkWebViewConfiguration> - </wkWebView> - </subviews> - <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> - </view> - <connections> - <outlet property="webView" destination="HmE-ZW-QKv" id="OGc-PV-TAB"/> - </connections> - </viewController> - <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> - </objects> - <point key="canvasLocation" x="-10" y="51"/> - </scene> - </scenes> -</document> diff --git a/res/lib/blockly/demos/mobile/ios/Blockly WebView/Info.plist b/res/lib/blockly/demos/mobile/ios/Blockly WebView/Info.plist deleted file mode 100644 index 16be3b681122de83e380d47b840b7d0486f71f86..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/ios/Blockly WebView/Info.plist +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>$(DEVELOPMENT_LANGUAGE)</string> - <key>CFBundleExecutable</key> - <string>$(EXECUTABLE_NAME)</string> - <key>CFBundleIdentifier</key> - <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>$(PRODUCT_NAME)</string> - <key>CFBundlePackageType</key> - <string>APPL</string> - <key>CFBundleShortVersionString</key> - <string>1.0</string> - <key>CFBundleVersion</key> - <string>1</string> - <key>LSRequiresIPhoneOS</key> - <true/> - <key>UILaunchStoryboardName</key> - <string>LaunchScreen</string> - <key>UIMainStoryboardFile</key> - <string>Main</string> - <key>UIRequiredDeviceCapabilities</key> - <array> - <string>armv7</string> - </array> - <key>UISupportedInterfaceOrientations</key> - <array> - <string>UIInterfaceOrientationPortrait</string> - <string>UIInterfaceOrientationLandscapeLeft</string> - <string>UIInterfaceOrientationLandscapeRight</string> - </array> - <key>UISupportedInterfaceOrientations~ipad</key> - <array> - <string>UIInterfaceOrientationPortrait</string> - <string>UIInterfaceOrientationPortraitUpsideDown</string> - <string>UIInterfaceOrientationLandscapeLeft</string> - <string>UIInterfaceOrientationLandscapeRight</string> - </array> -</dict> -</plist> diff --git a/res/lib/blockly/demos/mobile/ios/Blockly WebView/ViewController.swift b/res/lib/blockly/demos/mobile/ios/Blockly WebView/ViewController.swift deleted file mode 100644 index f8ad8018e44ad4a92c1ff6583d4b77b3e5284f30..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/ios/Blockly WebView/ViewController.swift +++ /dev/null @@ -1,111 +0,0 @@ -// ViewController.swift -// Blockly WebView UI controller. -// -// Created by Andrew Marshall on 8/7/18. -// Copyright © 2018 Google. All rights reserved. -// - -import UIKit -import WebKit - - -/// A basic ViewController for a WebView. -/// It handles the initial page load, and functions like window.prompt(). -class ViewController: UIViewController, WKUIDelegate { - /// The name used to reference this iOS object when executing callbacks from the JS code. - /// If this value is changed, it should also be changed in the `CODE_GENERATOR_BRIDGE_JS` file. - fileprivate static let HOST_HTML = "Blockly/webview.html" - - @IBOutlet weak var webView: WKWebView! - - /// Additional setup after loading the UI NIB. - override func viewDidLoad() { - super.viewDidLoad() - webView.uiDelegate = self - // Do any additional setup after loading the view, typically from a nib. - loadWebContent() - } - - /// Load the root HTML page into the webview. - func loadWebContent() { - if let htmlUrl = Bundle.main.url(forResource: "webview", withExtension: "html", - subdirectory: "Blockly") { - webView.load(URLRequest.init(url: htmlUrl)) - } else { - NSLog("Failed to load HTML. Could not find resource.") - } - } - - /// Handle window.alert() with a native dialog. - func webView(_ webView: WKWebView, - runJavaScriptAlertPanelWithMessage message: String, - initiatedByFrame frame: WKFrameInfo, - completionHandler: @escaping () -> Void) { - - let alert = UIAlertController(title: nil, message: message, preferredStyle: .alert) - let title = NSLocalizedString("OK", comment: "OK Button") - let ok = UIAlertAction(title: title, style: .default) { (action: UIAlertAction) -> Void in - alert.dismiss(animated: true, completion: nil) - } - alert.addAction(ok) - present(alert, animated: true) - completionHandler() - } - - /// Handle window.confirm() with a native dialog. - func webView(_ webView: WKWebView, - runJavaScriptConfirmPanelWithMessage message: String, - initiatedByFrame frame: WKFrameInfo, - completionHandler: @escaping (Bool) -> Void) { - - let alert = UIAlertController(title: nil, message: message, preferredStyle: .alert) - let closeAndHandle = { (okayed: Bool) in - alert.dismiss(animated: true, completion: nil) - completionHandler(okayed) - } - - let okTitle = NSLocalizedString("OK", comment: "OK button title") - let ok = UIAlertAction(title: okTitle, style: .default) { (action: UIAlertAction) -> Void in - closeAndHandle(true) - } - alert.addAction(ok) - - let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel button title") - let cancel = UIAlertAction(title: cancelTitle, style: .default) { - (action: UIAlertAction) -> Void in - closeAndHandle(false) - } - alert.addAction(cancel) - present(alert, animated: true) - } - - /// Handle window.prompt() with a native dialog. - func webView(_ webView: WKWebView, - runJavaScriptTextInputPanelWithPrompt prompt: String, - defaultText: String?, - initiatedByFrame frame: WKFrameInfo, - completionHandler: @escaping (String?) -> Void) { - - let alert = UIAlertController(title: prompt, message: nil, preferredStyle: .alert) - - alert.addTextField { (textField) in - textField.text = defaultText - } - - let okTitle = NSLocalizedString("OK", comment: "OK button title") - let okAction = UIAlertAction(title: okTitle, style: .default) { (_) in - let textInput = alert.textFields![0] as UITextField - completionHandler(textInput.text) - } - alert.addAction(okAction) - - let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel button title") - let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel) { (_) in - completionHandler(nil) - } - alert.addAction(cancelAction) - - present(alert, animated: true) - } -} - diff --git a/res/lib/blockly/demos/mobile/ios/cp_resources.sh b/res/lib/blockly/demos/mobile/ios/cp_resources.sh deleted file mode 100644 index 050ee900cba998b3c769a546f19676b886f6004c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/mobile/ios/cp_resources.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -set -eux - -BLOCKLY_ROOT=../../.. -IOS_RESOURCES=Resources/Non-Localized/Blockly - -MORE_FILES_TO_COPY=( - "blockly_compressed.js" - "blocks_compressed.js" - "media" - "msg/js" - ) - -mkdir -p $IOS_RESOURCES/media -mkdir -p $IOS_RESOURCES/msg/js -rsync -rp ../html/index.html $IOS_RESOURCES/webview.html -rsync -rp ../html/toolbox_standard.js $IOS_RESOURCES/toolbox_standard.js -for i in "${MORE_FILES_TO_COPY[@]}"; do # The quotes are necessary here - TARGET_DIR=$(dirname $IOS_RESOURCES/$i) - rsync -rp $BLOCKLY_ROOT/$i $TARGET_DIR -done diff --git a/res/lib/blockly/demos/plane/README.txt b/res/lib/blockly/demos/plane/README.txt deleted file mode 100644 index 944448fd6da8b1efb97c277fef3eb586af692e56..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/README.txt +++ /dev/null @@ -1,26 +0,0 @@ -This Blockly demo uses Closure Templates to create a multilingual application. -Any changes to the template.soy file require a recompile. Here is the command -to generate a quick English version for debugging: - -java -jar soy/SoyToJsSrcCompiler.jar --outputPathFormat generated/en.js --srcs template.soy - -To generate a full set of language translations, first extract all the strings -from template.soy using this command: - -java -jar soy/SoyMsgExtractor.jar --outputFile xlf/extracted_msgs.xlf template.soy - -This generates xlf/extracted_msgs.xlf, which may then be used by any -XLIFF-compatible translation console to generate a set of files with the -translated strings. These should be placed in the xlf directory. - -Finally, generate all the language versions with this command: - -java -jar soy/SoyToJsSrcCompiler.jar --locales ar,be-tarask,br,ca,da,de,el,en,es,fa,fr,he,hrx,hu,ia,is,it,ja,ko,ms,nb,nl,pl,pms,pt-br,ro,ru,sc,sv,th,tr,uk,vi,zh-hans,zh-hant --messageFilePathFormat xlf/translated_msgs_{LOCALE}.xlf --outputPathFormat "generated/{LOCALE}.js" template.soy - -This is the process that Google uses for maintaining Blockly Games in 50+ -languages. The XLIFF format is simple enough that it is trivial to write a -Python script to reformat it into some other format (such as JSON) for -compatibility with other translation consoles. - -For more information, see message translation for Closure Templates: -https://developers.google.com/closure/templates/docs/translation diff --git a/res/lib/blockly/demos/plane/blocks.js b/res/lib/blockly/demos/plane/blocks.js deleted file mode 100644 index 33c66c78ca5a8d0c31b4f5d1f6fc0386266c6a2b..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/blocks.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @license - * Copyright 2013 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Blocks for Blockly's Plane Seat Calculator application. - * @author fraser@google.com (Neil Fraser) - */ -'use strict'; - -Blockly.Blocks['plane_set_seats'] = { - // Block seat variable setter. - init: function() { - this.setHelpUrl(Blockly.Msg['VARIABLES_SET_HELPURL']); - this.setColour(330); - this.appendValueInput('VALUE') - .appendField(Plane.getMsg('Plane_setSeats')); - this.setTooltip(Blockly.Msg['VARIABLES_SET_TOOLTIP']); - this.setDeletable(false); - } -}; - -Blockly.JavaScript['plane_set_seats'] = function(block) { - // Generate JavaScript for seat variable setter. - var argument0 = Blockly.JavaScript.valueToCode(block, 'VALUE', - Blockly.JavaScript.ORDER_ASSIGNMENT) || 'NaN'; - return argument0 + ';'; -}; - -Blockly.Blocks['plane_get_rows'] = { - // Block for row variable getter. - init: function() { - this.setHelpUrl(Blockly.Msg['VARIABLES_GET_HELPURL']); - this.setColour(330); - this.appendDummyInput() - .appendField(Plane.getMsg('Plane_getRows'), 'title'); - this.setOutput(true, 'Number'); - }, - customUpdate: function() { - this.setFieldValue( - Plane.getMsg('Plane_getRows').replace('%1', Plane.rows1st), 'title'); - } -}; - -Blockly.JavaScript['plane_get_rows'] = function(block) { - // Generate JavaScript for row variable getter. - return ['Plane.rows1st', Blockly.JavaScript.ORDER_MEMBER]; -}; - -Blockly.Blocks['plane_get_rows1st'] = { - // Block for first class row variable getter. - init: function() { - this.setHelpUrl(Blockly.Msg['VARIABLES_GET_HELPURL']); - this.setColour(330); - this.appendDummyInput() - .appendField(Plane.getMsg('Plane_getRows1'), 'title'); - this.setOutput(true, 'Number'); - }, - customUpdate: function() { - this.setFieldValue( - Plane.getMsg('Plane_getRows1').replace('%1', Plane.rows1st), 'title'); - } -}; - -Blockly.JavaScript['plane_get_rows1st'] = function(block) { - // Generate JavaScript for first class row variable getter. - return ['Plane.rows1st', Blockly.JavaScript.ORDER_MEMBER]; -}; - -Blockly.Blocks['plane_get_rows2nd'] = { - // Block for second class row variable getter. - init: function() { - this.setHelpUrl(Blockly.Msg['VARIABLES_GET_HELPURL']); - this.setColour(330); - this.appendDummyInput() - .appendField(Plane.getMsg('Plane_getRows2'), 'title'); - this.setOutput(true, 'Number'); - }, - customUpdate: function() { - this.setFieldValue( - Plane.getMsg('Plane_getRows2').replace('%1', Plane.rows2nd), 'title'); - } -}; - -Blockly.JavaScript['plane_get_rows2nd'] = function(block) { - // Generate JavaScript for second class row variable getter. - return ['Plane.rows2nd', Blockly.JavaScript.ORDER_MEMBER]; -}; diff --git a/res/lib/blockly/demos/plane/generated/ar.js b/res/lib/blockly/demos/plane/generated/ar.js deleted file mode 100644 index ac760fb11d80863a4534a79861b74e56e6ea1fff..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/ar.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">\u0627\u0644\u0635\u0641\u0648\u0641: %1</span><span id="Plane_getRows">\u0627\u0644\u0635\u0641\u0648\u0641 (%1)</span><span id="Plane_rows1">\u0635\u0641\u0648\u0641 \u0627\u0644\u0637\u0628\u0642\u0629 \u0627\u0644\u0623\u0648\u0644\u0649: %1</span><span id="Plane_getRows1">\u0635\u0641\u0648\u0641 \u0627\u0644\u0637\u0628\u0642\u0629 \u0627\u0644\u0623\u0648\u0644\u0649 (%1)</span><span id="Plane_rows2">\u0635\u0641\u0648\u0641 \u0627\u0644\u0641\u0626\u0629 \u0627\u0644\u062B\u0627\u0646\u064A\u0629: %1</span><span id="Plane_getRows2">\u0635\u0641\u0648\u0641 \u0627\u0644\u0641\u0626\u0629 \u0627\u0644\u062B\u0627\u0646\u064A\u0629: (%1)</span><span id="Plane_seats">\u0627\u0644\u0645\u0642\u0627\u0639\u062F: %1</span><span id="Plane_placeholder">\u061F</span><span id="Plane_setSeats">\u0627\u0644\u0645\u0642\u0627\u0639\u062F =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">\u0622\u0644\u0629 \u062D\u0627\u0633\u0628\u0629 \u0644\u0645\u0642\u0639\u062F \u0627\u0644\u0637\u0627\u0626\u0631\u0629</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += '\u0647\u0646\u0627\u0644\u0643 \u0637\u0627\u0626\u0631\u0629 \u062A\u062D\u062A\u0648\u064A \u0639\u0644\u0649 \u0639\u062F\u062F \u0645\u0646 \u0635\u0641\u0648\u0641 \u0645\u0642\u0627\u0639\u062F \u0627\u0644\u0631\u0643\u0627\u0628. \u0643\u0644 \u0635\u0641 \u064A\u062D\u062A\u0648\u064A \u0639\u0644\u0649 \u0623\u0631\u0628\u0639\u0629 \u0645\u0642\u0627\u0639\u062F.'; - break; - case 2: - output += '\u0637\u0627\u0626\u0631\u0629 \u0628\u0645\u0642\u0639\u062F\u064A\u0646 \u0641\u064A \u0645\u0642\u0637\u0648\u0631\u0629 \u0627\u0644\u0637\u064A\u0651\u0627\u0631 (\u0644\u0644\u0637\u064A\u0627\u0631 \u0648\u0645\u0633\u0627\u0639\u062F\u0647) \u0648\u0639\u062F\u062F \u0645\u0646 \u0627\u0644\u0635\u0641\u0648\u0641 \u064A\u062D\u062A\u0648\u064A \u0643\u0644 \u0635\u0641 \u0639\u0644\u0649 \u0623\u0631\u0628\u0639\u0629 \u0645\u0642\u0627\u0639\u062F.'; - break; - case 3: - output += '\u0637\u0627\u0626\u0631\u0629 \u0628\u0645\u0642\u0639\u062F\u064A\u0646 \u0641\u064A \u0645\u0642\u0637\u0648\u0631\u0629 \u0627\u0644\u0637\u064A\u0651\u0627\u0631 (\u0644\u0644\u0637\u064A\u0627\u0631 \u0648\u0645\u0633\u0627\u0639\u062F\u0647) \u0648\u0639\u062F\u062F \u0645\u0646 \u0627\u0644\u0645\u0642\u0627\u0639\u062F \u0641\u064A \u0635\u0641\u0648\u0641 \u0627\u0644\u062F\u0631\u062C\u0629 \u0627\u0644\u0623\u0648\u0644\u0649 \u0648\u0627\u0644\u062B\u0627\u0646\u064A\u0629. \u0643\u0644 \u0635\u0641 \u0645\u0646 \u0635\u0641\u0648\u0641 \u0627\u0644\u062F\u0631\u062C\u0629 \u0627\u0644\u0623\u0648\u0644\u0649 \u064A\u062D\u062A\u0648\u064A \u0639\u0644\u0649 \u0623\u0631\u0628\u0639\u0629 \u0645\u0642\u0627\u0639\u062F. \u0648\u064A\u062D\u062A\u0648\u064A \u0643\u0644 \u0635\u0641 \u0641\u064A \u0627\u0644\u062F\u0631\u062C\u0629 \u0627\u0644\u062B\u0627\u0646\u064A\u0629 \u0639\u0644\u0649 \u062E\u0645\u0633\u0629 \u0645\u0642\u0627\u0639\u062F.'; - break; - } - output += '</p><p>\u0644\u0628\u0646\u0627\u0621 \u0635\u064A\u063A\u0629 (\u0623\u062F\u0646\u0627\u0647) \u062A\u0642\u0648\u0645 \u0628\u062D\u0633\u0627\u0628 \u0625\u062C\u0645\u0627\u0644\u064A \u0639\u062F\u062F \u0627\u0644\u0645\u0642\u0627\u0639\u062F \u0641\u064A \u0627\u0644\u0637\u0627\u0626\u0631\u0629 \u0639\u0646\u062F \u062A\u063A\u064A\u064A\u0631 \u0627\u0644\u0635\u0641\u0648\u0641 (\u0623\u0639\u0644\u0627\u0647).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/be-tarask.js b/res/lib/blockly/demos/plane/generated/be-tarask.js deleted file mode 100644 index 9fee77823e3576d40bb1c83143b12df756235d9c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/be-tarask.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">\u0420\u0430\u0434\u043A\u043E\u045E: %1</span><span id="Plane_getRows">\u0440\u0430\u0434\u043A\u043E\u045E (%1)</span><span id="Plane_rows1">\u0420\u0430\u0434\u043A\u0456 \u043F\u0435\u0440\u0448\u0430\u0433\u0430 \u043A\u043B\u044F\u0441\u0443: %1</span><span id="Plane_getRows1">\u0440\u0430\u0434\u043A\u0456 \u043F\u0435\u0440\u0448\u0430\u0433\u0430 \u043A\u043B\u044F\u0441\u0443 (%1)</span><span id="Plane_rows2">\u0420\u0430\u0434\u043A\u0456 \u0434\u0440\u0443\u0433\u043E\u0433\u0430 \u043A\u043B\u044F\u0441\u0443: %1</span><span id="Plane_getRows2">\u0440\u0430\u0434\u043A\u0456 \u0434\u0440\u0443\u0433\u043E\u0433\u0430 \u043A\u043B\u044F\u0441\u0443 (%1)</span><span id="Plane_seats">\u041C\u0435\u0441\u0446\u0430\u045E: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">\u043C\u0435\u0441\u0446\u0430\u045E =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">\u041A\u0430\u043B\u044C\u043A\u0443\u043B\u044F\u0442\u0430\u0440 \u043C\u0435\u0441\u0446\u0430\u045E \u0443 \u0441\u0430\u043C\u0430\u043B\u0451\u0446\u0435</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += '\u0421\u0430\u043C\u0430\u043B\u0451\u0442 \u043C\u0430\u0435 \u043D\u0435\u043A\u0430\u043B\u044C\u043A\u0456 \u0448\u044D\u0440\u0430\u0433\u0430\u045E \u043F\u0430\u0441\u0430\u0436\u044B\u0440\u0441\u043A\u0456\u0445 \u0441\u044F\u0434\u0437\u0435\u043D\u044C\u043D\u044F\u045E. \u041A\u043E\u0436\u043D\u0430\u044F \u0448\u044D\u0440\u0430\u0433 \u0443\u0442\u0440\u044B\u043C\u043B\u0456\u0432\u0430\u0435 \u0447\u0430\u0442\u044B\u0440\u044B \u043C\u0435\u0441\u0446\u044B.'; - break; - case 2: - output += '\u0421\u0430\u043C\u0430\u043B\u0451\u0442 \u043C\u0430\u0435 \u0434\u0432\u0430 \u043C\u0435\u0441\u0446\u044B \u045E \u043A\u0430\u0431\u0456\u043D\u0435 \u044D\u043A\u0456\u043F\u0430\u0436\u0430 (\u043F\u0456\u043B\u043E\u0442 \u0456 \u0434\u0440\u0443\u0433\u0456 \u043F\u0456\u043B\u043E\u0442), \u0456 \u043D\u0435\u043A\u0430\u043B\u044C\u043A\u0456 \u0448\u044D\u0440\u0430\u0433\u0430\u045E \u043F\u0430\u0441\u0430\u0436\u044B\u0440\u0441\u043A\u0456\u0445 \u0441\u044F\u0434\u0437\u0435\u043D\u044C\u043D\u044F\u045E. \u041A\u043E\u0436\u043D\u044B \u0448\u044D\u0440\u0430\u0433 \u0443\u0442\u0440\u044B\u043C\u043B\u0456\u0432\u0430\u0435 \u0447\u0430\u0442\u044B\u0440\u044B \u043C\u0435\u0441\u0446\u044B.'; - break; - case 3: - output += '\u0421\u0430\u043C\u0430\u043B\u0451\u0442 \u043C\u0430\u0435 \u0434\u0432\u0430 \u043C\u0435\u0441\u0446\u044B \u045E \u043A\u0430\u0431\u0456\u043D\u0435 \u044D\u043A\u0456\u043F\u0430\u0436\u0430 (\u043F\u0456\u043B\u043E\u0442 \u0456 \u0434\u0440\u0443\u0433\u0456 \u043F\u0456\u043B\u043E\u0442), \u0456 \u043D\u0435\u043A\u0430\u043B\u044C\u043A\u0456 \u043F\u0430\u0441\u0430\u0436\u044B\u0440\u0441\u043A\u0456\u0445 \u0448\u044D\u0440\u0430\u0433\u0430\u045E \u043C\u0435\u0441\u0446\u0430\u045E 1-\u0433\u0430 \u043A\u043B\u044F\u0441\u0430 \u0456 2-\u0433\u0430 \u043A\u043B\u044F\u0441\u0430. \u041A\u043E\u0436\u043D\u044B \u0448\u044D\u0440\u0430\u0433 1-\u0433\u0430 \u043A\u043B\u044F\u0441\u0430 \u0443\u0442\u0440\u044B\u043C\u043B\u0456\u0432\u0430\u0435 \u0447\u0430\u0442\u044B\u0440\u044B \u043C\u0435\u0441\u0446\u044B. \u041A\u043E\u0436\u043D\u044B \u0448\u044D\u0440\u0430\u0433 2-\u0433\u0430 \u043A\u043B\u044F\u0441\u0430 \u045E\u0442\u0440\u044B\u043C\u043B\u0456\u0432\u0430\u0435 \u043F\u044F\u0446\u044C \u043C\u0435\u0441\u0446\u0430\u045E.'; - break; - } - output += '</p><p>\u041F\u0430\u0431\u0443\u0434\u0430\u0432\u0430\u0446\u044C \u0444\u043E\u0440\u043C\u0443\u043B\u0443 (\u043D\u0456\u0436\u044D\u0439), \u044F\u043A\u0430\u044F \u043F\u0430\u0434\u043B\u0456\u0447\u0432\u0430\u0435 \u0430\u0433\u0443\u043B\u044C\u043D\u0443\u044E \u043A\u043E\u043B\u044C\u043A\u0430\u0441\u044C\u0446\u044C \u043C\u0435\u0441\u0446\u0430\u045E \u0443 \u0441\u0430\u043C\u0430\u043B\u0451\u0446\u0435 \u043F\u0440\u044B \u0437\u044C\u043C\u0435\u043D\u0435 \u0440\u0430\u0434\u043E\u045E (\u0433\u043B. \u0432\u044B\u0448\u044D\u0439).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/br.js b/res/lib/blockly/demos/plane/generated/br.js deleted file mode 100644 index 9722c6ea2401ebf2a4d6fc090af1ed5ab8edf80c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/br.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Renkennado\u00F9 : %1</span><span id="Plane_getRows">renkennado\u00F9 (%1)</span><span id="Plane_rows1">Renkennado\u00F9 kenta\u00F1 klas : %1</span><span id="Plane_getRows1">Renkennado\u00F9 kenta\u00F1 klas (%1)</span><span id="Plane_rows2">Renkennado\u00F9 eil klas : %1</span><span id="Plane_getRows2">Renkennado\u00F9 eil klas (%1)</span><span id="Plane_seats">Azezenno\u00F9 : %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">azezenno\u00F9 =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Jederez azezenn nijerez</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Un nijerez he deus un toullad renkennado\u00F9 azezenno\u00F9 evit ar veajourien. Peder azezenn a zo e pep renkennad.'; - break; - case 2: - output += 'En un nijerez ez eus div azezenn el logell levia\u00F1(evit al loman hag an eil loman), hag ur toullad renkennado\u00F9 azezenno\u00F9 evit an dremenidi. Peder azezenn zo e pep renkennad.'; - break; - case 3: - output += 'En un nijerez ez eus div azezenn el logell levia\u00F1(evit al loman hag an eil loman), hag un toullad renkennado\u00F9 azezenno\u00F9 tremenidi kenta\u00F1 hag eil klas. Peder azezenn zo e pep renkennad kenta\u00F1 klas. Pemp azezenn zo e pemp renkennad eil klas.'; - break; - } - output += '</p><p>Sevel ur formulenn (ama\u00F1 dindan) evit jedi\u00F1 an niver a azezenno\u00F9 en holl en nijerez pa vez kemmet an niver a renkennado\u00F9 (ama\u00F1 a-us).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/ca.js b/res/lib/blockly/demos/plane/generated/ca.js deleted file mode 100644 index 9f2808c682f46e4e6b1da9610be9a9f5d2b1bcb5..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/ca.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Files: %1</span><span id="Plane_getRows">files (%1)</span><span id="Plane_rows1">files de primera classe: %1</span><span id="Plane_getRows1">files de primera classe (%1)</span><span id="Plane_rows2">files de segona classe: %1</span><span id="Plane_getRows2">files de segona classe (%1)</span><span id="Plane_seats">Seients: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">seients =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Calculadora de seients d\'avi\u00F3</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Un avi\u00F3 t\u00E9 un nombre de files de seients de passatgers. Cada fila cont\u00E9 quatre seients.'; - break; - case 2: - output += 'Un avi\u00F3 t\u00E9 dos seients en la cabina de vol (pel pilot i pel copilot) i un nombre de files de seients de passatgers. Cada fila cont\u00E9 quatre seients.'; - break; - case 3: - output += 'Un avi\u00F3 t\u00E9 dos seients en la cabina de vol (pel pilot i copilot) i un nombre de files per seients de passatgers de primera classe i de segona classe. Cada fila de primera classe cont\u00E9 quatre seients. Cada fila de segona classe cont\u00E9 cinc seients.'; - break; - } - output += '</p><p>Constru\u00EFu una f\u00F3rmula (a sota) que calculi el nombre total de seients de l\'avi\u00F3 a mida que canvi\u00EFn les files (a dalt).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/da.js b/res/lib/blockly/demos/plane/generated/da.js deleted file mode 100644 index beed51a55683489b10ea9f0ee5c686a4af5dca34..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/da.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">R\u00E6kker: %1</span><span id="Plane_getRows">r\u00E6kker (%1)</span><span id="Plane_rows1">1. klasse r\u00E6kker: %1</span><span id="Plane_getRows1">1. klasse r\u00E6kker (%1)</span><span id="Plane_rows2">2. klasse r\u00E6kker: %1</span><span id="Plane_getRows2">2. klasse r\u00E6kker (%1)</span><span id="Plane_seats">S\u00E6der: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">s\u00E6der =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Flys\u00E6delommeregner</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Et fly har et antal r\u00E6kker af passagers\u00E6der. Hver r\u00E6kke indeholder fire s\u00E6der.'; - break; - case 2: - output += 'Et fly har to pladser i cockpittet (til pilot og med-pilot), og et antal r\u00E6kker af passagers\u00E6der. Hver r\u00E6kke indeholder fire s\u00E6der.'; - break; - case 3: - output += 'Et fly har to pladser i cockpittet (til pilot og med-pilot), og et antal r\u00E6kker af 1. klasses og 2. klasses passagers\u00E6der. Hver 1. klasses r\u00E6kke indeholder fire s\u00E6der. Hver 2. klasses r\u00E6kke indeholder fem s\u00E6der.'; - break; - } - output += '</p><p>Opbyg en formel (nedenfor), der beregner det samlede antal pladser p\u00E5 flyet, hvis antal r\u00E6kker \u00E6ndres (ovenfor).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/de.js b/res/lib/blockly/demos/plane/generated/de.js deleted file mode 100644 index edff1dc36e8467fec9eeec211eda777afd93790b..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/de.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Reihen: %1</span><span id="Plane_getRows">Reihen (%1)</span><span id="Plane_rows1">Reihen der 1. Klasse: %1</span><span id="Plane_getRows1">Reihen der 1. Klasse (%1)</span><span id="Plane_rows2">Reihen der 2. Klasse: %1</span><span id="Plane_getRows2">Reihen der 2. Klasse (%1)</span><span id="Plane_seats">Sitze: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">Sitze =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Flugzeugsitzrechner</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Ein Flugzeug hat eine Anzahl an Reihen mit Passagiersitzen. Jede Reihe enth\u00E4lt vier Sitze.'; - break; - case 2: - output += 'Ein Flugzeug hat zwei Sitze im Pilotenstand (f\u00FCr den Piloten und Co-Piloten) und eine Anzahl an Reihen mit Passagiersitzen. Jede Reihe enth\u00E4lt vier Sitze.'; - break; - case 3: - output += 'Ein Flugzeug hat zwei Sitze im Pilotenstand (f\u00FCr den Piloten und Co-Piloten) und eine Anzahl an Reihen mit Passagiersitzen der 1. und 2. Klasse. Jede 1.-Klasse-Reihe enth\u00E4lt vier Sitze. Jede 2.-Klasse-Reihe enth\u00E4lt f\u00FCnf Sitze.'; - break; - } - output += '</p><p>Erstelle eine Formel (unten), die die gesamte Anzahl an Sitzen im Flugzeug berechnet, wenn die Reihen (oben) ge\u00E4ndert werden.</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/el.js b/res/lib/blockly/demos/plane/generated/el.js deleted file mode 100644 index 451d5e57a7894e8902058f52b22027d8401fa20f..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/el.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">\u03A3\u03B5\u03B9\u03C1\u03AD\u03C2: %1</span><span id="Plane_getRows">\u03C3\u03B5\u03B9\u03C1\u03AD\u03C2 (%1)</span><span id="Plane_rows1">\u03A3\u03B5\u03B9\u03C1\u03AD\u03C2 1\u03B7\u03C2 \u03B8\u03AD\u03C3\u03B7\u03C2: %1</span><span id="Plane_getRows1">\u03A3\u03B5\u03B9\u03C1\u03AD\u03C2 1\u03B7\u03C2 \u03B8\u03AD\u03C3\u03B7\u03C2 (%1)</span><span id="Plane_rows2">\u03A3\u03B5\u03B9\u03C1\u03AD\u03C2 2\u03B7\u03C2 \u03B8\u03AD\u03C3\u03B7\u03C2: %1</span><span id="Plane_getRows2">\u03A3\u03B5\u03B9\u03C1\u03AD\u03C2 2\u03B7\u03C2 \u03B8\u03AD\u03C3\u03B7\u03C2 (%1)</span><span id="Plane_seats">\u039A\u03B1\u03B8\u03AF\u03C3\u03BC\u03B1\u03C4\u03B1: %1</span><span id="Plane_placeholder">;</span><span id="Plane_setSeats">\u03BA\u03B1\u03B8\u03AF\u03C3\u03BC\u03B1\u03C4\u03B1 =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">\u03A5\u03C0\u03BF\u03BB\u03BF\u03B3\u03B9\u03C3\u03BC\u03CC\u03C2 \u0398\u03AD\u03C3\u03B5\u03C9\u03BD \u03A3\u03B5 \u0391\u03B5\u03C1\u03BF\u03C0\u03BB\u03AC\u03BD\u03BF</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += '\u0388\u03BD\u03B1 \u03B1\u03B5\u03C1\u03BF\u03C0\u03BB\u03AC\u03BD\u03BF \u03AD\u03C7\u03B5\u03B9 \u03AD\u03BD\u03B1\u03BD \u03C3\u03C5\u03B3\u03BA\u03B5\u03BA\u03C1\u03B9\u03BC\u03AD\u03BD\u03BF \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC \u03C3\u03B5\u03B9\u03C1\u03CE\u03BD \u03BA\u03B1\u03B8\u03B9\u03C3\u03BC\u03AC\u03C4\u03C9\u03BD \u03B5\u03C0\u03B9\u03B2\u03B1\u03C4\u03CE\u03BD. \u039A\u03AC\u03B8\u03B5 \u03C3\u03B5\u03B9\u03C1\u03AC \u03AD\u03C7\u03B5\u03B9 \u03C4\u03AD\u03C3\u03C3\u03B5\u03C1\u03B1 \u03BA\u03B1\u03B8\u03AF\u03C3\u03BC\u03B1\u03C4\u03B1.'; - break; - case 2: - output += '\u0388\u03BD\u03B1 \u03B1\u03B5\u03C1\u03BF\u03C0\u03BB\u03AC\u03BD\u03BF \u03AD\u03C7\u03B5\u03B9 \u03B4\u03CD\u03BF \u03BA\u03B1\u03B8\u03AF\u03C3\u03BC\u03B1\u03C4\u03B1 \u03C3\u03C4\u03BF\u03BD \u03B8\u03AC\u03BB\u03B1\u03BC\u03BF \u03B4\u03B9\u03B1\u03BA\u03C5\u03B2\u03AD\u03C1\u03BD\u03B7\u03C3\u03B7\u03C2 (\u03B3\u03B9\u03B1 \u03C4\u03BF\u03BD \u03BA\u03C5\u03B2\u03B5\u03C1\u03BD\u03AE\u03C4\u03B7 \u03BA\u03B1\u03B9 \u03C4\u03BF\u03BD \u03C3\u03C5\u03B3\u03BA\u03C5\u03B2\u03B5\u03C1\u03BD\u03AE\u03C4\u03B7), \u03BA\u03B1\u03B8\u03CE\u03C2 \u03BA\u03B1\u03B9 \u03AD\u03BD\u03B1\u03BD \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC \u03B1\u03C0\u03CC \u03C3\u03B5\u03B9\u03C1\u03AD\u03C2 \u03BA\u03B1\u03B8\u03B9\u03C3\u03BC\u03AC\u03C4\u03C9\u03BD \u03B5\u03C0\u03B9\u03B2\u03B1\u03C4\u03CE\u03BD. \u039A\u03AC\u03B8\u03B5 \u03C3\u03B5\u03B9\u03C1\u03AC \u03AD\u03C7\u03B5\u03B9 \u03C4\u03AD\u03C3\u03C3\u03B5\u03C1\u03B1 \u03BA\u03B1\u03B8\u03AF\u03C3\u03BC\u03B1\u03C4\u03B1.'; - break; - case 3: - output += '\u0388\u03BD\u03B1 \u03B1\u03B5\u03C1\u03BF\u03C0\u03BB\u03AC\u03BD\u03BF \u03AD\u03C7\u03B5\u03B9 \u03B4\u03CD\u03BF \u03BA\u03B1\u03B8\u03AF\u03C3\u03BC\u03B1\u03C4\u03B1 \u03C3\u03C4\u03BF\u03BD \u03B8\u03AC\u03BB\u03B1\u03BC\u03BF \u03B4\u03B9\u03B1\u03BA\u03C5\u03B2\u03AD\u03C1\u03BD\u03B7\u03C3\u03B7\u03C2 (\u03B3\u03B9\u03B1 \u03C4\u03BF\u03BD \u03BA\u03C5\u03B2\u03B5\u03C1\u03BD\u03AE\u03C4\u03B7 \u03BA\u03B1\u03B9 \u03C4\u03BF\u03BD \u03C3\u03C5\u03B3\u03BA\u03C5\u03B2\u03B5\u03C1\u03BD\u03AE\u03C4\u03B7), \u03BA\u03B1\u03B8\u03CE\u03C2 \u03BA\u03B1\u03B9 \u03AD\u03BD\u03B1\u03BD \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC \u03C3\u03B5\u03B9\u03C1\u03CE\u03BD \u03BA\u03B1\u03B8\u03B9\u03C3\u03BC\u03AC\u03C4\u03C9\u03BD \u03B3\u03B9\u03B1 \u03C4\u03B7\u03BD 1\u03B7 \u03BA\u03B1\u03B9 2\u03B7 \u03B8\u03AD\u03C3\u03B7. \u039A\u03AC\u03B8\u03B5 \u03C3\u03B5\u03B9\u03C1\u03AC \u03C4\u03B7\u03C2 1\u03B7\u03C2 \u03B8\u03AD\u03C3\u03B7\u03C2 \u03AD\u03C7\u03B5\u03B9 \u03C4\u03AD\u03C3\u03C3\u03B5\u03C1\u03B1 \u03BA\u03B1\u03B8\u03AF\u03C3\u03BC\u03B1\u03C4\u03B1 \u03BA\u03B1\u03B9 \u03BA\u03AC\u03B8\u03B5 \u03C3\u03B5\u03B9\u03C1\u03AC \u03C4\u03B7\u03C2 2\u03B7\u03C2 \u03B8\u03AD\u03C3\u03B7\u03C2 \u03AD\u03C7\u03B5\u03B9 \u03C0\u03AD\u03BD\u03C4\u03B5 \u03BA\u03B1\u03B8\u03AF\u03C3\u03BC\u03B1\u03C4\u03B1.'; - break; - } - output += '</p><p>\u03A6\u03C4\u03B9\u03AC\u03BE\u03B5 \u03AD\u03BD\u03B1\u03BD \u03C4\u03CD\u03C0\u03BF (\u03BA\u03AC\u03C4\u03C9) \u03C0\u03BF\u03C5 \u03B8\u03B1 \u03C5\u03C0\u03BF\u03BB\u03BF\u03B3\u03AF\u03B6\u03B5\u03B9 \u03C4\u03BF\u03BD \u03C3\u03C5\u03BD\u03BF\u03BB\u03B9\u03BA\u03CC \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC \u03BA\u03B1\u03B8\u03B9\u03C3\u03BC\u03AC\u03C4\u03C9\u03BD \u03C4\u03BF\u03C5 \u03B1\u03B5\u03C1\u03BF\u03C0\u03BB\u03AC\u03BD\u03BF\u03C5 \u03BA\u03B1\u03B8\u03CE\u03C2 \u03B1\u03BB\u03BB\u03AC\u03B6\u03BF\u03C5\u03BD \u03BF\u03B9 \u03C3\u03B5\u03B9\u03C1\u03AD\u03C2 (\u03C0\u03AC\u03BD\u03C9).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/en.js b/res/lib/blockly/demos/plane/generated/en.js deleted file mode 100644 index 016b8443644c417538e5a7abf53a1c162e8fc676..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/en.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Rows: %1</span><span id="Plane_getRows">rows (%1)</span><span id="Plane_rows1">1st class rows: %1</span><span id="Plane_getRows1">1st class rows (%1)</span><span id="Plane_rows2">2nd class rows: %1</span><span id="Plane_getRows2">2nd class rows (%1)</span><span id="Plane_seats">Seats: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">seats =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Plane Seat Calculator</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'An airplane has a number of rows of passenger seats. Each row contains four seats.'; - break; - case 2: - output += 'An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.'; - break; - case 3: - output += 'An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.'; - break; - } - output += '</p><p>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/es.js b/res/lib/blockly/demos/plane/generated/es.js deleted file mode 100644 index a565218c818dcea907242e2b608c6b3950c75db9..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/es.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Filas: %1</span><span id="Plane_getRows">filas (%1)</span><span id="Plane_rows1">Filas de primera clase: %1</span><span id="Plane_getRows1">Filas de primera clase: (%1)</span><span id="Plane_rows2">Filas de segunda clase: %1</span><span id="Plane_getRows2">Filas de segunda clase: (%1)</span><span id="Plane_seats">Asientos: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">asientos =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Calculadora de asientos de avi\u00F3n</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Un avi\u00F3n\u00A0 tiene un n\u00FAmero de filas de asientos de pasajeros. Cada fila contiene cuatro asientos.'; - break; - case 2: - output += 'Un avi\u00F3n tiene dos asientos en la cabina de vuelo (para el piloto y co-piloto), y un n\u00FAmero de filas de asientos de pasajeros. Cada fila contiene cuatro asientos.'; - break; - case 3: - output += 'Un avi\u00F3n tiene dos asientos en la cabina de vuelo (para el piloto y co-piloto), y un n\u00FAmero de filas de asientos para pasajeros de primera y segunda clase. Cada fila de la primera clase contiene cuatro asientos. Cada fila de la segunda clase contiene cinco asientos.'; - break; - } - output += '</p><p>Construir una f\u00F3rmula (abajo) que calcule el n\u00FAmero total de asientos en el avi\u00F3n cuando las filas sean cambiadas (arriba).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/et.js b/res/lib/blockly/demos/plane/generated/et.js deleted file mode 100644 index 069c7cb2804ae262132a8ac8fe86098c87e6f35d..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/et.js +++ /dev/null @@ -1,37 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Ridu: %1</span><span id="Plane_getRows">rows (%1)</span><span id="Plane_rows1">1. klassi ridu: %1</span><span id="Plane_getRows1">1. klassi ridu (%1)</span><span id="Plane_rows2">2. klassi ridu: %1</span><span id="Plane_getRows2">2. klassi ridu (%1)</span><span id="Plane_seats">Istmeid: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">istmete arv =</span></div>'; -}; - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Lennukiistmete kalkulaator</span> '; - var iLimit37 = opt_ijData.maxLevel + 1; - for (var i37 = 1; i37 < iLimit37; i37++) { - output += ' ' + ((i37 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i37) + '</span>' : (i37 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i37) + '">' + soy.$$escapeHtml(i37) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i37) + '">' + soy.$$escapeHtml(i37) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Lennukis on reisijate istmed mitmes reas. Igas reas on neli istet.'; - break; - case 2: - output += 'Lennuki kokpitis on kaks istet (üks kummalegi piloodile) ja mingi arv istemridu reisijatele. Igas reas on neli istet.'; - break; - case 3: - output += 'Lennuki kokpitis on kaks istet (üks kummalegi piloodile), mingi arv ridu 1. klassi reisijatele ja mingi arv ridu 2. klassi reisijatele. Igas 1. klassi reas on neli istet, igas 2. klassi reas viis istet.'; - break; - } - output += '</p><p>Ehita plokkidest valem, mis arvutab istmete arvu lennukis õigesti sõltumata ridade arvust (seda saad muuta lennuki juures oleva liuguriga).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; diff --git a/res/lib/blockly/demos/plane/generated/fa.js b/res/lib/blockly/demos/plane/generated/fa.js deleted file mode 100644 index d29a9db9719f89097615a60515ed14e0a71b3ebc..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/fa.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">\u0631\u062F\u06CC\u0641: %1</span><span id="Plane_getRows">\u0631\u062F\u06CC\u0641\u200C\u0647\u0627 (%1)</span><span id="Plane_rows1">\u0627\u0648\u0644\u06CC\u0646 \u0631\u062F\u06CC\u0641 \u06A9\u0644\u0627\u0633: %1</span><span id="Plane_getRows1">\u0627\u0648\u0644\u06CC\u0646 \u06A9\u0644\u0627\u0633 \u0631\u062F\u06CC\u0641\u200C\u0647\u0627 (%1)</span><span id="Plane_rows2">\u062F\u0648\u0645\u06CC\u0646 \u06A9\u0644\u0627\u0633 \u0631\u062F\u06CC\u0641: %1</span><span id="Plane_getRows2">\u062F\u0648\u0645\u06CC\u0646 \u06A9\u0644\u0627\u0633 \u0631\u062F\u06CC\u0641\u200C\u0647\u0627 (%1)</span><span id="Plane_seats">\u0635\u0646\u062F\u0644\u06CC\u200C\u0647\u0627: %1</span><span id="Plane_placeholder">\u061F</span><span id="Plane_setSeats">\u0635\u0646\u062F\u0644\u06CC\u200C\u0647\u0627 =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">\u0645\u062D\u0627\u0633\u0628\u0647\u200C\u06AF\u0631 \u0635\u0646\u062F\u0644\u06CC\u200C\u0647\u0627\u06CC \u0647\u0648\u0627\u067E\u06CC\u0645\u0627</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += '\u06CC\u06A9 \u0647\u0648\u0627\u067E\u06CC\u0645\u0627 \u062A\u0639\u062F\u0627\u062F \u0627\u0632 \u0635\u0646\u062F\u0644\u06CC\u200C\u0647\u0627\u06CC \u0645\u0633\u0627\u0641\u0631\u06CC\u0646 \u0631\u0627 \u062F\u0627\u0631\u062F. \u0647\u0631 \u0631\u062F\u06CC\u0641 \u0634\u0645\u0627\u0644 \u0686\u0647\u0627\u0631 \u0635\u0646\u062F\u0644\u06CC \u0627\u0633\u062A.'; - break; - case 2: - output += '\u06CC\u06A9 \u0647\u0648\u0627\u067E\u06CC\u0645\u0627 \u062F\u0648 \u0635\u0646\u062F\u0644\u06CC \u062F\u0631 \u0639\u0631\u0634\u0647\u0654 \u067E\u0631\u0648\u0627\u0632 \u062F\u0627\u0631\u062F (\u0628\u0631\u0627\u06CC \u062E\u0644\u0628\u0627\u0646 \u0648 \u06A9\u0645\u06A9 \u062E\u0644\u0628\u0627\u0646) \u0648 \u062A\u0639\u062F\u0627\u062F\u06CC \u0635\u0646\u062F\u0644\u06CC \u0645\u0633\u0627\u0641\u0631\u06CC\u0646. \u0647\u0631 \u0631\u062F\u06CC\u0641 \u0634\u0627\u0645\u0644 \u0686\u0647\u0627\u0631 \u0635\u0646\u062F\u0644\u06CC \u0627\u0633\u062A.'; - break; - case 3: - output += '\u06CC\u06A9 \u0647\u0648\u0627\u067E\u06CC\u0645\u0627 \u062F\u0648 \u0635\u0646\u062F\u0644\u06CC \u062F\u0631 \u06A9\u0627\u0628\u06CC\u0646 \u062E\u0644\u0628\u0627\u0646 \u062F\u0627\u0631\u062F (\u0628\u0631\u0627\u06CC \u062E\u0644\u0628\u0627\u0646 \u0648 \u06A9\u0645\u06A9 \u062E\u0644\u0628\u0627\u0646) \u0648 \u062A\u0647\u062F\u0627\u062F \u0627\u0632 \u0635\u0646\u062F\u0644\u06CC\u200C\u0647\u0627 \u0645\u0633\u0627\u0641\u0631\u06CC\u0646 \u062F\u0631\u062C\u0647 \u06CC\u06A9 \u0648 \u062F\u0631\u062C\u0647 \u062F\u0648. \u0647\u0631 \u0631\u062F\u06CC\u0641 \u062F\u0631\u062C\u0647 \u06CC\u06A9 \u0634\u0627\u0645\u0644 \u0686\u0647\u0627\u0631 \u0635\u0646\u062F\u0644\u06CC \u0627\u0633\u062A. \u0647\u0631 \u0631\u062F\u06CC\u0641 \u062F\u0631\u062C\u0647 \u062F\u0648 \u0634\u0627\u0645\u0644 \u067E\u0646\u062C \u0635\u0646\u062F\u0644\u06CC \u0627\u0633\u062A.'; - break; - } - output += '</p><p>\u06CC\u06A9 \u0641\u0631\u0645\u0648\u0644 \u0628\u0633\u0627\u0632\u06CC\u062F (\u067E\u0627\u06CC\u06CC\u0646) \u06A9\u0647 \u062A\u0639\u062F\u0627\u062F \u06A9\u0644 \u0635\u0646\u062F\u0644\u06CC\u200C\u0647\u0627\u06CC \u0647\u0648\u0627\u067E\u06CC\u0645\u0627 \u0628\u0627 \u062A\u063A\u06CC\u06CC\u0631 \u0631\u062F\u06CC\u0641 \u0631\u0627 \u062D\u0633\u0627\u0628 \u06A9\u0646\u062F (\u0628\u0627\u0644\u0627).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/fr.js b/res/lib/blockly/demos/plane/generated/fr.js deleted file mode 100644 index df3ae46fde733d331cbcc371ac85720cd1fb0ce7..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/fr.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Rang\u00E9es : %1</span><span id="Plane_getRows">rang\u00E9es (%1)</span><span id="Plane_rows1">rang\u00E9es de premi\u00E8re classe : %1</span><span id="Plane_getRows1">rang\u00E9es de premi\u00E8re classe (%1)</span><span id="Plane_rows2">rang\u00E9es de seconde classe : %1</span><span id="Plane_getRows2">rang\u00E9es de seconde classe (%1)</span><span id="Plane_seats">Si\u00E8ges : %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">si\u00E8ges =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Calculateur de si\u00E8ges d\u2019avion</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Un avion a un nombre de rang\u00E9es de si\u00E8ges passager. Chaque rang\u00E9e contient quatre si\u00E8ges.'; - break; - case 2: - output += 'Un avion a deux si\u00E8ges dans le poste de pilotage (pour le pilote et le copilote), et un certain nombre de rang\u00E9es de si\u00E8ges passager. Chaque rang\u00E9e contient quatre si\u00E8ges.'; - break; - case 3: - output += 'Un avion a deux si\u00E8ges dans la cabine de pilotage (pour le pilote et le copilote), et un certain nombre de rang\u00E9es de si\u00E8ges passager de premi\u00E8re et seconde classes. Chaque rang\u00E9e de premi\u00E8re classe contient quatre si\u00E8ges. Chaque rang\u00E9e de seconde classe contient cinq si\u00E8ges.'; - break; - } - output += '</p><p>Construire une formule (ci-dessous) qui calcule le nombre total de si\u00E8ges dans l\u2019avion quand le nombre de rang\u00E9es est modifi\u00E9 (ci-dessus).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/he.js b/res/lib/blockly/demos/plane/generated/he.js deleted file mode 100644 index 1a4050b0f5c8eba86cb4da2fb73325e8eef69019..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/he.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">\u05E9\u05D5\u05E8\u05D5\u05EA: %1</span><span id="Plane_getRows">\u05E9\u05D5\u05E8\u05D5\u05EA (%1)</span><span id="Plane_rows1">\u05E9\u05D5\u05E8\u05D5\u05EA \u05D1\u05DE\u05D7\u05DC\u05E7\u05D4 \u05E8\u05D0\u05E9\u05D5\u05E0\u05D4: %1</span><span id="Plane_getRows1">\u05E9\u05D5\u05E8\u05D5\u05EA \u05D1\u05DE\u05D7\u05DC\u05E7\u05D4 \u05E8\u05D0\u05E9\u05D5\u05E0\u05D4 (%1)</span><span id="Plane_rows2">\u05E9\u05D5\u05E8\u05D5\u05EA \u05D1\u05DE\u05D7\u05DC\u05E7\u05D4 \u05E9\u05E0\u05D9\u05D9\u05D4: %1</span><span id="Plane_getRows2">\u05E9\u05D5\u05E8\u05D5\u05EA \u05D1\u05DE\u05D7\u05DC\u05E7\u05D4 \u05E9\u05E0\u05D9\u05D9\u05D4: (%1)</span><span id="Plane_seats">\u05DE\u05D5\u05E9\u05D1\u05D9\u05DD: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">\u05DE\u05D5\u05E9\u05D1\u05D9\u05DD =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">\u05DE\u05D7\u05E9\u05D1\u05D5\u05DF \u05DE\u05D5\u05E9\u05D1 \u05D1\u05DE\u05D8\u05D5\u05E1</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += '\u05D1\u05DE\u05D8\u05D5\u05E1 \u05D9\u05E9 \u05DE\u05E1\u05E4\u05E8 \u05E9\u05D5\u05E8\u05D5\u05EA \u05E2\u05DD \u05DE\u05D5\u05E9\u05D1\u05D9 \u05E0\u05D5\u05E1\u05E2\u05D9\u05DD. \u05D1\u05DB\u05DC \u05E9\u05D5\u05E8\u05D4 \u05D9\u05E9 \u05D0\u05E8\u05D1\u05E2\u05D4 \u05DE\u05D5\u05E9\u05D1\u05D9\u05DD.'; - break; - case 2: - output += '\u05D1\u05DE\u05D8\u05D5\u05E1 \u05D9\u05E9 \u05E9\u05E0\u05D9 \u05DE\u05D5\u05E9\u05D1\u05D9\u05DD \u05E2\u05D1\u05D5\u05E8 \u05D4\u05E6\u05D5\u05D5\u05EA (\u05D1\u05E9\u05D1\u05D9\u05DC \u05D4\u05D8\u05D9\u05D9\u05E1 \u05D5\u05D8\u05D9\u05D9\u05E1 \u05D4\u05DE\u05E9\u05E0\u05D4), \u05D5\u05DE\u05E1\u05E4\u05E8 \u05E9\u05D5\u05E8\u05D5\u05EA \u05E2\u05DD \u05DE\u05D5\u05E9\u05D1\u05D9 \u05E0\u05D5\u05E1\u05E2\u05D9\u05DD. \u05D1\u05DB\u05DC \u05E9\u05D5\u05E8\u05D4 \u05D9\u05E9 \u05D0\u05E8\u05D1\u05E2\u05D4 \u05DE\u05D5\u05E9\u05D1\u05D9\u05DD.'; - break; - case 3: - output += '\u05D1\u05DE\u05D8\u05D5\u05E1 \u05D9\u05E9 \u05E9\u05E0\u05D9 \u05DE\u05D5\u05E9\u05D1\u05D9\u05DD \u05E2\u05D1\u05D5\u05E8 \u05D4\u05E6\u05D5\u05D5\u05EA (\u05D1\u05E9\u05D1\u05D9\u05DC \u05D4\u05D8\u05D9\u05D9\u05E1 \u05D5\u05D8\u05D9\u05D9\u05E1 \u05D4\u05DE\u05E9\u05E0\u05D4), \u05D5\u05DE\u05E1\u05E4\u05E8 \u05E9\u05D5\u05E8\u05D5\u05EA \u05DE\u05D5\u05E9\u05D1\u05D9\u05DD \u05D1\u05DE\u05D7\u05DC\u05E7\u05EA \u05D4\u05E0\u05D5\u05E1\u05E2\u05D9\u05DD \u05D4\u05E8\u05D0\u05E9\u05D5\u05E0\u05D4 \u05D5\u05D1\u05DE\u05D7\u05DC\u05E7\u05EA \u05D4\u05E0\u05D5\u05E1\u05E2\u05D9\u05DD \u05D4\u05E9\u05E0\u05D9\u05D9\u05D4. \u05DB\u05DC \u05E9\u05D5\u05E8\u05D4 \u05D1\u05DE\u05D7\u05DC\u05E7\u05D4 \u05D4\u05E8\u05D0\u05E9\u05D5\u05E0\u05D4 \u05DE\u05DB\u05D9\u05DC\u05D4 \u05D0\u05E8\u05D1\u05E2\u05D4 \u05DE\u05D5\u05E9\u05D1\u05D9\u05DD. \u05DB\u05DC \u05E9\u05D5\u05E8\u05D4 \u05D1\u05DE\u05D7\u05DC\u05E7\u05D4 \u05D4\u05E9\u05E0\u05D9\u05D9\u05D4 \u05DE\u05DB\u05D9\u05DC\u05D4 \u05D7\u05DE\u05D9\u05E9\u05D4 \u05DE\u05D5\u05E9\u05D1\u05D9\u05DD.'; - break; - } - output += '</p><p>\u05D1\u05E0\u05D4 \u05E0\u05D5\u05E1\u05D7\u05D4 (\u05DC\u05DE\u05D8\u05D4) \u05D0\u05E9\u05E8 \u05EA\u05D7\u05E9\u05D1 \u05D0\u05EA \u05E1\u05DA \u05DB\u05DC \u05D4\u05DE\u05D5\u05E9\u05D1\u05D9\u05DD \u05D1\u05DE\u05D8\u05D5\u05E1 \u05D1\u05D4\u05EA\u05D0\u05DD \u05DC\u05E9\u05D9\u05E0\u05D5\u05D9 \u05DE\u05E1\u05E4\u05E8 \u05D4\u05E9\u05D5\u05E8\u05D5\u05EA (\u05DC\u05DE\u05E2\u05DC\u05D4).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/hrx.js b/res/lib/blockly/demos/plane/generated/hrx.js deleted file mode 100644 index 981fa7197f2c85043f99f7759ba66fd389fab058..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/hrx.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Reihe: %1</span><span id="Plane_getRows">Reihe (%1)</span><span id="Plane_rows1">Reihe von der 1. Klasse: %1</span><span id="Plane_getRows1">Reihe von der 1. Klasse (%1)</span><span id="Plane_rows2">Reihe von der 2. Klasse: %1</span><span id="Plane_getRows2">Reihe von der 2. Klasse (%1)</span><span id="Plane_seats">Sitz: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">Sitze =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Fluchzeichsitzrechner</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'En Fluchzeich hot en Oonzohl an Reihe mit Passagiersitze. Jede Reih enth\u00E4lt vier Sitze.'; - break; - case 2: - output += 'En Fluchzeich hot zwooi Sitze im Pilotestand (f\u00FCr den Pilot und Co-Pilot) und en Oonzohl an Reihe mit Passagiersitze. Jede Reih enth\u00E4lt vier Sitze.'; - break; - case 3: - output += 'En Fluchzeich hot zwooi Sitze im Pilotstand (f\u00FCr den Pilot und Co-Pilot) und en Oonzohl an Reihe mit Passagiersitze der 1. und 2. Klasse. Jede 1.-Klasse-Reih enth\u00E4lt vier Sitze. Jede 2.-Klasse-Reih enth\u00E4lt f\u00FCnf Sitze.'; - break; - } - output += '</p><p>Erstell en Formel (unne), die die gesamte Oonzohl an Sitze im Fluchzeich berechnet, wenn die Reihe (uwe) ge\u00E4nnert sin.</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/hu.js b/res/lib/blockly/demos/plane/generated/hu.js deleted file mode 100644 index 9717cdee7cd1d34bb9007d384c8cf77032b3e6d4..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/hu.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Sorok sz\u00E1ma: %1</span><span id="Plane_getRows">Sorok sz\u00E1ma (%1)</span><span id="Plane_rows1">1. oszt\u00E1ly: %1 sor</span><span id="Plane_getRows1">1. oszt\u00E1ly sorai (%1)</span><span id="Plane_rows2">2. oszt\u00E1ly: %1 sor</span><span id="Plane_getRows2">2. oszt\u00E1ly sorai (%1)</span><span id="Plane_seats">\u00DCl\u00E9sek sz\u00E1ma \u00F6sszesen: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">\u00DCl\u00E9sek sz\u00E1ma =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Rep\u00FCl\u0151g\u00E9p alkalmaz\u00E1s</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Egy rep\u00FCl\u0151g\u00E9pen az utasok t\u00F6bb sorban \u00FClnek az utast\u00E9rben. Az utast\u00E9r minden sor\u00E1ban n\u00E9gy sz\u00E9k van.'; - break; - case 2: - output += 'Egy rep\u00FCl\u0151g\u00E9pnek 2 \u00FCl\u00E9se van a pil\u00F3taf\u00FClk\u00E9ben (a pil\u00F3t\u00E1nak \u00E9s a m\u00E1sodpil\u00F3t\u00E1nak), az utasok t\u00F6bb sorban \u00FClnek az utast\u00E9rben. Az utast\u00E9r minden sor\u00E1ban n\u00E9gy sz\u00E9k van.'; - break; - case 3: - output += 'Egy rep\u00FCl\u0151g\u00E9pnek 2 \u00FCl\u00E9se van a pil\u00F3taf\u00FClk\u00E9ben (a pil\u00F3t\u00E1nak \u00E9s a m\u00E1sodpil\u00F3t\u00E1nak), az utasok 1. \u00E9s 2. oszt\u00E1lyon utazhatnak. Az 1. oszt\u00E1lyon n\u00E9gy sz\u00E9k van egy sorban. A 2. oszt\u00E1lyon \u00F6t sz\u00E9k van egy sorban.'; - break; - } - output += '</p><p>K\u00E9sz\u00EDtsd el a k\u00E9pletet (lent) amivel kisz\u00E1molhat\u00F3, hogy h\u00E1ny \u00FCl\u00E9s van \u00F6sszesen a rep\u00FCl\u0151g\u00E9pen annak f\u00FCggv\u00E9ny\u00E9ben, ahogy (fent) \u00E1ll\u00EDtod a sorok sz\u00E1m\u00E1t.</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/ia.js b/res/lib/blockly/demos/plane/generated/ia.js deleted file mode 100644 index b80ad6e16c96727b0a38ec11597bef7380a70932..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/ia.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Filas: %1</span><span id="Plane_getRows">filas (%1)</span><span id="Plane_rows1">Filas de prime classe: %1</span><span id="Plane_getRows1">filas de prime classe (%1)</span><span id="Plane_rows2">Filas de secunde classe: %1</span><span id="Plane_getRows2">filas de secunde classe (%1)</span><span id="Plane_seats">Sedes: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">sedes =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Calculator de sedias de avion</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Un avion ha un numero de filas de sedes pro passageros. Cata fila contine quatro sedes.'; - break; - case 2: - output += 'Un avion ha duo sedes in le cabina (pro le pilota e le copilota) e un numero de filas de sedes pro passageros. Cata fila contine quatro sedes.'; - break; - case 3: - output += 'Un avion ha duo sedes in le cabina (pro le pilota e le copilota) e un numero de filas de sedes pro passageros del prime classe e del secunde classes. Cata fila del prime classe contine quatro sedes. Cata fila del secunde classe contine cinque sedes.'; - break; - } - output += '</p><p>Construe un formula (ci infra) que calcula le numero total de sedes in le avion quando le numero de filas es cambiate (ci supra).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/is.js b/res/lib/blockly/demos/plane/generated/is.js deleted file mode 100644 index 695f299e8599a365cf7ca305f8f7d51dc78c374f..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/is.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Ra\u00F0ir: %1</span><span id="Plane_getRows">ra\u00F0ir (%1)</span><span id="Plane_rows1">Ra\u00F0ir 1. farr\u00FDmi: %1</span><span id="Plane_getRows1">ra\u00F0ir 1. farr\u00FDmi (%1)</span><span id="Plane_rows2">Ra\u00F0ir 2. farr\u00FDmi: %1</span><span id="Plane_getRows2">ra\u00F0ir 2. farr\u00FDmi (%1)</span><span id="Plane_seats">S\u00E6ti: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">s\u00E6ti =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Flugs\u00E6tareiknir</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Flugv\u00E9l er me\u00F0 einhvern fj\u00F6lda s\u00E6tara\u00F0a fyrir far\u00FEega. \u00CD hverri r\u00F6\u00F0 eru fj\u00F6gur s\u00E6ti.'; - break; - case 2: - output += 'Flugv\u00E9l er me\u00F0 tv\u00F6 s\u00E6ti \u00ED stj\u00F3rnklefa (fyrir flugmanninn og a\u00F0sto\u00F0arflugmanninn) og einhvern fj\u00F6lda s\u00E6tara\u00F0a fyrir far\u00FEega. Hver s\u00E6tar\u00F6\u00F0 hefur fj\u00F6gur s\u00E6ti.'; - break; - case 3: - output += 'Flugv\u00E9l er me\u00F0 tv\u00F6 s\u00E6ti \u00ED stj\u00F3rnklefa (fyrir flugmanninn og a\u00F0sto\u00F0arflugmanninn) og einhvern fj\u00F6lda s\u00E6tara\u00F0a fyrir far\u00FEega \u00E1 1. og 2. farr\u00FDmi. Hver s\u00E6tar\u00F6\u00F0 \u00E1 1. farr\u00FDmi hefur fj\u00F6gur s\u00E6ti. Hver s\u00E6tar\u00F6\u00F0 \u00E1 2. farr\u00FDmi hefur fimm s\u00E6ti.'; - break; - } - output += '</p><p>B\u00FA\u00F0u til form\u00FAlu (h\u00E9r fyrir ne\u00F0an) sem reiknar heildarfj\u00F6lda s\u00E6ta \u00ED flugv\u00E9linni eftir \u00FEv\u00ED sem r\u00F6\u00F0unum er breytt (h\u00E9r fyrir ofan).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/it.js b/res/lib/blockly/demos/plane/generated/it.js deleted file mode 100644 index 2464481117a1256232d0999b5bbd21a084e3d8a2..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/it.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">File: %1</span><span id="Plane_getRows">file (%1)</span><span id="Plane_rows1">File 1\u00AA classe: %1</span><span id="Plane_getRows1">file 1\u00AA classe (%1)</span><span id="Plane_rows2">File 2\u00AA classe: %1</span><span id="Plane_getRows2">File 2\u00AA classe (%1)</span><span id="Plane_seats">Sedili: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">sedili =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Calcolo posti aereo</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Un aeroplano ha un numero di file contenenti i posti a sedere dei passeggeri. Ogni fila, contiene quattro posti a sedere.'; - break; - case 2: - output += 'Un aeroplano ha due posti a sedere nella cabina di pilotaggio (per il pilota e co-pilota), e un numero di file con i posti a sedere dei passeggeri. Ogni fila contiene quattro posti.'; - break; - case 3: - output += 'Un aereo ha due posti nella cabina di pilotaggio (per il pilota e il co-pilota), e un numero di file in prima e seconda classe, con i posti a sedere dei passeggeri. Ogni fila della prima classe contiene quattro posti. Quelle invece della seconda classe, ne contengono cinque.'; - break; - } - output += '</p><p>Costruisci una formula (sotto) che calcola il numero totale di posti a sedere su un aeroplano, cos\u00EC come cambiano le file di posti (sopra).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/ja.js b/res/lib/blockly/demos/plane/generated/ja.js deleted file mode 100644 index c5e96ee9155f8c2a13e97a4859cefbe4635b8efe..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/ja.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">\u5217\u306E\u6570: %1</span><span id="Plane_getRows">\u5217\u306E\u6570 (%1)</span><span id="Plane_rows1">\u30D5\u30A1\u30FC\u30B9\u30C8\u30AF\u30E9\u30B9\u306E\u5217\u6570: %1</span><span id="Plane_getRows1">\u30D5\u30A1\u30FC\u30B9\u30C8\u30AF\u30E9\u30B9\u306E\u5217\u6570 (%1)</span><span id="Plane_rows2">\u30BB\u30AB\u30F3\u30C9\u30AF\u30E9\u30B9\u306E\u5217\u6570: %1</span><span id="Plane_getRows2">\u30BB\u30AB\u30F3\u30C9\u30AF\u30E9\u30B9\u306E\u5217\u6570 (%1)</span><span id="Plane_seats">\u5EA7\u5E2D\u306E\u6570: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">\u5EA7\u5E2D\u306E\u6570 =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">\u98DB\u884C\u6A5F\u5EA7\u5E2D\u8A08\u7B97\u6A5F</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += '\u98DB\u884C\u6A5F\u306B\u4E57\u5BA2\u306E\u5EA7\u5E2D\u306E\u5217\u304C\u3042\u308A\u307E\u3059\u3002\u305D\u308C\u305E\u308C\u306E\u5217\u306B 4 \u3064\u306E\u5EA7\u5E2D\u304C\u3042\u308A\u307E\u3059\u3002'; - break; - case 2: - output += '\u98DB\u884C\u6A5F\u306B\u306F\u3001\u64CD\u7E26\u5BA4\u306E 2 \u3064\u306E\u5EA7\u5E2D (\u64CD\u7E26\u58EB\u3068\u526F\u64CD\u7E26\u58EB) \u3068\u3001\u4E57\u5BA2\u306E\u5EA7\u5E2D\u306E\u5217\u304C\u3042\u308A\u307E\u3059\u3002\u305D\u308C\u305E\u308C\u306E\u5217\u306B 4 \u3064\u306E\u5EA7\u5E2D\u304C\u3042\u308A\u307E\u3059\u3002'; - break; - case 3: - output += '\u98DB\u884C\u6A5F\u306B\u306F\u3001\u64CD\u7E26\u5BA4\u306E 2 \u3064\u306E\u5EA7\u5E2D (\u64CD\u7E26\u58EB\u3068\u526F\u64CD\u7E26\u58EB) \u3068\u3001\u30D5\u30A1\u30FC\u30B9\u30C8\u30AF\u30E9\u30B9\u3068\u30BB\u30AB\u30F3\u30C9\u30AF\u30E9\u30B9\u306E\u4E57\u5BA2\u306E\u5EA7\u5E2D\u306E\u5217\u304C\u3042\u308A\u307E\u3059\u3002\u305D\u308C\u305E\u308C\u306E\u5217\u306B\u3001\u30D5\u30A1\u30FC\u30B9\u30C8\u30AF\u30E9\u30B9\u3067\u306F 4 \u3064\u306E\u5EA7\u5E2D\u3001\u30BB\u30AB\u30F3\u30C9\u30AF\u30E9\u30B9\u3067\u306F 5 \u3064\u306E\u5EA7\u5E2D\u304C\u3042\u308A\u307E\u3059\u3002'; - break; - } - output += '</p><p>\u98DB\u884C\u6A5F\u306E\u5EA7\u5E2D\u306E\u6570\u3092\u8A08\u7B97\u3059\u308B\u5F0F\u3092\u3001\u4E0A\u3067\u5217\u306E\u6570\u3092\u5909\u66F4\u3057\u3066\u3082\u6B63\u3057\u304F\u306A\u308B\u3088\u3046\u306B\u3001\u4E0B\u306B\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/ko.js b/res/lib/blockly/demos/plane/generated/ko.js deleted file mode 100644 index 2e746ef5f83e0e0edff9a2b585520c338afbd09a..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/ko.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">\uD589 \uC218: %1</span><span id="Plane_getRows">\uD589 \uC218 (%1)</span><span id="Plane_rows1">1\uB4F1\uC11D \uD589 \uC218: %1</span><span id="Plane_getRows1">1\uB4F1\uC11D \uD589 \uC218 (%1)</span><span id="Plane_rows2">2\uB4F1\uC11D \uD589 \uC218: %1</span><span id="Plane_getRows2">2\uB4F1\uC11D \uD589 \uC218 (%1)</span><span id="Plane_seats">\uC88C\uC11D \uC218: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">\uC88C\uC11D\uC218 =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">\uBE44\uD589\uAE30 \uC88C\uC11D \uACC4\uC0B0\uAE30</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += '\uBE44\uD589\uAE30\uB294 \uC2B9\uAC1D \uC88C\uC11D\uC758 \uD589 \uC218\uAC00 \uC788\uC2B5\uB2C8\uB2E4. \uAC01 \uD589\uC5D0\uB294 \uC2DC\uD2B8 \uB124 \uAC1C\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.'; - break; - case 2: - output += '\uBE44\uD589\uAE30\uB294 \uBE44\uD589 \uAC11\uD310(\uC870\uC885\uC0AC\uC640 \uBD80\uC870\uC885\uC0AC\uC6A9)\uC5D0\uC11C \uC88C\uC11D \uB450 \uAC1C\uAC00 \uC788\uACE0, \uC2B9\uAC1D \uC88C\uC11D\uC758 \uD589 \uC218\uAC00 \uC788\uC2B5\uB2C8\uB2E4. \uAC01 \uD589\uC5D0\uB294 \uC2DC\uD2B8 \uB124 \uAC1C\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.'; - break; - case 3: - output += '\uBE44\uD589\uAE30\uB294 \uBE44\uD589 \uAC11\uD310(\uC870\uC885\uC0AC\uC640 \uBD80\uC870\uC885\uC0AC\uC6A9)\uC5D0\uC11C \uC88C\uC11D \uB450 \uAC1C\uAC00 \uC788\uACE0, 1\uB4F1\uC11D\uACFC 2\uB4F1\uC11D \uC2B9\uAC1D \uC88C\uC11D\uC758 \uD589 \uC218\uAC00 \uC788\uC2B5\uB2C8\uB2E4. \uAC01 1\uB4F1\uC11D \uD589\uC5D0\uB294 \uC2DC\uD2B8 \uB124 \uAC1C\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uAC01 2\uB4F1\uC11D \uD589\uC5D0\uB294 \uC2DC\uD2B8 \uB2E4\uC12F \uAC1C\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.'; - break; - } - output += '</p><p>\uD589\uC774 \uBC14\uB010(\uC704) \uBE44\uD589\uAE30\uC5D0 \uC88C\uC11D\uC758 \uCD1D \uC218\uB97C \uACC4\uC0B0\uD558\uB294 \uACF5\uC2DD(\uC544\uB798)\uC744 \uAD6C\uCD95\uD558\uC138\uC694.</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/ms.js b/res/lib/blockly/demos/plane/generated/ms.js deleted file mode 100644 index d2a292554ecf8b44ae41ed7d1a4ea917147fca16..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/ms.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Baris: %1</span><span id="Plane_getRows">baris (%1)</span><span id="Plane_rows1">Baris kelas pertama: %1</span><span id="Plane_getRows1">baris kelas pertama (%1)</span><span id="Plane_rows2">Baris kelas kedua: %1</span><span id="Plane_getRows2">baris kelas kedua (%1)</span><span id="Plane_seats">Tempat duduk: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">tempat duduk =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Pengira Tempat Duduk Kapal Terbang</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Sebuah kapal terbang mempunyai sebilangan baris tempat duduk penumpang. Setiap baris mengandungi empat tempat duduk.'; - break; - case 2: - output += 'Sebuah kapal terbang mempunyai tempat duduk di kokpit (untuk juruterbang dan pembantunya) dan sebilangan baris tempat duduk penumpang. Setiap baris mengandungi empat tempat duduk.'; - break; - case 3: - output += 'Sebuah kapal terbang mempunyai tempat duduk di kokpit (untuk juruterbang dan pembantunya) dan sebilangan baris tempat duduk penumpang kelas pertama dan kelas kedua. Setiap baris kelas pertama mengandungi empat tempat duduk. Setiap baris kelas pertama mengandungi lima tempat duduk.'; - break; - } - output += '</p><p>Wujudkan formula (di bawah) yang mengira jumlah tempat duduk di dalam kapal terbang sedangkan baris-barisnya diubah (di atas).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/nb.js b/res/lib/blockly/demos/plane/generated/nb.js deleted file mode 100644 index 1fc33875682d9ef7ac95f0b40906269acd17c9eb..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/nb.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Rader: %1</span><span id="Plane_getRows">rader (%1)</span><span id="Plane_rows1">Rader i f\u00F8rste klasse: %1</span><span id="Plane_getRows1">Rader i f\u00F8rste klasse (%1)</span><span id="Plane_rows2">Rader i andre klasse: %1</span><span id="Plane_getRows2">Rader i andre klasse (%1)</span><span id="Plane_seats">Seter: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">seter =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Flysetekalkulator</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Et fly har et antall rader med passasjerseter. Hver rad inneholder fire seter.'; - break; - case 2: - output += 'Et fly har to seter i cockpit (for piloten og andrepiloten), og et antall rader med passasjerseter. Hver rad inneholder fire seter.'; - break; - case 3: - output += 'Et fly har to seter i cockpit (for piloten og andrepiloten), og et antall rader med passasjerseter p\u00E5 f\u00F8rste og andre klasse. Hver av radene p\u00E5 f\u00F8rste klasse har fire seter. Hver av radene p\u00E5 andre klasse har fem seter.'; - break; - } - output += '</p><p>Bygg en formel (under) som beregner det totale antall seter p\u00E5 flyet etter hvert som radene endres (over).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/nl.js b/res/lib/blockly/demos/plane/generated/nl.js deleted file mode 100644 index 779022042def151a66d3a51323455faa0c755ae3..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/nl.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Rijen: %1</span><span id="Plane_getRows">rijen (%1)</span><span id="Plane_rows1">Rijen 1e klas: %1</span><span id="Plane_getRows1">Rijen 1e klas (%1)</span><span id="Plane_rows2">Rijen 2e klas: %1</span><span id="Plane_getRows2">Rijen 2e klas (%1)</span><span id="Plane_seats">Zitplaatsen: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">stoelen=</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Vliegtuigstoelencalculator</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Een vliegtuig heeft een aantal rijen met stoelen. Iedere rij heeft vier stoelen.'; - break; - case 2: - output += 'Een vliegtuig heeft twee stoelen in de cockpit (voor de piloot en de copiloot) en een aantal rijen met stoelen voor passagiers. Iedere rij bevat vier stoelen.'; - break; - case 3: - output += 'Een vliegtuig heeft twee stoelen in de cockpit (voor de piloot en de copiloot) en een aantal rijen voor 1e klasse en 2e klasse passagiers. Iedere rij in de 1e klasse heeft vier stoelen. Iedere rij in de 2e klasse heeft vijf stoelen.'; - break; - } - output += '</p><p>Maak hieronder een formule die het totale aantal stoelen in het vliegtuig berekent als het aantal rijen hierboven wordt aangepast.</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/pl.js b/res/lib/blockly/demos/plane/generated/pl.js deleted file mode 100644 index 0cf1830ea933764924bdd17d07e9d4cc8a508b97..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/pl.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Rz\u0119d\u00F3w: %1</span><span id="Plane_getRows">rz\u0119d\u00F3w (%1)</span><span id="Plane_rows1">Rz\u0119d\u00F3w w pierwszej klasie: %1</span><span id="Plane_getRows1">Rz\u0119d\u00F3w w pierwszej klasie (%1)</span><span id="Plane_rows2">Rz\u0119d\u00F3w w drugiej klasie: %1</span><span id="Plane_getRows2">Rz\u0119d\u00F3w w drugiej klasie (%1)</span><span id="Plane_seats">Siedze\u0144: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">siedze\u0144 =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Kalkulator miejsc w samolocie.</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Samolot ma kilka rz\u0119d\u00F3w siedze\u0144 pasa\u017Cer\u00F3w. Ka\u017Cdy rz\u0105d zawiera cztery miejsca.'; - break; - case 2: - output += 'Samolot ma dwa miejsca w kabinie pilot\u00F3w (dla pierwszego i drugiego pilota) oraz rz\u0119dy siedze\u0144 dla pasa\u017Cer\u00F3w. Ka\u017Cdy taki rz\u0105d sk\u0142ada si\u0119 z czterech siedze\u0144.'; - break; - case 3: - output += 'Samolot ma dwa miejsca w kabinie pilot\u00F3w (dla pierwszego i drugiego pilota) oraz rz\u0119dy siedze\u0144 dla pasa\u017Cer\u00F3w pierwszej i drugiej klasy. Ka\u017Cdy rz\u0105d pierwszej klasy sk\u0142ada si\u0119 z czterech siedze\u0144. Ka\u017Cdy rz\u0105d drugiej klasy sk\u0142ada si\u0119 z pi\u0119ciu siedze\u0144.'; - break; - } - output += '</p><p>Zbuduj wz\u00F3r (poni\u017Cej), kt\u00F3ry pozwala obliczy\u0107 \u0142\u0105czn\u0105 liczb\u0119 siedze\u0144 w samolocie w funkcji zmieniaj\u0105cej si\u0119 liczby rz\u0119d\u00F3w (powy\u017Cej).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/pms.js b/res/lib/blockly/demos/plane/generated/pms.js deleted file mode 100644 index eb35bacca078bb8db6c8954dd2b85dc36890c815..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/pms.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Linie: %1</span><span id="Plane_getRows">linie (%1)</span><span id="Plane_rows1">linie \u00EBd prima classa: %1</span><span id="Plane_getRows1">linie \u00EBd prima classa (%1)</span><span id="Plane_rows2">linie \u00EBd seconda classa: %1</span><span id="Plane_getRows2">linie \u00EBd seconda classa (%1)</span><span id="Plane_seats">Sedij: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">sedij =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Calcolator \u00EBd sedij d\'avion</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'N\'avion a l\'ha un n\u00F9mer \u00EBd file \u00EBd sedij da pass\u00EBg\u00E9. Minca fila a l\'ha quatr sedij.'; - break; - case 2: - output += 'N\'avion a l\'ha doi sedij ant la cabin-a \u00EBd pilotage (p\u00EBr \u00EBl pil\u00F2ta e \u00EBl c\u00F2-pil\u00F2ta), e un ch\u00E8ich n\u00F9mer \u00EBd file \u00EBd sedij pr\'ij passag\u00E9. Minca fila a conten quatr sedij.'; - break; - case 3: - output += 'N\'avion a l\'ha doi sedij ant la cabin-a \u00EBd pilotage (p\u00EBr \u00EBl pil\u00F2ta e \u00EBl c\u00F2-pil\u00F2ta) e un ch\u00E8ich n\u00F9mer \u00EBd file \u00EBd sedij pr\'ij passag\u00E9 \u00EBd prima e sconda classa. Minca fila \u00EBd prima classa a conten quatr sedij. Minca fila \u00EBd seconda classa a conten sinch sedij.'; - break; - } - output += '</p><p>Fabrich\u00E9 na f\u00F3rmola (s\u00EC-sota) ch\'a fa \'l cont d\u00EBl n\u00F9mer total \u00EBd sedij ant l\'avion cand che \u00EBl n\u00F9mer dle file a cangia (s\u00EC-dzora).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/pt-br.js b/res/lib/blockly/demos/plane/generated/pt-br.js deleted file mode 100644 index 821bdbe4f94c40c52c0d37b548faa203bda4a313..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/pt-br.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Filas: %1</span><span id="Plane_getRows">filas (%1)</span><span id="Plane_rows1">filas na primeira classe: %1</span><span id="Plane_getRows1">filas na primeira classe (%1)</span><span id="Plane_rows2">filas na segunda classe: %1</span><span id="Plane_getRows2">filas na segunda classe (%1)</span><span id="Plane_seats">Assentos: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">assentos =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Calculadora de Assentos em Avi\u00E3o</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Um avi\u00E3o tem um n\u00FAmero de filas de assentos para os passageiros. Cada fila cont\u00E9m quatro assentos.'; - break; - case 2: - output += 'Um avi\u00E3o tem dois assentos na cabine de comando (para o piloto e o copiloto) e um n\u00FAmero de filas de assentos para os passageiros. Cada fila cont\u00E9m quatro assentos.'; - break; - case 3: - output += 'Um avi\u00E3o tem dois assentos na cabine de comando (para o piloto e o copiloto) e um n\u00FAmero de filas de assentos na primeira e na segunda classe. Cada fila da primeira classe cont\u00E9m quatro assentos. Cada fila da segunda classe cont\u00E9m cinco assentos.'; - break; - } - output += '</p><p>Elabore uma f\u00F3rmula (abaixo) que calcule o n\u00FAmero total de assentos no avi\u00E3o a medida que as filas s\u00E3o alteradas (acima).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/ro.js b/res/lib/blockly/demos/plane/generated/ro.js deleted file mode 100644 index 6454c94bc107959a69c70f90111d98c81b1c42e4..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/ro.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">R\u00E2nduri: %1</span><span id="Plane_getRows">r\u00E2nduri (%1)</span><span id="Plane_rows1">r\u00E2nduri de clasa I: %1</span><span id="Plane_getRows1">r\u00E2nduri de clasa I (%1)</span><span id="Plane_rows2">r\u00E2nduri de clasa a II-a: %1</span><span id="Plane_getRows2">r\u00E2nduri de clasa a II-a (%1)</span><span id="Plane_seats">Scaune: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">scaune =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Calculator pentru locurile dintr-un avion</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Un avion are un num\u0103r de r\u00E2nduri cu scaune pentru pasageri. Fiecare r\u00E2nd con\u021Bine patru scaune.'; - break; - case 2: - output += 'Un avion are dou\u0103 scaune \u00EEn carling\u0103 (pentru pilot \u0219i copilot) \u0219i un num\u0103r de r\u00E2nduri cu scaune pentru pasageri. Fiecare r\u00E2nd con\u021Bine patru scaune.'; - break; - case 3: - output += 'Un avion are dou\u0103 scaune \u00EEn carling\u0103 (pentru pilot \u0219i copilot) \u0219i un num\u0103r de r\u00E2nduri cu scaune de clasa I \u0219i clasa a II-a pentru pasageri. Fiecare r\u00E2nd de clasa I con\u021Bine patru scaune. Fiecare r\u00E2nd de clasa a II-a con\u021Bine cinci scaune.'; - break; - } - output += '</p><p>Construie\u0219te o formul\u0103 (mai jos) care calculeaz\u0103 num\u0103rul total de locuri dintr-un avion \u00EEn timp ce r\u00E2ndurile se schimb\u0103 (mai sus).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/ru.js b/res/lib/blockly/demos/plane/generated/ru.js deleted file mode 100644 index 9e6ee4a20edbc0474755b176f1cc6b19844b39c8..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/ru.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">\u0420\u044F\u0434\u043E\u0432: %1</span><span id="Plane_getRows">\u0440\u044F\u0434\u044B (%1)</span><span id="Plane_rows1">\u0420\u044F\u0434\u043E\u0432 1-\u0433\u043E \u043A\u043B\u0430\u0441\u0441\u0430: %1</span><span id="Plane_getRows1">\u0440\u044F\u0434\u044B 1-\u0433\u043E \u043A\u043B\u0430\u0441\u0441\u0430 (%1)</span><span id="Plane_rows2">\u0420\u044F\u0434\u043E\u0432 2-\u0433\u043E \u043A\u043B\u0430\u0441\u0441\u0430: %1</span><span id="Plane_getRows2">\u0440\u044F\u0434\u044B 2-\u0433\u043E \u043A\u043B\u0430\u0441\u0441\u0430 (%1)</span><span id="Plane_seats">\u041C\u0435\u0441\u0442: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">\u043C\u0435\u0441\u0442\u0430 =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">\u041A\u0430\u043B\u044C\u043A\u0443\u043B\u044F\u0442\u043E\u0440 \u043F\u043E\u0441\u0430\u0434\u043E\u0447\u043D\u044B\u0445 \u043C\u0435\u0441\u0442 \u0432 \u0441\u0430\u043C\u043E\u043B\u0451\u0442\u0435</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += '\u0412 \u0441\u0430\u043C\u043E\u043B\u0451\u0442\u0435 \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0440\u044F\u0434\u043E\u0432 \u0441 \u043F\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0441\u043A\u0438\u043C\u0438 \u043C\u0435\u0441\u0442\u0430\u043C\u0438. \u0412 \u043A\u0430\u0436\u0434\u043E\u043C \u0440\u044F\u0434\u0443 4 \u043C\u0435\u0441\u0442\u0430.'; - break; - case 2: - output += '\u0412 \u0441\u0430\u043C\u043E\u043B\u0451\u0442\u0435 2 \u043C\u0435\u0441\u0442\u0430 \u0434\u043B\u044F \u043F\u0438\u043B\u043E\u0442\u0430 \u0438 \u0435\u0433\u043E \u043F\u043E\u043C\u043E\u0449\u043D\u0438\u043A\u0430, \u0430 \u0442\u0430\u043A\u0436\u0435 \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0440\u044F\u0434\u043E\u0432 \u0441 \u043F\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0441\u043A\u0438\u043C\u0438 \u043C\u0435\u0441\u0442\u0430\u043C\u0438. \u0412 \u043A\u0430\u0436\u0434\u043E\u043C \u0440\u044F\u0434\u0443 4 \u043C\u0435\u0441\u0442\u0430.'; - break; - case 3: - output += '\u0412 \u0441\u0430\u043C\u043E\u043B\u0451\u0442\u0435 2 \u043C\u0435\u0441\u0442\u0430 \u0434\u043B\u044F \u043F\u0438\u043B\u043E\u0442\u0430 \u0438 \u0435\u0433\u043E \u043F\u043E\u043C\u043E\u0449\u043D\u0438\u043A\u0430, \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0440\u044F\u0434\u043E\u0432 \u0441 \u043F\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0441\u043A\u0438\u043C\u0438 \u043C\u0435\u0441\u0442\u0430\u043C\u0438 \u043F\u0435\u0440\u0432\u043E\u0433\u043E \u043A\u043B\u0430\u0441\u0441\u0430, \u0430 \u0442\u0430\u043A\u0436\u0435 \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0440\u044F\u0434\u043E\u0432 \u0441 \u043F\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0441\u043A\u0438\u043C\u0438 \u043C\u0435\u0441\u0442\u0430\u043C\u0438 \u0432\u0442\u043E\u0440\u043E\u0433\u043E \u043A\u043B\u0430\u0441\u0441\u0430. \u0412 \u043A\u0430\u0436\u0434\u043E\u043C \u0440\u044F\u0434\u0443 \u043F\u0435\u0440\u0432\u043E\u0433\u043E \u043A\u043B\u0430\u0441\u0441\u0430 4 \u043C\u0435\u0441\u0442\u0430. \u0412 \u043A\u0430\u0436\u0434\u043E\u043C \u0440\u044F\u0434\u0443 \u0432\u0442\u043E\u0440\u043E\u0433\u043E \u043A\u043B\u0430\u0441\u0441\u0430 5 \u043C\u0435\u0441\u0442.'; - break; - } - output += '</p><p>\u041F\u043E\u0441\u0442\u0440\u043E\u0439\u0442\u0435 \u0444\u043E\u0440\u043C\u0443\u043B\u0443 \u0432 \u043E\u0431\u043B\u0430\u0441\u0442\u0438 \u043D\u0438\u0436\u0435, \u043A\u043E\u0442\u043E\u0440\u0430\u044F \u043F\u043E\u043C\u043E\u0436\u0435\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044C \u043E\u0431\u0449\u0435\u0435 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442 \u0432 \u0441\u0430\u043C\u043E\u043B\u0451\u0442\u0435 (\u043A\u0430\u043A \u043D\u0430 \u0440\u0438\u0441\u0443\u043D\u043A\u0435 \u0432\u044B\u0448\u0435).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/sc.js b/res/lib/blockly/demos/plane/generated/sc.js deleted file mode 100644 index b8511cc0ea793a84301b48b26be4a1dfc6b57b6e..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/sc.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Fileras: %1</span><span id="Plane_getRows">fileras (%1)</span><span id="Plane_rows1">fileras de primu classi: %1</span><span id="Plane_getRows1">fileras de primu classi (%1)</span><span id="Plane_rows2">fileras de segunda classi: %1</span><span id="Plane_getRows2">fileras de segunda classi (%1)</span><span id="Plane_seats">Cadironis: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">cadironis =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Fai su contu de is cadironis de unu apar\u00E8chiu</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Unu apar\u00E8chiu tenit unas cantu fileras de cadironis po passigeris. D\u00F2nnia filera tenit cuatru cadironis.'; - break; - case 2: - output += 'Unu apar\u00E8chiu tenit duus cadironis in sa cabina de cumandu (po su pilota e su co-pilota), e unas cantu fileras de cadironis po passigeris. D\u00F2nnia filera tenit cuatru cadironis.'; - break; - case 3: - output += 'Unu apar\u00E8chiu tenit duus cadironis in sa cabina de cumandu (po su pilota e su co-pilota), e unas cantu fileras de cadironis po passigeris de prima classi e de segunda classi. D\u00F2nnia filera de prima classi tenit cuatru cadironis. D\u00F2nnia filera de segunda classi tenit cincu cadironis.'; - break; - } - output += '</p><p>Cuncorda una formula (innoi asuta) chi cumpudit su numeru totali de postus a setzi in s\'aparechiu, a segunda de comenti mudant is fileras de postus (innoi in susu)</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/sv.js b/res/lib/blockly/demos/plane/generated/sv.js deleted file mode 100644 index 70b7c063b7b3a1808334da2a5c0de8ab3c8a854a..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/sv.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">Rader: %1</span><span id="Plane_getRows">rader (%1)</span><span id="Plane_rows1">Rader i f\u00F6rsta klass: %1</span><span id="Plane_getRows1">Rader i f\u00F6rsta klass (%1)</span><span id="Plane_rows2">Rader i andra klass: %1</span><span id="Plane_getRows2">Rader i andra klass (%1)</span><span id="Plane_seats">S\u00E4ten: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">s\u00E4ten =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">Plans\u00E4teskalkylator</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Ett flygplan har ett antal rader med passagerars\u00E4ten. Varje rad inneh\u00E5ller fyra s\u00E4ten.'; - break; - case 2: - output += 'Ett flygplan har tv\u00E5 s\u00E4ten i cockpiten (ett f\u00F6r piloten och ett f\u00F6r andrepiloten) och ett antal rader med passagerars\u00E4ten. Varje rad inneh\u00E5ller fyra s\u00E4ten.'; - break; - case 3: - output += 'Ett flygplan har tv\u00E5 s\u00E4ten i cockpiten (ett f\u00F6r piloten och ett f\u00F6r andrepiloten) och ett antal rader med passagerars\u00E4ten i f\u00F6rsta och andra klass. Varje rad i f\u00F6rsta klass inneh\u00E5ller fyra s\u00E4ten. Varje rad i andra klass inneh\u00E5ller fem s\u00E4ten.'; - break; - } - output += '</p><p>Bygg en formel (nedan) som ber\u00E4knar det totala antalet s\u00E4ten p\u00E5 flygplanet n\u00E4r raderna \u00E4ndras (ovan).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/th.js b/res/lib/blockly/demos/plane/generated/th.js deleted file mode 100644 index bf66783729b2bd731547dd51e63656b0ee65c2d8..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/th.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">%1 \u0E41\u0E16\u0E27</span><span id="Plane_getRows">\u0E08\u0E33\u0E19\u0E27\u0E19\u0E41\u0E16\u0E27 (%1)</span><span id="Plane_rows1">\u0E0A\u0E31\u0E49\u0E19\u0E40\u0E1F\u0E34\u0E23\u0E4C\u0E2A\u0E04\u0E25\u0E32\u0E2A %1 \u0E41\u0E16\u0E27</span><span id="Plane_getRows1">\u0E08\u0E33\u0E19\u0E27\u0E19\u0E41\u0E16\u0E27\u0E0A\u0E31\u0E49\u0E19\u0E40\u0E1F\u0E34\u0E23\u0E4C\u0E2A\u0E04\u0E25\u0E32\u0E2A (%1)</span><span id="Plane_rows2">\u0E0A\u0E31\u0E49\u0E19\u0E18\u0E38\u0E23\u0E01\u0E34\u0E08 %1 \u0E41\u0E16\u0E27</span><span id="Plane_getRows2">\u0E08\u0E33\u0E19\u0E27\u0E19\u0E41\u0E16\u0E27\u0E0A\u0E31\u0E49\u0E19\u0E18\u0E38\u0E23\u0E01\u0E34\u0E08 (%1)</span><span id="Plane_seats">\u0E04\u0E33\u0E19\u0E27\u0E13\u0E44\u0E14\u0E49\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14 %1 \u0E17\u0E35\u0E48\u0E19\u0E31\u0E48\u0E07</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E19\u0E31\u0E48\u0E07 =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">\u0E23\u0E30\u0E1A\u0E1A\u0E04\u0E33\u0E19\u0E27\u0E13\u0E17\u0E35\u0E48\u0E19\u0E31\u0E48\u0E07\u0E1A\u0E19\u0E40\u0E04\u0E23\u0E37\u0E48\u0E2D\u0E07\u0E1A\u0E34\u0E19</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += '\u0E20\u0E32\u0E22\u0E43\u0E19\u0E40\u0E04\u0E23\u0E37\u0E48\u0E2D\u0E07\u0E1A\u0E34\u0E19\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E44\u0E1B\u0E14\u0E49\u0E27\u0E22\u0E41\u0E16\u0E27\u0E02\u0E2D\u0E07\u0E17\u0E35\u0E48\u0E19\u0E31\u0E48\u0E07\u0E1C\u0E39\u0E49\u0E42\u0E14\u0E22\u0E2A\u0E32\u0E23 \u0E43\u0E19\u0E41\u0E15\u0E48\u0E25\u0E30\u0E41\u0E16\u0E27\u0E08\u0E30\u0E21\u0E35 4 \u0E17\u0E35\u0E48\u0E19\u0E31\u0E48\u0E07'; - break; - case 2: - output += '\u0E20\u0E32\u0E22\u0E43\u0E19\u0E40\u0E04\u0E23\u0E37\u0E48\u0E2D\u0E07\u0E1A\u0E34\u0E19\u0E08\u0E30\u0E21\u0E35\u0E17\u0E35\u0E48\u0E19\u0E31\u0E48\u0E07\u0E19\u0E31\u0E01\u0E1A\u0E34\u0E19\u0E2D\u0E22\u0E39\u0E48 2 \u0E17\u0E35\u0E48 (\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E19\u0E31\u0E01\u0E1A\u0E34\u0E19 \u0E41\u0E25\u0E30\u0E1C\u0E39\u0E49\u0E0A\u0E48\u0E27\u0E22\u0E19\u0E31\u0E01\u0E1A\u0E34\u0E19) \u0E41\u0E25\u0E30\u0E21\u0E35\u0E41\u0E16\u0E27\u0E17\u0E35\u0E48\u0E19\u0E31\u0E48\u0E07\u0E1C\u0E39\u0E49\u0E42\u0E14\u0E22\u0E2A\u0E32\u0E23\u0E2D\u0E22\u0E39\u0E48\u0E08\u0E33\u0E19\u0E27\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07 \u0E43\u0E19\u0E41\u0E15\u0E48\u0E25\u0E30\u0E41\u0E16\u0E27\u0E08\u0E30\u0E21\u0E35 4 \u0E17\u0E35\u0E48\u0E19\u0E31\u0E48\u0E07'; - break; - case 3: - output += '\u0E20\u0E32\u0E22\u0E43\u0E19\u0E40\u0E04\u0E23\u0E37\u0E48\u0E2D\u0E07\u0E1A\u0E34\u0E19\u0E08\u0E30\u0E21\u0E35\u0E17\u0E35\u0E48\u0E19\u0E31\u0E48\u0E07\u0E19\u0E31\u0E01\u0E1A\u0E34\u0E19\u0E2D\u0E22\u0E39\u0E48 2 \u0E17\u0E35\u0E48 (\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E19\u0E31\u0E01\u0E1A\u0E34\u0E19 \u0E41\u0E25\u0E30\u0E1C\u0E39\u0E49\u0E0A\u0E48\u0E27\u0E22\u0E19\u0E31\u0E01\u0E1A\u0E34\u0E19) \u0E41\u0E25\u0E30\u0E08\u0E30\u0E21\u0E35\u0E41\u0E16\u0E27\u0E17\u0E35\u0E48\u0E19\u0E31\u0E48\u0E07\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E1C\u0E39\u0E49\u0E42\u0E14\u0E22\u0E2A\u0E32\u0E23 "\u0E0A\u0E31\u0E49\u0E19\u0E40\u0E1F\u0E34\u0E23\u0E4C\u0E2A\u0E04\u0E25\u0E32\u0E2A" \u0E41\u0E25\u0E30 "\u0E0A\u0E31\u0E49\u0E19\u0E18\u0E38\u0E23\u0E01\u0E34\u0E08" \u0E2D\u0E22\u0E39\u0E48\u0E08\u0E33\u0E19\u0E27\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07 \u0E42\u0E14\u0E22\u0E43\u0E19\u0E0A\u0E31\u0E49\u0E19\u0E40\u0E1F\u0E34\u0E23\u0E4C\u0E2A\u0E04\u0E25\u0E32\u0E2A\u0E08\u0E30\u0E21\u0E35\u0E41\u0E16\u0E27\u0E25\u0E30 4 \u0E17\u0E35\u0E48\u0E19\u0E31\u0E48\u0E07 \u0E2A\u0E48\u0E27\u0E19\u0E43\u0E19\u0E0A\u0E31\u0E49\u0E19\u0E18\u0E38\u0E23\u0E01\u0E34\u0E08\u0E08\u0E30\u0E21\u0E35\u0E41\u0E16\u0E27\u0E25\u0E30 5 \u0E17\u0E35\u0E48\u0E19\u0E31\u0E48\u0E07'; - break; - } - output += '</p><p>\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E2A\u0E39\u0E15\u0E23\u0E04\u0E33\u0E19\u0E27\u0E13 (\u0E14\u0E49\u0E32\u0E19\u0E25\u0E48\u0E32\u0E07) \u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E04\u0E33\u0E19\u0E27\u0E13\u0E2B\u0E32\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E19\u0E31\u0E48\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14\u0E1A\u0E19\u0E40\u0E04\u0E23\u0E37\u0E48\u0E2D\u0E07\u0E1A\u0E34\u0E19 \u0E15\u0E32\u0E21\u0E08\u0E33\u0E19\u0E27\u0E19\u0E41\u0E16\u0E27\u0E17\u0E35\u0E48\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E44\u0E1B (\u0E14\u0E49\u0E32\u0E19\u0E1A\u0E19)</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/tr.js b/res/lib/blockly/demos/plane/generated/tr.js deleted file mode 100644 index 56d41cab310fc2ce8b746c8ab939a548daa850e8..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/tr.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">S\u0131ralar: %1</span><span id="Plane_getRows">s\u0131ralar (%1)</span><span id="Plane_rows1">Birinci s\u0131n\u0131f s\u0131ralar: (%1)</span><span id="Plane_getRows1">Birinci s\u0131n\u0131f s\u0131ralar (%1)</span><span id="Plane_rows2">\u0130kinci s\u0131n\u0131f s\u0131ralar: %1</span><span id="Plane_getRows2">\u0130kinci s\u0131n\u0131f s\u0131ralar (%1)</span><span id="Plane_seats">Koltuklar: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">koltuklar =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">U\u00E7ak Koltu\u011Fu Hesaplay\u0131c\u0131</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'Bir u\u00E7a\u011F\u0131n belirli say\u0131da koltuk s\u0131ras\u0131 vard\u0131r. Her s\u0131ra d\u00F6rt koltuk i\u00E7erir.'; - break; - case 2: - output += 'Bir u\u00E7a\u011F\u0131n u\u00E7u\u015F g\u00FCvertesinde iki koltu\u011Fu (pilot ve yard\u0131mc\u0131 pilot i\u00E7in), ve belirli say\u0131da koltuk s\u0131ras\u0131 vard\u0131r. Her s\u0131ra d\u00F6rt koltuk i\u00E7erir.'; - break; - case 3: - output += 'Bir u\u00E7a\u011F\u0131n u\u00E7u\u015F g\u00FCvertesinde iki koltu\u011Fu (pilot ve yard\u0131mc\u0131 pilot i\u00E7in), ve belirli say\u0131da birinci s\u0131n\u0131f ve ikinci s\u0131n\u0131f yolcu koltu\u011Fu s\u0131ras\u0131 vard\u0131r. Her birinci s\u0131n\u0131f s\u0131ra d\u00F6rt koltuk i\u00E7erir. Her ikinci s\u0131n\u0131f s\u0131ra be\u015F koltuk i\u00E7erir.'; - break; - } - output += '</p><p>S\u0131ralar(\u00FCstte) de\u011Fi\u015Ftik\u00E7e u\u00E7aktaki toplam koltuk say\u0131s\u0131n\u0131 hesaplayan bir form\u00FCl(altta) olu\u015Fturun.</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/uk.js b/res/lib/blockly/demos/plane/generated/uk.js deleted file mode 100644 index a73409dc89dcab6afcef31c605e605fb7f027289..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/uk.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">\u0420\u044F\u0434\u043A\u0438: %1</span><span id="Plane_getRows">\u0440\u044F\u0434\u043A\u0438 (%1)</span><span id="Plane_rows1">\u0440\u044F\u0434\u0456\u0432 1-\u0433\u043E \u043A\u043B\u0430\u0441\u0443: %1</span><span id="Plane_getRows1">\u0440\u044F\u0434\u0456\u0432 1-\u0433\u043E \u043A\u043B\u0430\u0441\u0443 (%1)</span><span id="Plane_rows2">\u0440\u044F\u0434\u0456\u0432 2-\u0433\u043E \u043A\u043B\u0430\u0441\u0443: %1</span><span id="Plane_getRows2">\u0440\u044F\u0434\u0456\u0432 2-\u0433\u043E \u043A\u043B\u0430\u0441\u0443 (%1)</span><span id="Plane_seats">\u041C\u0456\u0441\u0446\u044C: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">\u043C\u0456\u0441\u0446\u044C=</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">\u041A\u0430\u043B\u044C\u043A\u0443\u043B\u044F\u0442\u043E\u0440 \u043C\u0456\u0441\u0446\u044C \u0443 \u043B\u0456\u0442\u0430\u043A\u0443</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += '\u041B\u0456\u0442\u0430\u043A \u043C\u0430\u0454 \u043A\u0456\u043B\u044C\u043A\u0430 \u0440\u044F\u0434\u0456\u0432 \u043F\u0430\u0441\u0430\u0436\u0438\u0440\u0441\u044C\u043A\u0438\u0445 \u0441\u0438\u0434\u0456\u043D\u044C. \u041A\u043E\u0436\u0435\u043D \u0440\u044F\u0434 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u0447\u043E\u0442\u0438\u0440\u0438 \u043C\u0456\u0441\u0446\u044F.'; - break; - case 2: - output += '\u041B\u0456\u0442\u0430\u043A \u043C\u0430\u0454 \u0434\u0432\u0430 \u043C\u0456\u0441\u0446\u044F \u0432 \u043A\u0430\u0431\u0456\u043D\u0456 \u0435\u043A\u0456\u043F\u0430\u0436\u0443 (\u043F\u0456\u043B\u043E\u0442 \u0456 \u0434\u0440\u0443\u0433\u0438\u0439 \u043F\u0456\u043B\u043E\u0442), \u0456 \u043A\u0456\u043B\u044C\u043A\u0430 \u0440\u044F\u0434\u0456\u0432 \u043F\u0430\u0441\u0430\u0436\u0438\u0440\u0441\u044C\u043A\u0438\u0445 \u0441\u0438\u0434\u0456\u043D\u044C. \u041A\u043E\u0436\u0435\u043D \u0440\u044F\u0434\u043E\u043A \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u0447\u043E\u0442\u0438\u0440\u0438 \u043C\u0456\u0441\u0446\u044F.'; - break; - case 3: - output += '\u041B\u0456\u0442\u0430\u043A \u043C\u0430\u0454 \u0434\u0432\u0430 \u043C\u0456\u0441\u0446\u044F \u0432 \u043A\u0430\u0431\u0456\u043D\u0456 \u0435\u043A\u0456\u043F\u0430\u0436\u0443 (\u043F\u0456\u043B\u043E\u0442 \u0456 \u0434\u0440\u0443\u0433\u0438\u0439 \u043F\u0456\u043B\u043E\u0442), \u0456 \u043A\u0456\u043B\u044C\u043A\u0430 \u0440\u044F\u0434\u0456\u0432 1-\u0433\u043E \u043A\u043B\u0430\u0441\u0443 2-\u0433\u043E \u043A\u043B\u0430\u0441\u0443 \u043F\u0430\u0441\u0430\u0436\u0438\u0440\u0441\u044C\u043A\u0438\u0445 \u043C\u0456\u0441\u0446\u044C. \u041A\u043E\u0436\u043D\u0438\u0439 \u0440\u044F\u0434 1-\u0433\u043E \u043A\u043B\u0430\u0441\u0443 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u0447\u043E\u0442\u0438\u0440\u0438 \u043C\u0456\u0441\u0446\u044F. \u041A\u043E\u0436\u0435\u043D \u0440\u044F\u0434 2-\u0433\u043E \u043A\u043B\u0430\u0441\u0443 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u043F\'\u044F\u0442\u044C \u043C\u0456\u0441\u0446\u044C.'; - break; - } - output += '</p><p>\u041F\u043E\u0431\u0443\u0434\u0443\u0432\u0430\u0442\u0438 \u0444\u043E\u0440\u043C\u0443\u043B\u0443 (\u043D\u0438\u0436\u0447\u0435), \u044F\u043A\u0430 \u043E\u0431\u0447\u0438\u0441\u043B\u044E\u0454 \u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C \u043C\u0456\u0441\u0446\u044C \u043D\u0430 \u043B\u0456\u0442\u0430\u043A\u0443 \u043F\u0440\u0438 \u0437\u043C\u0456\u043D\u0456 \u0440\u044F\u0434\u043A\u0456\u0432 (\u0434\u0438\u0432. \u0432\u0438\u0449\u0435).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/vi.js b/res/lib/blockly/demos/plane/generated/vi.js deleted file mode 100644 index 54723b7f3368ef04144281652f33f10c63781f2c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/vi.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">S\u1ED1 h\u00E0ng gh\u1EBF: %1</span><span id="Plane_getRows">\u0111\u1EBFm s\u1ED1 h\u00E0ng gh\u1EBF (%1)</span><span id="Plane_rows1">H\u00E0ng h\u1EA1ng nh\u1EA5t: %1</span><span id="Plane_getRows1">s\u1ED1 h\u00E0ng h\u1EA1ng nh\u1EA5t (%1)</span><span id="Plane_rows2">H\u00E0ng h\u1EA1ng hai: %1</span><span id="Plane_getRows2">s\u1ED1 h\u00E0ng h\u1EA1ng hai (%1)</span><span id="Plane_seats">S\u1ED1 ch\u1ED7 ng\u1ED3i: %1</span><span id="Plane_placeholder">?</span><span id="Plane_setSeats">T\u00EDnh s\u1ED1 ch\u1ED7 ng\u1ED3i =</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">M\u00E1y bay gh\u1EBF m\u00E1y t\u00EDnh</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += 'M\u00E1y bay c\u00F3 m\u1ED9t s\u1ED1 h\u00E0ng gh\u1EBF h\u00E0nh kh\u00E1ch. M\u1ED7i h\u00E0ng c\u00F3 b\u1ED1n ch\u1ED7 ng\u1ED3i.'; - break; - case 2: - output += 'M\u1ED9t m\u00E1y bay c\u00F3 hai gh\u1EBF trong bu\u1ED3ng l\u00E1i (d\u00E0nh cho phi c\u00F4ng tr\u01B0\u1EDFng v\u00E0 phi c\u00F4ng ph\u1EE5), v\u00E0 m\u1ED9t lo\u1EA1t h\u00E0ng gh\u1EBF cho h\u00E0nh kh\u00E1ch. M\u1ED7i h\u00E0ng c\u00F3 b\u1ED1n gh\u1EBF (b\u1ED1n ch\u1ED7 ng\u1ED3i).'; - break; - case 3: - output += 'M\u1ED9t chi\u1EBFc m\u00E1y bay n\u00E0y c\u00F3 hai ch\u1ED7 ng\u1ED3i \u1EDF s\u00E0n (cho phi c\u00F4ng tr\u01B0\u1EDFng v\u00E0 phi c\u00F4ng ph\u00F3), v\u00E0 m\u1ED9t s\u1ED1 h\u00E0ng gh\u1EBF h\u1EA1ng 1 v\u00E0 h\u1EA1ng 2. M\u1ED7i h\u00E0ng h\u1EA1ng 1 c\u00F3 b\u1ED1n ch\u1ED7 ng\u1ED3i. M\u1ED7i h\u00E0ng h\u1EA1ng 2 c\u00F3 n\u0103m ch\u1ED7 ng\u1ED3i.'; - break; - } - output += '</p><p>D\u01B0\u1EDBi \u0111\u00E2y h\u00E3y t\u1EA1o c\u00F4ng th\u1EE9c t\u00EDnh s\u1ED1 ch\u1ED7 ng\u1ED3i tr\u00EAn m\u00E1y bay \u0111\u1EC3 n\u00F3 thay \u0111\u1ED5i t\u00F9y theo s\u1ED1 l\u01B0\u1EE3ng h\u00E0ng gh\u1EBF (h\u00ECnh tr\u00EAn).</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/zh-hans.js b/res/lib/blockly/demos/plane/generated/zh-hans.js deleted file mode 100644 index 3331b8e990eaea81f8632e6cd70c28388e48cde0..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/zh-hans.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">\u884C\uFF1A%1</span><span id="Plane_getRows">\u884C (%1)</span><span id="Plane_rows1">\u5934\u7B49\u884C\uFF1A%1</span><span id="Plane_getRows1">\u5934\u7B49\u884C\uFF08%1\uFF09</span><span id="Plane_rows2">\u7ECF\u6D4E\u7B49\u884C\uFF1A%1</span><span id="Plane_getRows2">\u7ECF\u6D4E\u7B49\u884C\uFF08%1\uFF09</span><span id="Plane_seats">\u5EA7\u4F4D\uFF1A%1</span><span id="Plane_placeholder">\uFF1F</span><span id="Plane_setSeats">\u5EA7\u4F4D\uFF1D</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">\u98DE\u673A\u5EA7\u4F4D\u8BA1\u7B97\u5668</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += '\u4E00\u67B6\u98DE\u673A\u6709\u4E00\u5B9A\u91CF\u884C\u6570\u7684\u4E58\u5BA2\u5EA7\u4F4D\uFF0C\u6BCF\u884C\u5171\u56DB\u5EA7\u3002'; - break; - case 2: - output += '\u4E00\u67B6\u98DE\u673A\u9664\u4E86\u6709\u4E24\u4E2A\u5EA7\u4F4D\u4F9B\u6B63\u526F\u9A7E\u9A76\u5458\uFF0C\u8FD8\u6709\u4E00\u5B9A\u91CF\u884C\u6570\u7684\u4E58\u5BA2\u5EA7\u4F4D\u3002\u6BCF\u884C\u5171\u56DB\u5EA7\u3002'; - break; - case 3: - output += '\u4E00\u67B6\u98DE\u673A\u9664\u4E86\u6709\u4E24\u4E2A\u5EA7\u4F4D\u4F9B\u6B63\u526F\u9A7E\u9A76\u5458\uFF0C\u8FD8\u6709\u4E00\u5B9A\u91CF\u884C\u6570\u7684\u5934\u7B49\u53CA\u7ECF\u6D4E\u4E58\u5BA2\u5EA7\u4F4D\u3002\u5934\u7B49\u6BCF\u884C\u5171\u56DB\u5EA7\uFF0C\u7ECF\u6D4E\u6BCF\u884C\u5171\u4E94\u5EA7\u3002'; - break; - } - output += '</p><p>\u4E8E\u4E0B\u65B9\u5199\u51FA\u4E00\u6761\u516C\u5F0F\u4EE5\u8BA1\u7B97\u98DE\u673A\u4E0A\u7684\u5EA7\u4F4D\u603B\u6570\u3002</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/generated/zh-hant.js b/res/lib/blockly/demos/plane/generated/zh-hant.js deleted file mode 100644 index 8eeb91d86d57a0c9682d05a33b349336d98da751..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/generated/zh-hant.js +++ /dev/null @@ -1,50 +0,0 @@ -// This file was automatically generated from template.soy. -// Please don't edit this file by hand. - -/** - * @fileoverview Templates in namespace planepage. - */ - -if (typeof planepage == 'undefined') { var planepage = {}; } - - -planepage.messages = function(opt_data, opt_ignored, opt_ijData) { - return '<div style="display: none"><span id="Plane_rows">\u6392\uFF1A%1</span><span id="Plane_getRows">\u6392\uFF08%1\uFF09</span><span id="Plane_rows1">\u982D\u7B49\u8259\uFF1A%1 \u6392</span><span id="Plane_getRows1">\u982D\u7B49\u8259\uFF08%1\uFF09</span><span id="Plane_rows2">\u7D93\u6FDF\u8259\uFF1A%1 \u6392</span><span id="Plane_getRows2">\u7D93\u6FDF\u8259\uFF08%1\uFF09</span><span id="Plane_seats">\u5EA7\u4F4D\uFF1A%1</span><span id="Plane_placeholder">\uFF1F</span><span id="Plane_setSeats">\u5EA7\u4F4D\uFF1D</span></div>'; -}; -if (goog.DEBUG) { - planepage.messages.soyTemplateName = 'planepage.messages'; -} - - -planepage.start = function(opt_data, opt_ignored, opt_ijData) { - var output = planepage.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ > <a href="../index.html">Demos</a>‏ > <span id="title">\u98DB\u6A5F\u5EA7\u4F4D\u8A08\u7B97\u5668</span> '; - var iLimit47 = opt_ijData.maxLevel + 1; - for (var i47 = 1; i47 < iLimit47; i47++) { - output += ' ' + ((i47 == opt_ijData.level) ? '<span class="tab" id="selected">' + soy.$$escapeHtml(i47) + '</span>' : (i47 < opt_ijData.level) ? '<a class="tab previous" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>' : '<a class="tab" href="?lang=' + soy.$$escapeHtml(opt_ijData.lang) + '&level=' + soy.$$escapeHtml(i47) + '">' + soy.$$escapeHtml(i47) + '</a>'); - } - output += '</h1></td><td class="farSide"><span ' + ((opt_ijData.lang == 'en') ? 'id="languageBorder"' : '') + ' style="padding: 10px"><select id="languageMenu"></select></span></td></tr></table><script src="slider.js"><\/script><svg id="plane" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600" height="320" viewBox="0 110 600 320"><defs><g id="row1st"><rect class="seat1st" width="10" height="10" x="75" y="243" /><rect class="seat1st" width="10" height="10" x="75" y="254" /><rect class="seat1st" width="10" height="10" x="75" y="272" /><rect class="seat1st" width="10" height="10" x="75" y="283" /></g><g id="row2nd"><rect class="seat2nd" width="10" height="8" x="75" y="243" /><rect class="seat2nd" width="10" height="8" x="75" y="251" /><rect class="seat2nd" width="10" height="8" x="75" y="269" /><rect class="seat2nd" width="10" height="8" x="75" y="277" /><rect class="seat2nd" width="10" height="8" x="75" y="285" /></g><linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient><linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fff;stop-opacity:0" /><stop offset="100%" style="stop-color:#fff;stop-opacity:1" /></linearGradient></defs><path d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" id="wing" /><path d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" id="tail" /><path d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" id="fuselage" /><rect width="610" height="100" x="-5" y="110" fill="url(#grad1)" /><rect width="610" height="100" x="-5" y="330" fill="url(#grad2)" /><text id="row1stText" x="55" y="380"></text><text id="row2ndText" x="55" y="420"></text><text x="55" y="210"><tspan id="seatText"></tspan><tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan><tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan></text>' + ((opt_ijData.level > 1) ? '<rect id="crew_right" class="crew" width="10" height="10" x="35" y="254" /><rect id="crew_left" class="crew" width="10" height="10" x="35" y="272" />' : '') + '</svg><p>'; - switch (opt_ijData.level) { - case 1: - output += '\u4E00\u67B6\u98DB\u6A5F\u6709\u4E00\u5B9A\u91CF\u884C\u6578\u7684\u4E58\u5BA2\u5EA7\u4F4D\uFF0C\u6BCF\u6392\u90FD\u5305\u542B\u56DB\u500B\u5E2D\u4F4D\u3002'; - break; - case 2: - output += '\u4E00\u67B6\u98DB\u6A5F\u9664\u4E86\u6709\u5169\u500B\u5EA7\u4F4D\u4F9B\u6B63\u526F\u6A5F\u5E2B\uFF0C\u9084\u6709\u4E00\u5B9A\u91CF\u884C\u6578\u7684\u4E58\u5BA2\u5EA7\u4F4D\u3002\u6BCF\u6392\u90FD\u5305\u542B\u56DB\u500B\u5E2D\u4F4D\u3002'; - break; - case 3: - output += '\u4E00\u67B6\u98DB\u6A5F\u9664\u4E86\u6709\u5169\u500B\u5EA7\u4F4D\u4F9B\u6B63\u526F\u6A5F\u5E2B\uFF0C\u9084\u6709\u4E00\u5B9A\u91CF\u884C\u6578\u7684\u982D\u7B49\u53CA\u7D93\u6FDF\u4E58\u5BA2\u5EA7\u4F4D\u3002\u982D\u7B49\u8259\u6BCF\u6392\u90FD\u5305\u542B\u56DB\u500B\u5E2D\u4F4D\uFF0C\u7D93\u6FDF\u8259\u6BCF\u6392\u90FD\u5305\u542B\u4E94\u500B\u5E2D\u4F4D\u3002\u3002'; - break; - } - output += '</p><p>\u65BC\u4E0B\u65B9\u5BEB\u51FA\u4E00\u689D\u516C\u5F0F\u4EE5\u8A08\u7B97\u98DB\u6A5F\u4E0A\u7684\u5EA7\u4F4D\u7E3D\u6578\u3002</p><script src="../../blockly_compressed.js"><\/script><script src="../../blocks_compressed.js"><\/script><script src="../../javascript_compressed.js"><\/script><script src="../../msg/js/' + soy.$$escapeHtml(opt_ijData.lang) + '.js"><\/script><script src="blocks.js"><\/script>' + planepage.toolbox(null, null, opt_ijData) + '<div id="blockly"></div>'; - return output; -}; -if (goog.DEBUG) { - planepage.start.soyTemplateName = 'planepage.start'; -} - - -planepage.toolbox = function(opt_data, opt_ignored, opt_ijData) { - return '<xml id="toolbox" style="display: none"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_arithmetic"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block>' + ((opt_ijData.level <= 2) ? '<block type="plane_get_rows"></block>' : '<block type="plane_get_rows1st"></block><block type="plane_get_rows2nd"></block>') + '</xml>'; -}; -if (goog.DEBUG) { - planepage.toolbox.soyTemplateName = 'planepage.toolbox'; -} diff --git a/res/lib/blockly/demos/plane/icon.png b/res/lib/blockly/demos/plane/icon.png deleted file mode 100644 index 816cc75f8fb0101ead08a44b35dd3610ef6fbb88..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/plane/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/plane/index.html b/res/lib/blockly/demos/plane/index.html deleted file mode 100644 index dec1cd3cd7b52fa2be923252bd2f71b82b661ffb..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/index.html +++ /dev/null @@ -1,19 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <meta name="google" value="notranslate"> - <title>Blockly Demo:</title> - <link rel="stylesheet" href="style.css"> - <script src="soy/soyutils.js"></script> - <script src="plane.js"></script> -</head> -<body> - <script> - document.write(planepage.start({}, null, - {lang: Plane.LANG, - level: Plane.LEVEL, - maxLevel: Plane.MAX_LEVEL})); - </script> -</body> -</html> diff --git a/res/lib/blockly/demos/plane/plane.js b/res/lib/blockly/demos/plane/plane.js deleted file mode 100644 index 182de9edc1c75de11d80ae1d016a7b3c1202737c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/plane.js +++ /dev/null @@ -1,442 +0,0 @@ -/** - * @license - * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview JavaScript for Blockly's Plane Seat Calculator demo. - * @author fraser@google.com (Neil Fraser) - */ -'use strict'; - -/** - * Create a namespace for the application. - */ -var Plane = {}; - -/** - * Lookup for names of supported languages. Keys should be in ISO 639 format. - */ -Plane.LANGUAGE_NAME = { - 'ar': 'العربية', - 'be-tarask': 'TaraÅ¡kievica', - 'br': 'Brezhoneg', - 'ca': 'Català ', - 'da': 'Dansk', - 'de': 'Deutsch', - 'el': 'Ελληνικά', - 'en': 'English', - 'es': 'Español', - 'fa': 'ÙØ§Ø±Ø³ÛŒ', - 'fr': 'Français', - 'he': 'עברית', - 'hrx': 'Hunsrik', - 'hu': 'Magyar', - 'ia': 'Interlingua', - 'is': 'Ãslenska', - 'it': 'Italiano', - 'ja': '日本語', - 'ko': '한êµì–´', - 'ms': 'Bahasa Melayu', - 'nb': 'Norsk BokmÃ¥l', - 'nl': 'Nederlands, Vlaams', - 'pl': 'Polski', - 'pms': 'Piemontèis', - 'pt-br': 'Português Brasileiro', - 'ro': 'Română', - 'ru': 'РуÑÑкий', - 'sc': 'Sardu', - 'sv': 'Svenska', - 'th': 'ภาษาไทย', - 'tr': 'Türkçe', - 'uk': 'УкраїнÑька', - 'vi': 'Tiếng Việt', - 'zh-hans': 'ç®€ä½“ä¸æ–‡', - 'zh-hant': 'æ£é«”䏿–‡' -}; - -/** - * List of RTL languages. - */ -Plane.LANGUAGE_RTL = ['ar', 'fa', 'he']; - -/** - * Main Blockly workspace. - * @type {Blockly.WorkspaceSvg} - */ -Plane.workspace = null; - -/** - * Extracts a parameter from the URL. - * If the parameter is absent default_value is returned. - * @param {string} name The name of the parameter. - * @param {string} defaultValue Value to return if paramater not found. - * @return {string} The parameter value or the default value if not found. - */ -Plane.getStringParamFromUrl = function(name, defaultValue) { - var val = location.search.match(new RegExp('[?&]' + name + '=([^&]+)')); - return val ? decodeURIComponent(val[1].replace(/\+/g, '%20')) : defaultValue; -}; - -/** - * Extracts a numeric parameter from the URL. - * If the parameter is absent or less than min_value, min_value is - * returned. If it is greater than max_value, max_value is returned. - * @param {string} name The name of the parameter. - * @param {number} minValue The minimum legal value. - * @param {number} maxValue The maximum legal value. - * @return {number} A number in the range [min_value, max_value]. - */ -Plane.getNumberParamFromUrl = function(name, minValue, maxValue) { - var val = Number(Plane.getStringParamFromUrl(name, 'NaN')); - return isNaN(val) ? minValue : Math.min(Math.max(minValue, val), maxValue); -}; - -/** - * Get the language of this user from the URL. - * @return {string} User's language. - */ -Plane.getLang = function() { - var lang = Plane.getStringParamFromUrl('lang', ''); - if (Plane.LANGUAGE_NAME[lang] === undefined) { - // Default to English. - lang = 'en'; - } - return lang; -}; - -/** - * Is the current language (Plane.LANG) an RTL language? - * @return {boolean} True if RTL, false if LTR. - */ -Plane.isRtl = function() { - return Plane.LANGUAGE_RTL.indexOf(Plane.LANG) != -1; -}; - -/** - * Load blocks saved in session/local storage. - * @param {string} defaultXml Text representation of default blocks. - */ -Plane.loadBlocks = function(defaultXml) { - try { - var loadOnce = window.sessionStorage.loadOnceBlocks; - } catch(e) { - // Firefox sometimes throws a SecurityError when accessing sessionStorage. - // Restarting Firefox fixes this, so it looks like a bug. - var loadOnce = null; - } - if (loadOnce) { - // Language switching stores the blocks during the reload. - delete window.sessionStorage.loadOnceBlocks; - var xml = Blockly.Xml.textToDom(loadOnce); - Blockly.Xml.domToWorkspace(xml, Plane.workspace); - } else if (defaultXml) { - // Load the editor with default starting blocks. - var xml = Blockly.Xml.textToDom(defaultXml); - Blockly.Xml.domToWorkspace(xml, Plane.workspace); - } - Plane.workspace.clearUndo(); -}; - -/** - * Save the blocks and reload with a different language. - */ -Plane.changeLanguage = function() { - // Store the blocks for the duration of the reload. - // This should be skipped for the index page, which has no blocks and does - // not load Blockly. - // MSIE 11 does not support sessionStorage on file:// URLs. - if (typeof Blockly != 'undefined' && window.sessionStorage) { - var xml = Blockly.Xml.workspaceToDom(Plane.workspace); - var text = Blockly.Xml.domToText(xml); - window.sessionStorage.loadOnceBlocks = text; - } - - var languageMenu = document.getElementById('languageMenu'); - var newLang = encodeURIComponent( - languageMenu.options[languageMenu.selectedIndex].value); - var search = window.location.search; - if (search.length <= 1) { - search = '?lang=' + newLang; - } else if (search.match(/[?&]lang=[^&]*/)) { - search = search.replace(/([?&]lang=)[^&]*/, '$1' + newLang); - } else { - search = search.replace(/\?/, '?lang=' + newLang + '&'); - } - - window.location = window.location.protocol + '//' + - window.location.host + window.location.pathname + search; -}; - -/** - * Gets the message with the given key from the document. - * @param {string} key The key of the document element. - * @return {string} The textContent of the specified element, - * or an error message if the element was not found. - */ -Plane.getMsg = function(key) { - var element = document.getElementById(key); - if (element) { - var text = element.textContent; - // Convert newline sequences. - text = text.replace(/\\n/g, '\n'); - return text; - } else { - return '[Unknown message: ' + key + ']'; - } -}; - -/** - * User's language (e.g. "en"). - * @type {string} - */ -Plane.LANG = Plane.getLang(); - -Plane.MAX_LEVEL = 3; -Plane.LEVEL = Plane.getNumberParamFromUrl('level', 1, Plane.MAX_LEVEL); - -Plane.rows1st = 0; -Plane.rows2nd = 0; - -/** - * Redraw the rows when the slider has moved. - * @param {number} value New slider position. - */ -Plane.sliderChange = function(value) { - var newRows = Math.round(value * 410 / 20); - Plane.redraw(newRows); -}; - -/** - * Change the text of a label. - * @param {string} id ID of element to change. - * @param {string} text New text. - */ -Plane.setText = function(id, text) { - var el = document.getElementById(id); - while (el.firstChild) { - el.removeChild(el.firstChild); - } - el.appendChild(document.createTextNode(text)); -}; - -/** - * Display a checkmark or cross next to the answer. - * @param {?boolean} ok True for checkmark, false for cross, null for nothing. - */ -Plane.setCorrect = function(ok) { - var yes = document.getElementById('seatYes'); - var no = document.getElementById('seatNo'); - yes.style.display = 'none'; - no.style.display = 'none'; - if (ok === true) { - yes.style.display = 'block'; - } else if (ok === false) { - no.style.display = 'block'; - } -}; - -/** - * Initialize Blockly and the SVG plane. - */ -Plane.init = function() { - Plane.initLanguage(); - - // Fixes viewport for small screens. - var viewport = document.querySelector('meta[name="viewport"]'); - if (viewport && screen.availWidth < 725) { - viewport.setAttribute('content', - 'width=725, initial-scale=.35, user-scalable=no'); - } - - Plane.workspace = Blockly.inject('blockly', - {media: '../../media/', - rtl: Plane.isRtl(), - toolbox: document.getElementById('toolbox')}); - - var defaultXml = - '<xml xmlns="https://developers.google.com/blockly/xml">' + - ' <block type="plane_set_seats" deletable="false" x="70" y="70">' + - ' </block>' + - '</xml>'; - Plane.loadBlocks(defaultXml); - - Plane.workspace.addChangeListener(Plane.recalculate); - Plane.workspace.addChangeListener(Blockly.Events.disableOrphans); - - // Initialize the slider. - var svg = document.getElementById('plane'); - Plane.rowSlider = new Slider(60, 330, 425, svg, Plane.sliderChange); - Plane.rowSlider.setValue(0.225); - - // Draw five 1st class rows. - Plane.redraw(5); -}; - -/** - * Initialize the page language. - */ -Plane.initLanguage = function() { - // Set the page title with the content of the H1 title. - document.title += ' ' + document.getElementById('title').textContent; - - // Set the HTML's language and direction. - // document.dir fails in Mozilla, use document.body.parentNode.dir instead. - // https://bugzilla.mozilla.org/show_bug.cgi?id=151407 - var rtl = Plane.isRtl(); - document.head.parentElement.setAttribute('dir', rtl ? 'rtl' : 'ltr'); - document.head.parentElement.setAttribute('lang', Plane.LANG); - - // Sort languages alphabetically. - var languages = []; - for (var lang in Plane.LANGUAGE_NAME) { - languages.push([Plane.LANGUAGE_NAME[lang], lang]); - } - var comp = function(a, b) { - // Sort based on first argument ('English', 'РуÑÑкий', '简体å—', etc). - if (a[0] > b[0]) return 1; - if (a[0] < b[0]) return -1; - return 0; - }; - languages.sort(comp); - // Populate the language selection menu. - var languageMenu = document.getElementById('languageMenu'); - languageMenu.options.length = 0; - for (var i = 0; i < languages.length; i++) { - var tuple = languages[i]; - var lang = tuple[tuple.length - 1]; - var option = new Option(tuple[0], lang); - if (lang == Plane.LANG) { - option.selected = true; - } - languageMenu.options.add(option); - } - languageMenu.addEventListener('change', Plane.changeLanguage, true); -}; - -/** - * Use the blocks to calculate the number of seats. - * Display the calculated number. - */ -Plane.recalculate = function() { - // Find the 'set' block and use it as the formula root. - var rootBlock = null; - var blocks = Plane.workspace.getTopBlocks(false); - for (var i = 0, block; block = blocks[i]; i++) { - if (block.type == 'plane_set_seats') { - rootBlock = block; - } - } - var seats = NaN; - Blockly.JavaScript.init(Plane.workspace); - var code = Blockly.JavaScript.blockToCode(rootBlock); - try { - seats = eval(code); - } catch (e) { - // Allow seats to remain NaN. - } - Plane.setText('seatText', - Plane.getMsg('Plane_seats').replace( - '%1', isNaN(seats) ? '?' : seats)); - Plane.setCorrect(isNaN(seats) ? null : (Plane.answer() == seats)); - - // Update blocks to show values. - function updateBlocks(blocks) { - for (var i = 0, block; block = blocks[i]; i++) { - block.customUpdate && block.customUpdate(); - } - } - updateBlocks(Plane.workspace.getAllBlocks(false)); - updateBlocks(Plane.workspace.flyout_.workspace_.getAllBlocks(false)); -}; - -/** - * Calculate the correct answer. - * @return {number} Number of seats. - */ -Plane.answer = function() { - if (Plane.LEVEL == 1) { - return Plane.rows1st * 4; - } else if (Plane.LEVEL == 2) { - return 2 + (Plane.rows1st * 4); - } else if (Plane.LEVEL == 3) { - return 2 + (Plane.rows1st * 4) + (Plane.rows2nd * 5); - } - throw 'Unknown level.'; -}; - -/** - * Redraw the SVG to show a new number of rows. - * @param {number} newRows - */ -Plane.redraw = function(newRows) { - var rows1st = Plane.rows1st; - var rows2nd = Plane.rows2nd; - var svg = document.getElementById('plane'); - if (newRows != rows1st) { - while (newRows < rows1st) { - var row = document.getElementById('row1st' + rows1st); - row.parentNode.removeChild(row); - rows1st--; - } - while (newRows > rows1st) { - rows1st++; - var row = document.createElementNS('http://www.w3.org/2000/svg', 'use'); - row.id = 'row1st' + rows1st; - // Row of 4 seats. - row.setAttribute('x', (rows1st - 1) * 20); - row.setAttributeNS('http://www.w3.org/1999/xlink', - 'xlink:href', '#row1st'); - svg.appendChild(row); - } - - if (Plane.LEVEL == 3) { - newRows = Math.floor((21 - newRows) * 1.11); - while (newRows < rows2nd) { - var row = document.getElementById('row2nd' + rows2nd); - row.parentNode.removeChild(row); - rows2nd--; - } - while (newRows > rows2nd) { - rows2nd++; - var row = document.createElementNS('http://www.w3.org/2000/svg', 'use'); - row.id = 'row2nd' + rows2nd; - row.setAttribute('x', 400 - (rows2nd - 1) * 18); - row.setAttributeNS('http://www.w3.org/1999/xlink', - 'xlink:href', '#row2nd'); - svg.appendChild(row); - } - } - - if (Plane.LEVEL < 3) { - Plane.setText('row1stText', - Plane.getMsg('Plane_rows').replace('%1', rows1st)); - } else { - Plane.setText('row1stText', - Plane.getMsg('Plane_rows1').replace('%1', rows1st)); - Plane.setText('row2ndText', - Plane.getMsg('Plane_rows2').replace('%1', rows2nd)); - } - - Plane.rows1st = rows1st; - Plane.rows2nd = rows2nd; - Plane.recalculate(); - } -}; - -window.addEventListener('load', Plane.init); - -// Load the user's language pack. -document.write('<script src="generated/' + Plane.LANG + '.js"></script>\n'); diff --git a/res/lib/blockly/demos/plane/slider.js b/res/lib/blockly/demos/plane/slider.js deleted file mode 100644 index a21965346ff3fc2cc0c49cc9dcce0e40c36043e0..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/slider.js +++ /dev/null @@ -1,285 +0,0 @@ -/** - * @license - * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview A slider control in SVG. - * @author fraser@google.com (Neil Fraser) - */ -'use strict'; - - -/** - * Object representing a horizontal slider widget. - * @param {number} x The horizontal offset of the slider. - * @param {number} y The vertical offset of the slider. - * @param {number} width The total width of the slider. - * @param {!Element} svgParent The SVG element to append the slider to. - * @param {Function=} opt_changeFunc Optional callback function that will be - * called when the slider is moved. The current value is passed. - * @constructor - */ -var Slider = function(x, y, width, svgParent, opt_changeFunc) { - this.KNOB_Y_ = y - 12; - this.KNOB_MIN_X_ = x + 8; - this.KNOB_MAX_X_ = x + width - 8; - this.TARGET_OVERHANG_ = 20; - this.value_ = 0.5; - this.changeFunc_ = opt_changeFunc; - this.animationTasks_ = []; - - // Draw the slider. - /* - <line class="sliderTrack" x1="10" y1="35" x2="140" y2="35" /> - <rect style="opacity: 0" x="5" y="25" width="150" height="20" /> - <path id="knob" - transform="translate(67, 23)" - d="m 8,0 l -8,8 v 12 h 16 v -12 z" /> - <circle style="opacity: 0" r="20" cy="35" cx="75"></circle> - */ - var track = document.createElementNS(Slider.SVG_NS_, 'line'); - track.setAttribute('class', 'sliderTrack'); - track.setAttribute('x1', x); - track.setAttribute('y1', y); - track.setAttribute('x2', x + width); - track.setAttribute('y2', y); - svgParent.appendChild(track); - this.track_ = track; - var rect = document.createElementNS(Slider.SVG_NS_, 'rect'); - rect.setAttribute('style', 'opacity: 0'); - rect.setAttribute('x', x - this.TARGET_OVERHANG_); - rect.setAttribute('y', y - this.TARGET_OVERHANG_); - rect.setAttribute('width', width + 2 * this.TARGET_OVERHANG_); - rect.setAttribute('height', 2 * this.TARGET_OVERHANG_); - rect.setAttribute('rx', this.TARGET_OVERHANG_); - rect.setAttribute('ry', this.TARGET_OVERHANG_); - svgParent.appendChild(rect); - this.trackTarget_ = rect; - var knob = document.createElementNS(Slider.SVG_NS_, 'path'); - knob.setAttribute('class', 'sliderKnob'); - knob.setAttribute('d', 'm 0,0 l -8,8 v 12 h 16 v -12 z'); - svgParent.appendChild(knob); - this.knob_ = knob; - var circle = document.createElementNS(Slider.SVG_NS_, 'circle'); - circle.setAttribute('style', 'opacity: 0'); - circle.setAttribute('r', this.TARGET_OVERHANG_); - circle.setAttribute('cy', y); - svgParent.appendChild(circle); - this.knobTarget_ = circle; - this.setValue(0.5); - - // Find the root SVG object. - while (svgParent && svgParent.nodeName.toLowerCase() != 'svg') { - svgParent = svgParent.parentNode; - } - this.SVG_ = svgParent; - - // Bind the events to this slider. - Slider.bindEvent_(this.knobTarget_, 'mousedown', this, this.knobMouseDown_); - Slider.bindEvent_(this.knobTarget_, 'touchstart', this, this.knobMouseDown_); - Slider.bindEvent_(this.trackTarget_, 'mousedown', this, this.rectMouseDown_); - Slider.bindEvent_(this.SVG_, 'mouseup', null, Slider.knobMouseUp_); - Slider.bindEvent_(this.SVG_, 'touchend', null, Slider.knobMouseUp_); - Slider.bindEvent_(this.SVG_, 'mousemove', null, Slider.knobMouseMove_); - Slider.bindEvent_(this.SVG_, 'touchmove', null, Slider.knobMouseMove_); - Slider.bindEvent_(document, 'mouseover', null, Slider.mouseOver_); -}; - - -Slider.SVG_NS_ = 'http://www.w3.org/2000/svg'; - -Slider.activeSlider_ = null; -Slider.startMouseX_ = 0; -Slider.startKnobX_ = 0; - -/** - * Start a drag when clicking down on the knob. - * @param {!Event} e Mouse-down event. - * @private - */ -Slider.prototype.knobMouseDown_ = function(e) { - if (e.type == 'touchstart') { - if (e.changedTouches.length != 1) { - return; - } - Slider.touchToMouse_(e) - } - Slider.activeSlider_ = this; - Slider.startMouseX_ = this.mouseToSvg_(e).x; - Slider.startKnobX_ = 0; - var transform = this.knob_.getAttribute('transform'); - if (transform) { - var r = transform.match(/translate\(\s*([-\d.]+)/); - if (r) { - Slider.startKnobX_ = Number(r[1]); - } - } - // Stop browser from attempting to drag the knob or - // from scrolling/zooming the page. - e.preventDefault(); -}; - -/** - * Stop a drag when clicking up anywhere. - * @param {Event} e Mouse-up event. - * @private - */ -Slider.knobMouseUp_ = function(e) { - Slider.activeSlider_ = null; -}; - -/** - * Stop a drag when the mouse enters a node not part of the SVG. - * @param {Event} e Mouse-up event. - * @private - */ -Slider.mouseOver_ = function(e) { - if (!Slider.activeSlider_) { - return; - } - var node = e.target; - // Find the root SVG object. - do { - if (node == Slider.activeSlider_.SVG_) { - return; - } - } while (node = node.parentNode); - Slider.knobMouseUp_(e); -}; - -/** - * Drag the knob to follow the mouse. - * @param {!Event} e Mouse-move event. - * @private - */ -Slider.knobMouseMove_ = function(e) { - var thisSlider = Slider.activeSlider_; - if (!thisSlider) { - return; - } - if (e.type == 'touchmove') { - if (e.changedTouches.length != 1) { - return; - } - Slider.touchToMouse_(e) - } - var x = thisSlider.mouseToSvg_(e).x - Slider.startMouseX_ + - Slider.startKnobX_; - thisSlider.setValue((x - thisSlider.KNOB_MIN_X_) / - (thisSlider.KNOB_MAX_X_ - thisSlider.KNOB_MIN_X_)); -}; - -/** - * Jump to a new value when the track is clicked. - * @param {!Event} e Mouse-down event. - * @private - */ -Slider.prototype.rectMouseDown_ = function(e) { - if (e.type == 'touchstart') { - if (e.changedTouches.length != 1) { - return; - } - Slider.touchToMouse_(e) - } - var x = this.mouseToSvg_(e).x; - this.animateValue((x - this.KNOB_MIN_X_) / - (this.KNOB_MAX_X_ - this.KNOB_MIN_X_)); -}; - -/** - * Returns the slider's value (0.0 - 1.0). - * @return {number} Current value. - */ -Slider.prototype.getValue = function() { - return this.value_; -}; - -/** - * Animates the slider's value (0.0 - 1.0). - * @param {number} value New value. - */ -Slider.prototype.animateValue = function(value) { - // Clear any ongoing animations. - while (this.animationTasks_.length) { - clearTimeout(this.animationTasks_.pop()); - } - var duration = 200; // Milliseconds to animate for. - var steps = 10; // Number of steps to animate. - var oldValue = this.getValue(); - var thisSlider = this; - var stepFunc = function(i) { - return function() { - var newVal = i * (value - oldValue) / (steps - 1) + oldValue; - thisSlider.setValue(newVal); - }; - } - for (var i = 0; i < steps; i++) { - this.animationTasks_.push(setTimeout(stepFunc(i), i * duration / steps)); - } -}; - -/** - * Sets the slider's value (0.0 - 1.0). - * @param {number} value New value. - */ -Slider.prototype.setValue = function(value) { - this.value_ = Math.min(Math.max(value, 0), 1); - var x = this.KNOB_MIN_X_ + - (this.KNOB_MAX_X_ - this.KNOB_MIN_X_) * this.value_; - this.knob_.setAttribute('transform', - 'translate(' + x + ',' + this.KNOB_Y_ + ')'); - this.knobTarget_.setAttribute('cx', x); - this.changeFunc_ && this.changeFunc_(this.value_); -}; - -/** - * Convert the mouse coordinates into SVG coordinates. - * @param {!Object} e Object with x and y mouse coordinates. - * @return {!Object} Object with x and y properties in SVG coordinates. - * @private - */ -Slider.prototype.mouseToSvg_ = function(e) { - var svgPoint = this.SVG_.createSVGPoint(); - svgPoint.x = e.clientX; - svgPoint.y = e.clientY; - var matrix = this.SVG_.getScreenCTM().inverse(); - return svgPoint.matrixTransform(matrix); -}; - -/** - * Bind an event to a function call. - * @param {!Node} node Node upon which to listen. - * @param {string} name Event name to listen to (e.g. 'mousedown'). - * @param {Object} thisObject The value of 'this' in the function. - * @param {!Function} func Function to call when event is triggered. - * @private - */ -Slider.bindEvent_ = function(node, name, thisObject, func) { - var wrapFunc = function(e) { - func.apply(thisObject, arguments); - }; - node.addEventListener(name, wrapFunc, false); -}; - -/** - * Map the touch event's properties to be compatible with a mouse event. - * @param {TouchEvent} e Event to modify. - */ -Slider.touchToMouse_ = function(e) { - var touchPoint = e.changedTouches[0]; - e.clientX = touchPoint.clientX; - e.clientY = touchPoint.clientY; -}; diff --git a/res/lib/blockly/demos/plane/soy/COPYING b/res/lib/blockly/demos/plane/soy/COPYING deleted file mode 100644 index d645695673349e3947e8e5ae42332d0ac3164cd7..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/soy/COPYING +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/res/lib/blockly/demos/plane/soy/README b/res/lib/blockly/demos/plane/soy/README deleted file mode 100644 index 51aa75caf584dcb63318333664a92428945a387c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/soy/README +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2009 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -Contents: - -+ SoyToJsSrcCompiler.jar - Executable jar that compiles template files into JavaScript files. - -+ SoyMsgExtractor.jar - Executable jar that extracts messages from template files into XLF files. - -+ soyutils.js - Helper utilities required by all JavaScript code that SoyToJsSrcCompiler - generates. Equivalent functionality to soyutils_usegoog.js, but this - version does not need Closure Library. - - -Instructions: - -+ A simple Hello World for JavaScript: - http://code.google.com/closure/templates/docs/helloworld_js.html - -+ Complete documentation: - http://code.google.com/closure/templates/ - -+ Closure Templates project on Google Code: - http://code.google.com/p/closure-templates/ - - -Notes: - -+ Closure Templates requires Java 6 or higher: - http://www.java.com/ diff --git a/res/lib/blockly/demos/plane/soy/SoyMsgExtractor.jar b/res/lib/blockly/demos/plane/soy/SoyMsgExtractor.jar deleted file mode 100644 index d5c112f5ed65c873f018b375feb7d6e70eeff040..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/plane/soy/SoyMsgExtractor.jar and /dev/null differ diff --git a/res/lib/blockly/demos/plane/soy/SoyToJsSrcCompiler.jar b/res/lib/blockly/demos/plane/soy/SoyToJsSrcCompiler.jar deleted file mode 100644 index bb3b7a9794c85d44b31bcbd3fd56009f3d630830..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/plane/soy/SoyToJsSrcCompiler.jar and /dev/null differ diff --git a/res/lib/blockly/demos/plane/soy/soyutils.js b/res/lib/blockly/demos/plane/soy/soyutils.js deleted file mode 100644 index 861c81f9fd5eb517e5b704358f74b48a77d19f36..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/soy/soyutils.js +++ /dev/null @@ -1,3299 +0,0 @@ -/** - * @license - * Copyright 2008 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview - * Utility functions and classes for Soy. - * - * <p> - * The top portion of this file contains utilities for Soy users:<ul> - * <li> soy.StringBuilder: Compatible with the 'stringbuilder' code style. - * <li> soy.renderElement: Render template and set as innerHTML of an element. - * <li> soy.renderAsFragment: Render template and return as HTML fragment. - * </ul> - * - * <p> - * The bottom portion of this file contains utilities that should only be called - * by Soy-generated JS code. Please do not use these functions directly from - * your hand-writen code. Their names all start with '$$'. - * - * @author Garrett Boyer - * @author Mike Samuel - * @author Kai Huang - * @author Aharon Lanin - */ - - -// COPIED FROM nogoog_shim.js - -// Create closure namespaces. -var goog = goog || {}; - - -goog.DEBUG = false; - - -goog.inherits = function(childCtor, parentCtor) { - /** @constructor */ - function tempCtor() {}; - tempCtor.prototype = parentCtor.prototype; - childCtor.superClass_ = parentCtor.prototype; - childCtor.prototype = new tempCtor(); - childCtor.prototype.constructor = childCtor; - - /** - * Calls superclass constructor/method. - * @param {!Object} me Should always be "this". - * @param {string} methodName - * @param {...*} var_args - * @return {?} The return value of the superclass method/constructor. - */ - childCtor.base = function(me, methodName, var_args) { - var args = Array.prototype.slice.call(arguments, 2); - return parentCtor.prototype[methodName].apply(me, args); - }; -}; - - -// Just enough browser detection for this file. -if (!goog.userAgent) { - goog.userAgent = (function() { - var userAgent = ""; - if ("undefined" !== typeof navigator && navigator - && "string" == typeof navigator.userAgent) { - userAgent = navigator.userAgent; - } - var isOpera = userAgent.indexOf('Opera') == 0; - return { - jscript: { - /** - * @type {boolean} - */ - HAS_JSCRIPT: 'ScriptEngine' in this - }, - /** - * @type {boolean} - */ - OPERA: isOpera, - /** - * @type {boolean} - */ - IE: !isOpera && userAgent.indexOf('MSIE') != -1, - /** - * @type {boolean} - */ - WEBKIT: !isOpera && userAgent.indexOf('WebKit') != -1 - }; - })(); -} - -if (!goog.asserts) { - goog.asserts = { - /** - * @param {*} condition Condition to check. - */ - assert: function (condition) { - if (!condition) { - throw Error('Assertion error'); - } - }, - /** - * @param {...*} var_args - */ - fail: function (var_args) {} - }; -} - - -// Stub out the document wrapper used by renderAs*. -if (!goog.dom) { - goog.dom = {}; - /** - * @param {Document=} d - * @constructor - */ - goog.dom.DomHelper = function(d) { - this.document_ = d || document; - }; - /** - * @return {!Document} - */ - goog.dom.DomHelper.prototype.getDocument = function() { - return this.document_; - }; - /** - * Creates a new element. - * @param {string} name Tag name. - * @return {!Element} - */ - goog.dom.DomHelper.prototype.createElement = function(name) { - return this.document_.createElement(name); - }; - /** - * Creates a new document fragment. - * @return {!DocumentFragment} - */ - goog.dom.DomHelper.prototype.createDocumentFragment = function() { - return this.document_.createDocumentFragment(); - }; -} - - -if (!goog.format) { - goog.format = { - insertWordBreaks: function(str, maxCharsBetweenWordBreaks) { - str = String(str); - - var resultArr = []; - var resultArrLen = 0; - - // These variables keep track of important state inside str. - var isInTag = false; // whether we're inside an HTML tag - var isMaybeInEntity = false; // whether we might be inside an HTML entity - var numCharsWithoutBreak = 0; // number of chars since last word break - var flushIndex = 0; // index of first char not yet flushed to resultArr - - for (var i = 0, n = str.length; i < n; ++i) { - var charCode = str.charCodeAt(i); - - // If hit maxCharsBetweenWordBreaks, and not space next, then add <wbr>. - if (numCharsWithoutBreak >= maxCharsBetweenWordBreaks && - // space - charCode != 32) { - resultArr[resultArrLen++] = str.substring(flushIndex, i); - flushIndex = i; - resultArr[resultArrLen++] = goog.format.WORD_BREAK; - numCharsWithoutBreak = 0; - } - - if (isInTag) { - // If inside an HTML tag and we see '>', it's the end of the tag. - if (charCode == 62) { - isInTag = false; - } - - } else if (isMaybeInEntity) { - switch (charCode) { - // Inside an entity, a ';' is the end of the entity. - // The entity that just ended counts as one char, so increment - // numCharsWithoutBreak. - case 59: // ';' - isMaybeInEntity = false; - ++numCharsWithoutBreak; - break; - // If maybe inside an entity and we see '<', we weren't actually in - // an entity. But now we're inside and HTML tag. - case 60: // '<' - isMaybeInEntity = false; - isInTag = true; - break; - // If maybe inside an entity and we see ' ', we weren't actually in - // an entity. Just correct the state and reset the - // numCharsWithoutBreak since we just saw a space. - case 32: // ' ' - isMaybeInEntity = false; - numCharsWithoutBreak = 0; - break; - } - - } else { // !isInTag && !isInEntity - switch (charCode) { - // When not within a tag or an entity and we see '<', we're now - // inside an HTML tag. - case 60: // '<' - isInTag = true; - break; - // When not within a tag or an entity and we see '&', we might be - // inside an entity. - case 38: // '&' - isMaybeInEntity = true; - break; - // When we see a space, reset the numCharsWithoutBreak count. - case 32: // ' ' - numCharsWithoutBreak = 0; - break; - // When we see a non-space, increment the numCharsWithoutBreak. - default: - ++numCharsWithoutBreak; - break; - } - } - } - - // Flush the remaining chars at the end of the string. - resultArr[resultArrLen++] = str.substring(flushIndex); - - return resultArr.join(''); - }, - /** - * String inserted as a word break by insertWordBreaks(). Safari requires - * <wbr></wbr>, Opera needs the ­ entity, though this will give a - * visible hyphen at breaks. IE8+ use a zero width space. Other browsers - * just use <wbr>. - * @type {string} - * @private - */ - WORD_BREAK: - goog.userAgent.WEBKIT ? '<wbr></wbr>' : - goog.userAgent.OPERA ? '­' : - goog.userAgent.IE ? '​' : - '<wbr>' - }; -} - - -if (!goog.i18n) { - goog.i18n = { - bidi: {} - }; -} - - -/** - * Constant that defines whether or not the current locale is an RTL locale. - * - * @type {boolean} - */ -goog.i18n.bidi.IS_RTL = false; - - -/** - * Directionality enum. - * @enum {number} - */ -goog.i18n.bidi.Dir = { - /** - * Left-to-right. - */ - LTR: 1, - - /** - * Right-to-left. - */ - RTL: -1, - - /** - * Neither left-to-right nor right-to-left. - */ - NEUTRAL: 0, - - /** - * A historical misnomer for NEUTRAL. - * @deprecated For "neutral", use NEUTRAL; for "unknown", use null. - */ - UNKNOWN: 0 -}; - - -/** - * Convert a directionality given in various formats to a goog.i18n.bidi.Dir - * constant. Useful for interaction with different standards of directionality - * representation. - * - * @param {goog.i18n.bidi.Dir|number|boolean|null} givenDir Directionality given - * in one of the following formats: - * 1. A goog.i18n.bidi.Dir constant. - * 2. A number (positive = LTR, negative = RTL, 0 = neutral). - * 3. A boolean (true = RTL, false = LTR). - * 4. A null for unknown directionality. - * @param {boolean=} opt_noNeutral Whether a givenDir of zero or - * goog.i18n.bidi.Dir.NEUTRAL should be treated as null, i.e. unknown, in - * order to preserve legacy behavior. - * @return {?goog.i18n.bidi.Dir} A goog.i18n.bidi.Dir constant matching the - * given directionality. If given null, returns null (i.e. unknown). - */ -goog.i18n.bidi.toDir = function(givenDir, opt_noNeutral) { - if (typeof givenDir == 'number') { - // This includes the non-null goog.i18n.bidi.Dir case. - return givenDir > 0 ? goog.i18n.bidi.Dir.LTR : - givenDir < 0 ? goog.i18n.bidi.Dir.RTL : - opt_noNeutral ? null : goog.i18n.bidi.Dir.NEUTRAL; - } else if (givenDir == null) { - return null; - } else { - // Must be typeof givenDir == 'boolean'. - return givenDir ? goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR; - } -}; - - -/** - * Estimates the directionality of a string based on relative word counts. - * If the number of RTL words is above a certain percentage of the total number - * of strongly directional words, returns RTL. - * Otherwise, if any words are strongly or weakly LTR, returns LTR. - * Otherwise, returns NEUTRAL. - * Numbers are counted as weakly LTR. - * @param {string} str The string to be checked. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {goog.i18n.bidi.Dir} Estimated overall directionality of {@code str}. - */ -goog.i18n.bidi.estimateDirection = function(str, opt_isHtml) { - var rtlCount = 0; - var totalCount = 0; - var hasWeaklyLtr = false; - var tokens = soyshim.$$bidiStripHtmlIfNecessary_(str, opt_isHtml). - split(soyshim.$$bidiWordSeparatorRe_); - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - if (soyshim.$$bidiRtlDirCheckRe_.test(token)) { - rtlCount++; - totalCount++; - } else if (soyshim.$$bidiIsRequiredLtrRe_.test(token)) { - hasWeaklyLtr = true; - } else if (soyshim.$$bidiLtrCharRe_.test(token)) { - totalCount++; - } else if (soyshim.$$bidiHasNumeralsRe_.test(token)) { - hasWeaklyLtr = true; - } - } - - return totalCount == 0 ? - (hasWeaklyLtr ? goog.i18n.bidi.Dir.LTR : goog.i18n.bidi.Dir.NEUTRAL) : - (rtlCount / totalCount > soyshim.$$bidiRtlDetectionThreshold_ ? - goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR); -}; - - -/** - * Utility class for formatting text for display in a potentially - * opposite-directionality context without garbling. Provides the following - * functionality: - * - * @param {goog.i18n.bidi.Dir|number|boolean|null} dir The context - * directionality, in one of the following formats: - * 1. A goog.i18n.bidi.Dir constant. NEUTRAL is treated the same as null, - * i.e. unknown, for backward compatibility with legacy calls. - * 2. A number (positive = LTR, negative = RTL, 0 = unknown). - * 3. A boolean (true = RTL, false = LTR). - * 4. A null for unknown directionality. - * @constructor - */ -goog.i18n.BidiFormatter = function(dir) { - /** - * The overall directionality of the context in which the formatter is being - * used. - * @type {?goog.i18n.bidi.Dir} - * @private - */ - this.dir_ = goog.i18n.bidi.toDir(dir, true /* opt_noNeutral */); -}; - -/** - * @return {?goog.i18n.bidi.Dir} The context directionality. - */ -goog.i18n.BidiFormatter.prototype.getContextDir = function() { - return this.dir_; -}; - -/** - * Returns 'dir="ltr"' or 'dir="rtl"', depending on the given directionality, if - * it is not the same as the context directionality. Otherwise, returns the - * empty string. - * - * @param {goog.i18n.bidi.Dir} dir A directionality. - * @return {string} 'dir="rtl"' for RTL text in non-RTL context; 'dir="ltr"' for - * LTR text in non-LTR context; else, the empty string. - */ -goog.i18n.BidiFormatter.prototype.knownDirAttr = function(dir) { - return !dir || dir == this.dir_ ? '' : dir < 0 ? 'dir="rtl"' : 'dir="ltr"'; -}; - -/** - * Returns the trailing horizontal edge, i.e. "right" or "left", depending on - * the global bidi directionality. - * @return {string} "left" for RTL context and "right" otherwise. - */ -goog.i18n.BidiFormatter.prototype.endEdge = function () { - return this.dir_ < 0 ? 'left' : 'right'; -}; - -/** - * Returns the Unicode BiDi mark matching the context directionality (LRM for - * LTR context directionality, RLM for RTL context directionality), or the - * empty string for unknown context directionality. - * - * @return {string} LRM for LTR context directionality and RLM for RTL context - * directionality. - */ -goog.i18n.BidiFormatter.prototype.mark = function () { - return ( - (this.dir_ > 0) ? '\u200E' /*LRM*/ : - (this.dir_ < 0) ? '\u200F' /*RLM*/ : - ''); -}; - -/** - * Returns a Unicode bidi mark matching the context directionality (LRM or RLM) - * if the directionality or the exit directionality of {@code text} are opposite - * to the context directionality. Otherwise returns the empty string. - * If opt_isHtml, makes sure to ignore the LTR nature of the mark-up and escapes - * in text, making the logic suitable for HTML and HTML-escaped text. - * @param {?goog.i18n.bidi.Dir} textDir {@code text}'s overall directionality, - * or null if unknown and needs to be estimated. - * @param {string} text The text whose directionality is to be estimated. - * @param {boolean=} opt_isHtml Whether text is HTML/HTML-escaped. - * Default: false. - * @return {string} A Unicode bidi mark matching the context directionality, or - * the empty string when either the context directionality is unknown or - * neither the text's overall nor its exit directionality is opposite to it. - */ -goog.i18n.BidiFormatter.prototype.markAfterKnownDir = function ( - textDir, text, opt_isHtml) { - if (textDir == null) { - textDir = goog.i18n.bidi.estimateDirection(text, opt_isHtml); - } - return ( - this.dir_ > 0 && (textDir < 0 || - soyshim.$$bidiIsRtlExitText_(text, opt_isHtml)) ? '\u200E' : // LRM - this.dir_ < 0 && (textDir > 0 || - soyshim.$$bidiIsLtrExitText_(text, opt_isHtml)) ? '\u200F' : // RLM - ''); -}; - -/** - * Formats an HTML string for use in HTML output of the context directionality, - * so an opposite-directionality string is neither garbled nor garbles what - * follows it. - * - * @param {?goog.i18n.bidi.Dir} textDir {@code str}'s overall directionality, or - * null if unknown and needs to be estimated. - * @param {string} str The input text (HTML or HTML-escaped). - * @param {boolean=} placeholder This argument exists for consistency with the - * Closure Library. Specifying it has no effect. - * @return {string} The input text after applying the above processing. - */ -goog.i18n.BidiFormatter.prototype.spanWrapWithKnownDir = function( - textDir, str, placeholder) { - if (textDir == null) { - textDir = goog.i18n.bidi.estimateDirection(str, true); - } - var reset = this.markAfterKnownDir(textDir, str, true); - if (textDir > 0 && this.dir_ <= 0) { - str = '<span dir="ltr">' + str + '</span>'; - } else if (textDir < 0 && this.dir_ >= 0) { - str = '<span dir="rtl">' + str + '</span>'; - } - return str + reset; -}; - -/** - * Returns the leading horizontal edge, i.e. "left" or "right", depending on - * the global bidi directionality. - * @return {string} "right" for RTL context and "left" otherwise. - */ -goog.i18n.BidiFormatter.prototype.startEdge = function () { - return this.dir_ < 0 ? 'right' : 'left'; -}; - -/** - * Formats an HTML-escaped string for use in HTML output of the context - * directionality, so an opposite-directionality string is neither garbled nor - * garbles what follows it. - * As opposed to {@link #spanWrapWithKnownDir}, this makes use of unicode bidi - * formatting characters. In HTML, it should only be used inside attribute - * values and elements that do not allow markup, e.g. an 'option' tag. - * - * @param {?goog.i18n.bidi.Dir} textDir {@code str}'s overall directionality, or - * null if unknown and needs to be estimated. - * @param {string} str The input text (HTML-escaped). - * @param {boolean=} opt_isHtml Whether {@code str} is HTML / HTML-escaped. - * Default: false. - * @return {string} The input text after applying the above processing. - */ -goog.i18n.BidiFormatter.prototype.unicodeWrapWithKnownDir = function( - textDir, str, opt_isHtml) { - if (textDir == null) { - textDir = goog.i18n.bidi.estimateDirection(str, opt_isHtml); - } - var reset = this.markAfterKnownDir(textDir, str, opt_isHtml); - if (textDir > 0 && this.dir_ <= 0) { - str = '\u202A' + str + '\u202C'; - } else if (textDir < 0 && this.dir_ >= 0) { - str = '\u202B' + str + '\u202C'; - } - return str + reset; -}; - - -if (!goog.string) { - goog.string = { - /** - * Converts \r\n, \r, and \n to <br>s - * @param {*} str The string in which to convert newlines. - * @param {boolean=} opt_xml Whether to use XML compatible tags. - * @return {string} A copy of {@code str} with converted newlines. - */ - newLineToBr: function(str, opt_xml) { - - str = String(str); - - // This quick test helps in the case when there are no chars to replace, - // in the worst case this makes barely a difference to the time taken. - if (!goog.string.NEWLINE_TO_BR_RE_.test(str)) { - return str; - } - - return str.replace(/(\r\n|\r|\n)/g, opt_xml ? '<br />' : '<br>'); - }, - urlEncode: encodeURIComponent, - /** - * Regular expression used within newlineToBr(). - * @type {RegExp} - * @private - */ - NEWLINE_TO_BR_RE_: /[\r\n]/ - }; -} - -/** - * Utility class to facilitate much faster string concatenation in IE, - * using Array.join() rather than the '+' operator. For other browsers - * we simply use the '+' operator. - * - * @param {Object|number|string|boolean=} opt_a1 Optional first initial item - * to append. - * @param {...Object|number|string|boolean} var_args Other initial items to - * append, e.g., new goog.string.StringBuffer('foo', 'bar'). - * @constructor - */ -goog.string.StringBuffer = function(opt_a1, var_args) { - /** - * Internal buffer for the string to be concatenated. - * @type {string|Array} - * @private - */ - this.buffer_ = goog.userAgent.jscript.HAS_JSCRIPT ? [] : ''; - - if (opt_a1 != null) { - this.append.apply(this, arguments); - } -}; - - -/** - * Length of internal buffer (faster than calling buffer_.length). - * Only used for IE. - * @type {number} - * @private - */ -goog.string.StringBuffer.prototype.bufferLength_ = 0; - -/** - * Appends one or more items to the string. - * - * Calling this with null, undefined, or empty arguments is an error. - * - * @param {Object|number|string|boolean} a1 Required first string. - * @param {Object|number|string|boolean=} opt_a2 Optional second string. - * @param {...Object|number|string|boolean} var_args Other items to append, - * e.g., sb.append('foo', 'bar', 'baz'). - * @return {goog.string.StringBuffer} This same StringBuilder object. - */ -goog.string.StringBuffer.prototype.append = function(a1, opt_a2, var_args) { - - if (goog.userAgent.jscript.HAS_JSCRIPT) { - if (opt_a2 == null) { // no second argument (note: undefined == null) - // Array assignment is 2x faster than Array push. Also, use a1 - // directly to avoid arguments instantiation, another 2x improvement. - this.buffer_[this.bufferLength_++] = a1; - } else { - var arr = /**@type {Array.<number|string|boolean>}*/(this.buffer_); - arr.push.apply(arr, arguments); - this.bufferLength_ = this.buffer_.length; - } - - } else { - - // Use a1 directly to avoid arguments instantiation for single-arg case. - this.buffer_ += a1; - if (opt_a2 != null) { // no second argument (note: undefined == null) - for (var i = 1; i < arguments.length; i++) { - this.buffer_ += arguments[i]; - } - } - } - - return this; -}; - - -/** - * Clears the string. - */ -goog.string.StringBuffer.prototype.clear = function() { - - if (goog.userAgent.jscript.HAS_JSCRIPT) { - this.buffer_.length = 0; // reuse array to avoid creating new object - this.bufferLength_ = 0; - - } else { - this.buffer_ = ''; - } -}; - - -/** - * Returns the concatenated string. - * - * @return {string} The concatenated string. - */ -goog.string.StringBuffer.prototype.toString = function() { - - if (goog.userAgent.jscript.HAS_JSCRIPT) { - var str = this.buffer_.join(''); - // Given a string with the entire contents, simplify the StringBuilder by - // setting its contents to only be this string, rather than many fragments. - this.clear(); - if (str) { - this.append(str); - } - return str; - - } else { - return /** @type {string} */ (this.buffer_); - } -}; - - -if (!goog.soy) goog.soy = { - /** - * Helper function to render a Soy template and then set the - * output string as the innerHTML of an element. It is recommended - * to use this helper function instead of directly setting - * innerHTML in your hand-written code, so that it will be easier - * to audit the code for cross-site scripting vulnerabilities. - * - * @param {Function} template The Soy template defining element's content. - * @param {Object=} opt_templateData The data for the template. - * @param {Object=} opt_injectedData The injected data for the template. - * @param {(goog.dom.DomHelper|Document)=} opt_dom The context in which DOM - * nodes will be created. - */ - renderAsElement: function( - template, opt_templateData, opt_injectedData, opt_dom) { - return /** @type {!Element} */ (soyshim.$$renderWithWrapper_( - template, opt_templateData, opt_dom, true /* asElement */, - opt_injectedData)); - }, - /** - * Helper function to render a Soy template into a single node or - * a document fragment. If the rendered HTML string represents a - * single node, then that node is returned (note that this is - * *not* a fragment, despite them name of the method). Otherwise a - * document fragment is returned containing the rendered nodes. - * - * @param {Function} template The Soy template defining element's content. - * @param {Object=} opt_templateData The data for the template. - * @param {Object=} opt_injectedData The injected data for the template. - * @param {(goog.dom.DomHelper|Document)=} opt_dom The context in which DOM - * nodes will be created. - * @return {!Node} The resulting node or document fragment. - */ - renderAsFragment: function( - template, opt_templateData, opt_injectedData, opt_dom) { - return soyshim.$$renderWithWrapper_( - template, opt_templateData, opt_dom, false /* asElement */, - opt_injectedData); - }, - /** - * Helper function to render a Soy template and then set the output string as - * the innerHTML of an element. It is recommended to use this helper function - * instead of directly setting innerHTML in your hand-written code, so that it - * will be easier to audit the code for cross-site scripting vulnerabilities. - * - * NOTE: New code should consider using goog.soy.renderElement instead. - * - * @param {Element} element The element whose content we are rendering. - * @param {Function} template The Soy template defining the element's content. - * @param {Object=} opt_templateData The data for the template. - * @param {Object=} opt_injectedData The injected data for the template. - */ - renderElement: function( - element, template, opt_templateData, opt_injectedData) { - element.innerHTML = template(opt_templateData, null, opt_injectedData); - }, - data: {} -}; - - -/** - * A type of textual content. - * - * This is an enum of type Object so that these values are unforgeable. - * - * @enum {!Object} - */ -goog.soy.data.SanitizedContentKind = { - - /** - * A snippet of HTML that does not start or end inside a tag, comment, entity, - * or DOCTYPE; and that does not contain any executable code - * (JS, {@code <object>}s, etc.) from a different trust domain. - */ - HTML: goog.DEBUG ? {sanitizedContentKindHtml: true} : {}, - - /** - * Executable Javascript code or expression, safe for insertion in a - * script-tag or event handler context, known to be free of any - * attacker-controlled scripts. This can either be side-effect-free - * Javascript (such as JSON) or Javascript that's entirely under Google's - * control. - */ - JS: goog.DEBUG ? {sanitizedContentJsChars: true} : {}, - - /** - * A sequence of code units that can appear between quotes (either kind) in a - * JS program without causing a parse error, and without causing any side - * effects. - * <p> - * The content should not contain unescaped quotes, newlines, or anything else - * that would cause parsing to fail or to cause a JS parser to finish the - * string its parsing inside the content. - * <p> - * The content must also not end inside an escape sequence ; no partial octal - * escape sequences or odd number of '{@code \}'s at the end. - */ - JS_STR_CHARS: goog.DEBUG ? {sanitizedContentJsStrChars: true} : {}, - - /** A properly encoded portion of a URI. */ - URI: goog.DEBUG ? {sanitizedContentUri: true} : {}, - - /** - * Repeated attribute names and values. For example, - * {@code dir="ltr" foo="bar" onclick="trustedFunction()" checked}. - */ - ATTRIBUTES: goog.DEBUG ? {sanitizedContentHtmlAttribute: true} : {}, - - // TODO: Consider separating rules, declarations, and values into - // separate types, but for simplicity, we'll treat explicitly blessed - // SanitizedContent as allowed in all of these contexts. - /** - * A CSS3 declaration, property, value or group of semicolon separated - * declarations. - */ - CSS: goog.DEBUG ? {sanitizedContentCss: true} : {}, - - /** - * Unsanitized plain-text content. - * - * This is effectively the "null" entry of this enum, and is sometimes used - * to explicitly mark content that should never be used unescaped. Since any - * string is safe to use as text, being of ContentKind.TEXT makes no - * guarantees about its safety in any other context such as HTML. - */ - TEXT: goog.DEBUG ? {sanitizedContentKindText: true} : {} -}; - - - -/** - * A string-like object that carries a content-type and a content direction. - * - * IMPORTANT! Do not create these directly, nor instantiate the subclasses. - * Instead, use a trusted, centrally reviewed library as endorsed by your team - * to generate these objects. Otherwise, you risk accidentally creating - * SanitizedContent that is attacker-controlled and gets evaluated unescaped in - * templates. - * - * @constructor - */ -goog.soy.data.SanitizedContent = function() { - throw Error('Do not instantiate directly'); -}; - - -/** - * The context in which this content is safe from XSS attacks. - * @type {goog.soy.data.SanitizedContentKind} - */ -goog.soy.data.SanitizedContent.prototype.contentKind; - - -/** - * The content's direction; null if unknown and thus to be estimated when - * necessary. - * @type {?goog.i18n.bidi.Dir} - */ -goog.soy.data.SanitizedContent.prototype.contentDir = null; - - -/** - * The already-safe content. - * @type {string} - */ -goog.soy.data.SanitizedContent.prototype.content; - - -/** @override */ -goog.soy.data.SanitizedContent.prototype.toString = function() { - return this.content; -}; - - -var soy = { esc: {} }; -var soydata = {}; -soydata.VERY_UNSAFE = {}; -var soyshim = { $$DEFAULT_TEMPLATE_DATA_: {} }; -/** - * Helper function to render a Soy template into a single node or a document - * fragment. If the rendered HTML string represents a single node, then that - * node is returned. Otherwise a document fragment is created and returned - * (wrapped in a DIV element if #opt_singleNode is true). - * - * @param {Function} template The Soy template defining the element's content. - * @param {Object=} opt_templateData The data for the template. - * @param {(goog.dom.DomHelper|Document)=} opt_dom The context in which DOM - * nodes will be created. - * @param {boolean=} opt_asElement Whether to wrap the fragment in an - * element if the template does not render a single element. If true, - * result is always an Element. - * @param {Object=} opt_injectedData The injected data for the template. - * @return {!Node} The resulting node or document fragment. - * @private - */ -soyshim.$$renderWithWrapper_ = function( - template, opt_templateData, opt_dom, opt_asElement, opt_injectedData) { - - var dom = opt_dom || document; - var wrapper = dom.createElement('div'); - wrapper.innerHTML = template( - opt_templateData || soyshim.$$DEFAULT_TEMPLATE_DATA_, undefined, - opt_injectedData); - - // If the template renders as a single element, return it. - if (wrapper.childNodes.length == 1) { - var firstChild = wrapper.firstChild; - if (!opt_asElement || firstChild.nodeType == 1 /* Element */) { - return /** @type {!Node} */ (firstChild); - } - } - - // If we're forcing it to be a single element, return the wrapper DIV. - if (opt_asElement) { - return wrapper; - } - - // Otherwise, create and return a fragment. - var fragment = dom.createDocumentFragment(); - while (wrapper.firstChild) { - fragment.appendChild(wrapper.firstChild); - } - return fragment; -}; - - -/** - * Strips str of any HTML mark-up and escapes. Imprecise in several ways, but - * precision is not very important, since the result is only meant to be used - * for directionality detection. - * Based on goog.i18n.bidi.stripHtmlIfNeeded_(). - * @param {string} str The string to be stripped. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {string} The stripped string. - * @private - */ -soyshim.$$bidiStripHtmlIfNecessary_ = function(str, opt_isHtml) { - return opt_isHtml ? str.replace(soyshim.$$BIDI_HTML_SKIP_RE_, '') : str; -}; - - -/** - * Simplified regular expression for am HTML tag (opening or closing) or an HTML - * escape - the things we want to skip over in order to ignore their ltr - * characters. - * Copied from goog.i18n.bidi.htmlSkipReg_. - * @type {RegExp} - * @private - */ -soyshim.$$BIDI_HTML_SKIP_RE_ = /<[^>]*>|&[^;]+;/g; - - -/** - * A practical pattern to identify strong LTR character. This pattern is not - * theoretically correct according to unicode standard. It is simplified for - * performance and small code size. - * Copied from goog.i18n.bidi.ltrChars_. - * @type {string} - * @private - */ -soyshim.$$bidiLtrChars_ = - 'A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02B8\u0300-\u0590\u0800-\u1FFF' + - '\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF'; - - -/** - * A practical pattern to identify strong RTL character. This pattern is not - * theoretically correct according to unicode standard. It is simplified for - * performance and small code size. - * Copied from goog.i18n.bidi.rtlChars_. - * @type {string} - * @private - */ -soyshim.$$bidiRtlChars_ = '\u0591-\u07FF\u200F\uFB1D-\uFDFF\uFE70-\uFEFC'; - - -/** - * Regular expressions to check if a piece of text is of RTL directionality - * on first character with strong directionality. - * Based on goog.i18n.bidi.rtlDirCheckRe_. - * @type {RegExp} - * @private - */ -soyshim.$$bidiRtlDirCheckRe_ = new RegExp( - '^[^' + soyshim.$$bidiLtrChars_ + ']*[' + soyshim.$$bidiRtlChars_ + ']'); - - -/** - * Regular expression to check for LTR characters. - * Based on goog.i18n.bidi.ltrCharReg_. - * @type {RegExp} - * @private - */ -soyshim.$$bidiLtrCharRe_ = new RegExp('[' + soyshim.$$bidiLtrChars_ + ']'); - - -/** - * Regular expression to check if a string looks like something that must - * always be LTR even in RTL text, e.g. a URL. When estimating the - * directionality of text containing these, we treat these as weakly LTR, - * like numbers. - * Copied from goog.i18n.bidi.isRequiredLtrRe_. - * @type {RegExp} - * @private - */ -soyshim.$$bidiIsRequiredLtrRe_ = /^http:\/\/.*/; - - -/** - * Regular expression to check if a string contains any numerals. Used to - * differentiate between completely neutral strings and those containing - * numbers, which are weakly LTR. - * Copied from goog.i18n.bidi.hasNumeralsRe_. - * @type {RegExp} - * @private - */ -soyshim.$$bidiHasNumeralsRe_ = /\d/; - - -/** - * Regular expression to split a string into "words" for directionality - * estimation based on relative word counts. - * Copied from goog.i18n.bidi.wordSeparatorRe_. - * @type {RegExp} - * @private - */ -soyshim.$$bidiWordSeparatorRe_ = /\s+/; - - -/** - * This constant controls threshold of rtl directionality. - * Copied from goog.i18n.bidi.rtlDetectionThreshold_. - * @type {number} - * @private - */ -soyshim.$$bidiRtlDetectionThreshold_ = 0.40; - -/** - * Regular expressions to check if the last strongly-directional character in a - * piece of text is LTR. - * Based on goog.i18n.bidi.ltrExitDirCheckRe_. - * @type {RegExp} - * @private - */ -soyshim.$$bidiLtrExitDirCheckRe_ = new RegExp( - '[' + soyshim.$$bidiLtrChars_ + '][^' + soyshim.$$bidiRtlChars_ + ']*$'); - - -/** - * Regular expressions to check if the last strongly-directional character in a - * piece of text is RTL. - * Based on goog.i18n.bidi.rtlExitDirCheckRe_. - * @type {RegExp} - * @private - */ -soyshim.$$bidiRtlExitDirCheckRe_ = new RegExp( - '[' + soyshim.$$bidiRtlChars_ + '][^' + soyshim.$$bidiLtrChars_ + ']*$'); - - -/** - * Check if the exit directionality a piece of text is LTR, i.e. if the last - * strongly-directional character in the string is LTR. - * Based on goog.i18n.bidi.endsWithLtr(). - * @param {string} str string being checked. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {boolean} Whether LTR exit directionality was detected. - * @private - */ -soyshim.$$bidiIsLtrExitText_ = function(str, opt_isHtml) { - str = soyshim.$$bidiStripHtmlIfNecessary_(str, opt_isHtml); - return soyshim.$$bidiLtrExitDirCheckRe_.test(str); -}; - - -/** - * Check if the exit directionality a piece of text is RTL, i.e. if the last - * strongly-directional character in the string is RTL. - * Based on goog.i18n.bidi.endsWithRtl(). - * @param {string} str string being checked. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {boolean} Whether RTL exit directionality was detected. - * @private - */ -soyshim.$$bidiIsRtlExitText_ = function(str, opt_isHtml) { - str = soyshim.$$bidiStripHtmlIfNecessary_(str, opt_isHtml); - return soyshim.$$bidiRtlExitDirCheckRe_.test(str); -}; - - -// ============================================================================= -// COPIED FROM soyutils_usegoog.js - - -// ----------------------------------------------------------------------------- -// StringBuilder (compatible with the 'stringbuilder' code style). - - -/** - * Utility class to facilitate much faster string concatenation in IE, - * using Array.join() rather than the '+' operator. For other browsers - * we simply use the '+' operator. - * - * @param {Object} var_args Initial items to append, - * e.g., new soy.StringBuilder('foo', 'bar'). - * @constructor - */ -soy.StringBuilder = goog.string.StringBuffer; - - -// ----------------------------------------------------------------------------- -// soydata: Defines typed strings, e.g. an HTML string {@code "a<b>c"} is -// semantically distinct from the plain text string {@code "a<b>c"} and smart -// templates can take that distinction into account. - -/** - * A type of textual content. - * - * This is an enum of type Object so that these values are unforgeable. - * - * @enum {!Object} - */ -soydata.SanitizedContentKind = goog.soy.data.SanitizedContentKind; - - -/** - * Checks whether a given value is of a given content kind. - * - * @param {*} value The value to be examined. - * @param {soydata.SanitizedContentKind} contentKind The desired content - * kind. - * @return {boolean} Whether the given value is of the given kind. - * @private - */ -soydata.isContentKind = function(value, contentKind) { - // TODO(user): This function should really include the assert on - // value.constructor that is currently sprinkled at most of the call sites. - // Unfortunately, that would require a (debug-mode-only) switch statement. - // TODO(user): Perhaps we should get rid of the contentKind property - // altogether and only at the constructor. - return value != null && value.contentKind === contentKind; -}; - - -/** - * Returns a given value's contentDir property, constrained to a - * goog.i18n.bidi.Dir value or null. Returns null if the value is null, - * undefined, a primitive or does not have a contentDir property, or the - * property's value is not 1 (for LTR), -1 (for RTL), or 0 (for neutral). - * - * @param {*} value The value whose contentDir property, if any, is to - * be returned. - * @return {?goog.i18n.bidi.Dir} The contentDir property. - */ -soydata.getContentDir = function(value) { - if (value != null) { - switch (value.contentDir) { - case goog.i18n.bidi.Dir.LTR: - return goog.i18n.bidi.Dir.LTR; - case goog.i18n.bidi.Dir.RTL: - return goog.i18n.bidi.Dir.RTL; - case goog.i18n.bidi.Dir.NEUTRAL: - return goog.i18n.bidi.Dir.NEUTRAL; - } - } - return null; -}; - - -/** - * Content of type {@link soydata.SanitizedContentKind.HTML}. - * - * The content is a string of HTML that can safely be embedded in a PCDATA - * context in your app. If you would be surprised to find that an HTML - * sanitizer produced {@code s} (e.g. it runs code or fetches bad URLs) and - * you wouldn't write a template that produces {@code s} on security or privacy - * grounds, then don't pass {@code s} here. The default content direction is - * unknown, i.e. to be estimated when necessary. - * - * @constructor - * @extends {goog.soy.data.SanitizedContent} - */ -soydata.SanitizedHtml = function() { - goog.soy.data.SanitizedContent.call(this); // Throws an exception. -}; -goog.inherits(soydata.SanitizedHtml, goog.soy.data.SanitizedContent); - -/** @override */ -soydata.SanitizedHtml.prototype.contentKind = soydata.SanitizedContentKind.HTML; - -/** - * Returns a SanitizedHtml object for a particular value. The content direction - * is preserved. - * - * This HTML-escapes the value unless it is already SanitizedHtml. - * - * @param {*} value The value to convert. If it is already a SanitizedHtml - * object, it is left alone. - * @return {!soydata.SanitizedHtml} A SanitizedHtml object derived from the - * stringified value. It is escaped unless the input is SanitizedHtml. - */ -soydata.SanitizedHtml.from = function(value) { - // The check is soydata.isContentKind() inlined for performance. - if (value != null && - value.contentKind === soydata.SanitizedContentKind.HTML) { - goog.asserts.assert(value.constructor === soydata.SanitizedHtml); - return /** @type {!soydata.SanitizedHtml} */ (value); - } - return soydata.VERY_UNSAFE.ordainSanitizedHtml( - soy.esc.$$escapeHtmlHelper(String(value)), soydata.getContentDir(value)); -}; - - -/** - * Content of type {@link soydata.SanitizedContentKind.JS}. - * - * The content is Javascript source that when evaluated does not execute any - * attacker-controlled scripts. The content direction is LTR. - * - * @constructor - * @extends {goog.soy.data.SanitizedContent} - */ -soydata.SanitizedJs = function() { - goog.soy.data.SanitizedContent.call(this); // Throws an exception. -}; -goog.inherits(soydata.SanitizedJs, goog.soy.data.SanitizedContent); - -/** @override */ -soydata.SanitizedJs.prototype.contentKind = - soydata.SanitizedContentKind.JS; - -/** @override */ -soydata.SanitizedJs.prototype.contentDir = goog.i18n.bidi.Dir.LTR; - - -/** - * Content of type {@link soydata.SanitizedContentKind.JS_STR_CHARS}. - * - * The content can be safely inserted as part of a single- or double-quoted - * string without terminating the string. The default content direction is - * unknown, i.e. to be estimated when necessary. - * - * @constructor - * @extends {goog.soy.data.SanitizedContent} - */ -soydata.SanitizedJsStrChars = function() { - goog.soy.data.SanitizedContent.call(this); // Throws an exception. -}; -goog.inherits(soydata.SanitizedJsStrChars, goog.soy.data.SanitizedContent); - -/** @override */ -soydata.SanitizedJsStrChars.prototype.contentKind = - soydata.SanitizedContentKind.JS_STR_CHARS; - -/** - * Content of type {@link soydata.SanitizedContentKind.URI}. - * - * The content is a URI chunk that the caller knows is safe to emit in a - * template. The content direction is LTR. - * - * @constructor - * @extends {goog.soy.data.SanitizedContent} - */ -soydata.SanitizedUri = function() { - goog.soy.data.SanitizedContent.call(this); // Throws an exception. -}; -goog.inherits(soydata.SanitizedUri, goog.soy.data.SanitizedContent); - -/** @override */ -soydata.SanitizedUri.prototype.contentKind = soydata.SanitizedContentKind.URI; - -/** @override */ -soydata.SanitizedUri.prototype.contentDir = goog.i18n.bidi.Dir.LTR; - - -/** - * Content of type {@link soydata.SanitizedContentKind.ATTRIBUTES}. - * - * The content should be safely embeddable within an open tag, such as a - * key="value" pair. The content direction is LTR. - * - * @constructor - * @extends {goog.soy.data.SanitizedContent} - */ -soydata.SanitizedHtmlAttribute = function() { - goog.soy.data.SanitizedContent.call(this); // Throws an exception. -}; -goog.inherits(soydata.SanitizedHtmlAttribute, goog.soy.data.SanitizedContent); - -/** @override */ -soydata.SanitizedHtmlAttribute.prototype.contentKind = - soydata.SanitizedContentKind.ATTRIBUTES; - -/** @override */ -soydata.SanitizedHtmlAttribute.prototype.contentDir = goog.i18n.bidi.Dir.LTR; - - -/** - * Content of type {@link soydata.SanitizedContentKind.CSS}. - * - * The content is non-attacker-exploitable CSS, such as {@code color:#c3d9ff}. - * The content direction is LTR. - * - * @constructor - * @extends {goog.soy.data.SanitizedContent} - */ -soydata.SanitizedCss = function() { - goog.soy.data.SanitizedContent.call(this); // Throws an exception. -}; -goog.inherits(soydata.SanitizedCss, goog.soy.data.SanitizedContent); - -/** @override */ -soydata.SanitizedCss.prototype.contentKind = - soydata.SanitizedContentKind.CSS; - -/** @override */ -soydata.SanitizedCss.prototype.contentDir = goog.i18n.bidi.Dir.LTR; - - -/** - * Unsanitized plain text string. - * - * While all strings are effectively safe to use as a plain text, there are no - * guarantees about safety in any other context such as HTML. This is - * sometimes used to mark that should never be used unescaped. - * - * @param {*} content Plain text with no guarantees. - * @param {?goog.i18n.bidi.Dir=} opt_contentDir The content direction; null if - * unknown and thus to be estimated when necessary. Default: null. - * @constructor - * @extends {goog.soy.data.SanitizedContent} - */ -soydata.UnsanitizedText = function(content, opt_contentDir) { - /** @override */ - this.content = String(content); - this.contentDir = opt_contentDir != null ? opt_contentDir : null; -}; -goog.inherits(soydata.UnsanitizedText, goog.soy.data.SanitizedContent); - -/** @override */ -soydata.UnsanitizedText.prototype.contentKind = - soydata.SanitizedContentKind.TEXT; - - -/** - * Empty string, used as a type in Soy templates. - * @enum {string} - * @private - */ -soydata.$$EMPTY_STRING_ = { - VALUE: '' -}; - - -/** - * Creates a factory for SanitizedContent types. - * - * This is a hack so that the soydata.VERY_UNSAFE.ordainSanitized* can - * instantiate Sanitized* classes, without making the Sanitized* constructors - * publicly usable. Requiring all construction to use the VERY_UNSAFE names - * helps callers and their reviewers easily tell that creating SanitizedContent - * is not always safe and calls for careful review. - * - * @param {function(new: T)} ctor A constructor. - * @return {!function(*, ?goog.i18n.bidi.Dir=): T} A factory that takes - * content and an optional content direction and returns a new instance. If - * the content direction is undefined, ctor.prototype.contentDir is used. - * @template T - * @private - */ -soydata.$$makeSanitizedContentFactory_ = function(ctor) { - /** @type {function(new: goog.soy.data.SanitizedContent)} */ - function InstantiableCtor() {} - InstantiableCtor.prototype = ctor.prototype; - /** - * Creates a ctor-type SanitizedContent instance. - * - * @param {*} content The content to put in the instance. - * @param {?goog.i18n.bidi.Dir=} opt_contentDir The content direction. If - * undefined, ctor.prototype.contentDir is used. - * @return {goog.soy.data.SanitizedContent} The new instance. It is actually - * of type T above (ctor's type, a descendant of SanitizedContent), but - * there is no way to express that here. - */ - function sanitizedContentFactory(content, opt_contentDir) { - var result = new InstantiableCtor(); - result.content = String(content); - if (opt_contentDir !== undefined) { - result.contentDir = opt_contentDir; - } - return result; - } - return sanitizedContentFactory; -}; - - -/** - * Creates a factory for SanitizedContent types that should always have their - * default directionality. - * - * This is a hack so that the soydata.VERY_UNSAFE.ordainSanitized* can - * instantiate Sanitized* classes, without making the Sanitized* constructors - * publicly usable. Requiring all construction to use the VERY_UNSAFE names - * helps callers and their reviewers easily tell that creating SanitizedContent - * is not always safe and calls for careful review. - * - * @param {function(new: T, string)} ctor A constructor. - * @return {!function(*): T} A factory that takes content and returns a new - * instance (with default directionality, i.e. ctor.prototype.contentDir). - * @template T - * @private - */ -soydata.$$makeSanitizedContentFactoryWithDefaultDirOnly_ = function(ctor) { - /** @type {function(new: goog.soy.data.SanitizedContent)} */ - function InstantiableCtor() {} - InstantiableCtor.prototype = ctor.prototype; - /** - * Creates a ctor-type SanitizedContent instance. - * - * @param {*} content The content to put in the instance. - * @return {goog.soy.data.SanitizedContent} The new instance. It is actually - * of type T above (ctor's type, a descendant of SanitizedContent), but - * there is no way to express that here. - */ - function sanitizedContentFactory(content) { - var result = new InstantiableCtor(); - result.content = String(content); - return result; - } - return sanitizedContentFactory; -}; - - -// ----------------------------------------------------------------------------- -// Sanitized content ordainers. Please use these with extreme caution (with the -// exception of markUnsanitizedText). A good recommendation is to limit usage -// of these to just a handful of files in your source tree where usages can be -// carefully audited. - - -/** - * Protects a string from being used in an noAutoescaped context. - * - * This is useful for content where there is significant risk of accidental - * unescaped usage in a Soy template. A great case is for user-controlled - * data that has historically been a source of vulernabilities. - * - * @param {*} content Text to protect. - * @param {?goog.i18n.bidi.Dir=} opt_contentDir The content direction; null if - * unknown and thus to be estimated when necessary. Default: null. - * @return {!soydata.UnsanitizedText} A wrapper that is rejected by the - * Soy noAutoescape print directive. - */ -soydata.markUnsanitizedText = function(content, opt_contentDir) { - return new soydata.UnsanitizedText(content, opt_contentDir); -}; - - -/** - * Takes a leap of faith that the provided content is "safe" HTML. - * - * @param {*} content A string of HTML that can safely be embedded in - * a PCDATA context in your app. If you would be surprised to find that an - * HTML sanitizer produced {@code s} (e.g. it runs code or fetches bad URLs) - * and you wouldn't write a template that produces {@code s} on security or - * privacy grounds, then don't pass {@code s} here. - * @param {?goog.i18n.bidi.Dir=} opt_contentDir The content direction; null if - * unknown and thus to be estimated when necessary. Default: null. - * @return {!soydata.SanitizedHtml} Sanitized content wrapper that - * indicates to Soy not to escape when printed as HTML. - */ -soydata.VERY_UNSAFE.ordainSanitizedHtml = - soydata.$$makeSanitizedContentFactory_(soydata.SanitizedHtml); - - -/** - * Takes a leap of faith that the provided content is "safe" (non-attacker- - * controlled, XSS-free) Javascript. - * - * @param {*} content Javascript source that when evaluated does not - * execute any attacker-controlled scripts. - * @return {!soydata.SanitizedJs} Sanitized content wrapper that indicates to - * Soy not to escape when printed as Javascript source. - */ -soydata.VERY_UNSAFE.ordainSanitizedJs = - soydata.$$makeSanitizedContentFactoryWithDefaultDirOnly_( - soydata.SanitizedJs); - - -// TODO: This function is probably necessary, either externally or internally -// as an implementation detail. Generally, plain text will always work here, -// as there's no harm to unescaping the string and then re-escaping when -// finally printed. -/** - * Takes a leap of faith that the provided content can be safely embedded in - * a Javascript string without re-esacping. - * - * @param {*} content Content that can be safely inserted as part of a - * single- or double-quoted string without terminating the string. - * @param {?goog.i18n.bidi.Dir=} opt_contentDir The content direction; null if - * unknown and thus to be estimated when necessary. Default: null. - * @return {!soydata.SanitizedJsStrChars} Sanitized content wrapper that - * indicates to Soy not to escape when printed in a JS string. - */ -soydata.VERY_UNSAFE.ordainSanitizedJsStrChars = - soydata.$$makeSanitizedContentFactory_(soydata.SanitizedJsStrChars); - - -/** - * Takes a leap of faith that the provided content is "safe" to use as a URI - * in a Soy template. - * - * This creates a Soy SanitizedContent object which indicates to Soy there is - * no need to escape it when printed as a URI (e.g. in an href or src - * attribute), such as if it's already been encoded or if it's a Javascript: - * URI. - * - * @param {*} content A chunk of URI that the caller knows is safe to - * emit in a template. - * @return {!soydata.SanitizedUri} Sanitized content wrapper that indicates to - * Soy not to escape or filter when printed in URI context. - */ -soydata.VERY_UNSAFE.ordainSanitizedUri = - soydata.$$makeSanitizedContentFactoryWithDefaultDirOnly_( - soydata.SanitizedUri); - - -/** - * Takes a leap of faith that the provided content is "safe" to use as an - * HTML attribute. - * - * @param {*} content An attribute name and value, such as - * {@code dir="ltr"}. - * @return {!soydata.SanitizedHtmlAttribute} Sanitized content wrapper that - * indicates to Soy not to escape when printed as an HTML attribute. - */ -soydata.VERY_UNSAFE.ordainSanitizedHtmlAttribute = - soydata.$$makeSanitizedContentFactoryWithDefaultDirOnly_( - soydata.SanitizedHtmlAttribute); - - -/** - * Takes a leap of faith that the provided content is "safe" to use as CSS - * in a style attribute or block. - * - * @param {*} content CSS, such as {@code color:#c3d9ff}. - * @return {!soydata.SanitizedCss} Sanitized CSS wrapper that indicates to - * Soy there is no need to escape or filter when printed in CSS context. - */ -soydata.VERY_UNSAFE.ordainSanitizedCss = - soydata.$$makeSanitizedContentFactoryWithDefaultDirOnly_( - soydata.SanitizedCss); - - -// ----------------------------------------------------------------------------- -// Public utilities. - - -/** - * Helper function to render a Soy template and then set the output string as - * the innerHTML of an element. It is recommended to use this helper function - * instead of directly setting innerHTML in your hand-written code, so that it - * will be easier to audit the code for cross-site scripting vulnerabilities. - * - * NOTE: New code should consider using goog.soy.renderElement instead. - * - * @param {Element} element The element whose content we are rendering. - * @param {Function} template The Soy template defining the element's content. - * @param {Object=} opt_templateData The data for the template. - * @param {Object=} opt_injectedData The injected data for the template. - */ -soy.renderElement = goog.soy.renderElement; - - -/** - * Helper function to render a Soy template into a single node or a document - * fragment. If the rendered HTML string represents a single node, then that - * node is returned (note that this is *not* a fragment, despite them name of - * the method). Otherwise a document fragment is returned containing the - * rendered nodes. - * - * NOTE: New code should consider using goog.soy.renderAsFragment - * instead (note that the arguments are different). - * - * @param {Function} template The Soy template defining the element's content. - * @param {Object=} opt_templateData The data for the template. - * @param {Document=} opt_document The document used to create DOM nodes. If not - * specified, global document object is used. - * @param {Object=} opt_injectedData The injected data for the template. - * @return {!Node} The resulting node or document fragment. - */ -soy.renderAsFragment = function( - template, opt_templateData, opt_document, opt_injectedData) { - return goog.soy.renderAsFragment( - template, opt_templateData, opt_injectedData, - new goog.dom.DomHelper(opt_document)); -}; - - -/** - * Helper function to render a Soy template into a single node. If the rendered - * HTML string represents a single node, then that node is returned. Otherwise, - * a DIV element is returned containing the rendered nodes. - * - * NOTE: New code should consider using goog.soy.renderAsElement - * instead (note that the arguments are different). - * - * @param {Function} template The Soy template defining the element's content. - * @param {Object=} opt_templateData The data for the template. - * @param {Document=} opt_document The document used to create DOM nodes. If not - * specified, global document object is used. - * @param {Object=} opt_injectedData The injected data for the template. - * @return {!Element} Rendered template contents, wrapped in a parent DIV - * element if necessary. - */ -soy.renderAsElement = function( - template, opt_templateData, opt_document, opt_injectedData) { - return goog.soy.renderAsElement( - template, opt_templateData, opt_injectedData, - new goog.dom.DomHelper(opt_document)); -}; - - -// ----------------------------------------------------------------------------- -// Below are private utilities to be used by Soy-generated code only. - - -/** - * Whether the locale is right-to-left. - * - * @type {boolean} - */ -soy.$$IS_LOCALE_RTL = goog.i18n.bidi.IS_RTL; - - -/** - * Builds an augmented map. The returned map will contain mappings from both - * the base map and the additional map. If the same key appears in both, then - * the value from the additional map will be visible, while the value from the - * base map will be hidden. The base map will be used, but not modified. - * - * @param {!Object} baseMap The original map to augment. - * @param {!Object} additionalMap A map containing the additional mappings. - * @return {!Object} An augmented map containing both the original and - * additional mappings. - */ -soy.$$augmentMap = function(baseMap, additionalMap) { - - // Create a new map whose '__proto__' field is set to baseMap. - /** @constructor */ - function TempCtor() {} - TempCtor.prototype = baseMap; - var augmentedMap = new TempCtor(); - - // Add the additional mappings to the new map. - for (var key in additionalMap) { - augmentedMap[key] = additionalMap[key]; - } - - return augmentedMap; -}; - - -/** - * Checks that the given map key is a string. - * @param {*} key Key to check. - * @return {string} The given key. - */ -soy.$$checkMapKey = function(key) { - // TODO: Support map literal with nonstring key. - if ((typeof key) != 'string') { - throw Error( - 'Map literal\'s key expression must evaluate to string' + - ' (encountered type "' + (typeof key) + '").'); - } - return key; -}; - - -/** - * Gets the keys in a map as an array. There are no guarantees on the order. - * @param {Object} map The map to get the keys of. - * @return {Array.<string>} The array of keys in the given map. - */ -soy.$$getMapKeys = function(map) { - var mapKeys = []; - for (var key in map) { - mapKeys.push(key); - } - return mapKeys; -}; - - -/** - * Gets a consistent unique id for the given delegate template name. Two calls - * to this function will return the same id if and only if the input names are - * the same. - * - * <p> Important: This function must always be called with a string constant. - * - * <p> If Closure Compiler is not being used, then this is just this identity - * function. If Closure Compiler is being used, then each call to this function - * will be replaced with a short string constant, which will be consistent per - * input name. - * - * @param {string} delTemplateName The delegate template name for which to get a - * consistent unique id. - * @return {string} A unique id that is consistent per input name. - * - * @consistentIdGenerator - */ -soy.$$getDelTemplateId = function(delTemplateName) { - return delTemplateName; -}; - - -/** - * Map from registered delegate template key to the priority of the - * implementation. - * @type {Object} - * @private - */ -soy.$$DELEGATE_REGISTRY_PRIORITIES_ = {}; - -/** - * Map from registered delegate template key to the implementation function. - * @type {Object} - * @private - */ -soy.$$DELEGATE_REGISTRY_FUNCTIONS_ = {}; - - -/** - * Registers a delegate implementation. If the same delegate template key (id - * and variant) has been registered previously, then priority values are - * compared and only the higher priority implementation is stored (if - * priorities are equal, an error is thrown). - * - * @param {string} delTemplateId The delegate template id. - * @param {string} delTemplateVariant The delegate template variant (can be - * empty string). - * @param {number} delPriority The implementation's priority value. - * @param {Function} delFn The implementation function. - */ -soy.$$registerDelegateFn = function( - delTemplateId, delTemplateVariant, delPriority, delFn) { - - var mapKey = 'key_' + delTemplateId + ':' + delTemplateVariant; - var currPriority = soy.$$DELEGATE_REGISTRY_PRIORITIES_[mapKey]; - if (currPriority === undefined || delPriority > currPriority) { - // Registering new or higher-priority function: replace registry entry. - soy.$$DELEGATE_REGISTRY_PRIORITIES_[mapKey] = delPriority; - soy.$$DELEGATE_REGISTRY_FUNCTIONS_[mapKey] = delFn; - } else if (delPriority == currPriority) { - // Registering same-priority function: error. - throw Error( - 'Encountered two active delegates with the same priority ("' + - delTemplateId + ':' + delTemplateVariant + '").'); - } else { - // Registering lower-priority function: do nothing. - } -}; - - -/** - * Retrieves the (highest-priority) implementation that has been registered for - * a given delegate template key (id and variant). If no implementation has - * been registered for the key, then the fallback is the same id with empty - * variant. If the fallback is also not registered, and allowsEmptyDefault is - * true, then returns an implementation that is equivalent to an empty template - * (i.e. rendered output would be empty string). - * - * @param {string} delTemplateId The delegate template id. - * @param {string|number} delTemplateVariant The delegate template variant (can - * be an empty string, or a number when a global is used). - * @param {boolean} allowsEmptyDefault Whether to default to the empty template - * function if there's no active implementation. - * @return {Function} The retrieved implementation function. - */ -soy.$$getDelegateFn = function( - delTemplateId, delTemplateVariant, allowsEmptyDefault) { - - var delFn = soy.$$DELEGATE_REGISTRY_FUNCTIONS_[ - 'key_' + delTemplateId + ':' + delTemplateVariant]; - if (! delFn && delTemplateVariant != '') { - // Fallback to empty variant. - delFn = soy.$$DELEGATE_REGISTRY_FUNCTIONS_['key_' + delTemplateId + ':']; - } - - if (delFn) { - return delFn; - } else if (allowsEmptyDefault) { - return soy.$$EMPTY_TEMPLATE_FN_; - } else { - throw Error( - 'Found no active impl for delegate call to "' + delTemplateId + ':' + - delTemplateVariant + '" (and not allowemptydefault="true").'); - } -}; - - -/** - * Private helper soy.$$getDelegateFn(). This is the empty template function - * that is returned whenever there's no delegate implementation found. - * - * @param {Object.<string, *>=} opt_data - * @param {soy.StringBuilder=} opt_sb - * @param {Object.<string, *>=} opt_ijData - * @return {string} - * @private - */ -soy.$$EMPTY_TEMPLATE_FN_ = function(opt_data, opt_sb, opt_ijData) { - return ''; -}; - - -// ----------------------------------------------------------------------------- -// Internal sanitized content wrappers. - - -/** - * Creates a SanitizedContent factory for SanitizedContent types for internal - * Soy let and param blocks. - * - * This is a hack within Soy so that SanitizedContent objects created via let - * and param blocks will truth-test as false if they are empty string. - * Tricking the Javascript runtime to treat empty SanitizedContent as falsey is - * not possible, and changing the Soy compiler to wrap every boolean statement - * for just this purpose is impractical. Instead, we just avoid wrapping empty - * string as SanitizedContent, since it's a no-op for empty strings anyways. - * - * @param {function(new: T)} ctor A constructor. - * @return {!function(*, ?goog.i18n.bidi.Dir=): (T|soydata.$$EMPTY_STRING_)} - * A factory that takes content and an optional content direction and - * returns a new instance, or an empty string. If the content direction is - * undefined, ctor.prototype.contentDir is used. - * @template T - * @private - */ -soydata.$$makeSanitizedContentFactoryForInternalBlocks_ = function(ctor) { - /** @type {function(new: goog.soy.data.SanitizedContent)} */ - function InstantiableCtor() {} - InstantiableCtor.prototype = ctor.prototype; - /** - * Creates a ctor-type SanitizedContent instance. - * - * @param {*} content The content to put in the instance. - * @param {?goog.i18n.bidi.Dir=} opt_contentDir The content direction. If - * undefined, ctor.prototype.contentDir is used. - * @return {goog.soy.data.SanitizedContent|soydata.$$EMPTY_STRING_} The new - * instance, or an empty string. A new instance is actually of type T - * above (ctor's type, a descendant of SanitizedContent), but there's no - * way to express that here. - */ - function sanitizedContentFactory(content, opt_contentDir) { - var contentString = String(content); - if (!contentString) { - return soydata.$$EMPTY_STRING_.VALUE; - } - var result = new InstantiableCtor(); - result.content = String(content); - if (opt_contentDir !== undefined) { - result.contentDir = opt_contentDir; - } - return result; - } - return sanitizedContentFactory; -}; - - -/** - * Creates a SanitizedContent factory for SanitizedContent types that should - * always have their default directionality for internal Soy let and param - * blocks. - * - * This is a hack within Soy so that SanitizedContent objects created via let - * and param blocks will truth-test as false if they are empty string. - * Tricking the Javascript runtime to treat empty SanitizedContent as falsey is - * not possible, and changing the Soy compiler to wrap every boolean statement - * for just this purpose is impractical. Instead, we just avoid wrapping empty - * string as SanitizedContent, since it's a no-op for empty strings anyways. - * - * @param {function(new: T)} ctor A constructor. - * @return {!function(*): (T|soydata.$$EMPTY_STRING_)} A - * factory that takes content and returns a - * new instance (with default directionality, i.e. - * ctor.prototype.contentDir), or an empty string. - * @template T - * @private - */ -soydata.$$makeSanitizedContentFactoryWithDefaultDirOnlyForInternalBlocks_ = - function(ctor) { - /** @type {function(new: goog.soy.data.SanitizedContent)} */ - function InstantiableCtor() {} - InstantiableCtor.prototype = ctor.prototype; - /** - * Creates a ctor-type SanitizedContent instance. - * - * @param {*} content The content to put in the instance. - * @return {goog.soy.data.SanitizedContent|soydata.$$EMPTY_STRING_} The new - * instance, or an empty string. A new instance is actually of type T - * above (ctor's type, a descendant of SanitizedContent), but there's no - * way to express that here. - */ - function sanitizedContentFactory(content) { - var contentString = String(content); - if (!contentString) { - return soydata.$$EMPTY_STRING_.VALUE; - } - var result = new InstantiableCtor(); - result.content = String(content); - return result; - } - return sanitizedContentFactory; -}; - - -/** - * Creates kind="text" block contents (internal use only). - * - * @param {*} content Text. - * @param {?goog.i18n.bidi.Dir=} opt_contentDir The content direction; null if - * unknown and thus to be estimated when necessary. Default: null. - * @return {!soydata.UnsanitizedText|soydata.$$EMPTY_STRING_} Wrapped result. - */ -soydata.$$markUnsanitizedTextForInternalBlocks = function( - content, opt_contentDir) { - var contentString = String(content); - if (!contentString) { - return soydata.$$EMPTY_STRING_.VALUE; - } - return new soydata.UnsanitizedText(contentString, opt_contentDir); -}; - - -/** - * Creates kind="html" block contents (internal use only). - * - * @param {*} content Text. - * @param {?goog.i18n.bidi.Dir=} opt_contentDir The content direction; null if - * unknown and thus to be estimated when necessary. Default: null. - * @return {soydata.SanitizedHtml|soydata.$$EMPTY_STRING_} Wrapped result. - */ -soydata.VERY_UNSAFE.$$ordainSanitizedHtmlForInternalBlocks = - soydata.$$makeSanitizedContentFactoryForInternalBlocks_( - soydata.SanitizedHtml); - - -/** - * Creates kind="js" block contents (internal use only). - * - * @param {*} content Text. - * @return {soydata.SanitizedJs|soydata.$$EMPTY_STRING_} Wrapped result. - */ -soydata.VERY_UNSAFE.$$ordainSanitizedJsForInternalBlocks = - soydata.$$makeSanitizedContentFactoryWithDefaultDirOnlyForInternalBlocks_( - soydata.SanitizedJs); - - -/** - * Creates kind="uri" block contents (internal use only). - * - * @param {*} content Text. - * @return {soydata.SanitizedUri|soydata.$$EMPTY_STRING_} Wrapped result. - */ -soydata.VERY_UNSAFE.$$ordainSanitizedUriForInternalBlocks = - soydata.$$makeSanitizedContentFactoryWithDefaultDirOnlyForInternalBlocks_( - soydata.SanitizedUri); - - -/** - * Creates kind="attributes" block contents (internal use only). - * - * @param {*} content Text. - * @return {soydata.SanitizedHtmlAttribute|soydata.$$EMPTY_STRING_} Wrapped - * result. - */ -soydata.VERY_UNSAFE.$$ordainSanitizedAttributesForInternalBlocks = - soydata.$$makeSanitizedContentFactoryWithDefaultDirOnlyForInternalBlocks_( - soydata.SanitizedHtmlAttribute); - - -/** - * Creates kind="css" block contents (internal use only). - * - * @param {*} content Text. - * @return {soydata.SanitizedCss|soydata.$$EMPTY_STRING_} Wrapped result. - */ -soydata.VERY_UNSAFE.$$ordainSanitizedCssForInternalBlocks = - soydata.$$makeSanitizedContentFactoryWithDefaultDirOnlyForInternalBlocks_( - soydata.SanitizedCss); - - -// ----------------------------------------------------------------------------- -// Escape/filter/normalize. - - -/** - * Returns a SanitizedHtml object for a particular value. The content direction - * is preserved. - * - * This HTML-escapes the value unless it is already SanitizedHtml. Escapes - * double quote '"' in addition to '&', '<', and '>' so that a string can be - * included in an HTML tag attribute value within double quotes. - * - * @param {*} value The value to convert. If it is already a SanitizedHtml - * object, it is left alone. - * @return {!soydata.SanitizedHtml} An escaped version of value. - */ -soy.$$escapeHtml = function(value) { - return soydata.SanitizedHtml.from(value); -}; - - -/** - * Strips unsafe tags to convert a string of untrusted HTML into HTML that - * is safe to embed. The content direction is preserved. - * - * @param {*} value The string-like value to be escaped. May not be a string, - * but the value will be coerced to a string. - * @return {!soydata.SanitizedHtml} A sanitized and normalized version of value. - */ -soy.$$cleanHtml = function(value) { - if (soydata.isContentKind(value, soydata.SanitizedContentKind.HTML)) { - goog.asserts.assert(value.constructor === soydata.SanitizedHtml); - return /** @type {!soydata.SanitizedHtml} */ (value); - } - return soydata.VERY_UNSAFE.ordainSanitizedHtml( - soy.$$stripHtmlTags(value, soy.esc.$$SAFE_TAG_WHITELIST_), - soydata.getContentDir(value)); -}; - - -/** - * Escapes HTML special characters in a string so that it can be embedded in - * RCDATA. - * <p> - * Escapes HTML special characters so that the value will not prematurely end - * the body of a tag like {@code <textarea>} or {@code <title>}. RCDATA tags - * cannot contain other HTML entities, so it is not strictly necessary to escape - * HTML special characters except when part of that text looks like an HTML - * entity or like a close tag : {@code </textarea>}. - * <p> - * Will normalize known safe HTML to make sure that sanitized HTML (which could - * contain an innocuous {@code </textarea>} don't prematurely end an RCDATA - * element. - * - * @param {*} value The string-like value to be escaped. May not be a string, - * but the value will be coerced to a string. - * @return {string} An escaped version of value. - */ -soy.$$escapeHtmlRcdata = function(value) { - if (soydata.isContentKind(value, soydata.SanitizedContentKind.HTML)) { - goog.asserts.assert(value.constructor === soydata.SanitizedHtml); - return soy.esc.$$normalizeHtmlHelper(value.content); - } - return soy.esc.$$escapeHtmlHelper(value); -}; - - -/** - * Matches any/only HTML5 void elements' start tags. - * See http://www.w3.org/TR/html-markup/syntax.html#syntax-elements - * @type {RegExp} - * @private - */ -soy.$$HTML5_VOID_ELEMENTS_ = new RegExp( - '^<(?:area|base|br|col|command|embed|hr|img|input' + - '|keygen|link|meta|param|source|track|wbr)\\b'); - - -/** - * Removes HTML tags from a string of known safe HTML. - * If opt_tagWhitelist is not specified or is empty, then - * the result can be used as an attribute value. - * - * @param {*} value The HTML to be escaped. May not be a string, but the - * value will be coerced to a string. - * @param {Object.<string, number>=} opt_tagWhitelist Has an own property whose - * name is a lower-case tag name and whose value is {@code 1} for - * each element that is allowed in the output. - * @return {string} A representation of value without disallowed tags, - * HTML comments, or other non-text content. - */ -soy.$$stripHtmlTags = function(value, opt_tagWhitelist) { - if (!opt_tagWhitelist) { - // If we have no white-list, then use a fast track which elides all tags. - return String(value).replace(soy.esc.$$HTML_TAG_REGEX_, '') - // This is just paranoia since callers should normalize the result - // anyway, but if they didn't, it would be necessary to ensure that - // after the first replace non-tag uses of < do not recombine into - // tags as in "<<foo>script>alert(1337)</<foo>script>". - .replace(soy.esc.$$LT_REGEX_, '<'); - } - - // Escapes '[' so that we can use [123] below to mark places where tags - // have been removed. - var html = String(value).replace(/\[/g, '['); - - // Consider all uses of '<' and replace whitelisted tags with markers like - // [1] which are indices into a list of approved tag names. - // Replace all other uses of < and > with entities. - var tags = []; - html = html.replace( - soy.esc.$$HTML_TAG_REGEX_, - function(tok, tagName) { - if (tagName) { - tagName = tagName.toLowerCase(); - if (opt_tagWhitelist.hasOwnProperty(tagName) && - opt_tagWhitelist[tagName]) { - var start = tok.charAt(1) === '/' ? '</' : '<'; - var index = tags.length; - tags[index] = start + tagName + '>'; - return '[' + index + ']'; - } - } - return ''; - }); - - // Escape HTML special characters. Now there are no '<' in html that could - // start a tag. - html = soy.esc.$$normalizeHtmlHelper(html); - - var finalCloseTags = soy.$$balanceTags_(tags); - - // Now html contains no tags or less-than characters that could become - // part of a tag via a replacement operation and tags only contains - // approved tags. - // Reinsert the white-listed tags. - html = html.replace( - /\[(\d+)\]/g, function(_, index) { return tags[index]; }); - - // Close any still open tags. - // This prevents unclosed formatting elements like <ol> and <table> from - // breaking the layout of containing HTML. - return html + finalCloseTags; -}; - - -/** - * Throw out any close tags that don't correspond to start tags. - * If {@code <table>} is used for formatting, embedded HTML shouldn't be able - * to use a mismatched {@code </table>} to break page layout. - * - * @param {Array.<string>} tags an array of tags that will be modified in place - * include tags, the empty string, or concatenations of empty tags. - * @return {string} zero or more closed tags that close all elements that are - * opened in tags but not closed. - * @private - */ -soy.$$balanceTags_ = function(tags) { - var open = []; - for (var i = 0, n = tags.length; i < n; ++i) { - var tag = tags[i]; - if (tag.charAt(1) === '/') { - var openTagIndex = open.length - 1; - // NOTE: This is essentially lastIndexOf, but it's not supported in IE. - while (openTagIndex >= 0 && open[openTagIndex] != tag) { - openTagIndex--; - } - if (openTagIndex < 0) { - tags[i] = ''; // Drop close tag. - } else { - tags[i] = open.slice(openTagIndex).reverse().join(''); - open.length = openTagIndex; - } - } else if (!soy.$$HTML5_VOID_ELEMENTS_.test(tag)) { - open.push('</' + tag.substring(1)); - } - } - return open.reverse().join(''); -}; - - -/** - * Escapes HTML special characters in an HTML attribute value. - * - * @param {*} value The HTML to be escaped. May not be a string, but the - * value will be coerced to a string. - * @return {string} An escaped version of value. - */ -soy.$$escapeHtmlAttribute = function(value) { - // NOTE: We don't accept ATTRIBUTES here because ATTRIBUTES is actually not - // the attribute value context, but instead k/v pairs. - if (soydata.isContentKind(value, soydata.SanitizedContentKind.HTML)) { - // NOTE: After removing tags, we also escape quotes ("normalize") so that - // the HTML can be embedded in attribute context. - goog.asserts.assert(value.constructor === soydata.SanitizedHtml); - return soy.esc.$$normalizeHtmlHelper(soy.$$stripHtmlTags(value.content)); - } - return soy.esc.$$escapeHtmlHelper(value); -}; - - -/** - * Escapes HTML special characters in a string including space and other - * characters that can end an unquoted HTML attribute value. - * - * @param {*} value The HTML to be escaped. May not be a string, but the - * value will be coerced to a string. - * @return {string} An escaped version of value. - */ -soy.$$escapeHtmlAttributeNospace = function(value) { - if (soydata.isContentKind(value, soydata.SanitizedContentKind.HTML)) { - goog.asserts.assert(value.constructor === soydata.SanitizedHtml); - return soy.esc.$$normalizeHtmlNospaceHelper( - soy.$$stripHtmlTags(value.content)); - } - return soy.esc.$$escapeHtmlNospaceHelper(value); -}; - - -/** - * Filters out strings that cannot be a substring of a valid HTML attribute. - * - * Note the input is expected to be key=value pairs. - * - * @param {*} value The value to escape. May not be a string, but the value - * will be coerced to a string. - * @return {string} A valid HTML attribute name part or name/value pair. - * {@code "zSoyz"} if the input is invalid. - */ -soy.$$filterHtmlAttributes = function(value) { - // NOTE: Explicitly no support for SanitizedContentKind.HTML, since that is - // meaningless in this context, which is generally *between* html attributes. - if (soydata.isContentKind(value, soydata.SanitizedContentKind.ATTRIBUTES)) { - goog.asserts.assert(value.constructor === soydata.SanitizedHtmlAttribute); - // Add a space at the end to ensure this won't get merged into following - // attributes, unless the interpretation is unambiguous (ending with quotes - // or a space). - return value.content.replace(/([^"'\s])$/, '$1 '); - } - // TODO: Dynamically inserting attributes that aren't marked as trusted is - // probably unnecessary. Any filtering done here will either be inadequate - // for security or not flexible enough. Having clients use kind="attributes" - // in parameters seems like a wiser idea. - return soy.esc.$$filterHtmlAttributesHelper(value); -}; - - -/** - * Filters out strings that cannot be a substring of a valid HTML element name. - * - * @param {*} value The value to escape. May not be a string, but the value - * will be coerced to a string. - * @return {string} A valid HTML element name part. - * {@code "zSoyz"} if the input is invalid. - */ -soy.$$filterHtmlElementName = function(value) { - // NOTE: We don't accept any SanitizedContent here. HTML indicates valid - // PCDATA, not tag names. A sloppy developer shouldn't be able to cause an - // exploit: - // ... {let userInput}script src=http://evil.com/evil.js{/let} ... - // ... {param tagName kind="html"}{$userInput}{/param} ... - // ... <{$tagName}>Hello World</{$tagName}> - return soy.esc.$$filterHtmlElementNameHelper(value); -}; - - -/** - * Escapes characters in the value to make it valid content for a JS string - * literal. - * - * @param {*} value The value to escape. May not be a string, but the value - * will be coerced to a string. - * @return {string} An escaped version of value. - * @deprecated - */ -soy.$$escapeJs = function(value) { - return soy.$$escapeJsString(value); -}; - - -/** - * Escapes characters in the value to make it valid content for a JS string - * literal. - * - * @param {*} value The value to escape. May not be a string, but the value - * will be coerced to a string. - * @return {string} An escaped version of value. - */ -soy.$$escapeJsString = function(value) { - if (soydata.isContentKind(value, soydata.SanitizedContentKind.JS_STR_CHARS)) { - // TODO: It might still be worthwhile to normalize it to remove - // unescaped quotes, null, etc: replace(/(?:^|[^\])['"]/g, '\\$ - goog.asserts.assert(value.constructor === soydata.SanitizedJsStrChars); - return value.content; - } - return soy.esc.$$escapeJsStringHelper(value); -}; - - -/** - * Encodes a value as a JavaScript literal. - * - * @param {*} value The value to escape. May not be a string, but the value - * will be coerced to a string. - * @return {string} A JavaScript code representation of the input. - */ -soy.$$escapeJsValue = function(value) { - // We surround values with spaces so that they can't be interpolated into - // identifiers by accident. - // We could use parentheses but those might be interpreted as a function call. - if (value == null) { // Intentionally matches undefined. - // Java returns null from maps where there is no corresponding key while - // JS returns undefined. - // We always output null for compatibility with Java which does not have a - // distinct undefined value. - return ' null '; - } - if (soydata.isContentKind(value, soydata.SanitizedContentKind.JS)) { - goog.asserts.assert(value.constructor === soydata.SanitizedJs); - return value.content; - } - switch (typeof value) { - case 'boolean': case 'number': - return ' ' + value + ' '; - default: - return "'" + soy.esc.$$escapeJsStringHelper(String(value)) + "'"; - } -}; - - -/** - * Escapes characters in the string to make it valid content for a JS regular - * expression literal. - * - * @param {*} value The value to escape. May not be a string, but the value - * will be coerced to a string. - * @return {string} An escaped version of value. - */ -soy.$$escapeJsRegex = function(value) { - return soy.esc.$$escapeJsRegexHelper(value); -}; - - -/** - * Matches all URI mark characters that conflict with HTML attribute delimiters - * or that cannot appear in a CSS uri. - * From <a href="http://www.w3.org/TR/CSS2/grammar.html">G.2: CSS grammar</a> - * <pre> - * url ([!#$%&*-~]|{nonascii}|{escape})* - * </pre> - * - * @type {RegExp} - * @private - */ -soy.$$problematicUriMarks_ = /['()]/g; - -/** - * @param {string} ch A single character in {@link soy.$$problematicUriMarks_}. - * @return {string} - * @private - */ -soy.$$pctEncode_ = function(ch) { - return '%' + ch.charCodeAt(0).toString(16); -}; - -/** - * Escapes a string so that it can be safely included in a URI. - * - * @param {*} value The value to escape. May not be a string, but the value - * will be coerced to a string. - * @return {string} An escaped version of value. - */ -soy.$$escapeUri = function(value) { - if (soydata.isContentKind(value, soydata.SanitizedContentKind.URI)) { - goog.asserts.assert(value.constructor === soydata.SanitizedUri); - return soy.$$normalizeUri(value); - } - // Apostophes and parentheses are not matched by encodeURIComponent. - // They are technically special in URIs, but only appear in the obsolete mark - // production in Appendix D.2 of RFC 3986, so can be encoded without changing - // semantics. - var encoded = soy.esc.$$escapeUriHelper(value); - soy.$$problematicUriMarks_.lastIndex = 0; - if (soy.$$problematicUriMarks_.test(encoded)) { - return encoded.replace(soy.$$problematicUriMarks_, soy.$$pctEncode_); - } - return encoded; -}; - - -/** - * Removes rough edges from a URI by escaping any raw HTML/JS string delimiters. - * - * @param {*} value The value to escape. May not be a string, but the value - * will be coerced to a string. - * @return {string} An escaped version of value. - */ -soy.$$normalizeUri = function(value) { - return soy.esc.$$normalizeUriHelper(value); -}; - - -/** - * Vets a URI's protocol and removes rough edges from a URI by escaping - * any raw HTML/JS string delimiters. - * - * @param {*} value The value to escape. May not be a string, but the value - * will be coerced to a string. - * @return {string} An escaped version of value. - */ -soy.$$filterNormalizeUri = function(value) { - if (soydata.isContentKind(value, soydata.SanitizedContentKind.URI)) { - goog.asserts.assert(value.constructor === soydata.SanitizedUri); - return soy.$$normalizeUri(value); - } - return soy.esc.$$filterNormalizeUriHelper(value); -}; - - -/** - * Allows only data-protocol image URI's. - * - * @param {*} value The value to process. May not be a string, but the value - * will be coerced to a string. - * @return {!soydata.SanitizedUri} An escaped version of value. - */ -soy.$$filterImageDataUri = function(value) { - // NOTE: Even if it's a SanitizedUri, we will still filter it. - return soydata.VERY_UNSAFE.ordainSanitizedUri( - soy.esc.$$filterImageDataUriHelper(value)); -}; - - -/** - * Escapes a string so it can safely be included inside a quoted CSS string. - * - * @param {*} value The value to escape. May not be a string, but the value - * will be coerced to a string. - * @return {string} An escaped version of value. - */ -soy.$$escapeCssString = function(value) { - return soy.esc.$$escapeCssStringHelper(value); -}; - - -/** - * Encodes a value as a CSS identifier part, keyword, or quantity. - * - * @param {*} value The value to escape. May not be a string, but the value - * will be coerced to a string. - * @return {string} A safe CSS identifier part, keyword, or quanitity. - */ -soy.$$filterCssValue = function(value) { - if (soydata.isContentKind(value, soydata.SanitizedContentKind.CSS)) { - goog.asserts.assert(value.constructor === soydata.SanitizedCss); - return value.content; - } - // Uses == to intentionally match null and undefined for Java compatibility. - if (value == null) { - return ''; - } - return soy.esc.$$filterCssValueHelper(value); -}; - - -/** - * Sanity-checks noAutoescape input for explicitly tainted content. - * - * SanitizedContentKind.TEXT is used to explicitly mark input that was never - * meant to be used unescaped. - * - * @param {*} value The value to filter. - * @return {*} The value, that we dearly hope will not cause an attack. - */ -soy.$$filterNoAutoescape = function(value) { - if (soydata.isContentKind(value, soydata.SanitizedContentKind.TEXT)) { - // Fail in development mode. - goog.asserts.fail( - 'Tainted SanitizedContentKind.TEXT for |noAutoescape: `%s`', - [value.content]); - // Return innocuous data in production. - return 'zSoyz'; - } - - return value; -}; - - -// ----------------------------------------------------------------------------- -// Basic directives/functions. - - -/** - * Converts \r\n, \r, and \n to <br>s - * @param {*} value The string in which to convert newlines. - * @return {string|!soydata.SanitizedHtml} A copy of {@code value} with - * converted newlines. If {@code value} is SanitizedHtml, the return value - * is also SanitizedHtml, of the same known directionality. - */ -soy.$$changeNewlineToBr = function(value) { - var result = goog.string.newLineToBr(String(value), false); - if (soydata.isContentKind(value, soydata.SanitizedContentKind.HTML)) { - return soydata.VERY_UNSAFE.ordainSanitizedHtml( - result, soydata.getContentDir(value)); - } - return result; -}; - - -/** - * Inserts word breaks ('wbr' tags) into a HTML string at a given interval. The - * counter is reset if a space is encountered. Word breaks aren't inserted into - * HTML tags or entities. Entites count towards the character count; HTML tags - * do not. - * - * @param {*} value The HTML string to insert word breaks into. Can be other - * types, but the value will be coerced to a string. - * @param {number} maxCharsBetweenWordBreaks Maximum number of non-space - * characters to allow before adding a word break. - * @return {string|!soydata.SanitizedHtml} The string including word - * breaks. If {@code value} is SanitizedHtml, the return value - * is also SanitizedHtml, of the same known directionality. - */ -soy.$$insertWordBreaks = function(value, maxCharsBetweenWordBreaks) { - var result = goog.format.insertWordBreaks( - String(value), maxCharsBetweenWordBreaks); - if (soydata.isContentKind(value, soydata.SanitizedContentKind.HTML)) { - return soydata.VERY_UNSAFE.ordainSanitizedHtml( - result, soydata.getContentDir(value)); - } - return result; -}; - - -/** - * Truncates a string to a given max length (if it's currently longer), - * optionally adding ellipsis at the end. - * - * @param {*} str The string to truncate. Can be other types, but the value will - * be coerced to a string. - * @param {number} maxLen The maximum length of the string after truncation - * (including ellipsis, if applicable). - * @param {boolean} doAddEllipsis Whether to add ellipsis if the string needs - * truncation. - * @return {string} The string after truncation. - */ -soy.$$truncate = function(str, maxLen, doAddEllipsis) { - - str = String(str); - if (str.length <= maxLen) { - return str; // no need to truncate - } - - // If doAddEllipsis, either reduce maxLen to compensate, or else if maxLen is - // too small, just turn off doAddEllipsis. - if (doAddEllipsis) { - if (maxLen > 3) { - maxLen -= 3; - } else { - doAddEllipsis = false; - } - } - - // Make sure truncating at maxLen doesn't cut up a unicode surrogate pair. - if (soy.$$isHighSurrogate_(str.charAt(maxLen - 1)) && - soy.$$isLowSurrogate_(str.charAt(maxLen))) { - maxLen -= 1; - } - - // Truncate. - str = str.substring(0, maxLen); - - // Add ellipsis. - if (doAddEllipsis) { - str += '...'; - } - - return str; -}; - -/** - * Private helper for $$truncate() to check whether a char is a high surrogate. - * @param {string} ch The char to check. - * @return {boolean} Whether the given char is a unicode high surrogate. - * @private - */ -soy.$$isHighSurrogate_ = function(ch) { - return 0xD800 <= ch && ch <= 0xDBFF; -}; - -/** - * Private helper for $$truncate() to check whether a char is a low surrogate. - * @param {string} ch The char to check. - * @return {boolean} Whether the given char is a unicode low surrogate. - * @private - */ -soy.$$isLowSurrogate_ = function(ch) { - return 0xDC00 <= ch && ch <= 0xDFFF; -}; - - -// ----------------------------------------------------------------------------- -// Bidi directives/functions. - - -/** - * Cache of bidi formatter by context directionality, so we don't keep on - * creating new objects. - * @type {!Object.<!goog.i18n.BidiFormatter>} - * @private - */ -soy.$$bidiFormatterCache_ = {}; - - -/** - * Returns cached bidi formatter for bidiGlobalDir, or creates a new one. - * @param {number} bidiGlobalDir The global directionality context: 1 if ltr, -1 - * if rtl, 0 if unknown. - * @return {goog.i18n.BidiFormatter} A formatter for bidiGlobalDir. - * @private - */ -soy.$$getBidiFormatterInstance_ = function(bidiGlobalDir) { - return soy.$$bidiFormatterCache_[bidiGlobalDir] || - (soy.$$bidiFormatterCache_[bidiGlobalDir] = - new goog.i18n.BidiFormatter(bidiGlobalDir)); -}; - - -/** - * Estimate the overall directionality of text. If opt_isHtml, makes sure to - * ignore the LTR nature of the mark-up and escapes in text, making the logic - * suitable for HTML and HTML-escaped text. - * If text has a goog.i18n.bidi.Dir-valued contentDir, this is used instead of - * estimating the directionality. - * - * @param {*} text The content whose directionality is to be estimated. - * @param {boolean=} opt_isHtml Whether text is HTML/HTML-escaped. - * Default: false. - * @return {number} 1 if text is LTR, -1 if it is RTL, and 0 if it is neutral. - */ -soy.$$bidiTextDir = function(text, opt_isHtml) { - var contentDir = soydata.getContentDir(text); - if (contentDir != null) { - return contentDir; - } - var isHtml = opt_isHtml || - soydata.isContentKind(text, soydata.SanitizedContentKind.HTML); - return goog.i18n.bidi.estimateDirection(text + '', isHtml); -}; - - -/** - * Returns 'dir="ltr"' or 'dir="rtl"', depending on text's estimated - * directionality, if it is not the same as bidiGlobalDir. - * Otherwise, returns the empty string. - * If opt_isHtml, makes sure to ignore the LTR nature of the mark-up and escapes - * in text, making the logic suitable for HTML and HTML-escaped text. - * If text has a goog.i18n.bidi.Dir-valued contentDir, this is used instead of - * estimating the directionality. - * - * @param {number} bidiGlobalDir The global directionality context: 1 if ltr, -1 - * if rtl, 0 if unknown. - * @param {*} text The content whose directionality is to be estimated. - * @param {boolean=} opt_isHtml Whether text is HTML/HTML-escaped. - * Default: false. - * @return {soydata.SanitizedHtmlAttribute} 'dir="rtl"' for RTL text in non-RTL - * context; 'dir="ltr"' for LTR text in non-LTR context; - * else, the empty string. - */ -soy.$$bidiDirAttr = function(bidiGlobalDir, text, opt_isHtml) { - var formatter = soy.$$getBidiFormatterInstance_(bidiGlobalDir); - var contentDir = soydata.getContentDir(text); - if (contentDir == null) { - var isHtml = opt_isHtml || - soydata.isContentKind(text, soydata.SanitizedContentKind.HTML); - contentDir = goog.i18n.bidi.estimateDirection(text + '', isHtml); - } - return soydata.VERY_UNSAFE.ordainSanitizedHtmlAttribute( - formatter.knownDirAttr(contentDir)); -}; - - -/** - * Returns a Unicode BiDi mark matching bidiGlobalDir (LRM or RLM) if the - * directionality or the exit directionality of text are opposite to - * bidiGlobalDir. Otherwise returns the empty string. - * If opt_isHtml, makes sure to ignore the LTR nature of the mark-up and escapes - * in text, making the logic suitable for HTML and HTML-escaped text. - * If text has a goog.i18n.bidi.Dir-valued contentDir, this is used instead of - * estimating the directionality. - * - * @param {number} bidiGlobalDir The global directionality context: 1 if ltr, -1 - * if rtl, 0 if unknown. - * @param {*} text The content whose directionality is to be estimated. - * @param {boolean=} opt_isHtml Whether text is HTML/HTML-escaped. - * Default: false. - * @return {string} A Unicode bidi mark matching bidiGlobalDir, or the empty - * string when text's overall and exit directionalities both match - * bidiGlobalDir, or bidiGlobalDir is 0 (unknown). - */ -soy.$$bidiMarkAfter = function(bidiGlobalDir, text, opt_isHtml) { - var formatter = soy.$$getBidiFormatterInstance_(bidiGlobalDir); - var isHtml = opt_isHtml || - soydata.isContentKind(text, soydata.SanitizedContentKind.HTML); - return formatter.markAfterKnownDir(soydata.getContentDir(text), text + '', - isHtml); -}; - - -/** - * Returns text wrapped in a <span dir="ltr|rtl"> according to its - * directionality - but only if that is neither neutral nor the same as the - * global context. Otherwise, returns text unchanged. - * Always treats text as HTML/HTML-escaped, i.e. ignores mark-up and escapes - * when estimating text's directionality. - * If text has a goog.i18n.bidi.Dir-valued contentDir, this is used instead of - * estimating the directionality. - * - * @param {number} bidiGlobalDir The global directionality context: 1 if ltr, -1 - * if rtl, 0 if unknown. - * @param {*} text The string to be wrapped. Can be other types, but the value - * will be coerced to a string. - * @return {!goog.soy.data.SanitizedContent|string} The wrapped text. - */ -soy.$$bidiSpanWrap = function(bidiGlobalDir, text) { - var formatter = soy.$$getBidiFormatterInstance_(bidiGlobalDir); - - // We always treat the value as HTML, because span-wrapping is only useful - // when its output will be treated as HTML (without escaping), and because - // |bidiSpanWrap is not itself specified to do HTML escaping in Soy. (Both - // explicit and automatic HTML escaping, if any, is done before calling - // |bidiSpanWrap because the BidiSpanWrapDirective Java class implements - // SanitizedContentOperator, but this does not mean that the input has to be - // HTML SanitizedContent. In legacy usage, a string that is not - // SanitizedContent is often printed in an autoescape="false" template or by - // a print with a |noAutoescape, in which case our input is just SoyData.) If - // the output will be treated as HTML, the input had better be safe - // HTML/HTML-escaped (even if it isn't HTML SanitizedData), or we have an XSS - // opportunity and a much bigger problem than bidi garbling. - var wrappedText = formatter.spanWrapWithKnownDir( - soydata.getContentDir(text), text + '', true /* opt_isHtml */); - - // Like other directives whose Java class implements SanitizedContentOperator, - // |bidiSpanWrap is called after the escaping (if any) has already been done, - // and thus there is no need for it to produce actual SanitizedContent. - return wrappedText; -}; - - -/** - * Returns text wrapped in Unicode BiDi formatting characters according to its - * directionality, i.e. either LRE or RLE at the beginning and PDF at the end - - * but only if text's directionality is neither neutral nor the same as the - * global context. Otherwise, returns text unchanged. - * Only treats soydata.SanitizedHtml as HTML/HTML-escaped, i.e. ignores mark-up - * and escapes when estimating text's directionality. - * If text has a goog.i18n.bidi.Dir-valued contentDir, this is used instead of - * estimating the directionality. - * - * @param {number} bidiGlobalDir The global directionality context: 1 if ltr, -1 - * if rtl, 0 if unknown. - * @param {*} text The string to be wrapped. Can be other types, but the value - * will be coerced to a string. - * @return {!goog.soy.data.SanitizedContent|string} The wrapped string. - */ -soy.$$bidiUnicodeWrap = function(bidiGlobalDir, text) { - var formatter = soy.$$getBidiFormatterInstance_(bidiGlobalDir); - - // We treat the value as HTML if and only if it says it's HTML, even though in - // legacy usage, we sometimes have an HTML string (not SanitizedContent) that - // is passed to an autoescape="false" template or a {print $foo|noAutoescape}, - // with the output going into an HTML context without escaping. We simply have - // no way of knowing if this is what is happening when we get - // non-SanitizedContent input, and most of the time it isn't. - var isHtml = soydata.isContentKind(text, soydata.SanitizedContentKind.HTML); - var wrappedText = formatter.unicodeWrapWithKnownDir( - soydata.getContentDir(text), text + '', isHtml); - - // Bidi-wrapping a value converts it to the context directionality. Since it - // does not cost us anything, we will indicate this known direction in the - // output SanitizedContent, even though the intended consumer of that - // information - a bidi wrapping directive - has already been run. - var wrappedTextDir = formatter.getContextDir(); - - // Unicode-wrapping UnsanitizedText gives UnsanitizedText. - // Unicode-wrapping safe HTML or JS string data gives valid, safe HTML or JS - // string data. - // ATTENTION: Do these need to be ...ForInternalBlocks()? - if (soydata.isContentKind(text, soydata.SanitizedContentKind.TEXT)) { - return new soydata.UnsanitizedText(wrappedText, wrappedTextDir); - } - if (isHtml) { - return soydata.VERY_UNSAFE.ordainSanitizedHtml(wrappedText, wrappedTextDir); - } - if (soydata.isContentKind(text, soydata.SanitizedContentKind.JS_STR_CHARS)) { - return soydata.VERY_UNSAFE.ordainSanitizedJsStrChars( - wrappedText, wrappedTextDir); - } - - // Unicode-wrapping does not conform to the syntax of the other types of - // content. For lack of anything better to do, we we do not declare a content - // kind at all by falling through to the non-SanitizedContent case below. - // TODO(user): Consider throwing a runtime error on receipt of - // SanitizedContent other than TEXT, HTML, or JS_STR_CHARS. - - // The input was not SanitizedContent, so our output isn't SanitizedContent - // either. - return wrappedText; -}; - - -// ----------------------------------------------------------------------------- -// Generated code. - - - - - - - - -// START GENERATED CODE FOR ESCAPERS. - -/** - * @type {function (*) : string} - */ -soy.esc.$$escapeUriHelper = function(v) { - return encodeURIComponent(String(v)); -}; - -/** - * Maps characters to the escaped versions for the named escape directives. - * @type {Object.<string, string>} - * @private - */ -soy.esc.$$ESCAPE_MAP_FOR_ESCAPE_HTML__AND__NORMALIZE_HTML__AND__ESCAPE_HTML_NOSPACE__AND__NORMALIZE_HTML_NOSPACE_ = { - '\x00': '\x26#0;', - '\x22': '\x26quot;', - '\x26': '\x26amp;', - '\x27': '\x26#39;', - '\x3c': '\x26lt;', - '\x3e': '\x26gt;', - '\x09': '\x26#9;', - '\x0a': '\x26#10;', - '\x0b': '\x26#11;', - '\x0c': '\x26#12;', - '\x0d': '\x26#13;', - ' ': '\x26#32;', - '-': '\x26#45;', - '\/': '\x26#47;', - '\x3d': '\x26#61;', - '`': '\x26#96;', - '\x85': '\x26#133;', - '\xa0': '\x26#160;', - '\u2028': '\x26#8232;', - '\u2029': '\x26#8233;' -}; - -/** - * A function that can be used with String.replace. - * @param {string} ch A single character matched by a compatible matcher. - * @return {string} A token in the output language. - * @private - */ -soy.esc.$$REPLACER_FOR_ESCAPE_HTML__AND__NORMALIZE_HTML__AND__ESCAPE_HTML_NOSPACE__AND__NORMALIZE_HTML_NOSPACE_ = function(ch) { - return soy.esc.$$ESCAPE_MAP_FOR_ESCAPE_HTML__AND__NORMALIZE_HTML__AND__ESCAPE_HTML_NOSPACE__AND__NORMALIZE_HTML_NOSPACE_[ch]; -}; - -/** - * Maps characters to the escaped versions for the named escape directives. - * @type {Object.<string, string>} - * @private - */ -soy.esc.$$ESCAPE_MAP_FOR_ESCAPE_JS_STRING__AND__ESCAPE_JS_REGEX_ = { - '\x00': '\\x00', - '\x08': '\\x08', - '\x09': '\\t', - '\x0a': '\\n', - '\x0b': '\\x0b', - '\x0c': '\\f', - '\x0d': '\\r', - '\x22': '\\x22', - '\x26': '\\x26', - '\x27': '\\x27', - '\/': '\\\/', - '\x3c': '\\x3c', - '\x3d': '\\x3d', - '\x3e': '\\x3e', - '\\': '\\\\', - '\x85': '\\x85', - '\u2028': '\\u2028', - '\u2029': '\\u2029', - '$': '\\x24', - '(': '\\x28', - ')': '\\x29', - '*': '\\x2a', - '+': '\\x2b', - ',': '\\x2c', - '-': '\\x2d', - '.': '\\x2e', - ':': '\\x3a', - '?': '\\x3f', - '[': '\\x5b', - ']': '\\x5d', - '^': '\\x5e', - '{': '\\x7b', - '|': '\\x7c', - '}': '\\x7d' -}; - -/** - * A function that can be used with String.replace. - * @param {string} ch A single character matched by a compatible matcher. - * @return {string} A token in the output language. - * @private - */ -soy.esc.$$REPLACER_FOR_ESCAPE_JS_STRING__AND__ESCAPE_JS_REGEX_ = function(ch) { - return soy.esc.$$ESCAPE_MAP_FOR_ESCAPE_JS_STRING__AND__ESCAPE_JS_REGEX_[ch]; -}; - -/** - * Maps characters to the escaped versions for the named escape directives. - * @type {Object.<string, string>} - * @private - */ -soy.esc.$$ESCAPE_MAP_FOR_ESCAPE_CSS_STRING_ = { - '\x00': '\\0 ', - '\x08': '\\8 ', - '\x09': '\\9 ', - '\x0a': '\\a ', - '\x0b': '\\b ', - '\x0c': '\\c ', - '\x0d': '\\d ', - '\x22': '\\22 ', - '\x26': '\\26 ', - '\x27': '\\27 ', - '(': '\\28 ', - ')': '\\29 ', - '*': '\\2a ', - '\/': '\\2f ', - ':': '\\3a ', - ';': '\\3b ', - '\x3c': '\\3c ', - '\x3d': '\\3d ', - '\x3e': '\\3e ', - '@': '\\40 ', - '\\': '\\5c ', - '{': '\\7b ', - '}': '\\7d ', - '\x85': '\\85 ', - '\xa0': '\\a0 ', - '\u2028': '\\2028 ', - '\u2029': '\\2029 ' -}; - -/** - * A function that can be used with String.replace. - * @param {string} ch A single character matched by a compatible matcher. - * @return {string} A token in the output language. - * @private - */ -soy.esc.$$REPLACER_FOR_ESCAPE_CSS_STRING_ = function(ch) { - return soy.esc.$$ESCAPE_MAP_FOR_ESCAPE_CSS_STRING_[ch]; -}; - -/** - * Maps characters to the escaped versions for the named escape directives. - * @type {Object.<string, string>} - * @private - */ -soy.esc.$$ESCAPE_MAP_FOR_NORMALIZE_URI__AND__FILTER_NORMALIZE_URI_ = { - '\x00': '%00', - '\x01': '%01', - '\x02': '%02', - '\x03': '%03', - '\x04': '%04', - '\x05': '%05', - '\x06': '%06', - '\x07': '%07', - '\x08': '%08', - '\x09': '%09', - '\x0a': '%0A', - '\x0b': '%0B', - '\x0c': '%0C', - '\x0d': '%0D', - '\x0e': '%0E', - '\x0f': '%0F', - '\x10': '%10', - '\x11': '%11', - '\x12': '%12', - '\x13': '%13', - '\x14': '%14', - '\x15': '%15', - '\x16': '%16', - '\x17': '%17', - '\x18': '%18', - '\x19': '%19', - '\x1a': '%1A', - '\x1b': '%1B', - '\x1c': '%1C', - '\x1d': '%1D', - '\x1e': '%1E', - '\x1f': '%1F', - ' ': '%20', - '\x22': '%22', - '\x27': '%27', - '(': '%28', - ')': '%29', - '\x3c': '%3C', - '\x3e': '%3E', - '\\': '%5C', - '{': '%7B', - '}': '%7D', - '\x7f': '%7F', - '\x85': '%C2%85', - '\xa0': '%C2%A0', - '\u2028': '%E2%80%A8', - '\u2029': '%E2%80%A9', - '\uff01': '%EF%BC%81', - '\uff03': '%EF%BC%83', - '\uff04': '%EF%BC%84', - '\uff06': '%EF%BC%86', - '\uff07': '%EF%BC%87', - '\uff08': '%EF%BC%88', - '\uff09': '%EF%BC%89', - '\uff0a': '%EF%BC%8A', - '\uff0b': '%EF%BC%8B', - '\uff0c': '%EF%BC%8C', - '\uff0f': '%EF%BC%8F', - '\uff1a': '%EF%BC%9A', - '\uff1b': '%EF%BC%9B', - '\uff1d': '%EF%BC%9D', - '\uff1f': '%EF%BC%9F', - '\uff20': '%EF%BC%A0', - '\uff3b': '%EF%BC%BB', - '\uff3d': '%EF%BC%BD' -}; - -/** - * A function that can be used with String.replace. - * @param {string} ch A single character matched by a compatible matcher. - * @return {string} A token in the output language. - * @private - */ -soy.esc.$$REPLACER_FOR_NORMALIZE_URI__AND__FILTER_NORMALIZE_URI_ = function(ch) { - return soy.esc.$$ESCAPE_MAP_FOR_NORMALIZE_URI__AND__FILTER_NORMALIZE_URI_[ch]; -}; - -/** - * Matches characters that need to be escaped for the named directives. - * @type RegExp - * @private - */ -soy.esc.$$MATCHER_FOR_ESCAPE_HTML_ = /[\x00\x22\x26\x27\x3c\x3e]/g; - -/** - * Matches characters that need to be escaped for the named directives. - * @type RegExp - * @private - */ -soy.esc.$$MATCHER_FOR_NORMALIZE_HTML_ = /[\x00\x22\x27\x3c\x3e]/g; - -/** - * Matches characters that need to be escaped for the named directives. - * @type RegExp - * @private - */ -soy.esc.$$MATCHER_FOR_ESCAPE_HTML_NOSPACE_ = /[\x00\x09-\x0d \x22\x26\x27\x2d\/\x3c-\x3e`\x85\xa0\u2028\u2029]/g; - -/** - * Matches characters that need to be escaped for the named directives. - * @type RegExp - * @private - */ -soy.esc.$$MATCHER_FOR_NORMALIZE_HTML_NOSPACE_ = /[\x00\x09-\x0d \x22\x27\x2d\/\x3c-\x3e`\x85\xa0\u2028\u2029]/g; - -/** - * Matches characters that need to be escaped for the named directives. - * @type RegExp - * @private - */ -soy.esc.$$MATCHER_FOR_ESCAPE_JS_STRING_ = /[\x00\x08-\x0d\x22\x26\x27\/\x3c-\x3e\\\x85\u2028\u2029]/g; - -/** - * Matches characters that need to be escaped for the named directives. - * @type RegExp - * @private - */ -soy.esc.$$MATCHER_FOR_ESCAPE_JS_REGEX_ = /[\x00\x08-\x0d\x22\x24\x26-\/\x3a\x3c-\x3f\x5b-\x5e\x7b-\x7d\x85\u2028\u2029]/g; - -/** - * Matches characters that need to be escaped for the named directives. - * @type RegExp - * @private - */ -soy.esc.$$MATCHER_FOR_ESCAPE_CSS_STRING_ = /[\x00\x08-\x0d\x22\x26-\x2a\/\x3a-\x3e@\\\x7b\x7d\x85\xa0\u2028\u2029]/g; - -/** - * Matches characters that need to be escaped for the named directives. - * @type RegExp - * @private - */ -soy.esc.$$MATCHER_FOR_NORMALIZE_URI__AND__FILTER_NORMALIZE_URI_ = /[\x00- \x22\x27-\x29\x3c\x3e\\\x7b\x7d\x7f\x85\xa0\u2028\u2029\uff01\uff03\uff04\uff06-\uff0c\uff0f\uff1a\uff1b\uff1d\uff1f\uff20\uff3b\uff3d]/g; - -/** - * A pattern that vets values produced by the named directives. - * @type RegExp - * @private - */ -soy.esc.$$FILTER_FOR_FILTER_CSS_VALUE_ = /^(?!-*(?:expression|(?:moz-)?binding))(?:[.#]?-?(?:[_a-z0-9-]+)(?:-[_a-z0-9-]+)*-?|-?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[a-z]{1,2}|%)?|!important|)$/i; - -/** - * A pattern that vets values produced by the named directives. - * @type RegExp - * @private - */ -soy.esc.$$FILTER_FOR_FILTER_NORMALIZE_URI_ = /^(?:(?:https?|mailto):|[^&:\/?#]*(?:[\/?#]|$))/i; - -/** - * A pattern that vets values produced by the named directives. - * @type RegExp - * @private - */ -soy.esc.$$FILTER_FOR_FILTER_IMAGE_DATA_URI_ = /^data:image\/(?:bmp|gif|jpe?g|png|tiff|webp);base64,[a-z0-9+\/]+=*$/i; - -/** - * A pattern that vets values produced by the named directives. - * @type RegExp - * @private - */ -soy.esc.$$FILTER_FOR_FILTER_HTML_ATTRIBUTES_ = /^(?!style|on|action|archive|background|cite|classid|codebase|data|dsync|href|longdesc|src|usemap)(?:[a-z0-9_$:-]*)$/i; - -/** - * A pattern that vets values produced by the named directives. - * @type RegExp - * @private - */ -soy.esc.$$FILTER_FOR_FILTER_HTML_ELEMENT_NAME_ = /^(?!script|style|title|textarea|xmp|no)[a-z0-9_$:-]*$/i; - -/** - * A helper for the Soy directive |escapeHtml - * @param {*} value Can be of any type but will be coerced to a string. - * @return {string} The escaped text. - */ -soy.esc.$$escapeHtmlHelper = function(value) { - var str = String(value); - return str.replace( - soy.esc.$$MATCHER_FOR_ESCAPE_HTML_, - soy.esc.$$REPLACER_FOR_ESCAPE_HTML__AND__NORMALIZE_HTML__AND__ESCAPE_HTML_NOSPACE__AND__NORMALIZE_HTML_NOSPACE_); -}; - -/** - * A helper for the Soy directive |normalizeHtml - * @param {*} value Can be of any type but will be coerced to a string. - * @return {string} The escaped text. - */ -soy.esc.$$normalizeHtmlHelper = function(value) { - var str = String(value); - return str.replace( - soy.esc.$$MATCHER_FOR_NORMALIZE_HTML_, - soy.esc.$$REPLACER_FOR_ESCAPE_HTML__AND__NORMALIZE_HTML__AND__ESCAPE_HTML_NOSPACE__AND__NORMALIZE_HTML_NOSPACE_); -}; - -/** - * A helper for the Soy directive |escapeHtmlNospace - * @param {*} value Can be of any type but will be coerced to a string. - * @return {string} The escaped text. - */ -soy.esc.$$escapeHtmlNospaceHelper = function(value) { - var str = String(value); - return str.replace( - soy.esc.$$MATCHER_FOR_ESCAPE_HTML_NOSPACE_, - soy.esc.$$REPLACER_FOR_ESCAPE_HTML__AND__NORMALIZE_HTML__AND__ESCAPE_HTML_NOSPACE__AND__NORMALIZE_HTML_NOSPACE_); -}; - -/** - * A helper for the Soy directive |normalizeHtmlNospace - * @param {*} value Can be of any type but will be coerced to a string. - * @return {string} The escaped text. - */ -soy.esc.$$normalizeHtmlNospaceHelper = function(value) { - var str = String(value); - return str.replace( - soy.esc.$$MATCHER_FOR_NORMALIZE_HTML_NOSPACE_, - soy.esc.$$REPLACER_FOR_ESCAPE_HTML__AND__NORMALIZE_HTML__AND__ESCAPE_HTML_NOSPACE__AND__NORMALIZE_HTML_NOSPACE_); -}; - -/** - * A helper for the Soy directive |escapeJsString - * @param {*} value Can be of any type but will be coerced to a string. - * @return {string} The escaped text. - */ -soy.esc.$$escapeJsStringHelper = function(value) { - var str = String(value); - return str.replace( - soy.esc.$$MATCHER_FOR_ESCAPE_JS_STRING_, - soy.esc.$$REPLACER_FOR_ESCAPE_JS_STRING__AND__ESCAPE_JS_REGEX_); -}; - -/** - * A helper for the Soy directive |escapeJsRegex - * @param {*} value Can be of any type but will be coerced to a string. - * @return {string} The escaped text. - */ -soy.esc.$$escapeJsRegexHelper = function(value) { - var str = String(value); - return str.replace( - soy.esc.$$MATCHER_FOR_ESCAPE_JS_REGEX_, - soy.esc.$$REPLACER_FOR_ESCAPE_JS_STRING__AND__ESCAPE_JS_REGEX_); -}; - -/** - * A helper for the Soy directive |escapeCssString - * @param {*} value Can be of any type but will be coerced to a string. - * @return {string} The escaped text. - */ -soy.esc.$$escapeCssStringHelper = function(value) { - var str = String(value); - return str.replace( - soy.esc.$$MATCHER_FOR_ESCAPE_CSS_STRING_, - soy.esc.$$REPLACER_FOR_ESCAPE_CSS_STRING_); -}; - -/** - * A helper for the Soy directive |filterCssValue - * @param {*} value Can be of any type but will be coerced to a string. - * @return {string} The escaped text. - */ -soy.esc.$$filterCssValueHelper = function(value) { - var str = String(value); - if (!soy.esc.$$FILTER_FOR_FILTER_CSS_VALUE_.test(str)) { - return 'zSoyz'; - } - return str; -}; - -/** - * A helper for the Soy directive |normalizeUri - * @param {*} value Can be of any type but will be coerced to a string. - * @return {string} The escaped text. - */ -soy.esc.$$normalizeUriHelper = function(value) { - var str = String(value); - return str.replace( - soy.esc.$$MATCHER_FOR_NORMALIZE_URI__AND__FILTER_NORMALIZE_URI_, - soy.esc.$$REPLACER_FOR_NORMALIZE_URI__AND__FILTER_NORMALIZE_URI_); -}; - -/** - * A helper for the Soy directive |filterNormalizeUri - * @param {*} value Can be of any type but will be coerced to a string. - * @return {string} The escaped text. - */ -soy.esc.$$filterNormalizeUriHelper = function(value) { - var str = String(value); - if (!soy.esc.$$FILTER_FOR_FILTER_NORMALIZE_URI_.test(str)) { - return '#zSoyz'; - } - return str.replace( - soy.esc.$$MATCHER_FOR_NORMALIZE_URI__AND__FILTER_NORMALIZE_URI_, - soy.esc.$$REPLACER_FOR_NORMALIZE_URI__AND__FILTER_NORMALIZE_URI_); -}; - -/** - * A helper for the Soy directive |filterImageDataUri - * @param {*} value Can be of any type but will be coerced to a string. - * @return {string} The escaped text. - */ -soy.esc.$$filterImageDataUriHelper = function(value) { - var str = String(value); - if (!soy.esc.$$FILTER_FOR_FILTER_IMAGE_DATA_URI_.test(str)) { - return 'data:image/gif;base64,zSoyz'; - } - return str; -}; - -/** - * A helper for the Soy directive |filterHtmlAttributes - * @param {*} value Can be of any type but will be coerced to a string. - * @return {string} The escaped text. - */ -soy.esc.$$filterHtmlAttributesHelper = function(value) { - var str = String(value); - if (!soy.esc.$$FILTER_FOR_FILTER_HTML_ATTRIBUTES_.test(str)) { - return 'zSoyz'; - } - return str; -}; - -/** - * A helper for the Soy directive |filterHtmlElementName - * @param {*} value Can be of any type but will be coerced to a string. - * @return {string} The escaped text. - */ -soy.esc.$$filterHtmlElementNameHelper = function(value) { - var str = String(value); - if (!soy.esc.$$FILTER_FOR_FILTER_HTML_ELEMENT_NAME_.test(str)) { - return 'zSoyz'; - } - return str; -}; - -/** - * Matches all tags, HTML comments, and DOCTYPEs in tag soup HTML. - * By removing these, and replacing any '<' or '>' characters with - * entities we guarantee that the result can be embedded into a - * an attribute without introducing a tag boundary. - * - * @type {RegExp} - * @private - */ -soy.esc.$$HTML_TAG_REGEX_ = /<(?:!|\/?([a-zA-Z][a-zA-Z0-9:\-]*))(?:[^>'"]|"[^"]*"|'[^']*')*>/g; - -/** - * Matches all occurrences of '<'. - * - * @type {RegExp} - * @private - */ -soy.esc.$$LT_REGEX_ = /</g; - -/** - * Maps lower-case names of innocuous tags to 1. - * - * @type {Object.<string,number>} - * @private - */ -soy.esc.$$SAFE_TAG_WHITELIST_ = {'b': 1, 'br': 1, 'em': 1, 'i': 1, 's': 1, 'sub': 1, 'sup': 1, 'u': 1}; - -// END GENERATED CODE diff --git a/res/lib/blockly/demos/plane/style.css b/res/lib/blockly/demos/plane/style.css deleted file mode 100644 index 16e2c6f412a2ed56eb81b37065d74072cede2519..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/style.css +++ /dev/null @@ -1,97 +0,0 @@ -body { - background-color: #fff; - font-family: sans-serif; - margin-top: 0; -} -h1 { - font-weight: normal; - font-size: 140%; -} -.farSide { - text-align: right; -} -html[dir="RTL"] .farSide { - text-align: left; -} -.tab { - padding: 6px 12px; - text-decoration: none; - color: #000; -} -#selected { - font-weight: bold; - background-color: #ddd; - border-radius: 20px; -} - -/* Pulse the language menu once to draw attention to it. */ -#languageBorder { - border-radius: 4px; - animation: pulse 2s ease-in-out forwards; - animation-delay: 2s; -} -@keyframes pulse { - 0% { background-color: #fff } - 50% { background-color: #f00 } - 100% { background-color: #fff } -} - -#blockly { - height: 300px; - width: 100%; - border-style: solid; - border-color: #ddd; - border-width: 0 1px 1px 0; -} - -/* SVG Plane. */ -#plane { - overflow: hidden; -} -#fuselage { - fill: #fff; - stroke: #000; -} -#wing, #tail { - fill: #ddd; - stroke: #444; -} -.crew { - fill: #f44; - stroke: #000; -} -.seat1st { - fill: #88f; - stroke: #000; -} -.seat2nd { - fill: #8b8; - stroke: #000; -} -#seatYes, #seatNo { - font-size: 40pt; -} -text { - font-family: sans-serif; - font-size: 20pt; - fill: #444; -} -html[dir="RTL"] #plane text { - text-anchor: end; -} - -/* Slider. */ -.sliderTrack { - stroke: #aaa; - stroke-width: 6px; - stroke-linecap: round; -} -.sliderKnob { - fill: #ddd; - stroke: #bbc; - stroke-width: 1px; - stroke-linejoin: round; -} -.sliderKnob:hover { - fill: #eee; -} diff --git a/res/lib/blockly/demos/plane/template.soy b/res/lib/blockly/demos/plane/template.soy deleted file mode 100644 index cbccc9ae467677642d98f90f2e939cb86f7f0e9d..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/template.soy +++ /dev/null @@ -1,225 +0,0 @@ -{namespace planepage} - -/** - * This is a Closure Template. - * - * See the README.txt for details. - */ - -/** - * Translated messages for use in JavaScript. - */ -{template .messages} - <div style="display: none"> - <span id="Plane_rows">{msg meaning="Plane.rows" desc="page text - Total number of rows of seats on an airplane.\n\nParameters:\n* %1 - number of rows of seats on an airplane. It is always an integer greater than or equal to zero."}Rows: %1{/msg}</span> - <span id="Plane_getRows">{msg meaning="Plane.getRows" desc="block text - The number of rows on the airplane, to be used in a mathematical equation, such as: 'seats = 4 x '''rows (5)''''.\n\nParameters:\n* %1 - number of rows of seats on an airplane. It is always an integer greater than or equal to zero."}rows (%1){/msg}</span> - <span id="Plane_rows1">{msg meaning="Plane.rows1" desc="page text - The number of rows of first-class seats on the airplane. You can see the block at [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=3].\n\nParameters:\n* %1 - number of rows of first-class seats on an airplane. It is always an integer greater than or equal to zero."}1st class rows: %1{/msg}</span> - <span id="Plane_getRows1">{msg meaning="Plane.getRows1" desc="block text - The number of rows of first-class seats on the, to be used in a mathematical equation. See [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=3].\n\nParameters:\n* %1 - number of rows of first-class seats on an airplane. It is always an integer greater than or equal to zero."}1st class rows (%1){/msg}</span> - <span id="Plane_rows2">{msg meaning="Plane.rows2" desc="page text - The number of rows of second-class seats on the airplane. %1 is an integer greater or equal to zero. See [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=3].\n\nParameters:\n* %1 - number of rows of second-class seats on an airplane. It is always an integer greater than or equal to zero."}2nd class rows: %1{/msg}</span> - <span id="Plane_getRows2">{msg meaning="Plane.getRows2" desc="block text - The number of rows of second-class (also called 'economy class') seats on the airplane, to be used in a mathematical expression.\n\nParameters:\n* %1 - number of rows of second-class seats on an airplane. It is always an integer greater than or equal to zero."}2nd class rows (%1){/msg}</span> - <span id="Plane_seats">{msg meaning="Plane.seats" desc="page text - The total number of seats on the airplane.\n\nParameters:\n* %1 - number of seats on an airplane. It is always either the next message or an integer greater than or equal to zero."}Seats: %1{/msg}</span> - <span id="Plane_placeholder">{msg meaning="Plane.placeholder" desc="page text - A word or symbol indicating that this numeric value has not yet been determined."}?{/msg}</span> - <span id="Plane_setSeats">{msg meaning="Plane.setSeats" desc="block text - The first half of a mathematical equation determining the number of seats in an airplane, such as: ''''seats =''' 4 x rows'."}seats ={/msg}</span> - </div> -{/template} - -/** - * Web page structure. - */ -{template .start} - {call .messages /} - <table width="100%"> - <tr> - <td> - <h1><a href="https://developers.google.com/blockly/">Blockly</a>‏ >{sp} - <a href="../index.html">Demos</a>‏ >{sp} - <span id="title"> - {msg meaning="Plane.plane" desc="title - Specifies that this is Blockly's '''Plane''' (airplane) tutorial. The word 'plane' was chosen over 'airplane' in English because it is shorter and less formal."} - Plane Seat Calculator - {/msg} - </span> - {sp} {sp} - {for $i in range(1, $ij.maxLevel + 1)} - {sp} - {if $i == $ij.level} - <span class="tab" id="selected">{$i}</span> - {else} - {if $i < $ij.level} - <a class="tab previous" href="?lang={$ij.lang}&level={$i}">{$i}</a> - {else} - <a class="tab" href="?lang={$ij.lang}&level={$i}">{$i}</a> - {/if} - {/if} - {/for} - </h1> - </td> - <td class="farSide"> - <span {if $ij.lang == 'en'}id="languageBorder"{/if} style="padding: 10px"> - <select id="languageMenu"></select> - </span> - </td> - </tr> - </table> - - <script src="slider.js"></script> - <svg - id="plane" - xmlns="http://www.w3.org/2000/svg" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - version="1.1" - width="600" - height="320" - viewBox="0 110 600 320"> - <defs> - <g id="row1st"> - <rect - class="seat1st" - width="10" height="10" - x="75" y="243" /> - <rect - class="seat1st" - width="10" height="10" - x="75" y="254" /> - <rect - class="seat1st" - width="10" height="10" - x="75" y="272" /> - <rect - class="seat1st" - width="10" height="10" - x="75" y="283" /> - </g> - <g id="row2nd"> - <rect - class="seat2nd" - width="10" height="8" - x="75" y="243" /> - <rect - class="seat2nd" - width="10" height="8" - x="75" y="251" /> - <rect - class="seat2nd" - width="10" height="8" - x="75" y="269" /> - <rect - class="seat2nd" - width="10" height="8" - x="75" y="277" /> - <rect - class="seat2nd" - width="10" height="8" - x="75" y="285" /> - </g> - <linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%"> - <stop offset="0%" style="stop-color:#fff;stop-opacity:0" /> - <stop offset="100%" style="stop-color:#fff;stop-opacity:1" /> - </linearGradient> - <linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"> - <stop offset="0%" style="stop-color:#fff;stop-opacity:0" /> - <stop offset="100%" style="stop-color:#fff;stop-opacity:1" /> - </linearGradient> - </defs> - <path - d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z" - id="wing" /> - <path - d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z" - id="tail" /> - <path - d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z" - id="fuselage" /> - <rect - width="610" - height="100" - x="-5" - y="110" - fill="url(#grad1)" /> - <rect - width="610" - height="100" - x="-5" - y="330" - fill="url(#grad2)" /> - <text id="row1stText" x="55" y="380"></text> - <text id="row2ndText" x="55" y="420"></text> - <text x="55" y="210"> - <tspan id="seatText"></tspan> - <tspan id="seatYes" style="fill: #0c0;" dy="10">✓</tspan> - <tspan id="seatNo" style="fill: #f00;" dy="10">✗</tspan> - </text> - {if $ij.level > 1} - <rect - id="crew_right" class="crew" - width="10" height="10" - x="35" y="254" /> - <rect - id="crew_left" class="crew" - width="10" height="10" - x="35" y="272" /> - {/if} - </svg> - - <p> - {switch $ij.level} - {case 1} - {msg meaning="Plane.description1" desc="instructions - Note that in [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=1 this level], there is only one type of seat on the plane."}An airplane has a number of rows of passenger seats. Each row contains four seats.{/msg} - {case 2} - {msg meaning="Plane.description2" desc="instructions - Note that in [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=2 this level], there are two types of seats on this plane."}An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.{/msg} - {case 3} - {msg meaning="Plane.description3" desc="instructions - Note that in [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=3 this level], there are three types of seats on this plane. Be sure to use the same terms for '1st class' and '2nd class' as you did for the earlier messages."}An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.{/msg} - {/switch} - </p> - <p> - {msg meaning="Plane.instructions" desc="page text - This text appears below the airplane graphic and above the space for the user to create the formula. The number of rows an the graphic may be changed by the user with a slider. See [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=1] for a picture."}Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).{/msg} - </p> - - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../javascript_compressed.js"></script> - <script src="../../msg/js/{$ij.lang}.js"></script> - <script src="blocks.js"></script> - {call .toolbox /} - <div id="blockly"></div> -{/template} - -/** - * Toolboxes for each level. - */ -{template .toolbox} - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <block type="math_number"></block> - <block type="math_arithmetic"> - <value name="A"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="B"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - </block> - <block type="math_arithmetic"> - <field name="OP">MULTIPLY</field> - <value name="A"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - <value name="B"> - <shadow type="math_number"> - <field name="NUM">1</field> - </shadow> - </value> - </block> - {if $ij.level <= 2} - <block type="plane_get_rows"></block> - {else} - <block type="plane_get_rows1st"></block> - <block type="plane_get_rows2nd"></block> - {/if} - </xml> -{/template} diff --git a/res/lib/blockly/demos/plane/xlf/extracted_msgs.xlf b/res/lib/blockly/demos/plane/xlf/extracted_msgs.xlf deleted file mode 100644 index 6a4fd44ff4f7bbbb8cecb41d92c14e5226691373..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/extracted_msgs.xlf +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" xml:space="preserve" source-language="en"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <note priority="1" from="description">page text - Total number of rows of seats on an airplane.\n\nParameters:\n* %1 - number of rows of seats on an airplane. It is always an integer greater than or equal to zero.</note> - <note priority="1" from="meaning">Plane.rows</note> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <note priority="1" from="description">block text - The first half of a mathematical equation determining the number of seats in an airplane, such as: ''''seats =''' 4 x rows'.</note> - <note priority="1" from="meaning">Plane.setSeats</note> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <note priority="1" from="description">instructions - Note that in [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=3 this level], there are three types of seats on this plane. Be sure to use the same terms for '1st class' and '2nd class' as you did for the earlier messages.</note> - <note priority="1" from="meaning">Plane.description3</note> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <note priority="1" from="description">page text - A word or symbol indicating that this numeric value has not yet been determined.</note> - <note priority="1" from="meaning">Plane.placeholder</note> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <note priority="1" from="description">page text - This text appears below the airplane graphic and above the space for the user to create the formula. The number of rows an the graphic may be changed by the user with a slider. See [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=1] for a picture.</note> - <note priority="1" from="meaning">Plane.instructions</note> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <note priority="1" from="description">instructions - Note that in [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=2 this level], there are two types of seats on this plane.</note> - <note priority="1" from="meaning">Plane.description2</note> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <note priority="1" from="description">block text - The number of rows of first-class seats on the, to be used in a mathematical equation. See [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=3].\n\nParameters:\n* %1 - number of rows of first-class seats on an airplane. It is always an integer greater than or equal to zero.</note> - <note priority="1" from="meaning">Plane.getRows1</note> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <note priority="1" from="description">page text - The number of rows of second-class seats on the airplane. %1 is an integer greater or equal to zero. See [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=3].\n\nParameters:\n* %1 - number of rows of second-class seats on an airplane. It is always an integer greater than or equal to zero.</note> - <note priority="1" from="meaning">Plane.rows2</note> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <note priority="1" from="description">page text - The total number of seats on the airplane.\n\nParameters:\n* %1 - number of seats on an airplane. It is always either the next message or an integer greater than or equal to zero.</note> - <note priority="1" from="meaning">Plane.seats</note> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <note priority="1" from="description">title - Specifies that this is Blockly's '''Plane''' (airplane) tutorial. The word 'plane' was chosen over 'airplane' in English because it is shorter and less formal.</note> - <note priority="1" from="meaning">Plane.plane</note> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <note priority="1" from="description">block text - The number of rows on the airplane, to be used in a mathematical equation, such as: 'seats = 4 x '''rows (5)''''.\n\nParameters:\n* %1 - number of rows of seats on an airplane. It is always an integer greater than or equal to zero.</note> - <note priority="1" from="meaning">Plane.getRows</note> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <note priority="1" from="description">page text - The number of rows of first-class seats on the airplane. You can see the block at [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=3].\n\nParameters:\n* %1 - number of rows of first-class seats on an airplane. It is always an integer greater than or equal to zero.</note> - <note priority="1" from="meaning">Plane.rows1</note> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <note priority="1" from="description">instructions - Note that in [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=1 this level], there is only one type of seat on the plane.</note> - <note priority="1" from="meaning">Plane.description1</note> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <note priority="1" from="description">block text - The number of rows of second-class (also called 'economy class') seats on the airplane, to be used in a mathematical expression.\n\nParameters:\n* %1 - number of rows of second-class seats on an airplane. It is always an integer greater than or equal to zero.</note> - <note priority="1" from="meaning">Plane.getRows2</note> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_ar.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_ar.xlf deleted file mode 100644 index c9b8e1689ace789cebc12a700f364c81decb4c8b..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_ar.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="ar"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>الصÙÙˆÙ: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>المقاعد =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>طائرة بمقعدين ÙÙŠ مقطورة الطيّار (للطيار ومساعده) وعدد من المقاعد ÙÙŠ صÙو٠الدرجة الأولى والثانية. كل ص٠من صÙو٠الدرجة الأولى ÙŠØØªÙˆÙŠ Ø¹Ù„Ù‰ أربعة مقاعد. ÙˆÙŠØØªÙˆÙŠ ÙƒÙ„ ص٠ÙÙŠ الدرجة الثانية على خمسة مقاعد.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>ØŸ</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>لبناء صيغة (أدناه) تقوم Ø¨ØØ³Ø§Ø¨ إجمالي عدد المقاعد ÙÙŠ الطائرة عند تغيير الصÙÙˆÙ (أعلاه).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>طائرة بمقعدين ÙÙŠ مقطورة الطيّار (للطيار ومساعده) وعدد من الصÙÙˆÙ ÙŠØØªÙˆÙŠ ÙƒÙ„ ص٠على أربعة مقاعد.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>صÙو٠الطبقة الأولى (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>صÙÙˆÙ Ø§Ù„ÙØ¦Ø© الثانية: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>المقاعد: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>آلة ØØ§Ø³Ø¨Ø© لمقعد الطائرة</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>الصÙÙˆÙ (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>صÙو٠الطبقة الأولى: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>هنالك طائرة ØªØØªÙˆÙŠ Ø¹Ù„Ù‰ عدد من صÙو٠مقاعد الركاب. كل ØµÙ ÙŠØØªÙˆÙŠ Ø¹Ù„Ù‰ أربعة مقاعد.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>صÙÙˆÙ Ø§Ù„ÙØ¦Ø© الثانية: (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_be-tarask.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_be-tarask.xlf deleted file mode 100644 index 4580b5f1d6e85fba3ebb428244887d0652aed68f..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_be-tarask.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="be-tarask"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Радкоў: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>меÑцаў =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Самалёт мае два меÑцы Ñž кабіне Ñкіпажа (пілот Ñ– другі пілот), Ñ– некалькі паÑажырÑкіх шÑрагаў меÑцаў 1-га клÑÑа Ñ– 2-га клÑÑа. Кожны шÑраг 1-га клÑÑа утрымлівае чатыры меÑцы. Кожны шÑраг 2-га клÑÑа ўтрымлівае пÑць меÑцаў.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Пабудаваць формулу (ніжÑй), ÑÐºÐ°Ñ Ð¿Ð°Ð´Ð»Ñ–Ñ‡Ð²Ð°Ðµ агульную колькаÑьць меÑцаў у Ñамалёце пры зьмене радоў (гл. вышÑй).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Самалёт мае два меÑцы Ñž кабіне Ñкіпажа (пілот Ñ– другі пілот), Ñ– некалькі шÑрагаў паÑажырÑкіх ÑÑдзеньнÑÑž. Кожны шÑраг утрымлівае чатыры меÑцы.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>радкі першага клÑÑу (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>Радкі другога клÑÑу: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>МеÑцаў: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>КалькулÑтар меÑцаў у Ñамалёце</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>радкоў (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Радкі першага клÑÑу: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Самалёт мае некалькі шÑрагаў паÑажырÑкіх ÑÑдзеньнÑÑž. ÐšÐ¾Ð¶Ð½Ð°Ñ ÑˆÑраг утрымлівае чатыры меÑцы.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>радкі другога клÑÑу (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_br.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_br.xlf deleted file mode 100644 index 4a7fc0c26c28663d33385614d915ca43bb904f52..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_br.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="br"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Renkennadoù : %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>azezennoù =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>En un nijerez ez eus div azezenn el logell leviañ(evit al loman hag an eil loman), hag un toullad renkennadoù azezennoù tremenidi kentañ hag eil klas. Peder azezenn zo e pep renkennad kentañ klas. Pemp azezenn zo e pemp renkennad eil klas.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Sevel ur formulenn (amañ dindan) evit jediñ an niver a azezennoù en holl en nijerez pa vez kemmet an niver a renkennadoù (amañ a-us).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>En un nijerez ez eus div azezenn el logell leviañ(evit al loman hag an eil loman), hag ur toullad renkennadoù azezennoù evit an dremenidi. Peder azezenn zo e pep renkennad.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>Renkennadoù kentañ klas (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>Renkennadoù eil klas : %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Azezennoù : %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Jederez azezenn nijerez</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>renkennadoù (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Renkennadoù kentañ klas : %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Un nijerez he deus un toullad renkennadoù azezennoù evit ar veajourien. Peder azezenn a zo e pep renkennad.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>Renkennadoù eil klas (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_ca.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_ca.xlf deleted file mode 100644 index 17dfe65e09e0b1e1f87e866b8b3a89b45aeb455f..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_ca.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="ca"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Files: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>seients =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Un avió té dos seients en la cabina de vol (pel pilot i copilot) i un nombre de files per seients de passatgers de primera classe i de segona classe. Cada fila de primera classe conté quatre seients. Cada fila de segona classe conté cinc seients.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Construïu una fórmula (a sota) que calculi el nombre total de seients de l'avió a mida que canviïn les files (a dalt).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Un avió té dos seients en la cabina de vol (pel pilot i pel copilot) i un nombre de files de seients de passatgers. Cada fila conté quatre seients.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>files de primera classe (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>files de segona classe: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Seients: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Calculadora de seients d'avió</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>files (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>files de primera classe: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Un avió té un nombre de files de seients de passatgers. Cada fila conté quatre seients.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>files de segona classe (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_da.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_da.xlf deleted file mode 100644 index 752fe24f5b89caaffa17c20d5156fb7506158626..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_da.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="da"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Rækker: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>sæder =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Et fly har to pladser i cockpittet (til pilot og med-pilot), og et antal rækker af 1. klasses og 2. klasses passagersæder. Hver 1. klasses række indeholder fire sæder. Hver 2. klasses række indeholder fem sæder.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Opbyg en formel (nedenfor), der beregner det samlede antal pladser pÃ¥ flyet, hvis antal rækker ændres (ovenfor).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Et fly har to pladser i cockpittet (til pilot og med-pilot), og et antal rækker af passagersæder. Hver række indeholder fire sæder.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>1. klasse rækker (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>2. klasse rækker: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Sæder: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Flysædelommeregner</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>rækker (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>1. klasse rækker: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Et fly har et antal rækker af passagersæder. Hver række indeholder fire sæder.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>2. klasse rækker (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_de.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_de.xlf deleted file mode 100644 index f06bc77253e4086e3977b6a5c17567744b4925d3..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_de.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="de"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Reihen: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>Sitze =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Ein Flugzeug hat zwei Sitze im Pilotenstand (für den Piloten und Co-Piloten) und eine Anzahl an Reihen mit Passagiersitzen der 1. und 2. Klasse. Jede 1.-Klasse-Reihe enthält vier Sitze. Jede 2.-Klasse-Reihe enthält fünf Sitze.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Erstelle eine Formel (unten), die die gesamte Anzahl an Sitzen im Flugzeug berechnet, wenn die Reihen (oben) geändert werden.</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Ein Flugzeug hat zwei Sitze im Pilotenstand (für den Piloten und Co-Piloten) und eine Anzahl an Reihen mit Passagiersitzen. Jede Reihe enthält vier Sitze.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>Reihen der 1. Klasse (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>Reihen der 2. Klasse: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Sitze: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Flugzeugsitzrechner</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>Reihen (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Reihen der 1. Klasse: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Ein Flugzeug hat eine Anzahl an Reihen mit Passagiersitzen. Jede Reihe enthält vier Sitze.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>Reihen der 2. Klasse (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_el.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_el.xlf deleted file mode 100644 index 5acb291d2c31a756f2bd872ca938e2e984893c56..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_el.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="el"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>ΣειÏÎÏ‚: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>καθίσματα =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Ένα αεÏοπλάνο Îχει δÏο καθίσματα στον θάλαμο διακυβÎÏνησης (για τον κυβεÏνήτη και τον συγκυβεÏνήτη), καθώς και Îναν αÏιθμό σειÏών καθισμάτων για την 1η και 2η θÎση. Κάθε σειÏά της 1ης θÎσης Îχει Ï„ÎσσεÏα καθίσματα και κάθε σειÏά της 2ης θÎσης Îχει Ï€Îντε καθίσματα.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>;</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Φτιάξε Îναν Ï„Ïπο (κάτω) που θα υπολογίζει τον συνολικό αÏιθμό καθισμάτων του αεÏοπλάνου καθώς αλλάζουν οι σειÏÎÏ‚ (πάνω).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Ένα αεÏοπλάνο Îχει δÏο καθίσματα στον θάλαμο διακυβÎÏνησης (για τον κυβεÏνήτη και τον συγκυβεÏνήτη), καθώς και Îναν αÏιθμό από σειÏÎÏ‚ καθισμάτων επιβατών. Κάθε σειÏά Îχει Ï„ÎσσεÏα καθίσματα.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>ΣειÏÎÏ‚ 1ης θÎσης (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>ΣειÏÎÏ‚ 2ης θÎσης: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Καθίσματα: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Υπολογισμός ΘÎσεων Σε ΑεÏοπλάνο</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>σειÏÎÏ‚ (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>ΣειÏÎÏ‚ 1ης θÎσης: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Ένα αεÏοπλάνο Îχει Îναν συγκεκÏιμÎνο αÏιθμό σειÏών καθισμάτων επιβατών. Κάθε σειÏά Îχει Ï„ÎσσεÏα καθίσματα.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>ΣειÏÎÏ‚ 2ης θÎσης (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_en.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_en.xlf deleted file mode 100644 index e471a00085b5ebb431e17d210962061e0b86be38..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_en.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="en"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Rows: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>seats =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>1st class rows (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>2nd class rows: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Seats: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Plane Seat Calculator</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>rows (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>1st class rows: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>An airplane has a number of rows of passenger seats. Each row contains four seats.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>2nd class rows (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_es.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_es.xlf deleted file mode 100644 index e2022b5f12335a13ebd4bf4bc9f83c3fbaa60e08..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_es.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="es"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Filas: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>asientos =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Un avión tiene dos asientos en la cabina de vuelo (para el piloto y co-piloto), y un número de filas de asientos para pasajeros de primera y segunda clase. Cada fila de la primera clase contiene cuatro asientos. Cada fila de la segunda clase contiene cinco asientos.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Construir una fórmula (abajo) que calcule el número total de asientos en el avión cuando las filas sean cambiadas (arriba).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Un avión tiene dos asientos en la cabina de vuelo (para el piloto y co-piloto), y un número de filas de asientos de pasajeros. Cada fila contiene cuatro asientos.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>Filas de primera clase: (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>Filas de segunda clase: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Asientos: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Calculadora de asientos de avión</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>filas (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Filas de primera clase: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Un avión tiene un número de filas de asientos de pasajeros. Cada fila contiene cuatro asientos.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>Filas de segunda clase: (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_et.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_et.xlf deleted file mode 100644 index d88be0a9f7383f04fe08b890ebf25f29a29771ae..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_et.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="en"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Ridu: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>istmete arv =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Lennuki kokpitis on kaks istet (üks kummalegi piloodile), mingi arv ridu 1. klassi reisijatele ja mingi arv ridu 2. klassi reisijatele. Igas 1. klassi reas on neli istet, igas 2. klassi reas viis istet.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Ehita plokkidest valem, mis arvutab istmete arvu lennukis õigesti sõltumata ridade arvust (seda saad muuta lennuki juures oleva liuguriga).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Lennuki kokpitis on kaks istet (üks kummalegi piloodile) ja mingi arv istemridu reisijatele. Igas reas on neli istet.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>1. klassi ridu (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>2. klassi ridu: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Istmeid: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Lennukiistmete kalkulaator</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>rows (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>1. klassi ridu: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Lennukis on reisijate istmed mitmes reas. Igas reas on neli istet.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>2. klassi ridu (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_fa.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_fa.xlf deleted file mode 100644 index 264ec31044438ce1c7aad68ff873e862e3dba57b..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_fa.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="fa"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>ردیÙ: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>صندلی‌ها =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>یک هواپیما دو صندلی در کابین خلبان دارد (برای خلبان Ùˆ Ú©Ù…Ú© خلبان) Ùˆ تهداد از صندلی‌ها Ù…Ø³Ø§ÙØ±ÛŒÙ† درجه یک Ùˆ درجه دو. هر ردی٠درجه یک شامل چهار صندلی است. هر ردی٠درجه دو شامل پنج صندلی است.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>ØŸ</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>یک ÙØ±Ù…ول بسازید (پایین) Ú©Ù‡ تعداد Ú©Ù„ صندلی‌های هواپیما با تغییر ردی٠را ØØ³Ø§Ø¨ کند (بالا).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>یک هواپیما دو صندلی در عرشهٔ پرواز دارد (برای خلبان Ùˆ Ú©Ù…Ú© خلبان) Ùˆ تعدادی صندلی Ù…Ø³Ø§ÙØ±ÛŒÙ†. هر ردی٠شامل چهار صندلی است.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>اولین کلاس ردیÙ‌ها (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>دومین کلاس ردیÙ: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>صندلی‌ها: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Ù…ØØ§Ø³Ø¨Ù‡â€ŒÚ¯Ø± صندلی‌های هواپیما</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>ردیÙ‌ها (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>اولین ردی٠کلاس: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>یک هواپیما تعداد از صندلی‌های Ù…Ø³Ø§ÙØ±ÛŒÙ† را دارد. هر ردی٠شمال چهار صندلی است.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>دومین کلاس ردیÙ‌ها (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_fr.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_fr.xlf deleted file mode 100644 index 9485da29bd3d220427a784600d20e39a3c10da51..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_fr.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="fr"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Rangées : %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>sièges =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Un avion a deux sièges dans la cabine de pilotage (pour le pilote et le copilote), et un certain nombre de rangées de sièges passager de première et seconde classes. Chaque rangée de première classe contient quatre sièges. Chaque rangée de seconde classe contient cinq sièges.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Construire une formule (ci-dessous) qui calcule le nombre total de sièges dans l’avion quand le nombre de rangées est modifié (ci-dessus).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Un avion a deux sièges dans le poste de pilotage (pour le pilote et le copilote), et un certain nombre de rangées de sièges passager. Chaque rangée contient quatre sièges.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>rangées de première classe (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>rangées de seconde classe : %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Sièges : %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Calculateur de sièges d’avion</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>rangées (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>rangées de première classe : %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Un avion a un nombre de rangées de sièges passager. Chaque rangée contient quatre sièges.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>rangées de seconde classe (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_he.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_he.xlf deleted file mode 100644 index 55ac148c5ae315955b13b99632d66d22d0054570..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_he.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="he"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>שורות: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>×ž×•×©×‘×™× =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>במטוס יש ×©× ×™ ×ž×•×©×‘×™× ×¢×‘×•×¨ הצוות (בשביל הטייס וטייס ×”×ž×©× ×”), ומספר שורות ×ž×•×©×‘×™× ×‘×ž×—×œ×§×ª ×”× ×•×¡×¢×™× ×”×¨××©×•× ×” ובמחלקת ×”× ×•×¡×¢×™× ×”×©× ×™×™×”. כל שורה במחלקה הר××©×•× ×” מכילה ×רבעה מושבי×. כל שורה במחלקה ×”×©× ×™×™×” מכילה חמישה מושבי×.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>×‘× ×” × ×•×¡×—×” (למטה) ×שר תחשב ×ת סך כל ×”×ž×•×©×‘×™× ×‘×ž×˜×•×¡ בהת×× ×œ×©×™× ×•×™ מספר השורות (למעלה).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>במטוס יש ×©× ×™ ×ž×•×©×‘×™× ×¢×‘×•×¨ הצוות (בשביל הטייס וטייס ×”×ž×©× ×”), ומספר שורות ×¢× ×ž×•×©×‘×™ × ×•×¡×¢×™×. בכל שורה יש ×רבעה מושבי×.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>שורות במחלקה ר××©×•× ×” (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>שורות במחלקה ×©× ×™×™×”: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>מושבי×: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>מחשבון מושב במטוס</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>שורות (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>שורות במחלקה ר××©×•× ×”: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>במטוס יש מספר שורות ×¢× ×ž×•×©×‘×™ × ×•×¡×¢×™×. בכל שורה יש ×רבעה מושבי×.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>שורות במחלקה ×©× ×™×™×”: (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_hrx.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_hrx.xlf deleted file mode 100644 index 263d3050749a1cb4e4dd17744f9a57d9d0ab7d61..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_hrx.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="hrx"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Reihe: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>Sitze =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>En Fluchzeich hot zwooi Sitze im Pilotstand (für den Pilot und Co-Pilot) und en Oonzohl an Reihe mit Passagiersitze der 1. und 2. Klasse. Jede 1.-Klasse-Reih enthält vier Sitze. Jede 2.-Klasse-Reih enthält fünf Sitze.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Erstell en Formel (unne), die die gesamte Oonzohl an Sitze im Fluchzeich berechnet, wenn die Reihe (uwe) geännert sin.</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>En Fluchzeich hot zwooi Sitze im Pilotestand (für den Pilot und Co-Pilot) und en Oonzohl an Reihe mit Passagiersitze. Jede Reih enthält vier Sitze.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>Reihe von der 1. Klasse (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>Reihe von der 2. Klasse: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Sitz: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Fluchzeichsitzrechner</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>Reihe (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Reihe von der 1. Klasse: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>En Fluchzeich hot en Oonzohl an Reihe mit Passagiersitze. Jede Reih enthält vier Sitze.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>Reihe von der 2. Klasse (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_hu.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_hu.xlf deleted file mode 100644 index c44d1aa9d4ad1be3ac10f97210bdb8ac20c779e6..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_hu.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="hu"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Sorok száma: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>Ülések száma =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Egy repülÅ‘gépnek 2 ülése van a pilótafülkében (a pilótának és a másodpilótának), az utasok 1. és 2. osztályon utazhatnak. Az 1. osztályon négy szék van egy sorban. A 2. osztályon öt szék van egy sorban.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>KészÃtsd el a képletet (lent) amivel kiszámolható, hogy hány ülés van összesen a repülÅ‘gépen annak függvényében, ahogy (fent) állÃtod a sorok számát.</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Egy repülÅ‘gépnek 2 ülése van a pilótafülkében (a pilótának és a másodpilótának), az utasok több sorban ülnek az utastérben. Az utastér minden sorában négy szék van.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>1. osztály sorai (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>2. osztály: %1 sor</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Ülések száma összesen: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>RepülÅ‘gép alkalmazás</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>Sorok száma (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>1. osztály: %1 sor</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Egy repülÅ‘gépen az utasok több sorban ülnek az utastérben. Az utastér minden sorában négy szék van.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>2. osztály sorai (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_ia.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_ia.xlf deleted file mode 100644 index 83ae2c6d2f8bc707d350ac8dcb98c00307460f6a..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_ia.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="ia"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Filas: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>sedes =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Un avion ha duo sedes in le cabina (pro le pilota e le copilota) e un numero de filas de sedes pro passageros del prime classe e del secunde classes. Cata fila del prime classe contine quatro sedes. Cata fila del secunde classe contine cinque sedes.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Construe un formula (ci infra) que calcula le numero total de sedes in le avion quando le numero de filas es cambiate (ci supra).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Un avion ha duo sedes in le cabina (pro le pilota e le copilota) e un numero de filas de sedes pro passageros. Cata fila contine quatro sedes.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>filas de prime classe (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>Filas de secunde classe: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Sedes: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Calculator de sedias de avion</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>filas (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Filas de prime classe: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Un avion ha un numero de filas de sedes pro passageros. Cata fila contine quatro sedes.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>filas de secunde classe (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_is.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_is.xlf deleted file mode 100644 index 3810f4b34c859007831828126290198bd16cdcd5..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_is.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="is"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Raðir: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>sæti =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Flugvél er með tvö sæti à stjórnklefa (fyrir flugmanninn og aðstoðarflugmanninn) og einhvern fjölda sætaraða fyrir farþega á 1. og 2. farrými. Hver sætaröð á 1. farrými hefur fjögur sæti. Hver sætaröð á 2. farrými hefur fimm sæti.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Búðu til formúlu (hér fyrir neðan) sem reiknar heildarfjölda sæta à flugvélinni eftir þvà sem röðunum er breytt (hér fyrir ofan).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Flugvél er með tvö sæti à stjórnklefa (fyrir flugmanninn og aðstoðarflugmanninn) og einhvern fjölda sætaraða fyrir farþega. Hver sætaröð hefur fjögur sæti.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>raðir 1. farrými (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>Raðir 2. farrými: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Sæti: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Flugsætareiknir</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>raðir (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Raðir 1. farrými: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Flugvél er með einhvern fjölda sætaraða fyrir farþega. à hverri röð eru fjögur sæti.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>raðir 2. farrými (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_it.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_it.xlf deleted file mode 100644 index 27bad0dcffde6ad17c40677173106d9a594533fa..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_it.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="it"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>File: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>sedili =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Un aereo ha due posti nella cabina di pilotaggio (per il pilota e il co-pilota), e un numero di file in prima e seconda classe, con i posti a sedere dei passeggeri. Ogni fila della prima classe contiene quattro posti. Quelle invece della seconda classe, ne contengono cinque.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Costruisci una formula (sotto) che calcola il numero totale di posti a sedere su un aeroplano, così come cambiano le file di posti (sopra).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Un aeroplano ha due posti a sedere nella cabina di pilotaggio (per il pilota e co-pilota), e un numero di file con i posti a sedere dei passeggeri. Ogni fila contiene quattro posti.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>file 1ª classe (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>File 2ª classe: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Sedili: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Calcolo posti aereo</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>file (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>File 1ª classe: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Un aeroplano ha un numero di file contenenti i posti a sedere dei passeggeri. Ogni fila, contiene quattro posti a sedere.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>File 2ª classe (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_ja.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_ja.xlf deleted file mode 100644 index b04624a27196d028da88bcbc8004ba7f82854c58..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_ja.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="ja"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>åˆ—ã®æ•°: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>座å¸ã®æ•° =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>飛行機ã«ã¯ã€æ“縦室㮠2 ã¤ã®åº§å¸ (æ“縦士ã¨å‰¯æ“縦士) ã¨ã€ãƒ•ァーストクラスã¨ã‚»ã‚«ãƒ³ãƒ‰ã‚¯ãƒ©ã‚¹ã®ä¹—客ã®åº§å¸ã®åˆ—ãŒã‚りã¾ã™ã€‚ãれãžã‚Œã®åˆ—ã«ã€ãƒ•ァーストクラスã§ã¯ 4 ã¤ã®åº§å¸ã€ã‚»ã‚«ãƒ³ãƒ‰ã‚¯ãƒ©ã‚¹ã§ã¯ 5 ã¤ã®åº§å¸ãŒã‚りã¾ã™ã€‚</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>飛行機ã®åº§å¸ã®æ•°ã‚’計算ã™ã‚‹å¼ã‚’ã€ä¸Šã§åˆ—ã®æ•°ã‚’変更ã—ã¦ã‚‚æ£ã—ããªã‚‹ã‚ˆã†ã«ã€ä¸‹ã«å…¥åŠ›ã—ã¦ãã ã•ã„。</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>飛行機ã«ã¯ã€æ“縦室㮠2 ã¤ã®åº§å¸ (æ“縦士ã¨å‰¯æ“縦士) ã¨ã€ä¹—客ã®åº§å¸ã®åˆ—ãŒã‚りã¾ã™ã€‚ãれãžã‚Œã®åˆ—ã« 4 ã¤ã®åº§å¸ãŒã‚りã¾ã™ã€‚</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>ファーストクラスã®åˆ—æ•° (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>セカンドクラスã®åˆ—æ•°: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>座å¸ã®æ•°: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>飛行機座å¸è¨ˆç®—機</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>åˆ—ã®æ•° (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>ファーストクラスã®åˆ—æ•°: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>飛行機ã«ä¹—客ã®åº§å¸ã®åˆ—ãŒã‚りã¾ã™ã€‚ãれãžã‚Œã®åˆ—ã« 4 ã¤ã®åº§å¸ãŒã‚りã¾ã™ã€‚</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>セカンドクラスã®åˆ—æ•° (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_ko.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_ko.xlf deleted file mode 100644 index 07e23288e665a6cb8f6025c4c9fddf4a7e310dc9..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_ko.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="ko"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>í–‰ 수: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>좌ì„수 =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>비행기는 비행 ê°‘íŒ(조종사와 부조종사용)ì—서 ì¢Œì„ ë‘ ê°œê°€ ìžˆê³ , 1등ì„ê³¼ 2ë“±ì„ ìŠ¹ê° ì¢Œì„ì˜ í–‰ 수가 있습니다. ê° 1ë“±ì„ í–‰ì—는 시트 네 개가 í¬í•¨ë˜ì–´ 있습니다. ê° 2ë“±ì„ í–‰ì—는 시트 다섯 개가 í¬í•¨ë˜ì–´ 있습니다.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>í–‰ì´ ë°”ë€(위) ë¹„í–‰ê¸°ì— ì¢Œì„ì˜ ì´ ìˆ˜ë¥¼ 계산하는 ê³µì‹(아래)ì„ êµ¬ì¶•í•˜ì„¸ìš”.</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>비행기는 비행 ê°‘íŒ(조종사와 부조종사용)ì—서 ì¢Œì„ ë‘ ê°œê°€ ìžˆê³ , ìŠ¹ê° ì¢Œì„ì˜ í–‰ 수가 있습니다. ê° í–‰ì—는 시트 네 개가 í¬í•¨ë˜ì–´ 있습니다.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>1ë“±ì„ í–‰ 수 (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>2ë“±ì„ í–‰ 수: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>ì¢Œì„ ìˆ˜: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>비행기 ì¢Œì„ ê³„ì‚°ê¸°</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>í–‰ 수 (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>1ë“±ì„ í–‰ 수: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>비행기는 ìŠ¹ê° ì¢Œì„ì˜ í–‰ 수가 있습니다. ê° í–‰ì—는 시트 네 개가 í¬í•¨ë˜ì–´ 있습니다.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>2ë“±ì„ í–‰ 수 (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_ms.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_ms.xlf deleted file mode 100644 index c34f084a3d41aeaad0c138fb848ae812ef37516b..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_ms.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="ms"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Baris: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>tempat duduk =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Sebuah kapal terbang mempunyai tempat duduk di kokpit (untuk juruterbang dan pembantunya) dan sebilangan baris tempat duduk penumpang kelas pertama dan kelas kedua. Setiap baris kelas pertama mengandungi empat tempat duduk. Setiap baris kelas pertama mengandungi lima tempat duduk.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Wujudkan formula (di bawah) yang mengira jumlah tempat duduk di dalam kapal terbang sedangkan baris-barisnya diubah (di atas).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Sebuah kapal terbang mempunyai tempat duduk di kokpit (untuk juruterbang dan pembantunya) dan sebilangan baris tempat duduk penumpang. Setiap baris mengandungi empat tempat duduk.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>baris kelas pertama (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>Baris kelas kedua: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Tempat duduk: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Pengira Tempat Duduk Kapal Terbang</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>baris (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Baris kelas pertama: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Sebuah kapal terbang mempunyai sebilangan baris tempat duduk penumpang. Setiap baris mengandungi empat tempat duduk.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>baris kelas kedua (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_nb.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_nb.xlf deleted file mode 100644 index 99c9c6a997153f4ee66b8232c48dc187d4cdfd21..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_nb.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="nb"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Rader: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>seter =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Et fly har to seter i cockpit (for piloten og andrepiloten), og et antall rader med passasjerseter pÃ¥ første og andre klasse. Hver av radene pÃ¥ første klasse har fire seter. Hver av radene pÃ¥ andre klasse har fem seter.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Bygg en formel (under) som beregner det totale antall seter pÃ¥ flyet etter hvert som radene endres (over).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Et fly har to seter i cockpit (for piloten og andrepiloten), og et antall rader med passasjerseter. Hver rad inneholder fire seter.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>Rader i første klasse (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>Rader i andre klasse: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Seter: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Flysetekalkulator</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>rader (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Rader i første klasse: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Et fly har et antall rader med passasjerseter. Hver rad inneholder fire seter.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>Rader i andre klasse (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_nl.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_nl.xlf deleted file mode 100644 index 6f36fa026c7b0bbc75563c3e444d895c734fbf28..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_nl.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="nl"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Rijen: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>stoelen=</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Een vliegtuig heeft twee stoelen in de cockpit (voor de piloot en de copiloot) en een aantal rijen voor 1e klasse en 2e klasse passagiers. Iedere rij in de 1e klasse heeft vier stoelen. Iedere rij in de 2e klasse heeft vijf stoelen.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Maak hieronder een formule die het totale aantal stoelen in het vliegtuig berekent als het aantal rijen hierboven wordt aangepast.</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Een vliegtuig heeft twee stoelen in de cockpit (voor de piloot en de copiloot) en een aantal rijen met stoelen voor passagiers. Iedere rij bevat vier stoelen.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>Rijen 1e klas (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>Rijen 2e klas: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Zitplaatsen: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Vliegtuigstoelencalculator</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>rijen (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Rijen 1e klas: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Een vliegtuig heeft een aantal rijen met stoelen. Iedere rij heeft vier stoelen.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>Rijen 2e klas (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_pl.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_pl.xlf deleted file mode 100644 index 4c8b044e2c880e24fbd72ec980dcddd73a3af49f..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_pl.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="pl"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>RzÄ™dów: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>siedzeÅ„ =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Samolot ma dwa miejsca w kabinie pilotów (dla pierwszego i drugiego pilota) oraz rzÄ™dy siedzeÅ„ dla pasażerów pierwszej i drugiej klasy. Każdy rzÄ…d pierwszej klasy skÅ‚ada siÄ™ z czterech siedzeÅ„. Każdy rzÄ…d drugiej klasy skÅ‚ada siÄ™ z piÄ™ciu siedzeÅ„.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Zbuduj wzór (poniżej), który pozwala obliczyć łącznÄ… liczbÄ™ siedzeÅ„ w samolocie w funkcji zmieniajÄ…cej siÄ™ liczby rzÄ™dów (powyżej).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Samolot ma dwa miejsca w kabinie pilotów (dla pierwszego i drugiego pilota) oraz rzÄ™dy siedzeÅ„ dla pasażerów. Każdy taki rzÄ…d skÅ‚ada siÄ™ z czterech siedzeÅ„.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>RzÄ™dów w pierwszej klasie (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>RzÄ™dów w drugiej klasie: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>SiedzeÅ„: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Kalkulator miejsc w samolocie.</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>rzÄ™dów (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>RzÄ™dów w pierwszej klasie: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Samolot ma kilka rzÄ™dów siedzeÅ„ pasażerów. Każdy rzÄ…d zawiera cztery miejsca.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>RzÄ™dów w drugiej klasie (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_pms.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_pms.xlf deleted file mode 100644 index 0fef9121763ba6d1f04caab3938bfbc4816bc38c..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_pms.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="pms"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Linie: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>sedij =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>N'avion a l'ha doi sedij ant la cabin-a ëd pilotage (për ël pilòta e ël cò-pilòta) e un chèich nùmer ëd file ëd sedij pr'ij passagé ëd prima e sconda classa. Minca fila ëd prima classa a conten quatr sedij. Minca fila ëd seconda classa a conten sinch sedij.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Fabriché na fórmola (sì-sota) ch'a fa 'l cont dël nùmer total ëd sedij ant l'avion cand che ël nùmer dle file a cangia (sì-dzora).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>N'avion a l'ha doi sedij ant la cabin-a ëd pilotage (për ël pilòta e ël cò-pilòta), e un chèich nùmer ëd file ëd sedij pr'ij passagé. Minca fila a conten quatr sedij.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>linie ëd prima classa (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>linie ëd seconda classa: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Sedij: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Calcolator ëd sedij d'avion</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>linie (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>linie ëd prima classa: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>N'avion a l'ha un nùmer ëd file ëd sedij da passëgé. Minca fila a l'ha quatr sedij.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>linie ëd seconda classa (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_pt-br.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_pt-br.xlf deleted file mode 100644 index 7bdd9ccff99644e7000c51029aaaf8d2758c0029..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_pt-br.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="pt-br"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Filas: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>assentos =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Um avião tem dois assentos na cabine de comando (para o piloto e o copiloto) e um número de filas de assentos na primeira e na segunda classe. Cada fila da primeira classe contém quatro assentos. Cada fila da segunda classe contém cinco assentos.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Elabore uma fórmula (abaixo) que calcule o número total de assentos no avião a medida que as filas são alteradas (acima).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Um avião tem dois assentos na cabine de comando (para o piloto e o copiloto) e um número de filas de assentos para os passageiros. Cada fila contém quatro assentos.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>filas na primeira classe (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>filas na segunda classe: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Assentos: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Calculadora de Assentos em Avião</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>filas (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>filas na primeira classe: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Um avião tem um número de filas de assentos para os passageiros. Cada fila contém quatro assentos.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>filas na segunda classe (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_ro.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_ro.xlf deleted file mode 100644 index 614a3bda28bb05be56d5cd5bc8bd29588ef9a0f5..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_ro.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="ro"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Rânduri: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>scaune =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Un avion are două scaune în carlingă (pentru pilot È™i copilot) È™i un număr de rânduri cu scaune de clasa I È™i clasa a II-a pentru pasageri. Fiecare rând de clasa I conÈ›ine patru scaune. Fiecare rând de clasa a II-a conÈ›ine cinci scaune.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>ConstruieÈ™te o formulă (mai jos) care calculează numărul total de locuri dintr-un avion în timp ce rândurile se schimbă (mai sus).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Un avion are două scaune în carlingă (pentru pilot È™i copilot) È™i un număr de rânduri cu scaune pentru pasageri. Fiecare rând conÈ›ine patru scaune.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>rânduri de clasa I (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>rânduri de clasa a II-a: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Scaune: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Calculator pentru locurile dintr-un avion</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>rânduri (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>rânduri de clasa I: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Un avion are un număr de rânduri cu scaune pentru pasageri. Fiecare rând conÈ›ine patru scaune.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>rânduri de clasa a II-a (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_ru.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_ru.xlf deleted file mode 100644 index d25b25458d7a0801d5e546944415e324bc9b5101..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_ru.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="ru"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Ð Ñдов: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>меÑта =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Ð’ Ñамолёте 2 меÑта Ð´Ð»Ñ Ð¿Ð¸Ð»Ð¾Ñ‚Ð° и его помощника, неÑколько Ñ€Ñдов Ñ Ð¿Ð°ÑÑажирÑкими меÑтами первого клаÑÑа, а также неÑколько Ñ€Ñдов Ñ Ð¿Ð°ÑÑажирÑкими меÑтами второго клаÑÑа. Ð’ каждом Ñ€Ñду первого клаÑÑа 4 меÑта. Ð’ каждом Ñ€Ñду второго клаÑÑа 5 меÑÑ‚.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>ПоÑтройте формулу в облаÑти ниже, ÐºÐ¾Ñ‚Ð¾Ñ€Ð°Ñ Ð¿Ð¾Ð¼Ð¾Ð¶ÐµÑ‚ раÑÑчитать общее количеÑтво меÑÑ‚ в Ñамолёте (как на риÑунке выше).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Ð’ Ñамолёте 2 меÑта Ð´Ð»Ñ Ð¿Ð¸Ð»Ð¾Ñ‚Ð° и его помощника, а также неÑколько Ñ€Ñдов Ñ Ð¿Ð°ÑÑажирÑкими меÑтами. Ð’ каждом Ñ€Ñду 4 меÑта.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>Ñ€Ñды 1-го клаÑÑа (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>Ð Ñдов 2-го клаÑÑа: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>МеÑÑ‚: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>КалькулÑтор поÑадочных меÑÑ‚ в Ñамолёте</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>Ñ€Ñды (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Ð Ñдов 1-го клаÑÑа: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Ð’ Ñамолёте неÑколько Ñ€Ñдов Ñ Ð¿Ð°ÑÑажирÑкими меÑтами. Ð’ каждом Ñ€Ñду 4 меÑта.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>Ñ€Ñды 2-го клаÑÑа (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_sc.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_sc.xlf deleted file mode 100644 index 63281235617ca48d6b27ca08f7a306fb32f9493b..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_sc.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="sc"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Fileras: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>cadironis =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Unu aparèchiu tenit duus cadironis in sa cabina de cumandu (po su pilota e su co-pilota), e unas cantu fileras de cadironis po passigeris de prima classi e de segunda classi. Dònnia filera de prima classi tenit cuatru cadironis. Dònnia filera de segunda classi tenit cincu cadironis.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Cuncorda una formula (innoi asuta) chi cumpudit su numeru totali de postus a setzi in s'aparechiu, a segunda de comenti mudant is fileras de postus (innoi in susu)</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Unu aparèchiu tenit duus cadironis in sa cabina de cumandu (po su pilota e su co-pilota), e unas cantu fileras de cadironis po passigeris. Dònnia filera tenit cuatru cadironis.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>fileras de primu classi (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>fileras de segunda classi: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Cadironis: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Fai su contu de is cadironis de unu aparèchiu</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>fileras (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>fileras de primu classi: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Unu aparèchiu tenit unas cantu fileras de cadironis po passigeris. Dònnia filera tenit cuatru cadironis.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>fileras de segunda classi (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_sv.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_sv.xlf deleted file mode 100644 index f3d836fba330eca6e0881838238f60be723287cc..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_sv.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="sv"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Rader: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>säten =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Ett flygplan har tvÃ¥ säten i cockpiten (ett för piloten och ett för andrepiloten) och ett antal rader med passagerarsäten i första och andra klass. Varje rad i första klass innehÃ¥ller fyra säten. Varje rad i andra klass innehÃ¥ller fem säten.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Bygg en formel (nedan) som beräknar det totala antalet säten pÃ¥ flygplanet när raderna ändras (ovan).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Ett flygplan har tvÃ¥ säten i cockpiten (ett för piloten och ett för andrepiloten) och ett antal rader med passagerarsäten. Varje rad innehÃ¥ller fyra säten.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>Rader i första klass (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>Rader i andra klass: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Säten: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Plansäteskalkylator</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>rader (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Rader i första klass: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Ett flygplan har ett antal rader med passagerarsäten. Varje rad innehÃ¥ller fyra säten.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>Rader i andra klass (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_th.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_th.xlf deleted file mode 100644 index 0967d4d199f393d3186f73547546906b1699f970..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_th.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="th"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>%1 à¹à¸–ว</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>จำนวนที่นั่ง =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>ภายในเครื่à¸à¸‡à¸šà¸´à¸™à¸ˆà¸°à¸¡à¸µà¸—ี่นั่งนัà¸à¸šà¸´à¸™à¸à¸¢à¸¹à¹ˆ 2 ที่ (สำหรับนัà¸à¸šà¸´à¸™ à¹à¸¥à¸°à¸œà¸¹à¹‰à¸Šà¹ˆà¸§à¸¢à¸™à¸±à¸à¸šà¸´à¸™) à¹à¸¥à¸°à¸ˆà¸°à¸¡à¸µà¹à¸–วที่นั่งสำหรับผู้โดยสาร "ชั้นเฟิร์สคลาส" à¹à¸¥à¸° "ชั้นธุรà¸à¸´à¸ˆ" à¸à¸¢à¸¹à¹ˆà¸ˆà¸³à¸™à¸§à¸™à¸«à¸™à¸¶à¹ˆà¸‡ โดยในชั้นเฟิร์สคลาสจะมีà¹à¸–วละ 4 ที่นั่ง ส่วนในชั้นธุรà¸à¸´à¸ˆà¸ˆà¸°à¸¡à¸µà¹à¸–วละ 5 ที่นั่ง</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>สร้างสูตรคำนวณ (ด้านล่าง) เพื่à¸à¸„ำนวณหาจำนวนที่นั่งทั้งหมดบนเครื่à¸à¸‡à¸šà¸´à¸™ ตามจำนวนà¹à¸–วที่เปลี่ยนไป (ด้านบน)</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>ภายในเครื่à¸à¸‡à¸šà¸´à¸™à¸ˆà¸°à¸¡à¸µà¸—ี่นั่งนัà¸à¸šà¸´à¸™à¸à¸¢à¸¹à¹ˆ 2 ที่ (สำหรับนัà¸à¸šà¸´à¸™ à¹à¸¥à¸°à¸œà¸¹à¹‰à¸Šà¹ˆà¸§à¸¢à¸™à¸±à¸à¸šà¸´à¸™) à¹à¸¥à¸°à¸¡à¸µà¹à¸–วที่นั่งผู้โดยสารà¸à¸¢à¸¹à¹ˆà¸ˆà¸³à¸™à¸§à¸™à¸«à¸™à¸¶à¹ˆà¸‡ ในà¹à¸•่ละà¹à¸–วจะมี 4 ที่นั่ง</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>จำนวนà¹à¸–วชั้นเฟิร์สคลาส (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>ชั้นธุรà¸à¸´à¸ˆ %1 à¹à¸–ว</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>คำนวณได้ทั้งหมด %1 ที่นั่ง</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>ระบบคำนวณที่นั่งบนเครื่à¸à¸‡à¸šà¸´à¸™</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>จำนวนà¹à¸–ว (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>ชั้นเฟิร์สคลาส %1 à¹à¸–ว</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>ภายในเครื่à¸à¸‡à¸šà¸´à¸™à¸›à¸£à¸°à¸à¸à¸šà¹„ปด้วยà¹à¸–วขà¸à¸‡à¸—ี่นั่งผู้โดยสาร ในà¹à¸•่ละà¹à¸–วจะมี 4 ที่นั่ง</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>จำนวนà¹à¸–วชั้นธุรà¸à¸´à¸ˆ (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_tr.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_tr.xlf deleted file mode 100644 index 678541a32d9d88d410f85e11206f6a2805226c73..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_tr.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="tr"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Sıralar: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>koltuklar =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Bir uçağın uçuÅŸ güvertesinde iki koltuÄŸu (pilot ve yardımcı pilot için), ve belirli sayıda birinci sınıf ve ikinci sınıf yolcu koltuÄŸu sırası vardır. Her birinci sınıf sıra dört koltuk içerir. Her ikinci sınıf sıra beÅŸ koltuk içerir.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Sıralar(üstte) deÄŸiÅŸtikçe uçaktaki toplam koltuk sayısını hesaplayan bir formül(altta) oluÅŸturun.</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Bir uçağın uçuÅŸ güvertesinde iki koltuÄŸu (pilot ve yardımcı pilot için), ve belirli sayıda koltuk sırası vardır. Her sıra dört koltuk içerir.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>Birinci sınıf sıralar (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>İkinci sınıf sıralar: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Koltuklar: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Uçak KoltuÄŸu Hesaplayıcı</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>sıralar (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Birinci sınıf sıralar: (%1)</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Bir uçağın belirli sayıda koltuk sırası vardır. Her sıra dört koltuk içerir.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>İkinci sınıf sıralar (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_uk.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_uk.xlf deleted file mode 100644 index d5e7682a58b18054a2569026a4149578849629ff..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_uk.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="uk"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Ð Ñдки: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>міÑць=</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Літак має два міÑÑ†Ñ Ð² кабіні екіпажу (пілот Ñ– другий пілот), Ñ– кілька Ñ€Ñдів 1-го клаÑу 2-го клаÑу паÑажирÑьких міÑць. Кожний Ñ€Ñд 1-го клаÑу міÑтить чотири міÑцÑ. Кожен Ñ€Ñд 2-го клаÑу міÑтить п'Ñть міÑць.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Побудувати формулу (нижче), Ñка обчиÑлює кількіÑть міÑць на літаку при зміні Ñ€Ñдків (див. вище).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Літак має два міÑÑ†Ñ Ð² кабіні екіпажу (пілот Ñ– другий пілот), Ñ– кілька Ñ€Ñдів паÑажирÑьких Ñидінь. Кожен Ñ€Ñдок міÑтить чотири міÑцÑ.</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>Ñ€Ñдів 1-го клаÑу (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>Ñ€Ñдів 2-го клаÑу: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>МіÑць: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>КалькулÑтор міÑць у літаку</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>Ñ€Ñдки (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Ñ€Ñдів 1-го клаÑу: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Літак має кілька Ñ€Ñдів паÑажирÑьких Ñидінь. Кожен Ñ€Ñд міÑтить чотири міÑцÑ.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>Ñ€Ñдів 2-го клаÑу (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_vi.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_vi.xlf deleted file mode 100644 index 1f4ef6fcf07205514d545c1ce942be499c3911eb..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_vi.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="vi"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>Số hà ng ghế: %1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>TÃnh số chá»— ngồi =</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>Má»™t chiếc máy bay nà y có hai chá»— ngồi ở sà n (cho phi công trưởng và phi công phó), và má»™t số hà ng ghế hạng 1 và hạng 2. Má»—i hà ng hạng 1 có bốn chá»— ngồi. Má»—i hà ng hạng 2 có năm chá»— ngồi.</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>Dưới đây hãy tạo công thức tÃnh số chá»— ngồi trên máy bay để nó thay đổi tùy theo số lượng hà ng ghế (hình trên).</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>Má»™t máy bay có hai ghế trong buồng lái (dà nh cho phi công trưởng và phi công phụ), và má»™t loạt hà ng ghế cho hà nh khách. Má»—i hà ng có bốn ghế (bốn chá»— ngồi).</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>số hà ng hạng nhất (%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>Hà ng hạng hai: %1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>Số chá»— ngồi: %1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>Máy bay ghế máy tÃnh</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>đếm số hà ng ghế (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>Hà ng hạng nhất: %1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>Máy bay có má»™t số hà ng ghế hà nh khách. Má»—i hà ng có bốn chá»— ngồi.</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>số hà ng hạng hai (%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_zh-hans.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_zh-hans.xlf deleted file mode 100644 index 2cbb7e858f5c6b8053ba95c54c465bd197a1f4b7..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_zh-hans.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="zh-hans"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>行:%1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>座ä½ï¼</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>一架飞机除了有两个座ä½ä¾›æ£å‰¯é©¾é©¶å‘˜ï¼Œè¿˜æœ‰ä¸€å®šé‡è¡Œæ•°çš„头ç‰åŠç»æµŽä¹˜å®¢åº§ä½ã€‚å¤´ç‰æ¯è¡Œå…±å››åº§ï¼Œç»æµŽæ¯è¡Œå…±äº”座。</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>于下方写出一æ¡å…¬å¼ä»¥è®¡ç®—é£žæœºä¸Šçš„åº§ä½æ€»æ•°ã€‚</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>一架飞机除了有两个座ä½ä¾›æ£å‰¯é©¾é©¶å‘˜ï¼Œè¿˜æœ‰ä¸€å®šé‡è¡Œæ•°çš„乘客座ä½ã€‚æ¯è¡Œå…±å››åº§ã€‚</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>头ç‰è¡Œï¼ˆ%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>ç»æµŽç‰è¡Œï¼š%1</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>座ä½ï¼š%1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>飞机座ä½è®¡ç®—器</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>行 (%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>头ç‰è¡Œï¼š%1</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>一架飞机有一定é‡è¡Œæ•°çš„乘客座ä½ï¼Œæ¯è¡Œå…±å››åº§ã€‚</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>ç»æµŽç‰è¡Œï¼ˆ%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/plane/xlf/translated_msgs_zh-hant.xlf b/res/lib/blockly/demos/plane/xlf/translated_msgs_zh-hant.xlf deleted file mode 100644 index 2dadf6d4e7ce170e6963ae816cf956d2188d3734..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/plane/xlf/translated_msgs_zh-hant.xlf +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file original="SoyMsgBundle" datatype="x-soy-msg-bundle" source-language="en" target-language="zh-hant"> - <body> - <trans-unit id="286555642257111053" datatype="html"> - <source>Rows: %1</source> - <target>排:%1</target> - </trans-unit> - <trans-unit id="990695256953568910" datatype="html"> - <source>seats =</source> - <target>座ä½ï¼</target> - </trans-unit> - <trans-unit id="1327005465775917626" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.</source> - <target>一架飛機除了有兩個座ä½ä¾›æ£å‰¯æ©Ÿå¸«ï¼Œé‚„有一定é‡è¡Œæ•¸çš„é ç‰åŠç¶“濟乘客座ä½ã€‚é ç‰è‰™æ¯æŽ’都包å«å››å€‹å¸ä½ï¼Œç¶“æ¿Ÿè‰™æ¯æŽ’éƒ½åŒ…å«äº”個å¸ä½ã€‚。</target> - </trans-unit> - <trans-unit id="1649099567159388799" datatype="html"> - <source>?</source> - <target>?</target> - </trans-unit> - <trans-unit id="3872872459414039837" datatype="html"> - <source>Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).</source> - <target>於下方寫出一æ¢å…¬å¼ä»¥è¨ˆç®—飛機上的座ä½ç¸½æ•¸ã€‚</target> - </trans-unit> - <trans-unit id="4755413400587385256" datatype="html"> - <source>An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.</source> - <target>一架飛機除了有兩個座ä½ä¾›æ£å‰¯æ©Ÿå¸«ï¼Œé‚„有一定é‡è¡Œæ•¸çš„乘客座ä½ã€‚æ¯æŽ’éƒ½åŒ…å«å››å€‹å¸ä½ã€‚</target> - </trans-unit> - <trans-unit id="5622822520334788359" datatype="html"> - <source>1st class rows (%1)</source> - <target>é ç‰è‰™ï¼ˆ%1)</target> - </trans-unit> - <trans-unit id="6523489254328705062" datatype="html"> - <source>2nd class rows: %1</source> - <target>經濟艙:%1 排</target> - </trans-unit> - <trans-unit id="6636919311618748816" datatype="html"> - <source>Seats: %1</source> - <target>座ä½ï¼š%1</target> - </trans-unit> - <trans-unit id="6646116297668869388" datatype="html"> - <source>Plane Seat Calculator</source> - <target>飛機座ä½è¨ˆç®—器</target> - </trans-unit> - <trans-unit id="7030918043298347994" datatype="html"> - <source>rows (%1)</source> - <target>排(%1)</target> - </trans-unit> - <trans-unit id="7091637686507441682" datatype="html"> - <source>1st class rows: %1</source> - <target>é ç‰è‰™ï¼š%1 排</target> - </trans-unit> - <trans-unit id="7784699858027886282" datatype="html"> - <source>An airplane has a number of rows of passenger seats. Each row contains four seats.</source> - <target>一架飛機有一定é‡è¡Œæ•¸çš„乘客座ä½ï¼Œæ¯æŽ’都包å«å››å€‹å¸ä½ã€‚</target> - </trans-unit> - <trans-unit id="8347578891541780742" datatype="html"> - <source>2nd class rows (%1)</source> - <target>經濟艙(%1)</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/res/lib/blockly/demos/resizable/icon.png b/res/lib/blockly/demos/resizable/icon.png deleted file mode 100644 index c4eaf81aef9a4ba22cdc26ae1d605e294173e1e6..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/resizable/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/resizable/index.html b/res/lib/blockly/demos/resizable/index.html deleted file mode 100644 index e2ee1e06d76d3c3d0bf41a39094880c2e5755d3f..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/resizable/index.html +++ /dev/null @@ -1,52 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Resizable Blockly (Part 1)</title> - <style> - html, body { - height: 100%; - margin: 0; - } - body { - background-color: #fff; - font-family: sans-serif; - overflow: hidden; - } - h1 { - font-weight: normal; - font-size: 140%; - } - table { - height: 100%; - width: 100%; - } - #blocklyArea { - height: 99%; - background: #fc9; - text-align: center; - } - </style> -</head> -<body> - <table> - <tr> - <td> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Resizable Blockly (Part 1)</h1> - - <p>The first step in creating a resizable Blockly workspace is to use - CSS or tables to create an area for it. - Next, <a href="overlay.html">inject Blockly</a> over that area.</p> - - <p>→ More info on <a href="https://developers.google.com/blockly/guides/configure/web/resizable">injecting resizable Blockly</a>…</p> - </td> - </tr> - <tr> - <td id="blocklyArea"> - Blockly will be positioned here. - </td> - </tr> - </table> -</body> -</html> diff --git a/res/lib/blockly/demos/resizable/overlay.html b/res/lib/blockly/demos/resizable/overlay.html deleted file mode 100644 index 826a667bd4de02c98b1c1b4e7d12c8d360f76de8..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/resizable/overlay.html +++ /dev/null @@ -1,96 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Resizable Blockly (Part 2)</title> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <style> - html, body { - height: 100%; - margin: 0; - } - body { - background-color: #fff; - font-family: sans-serif; - overflow: hidden; - } - h1 { - font-weight: normal; - font-size: 140%; - } - table { - height: 100%; - width: 100%; - } - #blocklyArea { - height: 99%; - } - </style> -</head> -<body> - <table> - <tr> - <td> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Resizable Blockly (Part 2)</h1> - - <p> - Once an <a href="index.html">area is defined</a>, Blockly can be - injected and positioned over the area. - A resize handler keeps it in position as the page changes. - </p> - - <p>→ More info on <a href="https://developers.google.com/blockly/guides/configure/web/resizable">injecting resizable Blockly</a>…</p> - </td> - </tr> - <tr> - <td id="blocklyArea"> - </td> - </tr> - </table> - - <div id="blocklyDiv" style="position: absolute"></div> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <block type="controls_if"></block> - <block type="logic_compare"></block> - <block type="controls_repeat_ext"></block> - <block type="math_number"> - <field name="NUM">123</field> - </block> - <block type="math_arithmetic"></block> - <block type="text"></block> - <block type="text_print"></block> - </xml> - - <script> - var blocklyArea = document.getElementById('blocklyArea'); - var blocklyDiv = document.getElementById('blocklyDiv'); - var demoWorkspace = Blockly.inject(blocklyDiv, - {media: '../../media/', - toolbox: document.getElementById('toolbox')}); - var onresize = function(e) { - // Compute the absolute coordinates and dimensions of blocklyArea. - var element = blocklyArea; - var x = 0; - var y = 0; - do { - x += element.offsetLeft; - y += element.offsetTop; - element = element.offsetParent; - } while (element); - // Position blocklyDiv over blocklyArea. - blocklyDiv.style.left = x + 'px'; - blocklyDiv.style.top = y + 'px'; - blocklyDiv.style.width = blocklyArea.offsetWidth + 'px'; - blocklyDiv.style.height = blocklyArea.offsetHeight + 'px'; - Blockly.svgResize(demoWorkspace); - }; - window.addEventListener('resize', onresize, false); - onresize(); - Blockly.svgResize(demoWorkspace); - </script> -</body> -</html> diff --git a/res/lib/blockly/demos/rtl/icon.png b/res/lib/blockly/demos/rtl/icon.png deleted file mode 100644 index 284c1efa894b8725b2b2fda794d5a92b572ee532..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/rtl/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/rtl/index.html b/res/lib/blockly/demos/rtl/index.html deleted file mode 100644 index ff2b6306bedf3710f665bf12b8b8cc96927b890e..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/rtl/index.html +++ /dev/null @@ -1,210 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <meta name="google" value="notranslate"> - <title>Blockly Demo: RTL</title> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../msg/js/ar.js"></script> - <style> - body { - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - #blocklyDiv { - height: 600px; - width: 800px; - } - </style> - <script> - function init() { - var demoWorkspace = Blockly.inject('blocklyDiv', - {media: '../../media/', - rtl: true, - toolbox: document.getElementById('toolbox')}); - Blockly.Xml.domToWorkspace(document.getElementById('startBlocks'), - demoWorkspace); - //window.onbeforeunload = function() { - // return 'Leaving this page will result in the loss of your work.'; - //}; - } - </script> -</head> -<body onload="init()"> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Right-to-Left</h1> - - <div id="blocklyDiv"></div> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <category name="منطق" colour="%{BKY_LOGIC_HUE}"> - <block type="controls_if"></block> - <block type="logic_compare"></block> - <block type="logic_operation"></block> - <block type="logic_negate"></block> - <block type="logic_boolean"></block> - <block type="logic_null"></block> - <block type="logic_ternary"></block> - </category> - <category name="الØÙ„قات" colour="%{BKY_LOOPS_HUE}"> - <block type="controls_repeat_ext"> - <value name="TIMES"> - <block type="math_number"> - <field name="NUM">10</field> - </block> - </value> - </block> - <block type="controls_whileUntil"></block> - <block type="controls_for"> - <value name="FROM"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - <value name="TO"> - <block type="math_number"> - <field name="NUM">10</field> - </block> - </value> - <value name="BY"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - </block> - <block type="controls_forEach"></block> - <block type="controls_flow_statements"></block> - </category> - <category name="رياضيات" colour="%{BKY_MATH_HUE}"> - <block type="math_number"> - <field name="NUM">123</field> - </block> - <block type="math_arithmetic"></block> - <block type="math_single"></block> - <block type="math_trig"></block> - <block type="math_constant"></block> - <block type="math_number_property"></block> - <block type="math_round"></block> - <block type="math_on_list"></block> - <block type="math_modulo"></block> - <block type="math_constrain"> - <value name="LOW"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - <value name="HIGH"> - <block type="math_number"> - <field name="NUM">100</field> - </block> - </value> - </block> - <block type="math_random_int"> - <value name="FROM"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - <value name="TO"> - <block type="math_number"> - <field name="NUM">100</field> - </block> - </value> - </block> - <block type="math_random_float"></block> - <block type="math_atan2"></block> - </category> - <category name="نص" colour="%{BKY_TEXTS_HUE}"> - <block type="text"></block> - <block type="text_join"></block> - <block type="text_append"> - <value name="TEXT"> - <block type="text"></block> - </value> - </block> - <block type="text_length"></block> - <block type="text_isEmpty"></block> - <block type="text_indexOf"></block> - <block type="text_charAt"></block> - <block type="text_changeCase"></block> - <block type="text_trim"></block> - <block type="text_print"></block> - <block type="text_prompt_ext"> - <value name="TEXT"> - <block type="text"></block> - </value> - </block> - </category> - <category name="قوائم" colour="%{BKY_LISTS_HUE}"> - <block type="lists_create_empty"></block> - <block type="lists_create_with"></block> - <block type="lists_repeat"> - <value name="NUM"> - <block type="math_number"> - <field name="NUM">5</field> - </block> - </value> - </block> - <block type="lists_length"></block> - <block type="lists_isEmpty"></block> - <block type="lists_indexOf"></block> - <block type="lists_getIndex"></block> - <block type="lists_setIndex"></block> - </category> - <category name="لون" colour="%{BKY_COLOUR_HUE}"> - <block type="colour_picker"></block> - <block type="colour_rgb"></block> - <block type="colour_blend"></block> - </category> - <sep></sep> - <category name="متغيرات" custom="VARIABLE" colour="%{BKY_VARIABLES_HUE}"> - </category> - <category name="إجراءات" custom="PROCEDURE" colour="%{BKY_PROCEDURES_HUE}"> - </category> - </xml> - - <xml xmlns="https://developers.google.com/blockly/xml" id="startBlocks" style="display: none"> - <block type="controls_if" inline="false" x="50" y="50"> - <value name="IF0"> - <block type="logic_compare" inline="true"> - <field name="OP">LT</field> - <value name="A"> - <block type="variables_get"> - <field name="VAR">x</field> - </block> - </value> - <value name="B"> - <block type="math_number"> - <field name="NUM">256</field> - </block> - </value> - </block> - </value> - <statement name="DO0"> - <block type="variables_set" inline="false"> - <field name="VAR">x</field> - <value name="VALUE"> - <block type="math_number"> - <field name="NUM">0</field> - </block> - </value> - <next> - <block type="text_print" inline="false"> - <value name="TEXT"> - <block type="text"> - <field name="TEXT">أكثر من لعبة</field> - </block> - </value> - </block> - </next> - </block> - </statement> - </block> - </xml> -</body> -</html> diff --git a/res/lib/blockly/demos/storage/icon.png b/res/lib/blockly/demos/storage/icon.png deleted file mode 100644 index a766b5d2b8224920919d608c27573bb9a9101967..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/storage/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/storage/index.html b/res/lib/blockly/demos/storage/index.html deleted file mode 100644 index 759dc2b8345c2f00cf2a79a49bf5647f96f4e1fa..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/storage/index.html +++ /dev/null @@ -1,96 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Cloud Storage</title> - <script src="/storage.js"></script> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <style> - body { - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - #sorry { - padding: 1ex; - background-color: #f9edbe; - border: solid 1px #f0c36d; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Cloud Storage</h1> - - <p>This is a simple demo of cloud storage using App Engine.</p> - - <script> - if ('BlocklyStorage' in window) { - BlocklyStorage.HTTPREQUEST_ERROR = 'There was a problem with the request.\n'; - BlocklyStorage.LINK_ALERT = 'Share your blocks with this link:\n\n%1'; - BlocklyStorage.HASH_ERROR = 'Sorry, "%1" doesn\'t correspond with any saved Blockly file.'; - BlocklyStorage.XML_ERROR = 'Could not load your saved file.\n'+ - 'Perhaps it was created with a different version of Blockly?'; - } else { - document.write('<p id="sorry">Sorry, cloud storage is not available. This demo must be hosted on App Engine.</p>'); - } - </script> - - <p>→ More info on <a href="https://developers.google.com/blockly/guides/configure-blockly/web/cloud-storage">Cloud Storage</a>…</p> - - <p> - <button onclick="BlocklyStorage.link()">Save Blocks</button> - </p> - - <div id="blocklyDiv" style="height: 480px; width: 600px;"></div> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <category name="Logic" colour="%{BKY_LOGIC_HUE}"> - <block type="controls_if"></block> - <block type="logic_compare"></block> - <block type="logic_operation"></block> - <block type="logic_negate"></block> - <block type="logic_boolean"></block> - </category> - <category name="Loops" colour="%{BKY_LOOPS_HUE}"> - <block type="controls_repeat_ext"> - <value name="TIMES"> - <block type="math_number"> - <field name="NUM">10</field> - </block> - </value> - </block> - <block type="controls_whileUntil"></block> - </category> - <category name="Math" colour="%{BKY_MATH_HUE}"> - <block type="math_number"> - <field name="NUM">123</field> - </block> - <block type="math_arithmetic"></block> - <block type="math_single"></block> - </category> - <category name="Text" colour="%{BKY_TEXTS_HUE}"> - <block type="text"></block> - <block type="text_length"></block> - <block type="text_print"></block> - </category> - </xml> - - <script> - var demoWorkspace = Blockly.inject('blocklyDiv', - {media: '../../media/', - toolbox: document.getElementById('toolbox')}); - - // An href with #key trigers an AJAX call to retrieve saved blocks. - if ('BlocklyStorage' in window && window.location.hash.length > 1) { - BlocklyStorage.retrieveXml(window.location.hash.substring(1)); - } - </script> - -</body> -</html> diff --git a/res/lib/blockly/demos/toolbox/icon.png b/res/lib/blockly/demos/toolbox/icon.png deleted file mode 100644 index fe54fe492199dd168395c61f0d0fe5708d7beda0..0000000000000000000000000000000000000000 Binary files a/res/lib/blockly/demos/toolbox/icon.png and /dev/null differ diff --git a/res/lib/blockly/demos/toolbox/index.html b/res/lib/blockly/demos/toolbox/index.html deleted file mode 100644 index 007b8eeb59f85be63fbd7096f01f10378236746d..0000000000000000000000000000000000000000 --- a/res/lib/blockly/demos/toolbox/index.html +++ /dev/null @@ -1,349 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Blockly Demo: Toolbox</title> - <script src="../../blockly_compressed.js"></script> - <script src="../../blocks_compressed.js"></script> - <script src="../../msg/js/en.js"></script> - <style> - body { - background-color: #fff; - font-family: sans-serif; - } - h1 { - font-weight: normal; - font-size: 140%; - } - </style> -</head> -<body> - <h1><a href="https://developers.google.com/blockly/">Blockly</a> > - <a href="../index.html">Demos</a> > Toolbox</h1> - - <p>This is a demo of a complex category structure for the toolbox.</p> - - <p>→ More info on the <a href="https://developers.google.com/blockly/guides/configure/web/toolbox">Toolbox</a>…</p> - - <div id="blocklyDiv" style="height: 600px; width: 800px;"></div> - - <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none"> - <category name="Logic" colour="%{BKY_LOGIC_HUE}"> - <category name="If"> - <block type="controls_if"></block> - <block type="controls_if"> - <mutation else="1"></mutation> - </block> - <block type="controls_if"> - <mutation elseif="1" else="1"></mutation> - </block> - </category> - <category name="Boolean" colour="%{BKY_LOGIC_HUE}"> - <block type="logic_compare"></block> - <block type="logic_operation"></block> - <block type="logic_negate"></block> - <block type="logic_boolean"></block> - <block type="logic_null"></block> - <block type="logic_ternary"></block> - </category> - </category> - <category name="Loops" colour="%{BKY_LOOPS_HUE}"> - <block type="controls_repeat_ext"> - <value name="TIMES"> - <block type="math_number"> - <field name="NUM">10</field> - </block> - </value> - </block> - <block type="controls_whileUntil"></block> - <block type="controls_for"> - <field name="VAR">i</field> - <value name="FROM"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - <value name="TO"> - <block type="math_number"> - <field name="NUM">10</field> - </block> - </value> - <value name="BY"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - </block> - <block type="controls_forEach"></block> - <block type="controls_flow_statements"></block> - </category> - <category name="Math" colour="%{BKY_MATH_HUE}"> - <block type="math_number"> - <field name="NUM">123</field> - </block> - <block type="math_arithmetic"></block> - <block type="math_single"></block> - <block type="math_trig"></block> - <block type="math_constant"></block> - <block type="math_number_property"></block> - <block type="math_round"></block> - <block type="math_on_list"></block> - <block type="math_modulo"></block> - <block type="math_constrain"> - <value name="LOW"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - <value name="HIGH"> - <block type="math_number"> - <field name="NUM">100</field> - </block> - </value> - </block> - <block type="math_random_int"> - <value name="FROM"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - <value name="TO"> - <block type="math_number"> - <field name="NUM">100</field> - </block> - </value> - </block> - <block type="math_random_float"></block> - <block type="math_atan2"></block> - </category> - <category name="Lists" colour="%{BKY_LISTS_HUE}"> - <block type="lists_create_empty"></block> - <block type="lists_create_with"></block> - <block type="lists_repeat"> - <value name="NUM"> - <block type="math_number"> - <field name="NUM">5</field> - </block> - </value> - </block> - <block type="lists_length"></block> - <block type="lists_isEmpty"></block> - <block type="lists_indexOf"></block> - <block type="lists_getIndex"></block> - <block type="lists_setIndex"></block> - </category> - <sep></sep> - <category name="Variables" custom="VARIABLE" colour="%{BKY_VARIABLES_HUE}"> - </category> - <category name="Functions" custom="PROCEDURE" colour="%{BKY_PROCEDURES_HUE}"> - </category> - <sep></sep> - <category name="Library" expanded="true"> - <category name="Randomize"> - <block type="procedures_defnoreturn"> - <mutation> - <arg name="list"></arg> - </mutation> - <field name="NAME">randomize</field> - <statement name="STACK"> - <block type="controls_for" inline="true"> - <field name="VAR">x</field> - <value name="FROM"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - <value name="TO"> - <block type="lists_length" inline="false"> - <value name="VALUE"> - <block type="variables_get"> - <field name="VAR">list</field> - </block> - </value> - </block> - </value> - <value name="BY"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - <statement name="DO"> - <block type="variables_set" inline="false"> - <field name="VAR">y</field> - <value name="VALUE"> - <block type="math_random_int" inline="true"> - <value name="FROM"> - <block type="math_number"> - <field name="NUM">1</field> - </block> - </value> - <value name="TO"> - <block type="lists_length" inline="false"> - <value name="VALUE"> - <block type="variables_get"> - <field name="VAR">list</field> - </block> - </value> - </block> - </value> - </block> - </value> - <next> - <block type="variables_set" inline="false"> - <field name="VAR">temp</field> - <value name="VALUE"> - <block type="lists_getIndex" inline="true"> - <mutation statement="false" at="true"></mutation> - <field name="MODE">GET</field> - <field name="WHERE">FROM_START</field> - <value name="AT"> - <block type="variables_get"> - <field name="VAR">y</field> - </block> - </value> - <value name="VALUE"> - <block type="variables_get"> - <field name="VAR">list</field> - </block> - </value> - </block> - </value> - <next> - <block type="lists_setIndex" inline="false"> - <value name="AT"> - <block type="variables_get"> - <field name="VAR">y</field> - </block> - </value> - <value name="LIST"> - <block type="variables_get"> - <field name="VAR">list</field> - </block> - </value> - <value name="TO"> - <block type="lists_getIndex" inline="true"> - <mutation statement="false" at="true"></mutation> - <field name="MODE">GET</field> - <field name="WHERE">FROM_START</field> - <value name="AT"> - <block type="variables_get"> - <field name="VAR">x</field> - </block> - </value> - <value name="VALUE"> - <block type="variables_get"> - <field name="VAR">list</field> - </block> - </value> - </block> - </value> - <next> - <block type="lists_setIndex" inline="false"> - <value name="AT"> - <block type="variables_get"> - <field name="VAR">x</field> - </block> - </value> - <value name="LIST"> - <block type="variables_get"> - <field name="VAR">list</field> - </block> - </value> - <value name="TO"> - <block type="variables_get"> - <field name="VAR">temp</field> - </block> - </value> - </block> - </next> - </block> - </next> - </block> - </next> - </block> - </statement> - </block> - </statement> - </block> - </category> - <category name="Jabberwocky"> - <block type="text_print"> - <value name="TEXT"> - <block type="text"> - <field name="TEXT">'Twas brillig, and the slithy toves</field> - </block> - </value> - <next> - <block type="text_print"> - <value name="TEXT"> - <block type="text"> - <field name="TEXT"> Did gyre and gimble in the wabe:</field> - </block> - </value> - <next> - <block type="text_print"> - <value name="TEXT"> - <block type="text"> - <field name="TEXT">All mimsy were the borogroves,</field> - </block> - </value> - <next> - <block type="text_print"> - <value name="TEXT"> - <block type="text"> - <field name="TEXT"> And the mome raths outgrabe.</field> - </block> - </value> - </block> - </next> - </block> - </next> - </block> - </next> - </block> - <block type="text_print"> - <value name="TEXT"> - <block type="text"> - <field name="TEXT">"Beware the Jabberwock, my son!</field> - </block> - </value> - <next> - <block type="text_print"> - <value name="TEXT"> - <block type="text"> - <field name="TEXT"> The jaws that bite, the claws that catch!</field> - </block> - </value> - <next> - <block type="text_print"> - <value name="TEXT"> - <block type="text"> - <field name="TEXT">Beware the Jubjub bird, and shun</field> - </block> - </value> - <next> - <block type="text_print"> - <value name="TEXT"> - <block type="text"> - <field name="TEXT"> The frumious Bandersnatch!"</field> - </block> - </value> - </block> - </next> - </block> - </next> - </block> - </next> - </block> - </category> - </category> - </xml> - - <script> - var demoWorkspace = Blockly.inject('blocklyDiv', - {media: '../../media/', - toolbox: document.getElementById('toolbox')}); - </script> - -</body> -</html> diff --git a/res/lib/micromodal.js b/res/lib/micromodal.js new file mode 100644 index 0000000000000000000000000000000000000000..df3c56d8be6754e0bcc94ac73c03d6bdbf632396 --- /dev/null +++ b/res/lib/micromodal.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).MicroModal=t()}(this,function(){"use strict";return(()=>{const e=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'];class t{constructor({targetModal:e,triggers:t=[],onShow:o=(()=>{}),onClose:i=(()=>{}),openTrigger:n="data-micromodal-trigger",closeTrigger:s="data-micromodal-close",disableScroll:a=!1,disableFocus:l=!1,awaitCloseAnimation:d=!1,awaitOpenAnimation:r=!1,debugMode:c=!1}){this.modal=document.getElementById(e),this.config={debugMode:c,disableScroll:a,openTrigger:n,closeTrigger:s,onShow:o,onClose:i,awaitCloseAnimation:d,awaitOpenAnimation:r,disableFocus:l},t.length>0&&this.registerTriggers(...t),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}registerTriggers(...e){e.filter(Boolean).forEach(e=>{e.addEventListener("click",e=>this.showModal(e))})}showModal(){if(this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add("is-open"),this.scrollBehaviour("disable"),this.addEventListeners(),this.config.awaitOpenAnimation){const e=()=>{this.modal.removeEventListener("animationend",e,!1),this.setFocusToFirstNode()};this.modal.addEventListener("animationend",e,!1)}else this.setFocusToFirstNode();this.config.onShow(this.modal,this.activeElement)}closeModal(){const e=this.modal;this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.scrollBehaviour("enable"),this.activeElement&&this.activeElement.focus(),this.config.onClose(this.modal),this.config.awaitCloseAnimation?this.modal.addEventListener("animationend",function t(){e.classList.remove("is-open"),e.removeEventListener("animationend",t,!1)},!1):e.classList.remove("is-open")}closeModalById(e){this.modal=document.getElementById(e),this.modal&&this.closeModal()}scrollBehaviour(e){if(!this.config.disableScroll)return;const t=document.querySelector("body");switch(e){case"enable":Object.assign(t.style,{overflow:"",height:""});break;case"disable":Object.assign(t.style,{overflow:"hidden",height:"100vh"})}}addEventListeners(){this.modal.addEventListener("touchstart",this.onClick),this.modal.addEventListener("click",this.onClick),document.addEventListener("keydown",this.onKeydown)}removeEventListeners(){this.modal.removeEventListener("touchstart",this.onClick),this.modal.removeEventListener("click",this.onClick),document.removeEventListener("keydown",this.onKeydown)}onClick(e){e.target.hasAttribute(this.config.closeTrigger)&&(this.closeModal(),e.preventDefault())}onKeydown(e){27===e.keyCode&&this.closeModal(e),9===e.keyCode&&this.maintainFocus(e)}getFocusableNodes(){const t=this.modal.querySelectorAll(e);return Array(...t)}setFocusToFirstNode(){if(this.config.disableFocus)return;const e=this.getFocusableNodes();e.length&&e[0].focus()}maintainFocus(e){const t=this.getFocusableNodes();if(this.modal.contains(document.activeElement)){const o=t.indexOf(document.activeElement);e.shiftKey&&0===o&&(t[t.length-1].focus(),e.preventDefault()),e.shiftKey||o!==t.length-1||(t[0].focus(),e.preventDefault())}else t[0].focus()}}let o=null;const i=e=>{if(!document.getElementById(e))return console.warn(`MicroModal: â—Seems like you have missed %c'${e}'`,"background-color: #f8f9fa;color: #50596c;font-weight: bold;","ID somewhere in your code. Refer example below to resolve it."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",`<div class="modal" id="${e}"></div>`),!1},n=(e,t)=>{if((e=>{if(e.length<=0)console.warn("MicroModal: â—Please specify at least one %c'micromodal-trigger'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","data attribute."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'<a href="#" data-micromodal-trigger="my-modal"></a>')})(e),!t)return!0;for(var o in t)i(o);return!0};return{init:e=>{const i=Object.assign({},{openTrigger:"data-micromodal-trigger"},e),s=[...document.querySelectorAll(`[${i.openTrigger}]`)],a=((e,t)=>{const o=[];return e.forEach(e=>{const i=e.attributes[t].value;void 0===o[i]&&(o[i]=[]),o[i].push(e)}),o})(s,i.openTrigger);if(!0!==i.debugMode||!1!==n(s,a))for(var l in a){let e=a[l];i.targetModal=l,i.triggers=[...e],o=new t(i)}},show:(e,n)=>{const s=n||{};s.targetModal=e,!0===s.debugMode&&!1===i(e)||(o=new t(s)).showModal()},close:e=>{e?o.closeModalById(e):o.closeModal()}}})()}); diff --git a/res/lib/svg.min.js b/res/lib/svg.min.js new file mode 100644 index 0000000000000000000000000000000000000000..9b9d4c28d40cf98719a1a4af77a14fb82a494560 --- /dev/null +++ b/res/lib/svg.min.js @@ -0,0 +1,3 @@ +/*! @svgdotjs/svg.js v3.0.16 MIT*/; +var SVG=function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t,e){return t(e={exports:{}},e.exports),e.exports}var n,r,i,o=function(t){return t&&t.Math==Math&&t},y=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof t&&t)||Function("return this")(),m=function(t){try{return!!t()}catch(t){return!0}},f=!m(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),s={}.propertyIsEnumerable,u=Object.getOwnPropertyDescriptor,v={f:u&&!s.call({1:2},1)?function(t){var e=u(this,t);return!!e&&e.enumerable}:s},b=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},a={}.toString,h=function(t){return a.call(t).slice(8,-1)},l="".split,_=m(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==h(t)?l.call(t,""):Object(t)}:Object,c=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},d=function(t){return _(c(t))},g=function(t){return"object"==typeof t?null!==t:"function"==typeof t},p=function(t,e){if(!g(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!g(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!g(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!g(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},w={}.hasOwnProperty,x=function(t,e){return w.call(t,e)},k=y.document,O=g(k)&&g(k.createElement),S=function(t){return O?k.createElement(t):{}},j=!f&&!m(function(){return 7!=Object.defineProperty(S("div"),"a",{get:function(){return 7}}).a}),M=Object.getOwnPropertyDescriptor,E={f:f?M:function(t,e){if(t=d(t),e=p(e,!0),j)try{return M(t,e)}catch(t){}if(x(t,e))return b(!v.f.call(t,e),t[e])}},T=function(t){if(!g(t))throw TypeError(String(t)+" is not an object");return t},C=Object.defineProperty,P={f:f?C:function(t,e,n){if(T(t),e=p(e,!0),T(n),j)try{return C(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},I=f?function(t,e,n){return P.f(t,e,b(1,n))}:function(t,e,n){return t[e]=n,t},N=function(e,n){try{I(y,e,n)}catch(t){y[e]=n}return n},D="__core-js_shared__",R=y[D]||N(D,{}),L=e(function(t){(t.exports=function(t,e){return R[t]||(R[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.3.6",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),F=L("native-function-to-string",Function.toString),z=y.WeakMap,q="function"==typeof z&&/native code/.test(F.call(z)),Y=0,X=Math.random(),V=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++Y+X).toString(36)},H=L("keys"),B=function(t){return H[t]||(H[t]=V(t))},U={},$=y.WeakMap;if(q){var Q=new $,W=Q.get,J=Q.has,Z=Q.set;n=function(t,e){return Z.call(Q,t,e),e},r=function(t){return W.call(Q,t)||{}},i=function(t){return J.call(Q,t)}}else{var K=B("state");U[K]=!0,n=function(t,e){return I(t,K,e),e},r=function(t){return x(t,K)?t[K]:{}},i=function(t){return x(t,K)}}var tt={set:n,get:r,has:i,enforce:function(t){return i(t)?r(t):n(t,{})},getterFor:function(n){return function(t){var e;if(!g(t)||(e=r(t)).type!==n)throw TypeError("Incompatible receiver, "+n+" required");return e}}},et=e(function(t){var e=tt.get,u=tt.enforce,a=String(F).split("toString");L("inspectSource",function(t){return F.call(t)}),(t.exports=function(t,e,n,r){var i=!!r&&!!r.unsafe,o=!!r&&!!r.enumerable,s=!!r&&!!r.noTargetGet;"function"==typeof n&&("string"!=typeof e||x(n,"name")||I(n,"name",e),u(n).source=a.join("string"==typeof e?e:"")),t!==y?(i?!s&&t[e]&&(o=!0):delete t[e],o?t[e]=n:I(t,e,n)):o?t[e]=n:N(e,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&e(this).source||F.call(this)})}),nt=y,rt=function(t){return"function"==typeof t?t:void 0},it=function(t,e){return arguments.length<2?rt(nt[t])||rt(y[t]):nt[t]&&nt[t][e]||y[t]&&y[t][e]},ot=Math.ceil,st=Math.floor,ut=function(t){return isNaN(t=+t)?0:(0<t?st:ot)(t)},at=Math.min,ht=function(t){return 0<t?at(ut(t),9007199254740991):0},lt=Math.max,ct=Math.min,ft=function(t,e){var n=ut(t);return n<0?lt(n+e,0):ct(n,e)},vt=function(u){return function(t,e,n){var r,i=d(t),o=ht(i.length),s=ft(n,o);if(u&&e!=e){for(;s<o;)if((r=i[s++])!=r)return!0}else for(;s<o;s++)if((u||s in i)&&i[s]===e)return u||s||0;return!u&&-1}},dt={includes:vt(!0),indexOf:vt(!1)},pt=dt.indexOf,yt=function(t,e){var n,r=d(t),i=0,o=[];for(n in r)!x(U,n)&&x(r,n)&&o.push(n);for(;e.length>i;)x(r,n=e[i++])&&(~pt(o,n)||o.push(n));return o},mt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],gt=mt.concat("length","prototype"),wt={f:Object.getOwnPropertyNames||function(t){return yt(t,gt)}},bt={f:Object.getOwnPropertySymbols},_t=it("Reflect","ownKeys")||function(t){var e=wt.f(T(t)),n=bt.f;return n?e.concat(n(t)):e},xt=function(t,e){for(var n=_t(e),r=P.f,i=E.f,o=0;o<n.length;o++){var s=n[o];x(t,s)||r(t,s,i(e,s))}},kt=/#|\.prototype\./,Ot=function(t,e){var n=At[St(t)];return n==Mt||n!=jt&&("function"==typeof e?m(e):!!e)},St=Ot.normalize=function(t){return String(t).replace(kt,".").toLowerCase()},At=Ot.data={},jt=Ot.NATIVE="N",Mt=Ot.POLYFILL="P",Et=Ot,Tt=E.f,Ct=function(t,e){var n,r,i,o,s,u=t.target,a=t.global,h=t.stat;if(n=a?y:h?y[u]||N(u,{}):(y[u]||{}).prototype)for(r in e){if(o=e[r],i=t.noTargetGet?(s=Tt(n,r))&&s.value:n[r],!Et(a?r:u+(h?".":"#")+r,t.forced)&&void 0!==i){if(typeof o==typeof i)continue;xt(o,i)}(t.sham||i&&i.sham)&&I(o,"sham",!0),et(n,r,o,t)}},Pt=Object.keys||function(t){return yt(t,mt)},It=function(t){return Object(c(t))},Nt=Object.assign,Dt=!Nt||m(function(){var A={},e={},t=Symbol(),n="abcdefghijklmnopqrst";return A[t]=7,n.split("").forEach(function(t){e[t]=t}),7!=Nt({},A)[t]||Pt(Nt({},e)).join("")!=n})?function(t,e){for(var n=It(t),r=arguments.length,i=1,o=bt.f,s=v.f;i<r;)for(var u,a=_(arguments[i++]),h=o?Pt(a).concat(o(a)):Pt(a),l=h.length,c=0;c<l;)u=h[c++],f&&!s.call(a,u)||(n[u]=a[u]);return n}:Nt;Ct({target:"Object",stat:!0,forced:Object.assign!==Dt},{assign:Dt});var Rt,Lt,Ft=Array.isArray||function(t){return"Array"==h(t)},zt=function(t,e,n){var r=p(e);r in t?P.f(t,r,b(0,n)):t[r]=n},qt=!!Object.getOwnPropertySymbols&&!m(function(){return!String(Symbol())}),Yt=y.Symbol,Xt=L("wks"),Gt=function(t){return Xt[t]||(Xt[t]=qt&&Yt[t]||(qt?Yt:V)("Symbol."+t))},Vt=it("navigator","userAgent")||"",Ht=y.process,Bt=Ht&&Ht.versions,Ut=Bt&&Bt.v8;Ut?Lt=(Rt=Ut.split("."))[0]+Rt[1]:Vt&&(!(Rt=Vt.match(/Edge\/(\d+)/))||74<=Rt[1])&&(Rt=Vt.match(/Chrome\/(\d+)/))&&(Lt=Rt[1]);var $t=Lt&&+Lt,Qt=Gt("species"),Wt=function(e){return 51<=$t||!m(function(){var t=[];return(t.constructor={})[Qt]=function(){return{foo:1}},1!==t[e](Boolean).foo})},Jt=Gt("species"),Zt=[].slice,Kt=Math.max;Ct({target:"Array",proto:!0,forced:!Wt("slice")},{slice:function(t,e){var n,r,i,o=d(this),s=ht(o.length),u=ft(t,s),a=ft(void 0===e?s:e,s);if(Ft(o)&&("function"!=typeof(n=o.constructor)||n!==Array&&!Ft(n.prototype)?g(n)&&null===(n=n[Jt])&&(n=void 0):n=void 0,n===Array||void 0===n))return Zt.call(o,u,a);for(r=new(void 0===n?Array:n)(Kt(a-u,0)),i=0;u<a;u++,i++)u in o&&zt(r,i,o[u]);return r.length=i,r}});var te=P.f,ee=Function.prototype,ne=ee.toString,re=/^\s*function ([^ (]*)/;!f||"name"in ee||te(ee,"name",{configurable:!0,get:function(){try{return ne.call(this).match(re)[1]}catch(t){return""}}});var ie=wt.f,oe={}.toString,se="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],ue={f:function(t){return se&&"[object Window]"==oe.call(t)?function(t){try{return ie(t)}catch(t){return se.slice()}}(t):ie(d(t))}},ae=ue.f,he=m(function(){return!Object.getOwnPropertyNames(1)});function le(t){return(le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ce(t){return(ce="function"==typeof Symbol&&"symbol"===le(Symbol.iterator)?function(t){return le(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":le(t)})(t)}Ct({target:"Object",stat:!0,forced:he},{getOwnPropertyNames:ae});var fe=f?Object.defineProperties:function(t,e){T(t);for(var n,r=Pt(e),i=r.length,o=0;o<i;)P.f(t,n=r[o++],e[n]);return t},ve=it("document","documentElement"),de=B("IE_PROTO"),pe="prototype",ye=function(){},me=function(){var t,e=S("iframe"),n=mt.length,r="script";for(e.style.display="none",ve.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write("<script>document.F=Object</"+r+">"),t.close(),me=t.F;n--;)delete me[pe][mt[n]];return me()},ge=Object.create||function(t,e){var n;return null!==t?(ye[pe]=T(t),n=new ye,ye[pe]=null,n[de]=t):n=me(),void 0===e?n:fe(n,e)};U[de]=!0;var we={f:Gt},be=P.f,_e=function(t){var Symbol=nt.Symbol||(nt.Symbol={});x(Symbol,t)||be(Symbol,t,{value:we.f(t)})},xe=P.f,ke=Gt("toStringTag"),Oe=function(t,e,n){t&&!x(t=n?t:t.prototype,ke)&&xe(t,ke,{configurable:!0,value:e})},Se=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t},Ae=function(r,i,t){if(Se(r),void 0===i)return r;switch(t){case 0:return function(){return r.call(i)};case 1:return function(t){return r.call(i,t)};case 2:return function(t,e){return r.call(i,t,e)};case 3:return function(t,e,n){return r.call(i,t,e,n)}}return function(){return r.apply(i,arguments)}},je=Gt("species"),Me=function(t,e){var n;return Ft(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!Ft(n.prototype)?g(n)&&null===(n=n[je])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)},Ee=[].push,Te=function(v){var d=1==v,p=2==v,y=3==v,m=4==v,g=6==v,w=5==v||g;return function(t,e,n,r){for(var i,o,s=It(t),u=_(s),a=Ae(e,n,3),h=ht(u.length),l=0,c=r||Me,f=d?c(t,h):p?c(t,0):void 0;l<h;l++)if((w||l in u)&&(o=a(i=u[l],l,s),v))if(d)f[l]=o;else if(o)switch(v){case 3:return!0;case 5:return i;case 6:return l;case 2:Ee.call(f,i)}else if(m)return!1;return g?-1:y||m?m:f}},Ce={forEach:Te(0),map:Te(1),filter:Te(2),some:Te(3),every:Te(4),find:Te(5),findIndex:Te(6)},Pe=Ce.forEach,Ie=B("hidden"),Ne="Symbol",De="prototype",Re=Gt("toPrimitive"),Le=tt.set,Fe=tt.getterFor(Ne),ze=Object[De],qe=y.Symbol,Ye=y.JSON,Xe=Ye&&Ye.stringify,Ge=E.f,Ve=P.f,He=ue.f,Be=v.f,Ue=L("symbols"),$e=L("op-symbols"),Qe=L("string-to-symbol-registry"),We=L("symbol-to-string-registry"),Je=L("wks"),Ze=y.QObject,Ke=!Ze||!Ze[De]||!Ze[De].findChild,tn=f&&m(function(){return 7!=ge(Ve({},"a",{get:function(){return Ve(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=Ge(ze,e);r&&delete ze[e],Ve(t,e,n),r&&t!==ze&&Ve(ze,e,r)}:Ve,en=function(t,e){var n=Ue[t]=ge(qe[De]);return Le(n,{type:Ne,tag:t,description:e}),f||(n.description=e),n},nn=qt&&"symbol"==typeof qe.iterator?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof qe},rn=function(t,e,n){t===ze&&rn($e,e,n),T(t);var r=p(e,!0);return T(n),x(Ue,r)?(n.enumerable?(x(t,Ie)&&t[Ie][r]&&(t[Ie][r]=!1),n=ge(n,{enumerable:b(0,!1)})):(x(t,Ie)||Ve(t,Ie,b(1,{})),t[Ie][r]=!0),tn(t,r,n)):Ve(t,r,n)},on=function(e,t){T(e);var n=d(t),r=Pt(n).concat(hn(n));return Pe(r,function(t){f&&!sn.call(n,t)||rn(e,t,n[t])}),e},sn=function(t){var e=p(t,!0),n=Be.call(this,e);return!(this===ze&&x(Ue,e)&&!x($e,e))&&(!(n||!x(this,e)||!x(Ue,e)||x(this,Ie)&&this[Ie][e])||n)},un=function(t,e){var n=d(t),r=p(e,!0);if(n!==ze||!x(Ue,r)||x($e,r)){var i=Ge(n,r);return!i||!x(Ue,r)||x(n,Ie)&&n[Ie][r]||(i.enumerable=!0),i}},an=function(t){var e=He(d(t)),n=[];return Pe(e,function(t){x(Ue,t)||x(U,t)||n.push(t)}),n},hn=function(t){var e=t===ze,n=He(e?$e:d(t)),r=[];return Pe(n,function(t){!x(Ue,t)||e&&!x(ze,t)||r.push(Ue[t])}),r};qt||(et((qe=function(){if(this instanceof qe)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,e=V(t),n=function(t){this===ze&&n.call($e,t),x(this,Ie)&&x(this[Ie],e)&&(this[Ie][e]=!1),tn(this,e,b(1,t))};return f&&Ke&&tn(ze,e,{configurable:!0,set:n}),en(e,t)})[De],"toString",function(){return Fe(this).tag}),v.f=sn,P.f=rn,E.f=un,wt.f=ue.f=an,bt.f=hn,f&&(Ve(qe[De],"description",{configurable:!0,get:function(){return Fe(this).description}}),et(ze,"propertyIsEnumerable",sn,{unsafe:!0})),we.f=function(t){return en(Gt(t),t)}),Ct({global:!0,wrap:!0,forced:!qt,sham:!qt},{Symbol:qe}),Pe(Pt(Je),function(t){_e(t)}),Ct({target:Ne,stat:!0,forced:!qt},{for:function(t){var e=String(t);if(x(Qe,e))return Qe[e];var n=qe(e);return Qe[e]=n,We[n]=e,n},keyFor:function(t){if(!nn(t))throw TypeError(t+" is not a symbol");if(x(We,t))return We[t]},useSetter:function(){Ke=!0},useSimple:function(){Ke=!1}}),Ct({target:"Object",stat:!0,forced:!qt,sham:!f},{create:function(t,e){return void 0===e?ge(t):on(ge(t),e)},defineProperty:rn,defineProperties:on,getOwnPropertyDescriptor:un}),Ct({target:"Object",stat:!0,forced:!qt},{getOwnPropertyNames:an,getOwnPropertySymbols:hn}),Ct({target:"Object",stat:!0,forced:m(function(){bt.f(1)})},{getOwnPropertySymbols:function(t){return bt.f(It(t))}}),Ye&&Ct({target:"JSON",stat:!0,forced:!qt||m(function(){var t=qe();return"[null]"!=Xe([t])||"{}"!=Xe({a:t})||"{}"!=Xe(Object(t))})},{stringify:function(t){for(var e,n,r=[t],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=e=r[1],(g(e)||void 0!==t)&&!nn(t))return Ft(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!nn(e))return e}),r[1]=e,Xe.apply(Ye,r)}}),qe[De][Re]||I(qe[De],Re,qe[De].valueOf),Oe(qe,Ne),U[Ie]=!0;var ln=P.f,cn=y.Symbol;if(f&&"function"==typeof cn&&(!("description"in cn.prototype)||void 0!==cn().description)){var fn={},vn=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),e=this instanceof vn?new cn(t):void 0===t?cn():cn(t);return""===t&&(fn[e]=!0),e};xt(vn,cn);var dn=vn.prototype=cn.prototype;dn.constructor=vn;var pn=dn.toString,yn="Symbol(test)"==String(cn("test")),mn=/^Symbol\((.*)\)[^)]+$/;ln(dn,"description",{configurable:!0,get:function(){var t=g(this)?this.valueOf():this,e=pn.call(t);if(x(fn,t))return"";var n=yn?e.slice(7,-1):e.replace(mn,"$1");return""===n?void 0:n}}),Ct({global:!0,forced:!0},{Symbol:vn})}_e("iterator");var gn=Gt("unscopables"),wn=Array.prototype;null==wn[gn]&&I(wn,gn,ge(null));var bn,_n,xn,kn=function(t){wn[gn][t]=!0},On={},Sn=!m(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),An=B("IE_PROTO"),jn=Object.prototype,Mn=Sn?Object.getPrototypeOf:function(t){return t=It(t),x(t,An)?t[An]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?jn:null},En=Gt("iterator"),Tn=!1;[].keys&&("next"in(xn=[].keys())?(_n=Mn(Mn(xn)))!==Object.prototype&&(bn=_n):Tn=!0),null==bn&&(bn={}),x(bn,En)||I(bn,En,function(){return this});var Cn={IteratorPrototype:bn,BUGGY_SAFARI_ITERATORS:Tn},Pn=Cn.IteratorPrototype,In=function(){return this},Nn=Object.setPrototypeOf||("__proto__"in{}?function(){var n,r=!1,t={};try{(n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(t,[]),r=t instanceof Array}catch(t){}return function(t,e){return T(t),function(t){if(!g(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype")}(e),r?n.call(t,e):t.__proto__=e,t}}():void 0),Dn=Cn.IteratorPrototype,Rn=Cn.BUGGY_SAFARI_ITERATORS,Ln=Gt("iterator"),Fn="values",zn="entries",qn=function(){return this},Yn=function(t,e,n,r,i,o,s){var u,a,h;a=r,h=e+" Iterator",(u=n).prototype=ge(Pn,{next:b(1,a)}),Oe(u,h,!1),On[h]=In;var l,c,f,v=function(t){if(t===i&&g)return g;if(!Rn&&t in y)return y[t];switch(t){case"keys":case Fn:case zn:return function(){return new n(this,t)}}return function(){return new n(this)}},d=e+" Iterator",p=!1,y=t.prototype,m=y[Ln]||y["@@iterator"]||i&&y[i],g=!Rn&&m||v(i),w="Array"==e&&y.entries||m;if(w&&(l=Mn(w.call(new t)),Dn!==Object.prototype&&l.next&&(Mn(l)!==Dn&&(Nn?Nn(l,Dn):"function"!=typeof l[Ln]&&I(l,Ln,qn)),Oe(l,d,!0))),i==Fn&&m&&m.name!==Fn&&(p=!0,g=function(){return m.call(this)}),y[Ln]!==g&&I(y,Ln,g),On[e]=g,i)if(c={values:v(Fn),keys:o?g:v("keys"),entries:v(zn)},s)for(f in c)!Rn&&!p&&f in y||et(y,f,c[f]);else Ct({target:e,proto:!0,forced:Rn||p},c);return c},Xn="Array Iterator",Gn=tt.set,Vn=tt.getterFor(Xn),Hn=Yn(Array,"Array",function(t,e){Gn(this,{type:Xn,target:d(t),index:0,kind:e})},function(){var t=Vn(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?{value:t.target=void 0,done:!0}:"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}},"values");On.Arguments=On.Array,kn("keys"),kn("values"),kn("entries");var Bn=Gt("toStringTag"),Un="Arguments"==h(function(){return arguments}()),$n=function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),Bn))?n:Un?h(e):"Object"==(r=h(e))&&"function"==typeof e.callee?"Arguments":r},Qn={};Qn[Gt("toStringTag")]="z";var Wn="[object z]"!==String(Qn)?function(){return"[object "+$n(this)+"]"}:Qn.toString,Jn=Object.prototype;Wn!==Jn.toString&&et(Jn,"toString",Wn,{unsafe:!0});var Zn=!m(function(){return Object.isExtensible(Object.preventExtensions({}))}),Kn=e(function(t){var e=P.f,n=V("meta"),r=0,i=Object.isExtensible||function(){return!0},o=function(t){e(t,n,{value:{objectID:"O"+ ++r,weakData:{}}})},s=t.exports={REQUIRED:!1,fastKey:function(t,e){if(!g(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!x(t,n)){if(!i(t))return"F";if(!e)return"E";o(t)}return t[n].objectID},getWeakData:function(t,e){if(!x(t,n)){if(!i(t))return!0;if(!e)return!1;o(t)}return t[n].weakData},onFreeze:function(t){return Zn&&s.REQUIRED&&i(t)&&!x(t,n)&&o(t),t}};U[n]=!0}),tr=Gt("iterator"),er=Array.prototype,nr=Gt("iterator"),rr=function(e,t,n,r){try{return r?t(T(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&T(i.call(e)),t}},ir=e(function(t){var d=function(t,e){this.stopped=t,this.result=e};(t.exports=function(t,e,n,r,i){var o,s,u,a,h,l,c,f,v=Ae(e,n,r?2:1);if(i)o=t;else{if("function"!=typeof(s=function(t){if(null!=t)return t[nr]||t["@@iterator"]||On[$n(t)]}(t)))throw TypeError("Target is not iterable");if(void 0!==(f=s)&&(On.Array===f||er[tr]===f)){for(u=0,a=ht(t.length);u<a;u++)if((h=r?v(T(c=t[u])[0],c[1]):v(t[u]))&&h instanceof d)return h;return new d(!1)}o=s.call(t)}for(l=o.next;!(c=l.call(o)).done;)if("object"==typeof(h=rr(o,v,c.value,r))&&h&&h instanceof d)return h;return new d(!1)}).stop=function(t){return new d(!0,t)}}),or=function(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t},sr=Gt("iterator"),ur=!1;try{var ar=0,hr={next:function(){return{done:!!ar++}},return:function(){ur=!0}};hr[sr]=function(){return this},Array.from(hr,function(){throw 2})}catch(t){}var lr=function(t,e,n){var r,i;return Nn&&"function"==typeof(r=e.constructor)&&r!==n&&g(i=r.prototype)&&i!==n.prototype&&Nn(t,i),t},cr=function(t,e,n){for(var r in e)et(t,r,e[r],n);return t},fr=Gt("species"),vr=P.f,dr=Kn.fastKey,pr=tt.set,yr=tt.getterFor,mr=(function(r,t,e,i,o){var s=y[r],u=s&&s.prototype,a=s,h=i?"set":"add",n={},l=function(t){var n=u[t];et(u,t,"add"==t?function(t){return n.call(this,0===t?0:t),this}:"delete"==t?function(t){return!(o&&!g(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return o&&!g(t)?void 0:n.call(this,0===t?0:t)}:"has"==t?function(t){return!(o&&!g(t))&&n.call(this,0===t?0:t)}:function(t,e){return n.call(this,0===t?0:t,e),this})};if(Et(r,"function"!=typeof s||!(o||u.forEach&&!m(function(){(new s).entries().next()}))))a=e.getConstructor(t,r,i,h),Kn.REQUIRED=!0;else if(Et(r,!0)){var c=new a,f=c[h](o?{}:-0,1)!=c,v=m(function(){c.has(1)}),d=function(t,e){if(!e&&!ur)return!1;var n=!1;try{var r={};r[sr]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n}(function(t){new s(t)}),p=!o&&m(function(){for(var t=new s,e=5;e--;)t[h](e,e);return!t.has(-0)});d||(((a=t(function(t,e){or(t,a,r);var n=lr(new s,t,a);return null!=e&&ir(e,n[h],n,i),n})).prototype=u).constructor=a),(v||p)&&(l("delete"),l("has"),i&&l("get")),(p||f)&&l(h),o&&u.clear&&delete u.clear}n[r]=a,Ct({global:!0,forced:a!=s},n),Oe(a,r),o||e.setStrong(a,r,i)}("Set",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},{getConstructor:function(t,n,r,i){var o=t(function(t,e){or(t,o,n),pr(t,{type:n,index:ge(null),first:void 0,last:void 0,size:0}),f||(t.size=0),null!=e&&ir(e,t[i],t,r)}),u=yr(n),s=function(t,e,n){var r,i,o=u(t),s=a(t,e);return s?s.value=n:(o.last=s={index:i=dr(e,!0),key:e,value:n,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=s),r&&(r.next=s),f?o.size++:t.size++,"F"!==i&&(o.index[i]=s)),t},a=function(t,e){var n,r=u(t),i=dr(e);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key==e)return n};return cr(o.prototype,{clear:function(){for(var t=u(this),e=t.index,n=t.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete e[n.index],n=n.next;t.first=t.last=void 0,f?t.size=0:this.size=0},delete:function(t){var e=u(this),n=a(this,t);if(n){var r=n.next,i=n.previous;delete e.index[n.index],n.removed=!0,i&&(i.next=r),r&&(r.previous=i),e.first==n&&(e.first=r),e.last==n&&(e.last=i),f?e.size--:this.size--}return!!n},forEach:function(t){for(var e,n=u(this),r=Ae(t,1<arguments.length?arguments[1]:void 0,3);e=e?e.next:n.first;)for(r(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!a(this,t)}}),cr(o.prototype,r?{get:function(t){var e=a(this,t);return e&&e.value},set:function(t,e){return s(this,0===t?0:t,e)}}:{add:function(t){return s(this,t=0===t?0:t,t)}}),f&&vr(o.prototype,"size",{get:function(){return u(this).size}}),o},setStrong:function(t,e,n){var r,i,o=e+" Iterator",s=yr(e),u=yr(o);Yn(t,e,function(t,e){pr(this,{type:o,target:t,state:s(t),kind:e,last:void 0})},function(){for(var t=u(this),e=t.kind,n=t.last;n&&n.removed;)n=n.previous;return t.target&&(t.last=n=n?n.next:t.state.first)?"keys"==e?{value:n.key,done:!1}:"values"==e?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:{value:t.target=void 0,done:!0}},n?"entries":"values",!n,!0),r=it(e),i=P.f,f&&r&&!r[fr]&&i(r,fr,{configurable:!0,get:function(){return this}})}}),function(u){return function(t,e){var n,r,i=String(c(t)),o=ut(e),s=i.length;return o<0||s<=o?u?"":void 0:(n=i.charCodeAt(o))<55296||56319<n||o+1===s||(r=i.charCodeAt(o+1))<56320||57343<r?u?i.charAt(o):n:u?i.slice(o,o+2):r-56320+(n-55296<<10)+65536}}),gr={codeAt:mr(!1),charAt:mr(!0)},wr=gr.charAt,br="String Iterator",_r=tt.set,xr=tt.getterFor(br);Yn(String,"String",function(t){_r(this,{type:br,string:String(t),index:0})},function(){var t,e=xr(this),n=e.string,r=e.index;return r>=n.length?{value:void 0,done:!0}:(t=wr(n,r),e.index+=t.length,{value:t,done:!1})});var kr={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Or=Gt("iterator"),Sr=Gt("toStringTag"),Ar=Hn.values;for(var jr in kr){var Mr=y[jr],Er=Mr&&Mr.prototype;if(Er){if(Er[Or]!==Ar)try{I(Er,Or,Ar)}catch(t){Er[Or]=Ar}if(Er[Sr]||I(Er,Sr,jr),kr[jr])for(var Tr in Hn)if(Er[Tr]!==Hn[Tr])try{I(Er,Tr,Hn[Tr])}catch(t){Er[Tr]=Hn[Tr]}}}function Cr(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var Pr={},Ir=[];function Nr(t,e){if(Array.isArray(t)){var n=!0,r=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){Nr(o.value,e)}}catch(t){r=!0,i=t}finally{try{n||null==s.return||s.return()}finally{if(r)throw i}}}else if("object"!==ce(t))Rr(Object.getOwnPropertyNames(e)),Pr[t]=Object.assign(Pr[t]||{},e);else for(var u in t)Nr(u,t[u])}function Dr(t){return Pr[t]||{}}function Rr(t){Ir.push.apply(Ir,Cr(t))}var Lr=dt.includes;Ct({target:"Array",proto:!0},{includes:function(t){return Lr(this,t,1<arguments.length?arguments[1]:void 0)}}),kn("includes");var Fr,zr,qr=function(){var t=T(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},Yr=RegExp.prototype.exec,Xr=String.prototype.replace,Gr=Yr,Vr=(Fr=/a/,zr=/b*/g,Yr.call(Fr,"a"),Yr.call(zr,"a"),0!==Fr.lastIndex||0!==zr.lastIndex),Hr=void 0!==/()??/.exec("")[1];(Vr||Hr)&&(Gr=function(t){var e,n,r,i,o=this;return Hr&&(n=new RegExp("^"+o.source+"$(?!\\s)",qr.call(o))),Vr&&(e=o.lastIndex),r=Yr.call(o,t),Vr&&r&&(o.lastIndex=o.global?r.index+r[0].length:e),Hr&&r&&1<r.length&&Xr.call(r[0],n,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)}),r});var Br=Gr;Ct({target:"RegExp",proto:!0,forced:/./.exec!==Br},{exec:Br});var Ur=Gt("match"),$r=function(t){var e;return g(t)&&(void 0!==(e=t[Ur])?!!e:"RegExp"==h(t))},Qr=Gt("match");Ct({target:"String",proto:!0,forced:!function(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[Qr]=!1,"/./"[e](n)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~String(c(this)).indexOf(function(t){if($r(t))throw TypeError("The method doesn't accept regular expressions");return t}(t),1<arguments.length?arguments[1]:void 0)}});var Wr=Gt("species"),Jr=!m(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),Zr=!m(function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}),Kr=function(n,t,e,r){var i=Gt(n),o=!m(function(){var t={};return t[i]=function(){return 7},7!=""[n](t)}),s=o&&!m(function(){var t=!1,e=/a/;return"split"===n&&((e={constructor:{}}).constructor[Wr]=function(){return e},e.flags="",e[i]=/./[i]),e.exec=function(){return t=!0,null},e[i](""),!t});if(!o||!s||"replace"===n&&!Jr||"split"===n&&!Zr){var u=/./[i],a=e(i,""[n],function(t,e,n,r,i){return e.exec===Br?o&&!i?{done:!0,value:u.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),h=a[0],l=a[1];et(String.prototype,n,h),et(RegExp.prototype,i,2==t?function(t,e){return l.call(t,this,e)}:function(t){return l.call(t,this)}),r&&I(RegExp.prototype[i],"sham",!0)}},ti=gr.charAt,ei=function(t,e,n){return e+(n?ti(t,e).length:1)},ni=function(t,e){var n=t.exec;if("function"==typeof n){var r=n.call(t,e);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==h(t))throw TypeError("RegExp#exec called on incompatible receiver");return Br.call(t,e)},ri=Math.max,ii=Math.min,oi=Math.floor,si=/\$([$&'`]|\d\d?|<[^>]*>)/g,ui=/\$([$&'`]|\d\d?)/g;Kr("replace",2,function(i,_,x){return[function(t,e){var n=c(this),r=null==t?void 0:t[i];return void 0!==r?r.call(t,n,e):_.call(String(n),t,e)},function(t,e){var n=x(_,t,this,e);if(n.done)return n.value;var r=T(t),i=String(this),o="function"==typeof e;o||(e=String(e));var s=r.global;if(s){var u=r.unicode;r.lastIndex=0}for(var a=[];;){var h=ni(r,i);if(null===h)break;if(a.push(h),!s)break;""===String(h[0])&&(r.lastIndex=ei(i,ht(r.lastIndex),u))}for(var l,c="",f=0,v=0;v<a.length;v++){h=a[v];for(var d=String(h[0]),p=ri(ii(ut(h.index),i.length),0),y=[],m=1;m<h.length;m++)y.push(void 0===(l=h[m])?l:String(l));var g=h.groups;if(o){var w=[d].concat(y,p,i);void 0!==g&&w.push(g);var b=String(e.apply(void 0,w))}else b=k(d,i,p,y,g,e);f<=p&&(c+=i.slice(f,p)+b,f=p+d.length)}return c+i.slice(f)}];function k(o,s,u,a,h,t){var l=u+o.length,c=a.length,e=ui;return void 0!==h&&(h=It(h),e=si),_.call(t,e,function(t,e){var n;switch(e.charAt(0)){case"$":return"$";case"&":return o;case"`":return s.slice(0,u);case"'":return s.slice(l);case"<":n=h[e.slice(1,-1)];break;default:var r=+e;if(0===r)return t;if(c<r){var i=oi(r/10);return 0===i?t:i<=c?void 0===a[i-1]?e.charAt(1):a[i-1]+e.charAt(1):t}n=a[r-1]}return void 0===n?"":n})}});var ai,hi="\t\n\v\f\r    â€â€‚         âŸã€€\u2028\u2029\ufeff",li="["+hi+"]",ci=RegExp("^"+li+li+"*"),fi=RegExp(li+li+"*$"),vi=function(n){return function(t){var e=String(c(t));return 1&n&&(e=e.replace(ci,"")),2&n&&(e=e.replace(fi,"")),e}},di={start:vi(1),end:vi(2),trim:vi(3)},pi=di.trim;function yi(t,e){var n,r=t.length,i=[];for(n=0;n<r;n++)i.push(e(t[n]));return i}function mi(t){return t%360*Math.PI/180}function gi(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}function wi(t){return t.replace(/([A-Z])/g,function(t,e){return"-"+e.toLowerCase()})}function bi(t){return t.charAt(0).toUpperCase()+t.slice(1)}function _i(t,e,n,r){return null!=e&&null!=n||(r=r||t.bbox(),null==e?e=r.width/r.height*n:null==n&&(n=r.height/r.width*e)),{width:e,height:n}}function xi(t,e){var n,r,i=t.origin;if("string"==typeof i||null==i){var o=(i||"center").toLowerCase().trim(),s=e.bbox(),u=s.height,a=s.width,h=s.x,l=s.y,c=o.includes("left")?h:o.includes("right")?h+a:h+a/2,f=o.includes("top")?l:o.includes("bottom")?l+u:l+u/2;n=null!=t.ox?t.ox:c,r=null!=t.oy?t.oy:f}else n=i[0],r=i[1];return[n,r]}Ct({target:"String",proto:!0,forced:(ai="trim",m(function(){return!!hi[ai]()||"â€‹Â…á Ž"!="â€‹Â…á Ž"[ai]()||hi[ai].name!==ai}))},{trim:function(){return pi(this)}});var ki={__proto__:null,map:yi,filter:function(t,e){var n,r=t.length,i=[];for(n=0;n<r;n++)e(t[n])&&i.push(t[n]);return i},radians:mi,degrees:function(t){return 180*t/Math.PI%360},camelCase:gi,unCamelCase:wi,capitalize:bi,proportionalSize:_i,getOrigin:xi},Oi="http://www.w3.org/2000/svg",Si="http://www.w3.org/2000/xmlns/",Ai="http://www.w3.org/1999/xlink",ji="http://svgjs.com/svgjs",Mi={__proto__:null,ns:Oi,xmlns:Si,xlink:Ai,svgjs:ji},Ei={window:"undefined"==typeof window?null:window,document:"undefined"==typeof document?null:document};function Ti(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Ci=function t(){Ti(this,t)},Pi={},Ii="___SYMBOL___ROOT___";function Ni(t){return Ei.document.createElementNS(Oi,t)}function Di(t){if(t instanceof Ci)return t;if("object"===ce(t))return Fi(t);if(null==t)return new Pi[Ii];if("string"==typeof t&&"<"!==t.charAt(0))return Fi(Ei.document.querySelector(t));var e=Ni("svg");return e.innerHTML=t,t=Fi(e.firstChild)}function Ri(t,e){return e instanceof Ei.window.Node?e:Ni(t)}function Li(t){if(!t)return null;if(t.instance instanceof Ci)return t.instance;var e=bi(t.nodeName||"Dom");return"LinearGradient"===e||"RadialGradient"===e?e="Gradient":Pi[e]||(e="Dom"),new Pi[e](t)}var Fi=Li;function zi(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t.name,n=2<arguments.length&&void 0!==arguments[2]&&arguments[2];return Pi[e]=t,n&&(Pi[Ii]=t),Rr(Object.getOwnPropertyNames(t.prototype)),t}function qi(t){return Pi[t]}var Yi=1e3;function Xi(t){return"Svgjs"+bi(t)+Yi++}function Gi(t){for(var e=t.children.length-1;0<=e;e--)Gi(t.children[e]);return t.id?Li(t).id(Xi(t.nodeName)):Li(t)}function Vi(t,e,n){var r,i;for(i=(t=Array.isArray(t)?t:[t]).length-1;0<=i;i--)for(r in e){var o=e[r];n&&(o=Hi(e[r])),t[i].prototype[r]=o}}function Hi(i){return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[e.length-1];return!r||r.constructor!==Object||r instanceof Array?i.apply(this,e):i.apply(this,e.slice(0,-1)).attr(r)}}Nr("Dom",{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){var t=this.position()+1,e=this.parent();return e.removeElement(this).add(this,t),"function"==typeof e.isRoot&&e.isRoot()&&e.node.appendChild(e.defs().node),this},backward:function(){var t=this.position();return 0<t&&this.parent().removeElement(this).add(this,t-1),this},front:function(){var t=this.parent();return t.node.appendChild(this.node),"function"==typeof t.isRoot&&t.isRoot()&&t.node.appendChild(t.defs().node),this},back:function(){return 0<this.position()&&this.parent().removeElement(this).add(this,0),this},before:function(t){(t=Di(t)).remove();var e=this.position();return this.parent().add(t,e),this},after:function(t){(t=Di(t)).remove();var e=this.position();return this.parent().add(t,e+1),this},insertBefore:function(t){return(t=Di(t)).before(this),this},insertAfter:function(t){return(t=Di(t)).after(this),this}});var Bi=Ce.filter;Ct({target:"Array",proto:!0,forced:!Wt("filter")},{filter:function(t){return Bi(this,t,1<arguments.length?arguments[1]:void 0)}});var Ui=function(t,e){var n=[][t];return!n||!m(function(){n.call(null,e||function(){throw 1},1)})},$i=dt.indexOf,Qi=[].indexOf,Wi=!!Qi&&1/[1].indexOf(1,-0)<0,Ji=Ui("indexOf");Ct({target:"Array",proto:!0,forced:Wi||Ji},{indexOf:function(t){return Wi?Qi.apply(this,arguments)||0:$i(this,t,1<arguments.length?arguments[1]:void 0)}});var Zi=[].join,Ki=_!=Object,to=Ui("join",",");Ct({target:"Array",proto:!0,forced:Ki||to},{join:function(t){return Zi.call(d(this),void 0===t?",":t)}});var eo=Gt("species"),no=[].push,ro=Math.min,io=4294967295,oo=!m(function(){return!RegExp(io,"y")});Kr("split",2,function(i,g,w){var b;return b="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||1<".".split(/()()/).length||"".split(/.?/).length?function(t,e){var n=String(c(this)),r=void 0===e?io:e>>>0;if(0===r)return[];if(void 0===t)return[n];if(!$r(t))return g.call(n,t,r);for(var i,o,s,u=[],a=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),h=0,l=new RegExp(t.source,a+"g");(i=Br.call(l,n))&&!(h<(o=l.lastIndex)&&(u.push(n.slice(h,i.index)),1<i.length&&i.index<n.length&&no.apply(u,i.slice(1)),s=i[0].length,h=o,u.length>=r));)l.lastIndex===i.index&&l.lastIndex++;return h===n.length?!s&&l.test("")||u.push(""):u.push(n.slice(h)),u.length>r?u.slice(0,r):u}:"0".split(void 0,0).length?function(t,e){return void 0===t&&0===e?[]:g.call(this,t,e)}:g,[function(t,e){var n=c(this),r=null==t?void 0:t[i];return void 0!==r?r.call(t,n,e):b.call(String(n),t,e)},function(t,e){var n=w(b,t,this,e,b!==g);if(n.done)return n.value;var r,i,o,s=T(t),u=String(this),a=(r=RegExp,void 0===(o=T(s).constructor)||null==(i=T(o)[eo])?r:Se(i)),h=s.unicode,l=(s.ignoreCase?"i":"")+(s.multiline?"m":"")+(s.unicode?"u":"")+(oo?"y":"g"),c=new a(oo?s:"^(?:"+s.source+")",l),f=void 0===e?io:e>>>0;if(0===f)return[];if(0===u.length)return null===ni(c,u)?[u]:[];for(var v=0,d=0,A=[];d<u.length;){c.lastIndex=oo?d:0;var p,y=ni(c,oo?u:u.slice(d));if(null===y||(p=ro(ht(c.lastIndex+(oo?0:d)),u.length))===v)d=ei(u,d,h);else{if(A.push(u.slice(v,d)),A.length===f)return A;for(var m=1;m<=y.length-1;m++)if(A.push(y[m]),A.length===f)return A;d=v=p}}return A.push(u.slice(v)),A}]},!oo);var so=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,uo=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,ao=/rgb\((\d+),(\d+),(\d+)\)/,ho=/(#[a-z0-9\-_]+)/i,lo=/\)\s*,?\s*/,co=/\s/g,fo=/^#[a-f0-9]{3,6}$/i,vo=/^rgb\(/,po=/^(\s+)?$/,yo=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,mo=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,go=/[\s,]+/,wo=/([^e])-/gi,bo=/[MLHVCSQTAZ]/gi,_o=/[MLHVCSQTAZ]/i,xo=/((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi,ko=/\./g,Oo={__proto__:null,numberAndUnit:so,hex:uo,rgb:ao,reference:ho,transforms:lo,whitespace:co,isHex:fo,isRgb:vo,isCss:/[^:]+:[^;]+;?/,isBlank:po,isNumber:yo,isPercent:/^-?[\d.]+%$/,isImage:mo,delimiter:go,hyphen:wo,pathLetters:bo,isPathLetter:_o,numbersWithDots:xo,dots:ko};Nr("Dom",{classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(go)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){var e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(e){return this.hasClass(e)&&this.attr("class",this.classes().filter(function(t){return t!==e}).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}});var So=Ce.forEach,Ao=Ui("forEach")?function(t){return So(this,t,1<arguments.length?arguments[1]:void 0)}:[].forEach;for(var jo in Ct({target:"Array",proto:!0,forced:[].forEach!=Ao},{forEach:Ao}),kr){var Mo=y[jo],Eo=Mo&&Mo.prototype;if(Eo&&Eo.forEach!==Ao)try{I(Eo,"forEach",Ao)}catch(t){Eo.forEach=Ao}}Nr("Dom",{css:function(t,e){var n={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter(function(t){return!!t.length}).forEach(function(t){var e=t.split(/\s*:\s*/);n[e[0]]=e[1]}),n;if(arguments.length<2){if(Array.isArray(t)){var r=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(r=(s=u.next()).done);r=!0){var a=gi(s.value);n[a]=this.node.style[a]}}catch(t){i=!0,o=t}finally{try{r||null==u.return||u.return()}finally{if(i)throw o}}return n}if("string"==typeof t)return this.node.style[gi(t)];if("object"===ce(t))for(var h in t)this.node.style[gi(h)]=null==t[h]||po.test(t[h])?"":t[h]}return 2===arguments.length&&(this.node.style[gi(t)]=null==e||po.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),Nr("Dom",{data:function(e,t,n){if("object"===ce(e))for(t in e)this.data(t,e[t]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+e))}catch(t){return this.attr("data-"+e)}else this.attr("data-"+e,null===t?null:!0===n||"string"==typeof t||"number"==typeof t?t:JSON.stringify(t));return this}}),Nr("Dom",{remember:function(t,e){if("object"===ce(t))for(var n in t)this.remember(n,t[n]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0===arguments.length)this._memory={};else for(var t=arguments.length-1;0<=t;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});var To=function(h){return function(t,e,n,r){Se(e);var i=It(t),o=_(i),s=ht(i.length),u=h?s-1:0,a=h?-1:1;if(n<2)for(;;){if(u in o){r=o[u],u+=a;break}if(u+=a,h?u<0:s<=u)throw TypeError("Reduce of empty array with no initial value")}for(;h?0<=u:u<s;u+=a)u in o&&(r=e(r,o[u],u,i));return r}},Co={left:To(!1),right:To(!0)}.left;Ct({target:"Array",proto:!0,forced:Ui("reduce")},{reduce:function(t){return Co(this,t,arguments.length,1<arguments.length?arguments[1]:void 0)}});var Po=0,Io={};function No(t){var e=t.getEventHolder();return e===Ei.window&&(e=Io),e.events||(e.events={}),e.events}function Do(t){return t.getEventTarget()}function Ro(t,e,r,n,i){var o=r.bind(n||t),s=Di(t),u=No(s),a=Do(s);e=Array.isArray(e)?e:e.split(go),r._svgjsListenerId||(r._svgjsListenerId=++Po),e.forEach(function(t){var e=t.split(".")[0],n=t.split(".")[1]||"*";u[e]=u[e]||{},u[e][n]=u[e][n]||{},u[e][n][r._svgjsListenerId]=o,a.addEventListener(e,o,i||!1)})}function Lo(t,e,s,u){var a=Di(t),h=No(a),l=Do(a);("function"!=typeof s||(s=s._svgjsListenerId))&&(e=Array.isArray(e)?e:(e||"").split(go)).forEach(function(t){var e,n,r,i=t&&t.split(".")[0],o=t&&t.split(".")[1];if(s)h[i]&&h[i][o||"*"]&&(l.removeEventListener(i,h[i][o||"*"][s],u||!1),delete h[i][o||"*"][s]);else if(i&&o){if(h[i]&&h[i][o]){for(n in h[i][o])Lo(l,[i,o].join("."),n);delete h[i][o]}}else if(o)for(t in h)for(e in h[t])o===e&&Lo(l,[t,o].join("."));else if(i){if(h[i]){for(e in h[i])Lo(l,[i,e].join("."));delete h[i]}}else{for(t in h)Lo(l,t);(r=a.getEventHolder()).events&&(r.events={})}})}function Fo(t,e,n){var r=Do(t);return e instanceof Ei.window.Event||(e=new Ei.window.CustomEvent(e,{detail:n,cancelable:!0})),r.dispatchEvent(e),e}var zo=Gt("isConcatSpreadable"),qo=9007199254740991,Yo="Maximum allowed index exceeded",Xo=51<=$t||!m(function(){var t=[];return t[zo]=!1,t.concat()[0]!==t}),Go=Wt("concat"),Vo=function(t){if(!g(t))return!1;var e=t[zo];return void 0!==e?!!e:Ft(t)};Ct({target:"Array",proto:!0,forced:!Xo||!Go},{concat:function(t){var e,n,r,i,o,s=It(this),A=Me(s,0),u=0;for(e=-1,r=arguments.length;e<r;e++)if(o=-1===e?s:arguments[e],Vo(o)){if(i=ht(o.length),qo<u+i)throw TypeError(Yo);for(n=0;n<i;n++,u++)n in o&&zt(A,u,o[n])}else{if(qo<=u)throw TypeError(Yo);zt(A,u++,o)}return A.length=u,A}});var Ho=Ce.map;Ct({target:"Array",proto:!0,forced:!Wt("map")},{map:function(t){return Ho(this,t,1<arguments.length?arguments[1]:void 0)}});var Bo=Date.prototype,Uo="Invalid Date",$o="toString",Qo=Bo[$o],Wo=Bo.getTime;new Date(NaN)+""!=Uo&&et(Bo,$o,function(){var t=Wo.call(this);return t==t?Qo.call(this):Uo});var Jo=di.trim,Zo=y.parseInt,Ko=/^[+-]?0[Xx]/,ts=8!==Zo(hi+"08")||22!==Zo(hi+"0x16")?function(t,e){var n=Jo(String(t));return Zo(n,e>>>0||(Ko.test(n)?16:10))}:Zo;Ct({global:!0,forced:parseInt!=ts},{parseInt:ts});var es="toString",ns=RegExp.prototype,rs=ns[es],is=m(function(){return"/a/b"!=rs.call({source:"a",flags:"b"})}),os=rs.name!=es;function ss(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var n=[],r=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(r=(s=u.next()).done)&&(n.push(s.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==u.return||u.return()}finally{if(i)throw o}}return n}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function us(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function as(t,e,n){return e&&us(t.prototype,e),n&&us(t,n),t}function hs(t){var e=Math.round(t),n=Math.max(0,Math.min(255,e)).toString(16);return 1===n.length?"0"+n:n}function ls(t,e){for(var n=e.length;n--;)if(null==t[e[n]])return!1;return!0}function cs(t,e,n){return n<0&&(n+=1),1<n&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}(is||os)&&et(RegExp.prototype,es,function(){var t=T(this),e=String(t.source),n=t.flags;return"/"+e+"/"+String(void 0===n&&t instanceof RegExp&&!("flags"in ns)?qr.call(t):n)},{unsafe:!0});var fs=function(){function T(){Ti(this,T),this.init.apply(this,arguments)}return as(T,[{key:"init",value:function(){var t,e,n,r,i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,u=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"rgb";if(i=i||0,this.space)for(var h in this.space)delete this[this.space[h]];if("number"==typeof i)a="string"==typeof u?u:a,u="string"==typeof u?0:u,Object.assign(this,{_a:i,_b:o,_c:s,_d:u,space:a});else if(i instanceof Array)this.space=o||("string"==typeof i[3]?i[3]:i[4])||"rgb",Object.assign(this,{_a:i[0],_b:i[1],_c:i[2],_d:i[3]||0});else if(i instanceof Object){var l=(n=o,(r=ls(e=i,"rgb")?{_a:e.r,_b:e.g,_c:e.b,space:"rgb"}:ls(e,"xyz")?{_a:e.x,_b:e.y,_c:e.z,_d:0,space:"xyz"}:ls(e,"hsl")?{_a:e.h,_b:e.s,_c:e.l,_d:0,space:"hsl"}:ls(e,"lab")?{_a:e.l,_b:e.a,_c:e.b,_d:0,space:"lab"}:ls(e,"lch")?{_a:e.l,_b:e.c,_c:e.h,_d:0,space:"lch"}:ls(e,"cmyk")?{_a:e.c,_b:e.m,_c:e.y,_d:e.k,space:"cmyk"}:{_a:0,_b:0,_c:0,space:"rgb"}).space=n||r.space,r);Object.assign(this,l)}else if("string"==typeof i)if(vo.test(i)){var c=i.replace(co,""),f=ss(ao.exec(c).slice(1,4).map(function(t){return parseInt(t)}),3),v=f[0],d=f[1],p=f[2];Object.assign(this,{_a:v,_b:d,_c:p,_d:0,space:"rgb"})}else{if(!fo.test(i))throw Error("Unsupported string format, can't construct Color");var y=ss(uo.exec((t=i,4===t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t)).map(function(t){return parseInt(t,16)}),4),m=y[1],g=y[2],w=y[3];Object.assign(this,{_a:m,_b:g,_c:w,_d:0,space:"rgb"})}var b=this._a,_=this._b,x=this._c,k=this._d,O="rgb"===this.space?{r:b,g:_,b:x}:"xyz"===this.space?{x:b,y:_,z:x}:"hsl"===this.space?{h:b,s:_,l:x}:"lab"===this.space?{l:b,a:_,b:x}:"lch"===this.space?{l:b,c:_,h:x}:"cmyk"===this.space?{c:b,m:_,y:x,k:k}:{};Object.assign(this,O)}},{key:"rgb",value:function(){if("rgb"===this.space)return this;if("lab"===(O=this.space)||"xyz"===O||"lch"===O){var t=this.x,e=this.y,n=this.z;if("lab"===this.space||"lch"===this.space){var r=this.l,i=this.a,o=this.b;if("lch"===this.space){var s=this.c,u=this.h,a=Math.PI/180;i=s*Math.cos(a*u),o=s*Math.sin(a*u)}var h=(r+16)/116,l=i/500+h,c=h-o/200,f=16/116,v=.008856;t=.95047*(Math.pow(l,3)>v?Math.pow(l,3):(l-f)/7.787),e=1*(Math.pow(h,3)>v?Math.pow(h,3):(h-f)/7.787),n=1.08883*(Math.pow(c,3)>v?Math.pow(c,3):(c-f)/7.787)}var d=3.2406*t+-1.5372*e+-.4986*n,p=-.9689*t+1.8758*e+.0415*n,y=.0557*t+-.204*e+1.057*n,m=Math.pow,g=.0031308;return new T(255*(g<d?1.055*m(d,1/2.4)-.055:12.92*d),255*(g<p?1.055*m(p,1/2.4)-.055:12.92*p),255*(g<y?1.055*m(y,1/2.4)-.055:12.92*y))}if("hsl"===this.space){var w=this.h,b=this.s,_=this.l;if(w/=360,_/=100,0===(b/=100))return new T(_*=255,_,_);var x=_<.5?_*(1+b):_+b-_*b,k=2*_-x;return new T(255*cs(k,x,w+1/3),255*cs(k,x,w),255*cs(k,x,w-1/3))}if("cmyk"!==this.space)return this;var O,S=this.c,j=this.m,M=this.y,E=this.k;return new T(255*(1-Math.min(1,S*(1-E)+E)),255*(1-Math.min(1,j*(1-E)+E)),255*(1-Math.min(1,M*(1-E)+E)))}},{key:"lab",value:function(){var t=this.xyz(),e=t.x,n=t.y;return new T(116*n-16,500*(e-n),200*(n-t.z),"lab")}},{key:"xyz",value:function(){var t=this.rgb(),e=ss([t._a,t._b,t._c].map(function(t){return t/255}),3),n=e[0],r=e[1],i=e[2],o=.04045<n?Math.pow((n+.055)/1.055,2.4):n/12.92,s=.04045<r?Math.pow((r+.055)/1.055,2.4):r/12.92,u=.04045<i?Math.pow((i+.055)/1.055,2.4):i/12.92,a=(.4124*o+.3576*s+.1805*u)/.95047,h=(.2126*o+.7152*s+.0722*u)/1,l=(.0193*o+.1192*s+.9505*u)/1.08883;return new T(.008856<a?Math.pow(a,1/3):7.787*a+16/116,.008856<h?Math.pow(h,1/3):7.787*h+16/116,.008856<l?Math.pow(l,1/3):7.787*l+16/116,"xyz")}},{key:"lch",value:function(){var t=this.lab(),e=t.l,n=t.a,r=t.b,i=Math.sqrt(Math.pow(n,2)+Math.pow(r,2)),o=180*Math.atan2(r,n)/Math.PI;return o<0&&(o=360-(o*=-1)),new T(e,i,o,"lch")}},{key:"hsl",value:function(){var t=this.rgb(),e=ss([t._a,t._b,t._c].map(function(t){return t/255}),3),n=e[0],r=e[1],i=e[2],o=Math.max(n,r,i),s=Math.min(n,r,i),u=(o+s)/2,a=o===s,h=o-s;return new T(360*(a?0:o===n?((r-i)/h+(r<i?6:0))/6:o===r?((i-n)/h+2)/6:o===i?((n-r)/h+4)/6:0),100*(a?0:.5<u?h/(2-o-s):h/(o+s)),100*u,"hsl")}},{key:"cmyk",value:function(){var t=this.rgb(),e=ss([t._a,t._b,t._c].map(function(t){return t/255}),3),n=e[0],r=e[1],i=e[2],o=Math.min(1-n,1-r,1-i);return 1===o?new T(0,0,0,1,"cmyk"):new T((1-n-o)/(1-o),(1-r-o)/(1-o),(1-i-o)/(1-o),o,"cmyk")}},{key:"_clamped",value:function(){var t=this.rgb(),e=t._a,n=t._b,r=t._c,i=Math.max,o=Math.min,s=Math.round;return[e,n,r].map(function(t){return i(0,o(s(t),255))})}},{key:"toHex",value:function(){var t=ss(this._clamped().map(hs),3),e=t[0],n=t[1],r=t[2];return"#".concat(e).concat(n).concat(r)}},{key:"toString",value:function(){return this.toHex()}},{key:"toRgb",value:function(){var t=ss(this._clamped(),3),e=t[0],n=t[1],r=t[2];return"rgb(".concat(e,",").concat(n,",").concat(r,")")}},{key:"toArray",value:function(){return[this._a,this._b,this._c,this._d,this.space]}}],[{key:"random",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"vibrant",e=1<arguments.length?arguments[1]:void 0,n=Math.random,r=Math.round,i=Math.sin,o=Math.PI;if("vibrant"===t)return new T(24*n()+57,38*n()+45,360*n(),"lch");if("sine"===t)return new T(r(80*i(2*o*(e=null==e?n():e)/.5+.01)+150),r(50*i(2*o*e/.5+4.6)+200),r(100*i(2*o*e/.5+2.3)+150));if("pastel"===t)return new T(8*n()+86,17*n()+9,360*n(),"lch");if("dark"===t)return new T(10+10*n(),50*n()+86,360*n(),"lch");if("rgb"===t)return new T(255*n(),255*n(),255*n());if("lab"===t)return new T(100*n(),256*n()-128,256*n()-128,"lab");if("grey"===t){var s=255*n();return new T(s,s,s)}}},{key:"test",value:function(t){return"string"==typeof t&&(fo.test(t)||vo.test(t))}},{key:"isRgb",value:function(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}},{key:"isColor",value:function(t){return t&&(t instanceof T||this.isRgb(t)||this.test(t))}}]),T}(),vs=m(function(){Pt(1)});function ds(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ps(t,e){return!e||"object"!==ce(e)&&"function"!=typeof e?ds(t):e}function ys(t){return(ys=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ms(t,e,n){return(ms="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=ys(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function gs(t,e){return(gs=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ws(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&gs(t,e)}Ct({target:"Object",stat:!0,forced:vs},{keys:function(t){return Pt(It(t))}}),Kr("match",1,function(r,a,h){return[function(t){var e=c(this),n=null==t?void 0:t[r];return void 0!==n?n.call(t,e):new RegExp(t)[r](String(e))},function(t){var e=h(a,t,this);if(e.done)return e.value;var n=T(t),r=String(this);if(!n.global)return ni(n,r);for(var i,o=n.unicode,A=[],s=n.lastIndex=0;null!==(i=ni(n,r));){var u=String(i[0]);""===(A[s]=u)&&(n.lastIndex=ei(r,ht(n.lastIndex),o)),s++}return 0===s?null:A}]});var bs=wt.f,_s=E.f,xs=P.f,ks=di.trim,Os="Number",Ss=y[Os],As=Ss.prototype,js=h(ge(As))==Os,Ms=function(t){var e,n,r,i,o,s,u,a,h=p(t,!1);if("string"==typeof h&&2<h.length)if(43===(e=(h=ks(h)).charCodeAt(0))||45===e){if(88===(n=h.charCodeAt(2))||120===n)return NaN}else if(48===e){switch(h.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+h}for(s=(o=h.slice(2)).length,u=0;u<s;u++)if((a=o.charCodeAt(u))<48||i<a)return NaN;return parseInt(o,r)}return+h};if(Et(Os,!Ss(" 0o1")||!Ss("0b1")||Ss("+0x1"))){for(var Es,Ts=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof Ts&&(js?m(function(){As.valueOf.call(n)}):h(n)!=Os)?lr(new Ss(Ms(e)),n,Ts):Ms(e)},Cs=f?bs(Ss):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),Ps=0;Cs.length>Ps;Ps++)x(Ss,Es=Cs[Ps])&&!x(Ts,Es)&&xs(Ts,Es,_s(Ss,Es));(Ts.prototype=As).constructor=Ts,et(y,Os,Ts)}var Is=di.trim,Ns=y.parseFloat,Ds=1/Ns(hi+"-0")!=-1/0?function(t){var e=Is(String(t)),n=Ns(e);return 0===n&&"-"==e.charAt(0)?-0:n}:Ns;Ct({global:!0,forced:parseFloat!=Ds},{parseFloat:Ds});var Rs=function(){function t(){Ti(this,t),this.init.apply(this,arguments)}return as(t,[{key:"init",value:function(t,e){var n=0,r=0,i=Array.isArray(t)?{x:t[0],y:t[1]}:"object"===ce(t)?{x:t.x,y:t.y}:{x:t,y:e};return this.x=null==i.x?n:i.x,this.y=null==i.y?r:i.y,this}},{key:"clone",value:function(){return new t(this)}},{key:"transform",value:function(t){return this.clone().transformO(t)}},{key:"transformO",value:function(t){Fs.isMatrixLike(t)||(t=new Fs(t));var e=this.x,n=this.y;return this.x=t.a*e+t.c*n+t.e,this.y=t.b*e+t.d*n+t.f,this}},{key:"toArray",value:function(){return[this.x,this.y]}}]),t}();function Ls(t,e,n){return Math.abs(e-t)<(n||1e-6)}var Fs=function(){function h(){Ti(this,h),this.init.apply(this,arguments)}return as(h,[{key:"init",value:function(t){var e=h.fromArray([1,0,0,1,0,0]);return t=t instanceof Element?t.matrixify():"string"==typeof t?h.fromArray(t.split(go).map(parseFloat)):Array.isArray(t)?h.fromArray(t):"object"===ce(t)&&h.isMatrixLike(t)?t:"object"===ce(t)?(new h).transform(t):6===arguments.length?h.fromArray([].slice.call(arguments)):e,this.a=null!=t.a?t.a:e.a,this.b=null!=t.b?t.b:e.b,this.c=null!=t.c?t.c:e.c,this.d=null!=t.d?t.d:e.d,this.e=null!=t.e?t.e:e.e,this.f=null!=t.f?t.f:e.f,this}},{key:"clone",value:function(){return new h(this)}},{key:"transform",value:function(t){if(h.isMatrixLike(t))return new h(t).multiplyO(this);var e=h.formatTransforms(t),n=new Rs(e.ox,e.oy).transform(this),r=n.x,i=n.y,o=(new h).translateO(e.rx,e.ry).lmultiplyO(this).translateO(-r,-i).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(r,i);if(isFinite(e.px)||isFinite(e.py)){var s=new Rs(r,i).transform(o),u=e.px?e.px-s.x:0,a=e.py?e.py-s.y:0;o.translateO(u,a)}return o.translateO(e.tx,e.ty),o}},{key:"compose",value:function(t){t.origin&&(t.originX=t.origin[0],t.originY=t.origin[1]);var e=t.originX||0,n=t.originY||0,r=t.scaleX||1,i=t.scaleY||1,o=t.shear||0,s=t.rotate||0,u=t.translateX||0,a=t.translateY||0;return(new h).translateO(-e,-n).scaleO(r,i).shearO(o).rotateO(s).translateO(u,a).lmultiplyO(this).translateO(e,n)}},{key:"decompose",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=this.a,r=this.b,i=this.c,o=this.d,s=this.e,u=this.f,a=n*o-r*i,h=0<a?1:-1,l=h*Math.sqrt(n*n+r*r),c=Math.atan2(h*r,h*n),f=180/Math.PI*c,v=Math.cos(c),d=Math.sin(c),p=(n*i+r*o)/a,y=i*l/(p*n-r)||o*l/(p*r+n);return{scaleX:l,scaleY:y,shear:p,rotate:f,translateX:s-t+t*v*l+e*(p*v*l-d*y),translateY:u-e+t*d*l+e*(p*d*l+v*y),originX:t,originY:e,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}},{key:"multiply",value:function(t){return this.clone().multiplyO(t)}},{key:"multiplyO",value:function(t){var e=t instanceof h?t:new h(t);return h.matrixMultiply(this,e,this)}},{key:"lmultiply",value:function(t){return this.clone().lmultiplyO(t)}},{key:"lmultiplyO",value:function(t){var e=t instanceof h?t:new h(t);return h.matrixMultiply(e,this,this)}},{key:"inverseO",value:function(){var t=this.a,e=this.b,n=this.c,r=this.d,i=this.e,o=this.f,s=t*r-e*n;if(!s)throw new Error("Cannot invert "+this);var u=r/s,a=-e/s,h=-n/s,l=t/s,c=-(u*i+h*o),f=-(a*i+l*o);return this.a=u,this.b=a,this.c=h,this.d=l,this.e=c,this.f=f,this}},{key:"inverse",value:function(){return this.clone().inverseO()}},{key:"translate",value:function(t,e){return this.clone().translateO(t,e)}},{key:"translateO",value:function(t,e){return this.e+=t||0,this.f+=e||0,this}},{key:"scale",value:function(t,e,n,r){var i;return(i=this.clone()).scaleO.apply(i,arguments)}},{key:"scaleO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;3===arguments.length&&(r=n,n=e,e=t);var i=this.a,o=this.b,s=this.c,u=this.d,a=this.e,h=this.f;return this.a=i*t,this.b=o*e,this.c=s*t,this.d=u*e,this.e=a*t-n*t+n,this.f=h*e-r*e+r,this}},{key:"rotate",value:function(t,e,n){return this.clone().rotateO(t,e,n)}},{key:"rotateO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;t=mi(t);var r=Math.cos(t),i=Math.sin(t),o=this.a,s=this.b,u=this.c,a=this.d,h=this.e,l=this.f;return this.a=o*r-s*i,this.b=s*r+o*i,this.c=u*r-a*i,this.d=a*r+u*i,this.e=h*r-l*i+n*i-e*r+e,this.f=l*r+h*i-e*i-n*r+n,this}},{key:"flip",value:function(t,e){return this.clone().flipO(t,e)}},{key:"flipO",value:function(t,e){return"x"===t?this.scaleO(-1,1,e,0):"y"===t?this.scaleO(1,-1,0,e):this.scaleO(-1,-1,t,e||t)}},{key:"shear",value:function(t,e,n){return this.clone().shearO(t,e,n)}},{key:"shearO",value:function(t){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,n=this.a,r=this.b,i=this.c,o=this.d,s=this.e,u=this.f;return this.a=n+r*t,this.c=i+o*t,this.e=s+u*t-e*t,this}},{key:"skew",value:function(t,e,n,r){var i;return(i=this.clone()).skewO.apply(i,arguments)}},{key:"skewO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;3===arguments.length&&(r=n,n=e,e=t),t=mi(t),e=mi(e);var i=Math.tan(t),o=Math.tan(e),s=this.a,u=this.b,a=this.c,h=this.d,l=this.e,c=this.f;return this.a=s+u*i,this.b=u+s*o,this.c=a+h*i,this.d=h+a*o,this.e=l+c*i-r*i,this.f=c+l*o-n*o,this}},{key:"skewX",value:function(t,e,n){return this.skew(t,0,e,n)}},{key:"skewXO",value:function(t,e,n){return this.skewO(t,0,e,n)}},{key:"skewY",value:function(t,e,n){return this.skew(0,t,e,n)}},{key:"skewYO",value:function(t,e,n){return this.skewO(0,t,e,n)}},{key:"aroundO",value:function(t,e,n){var r=t||0,i=e||0;return this.translateO(-r,-i).lmultiplyO(n).translateO(r,i)}},{key:"around",value:function(t,e,n){return this.clone().aroundO(t,e,n)}},{key:"equals",value:function(t){var e=new h(t);return Ls(this.a,e.a)&&Ls(this.b,e.b)&&Ls(this.c,e.c)&&Ls(this.d,e.d)&&Ls(this.e,e.e)&&Ls(this.f,e.f)}},{key:"toString",value:function(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}},{key:"toArray",value:function(){return[this.a,this.b,this.c,this.d,this.e,this.f]}},{key:"valueOf",value:function(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}],[{key:"fromArray",value:function(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}},{key:"isMatrixLike",value:function(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}},{key:"formatTransforms",value:function(t){var e="both"===t.flip||!0===t.flip,n=t.flip&&(e||"x"===t.flip)?-1:1,r=t.flip&&(e||"y"===t.flip)?-1:1,i=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,o=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,s=t.scale&&t.scale.length?t.scale[0]*n:isFinite(t.scale)?t.scale*n:isFinite(t.scaleX)?t.scaleX*n:n,u=t.scale&&t.scale.length?t.scale[1]*r:isFinite(t.scale)?t.scale*r:isFinite(t.scaleY)?t.scaleY*r:r,a=t.shear||0,h=t.rotate||t.theta||0,l=new Rs(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),c=l.x,f=l.y,v=new Rs(t.position||t.px||t.positionX,t.py||t.positionY),d=v.x,p=v.y,y=new Rs(t.translate||t.tx||t.translateX,t.ty||t.translateY),m=y.x,g=y.y,w=new Rs(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:s,scaleY:u,skewX:i,skewY:o,shear:a,theta:h,rx:w.x,ry:w.y,tx:m,ty:g,ox:c,oy:f,px:d,py:p}}},{key:"matrixMultiply",value:function(t,e,n){var r=t.a*e.a+t.c*e.b,i=t.b*e.a+t.d*e.b,o=t.a*e.c+t.c*e.d,s=t.b*e.c+t.d*e.d,u=t.e+t.a*e.e+t.c*e.f,a=t.f+t.b*e.e+t.d*e.f;return n.a=r,n.b=i,n.c=o,n.d=s,n.e=u,n.f=a,n}}]),h}();function zs(){if(!zs.nodes){var t=Di().size(2,0);t.node.style.cssText=["opacity: 0","position: absolute","left: -100%","top: -100%","overflow: hidden"].join(";"),t.attr("focusable","false"),t.attr("aria-hidden","true");var e=t.path().node;zs.nodes={svg:t,path:e}}if(!zs.nodes.svg.node.parentNode){var n=Ei.document.body||Ei.document.documentElement;zs.nodes.svg.addTo(n)}return zs.nodes}function qs(t){return!(t.width||t.height||t.x||t.y)}zi(Fs,"Matrix");var Ys=function(){function s(){Ti(this,s),this.init.apply(this,arguments)}return as(s,[{key:"init",value:function(t){return t="string"==typeof t?t.split(go).map(parseFloat):Array.isArray(t)?t:"object"===ce(t)?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0]||0,this.y=t[1]||0,this.width=this.w=t[2]||0,this.height=this.h=t[3]||0,this.x2=this.x+this.w,this.y2=this.y+this.h,this.cx=this.x+this.w/2,this.cy=this.y+this.h/2,this}},{key:"merge",value:function(t){var e=Math.min(this.x,t.x),n=Math.min(this.y,t.y);return new s(e,n,Math.max(this.x+this.width,t.x+t.width)-e,Math.max(this.y+this.height,t.y+t.height)-n)}},{key:"transform",value:function(e){e instanceof Fs||(e=new Fs(e));var n=1/0,r=-1/0,i=1/0,o=-1/0;return[new Rs(this.x,this.y),new Rs(this.x2,this.y),new Rs(this.x,this.y2),new Rs(this.x2,this.y2)].forEach(function(t){t=t.transform(e),n=Math.min(n,t.x),r=Math.max(r,t.x),i=Math.min(i,t.y),o=Math.max(o,t.y)}),new s(n,i,r-n,o-i)}},{key:"addOffset",value:function(){return this.x+=Ei.window.pageXOffset,this.y+=Ei.window.pageYOffset,this}},{key:"toString",value:function(){return this.x+" "+this.y+" "+this.width+" "+this.height}},{key:"toArray",value:function(){return[this.x,this.y,this.width,this.height]}},{key:"isNulled",value:function(){return qs(this)}}]),s}();function Xs(t,e){var n,r;try{if(qs(n=t(this.node))&&((r=this.node)!==Ei.document&&!(Ei.document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===Ei.document}).call(Ei.document.documentElement,r)))throw new Error("Element not in the dom")}catch(t){n=e(this)}return n}Nr({viewbox:{viewbox:function(t,e,n,r){return null==t?new Ys(this.attr("viewBox")):this.attr("viewBox",new Ys(t,e,n,r))},zoom:function(t,e){var n=this.node.clientWidth,r=this.node.clientHeight,i=this.viewbox();if(!n&&!r){var o=window.getComputedStyle(this.node);n=parseFloat(o.getPropertyValue("width")),r=parseFloat(o.getPropertyValue("height"))}var s=n/i.width,u=r/i.height,a=Math.min(s,u);if(null==t)return a;var h=a/t;h===1/0&&(h=Number.MIN_VALUE),e=e||new Rs(n/2/s+i.x,r/2/u+i.y);var l=new Ys(i).transform(new Fs({scale:h,origin:e}));return this.viewbox(l)}}}),zi(Ys,"Box");var Gs=function(){try{return Function("name","baseClass","_constructor",["baseClass = baseClass || Array","return {"," [name]: class extends baseClass {"," constructor (...args) {"," super(...args)"," _constructor && _constructor.apply(this, args)"," }"," }","}[name]"].join("\n"))}catch(t){return function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Array,n=2<arguments.length?arguments[2]:void 0,r=function(){e.apply(this,arguments),n&&n.apply(this,arguments)};return((r.prototype=Object.create(e.prototype)).constructor=r).prototype.map=function(t){var e=new r;return e.push.apply(e,Array.prototype.map.call(this,t)),e},r}}}(),Vs=Gs("List",Array,function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];if("number"==typeof t)return this;this.length=0,this.push.apply(this,Cr(t))});Vi(Vs,{each:function(e){for(var t=arguments.length,n=new Array(1<t?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"function"==typeof e?this.map(function(t){return e.call(t,t)}):this.map(function(t){return t[e].apply(t,n)})},toArray:function(){return Array.prototype.concat.apply([],this)}});var Hs=["toArray","constructor","each"];function Bs(t,e){return new Vs(yi((e||Ei.document).querySelectorAll(t),function(t){return Li(t)}))}Vs.extend=function(t){t=t.reduce(function(t,r){return Hs.includes(r)||"_"===r[0]||(t[r]=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.each.apply(this,[r].concat(e))}),t},{}),Vi(Vs,t)};var Us=function(t){function r(){var t,e=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).events,n=void 0===e?{}:e;return Ti(this,r),(t=ps(this,ys(r).call(this))).events=n,t}return ws(r,Ci),as(r,[{key:"addEventListener",value:function(){}},{key:"dispatch",value:function(t,e){return Fo(this,t,e)}},{key:"dispatchEvent",value:function(t){var e=this.getEventHolder().events;if(!e)return!0;var n=e[t.type];for(var r in n)for(var i in n[r])n[r][i](t);return!t.defaultPrevented}},{key:"fire",value:function(t,e){return this.dispatch(t,e),this}},{key:"getEventHolder",value:function(){return this}},{key:"getEventTarget",value:function(){return this}},{key:"off",value:function(t,e){return Lo(this,t,e),this}},{key:"on",value:function(t,e,n,r){return Ro(this,t,e,n,r),this}},{key:"removeEventListener",value:function(){}}]),r}();function $s(){}zi(Us,"EventTarget");var Qs={duration:400,ease:">",delay:0},Ws={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","text-anchor":"start"},Js={__proto__:null,noop:$s,timeline:Qs,attrs:Ws},Zs=Gs("SVGArray",Array,function(t){this.init(t)});Vi(Zs,{init:function(t){return"number"==typeof t||(this.length=0,this.push.apply(this,Cr(this.parse(t)))),this},toArray:function(){return Array.prototype.concat.apply([],this)},toString:function(){return this.join(" ")},valueOf:function(){var t=[];return t.push.apply(t,Cr(this)),t},parse:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];return t instanceof Array?t:t.trim().split(go).map(parseFloat)},clone:function(){return new this.constructor(this)},toSet:function(){return new Set(this)}});var Ks=function(){function n(){Ti(this,n),this.init.apply(this,arguments)}return as(n,[{key:"init",value:function(t,e){return e=Array.isArray(t)?t[1]:e,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=e||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(e=t.match(so))&&(this.value=parseFloat(e[1]),"%"===e[5]?this.value/=100:"s"===e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof n&&(this.value=t.valueOf(),this.unit=t.unit),this}},{key:"toString",value:function(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}},{key:"toJSON",value:function(){return this.toString()}},{key:"toArray",value:function(){return[this.value,this.unit]}},{key:"valueOf",value:function(){return this.value}},{key:"plus",value:function(t){return new n(this+(t=new n(t)),this.unit||t.unit)}},{key:"minus",value:function(t){return new n(this-(t=new n(t)),this.unit||t.unit)}},{key:"times",value:function(t){return new n(this*(t=new n(t)),this.unit||t.unit)}},{key:"divide",value:function(t){return new n(this/(t=new n(t)),this.unit||t.unit)}},{key:"convert",value:function(t){return new n(this.value,t)}}]),n}(),tu=[];var Dom=function(t){function Dom(t,e){var n;return Ti(this,Dom),(n=ps(this,ys(Dom).call(this,t))).node=t,n.type=t.nodeName,e&&t!==e&&n.attr(e),n}return ws(Dom,Us),as(Dom,[{key:"add",value:function(t,e){return t=Di(t),null==e?this.node.appendChild(t.node):t.node!==this.node.childNodes[e]&&this.node.insertBefore(t.node,this.node.childNodes[e]),this}},{key:"addTo",value:function(t){return Di(t).put(this)}},{key:"children",value:function(){return new Vs(yi(this.node.children,function(t){return Li(t)}))}},{key:"clear",value:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}},{key:"clone",value:function(){return this.writeDataToDom(),Gi(this.node.cloneNode(!0))}},{key:"each",value:function(t,e){var n,r,i=this.children();for(n=0,r=i.length;n<r;n++)t.apply(i[n],[n,i]),e&&i[n].each(t,e);return this}},{key:"element",value:function(t){return this.put(new Dom(Ni(t)))}},{key:"first",value:function(){return Li(this.node.firstChild)}},{key:"get",value:function(t){return Li(this.node.childNodes[t])}},{key:"getEventHolder",value:function(){return this.node}},{key:"getEventTarget",value:function(){return this.node}},{key:"has",value:function(t){return 0<=this.index(t)}},{key:"id",value:function(t){return void 0!==t||this.node.id||(this.node.id=Xi(this.type)),this.attr("id",t)}},{key:"index",value:function(t){return[].slice.call(this.node.childNodes).indexOf(t.node)}},{key:"last",value:function(){return Li(this.node.lastChild)}},{key:"matches",value:function(t){var e=this.node;return(e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector).call(e,t)}},{key:"parent",value:function(t){var e=this;if(!e.node.parentNode)return null;if(e=Li(e.node.parentNode),!t)return e;for(;e;){if("string"==typeof t?e.matches(t):e instanceof t)return e;if(!e.node.parentNode||"#document"===e.node.parentNode.nodeName||"#document-fragment"===e.node.parentNode.nodeName)return null;e=Li(e.node.parentNode)}}},{key:"put",value:function(t,e){return this.add(t,e),t}},{key:"putIn",value:function(t){return Di(t).add(this)}},{key:"remove",value:function(){return this.parent()&&this.parent().removeElement(this),this}},{key:"removeElement",value:function(t){return this.node.removeChild(t.node),this}},{key:"replace",value:function(t){return t=Di(t),this.node.parentNode.replaceChild(t.node,this.node),t}},{key:"round",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:2,e=1<arguments.length?arguments[1]:void 0,n=Math.pow(10,t),r=this.attr();e||(e=Object.keys(r));var i={};return e.forEach(function(t){i[t]=Math.round(r[t]*n)/n}),this.attr(i),this}},{key:"toString",value:function(){return this.id()}},{key:"svg",value:function(n,t){var e,r,i;if(!1===n&&(t=!1,n=null),null==n||"function"==typeof n){t=null==t||t,this.writeDataToDom();var o=this;if(null!=n){if(o=Li(o.node.cloneNode(!0)),t){var s=n(o);if(o=s||o,!1===s)return""}o.each(function(){var t=n(this),e=t||this;!1===t?this.remove():t&&this!==e&&this.replace(e)},!0)}return t?o.node.outerHTML:o.node.innerHTML}for(t=null!=t&&t,e=Ei.document.createElementNS(Oi,"svg"),i=Ei.document.createDocumentFragment(),e.innerHTML=n,r=e.children.length;r--;)i.appendChild(e.firstElementChild);var u=this.parent();return t?this.replace(i)&&u:this.add(i)}},{key:"words",value:function(t){return this.node.textContent=t,this}},{key:"writeDataToDom",value:function(){return this.each(function(){this.writeDataToDom()}),this}}]),Dom}();Vi(Dom,{attr:function(n,t,e){var r=this;if(null==n){n={},t=this.node.attributes;var i=!0,o=!1,s=void 0;try{for(var u,a=t[Symbol.iterator]();!(i=(u=a.next()).done);i=!0){var h=u.value;n[h.nodeName]=yo.test(h.nodeValue)?parseFloat(h.nodeValue):h.nodeValue}}catch(t){o=!0,s=t}finally{try{i||null==a.return||a.return()}finally{if(o)throw s}}return n}if(n instanceof Array)return n.reduce(function(t,e){return t[e]=r.attr(e),t},{});if("object"===ce(n)&&n.constructor===Object)for(t in n)this.attr(t,n[t]);else if(null===t)this.node.removeAttribute(n);else{if(null==t)return null==(t=this.node.getAttribute(n))?Ws[n]:yo.test(t)?parseFloat(t):t;"number"==typeof(t=tu.reduce(function(t,e){return e(n,t,r)},t))?t=new Ks(t):fs.isColor(t)?t=new fs(t):t.constructor===Array&&(t=new Zs(t)),"leading"===n?this.leading&&this.leading(t):"string"==typeof e?this.node.setAttributeNS(e,n,t.toString()):this.node.setAttribute(n,t.toString()),!this.rebuild||"font-size"!==n&&"x"!==n||this.rebuild()}return this},find:function(t){return Bs(t,this.node)},findOne:function(t){return Li(this.node.querySelector(t))}}),zi(Dom,"Dom");var Element=function(t){function Element(t,e){var n;return Ti(this,Element),(n=ps(this,ys(Element).call(this,t,e))).dom={},n.node.instance=ds(n),t.hasAttribute("svgjs:data")&&n.setData(JSON.parse(t.getAttribute("svgjs:data"))||{}),n}return ws(Element,Dom),as(Element,[{key:"center",value:function(t,e){return this.cx(t).cy(e)}},{key:"cx",value:function(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)}},{key:"cy",value:function(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)}},{key:"defs",value:function(){return this.root().defs()}},{key:"dmove",value:function(t,e){return this.dx(t).dy(e)}},{key:"dx",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return this.x(new Ks(t).plus(this.x()))}},{key:"dy",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return this.y(new Ks(t).plus(this.y()))}},{key:"root",value:function(){var t=this.parent(qi(Ii));return t&&t.root()}},{key:"getEventHolder",value:function(){return this}},{key:"height",value:function(t){return this.attr("height",t)}},{key:"inside",value:function(t,e){var n=this.bbox();return t>n.x&&e>n.y&&t<n.x+n.width&&e<n.y+n.height}},{key:"move",value:function(t,e){return this.x(t).y(e)}},{key:"parents",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Ei.document;t=Di(t);for(var e=new Vs,n=this;(n=n.parent())&&n.node!==t.node&&n.node!==Ei.document;)e.push(n);return e}},{key:"reference",value:function(t){if(!(t=this.attr(t)))return null;var e=t.match(ho);return e?Di(e[1]):null}},{key:"setData",value:function(t){return this.dom=t,this}},{key:"size",value:function(t,e){var n=_i(this,t,e);return this.width(new Ks(n.width)).height(new Ks(n.height))}},{key:"width",value:function(t){return this.attr("width",t)}},{key:"writeDataToDom",value:function(){return this.node.removeAttribute("svgjs:data"),Object.keys(this.dom).length&&this.node.setAttribute("svgjs:data",JSON.stringify(this.dom)),ms(ys(Element.prototype),"writeDataToDom",this).call(this)}},{key:"x",value:function(t){return this.attr("x",t)}},{key:"y",value:function(t){return this.attr("y",t)}}]),Element}();Vi(Element,{bbox:function(){return new Ys(Xs.call(this,function(t){return t.getBBox()},function(e){try{var t=e.clone().addTo(zs().svg).show(),n=t.node.getBBox();return t.remove(),n}catch(t){throw new Error('Getting bbox of element "'+e.node.nodeName+'" is not possible. '+t.toString())}}))},rbox:function(t){var e=new Ys(Xs.call(this,function(t){return t.getBoundingClientRect()},function(t){throw new Error('Getting rbox of element "'+t.node.nodeName+'" is not possible')}));return t?e.transform(t.screenCTM().inverse()):e.addOffset()},point:function(t,e){return new Rs(t,e).transform(this.screenCTM().inverse())},ctm:function(){return new Fs(this.node.getCTM())},screenCTM:function(){if("function"!=typeof this.isRoot||this.isRoot())return new Fs(this.node.getScreenCTM());var t=this.rect(1,1),e=t.node.getScreenCTM();return t.remove(),new Fs(e)}}),zi(Element,"Element");var eu={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(t,e){return"color"===e?t:t+"-"+e}};["fill","stroke"].forEach(function(e){var n,t={};t[e]=function(t){if(void 0===t)return this.attr(e);if("string"==typeof t||t instanceof fs||fs.isRgb(t)||t instanceof Element)this.attr(e,t);else for(n=eu[e].length-1;0<=n;n--)null!=t[eu[e][n]]&&this.attr(eu.prefix(e,eu[e][n]),t[eu[e][n]]);return this},Nr(["Element","Runner"],t)}),Nr(["Element","Runner"],{matrix:function(t,e,n,r,i,o){return null==t?new Fs(this):this.attr("transform",new Fs(t,e,n,r,i,o))},rotate:function(t,e,n){return this.transform({rotate:t,ox:e,oy:n},!0)},skew:function(t,e,n,r){return 1===arguments.length||3===arguments.length?this.transform({skew:t,ox:e,oy:n},!0):this.transform({skew:[t,e],ox:n,oy:r},!0)},shear:function(t,e,n){return this.transform({shear:t,ox:e,oy:n},!0)},scale:function(t,e,n,r){return 1===arguments.length||3===arguments.length?this.transform({scale:t,ox:e,oy:n},!0):this.transform({scale:[t,e],ox:n,oy:r},!0)},translate:function(t,e){return this.transform({translate:[t,e]},!0)},relative:function(t,e){return this.transform({relative:[t,e]},!0)},flip:function(t,e){var n="string"==typeof t?t:(isFinite(t),"both"),r="both"===t&&isFinite(e)?[e,e]:"x"===t?[e,0]:"y"===t?[0,e]:isFinite(t)?[t,t]:[0,0];return this.transform({flip:n,origin:r},!0)},opacity:function(t){return this.attr("opacity",t)}}),Nr("radius",{radius:function(t,e){var n=(this._element||this).type;return"radialGradient"===n||"radialGradient"===n?this.attr("r",new Ks(t)):this.rx(t).ry(null==e?t:e)}}),Nr("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new Rs(this.node.getPointAtLength(t))}}),Nr(["Element","Runner"],{font:function(t,e){if("object"!==ce(t))return"leading"===t?this.leading(e):"anchor"===t?this.attr("text-anchor",e):"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?this.attr("font-"+t,e):this.attr(t,e);for(e in t)this.font(e,t[e]);return this}}),Nr("Text",{ax:function(t){return this.attr("x",t)},ay:function(t){return this.attr("y",t)},amove:function(t,e){return this.ax(t).ay(e)}}),Nr("Element",["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel"].reduce(function(t,e){return t[e]=function(t){return null===t?Lo(this,e):Ro(this,e,t),this},t},{}));var nu=[].reverse,ru=[1,2];Ct({target:"Array",proto:!0,forced:String(ru)===String(ru.reverse())},{reverse:function(){return Ft(this)&&(this.length=this.length),nu.call(this)}}),Ct({target:"Object",stat:!0,forced:!f,sham:!f},{defineProperties:fe}),Ct({target:"Object",stat:!0,forced:!f,sham:!f},{defineProperty:P.f});var iu=E.f,ou=m(function(){iu(1)});function su(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function au(t){return this.attr("rx",t)}function hu(t){return this.attr("ry",t)}function lu(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function cu(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function fu(t){return null==t?this.attr("cx"):this.attr("cx",t)}function vu(t){return null==t?this.attr("cy"):this.attr("cy",t)}function du(t){return null==t?2*this.rx():this.rx(new Ks(t).divide(2))}function pu(t){return null==t?2*this.ry():this.ry(new Ks(t).divide(2))}Ct({target:"Object",stat:!0,forced:!f||ou,sham:!f},{getOwnPropertyDescriptor:function(t,e){return iu(d(t),e)}}),Ct({target:"Object",stat:!0,sham:!f},{getOwnPropertyDescriptors:function(t){for(var e,n,r=d(t),i=E.f,o=_t(r),s={},u=0;o.length>u;)void 0!==(n=i(r,e=o[u++]))&&zt(s,e,n);return s}}),Nr("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(lo).slice(0,-1).map(function(t){var e=t.trim().split("(");return[e[0],e[1].split(go).map(function(t){return parseFloat(t)})]}).reverse().reduce(function(t,e){return"matrix"===e[0]?t.lmultiply(Fs.fromArray(e[1])):t[e[0]].apply(t,e[1])},new Fs)},toParent:function(t){if(this===t)return this;var e=this.screenCTM(),n=t.screenCTM().inverse();return this.addTo(t).untransform().transform(n.multiply(e)),this},toRoot:function(){return this.toParent(this.root())},transform:function(t,e){if(null==t||"string"==typeof t){var n=new Fs(this).decompose();return null==t?n:n[t]}Fs.isMatrixLike(t)||(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?uu(n,!0).forEach(function(t){su(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uu(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},t,{origin:xi(t,this)}));var r=new Fs(!0===e?this:e||!1).transform(t);return this.attr("transform",r)}});var yu={__proto__:null,rx:au,ry:hu,x:lu,y:cu,cx:fu,cy:vu,width:du,height:pu},Shape=function(t){function Shape(){return Ti(this,Shape),ps(this,ys(Shape).apply(this,arguments))}return ws(Shape,Element),Shape}();zi(Shape,"Shape");var Circle=function(t){function Circle(t){return Ti(this,Circle),ps(this,ys(Circle).call(this,Ri("circle",t),t))}return ws(Circle,Shape),as(Circle,[{key:"radius",value:function(t){return this.attr("r",t)}},{key:"rx",value:function(t){return this.attr("r",t)}},{key:"ry",value:function(t){return this.rx(t)}},{key:"size",value:function(t){return this.radius(new Ks(t).divide(2))}}]),Circle}();Vi(Circle,{x:lu,y:cu,cx:fu,cy:vu,width:du,height:pu}),Nr({Container:{circle:Hi(function(t){return this.put(new Circle).size(t).move(0,0)})}}),zi(Circle,"Circle");var Container=function(t){function Container(){return Ti(this,Container),ps(this,ys(Container).apply(this,arguments))}return ws(Container,Element),as(Container,[{key:"flatten",value:function(t){return this.each(function(){return this instanceof Container?this.flatten(t).ungroup(t):this.toParent(t)}),this.node.firstElementChild||this.remove(),this}},{key:"ungroup",value:function(t){return t=t||this.parent(),this.each(function(){return this.toParent(t)}),this.remove(),this}}]),Container}();zi(Container,"Container");var Defs=function(t){function Defs(t){return Ti(this,Defs),ps(this,ys(Defs).call(this,Ri("defs",t),t))}return ws(Defs,Container),as(Defs,[{key:"flatten",value:function(){return this}},{key:"ungroup",value:function(){return this}}]),Defs}();zi(Defs,"Defs");var Ellipse=function(t){function Ellipse(t){return Ti(this,Ellipse),ps(this,ys(Ellipse).call(this,Ri("ellipse",t),t))}return ws(Ellipse,Shape),as(Ellipse,[{key:"size",value:function(t,e){var n=_i(this,t,e);return this.rx(new Ks(n.width).divide(2)).ry(new Ks(n.height).divide(2))}}]),Ellipse}();Vi(Ellipse,yu),Nr("Container",{ellipse:Hi(function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t;return this.put(new Ellipse).size(t,e).move(0,0)})}),zi(Ellipse,"Ellipse");var Stop=function(t){function Stop(t){return Ti(this,Stop),ps(this,ys(Stop).call(this,Ri("stop",t),t))}return ws(Stop,Element),as(Stop,[{key:"update",value:function(t){return("number"==typeof t||t instanceof Ks)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new Ks(t.offset)),this}}]),Stop}();function mu(t,e){return"radialGradient"===(this._element||this).type?this.attr({fx:new Ks(t),fy:new Ks(e)}):this.attr({x1:new Ks(t),y1:new Ks(e)})}function gu(t,e){return"radialGradient"===(this._element||this).type?this.attr({cx:new Ks(t),cy:new Ks(e)}):this.attr({x2:new Ks(t),y2:new Ks(e)})}zi(Stop,"Stop");var wu={__proto__:null,from:mu,to:gu},Gradient=function(t){function Gradient(t,e){return Ti(this,Gradient),ps(this,ys(Gradient).call(this,Ri(t+"Gradient","string"==typeof t?null:t),e))}return ws(Gradient,Container),as(Gradient,[{key:"stop",value:function(t,e,n){return this.put(new Stop).update(t,e,n)}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"url",value:function(){return"url(#"+this.id()+")"}},{key:"toString",value:function(){return this.url()}},{key:"attr",value:function(t,e,n){return"transform"===t&&(t="gradientTransform"),ms(ys(Gradient.prototype),"attr",this).call(this,t,e,n)}},{key:"targets",value:function(){return Bs('svg [fill*="'+this.id()+'"]')}},{key:"bbox",value:function(){return new Ys}}]),Gradient}();Vi(Gradient,wu),Nr({Container:{gradient:Hi(function(t,e){return this.defs().gradient(t,e)})},Defs:{gradient:Hi(function(t,e){return this.put(new Gradient(t)).update(e)})}}),zi(Gradient,"Gradient");var Pattern=function(t){function Pattern(t){return Ti(this,Pattern),ps(this,ys(Pattern).call(this,Ri("pattern",t),t))}return ws(Pattern,Container),as(Pattern,[{key:"url",value:function(){return"url(#"+this.id()+")"}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"toString",value:function(){return this.url()}},{key:"attr",value:function(t,e,n){return"transform"===t&&(t="patternTransform"),ms(ys(Pattern.prototype),"attr",this).call(this,t,e,n)}},{key:"targets",value:function(){return Bs('svg [fill*="'+this.id()+'"]')}},{key:"bbox",value:function(){return new Ys}}]),Pattern}();Nr({Container:{pattern:function(){var t;return(t=this.defs()).pattern.apply(t,arguments)}},Defs:{pattern:Hi(function(t,e,n){return this.put(new Pattern).update(n).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})})}}),zi(Pattern,"Pattern");var bu,Image=function(t){function Image(t){return Ti(this,Image),ps(this,ys(Image).call(this,Ri("image",t),t))}return ws(Image,Shape),as(Image,[{key:"load",value:function(t,n){if(!t)return this;var r=new Ei.window.Image;return Ro(r,"load",function(t){var e=this.parent(Pattern);0===this.width()&&0===this.height()&&this.size(r.width,r.height),e instanceof Pattern&&0===e.width()&&0===e.height()&&e.size(this.width(),this.height()),"function"==typeof n&&n.call(this,t)},this),Ro(r,"load error",function(){Lo(r)}),this.attr("href",r.src=t,Ai)}}]),Image}();bu=function(t,e,n){return"fill"!==t&&"stroke"!==t||mo.test(e)&&(e=n.root().defs().image(e)),e instanceof Image&&(e=n.root().defs().pattern(0,0,function(t){t.add(e)})),e},tu.push(bu),Nr({Container:{image:Hi(function(t,e){return this.put(new Image).size(0,0).load(t,e)})}}),zi(Image,"Image");var _u=Gs("PointArray",Zs);Vi(_u,{toString:function(){for(var t=0,e=this.length,n=[];t<e;t++)n.push(this[t].join(","));return n.join(" ")},toLine:function(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}},at:function(t){if(!this.destination)return this;for(var e=0,n=this.length,r=[];e<n;e++)r.push([this[e][0]+(this.destination[e][0]-this[e][0])*t,this[e][1]+(this.destination[e][1]-this[e][1])*t]);return new _u(r)},parse:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[[0,0]],e=[];if(t instanceof Array){if(t[0]instanceof Array)return t}else t=t.trim().split(go).map(parseFloat);t.length%2!=0&&t.pop();for(var n=0,r=t.length;n<r;n+=2)e.push([t[n],t[n+1]]);return e},transform:function(t){for(var e=[],n=0;n<this.length;n++){var r=this[n];e.push([t.a*r[0]+t.c*r[1]+t.e,t.b*r[0]+t.d*r[1]+t.f])}return new _u(e)},move:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var r=this.length-1;0<=r;r--)this[r]=[this[r][0]+t,this[r][1]+e];return this},size:function(t,e){var n,r=this.bbox();for(n=this.length-1;0<=n;n--)r.width&&(this[n][0]=(this[n][0]-r.x)*t/r.width+r.x),r.height&&(this[n][1]=(this[n][1]-r.y)*e/r.height+r.y);return this},bbox:function(){var e=-1/0,n=-1/0,r=1/0,i=1/0;return this.forEach(function(t){e=Math.max(t[0],e),n=Math.max(t[1],n),r=Math.min(t[0],r),i=Math.min(t[1],i)}),{x:r,y:i,width:e-r,height:n-i}}});var xu={__proto__:null,MorphArray:_u,x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)},width:function(t){var e=this.bbox();return null==t?e.width:this.size(t,e.height)},height:function(t){var e=this.bbox();return null==t?e.height:this.size(e.width,t)}},Line=function(t){function Line(t){return Ti(this,Line),ps(this,ys(Line).call(this,Ri("line",t),t))}return ws(Line,Shape),as(Line,[{key:"array",value:function(){return new _u([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])}},{key:"plot",value:function(t,e,n,r){return null==t?this.array():(t=void 0!==e?{x1:t,y1:e,x2:n,y2:r}:new _u(t).toLine(),this.attr(t))}},{key:"move",value:function(t,e){return this.attr(this.array().move(t,e).toLine())}},{key:"size",value:function(t,e){var n=_i(this,t,e);return this.attr(this.array().size(n.width,n.height).toLine())}}]),Line}();Vi(Line,xu),Nr({Container:{line:Hi(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Line.prototype.plot.apply(this.put(new Line),null!=e[0]?e:[0,0,0,0])})}}),zi(Line,"Line");var Marker=function(t){function Marker(t){return Ti(this,Marker),ps(this,ys(Marker).call(this,Ri("marker",t),t))}return ws(Marker,Container),as(Marker,[{key:"width",value:function(t){return this.attr("markerWidth",t)}},{key:"height",value:function(t){return this.attr("markerHeight",t)}},{key:"ref",value:function(t,e){return this.attr("refX",t).attr("refY",e)}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"toString",value:function(){return"url(#"+this.id()+")"}}]),Marker}();Nr({Container:{marker:function(){var t;return(t=this.defs()).marker.apply(t,arguments)}},Defs:{marker:Hi(function(t,e,n){return this.put(new Marker).size(t,e).ref(t/2,e/2).viewbox(0,0,t,e).attr("orient","auto").update(n)})},marker:{marker:function(t,e,n,r){var i=["marker"];return"all"!==t&&i.push(t),i=i.join("-"),t=e instanceof Marker?e:this.defs().marker(e,n,r),this.attr(i,t)}}}),zi(Marker,"Marker");var ku=[].sort,Ou=[1,2,3],Su=m(function(){Ou.sort(void 0)}),Au=m(function(){Ou.sort(null)}),ju=Ui("sort");function Mu(e,n){return function(t){return null==t?this[t]:(this[e]=t,n&&n.call(this),this)}}Ct({target:"Array",proto:!0,forced:Su||!Au||ju},{sort:function(t){return void 0===t?ku.call(It(this)):ku.call(It(this),Se(t))}});var Eu={"-":function(t){return t},"<>":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(e,n,r,i){return function(t){return t<0?0<e?n/e*t:0<r?i/r*t:0:1<t?r<1?(1-i)/(1-r)*t+(i-r)/(1-r):e<1?(1-n)/(1-e)*t+(n-e)/(1-e):1:3*t*Math.pow(1-t,2)*n+3*Math.pow(t,2)*(1-t)*i+Math.pow(t,3)}},steps:function(i){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"end";o=o.split("-").reverse()[0];var s=i;return"none"===o?--s:"both"===o&&++s,function(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],n=Math.floor(t*i),r=t*n%1==0;return"start"!==o&&"both"!==o||++n,e&&r&&--n,0<=t&&n<0&&(n=0),t<=1&&s<n&&(n=s),n/s}}},Tu=function(){function t(){Ti(this,t)}return as(t,[{key:"done",value:function(){return!1}}]),t}(),Cu=function(t){function n(t){var e;return Ti(this,n),(e=ps(this,ys(n).call(this))).ease=Eu[t||Qs.ease]||t,e}return ws(n,Tu),as(n,[{key:"step",value:function(t,e,n){return"number"!=typeof t?n<1?t:e:t+(e-t)*this.ease(n)}}]),n}(),Pu=function(t){function n(t){var e;return Ti(this,n),(e=ps(this,ys(n).call(this))).stepper=t,e}return ws(n,Tu),as(n,[{key:"step",value:function(t,e,n,r){return this.stepper(t,e,n,r)}},{key:"done",value:function(t){return t.done}}]),n}();function Iu(){var t=(this._duration||500)/1e3,e=this._overshoot||0,n=Math.PI,r=Math.log(e/100+1e-10),i=-r/Math.sqrt(n*n+r*r),o=3.9/(i*t);this.d=2*i*o,this.k=o*o}var Nu=function(t){function r(t,e){var n;return Ti(this,r),(n=ps(this,ys(r).call(this))).duration(t||500).overshoot(e||0),n}return ws(r,Pu),as(r,[{key:"step",value:function(t,e,n,r){if("string"==typeof t)return t;if(r.done=n===1/0,n===1/0)return e;if(0===n)return t;100<n&&(n=16),n/=1e3;var i=r.velocity||0,o=-this.d*i-this.k*(t-e),s=t+i*n+o*n*n/2;return r.velocity=i+o*n,r.done=Math.abs(e-s)+Math.abs(i)<.002,r.done?e:s}}]),r}();Vi(Nu,{duration:Mu("_duration",Iu),overshoot:Mu("_overshoot",Iu)});var Du=function(t){function o(t,e,n,r){var i;return Ti(this,o),t=null==t?.1:t,e=null==e?.01:e,n=null==n?0:n,r=null==r?1e3:r,(i=ps(this,ys(o).call(this))).p(t).i(e).d(n).windup(r),i}return ws(o,Pu),as(o,[{key:"step",value:function(t,e,n,r){if("string"==typeof t)return t;if(r.done=n===1/0,n===1/0)return e;if(0===n)return t;var i=e-t,o=(r.integral||0)+i*n,s=(i-(r.error||0))/n,u=this.windup;return!1!==u&&(o=Math.max(-u,Math.min(o,u))),r.error=i,r.integral=o,r.done=Math.abs(i)<.001,r.done?e:t+(this.P*i+this.I*o+this.D*s)}}]),o}();Vi(Du,{windup:Mu("windup"),p:Mu("P"),i:Mu("I"),d:Mu("D")});var Ru=Gs("PathArray",Zs);function Lu(t,e,n,r){return n+r.replace(ko," .")}for(var Fu={M:function(t,e,n){return e.x=n.x=t[0],e.y=n.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,e){return e.x=t[2],e.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,e){return e.x=t[0],e.y=t[1],["T",t[0],t[1]]},Z:function(t,e,n){return e.x=n.x,e.y=n.y,["Z"]},A:function(t,e){return e.x=t[5],e.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},zu="mlhvqtcsaz".split(""),qu=0,Yu=zu.length;qu<Yu;++qu)Fu[zu[qu]]=function(o){return function(t,e,n){if("H"===o)t[0]=t[0]+e.x;else if("V"===o)t[0]=t[0]+e.y;else if("A"===o)t[5]=t[5]+e.x,t[6]=t[6]+e.y;else for(var r=0,i=t.length;r<i;++r)t[r]=t[r]+(r%2?e.y:e.x);return Fu[o](t,e,n)}}(zu[qu].toUpperCase());Vi(Ru,{toString:function(){return function(t){for(var e=0,n=t.length,r="";e<n;e++)r+=t[e][0],null!=t[e][1]&&(r+=t[e][1],null!=t[e][2]&&(r+=" ",r+=t[e][2],null!=t[e][3]&&(r+=" ",r+=t[e][3],r+=" ",r+=t[e][4],null!=t[e][5]&&(r+=" ",r+=t[e][5],r+=" ",r+=t[e][6],null!=t[e][7]&&(r+=" ",r+=t[e][7])))));return r+" "}(this)},move:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var r,i=this.length-1;0<=i;i--)"M"===(r=this[i][0])||"L"===r||"T"===r?(this[i][1]+=t,this[i][2]+=e):"H"===r?this[i][1]+=t:"V"===r?this[i][1]+=e:"C"===r||"S"===r||"Q"===r?(this[i][1]+=t,this[i][2]+=e,this[i][3]+=t,this[i][4]+=e,"C"===r&&(this[i][5]+=t,this[i][6]+=e)):"A"===r&&(this[i][6]+=t,this[i][7]+=e);return this},size:function(t,e){var n,r,i=this.bbox();for(i.width=0===i.width?1:i.width,i.height=0===i.height?1:i.height,n=this.length-1;0<=n;n--)"M"===(r=this[n][0])||"L"===r||"T"===r?(this[n][1]=(this[n][1]-i.x)*t/i.width+i.x,this[n][2]=(this[n][2]-i.y)*e/i.height+i.y):"H"===r?this[n][1]=(this[n][1]-i.x)*t/i.width+i.x:"V"===r?this[n][1]=(this[n][1]-i.y)*e/i.height+i.y:"C"===r||"S"===r||"Q"===r?(this[n][1]=(this[n][1]-i.x)*t/i.width+i.x,this[n][2]=(this[n][2]-i.y)*e/i.height+i.y,this[n][3]=(this[n][3]-i.x)*t/i.width+i.x,this[n][4]=(this[n][4]-i.y)*e/i.height+i.y,"C"===r&&(this[n][5]=(this[n][5]-i.x)*t/i.width+i.x,this[n][6]=(this[n][6]-i.y)*e/i.height+i.y)):"A"===r&&(this[n][1]=this[n][1]*t/i.width,this[n][2]=this[n][2]*e/i.height,this[n][6]=(this[n][6]-i.x)*t/i.width+i.x,this[n][7]=(this[n][7]-i.y)*e/i.height+i.y);return this},equalCommands:function(t){var e,n,r;for(t=new Ru(t),r=this.length===t.length,e=0,n=this.length;r&&e<n;e++)r=this[e][0]===t[e][0];return r},morph:function(t){return t=new Ru(t),this.equalCommands(t)?this.destination=t:this.destination=null,this},at:function(t){if(!this.destination)return this;var e,n,r,i,o=this,s=this.destination.value,u=[],a=new Ru;for(e=0,n=o.length;e<n;e++){for(u[e]=[o[e][0]],r=1,i=o[e].length;r<i;r++)u[e][r]=o[e][r]+(s[e][r]-o[e][r])*t;"A"===u[e][0]&&(u[e][4]=+(0!==u[e][4]),u[e][5]=+(0!==u[e][5]))}return a.value=u,a},parse:function(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[["M",0,0]];if(e instanceof Ru)return e;var n={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};e="string"==typeof e?e.replace(xo,Lu).replace(bo," $& ").replace(wo,"$1 -").trim().split(go):e.reduce(function(t,e){return[].concat.call(t,e)},[]);for(var r=[],i=new Rs,o=new Rs,s=0,u=e.length;_o.test(e[s])?(t=e[s],++s):"M"===t?t="L":"m"===t&&(t="l"),r.push(Fu[t].call(null,e.slice(s,s+=n[t.toUpperCase()]).map(parseFloat),i,o)),s<u;);return r},bbox:function(){return zs().path.setAttribute("d",this.toString()),zs.nodes.path.getBBox()}});var Xu=function(){function e(t){Ti(this,e),this._stepper=t||new Cu("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}return as(e,[{key:"from",value:function(t){return null==t?this._from:(this._from=this._set(t),this)}},{key:"to",value:function(t){return null==t?this._to:(this._to=this._set(t),this)}},{key:"type",value:function(t){return null==t?this._type:(this._type=t,this)}},{key:"_set",value:function(t){if(!this._type){var e=ce(t);"number"===e?this.type(Ks):"string"===e?fs.isColor(t)?this.type(fs):go.test(t)?this.type(bo.test(t)?Ru:Zs):so.test(t)?this.type(Ks):this.type(Gu):-1<Bu.indexOf(t.constructor)?this.type(t.constructor):Array.isArray(t)?this.type(Zs):"object"===e?this.type(Hu):this.type(Gu)}var n=new this._type(t);return this._type===fs&&(n=this._to?n[this._to[4]]():this._from?n[this._from[4]]():n),n=n.toArray(),this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(n.length)).map(Object).map(function(t){return t.done=!0,t}),n}},{key:"stepper",value:function(t){return null==t?this._stepper:(this._stepper=t,this)}},{key:"done",value:function(){return this._context.map(this._stepper.done).reduce(function(t,e){return t&&e},!0)}},{key:"at",value:function(n){var r=this;return this._morphObj.fromArray(this._from.map(function(t,e){return r._stepper.step(t,r._to[e],n,r._context[e],r._context)}))}}]),e}(),Gu=function(){function t(){Ti(this,t),this.init.apply(this,arguments)}return as(t,[{key:"init",value:function(t){return t=Array.isArray(t)?t[0]:t,this.value=t,this}},{key:"valueOf",value:function(){return this.value}},{key:"toArray",value:function(){return[this.value]}}]),t}(),Vu=function(){function e(){Ti(this,e),this.init.apply(this,arguments)}return as(e,[{key:"init",value:function(t){return Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,e.defaults,t),this}},{key:"toArray",value:function(){var t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}]),e}();Vu.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};var Hu=function(){function t(){Ti(this,t),this.init.apply(this,arguments)}return as(t,[{key:"init",value:function(t){if(this.values=[],!Array.isArray(t)){t=t||{};var e=[];for(var n in t)e.push([n,t[n]]);return e.sort(function(t,e){return t[0]-e[0]}),this.values=e.reduce(function(t,e){return t.concat(e)},[]),this}this.values=t}},{key:"valueOf",value:function(){for(var t={},e=this.values,n=0,r=e.length;n<r;n+=2)t[e[n]]=e[n+1];return t}},{key:"toArray",value:function(){return this.values}}]),t}(),Bu=[Gu,Vu,Hu];function Uu(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];Bu.push.apply(Bu,Cr([].concat(t)))}function $u(){Vi(Bu,{to:function(t){return(new Xu).type(this.constructor).from(this.valueOf()).to(t)},fromArray:function(t){return this.init(t),this}})}var Path=function(t){function Path(t){return Ti(this,Path),ps(this,ys(Path).call(this,Ri("path",t),t))}return ws(Path,Shape),as(Path,[{key:"array",value:function(){return this._array||(this._array=new Ru(this.attr("d")))}},{key:"plot",value:function(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new Ru(t))}},{key:"clear",value:function(){return delete this._array,this}},{key:"move",value:function(t,e){return this.attr("d",this.array().move(t,e))}},{key:"x",value:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}},{key:"y",value:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}},{key:"size",value:function(t,e){var n=_i(this,t,e);return this.attr("d",this.array().size(n.width,n.height))}},{key:"width",value:function(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}},{key:"height",value:function(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}},{key:"targets",value:function(){return Bs('svg textpath [href*="'+this.id()+'"]')}}]),Path}();Path.prototype.MorphArray=Ru,Nr({Container:{path:Hi(function(t){return this.put(new Path).plot(t||new Ru)})}}),zi(Path,"Path");var Qu={__proto__:null,array:function(){return this._array||(this._array=new _u(this.attr("points")))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new _u(t))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("points",this.array().move(t,e))},size:function(t,e){var n=_i(this,t,e);return this.attr("points",this.array().size(n.width,n.height))}},Polygon=function(t){function Polygon(t){return Ti(this,Polygon),ps(this,ys(Polygon).call(this,Ri("polygon",t),t))}return ws(Polygon,Shape),Polygon}();Nr({Container:{polygon:Hi(function(t){return this.put(new Polygon).plot(t||new _u)})}}),Vi(Polygon,xu),Vi(Polygon,Qu),zi(Polygon,"Polygon");var Polyline=function(t){function Polyline(t){return Ti(this,Polyline),ps(this,ys(Polyline).call(this,Ri("polyline",t),t))}return ws(Polyline,Shape),Polyline}();Nr({Container:{polyline:Hi(function(t){return this.put(new Polyline).plot(t||new _u)})}}),Vi(Polyline,xu),Vi(Polyline,Qu),zi(Polyline,"Polyline");var Rect=function(t){function Rect(t){return Ti(this,Rect),ps(this,ys(Rect).call(this,Ri("rect",t),t))}return ws(Rect,Shape),Rect}();Vi(Rect,{rx:au,ry:hu}),Nr({Container:{rect:Hi(function(t,e){return this.put(new Rect).size(t,e)})}}),zi(Rect,"Rect");var Wu=Math.max,Ju=Math.min;Ct({target:"Array",proto:!0,forced:!Wt("splice")},{splice:function(t,e){var n,r,A,i,o,s,u=It(this),a=ht(u.length),h=ft(t,a),l=arguments.length;if(0===l?n=r=0:r=1===l?(n=0,a-h):(n=l-2,Ju(Wu(ut(e),0),a-h)),9007199254740991<a+n-r)throw TypeError("Maximum allowed length exceeded");for(A=Me(u,r),i=0;i<r;i++)(o=h+i)in u&&zt(A,i,u[o]);if(n<(A.length=r)){for(i=h;i<a-r;i++)s=i+n,(o=i+r)in u?u[s]=u[o]:delete u[s];for(i=a;a-r+n<i;i--)delete u[i-1]}else if(r<n)for(i=a-r;h<i;i--)s=i+n-1,(o=i+r-1)in u?u[s]=u[o]:delete u[s];for(i=0;i<n;i++)u[i+h]=arguments[i+2];return u.length=a-r+n,A}});var Zu=function(){function t(){Ti(this,t),this._first=null,this._last=null}return as(t,[{key:"push",value:function(t){var e=t.next?t:{value:t,next:null,prev:null};return this._last?(e.prev=this._last,this._last.next=e,this._last=e):(this._last=e,this._first=e),e}},{key:"shift",value:function(){var t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}},{key:"first",value:function(){return this._first&&this._first.value}},{key:"last",value:function(){return this._last&&this._last.value}},{key:"remove",value:function(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}}]),t}(),Ku={nextDraw:null,frames:new Zu,timeouts:new Zu,immediates:new Zu,timer:function(){return Ei.window.performance||Ei.window.Date},transforms:[],frame:function(t){var e=Ku.frames.push({run:t});return null===Ku.nextDraw&&(Ku.nextDraw=Ei.window.requestAnimationFrame(Ku._draw)),e},timeout:function(t,e){e=e||0;var n=Ku.timer().now()+e,r=Ku.timeouts.push({run:t,time:n});return null===Ku.nextDraw&&(Ku.nextDraw=Ei.window.requestAnimationFrame(Ku._draw)),r},immediate:function(t){var e=Ku.immediates.push(t);return null===Ku.nextDraw&&(Ku.nextDraw=Ei.window.requestAnimationFrame(Ku._draw)),e},cancelFrame:function(t){null!=t&&Ku.frames.remove(t)},clearTimeout:function(t){null!=t&&Ku.timeouts.remove(t)},cancelImmediate:function(t){null!=t&&Ku.immediates.remove(t)},_draw:function(t){for(var e=null,n=Ku.timeouts.last();(e=Ku.timeouts.shift())&&(t>=e.time?e.run():Ku.timeouts.push(e),e!==n););for(var r=null,i=Ku.frames.last();r!==i&&(r=Ku.frames.shift());)r.run(t);for(var o=null;o=Ku.immediates.shift();)o();Ku.nextDraw=Ku.timeouts.first()||Ku.frames.first()?Ei.window.requestAnimationFrame(Ku._draw):null}},ta=function(t){var e=t.start,n=t.runner.duration();return{start:e,duration:n,end:e+n,runner:t.runner}},ea=function(){var t=Ei.window;return(t.performance||t.Date).now()},na=function(t){function n(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:ea;return Ti(this,n),(t=ps(this,ys(n).call(this)))._timeSource=e,t._startTime=0,t._speed=1,t._persist=0,t._nextFrame=null,t._paused=!0,t._runners=[],t._runnerIds=[],t._lastRunnerId=-1,t._time=0,t._lastSourceTime=0,t._lastStepTime=0,t._step=t._stepFn.bind(ds(t),!1),t._stepImmediate=t._stepFn.bind(ds(t),!0),t}return ws(n,Us),as(n,[{key:"schedule",value:function(t,e,n){if(null==t)return this._runners.map(ta);var r=0,i=this.getEndTime();if(e=e||0,null==n||"last"===n||"after"===n)r=i;else if("absolute"===n||"start"===n)r=e,e=0;else if("now"===n)r=this._time;else{if("relative"!==n)throw new Error('Invalid value for the "when" parameter');var o=this._runners[t.id];o&&(r=o.start+e,e=0)}t.unschedule(),t.timeline(this);var s=t.persist(),u={persist:null===s?this._persist:s,start:r+e,runner:t};return this._lastRunnerId=t.id,this._runners.push(u),this._runners.sort(function(t,e){return t.start-e.start}),this._runnerIds=this._runners.map(function(t){return t.runner.id}),this.updateTime()._continue(),this}},{key:"unschedule",value:function(t){var e=this._runnerIds.indexOf(t.id);return e<0||(this._runners.splice(e,1),this._runnerIds.splice(e,1),t.timeline(null)),this}},{key:"getEndTime",value:function(){var t=this._runners[this._runnerIds.indexOf(this._lastRunnerId)],e=t?t.runner.duration():0;return(t?t.start:0)+e}},{key:"getEndTimeOfTimeline",value:function(){for(var t=0,e=0;e<this._runners.length;e++){var n=this._runners[e],r=n?n.runner.duration():0,i=(n?n.start:0)+r;t<i&&(t=i)}return t}},{key:"updateTime",value:function(){return this.active()||(this._lastSourceTime=this._timeSource()),this}},{key:"play",value:function(){return this._paused=!1,this.updateTime()._continue()}},{key:"pause",value:function(){return this._paused=!0,this._continue()}},{key:"stop",value:function(){return this.time(0),this.pause()}},{key:"finish",value:function(){return this.time(this.getEndTimeOfTimeline()+1),this.pause()}},{key:"speed",value:function(t){return null==t?this._speed:(this._speed=t,this)}},{key:"reverse",value:function(t){var e=this.speed();if(null==t)return this.speed(-e);var n=Math.abs(e);return this.speed(t?n:-n)}},{key:"seek",value:function(t){return this.time(this._time+t)}},{key:"time",value:function(t){return null==t?this._time:(this._time=t,this._continue(!0))}},{key:"persist",value:function(t){return null==t?this._persist:(this._persist=t,this)}},{key:"source",value:function(t){return null==t?this._timeSource:(this._timeSource=t,this)}},{key:"_stepFn",value:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],e=this._timeSource(),n=e-this._lastSourceTime;t&&(n=0);var r=this._speed*n+(this._time-this._lastStepTime);this._lastSourceTime=e,t||(this._time+=r,this._time=this._time<0?0:this._time),this._lastStepTime=this._time,this.fire("time",this._time);for(var i=this._runners.length;i--;){var o=this._runners[i],s=o.runner;this._time-o.start<=0&&s.reset()}for(var u=!1,a=0,h=this._runners.length;a<h;a++){var l=this._runners[a],c=l.runner,f=r,v=this._time-l.start;if(v<=0)u=!0;else if(v<f&&(f=v),c.active())if(c.step(f).done){if(!0!==l.persist){c.duration()-c.time()+this._time+l.persist<this._time&&(c.unschedule(),--a,--h)}}else u=!0}return u&&!(this._speed<0&&0===this._time)||this._runnerIds.length&&this._speed<0&&0<this._time?this._continue():(this.pause(),this.fire("finished")),this}},{key:"_continue",value:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return Ku.cancelFrame(this._nextFrame),this._nextFrame=null,t?this._stepImmediate():(this._paused||(this._nextFrame=Ku.frame(this._step)),this)}},{key:"active",value:function(){return!!this._nextFrame}}]),n}();function ra(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ia(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ra(n,!0).forEach(function(t){su(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ra(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}Nr({Element:{timeline:function(t){return null==t?(this._timeline=this._timeline||new na,this._timeline):(this._timeline=t,this)}}});var oa=function(t){function o(t){var e;return Ti(this,o),(e=ps(this,ys(o).call(this))).id=o.id++,t="function"==typeof(t=null==t?Qs.duration:t)?new Pu(t):t,e._element=null,e._timeline=null,e.done=!1,e._queue=[],e._duration="number"==typeof t&&t,e._isDeclarative=t instanceof Pu,e._stepper=e._isDeclarative?t:new Cu,e._history={},e.enabled=!0,e._time=0,e._lastTime=0,e._reseted=!0,e.transforms=new Fs,e.transformId=1,e._haveReversed=!1,e._reverse=!1,e._loopsDone=0,e._swing=!1,e._wait=0,e._times=1,e._frameId=null,e._persist=!!e._isDeclarative||null,e}return ws(o,Us),as(o,[{key:"element",value:function(t){return null==t?this._element:((this._element=t)._prepareRunner(),this)}},{key:"timeline",value:function(t){return void 0===t?this._timeline:(this._timeline=t,this)}},{key:"animate",value:function(t,e,n){var r=o.sanitise(t,e,n),i=new o(r.duration);return this._timeline&&i.timeline(this._timeline),this._element&&i.element(this._element),i.loop(r).schedule(r.delay,r.when)}},{key:"schedule",value:function(t,e,n){if(t instanceof na||(n=e,e=t,t=this.timeline()),!t)throw Error("Runner cannot be scheduled without timeline");return t.schedule(this,e,n),this}},{key:"unschedule",value:function(){var t=this.timeline();return t&&t.unschedule(this),this}},{key:"loop",value:function(t,e,n){return"object"===ce(t)&&(e=t.swing,n=t.wait,t=t.times),this._times=t||1/0,this._swing=e||!1,this._wait=n||0,!0===this._times&&(this._times=1/0),this}},{key:"delay",value:function(t){return this.animate(0,t)}},{key:"queue",value:function(t,e,n,r){return this._queue.push({initialiser:t||$s,runner:e||$s,retarget:n,isTransform:r,initialised:!1,finished:!1}),this.timeline()&&this.timeline()._continue(),this}},{key:"during",value:function(t){return this.queue(null,t)}},{key:"after",value:function(t){return this.on("finished",t)}},{key:"time",value:function(t){if(null==t)return this._time;var e=t-this._time;return this.step(e),this}},{key:"duration",value:function(){return this._times*(this._wait+this._duration)-this._wait}},{key:"loops",value:function(t){var e=this._duration+this._wait;if(null==t){var n=Math.floor(this._time/e),r=(this._time-n*e)/this._duration;return Math.min(n+r,this._times)}var i=t%1,o=e*Math.floor(t)+this._duration*i;return this.time(o)}},{key:"persist",value:function(t){return null==t?this._persist:(this._persist=t,this)}},{key:"position",value:function(t){var e,n=this._time,i=this._duration,o=this._wait,r=this._times,s=this._swing,u=this._reverse;if(null==t){var a=function(t){var e=s*Math.floor(t%(2*(o+i))/(o+i)),n=e&&!u||!e&&u,r=Math.pow(-1,n)*(t%(o+i))/i+n;return Math.max(Math.min(r,1),0)},h=r*(o+i)-o;return e=n<=0?Math.round(a(1e-5)):n<h?a(n):Math.round(a(h-1e-5)),e}var l=Math.floor(this.loops()),c=s&&l%2==0;return e=l+(c&&!u||u&&c?t:1-t),this.loops(e)}},{key:"progress",value:function(t){return null==t?Math.min(1,this._time/this.duration()):this.time(t*this.duration())}},{key:"step",value:function(t){if(!this.enabled)return this;t=null==t?16:t,this._time+=t;var e=this.position(),n=this._lastPosition!==e&&0<=this._time;this._lastPosition=e;var r=this.duration(),i=this._lastTime<=0&&0<this._time,o=this._lastTime<r&&this._time>=r;this._lastTime=this._time,i&&this.fire("start",this);var s=this._isDeclarative;if(this.done=!s&&!o&&this._time>=r,this._reseted=!1,n||s){this._initialise(n),this.transforms=new Fs;var u=this._run(s?t:e);this.fire("step",this)}return this.done=this.done||u&&s,o&&this.fire("finished",this),this}},{key:"reset",value:function(){return this._reseted||(this.time(0),this._reseted=!0),this}},{key:"finish",value:function(){return this.step(1/0)}},{key:"reverse",value:function(t){return this._reverse=null==t?!this._reverse:t,this}},{key:"ease",value:function(t){return this._stepper=new Cu(t),this}},{key:"active",value:function(t){return null==t?this.enabled:(this.enabled=t,this)}},{key:"_rememberMorpher",value:function(t,e){if(this._history[t]={morpher:e,caller:this._queue[this._queue.length-1]},this._isDeclarative){var n=this.timeline();n&&n.play()}}},{key:"_tryRetarget",value:function(t,e,n){if(this._history[t]){if(!this._history[t].caller.initialised){var r=this._queue.indexOf(this._history[t].caller);return this._queue.splice(r,1),!1}this._history[t].caller.retarget?this._history[t].caller.retarget(e,n):this._history[t].morpher.to(e),this._history[t].caller.finished=!1;var i=this.timeline();return i&&i.play(),!0}return!1}},{key:"_initialise",value:function(t){if(t||this._isDeclarative)for(var e=0,n=this._queue.length;e<n;++e){var r=this._queue[e],i=this._isDeclarative||!r.initialised&&t;t=!r.finished,i&&t&&(r.initialiser.call(this),r.initialised=!0)}}},{key:"_run",value:function(t){for(var e=!0,n=0,r=this._queue.length;n<r;++n){var i=this._queue[n],o=i.runner.call(this,t);i.finished=i.finished||!0===o,e=e&&i.finished}return e}},{key:"addTransform",value:function(t,e){return this.transforms.lmultiplyO(t),this}},{key:"clearTransform",value:function(){return this.transforms=new Fs,this}},{key:"clearTransformsFromQueue",value:function(){this.done&&this._timeline&&this._timeline._runnerIds.includes(this.id)||(this._queue=this._queue.filter(function(t){return!t.isTransform}))}}],[{key:"sanitise",value:function(t,e,n){var r=1,i=!1,o=0;return e=e||Qs.delay,n=n||"last","object"!==ce(t=t||Qs.duration)||t instanceof Tu||(e=t.delay||e,n=t.when||n,i=t.swing||i,r=t.times||r,o=t.wait||o,t=t.duration||Qs.duration),{duration:t,delay:e,swing:i,times:r,wait:o,when:n}}}]),o}();oa.id=0;var sa=function(){function r(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Fs,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1,n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];Ti(this,r),this.transforms=t,this.id=e,this.done=n}return as(r,[{key:"clearTransformsFromQueue",value:function(){}}]),r}();Vi([oa,sa],{mergeWith:function(t){return new sa(t.transforms.lmultiply(this.transforms),t.id)}});var ua=function(t,e){return t.lmultiplyO(e)},aa=function(t){return t.transforms};var ha=function(){function t(){Ti(this,t),this.runners=[],this.ids=[]}return as(t,[{key:"add",value:function(t){if(!this.runners.includes(t)){var e=t.id+1;return this.runners.push(t),this.ids.push(e),this}}},{key:"getByID",value:function(t){return this.runners[this.ids.indexOf(t+1)]}},{key:"remove",value:function(t){var e=this.ids.indexOf(t+1);return this.ids.splice(e,1),this.runners.splice(e,1),this}},{key:"merge",value:function(){var n=this,r=null;return this.runners.forEach(function(t,e){r&&t.done&&r.done&&(!t._timeline||!t._timeline._runnerIds.includes(t.id))&&(!r._timeline||!r._timeline._runnerIds.includes(r.id))&&(n.remove(t.id),n.edit(r.id,t.mergeWith(r))),r=t}),this}},{key:"edit",value:function(t,e){var n=this.ids.indexOf(t+1);return this.ids.splice(n,1,t+1),this.runners.splice(n,1,e),this}},{key:"length",value:function(){return this.ids.length}},{key:"clearBefore",value:function(t){var e=this.ids.indexOf(t+1)||1;return this.ids.splice(0,e,0),this.runners.splice(0,e,new sa).forEach(function(t){return t.clearTransformsFromQueue()}),this}}]),t}();Nr({Element:{animate:function(t,e,n){var r=oa.sanitise(t,e,n),i=this.timeline();return new oa(r.duration).loop(r).element(this).timeline(i.play()).schedule(r.delay,r.when)},delay:function(t,e){return this.animate(0,t,e)},_clearTransformRunnersBefore:function(t){this._transformationRunners.clearBefore(t.id)},_currentTransform:function(e){return this._transformationRunners.runners.filter(function(t){return t.id<=e.id}).map(aa).reduce(ua,new Fs)},_addRunner:function(t){this._transformationRunners.add(t),Ku.cancelImmediate(this._frameId),this._frameId=Ku.immediate(function(){var t=this._transformationRunners.runners.map(aa).reduce(ua,new Fs);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}.bind(this))},_prepareRunner:function(){null==this._frameId&&(this._transformationRunners=(new ha).add(new sa(new Fs(this))))}}}),Vi(oa,{attr:function(t,e){return this.styleAttr("attr",t,e)},css:function(t,e){return this.styleAttr("css",t,e)},styleAttr:function(e,n,t){if("object"===ce(n)){for(var r in n)this.styleAttr(e,r,n[r]);return this}var i=new Xu(this._stepper).to(t);return this.queue(function(){i=i.from(this.element()[e](n))},function(t){return this.element()[e](n,i.at(t)),i.done()}),this},zoom:function(t,n){if(this._tryRetarget("zoom",gu,n))return this;var r=new Xu(this._stepper).to(new Ks(t));return this.queue(function(){r=r.from(this.element().zoom())},function(t){return this.element().zoom(r.at(t),n),r.done()},function(t,e){n=e,r.to(t)}),this._rememberMorpher("zoom",r),this},transform:function(v,d,p){if(d=v.relative||d,this._isDeclarative&&!d&&this._tryRetarget("transform",v))return this;var y=Fs.isMatrixLike(v);p=null!=v.affine?v.affine:null!=p?p:!y;var m,g,w,b,_,x=new Xu(this._stepper).type(p?Vu:Fs);return this.queue(function(){g=g||this.element(),m=m||xi(v,g),_=new Fs(d?void 0:g),g._addRunner(this),d||g._clearTransformRunnersBefore(this)},function(t){d||this.clearTransform();var e=new Rs(m).transform(g._currentTransform(this)),n=e.x,r=e.y,i=new Fs(ia({},v,{origin:[n,r]})),o=this._isDeclarative&&w?w:_;if(p){i=i.decompose(n,r),o=o.decompose(n,r);var s=i.rotate,u=o.rotate,a=[s-360,s,s+360],h=a.map(function(t){return Math.abs(t-u)}),l=Math.min.apply(Math,Cr(h)),c=h.indexOf(l);i.rotate=a[c]}d&&(y||(i.rotate=v.rotate||0),this._isDeclarative&&b&&(o.rotate=b)),x.from(o),x.to(i);var f=x.at(t);return b=f.rotate,w=new Fs(f),this.addTransform(w),g._addRunner(this),x.done()},function(t){(t.origin||"center").toString()!==(v.origin||"center").toString()&&(m=xi(v,g)),v=ia({},t,{origin:m})},!0),this._isDeclarative&&this._rememberMorpher("transform",x),this},x:function(t,e){return this._queueNumber("x",t)},y:function(t){return this._queueNumber("y",t)},dx:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return this._queueNumberDelta("x",t)},dy:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return this._queueNumberDelta("y",t)},dmove:function(t,e){return this.dx(t).dy(e)},_queueNumberDelta:function(e,t){if(t=new Ks(t),this._tryRetarget(e,t))return this;var n=new Xu(this._stepper).to(t),r=null;return this.queue(function(){r=this.element()[e](),n.from(r),n.to(r+t)},function(t){return this.element()[e](n.at(t)),n.done()},function(t){n.to(r+new Ks(t))}),this._rememberMorpher(e,n),this},_queueObject:function(e,t){if(this._tryRetarget(e,t))return this;var n=new Xu(this._stepper).to(t);return this.queue(function(){n.from(this.element()[e]())},function(t){return this.element()[e](n.at(t)),n.done()}),this._rememberMorpher(e,n),this},_queueNumber:function(t,e){return this._queueObject(t,new Ks(e))},cx:function(t){return this._queueNumber("cx",t)},cy:function(t){return this._queueNumber("cy",t)},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},size:function(t,e){var n;return t&&e||(n=this._element.bbox()),t||(t=n.width/n.height*e),e||(e=n.height/n.width*t),this.width(t).height(e)},width:function(t){return this._queueNumber("width",t)},height:function(t){return this._queueNumber("height",t)},plot:function(t,e,n,r){if(4===arguments.length)return this.plot([t,e,n,r]);if(this._tryRetarget("plot",t))return this;var i=new Xu(this._stepper).type(this._element.MorphArray).to(t);return this.queue(function(){i.from(this._element.array())},function(t){return this._element.plot(i.at(t)),i.done()}),this._rememberMorpher("plot",i),this},leading:function(t){return this._queueNumber("leading",t)},viewbox:function(t,e,n,r){return this._queueObject("viewbox",new Ys(t,e,n,r))},update:function(t){return"object"!==ce(t)?this.update({offset:t,color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}}),Vi(oa,{rx:au,ry:hu,from:mu,to:gu}),zi(oa,"Runner");var Svg=function(t){function Svg(t){var e;return Ti(this,Svg),(e=ps(this,ys(Svg).call(this,Ri("svg",t),t))).namespace(),e}return ws(Svg,Container),as(Svg,[{key:"isRoot",value:function(){return!(this.node.parentNode&&this.node.parentNode instanceof Ei.window.SVGElement&&"#document"!==this.node.parentNode.nodeName)}},{key:"root",value:function(){return this.isRoot()?this:ms(ys(Svg.prototype),"root",this).call(this)}},{key:"namespace",value:function(){return this.isRoot()?this.attr({xmlns:Oi,version:"1.1"}).attr("xmlns:xlink",Ai,Si).attr("xmlns:svgjs",ji,Si):this.root().namespace()}},{key:"defs",value:function(){return this.isRoot()?Li(this.node.querySelector("defs"))||this.put(new Defs):this.root().defs()}},{key:"parent",value:function(t){return this.isRoot()?"#document"===this.node.parentNode.nodeName?null:Li(this.node.parentNode):ms(ys(Svg.prototype),"parent",this).call(this,t)}},{key:"clear",value:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return delete this._defs,this}}]),Svg}();Nr({Container:{nested:Hi(function(){return this.put(new Svg)})}}),zi(Svg,"Svg",!0);var la=function(t){function e(t){return Ti(this,e),ps(this,ys(e).call(this,Ri("symbol",t),t))}return ws(e,Container),e}();Nr({Container:{symbol:Hi(function(){return this.put(new la)})}}),zi(la,"Symbol");var ca={__proto__:null,plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(Ei.document.createTextNode(t)),this},length:function(){return this.node.getComputedTextLength()}},Text=function(t){function Text(t){var e;return Ti(this,Text),(e=ps(this,ys(Text).call(this,Ri("text",t),t))).dom.leading=new Ks(1.3),e._rebuild=!0,e._build=!1,e}return ws(Text,Shape),as(Text,[{key:"x",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.x:this.attr("x",this.attr("x")+t-e.x)}},{key:"y",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.y:this.attr("y",this.attr("y")+t-e.y)}},{key:"move",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.bbox();return this.x(t,n).y(e,n)}},{key:"cx",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.cx:this.attr("x",this.attr("x")+t-e.cx)}},{key:"cy",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.cy:this.attr("y",this.attr("y")+t-e.cy)}},{key:"center",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.bbox();return this.cx(t,n).cy(e,n)}},{key:"text",value:function(t){if(void 0===t){var e=this.node.childNodes,n=0;t="";for(var r=0,i=e.length;r<i;++r)"textPath"!==e[r].nodeName?(r!==n&&3!==e[r].nodeType&&!0===Li(e[r]).dom.newLined&&(t+="\n"),t+=e[r].textContent):0===r&&(n=1);return t}if(this.clear().build(!0),"function"==typeof t)t.call(this,this);else for(var o=0,s=(t=t.split("\n")).length;o<s;o++)this.tspan(t[o]).newLine();return this.build(!1).rebuild()}},{key:"leading",value:function(t){return null==t?this.dom.leading:(this.dom.leading=new Ks(t),this.rebuild())}},{key:"rebuild",value:function(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){var n=this,r=0,i=this.dom.leading;this.each(function(){var t=Ei.window.getComputedStyle(this.node).getPropertyValue("font-size"),e=i*new Ks(t);this.dom.newLined&&(this.attr("x",n.attr("x")),"\n"===this.text()?r+=e:(this.attr("dy",e+r),r=0))}),this.fire("rebuild")}return this}},{key:"build",value:function(t){return this._build=!!t,this}},{key:"setData",value:function(t){return this.dom=t,this.dom.leading=new Ks(t.leading||1.3),this}}]),Text}();Vi(Text,ca),Nr({Container:{text:Hi(function(t){return this.put(new Text).text(t)}),plain:Hi(function(t){return this.put(new Text).plain(t)})}}),zi(Text,"Text");var Tspan=function(t){function Tspan(t){return Ti(this,Tspan),ps(this,ys(Tspan).call(this,Ri("tspan",t),t))}return ws(Tspan,Text),as(Tspan,[{key:"text",value:function(t){return null==t?this.node.textContent+(this.dom.newLined?"\n":""):("function"==typeof t?t.call(this,this):this.plain(t),this)}},{key:"dx",value:function(t){return this.attr("dx",t)}},{key:"dy",value:function(t){return this.attr("dy",t)}},{key:"x",value:function(t){return this.attr("x",t)}},{key:"y",value:function(t){return this.attr("x",t)}},{key:"move",value:function(t,e){return this.x(t).y(e)}},{key:"newLine",value:function(){var t=this.parent(Text);this.dom.newLined=!0;var e=Ei.window.getComputedStyle(this.node).getPropertyValue("font-size"),n=t.dom.leading*new Ks(e);return this.dy(n).attr("x",t.x())}}]),Tspan}();Vi(Tspan,ca),Nr({Tspan:{tspan:Hi(function(t){var e=new Tspan;return this._build||this.clear(),this.node.appendChild(e.node),e.text(t)})}}),zi(Tspan,"Tspan");var ClipPath=function(t){function ClipPath(t){return Ti(this,ClipPath),ps(this,ys(ClipPath).call(this,Ri("clipPath",t),t))}return ws(ClipPath,Container),as(ClipPath,[{key:"remove",value:function(){return this.targets().forEach(function(t){t.unclip()}),ms(ys(ClipPath.prototype),"remove",this).call(this)}},{key:"targets",value:function(){return Bs('svg [clip-path*="'+this.id()+'"]')}}]),ClipPath}();Nr({Container:{clip:Hi(function(){return this.defs().put(new ClipPath)})},Element:{clipWith:function(t){var e=t instanceof ClipPath?t:this.parent().clip().add(t);return this.attr("clip-path",'url("#'+e.id()+'")')},unclip:function(){return this.attr("clip-path",null)},clipper:function(){return this.reference("clip-path")}}}),zi(ClipPath,"ClipPath");var fa=function(t){function e(t){return Ti(this,e),ps(this,ys(e).call(this,Ri("foreignObject",t),t))}return ws(e,Element),e}();Nr({Container:{foreignObject:Hi(function(t,e){return this.put(new fa).size(t,e)})}}),zi(fa,"ForeignObject");var G=function(t){function G(t){return Ti(this,G),ps(this,ys(G).call(this,Ri("g",t),t))}return ws(G,Container),as(G,[{key:"x",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.x:this.move(t,e.y,e)}},{key:"y",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.y:this.move(e.x,t,e)}},{key:"move",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.bbox(),r=t-n.x,i=e-n.y;return this.dmove(r,i)}},{key:"dx",value:function(t){return this.dmove(t,0)}},{key:"dy",value:function(t){return this.dmove(0,t)}},{key:"dmove",value:function(s,u){return this.children().forEach(function(t,e){var n=t.bbox(),r=new Fs(t),i=r.translate(s,u).transform(r.inverse()),o=new Rs(n.x,n.y).transform(i);t.move(o.x,o.y)}),this}},{key:"width",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.width:this.size(t,e.height,e)}},{key:"height",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.height:this.size(e.width,t,e)}},{key:"size",value:function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.bbox(),n=_i(this,t,e,r),i=n.width/r.width,o=n.height/r.height;return this.children().forEach(function(t,e){var n=new Rs(r).transform(new Fs(t).inverse());t.scale(i,o,n.x,n.y)}),this}}]),G}();Nr({Container:{group:Hi(function(){return this.put(new G)})}}),zi(G,"G");var A=function(t){function A(t){return Ti(this,A),ps(this,ys(A).call(this,Ri("a",t),t))}return ws(A,Container),as(A,[{key:"to",value:function(t){return this.attr("href",t,Ai)}},{key:"target",value:function(t){return this.attr("target",t)}}]),A}();Nr({Container:{link:Hi(function(t){return this.put(new A).to(t)})},Element:{linkTo:function(t){var e=new A;return"function"==typeof t?t.call(e,e):e.to(t),this.parent().put(e).put(this)}}}),zi(A,"A");var Mask=function(t){function Mask(t){return Ti(this,Mask),ps(this,ys(Mask).call(this,Ri("mask",t),t))}return ws(Mask,Container),as(Mask,[{key:"remove",value:function(){return this.targets().forEach(function(t){t.unmask()}),ms(ys(Mask.prototype),"remove",this).call(this)}},{key:"targets",value:function(){return Bs('svg [mask*="'+this.id()+'"]')}}]),Mask}();function va(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}Nr({Container:{mask:Hi(function(){return this.defs().put(new Mask)})},Element:{maskWith:function(t){var e=t instanceof Mask?t:this.parent().mask().add(t);return this.attr("mask",'url("#'+e.id()+'")')},unmask:function(){return this.attr("mask",null)},masker:function(){return this.reference("mask")}}}),zi(Mask,"Mask");var Style=function(t){function Style(t){return Ti(this,Style),ps(this,ys(Style).call(this,Ri("style",t),t))}return ws(Style,Element),as(Style,[{key:"addText",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";return this.node.textContent+=t,this}},{key:"font",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return this.rule("@font-face",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?va(n,!0).forEach(function(t){su(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):va(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({fontFamily:t,src:e},n))}},{key:"rule",value:function(t,e){return this.addText(function(t,e){if(!t)return"";if(!e)return t;var n=t+"{";for(var r in e)n+=wi(r)+":"+e[r]+";";return n+="}"}(t,e))}}]),Style}();Nr("Dom",{style:Hi(function(t,e){return this.put(new Style).rule(t,e)}),fontface:Hi(function(t,e,n){return this.put(new Style).font(t,e,n)})}),zi(Style,"Style");var TextPath=function(t){function TextPath(t){return Ti(this,TextPath),ps(this,ys(TextPath).call(this,Ri("textPath",t),t))}return ws(TextPath,Text),as(TextPath,[{key:"array",value:function(){var t=this.track();return t?t.array():null}},{key:"plot",value:function(t){var e=this.track(),n=null;return e&&(n=e.plot(t)),null==t?n:this}},{key:"track",value:function(){return this.reference("href")}}]),TextPath}();Nr({Container:{textPath:Hi(function(t,e){return t instanceof Text||(t=this.text(t)),t.path(e)})},Text:{path:Hi(function(t){var e,n=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],r=new TextPath;if(t instanceof Path||(t=this.defs().path(t)),r.attr("href","#"+t,Ai),n)for(;e=this.node.firstChild;)r.node.appendChild(e);return this.put(r)}),textPath:function(){return this.findOne("textPath")}},Path:{text:Hi(function(t){return t instanceof Text||(t=(new Text).addTo(this.parent()).text(t)),t.path(this)}),targets:function(){return Bs('svg [href*="'+this.id()+'"]')}}}),TextPath.prototype.MorphArray=Ru,zi(TextPath,"TextPath");var Use=function(t){function Use(t){return Ti(this,Use),ps(this,ys(Use).call(this,Ri("use",t),t))}return ws(Use,Shape),as(Use,[{key:"element",value:function(t,e){return this.attr("href",(e||"")+"#"+t,Ai)}}]),Use}();Nr({Container:{use:Hi(function(t,e){return this.put(new Use).element(t,e)})}}),zi(Use,"Use");var da=Di;Vi([Svg,la,Image,Pattern,Marker],Dr("viewbox")),Vi([Line,Polyline,Polygon,Path],Dr("marker")),Vi(Text,Dr("Text")),Vi(Path,Dr("Path")),Vi(Defs,Dr("Defs")),Vi([Text,Tspan],Dr("Tspan")),Vi([Rect,Ellipse,Circle,Gradient],Dr("radius")),Vi(Us,Dr("EventTarget")),Vi(Dom,Dr("Dom")),Vi(Element,Dr("Element")),Vi(Shape,Dr("Shape")),Vi(Container,Dr("Container")),Vi(oa,Dr("Runner")),Vs.extend(Cr(new Set(Ir))),Uu([Ks,fs,Ys,Fs,Zs,_u,Ru]),$u();var pa={__proto__:null,Morphable:Xu,registerMorphableType:Uu,makeMorphable:$u,TransformBag:Vu,ObjectBag:Hu,NonMorphable:Gu,defaults:Js,utils:ki,namespaces:Mi,regex:Oo,SVG:da,parser:zs,find:Bs,registerWindow:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;Ei.window=t,Ei.document=e},Animator:Ku,Controller:Pu,Ease:Cu,PID:Du,Spring:Nu,easing:Eu,Queue:Zu,Runner:oa,Timeline:na,Array:Zs,Box:Ys,Color:fs,EventTarget:Us,Matrix:Fs,Number:Ks,PathArray:Ru,Point:Rs,PointArray:_u,List:Vs,Circle:Circle,ClipPath:ClipPath,Container:Container,Defs:Defs,Dom:Dom,Element:Element,Ellipse:Ellipse,ForeignObject:fa,Gradient:Gradient,G:G,A:A,Image:Image,Line:Line,Marker:Marker,Mask:Mask,Path:Path,Pattern:Pattern,Polygon:Polygon,Polyline:Polyline,Rect:Rect,Shape:Shape,Stop:Stop,Style:Style,Svg:Svg,Symbol:la,Text:Text,TextPath:TextPath,Tspan:Tspan,Use:Use,on:Ro,off:Lo,dispatch:Fo,root:Ii,create:Ni,makeInstance:Di,nodeOrNew:Ri,adopt:Li,mockAdopt:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Li;Fi=t},register:zi,getClass:qi,eid:Xi,assignNewId:Gi,extend:Vi,wrapWithAttrCheck:Hi,invent:function(e){var t="function"==typeof e.create?e.create:function(t){this.constructor(t||Ni(e.create))};return e.inherit&&(t.prototype=new e.inherit,t.prototype.constructor=t),e.extend&&Vi(t,e.extend),e.construct&&Vi(e.parent||Pi.Container,e.construct),t}};function ya(t){return Di(t)}return Object.assign(ya,pa),ya}(); +//# sourceMappingURL=svg.min.js.map diff --git a/res/style.css b/res/style.css index c97f011ad12d13a10fc20be72f5aea615bfd7494..59d9c1321c59a89457c240cfd5c4996da7776492 100644 --- a/res/style.css +++ b/res/style.css @@ -15,7 +15,7 @@ body { font-family: sans-serif; } -header { +#header { position: fixed; display: flex; align-items: center; @@ -28,13 +28,13 @@ background-color: var(--main-bg-color-dark); color: white; } -header p { +#header p { font-size:30px; font-family:"Arial"; font-weight:bold; } -footer{ +#footer{ position: fixed; display: flex; align-items: center; @@ -47,7 +47,7 @@ background-color: var(--main-bg-color-dark); color: white; } -footer img { +#footer img { width: auto; max-height: 80%; margin-left: 5%; @@ -173,7 +173,6 @@ text-decoration:none; #animationArea { flex : 1; order: 2; - background-color: grey; margin: 2%; } @@ -193,3 +192,48 @@ height:100%; width:48%; margin-right:2%; } + + +/* PARAMS DES MODAL */ + +/* The Modal (background) */ +.modal { + display: none; /* Hidden by default */ + position: fixed; /* Stay in place */ + z-index: 1; /* Sit on top */ + left: 0; + top: 0; + width: 100%; /* Full width */ + height: 100%; /* Full height */ + overflow: auto; /* Enable scroll if needed */ + background-color: rgb(0,0,0); /* Fallback color */ + background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ +} + +/* Modal Content/Box */ +.modal-content { + background-color: #fefefe; + margin: 15% auto; /* 15% from the top and centered */ + padding: 20px; + border: 1px solid #888; + width: 80%; /* Could be more or less, depending on screen size */ +} + +/* The Close Button */ +.close { + color: #aaa; + float: right; + font-size: 28px; + font-weight: bold; +} + +.close:hover, +.close:focus { + color: black; + text-decoration: none; + cursor: pointer; +} + +.consignes { + display: none; +}