Commit b37fb2bf authored by Neil Fraser's avatar Neil Fraser

Move datepicker CSS out of main codebase.

parent 7e90591a
......@@ -1060,7 +1060,7 @@ Blockly.Block.prototype.toString=function(a){var b=[];if(this.collapsed_)b.push(
Blockly.Block.prototype.appendStatementInput=function(a){return this.appendInput_(Blockly.NEXT_STATEMENT,a)};Blockly.Block.prototype.appendDummyInput=function(a){return this.appendInput_(Blockly.DUMMY_INPUT,a||"")};
Blockly.Block.prototype.jsonInit=function(a){goog.asserts.assertString(a.message,"No message.");goog.asserts.assertArray(a.args,"No args.");goog.asserts.assert(void 0==a.output||void 0==a.previousStatement,"Must not have both an output and a previousStatement.");this.setColour(a.colour);for(var b=a.message.split(/(%\d+)/),c=[],d=0,e=[],f=0;f<b.length;f++){var g=b[f];if(g.match(/^%\d+$/)){var h=parseInt(g.substring(1),10);goog.asserts.assert(0<h&&h<=a.args.length,'Message index "%s" out of range.',
g);goog.asserts.assert(!c[h],'Message index "%s" duplicated.',g);c[h]=!0;d++;e.push(a.args[h-1])}else(g=g.replace(/%%/g,"%").trim())&&e.push(g)}goog.asserts.assert(d==a.args.length,"Message does not reference all %s arg(s).",a.args.length);!e.length||"string"!=typeof e[e.length-1]&&0!=e[e.length-1].type.indexOf("field_")||(b={type:"input_dummy"},a.lastDummyAlign&&(b.align=a.lastDummyAlign),e.push(b));c={LEFT:Blockly.ALIGN_LEFT,RIGHT:Blockly.ALIGN_RIGHT,CENTRE:Blockly.ALIGN_CENTRE};d=[];for(f=0;f<
e.length;f++)if(g=e[f],"string"==typeof g)d.push([g,void 0]);else{b=h=null;switch(g.type){case "field_label":h=new Blockly.FieldLabel(g.text);break;case "field_input":h=new Blockly.FieldTextInput(g.text);break;case "field_angle":h=new Blockly.FieldAngle(g.angle);break;case "field_checkbox":h=new Blockly.FieldCheckbox(g.checked);break;case "field_colour":h=new Blockly.FieldColour(g.colour);break;case "field_date":h=new Blockly.FieldDate(g.date);break;case "field_variable":h=new Blockly.FieldVariable(g.variable);
e.length;f++)if(g=e[f],"string"==typeof g)d.push([g,void 0]);else{b=h=null;switch(g.type){case "field_label":h=new Blockly.FieldLabel(g.text);break;case "field_input":h=new Blockly.FieldTextInput(g.text);break;case "field_angle":h=new Blockly.FieldAngle(g.angle);break;case "field_checkbox":h=new Blockly.FieldCheckbox(g.checked?"TRUE":"FALSE");break;case "field_colour":h=new Blockly.FieldColour(g.colour);break;case "field_date":h=new Blockly.FieldDate(g.date);break;case "field_variable":h=new Blockly.FieldVariable(g.variable);
break;case "field_dropdown":h=new Blockly.FieldDropdown(g.options);break;case "field_image":h=new Blockly.FieldImage(g.src,g.width,g.height,g.alt);break;case "input_value":b=this.appendValueInput(g.name);break;case "input_statement":b=this.appendStatementInput(g.name);break;case "input_dummy":b=this.appendDummyInput(g.name);break;default:throw"Unknown element type: "+g.type;}if(h)d.push([h,g.name]);else if(b){g.check&&b.setCheck(g.check);g.align&&b.setAlign(c[g.align]);for(g=0;g<d.length;g++)b.appendField(d[g][0],
d[g][1]);d.length=0}}void 0!==a.inputsInline&&this.setInputsInline(a.inputsInline);void 0!==a.output&&this.setOutput(!0,a.output);void 0!==a.previousStatement&&this.setPreviousStatement(!0,a.previousStatement);void 0!==a.nextStatement&&this.setNextStatement(!0,a.nextStatement);this.setTooltip(a.tooltip);this.setHelpUrl(a.helpUrl)};
Blockly.Block.prototype.appendInput_=function(a,b){var c=null;if(a==Blockly.INPUT_VALUE||a==Blockly.NEXT_STATEMENT)c=new Blockly.Connection(this,a);c=new Blockly.Input(a,b,this,c);this.inputList.push(c);this.rendered&&(this.render(),this.bumpNeighbours_());return c};
......@@ -1302,7 +1302,8 @@ Blockly.Toolbox.TreeNode=function(a,b,c,d){goog.ui.tree.TreeNode.call(this,b,c,d
Blockly.Toolbox.TreeNode.prototype.onMouseDown=function(a){this.hasChildren()&&this.isUserCollapsible_?(this.toggle(),this.select()):this.isSelected()?this.getTree().setSelectedItem(null):this.select();this.updateRow()};Blockly.Toolbox.TreeNode.prototype.onDoubleClick_=function(a){};Blockly.Toolbox.TreeSeparator=function(){Blockly.Toolbox.TreeNode.call(this,null,"",Blockly.Toolbox.TreeSeparator.CONFIG_)};goog.inherits(Blockly.Toolbox.TreeSeparator,Blockly.Toolbox.TreeNode);
Blockly.Toolbox.TreeSeparator.CONFIG_={cssTreeRow:"blocklyTreeSeparator"};
// Copyright 2013 Google Inc. Apache License 2.0
Blockly.Css={};Blockly.Css.Cursor={OPEN:"handopen",CLOSED:"handclosed",DELETE:"handdelete"};Blockly.Css.currentCursor_="";Blockly.Css.styleSheet_=null;Blockly.Css.mediaPath_="";Blockly.Css.inject=function(a,b){if(!Blockly.Css.styleSheet_){var c=".blocklyDraggable {}\n";a&&(c+=Blockly.Css.CONTENT.join("\n"));Blockly.Css.mediaPath_=b.replace(/[\\\/]$/,"");c=c.replace(/<<<PATH>>>/g,Blockly.Css.mediaPath_);Blockly.Css.styleSheet_=goog.cssom.addCssText(c).sheet;Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN)}};
Blockly.Css={};Blockly.Css.Cursor={OPEN:"handopen",CLOSED:"handclosed",DELETE:"handdelete"};Blockly.Css.currentCursor_="";Blockly.Css.styleSheet_=null;Blockly.Css.mediaPath_="";
Blockly.Css.inject=function(a,b){if(!Blockly.Css.styleSheet_){var c=".blocklyDraggable {}\n";a&&(c+=Blockly.Css.CONTENT.join("\n"),Blockly.FieldDate&&(c+=Blockly.FieldDate.CSS.join("\n")));Blockly.Css.mediaPath_=b.replace(/[\\\/]$/,"");c=c.replace(/<<<PATH>>>/g,Blockly.Css.mediaPath_);Blockly.Css.styleSheet_=goog.cssom.addCssText(c).sheet;Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN)}};
Blockly.Css.setCursor=function(a){if(Blockly.Css.currentCursor_!=a){Blockly.Css.currentCursor_=a;var b="url("+Blockly.Css.mediaPath_+"/"+a+".cur) "+(a==Blockly.Css.Cursor.OPEN?"8 5":"7 3")+", auto";goog.cssom.replaceCssRule("",".blocklyDraggable {\n cursor: "+b+";\n}\n",Blockly.Css.styleSheet_,0);for(var c=document.getElementsByClassName("blocklyToolboxDiv"),d=0,e;e=c[d];d++)e.style.cursor=a==Blockly.Css.Cursor.OPEN?"":b;document.body.parentNode.style.cursor=a==Blockly.Css.Cursor.OPEN?"":b}};
Blockly.Css.CONTENT=[".blocklySvg {"," background-color: #fff;"," outline: none;"," overflow: hidden;","}",".blocklyWidgetDiv {"," display: none;"," position: absolute;"," z-index: 999;","}",".blocklyTooltipDiv {"," background-color: #ffffc7;"," border: 1px solid #ddc;"," box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);"," color: #000;"," display: none;"," font-family: sans-serif;"," font-size: 9pt;"," opacity: 0.9;"," padding: 2px;"," position: absolute;"," z-index: 1000;","}",".blocklyResizeSE {",
" cursor: se-resize;"," fill: #aaa;","}",".blocklyResizeSW {"," cursor: sw-resize;"," fill: #aaa;","}",".blocklyResizeLine {"," stroke: #888;"," stroke-width: 1;","}",".blocklyHighlightedConnectionPath {"," fill: none;"," stroke: #fc3;"," stroke-width: 4px;","}",".blocklyPathLight {"," fill: none;"," stroke-linecap: round;"," stroke-width: 1;","}",".blocklySelected>.blocklyPath {"," stroke: #fc3;"," stroke-width: 3px;","}",".blocklySelected>.blocklyPathLight {"," display: none;","}",
......@@ -1316,17 +1317,12 @@ Blockly.Css.CONTENT=[".blocklySvg {"," background-color: #fff;"," outline: non
"}",".blocklyTreeIconClosedRtl {"," background-position: 0px -1px;","}",".blocklyTreeIconOpen {"," background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {"," background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {"," background-position: 0px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {"," background-position: -16px -17px;","}",".blocklyTreeIconNone,",".blocklyTreeSelected>.blocklyTreeIconNone {"," background-position: -48px -1px;",
"}",".blocklyTreeLabel {"," cursor: default;"," font-family: sans-serif;"," font-size: 16px;"," padding: 0 3px;"," vertical-align: middle;","}",".blocklyTreeSelected {"," background-color: #57e !important;","}",".blocklyTreeSelected .blocklyTreeLabel {"," color: #fff;","}",".blocklyWidgetDiv .goog-palette {"," outline: none;"," cursor: default;","}",".blocklyWidgetDiv .goog-palette-table {"," border: 1px solid #666;"," border-collapse: collapse;","}",".blocklyWidgetDiv .goog-palette-cell {",
" height: 13px;"," width: 15px;"," margin: 0;"," border: 0;"," text-align: center;"," vertical-align: middle;"," border-right: 1px solid #666;"," font-size: 1px;","}",".blocklyWidgetDiv .goog-palette-colorswatch {"," position: relative;"," height: 13px;"," width: 15px;"," border: 1px solid #666;","}",".blocklyWidgetDiv .goog-palette-cell-hover .goog-palette-colorswatch {"," border: 1px solid #FFF;","}",".blocklyWidgetDiv .goog-palette-cell-selected .goog-palette-colorswatch {"," border: 1px solid #000;",
" color: #fff;","}",".blocklyWidgetDiv .goog-date-picker,",".blocklyWidgetDiv .goog-date-picker th,",".blocklyWidgetDiv .goog-date-picker td {"," font: 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-date-picker {"," -moz-user-focus: normal;"," -moz-user-select: none;"," position: relative;"," border: 1px solid #000;"," float: left;"," padding: 2px;"," color: #000;"," background: #c3d9ff;"," cursor: default;","}",".blocklyWidgetDiv .goog-date-picker th {"," text-align: center;",
"}",".blocklyWidgetDiv .goog-date-picker td {"," text-align: center;"," vertical-align: middle;"," padding: 1px 3px;","}",".blocklyWidgetDiv .goog-date-picker-menu {"," position: absolute;"," background: threedface;"," border: 1px solid gray;"," -moz-user-focus: normal;"," z-index: 1;"," outline: none;","}",".blocklyWidgetDiv .goog-date-picker-menu ul {"," list-style: none;"," margin: 0px;"," padding: 0px;","}",".blocklyWidgetDiv .goog-date-picker-menu ul li {"," cursor: default;","}",
".blocklyWidgetDiv .goog-date-picker-menu-selected {"," background: #ccf;","}",".blocklyWidgetDiv .goog-date-picker th {"," font-size: .9em;","}",".blocklyWidgetDiv .goog-date-picker td div {"," float: left;","}",".blocklyWidgetDiv .goog-date-picker button {"," padding: 0px;"," margin: 1px 0;"," border: 0;"," color: #20c;"," font-weight: bold;"," background: transparent;","}",".blocklyWidgetDiv .goog-date-picker-date {"," background: #fff;","}",".blocklyWidgetDiv .goog-date-picker-week,",
".blocklyWidgetDiv .goog-date-picker-wday {"," padding: 1px 3px;"," border: 0;"," border-color: #a2bbdd;"," border-style: solid;","}",".blocklyWidgetDiv .goog-date-picker-week {"," border-right-width: 1px;","}",".blocklyWidgetDiv .goog-date-picker-wday {"," border-bottom-width: 1px;","}",".blocklyWidgetDiv .goog-date-picker-head td {"," text-align: center;","}",".blocklyWidgetDiv td.goog-date-picker-today-cont {"," text-align: center;","}",".blocklyWidgetDiv td.goog-date-picker-none-cont {",
" text-align: center;","}",".blocklyWidgetDiv .goog-date-picker-month {"," min-width: 11ex;"," white-space: nowrap;","}",".blocklyWidgetDiv .goog-date-picker-year {"," min-width: 6ex;"," white-space: nowrap;","}",".blocklyWidgetDiv .goog-date-picker-monthyear {"," white-space: nowrap;","}",".blocklyWidgetDiv .goog-date-picker table {"," border-collapse: collapse;","}",".blocklyWidgetDiv .goog-date-picker-other-month {"," color: #888;","}",".blocklyWidgetDiv .goog-date-picker-wkend-start,",
".blocklyWidgetDiv .goog-date-picker-wkend-end {"," background: #eee;","}",".blocklyWidgetDiv td.goog-date-picker-selected {"," background: #c3d9ff;","}",".blocklyWidgetDiv .goog-date-picker-today {"," background: #9ab;"," font-weight: bold !important;"," border-color: #246 #9bd #9bd #246;"," color: #fff;","}",".blocklyWidgetDiv .goog-menu {"," background: #fff;"," border-color: #ccc #666 #666 #ccc;"," border-style: solid;"," border-width: 1px;"," cursor: default;"," font: normal 13px Arial, sans-serif;",
" margin: 0;"," outline: none;"," padding: 4px 0;"," position: absolute;"," z-index: 20000;","}",".blocklyWidgetDiv .goog-menuitem {"," color: #000;"," font: normal 13px Arial, sans-serif;"," list-style: none;"," margin: 0;"," padding: 4px 7em 4px 28px;"," white-space: nowrap;","}",".blocklyWidgetDiv .goog-menuitem.goog-menuitem-rtl {"," padding-left: 7em;"," padding-right: 28px;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem {",
" padding-left: 12px;","}",".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem {"," padding-right: 20px;","}",".blocklyWidgetDiv .goog-menuitem-content {"," color: #000;"," font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel,",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content {"," color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon {"," opacity: 0.3;"," -moz-opacity: 0.3;"," filter: alpha(opacity=30);",
"}",".blocklyWidgetDiv .goog-menuitem-highlight,",".blocklyWidgetDiv .goog-menuitem-hover {"," background-color: #d6e9f8;"," border-color: #d6e9f8;"," border-style: dotted;"," border-width: 1px 0;"," padding-bottom: 3px;"," padding-top: 3px;","}",".blocklyWidgetDiv .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-icon {"," background-repeat: no-repeat;"," height: 16px;"," left: 6px;"," position: absolute;"," right: auto;"," vertical-align: middle;"," width: 16px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",
".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon {"," left: auto;"," right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {"," background: url(//ssl.gstatic.com/editor/editortoolbar.png) no-repeat -512px 0;","}",".blocklyWidgetDiv .goog-menuitem-accel {"," color: #999;"," direction: ltr;"," left: auto;"," padding: 0 6px;"," position: absolute;"," right: 0;"," text-align: right;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-accel {",
" left: 0;"," right: auto;"," text-align: left;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-hint {"," text-decoration: underline;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-separator {"," color: #999;"," font-size: 12px;"," padding-left: 4px;","}",".blocklyWidgetDiv .goog-menuseparator {"," border-top: 1px solid #ccc;"," margin: 4px 0;"," padding: 0;","}",""];
" color: #fff;","}",".blocklyWidgetDiv .goog-menu {"," background: #fff;"," border-color: #ccc #666 #666 #ccc;"," border-style: solid;"," border-width: 1px;"," cursor: default;"," font: normal 13px Arial, sans-serif;"," margin: 0;"," outline: none;"," padding: 4px 0;"," position: absolute;"," z-index: 20000;","}",".blocklyWidgetDiv .goog-menuitem {"," color: #000;"," font: normal 13px Arial, sans-serif;"," list-style: none;"," margin: 0;"," padding: 4px 7em 4px 28px;"," white-space: nowrap;",
"}",".blocklyWidgetDiv .goog-menuitem.goog-menuitem-rtl {"," padding-left: 7em;"," padding-right: 28px;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem {"," padding-left: 12px;","}",".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem {"," padding-right: 20px;","}",".blocklyWidgetDiv .goog-menuitem-content {"," color: #000;"," font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel,",
".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content {"," color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon {"," opacity: 0.3;"," -moz-opacity: 0.3;"," filter: alpha(opacity=30);","}",".blocklyWidgetDiv .goog-menuitem-highlight,",".blocklyWidgetDiv .goog-menuitem-hover {"," background-color: #d6e9f8;"," border-color: #d6e9f8;"," border-style: dotted;"," border-width: 1px 0;"," padding-bottom: 3px;"," padding-top: 3px;","}",".blocklyWidgetDiv .goog-menuitem-checkbox,",
".blocklyWidgetDiv .goog-menuitem-icon {"," background-repeat: no-repeat;"," height: 16px;"," left: 6px;"," position: absolute;"," right: auto;"," vertical-align: middle;"," width: 16px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon {"," left: auto;"," right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {"," background: url(//ssl.gstatic.com/editor/editortoolbar.png) no-repeat -512px 0;",
"}",".blocklyWidgetDiv .goog-menuitem-accel {"," color: #999;"," direction: ltr;"," left: auto;"," padding: 0 6px;"," position: absolute;"," right: 0;"," text-align: right;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-accel {"," left: 0;"," right: auto;"," text-align: left;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-hint {"," text-decoration: underline;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-separator {"," color: #999;"," font-size: 12px;"," padding-left: 4px;",
"}",".blocklyWidgetDiv .goog-menuseparator {"," border-top: 1px solid #ccc;"," margin: 4px 0;"," padding: 0;","}",""];
// Copyright 2013 Google Inc. Apache License 2.0
Blockly.WidgetDiv={};Blockly.WidgetDiv.DIV=null;Blockly.WidgetDiv.owner_=null;Blockly.WidgetDiv.dispose_=null;Blockly.WidgetDiv.createDom=function(){Blockly.WidgetDiv.DIV||(Blockly.WidgetDiv.DIV=goog.dom.createDom("div","blocklyWidgetDiv"),document.body.appendChild(Blockly.WidgetDiv.DIV))};Blockly.WidgetDiv.show=function(a,b,c){Blockly.WidgetDiv.hide();Blockly.WidgetDiv.owner_=a;Blockly.WidgetDiv.dispose_=c;Blockly.WidgetDiv.DIV.style.direction=b?"rtl":"ltr";Blockly.WidgetDiv.DIV.style.display="block"};
Blockly.WidgetDiv.hide=function(){Blockly.WidgetDiv.owner_&&(Blockly.WidgetDiv.DIV.style.display="none",Blockly.WidgetDiv.dispose_&&Blockly.WidgetDiv.dispose_(),Blockly.WidgetDiv.owner_=null,Blockly.WidgetDiv.dispose_=null,goog.dom.removeChildren(Blockly.WidgetDiv.DIV))};Blockly.WidgetDiv.isVisible=function(){return!!Blockly.WidgetDiv.owner_};Blockly.WidgetDiv.hideIfOwner=function(a){Blockly.WidgetDiv.owner_==a&&Blockly.WidgetDiv.hide()};
......
......@@ -973,7 +973,8 @@ Blockly.Block.prototype.jsonInit = function(json) {
field = new Blockly.FieldAngle(element['angle']);
break;
case 'field_checkbox':
field = new Blockly.FieldCheckbox(element['checked']);
field = new Blockly.FieldCheckbox(
element['checked'] ? 'TRUE' : 'FALSE');
break;
case 'field_colour':
field = new Blockly.FieldColour(element['colour']);
......
......@@ -79,6 +79,9 @@ Blockly.Css.inject = function(hasCss, pathToMedia) {
var text = '.blocklyDraggable {}\n';
if (hasCss) {
text += Blockly.Css.CONTENT.join('\n');
if (Blockly.FieldDate) {
text += Blockly.FieldDate.CSS.join('\n');
}
}
// Strip off any trailing slash (either Unix or Windows).
Blockly.Css.mediaPath_ = pathToMedia.replace(/[\\\/]$/, '');
......@@ -514,161 +517,6 @@ Blockly.Css.CONTENT = [
' color: #fff;',
'}',
/* Copied from: goog/css/datepicker.css */
/*
* Copyright 2009 The Closure Library Authors. All Rights Reserved.
*
* Use of this source code is governed by the Apache License, Version 2.0.
* See the COPYING file for details.
*/
/*
* Standard styling for a goog.ui.DatePicker.
*
* @author arv@google.com (Erik Arvidsson)
*/
'.blocklyWidgetDiv .goog-date-picker,',
'.blocklyWidgetDiv .goog-date-picker th,',
'.blocklyWidgetDiv .goog-date-picker td {',
' font: 13px Arial, sans-serif;',
'}',
'.blocklyWidgetDiv .goog-date-picker {',
' -moz-user-focus: normal;',
' -moz-user-select: none;',
' position: relative;',
' border: 1px solid #000;',
' float: left;',
' padding: 2px;',
' color: #000;',
' background: #c3d9ff;',
' cursor: default;',
'}',
'.blocklyWidgetDiv .goog-date-picker th {',
' text-align: center;',
'}',
'.blocklyWidgetDiv .goog-date-picker td {',
' text-align: center;',
' vertical-align: middle;',
' padding: 1px 3px;',
'}',
'.blocklyWidgetDiv .goog-date-picker-menu {',
' position: absolute;',
' background: threedface;',
' border: 1px solid gray;',
' -moz-user-focus: normal;',
' z-index: 1;',
' outline: none;',
'}',
'.blocklyWidgetDiv .goog-date-picker-menu ul {',
' list-style: none;',
' margin: 0px;',
' padding: 0px;',
'}',
'.blocklyWidgetDiv .goog-date-picker-menu ul li {',
' cursor: default;',
'}',
'.blocklyWidgetDiv .goog-date-picker-menu-selected {',
' background: #ccf;',
'}',
'.blocklyWidgetDiv .goog-date-picker th {',
' font-size: .9em;',
'}',
'.blocklyWidgetDiv .goog-date-picker td div {',
' float: left;',
'}',
'.blocklyWidgetDiv .goog-date-picker button {',
' padding: 0px;',
' margin: 1px 0;',
' border: 0;',
' color: #20c;',
' font-weight: bold;',
' background: transparent;',
'}',
'.blocklyWidgetDiv .goog-date-picker-date {',
' background: #fff;',
'}',
'.blocklyWidgetDiv .goog-date-picker-week,',
'.blocklyWidgetDiv .goog-date-picker-wday {',
' padding: 1px 3px;',
' border: 0;',
' border-color: #a2bbdd;',
' border-style: solid;',
'}',
'.blocklyWidgetDiv .goog-date-picker-week {',
' border-right-width: 1px;',
'}',
'.blocklyWidgetDiv .goog-date-picker-wday {',
' border-bottom-width: 1px;',
'}',
'.blocklyWidgetDiv .goog-date-picker-head td {',
' text-align: center;',
'}',
/** Use td.className instead of !important */
'.blocklyWidgetDiv td.goog-date-picker-today-cont {',
' text-align: center;',
'}',
/** Use td.className instead of !important */
'.blocklyWidgetDiv td.goog-date-picker-none-cont {',
' text-align: center;',
'}',
'.blocklyWidgetDiv .goog-date-picker-month {',
' min-width: 11ex;',
' white-space: nowrap;',
'}',
'.blocklyWidgetDiv .goog-date-picker-year {',
' min-width: 6ex;',
' white-space: nowrap;',
'}',
'.blocklyWidgetDiv .goog-date-picker-monthyear {',
' white-space: nowrap;',
'}',
'.blocklyWidgetDiv .goog-date-picker table {',
' border-collapse: collapse;',
'}',
'.blocklyWidgetDiv .goog-date-picker-other-month {',
' color: #888;',
'}',
'.blocklyWidgetDiv .goog-date-picker-wkend-start,',
'.blocklyWidgetDiv .goog-date-picker-wkend-end {',
' background: #eee;',
'}',
/** Use td.className instead of !important */
'.blocklyWidgetDiv td.goog-date-picker-selected {',
' background: #c3d9ff;',
'}',
'.blocklyWidgetDiv .goog-date-picker-today {',
' background: #9ab;',
' font-weight: bold !important;',
' border-color: #246 #9bd #9bd #246;',
' color: #fff;',
'}',
/* Copied from: goog/css/menu.css */
/*
* Copyright 2009 The Closure Library Authors. All Rights Reserved.
......
......@@ -197,3 +197,160 @@ Blockly.FieldDate.loadLanguage_ = function() {
}
}
};
Blockly.FieldDate.CSS = [
/* Copied from: goog/css/datepicker.css */
/*
* Copyright 2009 The Closure Library Authors. All Rights Reserved.
*
* Use of this source code is governed by the Apache License, Version 2.0.
* See the COPYING file for details.
*/
/*
* Standard styling for a goog.ui.DatePicker.
*
* @author arv@google.com (Erik Arvidsson)
*/
'.blocklyWidgetDiv .goog-date-picker,',
'.blocklyWidgetDiv .goog-date-picker th,',
'.blocklyWidgetDiv .goog-date-picker td {',
' font: 13px Arial, sans-serif;',
'}',
'.blocklyWidgetDiv .goog-date-picker {',
' -moz-user-focus: normal;',
' -moz-user-select: none;',
' position: relative;',
' border: 1px solid #000;',
' float: left;',
' padding: 2px;',
' color: #000;',
' background: #c3d9ff;',
' cursor: default;',
'}',
'.blocklyWidgetDiv .goog-date-picker th {',
' text-align: center;',
'}',
'.blocklyWidgetDiv .goog-date-picker td {',
' text-align: center;',
' vertical-align: middle;',
' padding: 1px 3px;',
'}',
'.blocklyWidgetDiv .goog-date-picker-menu {',
' position: absolute;',
' background: threedface;',
' border: 1px solid gray;',
' -moz-user-focus: normal;',
' z-index: 1;',
' outline: none;',
'}',
'.blocklyWidgetDiv .goog-date-picker-menu ul {',
' list-style: none;',
' margin: 0px;',
' padding: 0px;',
'}',
'.blocklyWidgetDiv .goog-date-picker-menu ul li {',
' cursor: default;',
'}',
'.blocklyWidgetDiv .goog-date-picker-menu-selected {',
' background: #ccf;',
'}',
'.blocklyWidgetDiv .goog-date-picker th {',
' font-size: .9em;',
'}',
'.blocklyWidgetDiv .goog-date-picker td div {',
' float: left;',
'}',
'.blocklyWidgetDiv .goog-date-picker button {',
' padding: 0px;',
' margin: 1px 0;',
' border: 0;',
' color: #20c;',
' font-weight: bold;',
' background: transparent;',
'}',
'.blocklyWidgetDiv .goog-date-picker-date {',
' background: #fff;',
'}',
'.blocklyWidgetDiv .goog-date-picker-week,',
'.blocklyWidgetDiv .goog-date-picker-wday {',
' padding: 1px 3px;',
' border: 0;',
' border-color: #a2bbdd;',
' border-style: solid;',
'}',
'.blocklyWidgetDiv .goog-date-picker-week {',
' border-right-width: 1px;',
'}',
'.blocklyWidgetDiv .goog-date-picker-wday {',
' border-bottom-width: 1px;',
'}',
'.blocklyWidgetDiv .goog-date-picker-head td {',
' text-align: center;',
'}',
/** Use td.className instead of !important */
'.blocklyWidgetDiv td.goog-date-picker-today-cont {',
' text-align: center;',
'}',
/** Use td.className instead of !important */
'.blocklyWidgetDiv td.goog-date-picker-none-cont {',
' text-align: center;',
'}',
'.blocklyWidgetDiv .goog-date-picker-month {',
' min-width: 11ex;',
' white-space: nowrap;',
'}',
'.blocklyWidgetDiv .goog-date-picker-year {',
' min-width: 6ex;',
' white-space: nowrap;',
'}',
'.blocklyWidgetDiv .goog-date-picker-monthyear {',
' white-space: nowrap;',
'}',
'.blocklyWidgetDiv .goog-date-picker table {',
' border-collapse: collapse;',
'}',
'.blocklyWidgetDiv .goog-date-picker-other-month {',
' color: #888;',
'}',
'.blocklyWidgetDiv .goog-date-picker-wkend-start,',
'.blocklyWidgetDiv .goog-date-picker-wkend-end {',
' background: #eee;',
'}',
/** Use td.className instead of !important */
'.blocklyWidgetDiv td.goog-date-picker-selected {',
' background: #c3d9ff;',
'}',
'.blocklyWidgetDiv .goog-date-picker-today {',
' background: #9ab;',
' font-weight: bold !important;',
' border-color: #246 #9bd #9bd #246;',
' color: #fff;',
'}'
];
......@@ -368,14 +368,14 @@ function getFieldsJson_(block) {
fields.push({
type: block.type,
name: block.getFieldValue('FIELDNAME'),
angle: block.getFieldValue('ANGLE')
angle: Number(block.getFieldValue('ANGLE'))
});
break;
case 'field_checkbox':
fields.push({
type: block.type,
name: block.getFieldValue('FIELDNAME'),
checked: block.getFieldValue('CHECKED')
checked: block.getFieldValue('CHECKED') == 'TRUE'
});
break;
case 'field_colour':
......@@ -416,7 +416,6 @@ function getFieldsJson_(block) {
case 'field_image':
fields.push({
type: block.type,
name: block.getFieldValue('FIELDNAME'),
src: block.getFieldValue('SRC'),
width: Number(block.getFieldValue('WIDTH')),
height: Number(block.getFieldValue('HEIGHT')),
......@@ -603,14 +602,18 @@ function updatePreview() {
if (Blockly.Blocks[blockType]) {
throw 'Block name collides with existing property: ' + blockType;
}
var code = document.getElementById('languagePre').textContent;
var code = document.getElementById('languagePre').textContent.trim();
if (!code) {
// Nothing to render. Happens while cloud storage is loading.
return;
}
var format = document.getElementById('format').value;
if (format == 'JSON') {
Blockly.Blocks[blockType] = {
init: function() {
this.jsonInit(JSON.parse(code));
}
};;
};
} else if (format == 'JavaScript') {
eval(code);
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment