Merge remote-tracking branch 'origin/master'

This commit is contained in:
John Firebaugh
2013-03-08 13:24:28 -08:00
15 changed files with 67 additions and 1963 deletions
+3 -2
View File
@@ -17,11 +17,12 @@ data/presets/presets.json: $(PRESET_FILES)
# TODO: write a nice node script for this
data/data.js: \
data \
data/deprecated.json \
data/discarded.json \
data/imagery.json \
data/keys.json
node data/make.js
node build.js
.INTERMEDIATE iD.js: \
js/lib/bootstrap-tooltip.js \
@@ -77,7 +78,7 @@ iD.js: Makefile
%.min.js: %.js Makefile
@rm -f $@
$(JS_COMPILER) $< -c -m -o $@
$(JS_COMPILER) $< -m -o $@
clean:
rm -f iD*.js
+31
View File
@@ -0,0 +1,31 @@
var fs = require('fs'),
glob = require('glob');
function read(f) {
return JSON.parse(fs.readFileSync(f));
}
function r(f) {
return read(__dirname + '/data/' + f);
}
function rp(f) {
return r('presets/' + f);
}
fs.writeFileSync('data/presets/presets.json', JSON.stringify(
glob.sync(__dirname + '/data/presets/presets/**/*.json').map(function(file) {
return read(file);
})));
fs.writeFileSync('data/data.js', 'iD.data = ' + JSON.stringify({
deprecated: r('deprecated.json'),
discarded: r('discarded.json'),
keys: r('keys.json'),
presets: {
presets: rp('presets.json'),
defaults: rp('defaults.json'),
categories: rp('categories.json'),
forms: rp('forms.json')
}
}) + ';');
+1
View File
@@ -133,6 +133,7 @@ a:hover {
textarea,
input[type=text],
input[type=search],
input[type=number],
input[type=url],
input[type=tel],
input[type=email] {
+2 -28
View File
@@ -19,18 +19,6 @@
"ford": "yes"
}
},
{
"old": { "highway": "ford" },
"replace": {
"ford": "yes"
}
},
{
"old": { "highway": "ford" },
"replace": {
"ford": "yes"
}
},
{
"old": { "highway": "stile" },
"replace": {
@@ -58,18 +46,11 @@
"incline": "unpaved"
}
},
{
"old": { "highway": "unsurfaced" },
"replace": {
"highway": "road",
"incline": "unpaved"
}
},
{
"old": { "landuse": "wood" },
"replace": {
"highway": "road",
"incline": "unpaved"
"landuse": "forest",
"natural": "wood"
}
},
{
@@ -97,12 +78,5 @@
"replace": {
"generator:output": "$1"
}
},
{
"old": { "bicycle_parking": "organic" },
"replace": {
"shop": "supermarket",
"organic": "only"
}
}
]
-16
View File
@@ -1,16 +0,0 @@
var fs = require('fs');
function r(f) { return JSON.parse(fs.readFileSync(__dirname + '/' + f)); }
function rp(f) { return r('presets/' + f); }
fs.writeFileSync('data.js', 'iD.data = ' + JSON.stringify({
deprecated: r('deprecated.json'),
discarded: r('discarded.json'),
keys: r('keys.json'),
presets: {
presets: rp('presets.json'),
defaults: rp('defaults.json'),
categories: rp('categories.json'),
forms: rp('forms.json')
}
}));
-8
View File
@@ -1,8 +0,0 @@
#!/bin/bash
dir=$(dirname $0)
presets=$(find $dir/presets -name "*.json" -exec cat {} \; -exec echo , \;)
echo [${presets%?}] > $dir/presets.json
node -e "
var fs = require('fs');
fs.writeFileSync('$dir/presets.json', JSON.stringify(JSON.parse(fs.readFileSync('$dir/presets.json', 'utf8')), null, 4));
"
+5
View File
@@ -41,6 +41,11 @@
"type": "combo",
"default": { "area": "yes" }
},
"levels": {
"key": "building:levels",
"type": "number",
"title": "Levels"
},
"fee": {
"key": "fee",
"type": "check"
+1 -1895
View File
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -12,6 +12,7 @@
"icon": "warehouse",
"form": [
"building_yes",
"levels",
"address"
]
}
}
+1 -2
View File
@@ -9,7 +9,7 @@ iD.Graph = function(other, mutable) {
this.inherited = true;
} else {
if (_.isArray(other)) {
if (Array.isArray(other)) {
var entities = {};
for (var i = 0; i < other.length; i++) {
entities[other[i].id] = other[i];
@@ -273,5 +273,4 @@ iD.Graph.prototype = {
}
return this;
}
};
+8 -7
View File
@@ -31,6 +31,7 @@ iD.History = function(context) {
return difference;
}
// iD uses namespaced keys so multiple installations do not conflict
function getKey(n) {
return 'iD_' + window.location.origin + '_' + n;
}
@@ -42,7 +43,6 @@ iD.History = function(context) {
merge: function(entities) {
var base = stack[0].graph.base(),
newentities = Object.keys(entities).filter(function(i) {
return !base.entities[i];
@@ -192,11 +192,10 @@ iD.History = function(context) {
if (stack.length <= 1) return;
var json = JSON.stringify(stack.map(function(i) {
return {
annotation: i.annotation,
imagery_used: i.imagery_used,
entities: i.graph.entities
};
var x = { entities: i.graph.entities };
if (i.imagery_used) x.imagery_used = i.imagery_used;
if (i.annotation) x.annotation = i.annotation;
return x;
}), function includeUndefined(key, value) {
if (typeof value === 'undefined') return 'undefined';
return value;
@@ -221,10 +220,13 @@ iD.History = function(context) {
return lock;
},
// is iD not open in another window and it detects that
// there's a history stored in localStorage that's recoverable?
restorableChanges: function() {
return lock && !!context.storage(getKey('history'));
},
// load history from a version stored in localStorage
load: function() {
if (!lock) return;
@@ -246,7 +248,6 @@ iD.History = function(context) {
});
stack[0].graph.inherited = false;
dispatch.change();
},
_getKey: getKey
+1 -1
View File
@@ -17,7 +17,7 @@ iD.presets.Preset = function(preset, forms) {
score = 0;
for (var t in tags) {
if (entity.tags[t] === tags[t]) {
score ++;
score++;
} else if (tags[t] === '*' && t in entity.tags) {
score += 0.5;
} else {
+1 -1
View File
@@ -66,7 +66,7 @@ iD.Background = function() {
tile().forEach(function(d) {
addSource(d);
requests.push(d);
if (!cache[d[3]] && lookUp(d)) {
if (cache[d[3]] === false && lookUp(d)) {
requests.push(addSource(lookUp(d)));
}
});
+9 -1
View File
@@ -80,6 +80,13 @@ iD.ui.preset = function(context) {
.attr('placeholder', 'http://example.com/')
.call(iD.behavior.accept().on('accept', event.close));
break;
case 'number':
i = this.append('input')
.attr('type', 'number')
.attr('id', 'input-' + d.key)
.attr('placeholder', '0')
.call(iD.behavior.accept().on('accept', event.close));
break;
case 'check':
wrap = this.append('span').attr('class', 'input-wrap-position'),
i = wrap.append('input').attr('type', 'text');
@@ -87,7 +94,6 @@ iD.ui.preset = function(context) {
wrap.call(check);
event.on('setTags.' + d.key, check.update);
break;
case 'select':
wrap = this.append('span').attr('class', 'input-wrap-position'),
i = wrap.append('input').attr('type', 'text');
@@ -122,6 +128,8 @@ iD.ui.preset = function(context) {
}));
});
break;
default:
throw 'Unknown input type ' + d.type;
}
if (i) {
i.on('change', key);
+2 -1
View File
@@ -21,6 +21,7 @@
"license": "WTFPL",
"devDependencies": {
"uglify-js": "~2.2.2",
"mocha-phantomjs": "~1.1.1"
"mocha-phantomjs": "~1.1.1",
"glob": "~3.1.21"
}
}