12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <!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 id="toolbox" style="display: none">
- <category name="Logic">
- <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">
- <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">
- <block type="math_number"></block>
- <block type="math_arithmetic"></block>
- <block type="math_single"></block>
- </category>
- <category name="Text">
- <block type="text"></block>
- <block type="text_length"></block>
- <block type="text_print"></block>
- </category>
- </xml>
- <script>
- var workspace = 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>
|