From faa8b4fe2243b1a8ef5cc4342183f4880b728a3d Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Fri, 27 Dec 2013 18:49:56 -0800 Subject: Add a 'get current DATE' block with various options, add some translations to FR and DE --- blocks.js | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'blocks.js') diff --git a/blocks.js b/blocks.js index 96d8b53..ed936d1 100644 --- a/blocks.js +++ b/blocks.js @@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2013-November-26'; +modules.blocks = '2013-December-27'; var SyntaxElementMorph; var BlockMorph; @@ -812,6 +812,27 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { true // read-only ); break; + case '%dates': + part = new InputSlotMorph( + null, // text + false, // non-numeric + { + 'Date' : ['Date'], + 'Month' : ['Month'], + 'Day of Month' : ['Day of Month'], + 'Year' : ['Year'], + 'Day of Week' : ['Day of Week'], + 'Time' : ['Time'], + 'Hour' : ['Hour'], + 'Minute' : ['Minute'], + 'Second' : ['Second'], + 'Time in Milliseconds' : ['Time in Milliseconds'], + 'UTC Time' : ['UTC Time'], + }, + true // read-only + ); + part.setContents('Date') + break; case '%delim': part = new InputSlotMorph( null, // text @@ -1166,7 +1187,6 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { ); break; - // symbols: case '%turtle': @@ -6147,7 +6167,7 @@ CSlotMorph.prototype.drawBottomEdge = function (context) { I am an editable text input slot. I can be either rectangular or rounded, and can have an optional drop-down menu. If I'm set to read-only I must have a drop-down menu and will assume a darker - shade of my parent's color. + shade of my parent's color. my most important public attributes and accessors are: -- cgit v1.3.1 From 9f0f9dde37730dea46539c4c8971561a0a042354 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Sat, 28 Dec 2013 15:01:24 -0800 Subject: Add style tweaks per Nathan's comments. --- blocks.js | 24 ++++++++++++------------ objects.js | 5 ++--- threads.js | 37 +++++++++++++++++-------------------- 3 files changed, 31 insertions(+), 35 deletions(-) (limited to 'blocks.js') diff --git a/blocks.js b/blocks.js index ed936d1..a1d80f5 100644 --- a/blocks.js +++ b/blocks.js @@ -817,21 +817,21 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { null, // text false, // non-numeric { - 'Date' : ['Date'], - 'Month' : ['Month'], - 'Day of Month' : ['Day of Month'], - 'Year' : ['Year'], - 'Day of Week' : ['Day of Week'], - 'Time' : ['Time'], - 'Hour' : ['Hour'], - 'Minute' : ['Minute'], - 'Second' : ['Second'], - 'Time in Milliseconds' : ['Time in Milliseconds'], - 'UTC Time' : ['UTC Time'], + 'date' : ['date'], + 'month' : ['month'], + 'year' : ['year'], + 'day of month' : ['day of month'], + 'day of week' : ['day of week'], + 'time' : ['time'], + 'hour' : ['hour'], + 'minute' : ['minute'], + 'second' : ['second'], + 'time in milliseconds' : ['time in milliseconds'], + 'UTC time' : ['UTC time'], }, true // read-only ); - part.setContents('Date') + part.setContents('date'); break; case '%delim': part = new InputSlotMorph( diff --git a/objects.js b/objects.js index a2caedd..46be53c 100644 --- a/objects.js +++ b/objects.js @@ -124,7 +124,7 @@ PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.objects = '2013-December-27'; +modules.objects = '2013-December-28'; var SpriteMorph; var StageMorph; @@ -789,8 +789,7 @@ SpriteMorph.prototype.initBlocks = function () { reportDate: { type: 'reporter', category: 'sensing', - spec: 'get current %dates', - + spec: 'get current %dates' }, // Operators diff --git a/threads.js b/threads.js index 13fcff3..9192023 100644 --- a/threads.js +++ b/threads.js @@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2013-December-11'; +modules.threads = '2013-December-28'; var ThreadManager; var Process; @@ -2475,31 +2475,28 @@ Process.prototype.reportTimer = function () { }; // Process Dates and times in Snap +// Map block options to built-in functions +var dateMap = { + 'date' : 'toLocaleDateString', + 'time' : 'toLocaleTimeString', + 'month' : 'getMonthName', // return a name, not a number + 'year' : 'getFullYear', + 'day of week' : 'getDayName', // return a name, not a number + 'day of month': 'getDate', + 'hour' : 'getHours', + 'minute' : 'getMinutes', + 'second' : 'getSeconds', + 'milliseconds' : 'getMilliseconds', + 'time in milliseconds' : 'getTime', + 'UTC time' : 'toUTCString' }; Process.prototype.reportDate = function (datefn) { - // Map block options to built-in functions - var dateMap = { 'Date' : 'toLocaleDateString', - 'Time' : 'toLocaleTimeString', - 'Month' : 'getMonthName', // return a name, not a number - 'Day of Week' : 'getDayName', // return a name, not a number - 'Day of Month': 'getDate', - 'Year' : 'getFullYear', - 'Hour' : 'getHours', - 'Minute' : 'getMinutes', - 'Second' : 'getSeconds', - 'Milliseconds' : 'getMilliseconds', - 'Time in Milliseconds' : 'getTime', - 'UTC Time' : 'toUTCString' }; - - if (!dateMap[datefn]) { - return ''; - } + if (!dateMap[datefn]) { return ''; } currDate = new Date(); - func = dateMap[datefn] + func = dateMap[datefn]; return currDate[func](); - } // Process code mapping -- cgit v1.3.1 From 9aa3921dd04ee8b6fedec0116f9e3f5503e4043b Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Sun, 26 Jan 2014 04:30:43 -0800 Subject: Remove unecessary items and reorder dropdown --- blocks.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'blocks.js') diff --git a/blocks.js b/blocks.js index a1d80f5..c975e16 100644 --- a/blocks.js +++ b/blocks.js @@ -817,17 +817,14 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { null, // text false, // non-numeric { - 'date' : ['date'], - 'month' : ['month'], 'year' : ['year'], - 'day of month' : ['day of month'], + 'month' : ['month'], + 'date' : ['date'], 'day of week' : ['day of week'], - 'time' : ['time'], 'hour' : ['hour'], 'minute' : ['minute'], 'second' : ['second'], 'time in milliseconds' : ['time in milliseconds'], - 'UTC time' : ['UTC time'], }, true // read-only ); -- cgit v1.3.1 From 434392a87990395e689bf472fdf4ff71c92cbea8 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Thu, 6 Feb 2014 20:26:32 -0800 Subject: remove lang file and incorporate fixes in blocks, opbjects --- blocks.js | 2 +- lang-de.js | 7 +------ lang-fr.js | 13 ++++--------- objects.js | 2 +- 4 files changed, 7 insertions(+), 17 deletions(-) (limited to 'blocks.js') diff --git a/blocks.js b/blocks.js index 1cfd2c2..383518a 100644 --- a/blocks.js +++ b/blocks.js @@ -829,7 +829,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { }, true // read-only ); - part.setContents('date'); + part.setContents(['date']); break; case '%delim': part = new InputSlotMorph( diff --git a/lang-de.js b/lang-de.js index c68cf4b..8b71902 100644 --- a/lang-de.js +++ b/lang-de.js @@ -1257,10 +1257,5 @@ SnapTranslator.dict.de = { 'last': 'letztes', 'any': - 'beliebiges', - - // Date reporter dropdowns - 'month': - 'monat', - + 'beliebiges' }; diff --git a/lang-fr.js b/lang-fr.js index ecb585a..4198bf7 100644 --- a/lang-fr.js +++ b/lang-fr.js @@ -718,7 +718,7 @@ SnapTranslator.dict.fr = { 'check for alternative\nGUI design': 'Cocher pour un style d\interface alternatif', 'uncheck for default\nGUI design': - 'D\u00E9cocher pour le style classique d\interface', + 'D\u00E9cocher pour le style classique d\interface', 'Thread safe scripts': 'Scripts réentrants', 'check to disallow\nscript reentrance': @@ -733,7 +733,7 @@ SnapTranslator.dict.fr = { 'D\u00E9cocher pour une vitesse\nd\'animation maximale (mais variable)', 'check for smooth, predictable\nanimations across computers': 'Cocher pour une vitesse d\'animation\nfixe et identique sur tous les ordinateurs', - + // inputs 'with inputs': 'avec entr\u00E9es', @@ -958,7 +958,7 @@ SnapTranslator.dict.fr = { 'tabulations', 'cr': 'retours de ligne', - + // About Snap 'About Snap': 'A propos de Snap', @@ -1162,10 +1162,5 @@ SnapTranslator.dict.fr = { 'last': 'dernier', 'any': - 'n\u0027importe quel', - - // Date reporter dropdowns - 'month': - 'mois' - + 'n\u0027importe quel' }; diff --git a/objects.js b/objects.js index 1d37a4e..d646130 100644 --- a/objects.js +++ b/objects.js @@ -807,7 +807,7 @@ SpriteMorph.prototype.initBlocks = function () { reportDate: { type: 'reporter', category: 'sensing', - spec: 'get current %dates' + spec: 'current %dates' }, // Operators -- cgit v1.3.1