From 1585a1664a9bbdb7c8efa5f3da361b4aaf6450e4 Mon Sep 17 00:00:00 2001 From: Gubolin Date: Sun, 1 Mar 2015 09:51:26 +0100 Subject: remove language and location blocks --- blocks.js | 19 ----------------- gui.js | 1 - objects.js | 16 -------------- threads.js | 72 -------------------------------------------------------------- 4 files changed, 108 deletions(-) diff --git a/blocks.js b/blocks.js index 35f31a4..e56d0ed 100644 --- a/blocks.js +++ b/blocks.js @@ -866,25 +866,6 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { ); part.setContents(['date']); break; - case '%locations': - part = new InputSlotMorph( - null, // text - false, // non-numeric - { - 'all' : ['all'], - 'country' : ['country'], - 'state' : ['state'], - 'state district' : ['state district'], - 'suburb' : ['suburb'], - 'city' : ['city'], - 'road' : ['road'], - 'house number' : ['house number'], - 'licence': ['licence'] - }, - true // read-only - ); - part.setContents(['all']); - break; case '%delim': part = new InputSlotMorph( null, // text diff --git a/gui.js b/gui.js index b452941..c3104c5 100644 --- a/gui.js +++ b/gui.js @@ -3546,7 +3546,6 @@ IDE_Morph.prototype.setLanguage = function (lang, callback) { if (lang === 'en') { return this.reflectLanguage('en', callback); } - myself.userLanguage = lang; translation = document.createElement('script'); translation.id = 'language'; translation.onload = function () { diff --git a/objects.js b/objects.js index 5ad18e7..d0c32df 100644 --- a/objects.js +++ b/objects.js @@ -941,16 +941,6 @@ SpriteMorph.prototype.initBlocks = function () { category: 'sensing', spec: 'current acceleration along the z axes' }, - reportLanguage: { - type: 'reporter', - category: 'sensing', - spec: 'language' - }, - reportLocation: { - type: 'reporter', - category: 'sensing', - spec: 'location %locations' - }, // Operators reifyScript: { @@ -1986,9 +1976,6 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push('-'); blocks.push(block('reportDate')); blocks.push('-'); - blocks.push(block('reportLanguage')); - blocks.push(block('reportLocation')); - blocks.push('-'); blocks.push(block('doVibrate')); blocks.push('-'); blocks.push(block('reportCompassHeading')); @@ -5192,9 +5179,6 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push('-'); blocks.push(block('reportDate')); blocks.push('-'); - blocks.push(block('reportLanguage')); - blocks.push(block('reportLocation')); - blocks.push('-'); blocks.push(block('doVibrate')); blocks.push('-'); blocks.push(block('reportCompassHeading')); diff --git a/threads.js b/threads.js index 06454e3..7587f06 100644 --- a/threads.js +++ b/threads.js @@ -2669,78 +2669,6 @@ Process.prototype.reportTimer = function () { return 0; }; -Process.prototype.reportLanguage = function () { - var ide = this.homeContext.receiver.parentThatIsA(IDE_Morph); - if (ide) { - var lang = ide.userLanguage; - if (lang) { - return lang; - } - } - return 'en'; -}; - -Process.prototype.reportLocation = function (name) { - var myself = this; - - if (!myself.context.jsonpScript) { - if (!navigator.geolocation) { - myself.handleError({name: 'Location', - message: 'navigator.geolocation is not supported'}); - } - window.OSM_JSONP_Callback = function (data) { - myself.context.json = data; - window.OSM_JSONP_Callback = undefined; - }; - myself.context.jsonpScript = document.createElement('script'); - - navigator.geolocation.getCurrentPosition( - function (pos) { - var crd = pos.coords; - - myself.context.jsonpScript.src = - 'https://nominatim.openstreetmap.org/reverse' - + '?format=json&json_callback=OSM_JSONP_Callback' - + '&zoom=18&addressdetails=1' - + '&lat=' - + crd.latitude - + '&lon=' - + crd.longitude; - document.getElementsByTagName('HEAD')[0] - .appendChild(myself.context.jsonpScript); - }, - function (err) { - console.log(err); - myself.handleError({name: 'Location', message: err}); - }, - { enableHightAccuracy: true, timeout: 30000, maximumAge: 0} - ); - } else { - if (myself.context.json) { - switch (myself.inputOption(name)) { - case 'all': - return myself.context.json.display_name; - case 'state district': - return myself.context.json.address.state_district; - case 'house number': - return myself.context.json.address.house_number; - case 'licence': - return myself.context.json.licence; - case 'country': - case 'state': - case 'suburb': - case 'city': - case 'road': - return myself.context. - json.address[myself.inputOption(name)]; - } - } - } - - this.pushContext('doYield'); - this.pushContext(); -}; - // Process Dates and times in Snap // Map block options to built-in functions var dateMap = { -- cgit v1.3.1