request.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * @license
  3. * Visual Blocks Editor
  4. *
  5. * Copyright 2012 Google Inc.
  6. * https://developers.google.com/blockly/
  7. *
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. /**
  21. * @fileoverview Colour blocks for Blockly.
  22. * @author fraser@google.com (Neil Fraser)
  23. */
  24. 'use strict';
  25. goog.provide('Blockly.Blocks.requests');
  26. goog.require('Blockly.Blocks');
  27. /**
  28. * Common HSV hue for all blocks in this category.
  29. */
  30. Blockly.Blocks.requests.HUE = "#ff8b2c";
  31. Blockly.Blocks['request_import'] = {
  32. /**
  33. * @this Blockly.Block
  34. */
  35. init: function() {
  36. this.setColour(Blockly.Blocks.requests.HUE);
  37. this.appendDummyInput()
  38. .appendField(Blockly.Msg.REQUEST_IMPORT);
  39. // this.setInputsInline(false);
  40. // this.setOutput(true);
  41. this.setPreviousStatement(true);
  42. this.setNextStatement(true);
  43. },
  44. };
  45. Blockly.Blocks['request_post'] = {
  46. /**
  47. * @this Blockly.Block
  48. */
  49. init: function() {
  50. this.setColour(Blockly.Blocks.requests.HUE);
  51. this.appendDummyInput()
  52. .appendField(Blockly.Msg.REQUEST_POST_DATATYPE);
  53. this.appendDummyInput()
  54. .appendField(Blockly.Msg.REQUEST_SET_URL)
  55. .appendField(new Blockly.FieldTextInput("http://192.168.4.1/get"),"URL")
  56. this.appendValueInput("DATA")
  57. .appendField(Blockly.Msg.REQUEST_DATA);
  58. // this.setInputsInline(false);
  59. // this.setOutput(true);
  60. this.setPreviousStatement(true);
  61. this.setNextStatement(true);
  62. },
  63. };