diff --git a/blockly_uncompressed.js b/blockly_uncompressed.js index c498aa194..955381da6 100644 --- a/blockly_uncompressed.js +++ b/blockly_uncompressed.js @@ -34,50 +34,50 @@ this.BLOCKLY_BOOT = function(root) { dir = this.BLOCKLY_DIR.match(/[^\/]+$/)[0]; } // Execute after Closure has loaded. -goog.addDependency("../../../" + dir + "/core/block.js", ['Blockly.Block'], ['Blockly.Blocks', 'Blockly.Comment', 'Blockly.Connection', 'Blockly.Events.BlockChange', 'Blockly.Events.BlockCreate', 'Blockly.Events.BlockDelete', 'Blockly.Events.BlockMove', 'Blockly.Extensions', 'Blockly.Input', 'Blockly.Mutator', 'Blockly.utils', 'Blockly.Warning', 'Blockly.Workspace', 'goog.math.Coordinate']); +goog.addDependency("../../../" + dir + "/core/block.js", ['Blockly.Block'], ['Blockly.Blocks', 'Blockly.Comment', 'Blockly.Connection', 'Blockly.Events.BlockChange', 'Blockly.Events.BlockCreate', 'Blockly.Events.BlockDelete', 'Blockly.Events.BlockMove', 'Blockly.Extensions', 'Blockly.Input', 'Blockly.Mutator', 'Blockly.utils', 'Blockly.Warning', 'Blockly.Workspace', 'goog.math.Coordinate', 'goog.color']); goog.addDependency("../../../" + dir + "/core/block_animations.js", ['Blockly.BlockAnimations'], ['Blockly.utils']); goog.addDependency("../../../" + dir + "/core/block_drag_surface.js", ['Blockly.BlockDragSurfaceSvg'], ['Blockly.utils', 'goog.math.Coordinate']); goog.addDependency("../../../" + dir + "/core/block_dragger.js", ['Blockly.BlockDragger'], ['Blockly.BlockAnimations', 'Blockly.InsertionMarkerManager', 'Blockly.Events.BlockMove', 'goog.math.Coordinate']); goog.addDependency("../../../" + dir + "/core/block_events.js", ['Blockly.Events.BlockBase', 'Blockly.Events.BlockChange', 'Blockly.Events.BlockCreate', 'Blockly.Events.BlockDelete', 'Blockly.Events.BlockMove', 'Blockly.Events.Change', 'Blockly.Events.Create', 'Blockly.Events.Delete', 'Blockly.Events.Move'], ['Blockly.Events', 'Blockly.Events.Abstract', 'Blockly.Xml.utils', 'goog.math.Coordinate']); -goog.addDependency("../../../" + dir + "/core/block_render_svg.js", ['Blockly.BlockSvg.render'], ['Blockly.BlockSvg']); +goog.addDependency("../../../" + dir + "/core/block_render_svg.js", ['Blockly.BlockSvg.render'], ['Blockly.BlockSvg', 'Blockly.utils']); goog.addDependency("../../../" + dir + "/core/block_svg.js", ['Blockly.BlockSvg'], ['Blockly.Block', 'Blockly.BlockAnimations', 'Blockly.ContextMenu', 'Blockly.Events.Ui', 'Blockly.Events.BlockMove', 'Blockly.Grid', 'Blockly.RenderedConnection', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.utils', 'goog.color', 'goog.math.Coordinate']); goog.addDependency("../../../" + dir + "/core/blockly.js", ['Blockly'], ['Blockly.BlockSvg.render', 'Blockly.Events', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldDropdown', 'Blockly.FieldLabelSerializable', 'Blockly.FieldImage', 'Blockly.FieldTextInput', 'Blockly.FieldNumber', 'Blockly.FieldVariable', 'Blockly.Generator', 'Blockly.Msg', 'Blockly.Procedures', 'Blockly.Toolbox', 'Blockly.Touch', 'Blockly.WidgetDiv', 'Blockly.WorkspaceSvg', 'Blockly.constants', 'Blockly.inject', 'Blockly.utils', 'Blockly.Xml', 'goog.color']); goog.addDependency("../../../" + dir + "/core/blocks.js", ['Blockly.Blocks'], []); -goog.addDependency("../../../" + dir + "/core/bubble.js", ['Blockly.Bubble'], ['Blockly.Touch', 'Blockly.Workspace', 'goog.math.Coordinate', 'goog.userAgent']); +goog.addDependency("../../../" + dir + "/core/bubble.js", ['Blockly.Bubble'], ['Blockly.Touch', 'Blockly.userAgent', 'Blockly.utils', 'Blockly.Workspace', 'goog.math.Coordinate']); goog.addDependency("../../../" + dir + "/core/bubble_dragger.js", ['Blockly.BubbleDragger'], ['Blockly.Bubble', 'Blockly.Events.CommentMove', 'Blockly.utils', 'Blockly.WorkspaceCommentSvg', 'goog.math.Coordinate']); -goog.addDependency("../../../" + dir + "/core/comment.js", ['Blockly.Comment'], ['Blockly.Bubble', 'Blockly.Events.BlockChange', 'Blockly.Events.Ui', 'Blockly.Icon', 'Blockly.utils', 'goog.userAgent']); +goog.addDependency("../../../" + dir + "/core/comment.js", ['Blockly.Comment'], ['Blockly.Bubble', 'Blockly.Events.BlockChange', 'Blockly.Events.Ui', 'Blockly.Icon', 'Blockly.userAgent', 'Blockly.utils']); goog.addDependency("../../../" + dir + "/core/connection.js", ['Blockly.Connection'], ['Blockly.Events.BlockMove', 'Blockly.Xml']); goog.addDependency("../../../" + dir + "/core/connection_db.js", ['Blockly.ConnectionDB'], ['Blockly.Connection']); goog.addDependency("../../../" + dir + "/core/constants.js", ['Blockly.constants'], []); -goog.addDependency("../../../" + dir + "/core/contextmenu.js", ['Blockly.ContextMenu'], ['Blockly.Events.BlockCreate', 'Blockly.utils', 'Blockly.utils.uiMenu', 'Blockly.Xml', 'goog.events', 'goog.math.Coordinate', 'goog.ui.Menu', 'goog.ui.MenuItem', 'goog.userAgent']); +goog.addDependency("../../../" + dir + "/core/contextmenu.js", ['Blockly.ContextMenu'], ['Blockly.Events.BlockCreate', 'Blockly.userAgent', 'Blockly.utils', 'Blockly.utils.uiMenu', 'Blockly.Xml', 'goog.events', 'goog.math.Coordinate', 'goog.ui.Menu', 'goog.ui.MenuItem']); goog.addDependency("../../../" + dir + "/core/css.js", ['Blockly.Css'], []); goog.addDependency("../../../" + dir + "/core/dragged_connection_manager.js", ['Blockly.DraggedConnectionManager'], ['Blockly.BlockAnimations', 'Blockly.RenderedConnection', 'goog.math.Coordinate']); goog.addDependency("../../../" + dir + "/core/dropdowndiv.js", ['Blockly.DropDownDiv'], ['Blockly.utils', 'goog.dom', 'goog.style']); goog.addDependency("../../../" + dir + "/core/events.js", ['Blockly.Events'], ['Blockly.utils']); goog.addDependency("../../../" + dir + "/core/events_abstract.js", ['Blockly.Events.Abstract'], ['Blockly.Events']); goog.addDependency("../../../" + dir + "/core/extensions.js", ['Blockly.Extensions'], ['Blockly.Mutator', 'Blockly.utils']); -goog.addDependency("../../../" + dir + "/core/field.js", ['Blockly.Field'], ['Blockly.Events.BlockChange', 'Blockly.Gesture', 'Blockly.utils', 'goog.math.Size', 'goog.style', 'goog.userAgent']); -goog.addDependency("../../../" + dir + "/core/field_angle.js", ['Blockly.FieldAngle'], ['Blockly.DropDownDiv', 'Blockly.FieldTextInput', 'Blockly.utils', 'goog.userAgent']); +goog.addDependency("../../../" + dir + "/core/field.js", ['Blockly.Field'], ['Blockly.Events.BlockChange', 'Blockly.Gesture', 'Blockly.userAgent', 'Blockly.utils', 'goog.math.Size', 'goog.style']); +goog.addDependency("../../../" + dir + "/core/field_angle.js", ['Blockly.FieldAngle'], ['Blockly.DropDownDiv', 'Blockly.FieldTextInput', 'Blockly.userAgent', 'Blockly.utils']); goog.addDependency("../../../" + dir + "/core/field_checkbox.js", ['Blockly.FieldCheckbox'], ['Blockly.Field', 'Blockly.utils']); -goog.addDependency("../../../" + dir + "/core/field_colour.js", ['Blockly.FieldColour'], ['Blockly.DropDownDiv', 'Blockly.Field', 'Blockly.utils', 'goog.style']); +goog.addDependency("../../../" + dir + "/core/field_colour.js", ['Blockly.FieldColour'], ['Blockly.DropDownDiv', 'Blockly.Field', 'goog.style']); goog.addDependency("../../../" + dir + "/core/field_date.js", ['Blockly.FieldDate'], ['Blockly.Field', 'Blockly.utils', 'goog.date', 'goog.date.DateTime', 'goog.events', 'goog.i18n.DateTimeSymbols', 'goog.i18n.DateTimeSymbols_he', 'goog.style', 'goog.ui.DatePicker']); -goog.addDependency("../../../" + dir + "/core/field_dropdown.js", ['Blockly.FieldDropdown'], ['Blockly.Field', 'Blockly.utils', 'Blockly.utils.uiMenu', 'goog.events', 'goog.ui.Menu', 'goog.ui.MenuItem', 'goog.userAgent']); +goog.addDependency("../../../" + dir + "/core/field_dropdown.js", ['Blockly.FieldDropdown'], ['Blockly.Field', 'Blockly.userAgent', 'Blockly.utils', 'Blockly.utils.uiMenu', 'goog.events', 'goog.ui.Menu', 'goog.ui.MenuItem']); goog.addDependency("../../../" + dir + "/core/field_image.js", ['Blockly.FieldImage'], ['Blockly.Field', 'Blockly.utils', 'goog.math.Size']); goog.addDependency("../../../" + dir + "/core/field_label.js", ['Blockly.FieldLabel'], ['Blockly.Field', 'Blockly.Tooltip', 'Blockly.utils', 'goog.math.Size']); -goog.addDependency("../../../" + dir + "/core/field_label_serializable.js", ['Blockly.FieldLabelSerializable'], ['Blockly.FieldLabel']); +goog.addDependency("../../../" + dir + "/core/field_label_serializable.js", ['Blockly.FieldLabelSerializable'], ['Blockly.FieldLabel', 'Blockly.utils']); goog.addDependency("../../../" + dir + "/core/field_number.js", ['Blockly.FieldNumber'], ['Blockly.FieldTextInput']); -goog.addDependency("../../../" + dir + "/core/field_textinput.js", ['Blockly.FieldTextInput'], ['Blockly.DropDownDiv', 'Blockly.Field', 'Blockly.Msg', 'Blockly.utils', 'goog.math.Coordinate', 'goog.userAgent']); +goog.addDependency("../../../" + dir + "/core/field_textinput.js", ['Blockly.FieldTextInput'], ['Blockly.DropDownDiv', 'Blockly.Field', 'Blockly.Msg', 'Blockly.userAgent', 'Blockly.utils', 'goog.math.Coordinate']); goog.addDependency("../../../" + dir + "/core/field_variable.js", ['Blockly.FieldVariable'], ['Blockly.FieldDropdown', 'Blockly.Msg', 'Blockly.utils', 'Blockly.VariableModel', 'Blockly.Variables', 'goog.math.Size']); goog.addDependency("../../../" + dir + "/core/flyout_base.js", ['Blockly.Flyout'], ['Blockly.Block', 'Blockly.Events', 'Blockly.Events.BlockCreate', 'Blockly.Events.VarCreate', 'Blockly.FlyoutButton', 'Blockly.Gesture', 'Blockly.Touch', 'Blockly.utils', 'Blockly.WorkspaceSvg', 'Blockly.Xml', 'goog.math.Rect']); goog.addDependency("../../../" + dir + "/core/flyout_button.js", ['Blockly.FlyoutButton'], ['Blockly.utils', 'goog.math.Coordinate']); goog.addDependency("../../../" + dir + "/core/flyout_dragger.js", ['Blockly.FlyoutDragger'], ['Blockly.WorkspaceDragger']); -goog.addDependency("../../../" + dir + "/core/flyout_horizontal.js", ['Blockly.HorizontalFlyout'], ['Blockly.Block', 'Blockly.Events', 'Blockly.FlyoutButton', 'Blockly.Flyout', 'Blockly.WorkspaceSvg', 'goog.math.Rect', 'goog.userAgent']); -goog.addDependency("../../../" + dir + "/core/flyout_vertical.js", ['Blockly.VerticalFlyout'], ['Blockly.Block', 'Blockly.Events', 'Blockly.Flyout', 'Blockly.FlyoutButton', 'Blockly.WorkspaceSvg', 'goog.math.Rect', 'goog.userAgent']); +goog.addDependency("../../../" + dir + "/core/flyout_horizontal.js", ['Blockly.HorizontalFlyout'], ['Blockly.Block', 'Blockly.Events', 'Blockly.FlyoutButton', 'Blockly.Flyout', 'Blockly.utils', 'Blockly.WorkspaceSvg', 'goog.math.Rect']); +goog.addDependency("../../../" + dir + "/core/flyout_vertical.js", ['Blockly.VerticalFlyout'], ['Blockly.Block', 'Blockly.Events', 'Blockly.Flyout', 'Blockly.FlyoutButton', 'Blockly.userAgent', 'Blockly.utils', 'Blockly.WorkspaceSvg', 'goog.math.Rect']); goog.addDependency("../../../" + dir + "/core/generator.js", ['Blockly.Generator'], ['Blockly.Block']); goog.addDependency("../../../" + dir + "/core/gesture.js", ['Blockly.Gesture'], ['Blockly.BlockAnimations', 'Blockly.BlockDragger', 'Blockly.BubbleDragger', 'Blockly.constants', 'Blockly.Events.Ui', 'Blockly.FlyoutDragger', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.utils', 'Blockly.WorkspaceDragger', 'goog.math.Coordinate']); -goog.addDependency("../../../" + dir + "/core/grid.js", ['Blockly.Grid'], ['Blockly.utils', 'goog.userAgent']); +goog.addDependency("../../../" + dir + "/core/grid.js", ['Blockly.Grid'], ['Blockly.userAgent', 'Blockly.utils']); goog.addDependency("../../../" + dir + "/core/icon.js", ['Blockly.Icon'], ['Blockly.utils', 'goog.math.Coordinate']); -goog.addDependency("../../../" + dir + "/core/inject.js", ['Blockly.inject'], ['Blockly.BlockDragSurfaceSvg', 'Blockly.Css', 'Blockly.DropDownDiv', 'Blockly.Grid', 'Blockly.Options', 'Blockly.utils', 'Blockly.WorkspaceSvg', 'Blockly.WorkspaceDragSurfaceSvg', 'goog.ui.Component', 'goog.userAgent']); +goog.addDependency("../../../" + dir + "/core/inject.js", ['Blockly.inject'], ['Blockly.BlockDragSurfaceSvg', 'Blockly.Css', 'Blockly.DropDownDiv', 'Blockly.Grid', 'Blockly.Options', 'Blockly.userAgent', 'Blockly.utils', 'Blockly.WorkspaceSvg', 'Blockly.WorkspaceDragSurfaceSvg', 'goog.ui.Component']); goog.addDependency("../../../" + dir + "/core/input.js", ['Blockly.Input'], ['Blockly.Connection', 'Blockly.FieldLabel']); goog.addDependency("../../../" + dir + "/core/insertion_marker_manager.js", ['Blockly.InsertionMarkerManager'], ['Blockly.BlockAnimations', 'Blockly.Events.BlockMove', 'Blockly.RenderedConnection', 'goog.math.Coordinate']); goog.addDependency("../../../" + dir + "/core/msg.js", ['Blockly.Msg'], []); @@ -98,7 +98,8 @@ goog.addDependency("../../../" + dir + "/core/touch_gesture.js", ['Blockly.Touch goog.addDependency("../../../" + dir + "/core/trashcan.js", ['Blockly.Trashcan'], ['Blockly.utils', 'goog.math.Rect']); goog.addDependency("../../../" + dir + "/core/ui_events.js", ['Blockly.Events.Ui'], ['Blockly.Events', 'Blockly.Events.Abstract']); goog.addDependency("../../../" + dir + "/core/ui_menu_utils.js", ['Blockly.utils.uiMenu'], []); -goog.addDependency("../../../" + dir + "/core/utils.js", ['Blockly.utils'], ['goog.dom', 'goog.math.Coordinate', 'goog.userAgent']); +goog.addDependency("../../../" + dir + "/core/useragent.js", ['Blockly.userAgent'], []); +goog.addDependency("../../../" + dir + "/core/utils.js", ['Blockly.utils'], ['Blockly.userAgent', 'goog.dom', 'goog.math.Coordinate']); goog.addDependency("../../../" + dir + "/core/variable_events.js", ['Blockly.Events.VarBase', 'Blockly.Events.VarCreate', 'Blockly.Events.VarDelete', 'Blockly.Events.VarRename'], ['Blockly.Events', 'Blockly.Events.Abstract']); goog.addDependency("../../../" + dir + "/core/variable_map.js", ['Blockly.VariableMap'], ['Blockly.Events.VarDelete', 'Blockly.Events.VarRename', 'Blockly.utils']); goog.addDependency("../../../" + dir + "/core/variable_model.js", ['Blockly.VariableModel'], ['Blockly.Events.VarCreate', 'Blockly.utils']); @@ -107,7 +108,7 @@ goog.addDependency("../../../" + dir + "/core/variables_dynamic.js", ['Blockly.V goog.addDependency("../../../" + dir + "/core/warning.js", ['Blockly.Warning'], ['Blockly.Bubble', 'Blockly.Events.Ui', 'Blockly.Icon', 'Blockly.utils']); goog.addDependency("../../../" + dir + "/core/widgetdiv.js", ['Blockly.WidgetDiv'], ['Blockly.Css', 'goog.style']); goog.addDependency("../../../" + dir + "/core/workspace.js", ['Blockly.Workspace'], ['Blockly.utils', 'Blockly.VariableMap', 'Blockly.WorkspaceComment']); -goog.addDependency("../../../" + dir + "/core/workspace_audio.js", ['Blockly.WorkspaceAudio'], ['goog.userAgent']); +goog.addDependency("../../../" + dir + "/core/workspace_audio.js", ['Blockly.WorkspaceAudio'], ['Blockly.userAgent']); goog.addDependency("../../../" + dir + "/core/workspace_comment.js", ['Blockly.WorkspaceComment'], ['Blockly.Events.CommentChange', 'Blockly.Events.CommentCreate', 'Blockly.Events.CommentDelete', 'Blockly.Events.CommentMove', 'Blockly.utils', 'Blockly.Xml.utils', 'goog.math.Coordinate']); goog.addDependency("../../../" + dir + "/core/workspace_comment_render_svg.js", ['Blockly.WorkspaceCommentSvg.render'], ['Blockly.utils', 'Blockly.WorkspaceCommentSvg', 'goog.math.Coordinate']); goog.addDependency("../../../" + dir + "/core/workspace_comment_svg.js", ['Blockly.WorkspaceCommentSvg'], ['Blockly.Events.CommentCreate', 'Blockly.Events.CommentDelete', 'Blockly.Events.CommentMove', 'Blockly.utils', 'Blockly.WorkspaceComment', 'goog.math.Coordinate']); @@ -116,7 +117,7 @@ goog.addDependency("../../../" + dir + "/core/workspace_dragger.js", ['Blockly.W goog.addDependency("../../../" + dir + "/core/workspace_events.js", ['Blockly.Events.FinishedLoading'], ['Blockly.Events', 'Blockly.Events.Abstract']); goog.addDependency("../../../" + dir + "/core/workspace_svg.js", ['Blockly.WorkspaceSvg'], ['Blockly.ConnectionDB', 'Blockly.constants', 'Blockly.Events.BlockCreate', 'Blockly.Gesture', 'Blockly.Grid', 'Blockly.Options', 'Blockly.ScrollbarPair', 'Blockly.Touch', 'Blockly.TouchGesture', 'Blockly.Trashcan', 'Blockly.utils', 'Blockly.VariablesDynamic', 'Blockly.Workspace', 'Blockly.WorkspaceAudio', 'Blockly.WorkspaceComment', 'Blockly.WorkspaceCommentSvg', 'Blockly.WorkspaceCommentSvg.render', 'Blockly.WorkspaceDragSurfaceSvg', 'Blockly.Xml', 'Blockly.ZoomControls', 'goog.dom', 'goog.math.Coordinate']); goog.addDependency("../../../" + dir + "/core/ws_comment_events.js", ['Blockly.Events.CommentBase', 'Blockly.Events.CommentChange', 'Blockly.Events.CommentCreate', 'Blockly.Events.CommentDelete', 'Blockly.Events.CommentMove'], ['Blockly.Events', 'Blockly.Events.Abstract', 'Blockly.Xml', 'Blockly.Xml.utils', 'goog.math.Coordinate']); -goog.addDependency("../../../" + dir + "/core/xml.js", ['Blockly.Xml'], ['Blockly.Events.BlockCreate', 'Blockly.Events.FinishedLoading', 'Blockly.Events.VarCreate', 'Blockly.Xml.utils']); +goog.addDependency("../../../" + dir + "/core/xml.js", ['Blockly.Xml'], ['Blockly.Events.BlockCreate', 'Blockly.Events.FinishedLoading', 'Blockly.Events.VarCreate', 'Blockly.utils', 'Blockly.Xml.utils']); goog.addDependency("../../../" + dir + "/core/xml_utils.js", ['Blockly.Xml.utils'], []); goog.addDependency("../../../" + dir + "/core/zoom_controls.js", ['Blockly.ZoomControls'], ['Blockly.Touch', 'Blockly.utils']); goog.addDependency("../../alltests.js", [], []); @@ -725,7 +726,7 @@ goog.addDependency("i18n/dateintervalpatternsext.js", [], []); goog.addDependency("i18n/dateintervalsymbols.js", [], []); goog.addDependency("i18n/dateintervalsymbolsext.js", [], []); goog.addDependency("i18n/datetimeformat.js", ['goog.i18n.DateTimeFormat', 'goog.i18n.DateTimeFormat.Format'], ['goog.asserts', 'goog.date', 'goog.i18n.DateTimeSymbols', 'goog.i18n.TimeZone', 'goog.string']); -goog.addDependency("i18n/datetimeformat_test.js", ['goog.i18n.DateTimeFormatTest'], ['goog.date.Date', 'goog.date.DateTime', 'goog.i18n.DateTimeFormat', 'goog.i18n.DateTimePatterns', 'goog.i18n.DateTimePatterns_ar_EG', 'goog.i18n.DateTimePatterns_bg', 'goog.i18n.DateTimePatterns_de', 'goog.i18n.DateTimePatterns_en', 'goog.i18n.DateTimePatterns_en_XA', 'goog.i18n.DateTimePatterns_fa', 'goog.i18n.DateTimePatterns_fr', 'goog.i18n.DateTimePatterns_ja', 'goog.i18n.DateTimePatterns_sv', 'goog.i18n.DateTimePatterns_zh_HK', 'goog.i18n.DateTimePatterns_zh_Hant_TW', 'goog.i18n.DateTimeSymbols', 'goog.i18n.DateTimeSymbols_ar_AE', 'goog.i18n.DateTimeSymbols_ar_EG', 'goog.i18n.DateTimeSymbols_ar_SA', 'goog.i18n.DateTimeSymbols_bn_BD', 'goog.i18n.DateTimeSymbols_de', 'goog.i18n.DateTimeSymbols_en', 'goog.i18n.DateTimeSymbols_en_GB', 'goog.i18n.DateTimeSymbols_en_IE', 'goog.i18n.DateTimeSymbols_en_IN', 'goog.i18n.DateTimeSymbols_en_US', 'goog.i18n.DateTimeSymbols_fa', 'goog.i18n.DateTimeSymbols_fr', 'goog.i18n.DateTimeSymbols_fr_DJ', 'goog.i18n.DateTimeSymbols_he_IL', 'goog.i18n.DateTimeSymbols_ja', 'goog.i18n.DateTimeSymbols_ro_RO', 'goog.i18n.DateTimeSymbols_sv', 'goog.i18n.TimeZone', 'goog.testing.jsunit']); +goog.addDependency("i18n/datetimeformat_test.js", ['goog.i18n.DateTimeFormatTest'], ['goog.date.Date', 'goog.date.DateTime', 'goog.i18n.DateTimeFormat', 'goog.i18n.DateTimePatterns', 'goog.i18n.DateTimePatterns_ar_EG', 'goog.i18n.DateTimePatterns_de', 'goog.i18n.DateTimePatterns_en', 'goog.i18n.DateTimePatterns_fa', 'goog.i18n.DateTimePatterns_fr', 'goog.i18n.DateTimePatterns_ja', 'goog.i18n.DateTimePatterns_sv', 'goog.i18n.DateTimeSymbols', 'goog.i18n.DateTimeSymbols_ar_AE', 'goog.i18n.DateTimeSymbols_ar_EG', 'goog.i18n.DateTimeSymbols_ar_SA', 'goog.i18n.DateTimeSymbols_bn_BD', 'goog.i18n.DateTimeSymbols_de', 'goog.i18n.DateTimeSymbols_en', 'goog.i18n.DateTimeSymbols_en_GB', 'goog.i18n.DateTimeSymbols_en_IE', 'goog.i18n.DateTimeSymbols_en_IN', 'goog.i18n.DateTimeSymbols_en_US', 'goog.i18n.DateTimeSymbols_fa', 'goog.i18n.DateTimeSymbols_fr', 'goog.i18n.DateTimeSymbols_fr_DJ', 'goog.i18n.DateTimeSymbols_he_IL', 'goog.i18n.DateTimeSymbols_ja', 'goog.i18n.DateTimeSymbols_ro_RO', 'goog.i18n.DateTimeSymbols_sv', 'goog.i18n.TimeZone', 'goog.testing.jsunit']); goog.addDependency("i18n/datetimeparse.js", ['goog.i18n.DateTimeParse'], ['goog.asserts', 'goog.date', 'goog.i18n.DateTimeFormat', 'goog.i18n.DateTimeSymbols']); goog.addDependency("i18n/datetimeparse_test.js", ['goog.i18n.DateTimeParseTest'], ['goog.date.Date', 'goog.i18n.DateTimeFormat', 'goog.i18n.DateTimeParse', 'goog.i18n.DateTimeSymbols', 'goog.i18n.DateTimeSymbols_en', 'goog.i18n.DateTimeSymbols_fa', 'goog.i18n.DateTimeSymbols_fr', 'goog.i18n.DateTimeSymbols_pl', 'goog.i18n.DateTimeSymbols_zh', 'goog.testing.ExpectedFailures', 'goog.testing.jsunit', 'goog.userAgent']); goog.addDependency("i18n/datetimepatterns.js", ['goog.i18n.DateTimePatterns', 'goog.i18n.DateTimePatterns_af', 'goog.i18n.DateTimePatterns_am', 'goog.i18n.DateTimePatterns_ar', 'goog.i18n.DateTimePatterns_ar_DZ', 'goog.i18n.DateTimePatterns_ar_EG', 'goog.i18n.DateTimePatterns_az', 'goog.i18n.DateTimePatterns_be', 'goog.i18n.DateTimePatterns_bg', 'goog.i18n.DateTimePatterns_bn', 'goog.i18n.DateTimePatterns_br', 'goog.i18n.DateTimePatterns_bs', 'goog.i18n.DateTimePatterns_ca', 'goog.i18n.DateTimePatterns_chr', 'goog.i18n.DateTimePatterns_cs', 'goog.i18n.DateTimePatterns_cy', 'goog.i18n.DateTimePatterns_da', 'goog.i18n.DateTimePatterns_de', 'goog.i18n.DateTimePatterns_de_AT', 'goog.i18n.DateTimePatterns_de_CH', 'goog.i18n.DateTimePatterns_el', 'goog.i18n.DateTimePatterns_en', 'goog.i18n.DateTimePatterns_en_AU', 'goog.i18n.DateTimePatterns_en_CA', 'goog.i18n.DateTimePatterns_en_GB', 'goog.i18n.DateTimePatterns_en_IE', 'goog.i18n.DateTimePatterns_en_IN', 'goog.i18n.DateTimePatterns_en_SG', 'goog.i18n.DateTimePatterns_en_US', 'goog.i18n.DateTimePatterns_en_ZA', 'goog.i18n.DateTimePatterns_es', 'goog.i18n.DateTimePatterns_es_419', 'goog.i18n.DateTimePatterns_es_ES', 'goog.i18n.DateTimePatterns_es_MX', 'goog.i18n.DateTimePatterns_es_US', 'goog.i18n.DateTimePatterns_et', 'goog.i18n.DateTimePatterns_eu', 'goog.i18n.DateTimePatterns_fa', 'goog.i18n.DateTimePatterns_fi', 'goog.i18n.DateTimePatterns_fil', 'goog.i18n.DateTimePatterns_fr', 'goog.i18n.DateTimePatterns_fr_CA', 'goog.i18n.DateTimePatterns_ga', 'goog.i18n.DateTimePatterns_gl', 'goog.i18n.DateTimePatterns_gsw', 'goog.i18n.DateTimePatterns_gu', 'goog.i18n.DateTimePatterns_haw', 'goog.i18n.DateTimePatterns_he', 'goog.i18n.DateTimePatterns_hi', 'goog.i18n.DateTimePatterns_hr', 'goog.i18n.DateTimePatterns_hu', 'goog.i18n.DateTimePatterns_hy', 'goog.i18n.DateTimePatterns_id', 'goog.i18n.DateTimePatterns_in', 'goog.i18n.DateTimePatterns_is', 'goog.i18n.DateTimePatterns_it', 'goog.i18n.DateTimePatterns_iw', 'goog.i18n.DateTimePatterns_ja', 'goog.i18n.DateTimePatterns_ka', 'goog.i18n.DateTimePatterns_kk', 'goog.i18n.DateTimePatterns_km', 'goog.i18n.DateTimePatterns_kn', 'goog.i18n.DateTimePatterns_ko', 'goog.i18n.DateTimePatterns_ky', 'goog.i18n.DateTimePatterns_ln', 'goog.i18n.DateTimePatterns_lo', 'goog.i18n.DateTimePatterns_lt', 'goog.i18n.DateTimePatterns_lv', 'goog.i18n.DateTimePatterns_mk', 'goog.i18n.DateTimePatterns_ml', 'goog.i18n.DateTimePatterns_mn', 'goog.i18n.DateTimePatterns_mo', 'goog.i18n.DateTimePatterns_mr', 'goog.i18n.DateTimePatterns_ms', 'goog.i18n.DateTimePatterns_mt', 'goog.i18n.DateTimePatterns_my', 'goog.i18n.DateTimePatterns_nb', 'goog.i18n.DateTimePatterns_ne', 'goog.i18n.DateTimePatterns_nl', 'goog.i18n.DateTimePatterns_no', 'goog.i18n.DateTimePatterns_no_NO', 'goog.i18n.DateTimePatterns_or', 'goog.i18n.DateTimePatterns_pa', 'goog.i18n.DateTimePatterns_pl', 'goog.i18n.DateTimePatterns_pt', 'goog.i18n.DateTimePatterns_pt_BR', 'goog.i18n.DateTimePatterns_pt_PT', 'goog.i18n.DateTimePatterns_ro', 'goog.i18n.DateTimePatterns_ru', 'goog.i18n.DateTimePatterns_sh', 'goog.i18n.DateTimePatterns_si', 'goog.i18n.DateTimePatterns_sk', 'goog.i18n.DateTimePatterns_sl', 'goog.i18n.DateTimePatterns_sq', 'goog.i18n.DateTimePatterns_sr', 'goog.i18n.DateTimePatterns_sr_Latn', 'goog.i18n.DateTimePatterns_sv', 'goog.i18n.DateTimePatterns_sw', 'goog.i18n.DateTimePatterns_ta', 'goog.i18n.DateTimePatterns_te', 'goog.i18n.DateTimePatterns_th', 'goog.i18n.DateTimePatterns_tl', 'goog.i18n.DateTimePatterns_tr', 'goog.i18n.DateTimePatterns_uk', 'goog.i18n.DateTimePatterns_ur', 'goog.i18n.DateTimePatterns_uz', 'goog.i18n.DateTimePatterns_vi', 'goog.i18n.DateTimePatterns_zh', 'goog.i18n.DateTimePatterns_zh_CN', 'goog.i18n.DateTimePatterns_zh_HK', 'goog.i18n.DateTimePatterns_zh_TW', 'goog.i18n.DateTimePatterns_zu'], []); @@ -1842,6 +1843,7 @@ goog.require('Blockly.Xml.utils'); goog.require('Blockly.ZoomControls'); goog.require('Blockly.constants'); goog.require('Blockly.inject'); +goog.require('Blockly.userAgent'); goog.require('Blockly.utils'); goog.require('Blockly.utils.uiMenu'); diff --git a/core/block_render_svg.js b/core/block_render_svg.js index d8753a18f..6c9052934 100644 --- a/core/block_render_svg.js +++ b/core/block_render_svg.js @@ -28,6 +28,7 @@ goog.provide('Blockly.BlockSvg.render'); goog.require('Blockly.BlockSvg'); +goog.require('Blockly.utils'); /** diff --git a/core/bubble.js b/core/bubble.js index ef2ff9c71..3d3ace56c 100644 --- a/core/bubble.js +++ b/core/bubble.js @@ -27,6 +27,7 @@ goog.provide('Blockly.Bubble'); goog.require('Blockly.Touch'); +goog.require('Blockly.userAgent'); goog.require('Blockly.utils'); goog.require('Blockly.Workspace'); @@ -225,7 +226,7 @@ Blockly.Bubble.prototype.createDom_ = function(content, hasResize) { this.bubbleGroup_ = Blockly.utils.createSvgElement('g', {}, null); var filter = {'filter': 'url(#' + this.workspace_.options.embossFilterId + ')'}; - if (Blockly.utils.userAgent.JAVA_FX) { + if (Blockly.userAgent.JAVA_FX) { // Multiple reports that JavaFX can't handle filters. // https://github.com/google/blockly/issues/99 filter = {}; diff --git a/core/comment.js b/core/comment.js index f269e5ec6..73a9c6695 100644 --- a/core/comment.js +++ b/core/comment.js @@ -30,6 +30,7 @@ goog.require('Blockly.Bubble'); goog.require('Blockly.Events.BlockChange'); goog.require('Blockly.Events.Ui'); goog.require('Blockly.Icon'); +goog.require('Blockly.userAgent'); goog.require('Blockly.utils'); @@ -183,7 +184,7 @@ Blockly.Comment.prototype.setVisible = function(visible) { Blockly.Events.fire( new Blockly.Events.Ui(this.block_, 'commentOpen', !visible, visible)); if ((!this.block_.isEditable() && !this.textarea_) || - Blockly.utils.userAgent.IE) { + Blockly.userAgent.IE) { // Steal the code from warnings to make an uneditable text bubble. // MSIE does not support foreignobject; textareas are impossible. // https://docs.microsoft.com/en-us/openspecs/ie_standards/ms-svg/56e6e04c-7c8c-44dd-8100-bd745ee42034 diff --git a/core/contextmenu.js b/core/contextmenu.js index e8e75f18d..f9e7a39bd 100644 --- a/core/contextmenu.js +++ b/core/contextmenu.js @@ -31,6 +31,7 @@ goog.provide('Blockly.ContextMenu'); goog.require('Blockly.Events.BlockCreate'); +goog.require('Blockly.userAgent'); goog.require('Blockly.utils'); goog.require('Blockly.utils.uiMenu'); goog.require('Blockly.Xml'); @@ -279,7 +280,7 @@ Blockly.ContextMenu.blockDuplicateOption = function(block) { */ Blockly.ContextMenu.blockCommentOption = function(block) { var commentOption = { - enabled: !Blockly.utils.userAgent.IE + enabled: !Blockly.userAgent.IE }; // If there's already a comment, add an option to delete it. if (block.comment) { @@ -387,7 +388,7 @@ Blockly.ContextMenu.workspaceCommentOption = function(ws, e) { var wsCommentOption = { // Foreign objects don't work in IE. Don't let the user create comments // that they won't be able to edit. - enabled: !Blockly.utils.userAgent.IE + enabled: !Blockly.userAgent.IE }; wsCommentOption.text = Blockly.Msg.ADD_COMMENT; wsCommentOption.callback = function() { diff --git a/core/field.js b/core/field.js index 54d4cf657..6ce1aa79e 100644 --- a/core/field.js +++ b/core/field.js @@ -30,6 +30,7 @@ goog.provide('Blockly.Field'); goog.require('Blockly.Events.BlockChange'); goog.require('Blockly.Gesture'); +goog.require('Blockly.userAgent'); goog.require('Blockly.utils'); goog.require('goog.math.Size'); @@ -495,7 +496,7 @@ Blockly.Field.getCachedWidth = function(textElement) { // Attempt to compute fetch the width of the SVG text element. try { - if (Blockly.utils.userAgent.IE || Blockly.utils.userAgent.EDGE) { + if (Blockly.userAgent.IE || Blockly.userAgent.EDGE) { width = textElement.getBBox().width; } else { width = textElement.getComputedTextLength(); diff --git a/core/field_angle.js b/core/field_angle.js index 3fb335bd1..2c29395e4 100644 --- a/core/field_angle.js +++ b/core/field_angle.js @@ -28,6 +28,7 @@ goog.provide('Blockly.FieldAngle'); goog.require('Blockly.DropDownDiv'); goog.require('Blockly.FieldTextInput'); +goog.require('Blockly.userAgent'); goog.require('Blockly.utils'); @@ -161,9 +162,9 @@ Blockly.FieldAngle.prototype.dispose_ = function() { */ Blockly.FieldAngle.prototype.showEditor_ = function() { var noFocus = - Blockly.utils.userAgent.MOBILE || - Blockly.utils.userAgent.ANDROID || - Blockly.utils.userAgent.IPAD; + Blockly.userAgent.MOBILE || + Blockly.userAgent.ANDROID || + Blockly.userAgent.IPAD; // Mobile browsers have issues with in-line textareas (focus & keyboards). Blockly.FieldAngle.superClass_.showEditor_.call(this, noFocus); diff --git a/core/field_colour.js b/core/field_colour.js index 8ec1bc223..f3d17df1f 100644 --- a/core/field_colour.js +++ b/core/field_colour.js @@ -28,7 +28,6 @@ goog.provide('Blockly.FieldColour'); goog.require('Blockly.DropDownDiv'); goog.require('Blockly.Field'); -goog.require('Blockly.utils'); goog.require('goog.style'); diff --git a/core/field_dropdown.js b/core/field_dropdown.js index a0c18f3d0..cbfded728 100644 --- a/core/field_dropdown.js +++ b/core/field_dropdown.js @@ -29,6 +29,7 @@ goog.provide('Blockly.FieldDropdown'); goog.require('Blockly.Field'); +goog.require('Blockly.userAgent'); goog.require('Blockly.utils'); goog.require('Blockly.utils.uiMenu'); @@ -97,7 +98,7 @@ Blockly.FieldDropdown.MAX_MENU_HEIGHT_VH = 0.45; * Android can't (in 2014) display "▾", so use "▼" instead. */ Blockly.FieldDropdown.ARROW_CHAR = - Blockly.utils.userAgent.ANDROID ? '\u25BC' : '\u25BE'; + Blockly.userAgent.ANDROID ? '\u25BC' : '\u25BE'; /** * Mouse cursor style when over the hotspot that initiates the editor. @@ -526,7 +527,7 @@ Blockly.FieldDropdown.prototype.renderSelectedText_ = function() { */ Blockly.FieldDropdown.prototype.updateWidth = function() { if (this.imageJson_ && - (Blockly.utils.userAgent.IE || Blockly.utils.userAgent.EDGE)) { + (Blockly.userAgent.IE || Blockly.userAgent.EDGE)) { // Recalculate the full width. var arrowWidth = Blockly.Field.getCachedWidth(this.arrow_); var width = Number(this.imageJson_.width) + arrowWidth + diff --git a/core/field_label_serializable.js b/core/field_label_serializable.js index 26bf18185..182ecbbd4 100644 --- a/core/field_label_serializable.js +++ b/core/field_label_serializable.js @@ -28,6 +28,7 @@ goog.provide('Blockly.FieldLabelSerializable'); goog.require('Blockly.FieldLabel'); +goog.require('Blockly.utils'); /** diff --git a/core/field_textinput.js b/core/field_textinput.js index 251d06898..3fd38c028 100644 --- a/core/field_textinput.js +++ b/core/field_textinput.js @@ -29,6 +29,7 @@ goog.provide('Blockly.FieldTextInput'); goog.require('Blockly.DropDownDiv'); goog.require('Blockly.Field'); goog.require('Blockly.Msg'); +goog.require('Blockly.userAgent'); goog.require('Blockly.utils'); goog.require('goog.math.Coordinate'); @@ -165,9 +166,9 @@ Blockly.FieldTextInput.prototype.setSpellcheck = function(check) { Blockly.FieldTextInput.prototype.showEditor_ = function(opt_quietInput) { this.workspace_ = this.sourceBlock_.workspace; var quietInput = opt_quietInput || false; - if (!quietInput && (Blockly.utils.userAgent.MOBILE || - Blockly.utils.userAgent.ANDROID || - Blockly.utils.userAgent.IPAD)) { + if (!quietInput && (Blockly.userAgent.MOBILE || + Blockly.userAgent.ANDROID || + Blockly.userAgent.IPAD)) { this.showPromptEditor_(); } else { this.showInlineEditor_(quietInput); @@ -301,7 +302,7 @@ Blockly.FieldTextInput.prototype.onHtmlInputChange_ = function(_e) { this.setValue(text); Blockly.Events.setGroup(false); this.validate_(); - } else if (Blockly.utils.userAgent.WEBKIT) { + } else if (Blockly.userAgent.WEBKIT) { // Cursor key. Render the source block to show the caret moving. // Chrome only (version 26, OS X). this.sourceBlock_.render(); @@ -348,13 +349,13 @@ Blockly.FieldTextInput.prototype.resizeEditor_ = function() { // Shift by a few pixels to line up exactly. xy.y += 1; - if (Blockly.utils.userAgent.GECKO && Blockly.WidgetDiv.DIV.style.top) { + if (Blockly.userAgent.GECKO && Blockly.WidgetDiv.DIV.style.top) { // Firefox mis-reports the location of the border by a pixel // once the WidgetDiv is moved into position. xy.x -= 1; xy.y -= 1; } - if (Blockly.utils.userAgent.WEBKIT) { + if (Blockly.userAgent.WEBKIT) { xy.y -= 3; } div.style.left = xy.x + 'px'; diff --git a/core/flyout_horizontal.js b/core/flyout_horizontal.js index 4000aa81d..be8426bb1 100644 --- a/core/flyout_horizontal.js +++ b/core/flyout_horizontal.js @@ -30,6 +30,7 @@ goog.require('Blockly.Block'); goog.require('Blockly.Events'); goog.require('Blockly.FlyoutButton'); goog.require('Blockly.Flyout'); +goog.require('Blockly.utils'); goog.require('Blockly.WorkspaceSvg'); goog.require('goog.math.Rect'); diff --git a/core/flyout_vertical.js b/core/flyout_vertical.js index 417a3e4f6..a2fe351a4 100644 --- a/core/flyout_vertical.js +++ b/core/flyout_vertical.js @@ -30,6 +30,7 @@ goog.require('Blockly.Block'); goog.require('Blockly.Events'); goog.require('Blockly.Flyout'); goog.require('Blockly.FlyoutButton'); +goog.require('Blockly.userAgent'); goog.require('Blockly.utils'); goog.require('Blockly.WorkspaceSvg'); @@ -337,7 +338,7 @@ Blockly.VerticalFlyout.prototype.getClientRect = function() { // Firefox sometimes reports the wrong value for the client rect. // See https://github.com/google/blockly/issues/1425 and // https://bugzilla.mozilla.org/show_bug.cgi?id=1066435 - if (Blockly.utils.userAgent.GECKO && + if (Blockly.userAgent.GECKO && this.targetWorkspace_ && this.targetWorkspace_.isMutator) { // The position of the left side of the mutator workspace in pixels // relative to the window origin. diff --git a/core/grid.js b/core/grid.js index 52669ca51..9322dea37 100644 --- a/core/grid.js +++ b/core/grid.js @@ -27,6 +27,7 @@ goog.provide('Blockly.Grid'); +goog.require('Blockly.userAgent'); goog.require('Blockly.utils'); @@ -185,7 +186,7 @@ Blockly.Grid.prototype.moveTo = function(x, y) { this.gridPattern_.setAttribute('x', x); this.gridPattern_.setAttribute('y', y); - if (Blockly.utils.userAgent.IE || Blockly.utils.userAgent.EDGE) { + if (Blockly.userAgent.IE || Blockly.userAgent.EDGE) { // IE/Edge doesn't notice that the x/y offsets have changed. // Force an update. this.update(this.scale_); diff --git a/core/inject.js b/core/inject.js index deeb6c63a..8ecd1e1f7 100644 --- a/core/inject.js +++ b/core/inject.js @@ -31,6 +31,7 @@ goog.require('Blockly.Css'); goog.require('Blockly.DropDownDiv'); goog.require('Blockly.Grid'); goog.require('Blockly.Options'); +goog.require('Blockly.userAgent'); goog.require('Blockly.utils'); goog.require('Blockly.WorkspaceSvg'); goog.require('Blockly.WorkspaceDragSurfaceSvg'); @@ -433,7 +434,7 @@ Blockly.inject.bindDocumentEvents_ = function() { Blockly.bindEvent_(document, 'touchend', null, Blockly.longStop_); Blockly.bindEvent_(document, 'touchcancel', null, Blockly.longStop_); // Some iPad versions don't fire resize after portrait to landscape change. - if (Blockly.utils.userAgent.IPAD) { + if (Blockly.userAgent.IPAD) { Blockly.bindEventWithChecks_(window, 'orientationchange', document, function() { // TODO (#397): Fix for multiple Blockly workspaces. diff --git a/core/useragent.js b/core/useragent.js new file mode 100644 index 000000000..1abc62855 --- /dev/null +++ b/core/useragent.js @@ -0,0 +1,78 @@ +/** + * @license + * Visual Blocks Editor + * + * Copyright 2019 Google Inc. + * https://developers.google.com/blockly/ + * + * 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 Useragent detection. + * @author fraser@google.com (Neil Fraser) + */ +'use strict'; + +/** + * @name Blockly.userAgent + * @namespace + */ +goog.provide('Blockly.userAgent'); + + +(function(raw) { + Blockly.userAgent.raw = raw; + var rawUpper = Blockly.userAgent.raw.toUpperCase(); + /** + * Case-insensitive test of whether name is in the useragent string. + * @param {string} name Name to test. + * @return {boolean} True if name is present. + */ + function has(name) { + return rawUpper.indexOf(name.toUpperCase()) != -1; + } + + // Browsers. Logic from: + // https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/browser.js + Blockly.userAgent.IE = has('Trident') || has('MSIE'); + Blockly.userAgent.EDGE = has('Edge'); + // Useragent for JavaFX: + // Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.44 + // (KHTML, like Gecko) JavaFX/8.0 Safari/537.44 + Blockly.userAgent.JAVA_FX = has('JavaFX'); + + // Engines. Logic from: + // https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/engine.js + Blockly.userAgent.WEBKIT = has('WebKit') && + !Blockly.userAgent.EDGE; + Blockly.userAgent.GECKO = has('Gecko') && !Blockly.userAgent.WEBKIT && + !Blockly.userAgent.IE && !Blockly.userAgent.EDGE; + + // Platforms. Logic from: + // https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/platform.js + Blockly.userAgent.ANDROID = has('Android'); + Blockly.userAgent.IPAD = has('iPad'); + Blockly.userAgent.IPOD = has('iPod'); + Blockly.userAgent.IPHONE = has('iPhone') && + !Blockly.userAgent.IPAD && !Blockly.userAgent.IPOD; + Blockly.userAgent.MAC = has('Macintosh'); + + // Devices. Logic from: + // https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/device.js + Blockly.userAgent.TABLET = Blockly.userAgent.IPAD || + (Blockly.userAgent.ANDROID && !has('Mobile')) || has('Silk'); + Blockly.userAgent.MOBILE = !Blockly.userAgent.TABLET && + (Blockly.userAgent.IPOD || Blockly.userAgent.IPHONE || + Blockly.userAgent.ANDROID || has('IEMobile')); +})((this.navigator && this.navigator.userAgent) || ''); diff --git a/core/utils.js b/core/utils.js index 52187c160..9c08ee8cc 100644 --- a/core/utils.js +++ b/core/utils.js @@ -32,6 +32,8 @@ */ goog.provide('Blockly.utils'); +goog.require('Blockly.userAgent'); + goog.require('goog.dom'); goog.require('goog.math.Coordinate'); @@ -258,7 +260,7 @@ Blockly.utils.createSvgElement = function(name, attrs, parent) { * @return {boolean} True if right-click. */ Blockly.utils.isRightButton = function(e) { - if (e.ctrlKey && Blockly.utils.userAgent.MAC) { + if (e.ctrlKey && Blockly.userAgent.MAC) { // Control-clicking on Mac OS X is treated as a right-click. // WebKit on Mac OS X fails to change button to 2 (but Gecko does). return true; @@ -1027,51 +1029,3 @@ Blockly.utils.clampNumber = function(lowerBound, number, upperBound) { } return Math.max(lowerBound, Math.min(number, upperBound)); }; - -Blockly.utils.userAgent = {}; -(function(raw) { - Blockly.utils.userAgent.raw = raw; - var rawUpper = Blockly.utils.userAgent.raw.toUpperCase(); - /** - * Case-insensitive test of whether name is in the useragent string. - * @param {string} name Name to test. - * @return {boolean} True if name is present. - */ - function has(name) { - return rawUpper.indexOf(name.toUpperCase()) != -1; - } - - // Browsers. Logic from: - // https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/browser.js - Blockly.utils.userAgent.IE = has('Trident') || has('MSIE'); - Blockly.utils.userAgent.EDGE = has('Edge'); - // Useragent for JavaFX: - // Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.44 - // (KHTML, like Gecko) JavaFX/8.0 Safari/537.44 - Blockly.utils.userAgent.JAVA_FX = has('JavaFX'); - - // Engines. Logic from: - // https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/engine.js - Blockly.utils.userAgent.WEBKIT = has('WebKit') && - !Blockly.utils.userAgent.EDGE; - Blockly.utils.userAgent.GECKO = has('Gecko') && - !Blockly.utils.userAgent.IE && !Blockly.utils.userAgent.EDGE; - - // Platforms. Logic from: - // https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/platform.js - Blockly.utils.userAgent.ANDROID = has('Android'); - Blockly.utils.userAgent.IPAD = has('iPad'); - Blockly.utils.userAgent.IPOD = has('iPod'); - Blockly.utils.userAgent.IPHONE = has('iPhone') && - !Blockly.utils.userAgent.IPAD && !Blockly.utils.userAgent.IPOD; - Blockly.utils.userAgent.MAC = has('Macintosh'); - - // Devices. Logic from: - // https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/device.js - Blockly.utils.userAgent.TABLET = Blockly.utils.userAgent.IPAD || - (Blockly.utils.userAgent.ANDROID && !has('Mobile')) || has('Silk'); - Blockly.utils.userAgent.MOBILE = !Blockly.utils.userAgent.TABLET && - (Blockly.utils.userAgent.IPOD || Blockly.utils.userAgent.IPHONE || - Blockly.utils.userAgent.ANDROID || has('IEMobile')); -})((this.navigator && this.navigator.userAgent) || ''); - diff --git a/core/workspace_audio.js b/core/workspace_audio.js index 8d58c4156..9e0402551 100644 --- a/core/workspace_audio.js +++ b/core/workspace_audio.js @@ -27,7 +27,7 @@ goog.provide('Blockly.WorkspaceAudio'); -goog.require('Blockly.utils'); +goog.require('Blockly.userAgent'); /** @@ -115,7 +115,7 @@ Blockly.WorkspaceAudio.prototype.preload = function() { sound.pause(); // iOS can only process one sound at a time. Trying to load more than one // corrupts the earlier ones. Just load one and leave the others uncached. - if (Blockly.utils.userAgent.IPAD || Blockly.utils.userAgent.IPHONE) { + if (Blockly.userAgent.IPAD || Blockly.userAgent.IPHONE) { break; } } @@ -138,7 +138,7 @@ Blockly.WorkspaceAudio.prototype.play = function(name, opt_volume) { } this.lastSound_ = now; var mySound; - if (Blockly.utils.userAgent.IPAD || Blockly.utils.userAgent.ANDROID) { + if (Blockly.userAgent.IPAD || Blockly.userAgent.ANDROID) { // Creating a new audio node causes lag in Android and iPad. Android // refetches the file from the server, iPad uses a singleton audio // node which must be deleted and recreated for each new audio tag. diff --git a/core/xml.js b/core/xml.js index d953c87e3..75978deee 100644 --- a/core/xml.js +++ b/core/xml.js @@ -33,6 +33,7 @@ goog.provide('Blockly.Xml'); goog.require('Blockly.Events.BlockCreate'); goog.require('Blockly.Events.FinishedLoading'); goog.require('Blockly.Events.VarCreate'); +goog.require('Blockly.utils'); goog.require('Blockly.Xml.utils');