mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 14:45:12 +02:00
one-shot build (#3266)
* One-shot development * Move jsonp to module * Tooltip -> module * Remove d3.jsonp * Fix tooltip lint * Load all libs but d3 itself with require * Add top-level brfs * Unformat intro graph
This commit is contained in:
@@ -8,17 +8,11 @@ all: \
|
||||
dist/img/iD-sprite.svg \
|
||||
dist/img/maki-sprite.svg
|
||||
|
||||
|
||||
MAKI_SOURCES = node_modules/maki/src/*.svg
|
||||
|
||||
$(MAKI_SOURCES): node_modules/.install
|
||||
|
||||
dist/img/maki-sprite.svg: $(MAKI_SOURCES) Makefile
|
||||
node_modules/.bin/svg-sprite --symbol --symbol-dest . --symbol-sprite $@ $(MAKI_SOURCES)
|
||||
|
||||
data/feature-icons.json: $(MAKI_SOURCES)
|
||||
cp -f node_modules/maki/www/maki-sprite.json $@
|
||||
|
||||
dist/img/iD-sprite.svg: svg/iD-sprite.src.svg svg/iD-sprite.json
|
||||
node svg/spriteify.js --svg svg/iD-sprite.src.svg --json svg/iD-sprite.json > $@
|
||||
|
||||
@@ -31,44 +25,16 @@ BUILDJS_TARGETS = \
|
||||
data/data.js \
|
||||
dist/locales/en.js \
|
||||
dist/presets.js \
|
||||
dist/imagery.js
|
||||
dist/imagery.js \
|
||||
|
||||
BUILDJS_SOURCES = \
|
||||
$(filter-out $(BUILDJS_TARGETS), $(shell find data -type f -name '*.json')) \
|
||||
data/feature-icons.json \
|
||||
data/core.yaml
|
||||
|
||||
$(BUILDJS_TARGETS): $(BUILDJS_SOURCES) build.js
|
||||
node build.js
|
||||
|
||||
|
||||
MODULE_TARGETS = \
|
||||
js/lib/id/index.js \
|
||||
|
||||
js/lib/id/index.js: $(shell find modules -type f)
|
||||
@rm -f $@
|
||||
node_modules/.bin/rollup -c rollup.config.js -f umd -n iD modules/index.js --no-strict -o $@
|
||||
|
||||
dist/iD.js: \
|
||||
js/lib/bootstrap-tooltip.js \
|
||||
js/lib/d3.v3.js \
|
||||
js/lib/d3.combobox.js \
|
||||
js/lib/d3.geo.tile.js \
|
||||
js/lib/d3.jsonp.js \
|
||||
js/lib/d3.keybinding.js \
|
||||
js/lib/d3.one.js \
|
||||
js/lib/d3.dimensions.js \
|
||||
js/lib/d3.trigger.js \
|
||||
js/lib/d3.curtain.js \
|
||||
js/lib/d3.value.js \
|
||||
$(MODULE_TARGETS) \
|
||||
data/introGraph.js
|
||||
|
||||
.INTERMEDIATE dist/iD.js: data/data.js
|
||||
|
||||
dist/iD.js: node_modules/.install Makefile
|
||||
@rm -f $@
|
||||
cat $(filter %.js,$^) > $@
|
||||
dist/iD.js: $(BUILDJS_TARGETS)
|
||||
./node_modules/.bin/rollup --config=./rollup.config.js --input ./modules/id.js --output dist/iD.js
|
||||
|
||||
dist/iD.min.js: dist/iD.js Makefile
|
||||
@rm -f $@
|
||||
@@ -77,25 +43,12 @@ dist/iD.min.js: dist/iD.js Makefile
|
||||
dist/iD.css: css/*.css
|
||||
cat css/reset.css css/map.css css/app.css > $@
|
||||
|
||||
node_modules/.install: package.json
|
||||
npm install
|
||||
touch node_modules/.install
|
||||
|
||||
translations:
|
||||
node data/update_locales
|
||||
|
||||
imagery:
|
||||
npm install editor-layer-index@git://github.com/osmlab/editor-layer-index.git#gh-pages
|
||||
node data/update_imagery
|
||||
|
||||
suggestions:
|
||||
npm install name-suggestion-index@git://github.com/osmlab/name-suggestion-index.git
|
||||
cp node_modules/name-suggestion-index/name-suggestions.json data/name-suggestions.json
|
||||
|
||||
wikipedias:
|
||||
npm install wmf-sitematrix@git://github.com/osmlab/wmf-sitematrix.git
|
||||
cp node_modules/wmf-sitematrix/wikipedia.min.json data/wikipedia.json
|
||||
|
||||
D3_FILES = \
|
||||
node_modules/d3/src/start.js \
|
||||
node_modules/d3/src/arrays/index.js \
|
||||
@@ -119,4 +72,4 @@ d3:
|
||||
@echo 'd3 rebuilt. Please reapply 7e2485d, 4da529f, 223974d and 71a3d3e'
|
||||
|
||||
clean:
|
||||
rm -f $(BUILDJS_TARGETS) $(MODULE_TARGETS) data/feature-icons.json dist/iD*.js dist/iD.css dist/img/*.svg
|
||||
rm -f $(BUILDJS_TARGETS) data/feature-icons.json dist/iD*.js dist/iD.css dist/img/*.svg
|
||||
|
||||
@@ -6,7 +6,7 @@ var fs = require('fs'),
|
||||
jsonschema = require('jsonschema'),
|
||||
fieldSchema = require('./data/presets/schema/field.json'),
|
||||
presetSchema = require('./data/presets/schema/preset.json'),
|
||||
suggestions = require('./data/name-suggestions.json');
|
||||
suggestions = require('name-suggestion-index/name-suggestions.json');
|
||||
|
||||
function readtxt(f) {
|
||||
return fs.readFileSync(f, 'utf8');
|
||||
@@ -20,10 +20,6 @@ function r(f) {
|
||||
return read(__dirname + '/data/' + f);
|
||||
}
|
||||
|
||||
function rp(f) {
|
||||
return r('presets/' + f);
|
||||
}
|
||||
|
||||
function validate(file, instance, schema) {
|
||||
var result = jsonschema.validate(instance, schema);
|
||||
if (result.length) {
|
||||
@@ -295,25 +291,3 @@ var presets = {en: {presets: translations}};
|
||||
var en = _.merge(core, presets);
|
||||
fs.writeFileSync('dist/locales/en.json', JSON.stringify(en.en, null, 4));
|
||||
|
||||
fs.writeFileSync('data/data.js', 'iD.data = ' + JSON.stringify({
|
||||
deprecated: r('deprecated.json'),
|
||||
discarded: r('discarded.json'),
|
||||
wikipedia: r('wikipedia.json'),
|
||||
imperial: r('imperial.json'),
|
||||
featureIcons: r('feature-icons.json'),
|
||||
locales: r('locales.json'),
|
||||
en: read('dist/locales/en.json'),
|
||||
suggestions: r('name-suggestions.json'),
|
||||
addressFormats: r('address-formats.json'),
|
||||
phoneFormats: r('phone-formats.json'),
|
||||
driveLeft: r('drive-left.json')
|
||||
}) + ';');
|
||||
|
||||
fs.writeFileSync('dist/presets.js', 'iD.data.presets = ' + JSON.stringify({
|
||||
presets: rp('presets.json'),
|
||||
defaults: rp('defaults.json'),
|
||||
categories: rp('categories.json'),
|
||||
fields: rp('fields.json')
|
||||
}) + ';');
|
||||
|
||||
fs.writeFileSync('dist/imagery.js', 'iD.data.imagery = ' + JSON.stringify(r('imagery.json')) + ';');
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
iD.data = {
|
||||
load: function(path, callback) {
|
||||
if (!callback) {
|
||||
callback = path;
|
||||
path = '';
|
||||
}
|
||||
iD.util.asyncMap([
|
||||
path + 'data/deprecated.json',
|
||||
path + 'data/discarded.json',
|
||||
path + 'data/imagery.json',
|
||||
path + 'data/wikipedia.json',
|
||||
path + 'data/presets/presets.json',
|
||||
path + 'data/presets/defaults.json',
|
||||
path + 'data/presets/categories.json',
|
||||
path + 'data/presets/fields.json',
|
||||
path + 'data/imperial.json',
|
||||
path + 'data/feature-icons.json',
|
||||
path + 'data/locales.json',
|
||||
path + 'dist/locales/en.json',
|
||||
path + 'data/name-suggestions.json',
|
||||
path + 'data/address-formats.json',
|
||||
path + 'data/phone-formats.json',
|
||||
path + 'data/drive-left.json'
|
||||
], d3.json, function (err, data) {
|
||||
|
||||
iD.data = {
|
||||
deprecated: data[0],
|
||||
discarded: data[1],
|
||||
imagery: data[2],
|
||||
wikipedia: data[3],
|
||||
presets: {
|
||||
presets: data[4],
|
||||
defaults: data[5],
|
||||
categories: data[6],
|
||||
fields: data[7]
|
||||
},
|
||||
imperial: data[8],
|
||||
featureIcons: data[9],
|
||||
locales: data[10],
|
||||
en: data[11],
|
||||
suggestions: data[12],
|
||||
addressFormats: data[13],
|
||||
phoneFormats: data[14],
|
||||
driveLeft: data[15]
|
||||
};
|
||||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,349 +0,0 @@
|
||||
{
|
||||
"circle-stroked-24": { "x": 0, "y": 0, "width": 24, "height": 24 },
|
||||
"circle-stroked-18": { "x": 24, "y": 0, "width": 18, "height": 18 },
|
||||
"circle-stroked-12": { "x": 42, "y": 0, "width": 12, "height": 12 },
|
||||
"circle-24": { "x": 54, "y": 0, "width": 24, "height": 24 },
|
||||
"circle-18": { "x": 78, "y": 0, "width": 18, "height": 18 },
|
||||
"circle-12": { "x": 96, "y": 0, "width": 12, "height": 12 },
|
||||
"square-stroked-24": { "x": 108, "y": 0, "width": 24, "height": 24 },
|
||||
"square-stroked-18": { "x": 132, "y": 0, "width": 18, "height": 18 },
|
||||
"square-stroked-12": { "x": 150, "y": 0, "width": 12, "height": 12 },
|
||||
"square-24": { "x": 162, "y": 0, "width": 24, "height": 24 },
|
||||
"square-18": { "x": 186, "y": 0, "width": 18, "height": 18 },
|
||||
"square-12": { "x": 204, "y": 0, "width": 12, "height": 12 },
|
||||
"triangle-stroked-24": { "x": 216, "y": 0, "width": 24, "height": 24 },
|
||||
"triangle-stroked-18": { "x": 240, "y": 0, "width": 18, "height": 18 },
|
||||
"triangle-stroked-12": { "x": 258, "y": 0, "width": 12, "height": 12 },
|
||||
"triangle-24": { "x": 0, "y": 24, "width": 24, "height": 24 },
|
||||
"triangle-18": { "x": 24, "y": 24, "width": 18, "height": 18 },
|
||||
"triangle-12": { "x": 42, "y": 24, "width": 12, "height": 12 },
|
||||
"star-stroked-24": { "x": 54, "y": 24, "width": 24, "height": 24 },
|
||||
"star-stroked-18": { "x": 78, "y": 24, "width": 18, "height": 18 },
|
||||
"star-stroked-12": { "x": 96, "y": 24, "width": 12, "height": 12 },
|
||||
"star-24": { "x": 108, "y": 24, "width": 24, "height": 24 },
|
||||
"star-18": { "x": 132, "y": 24, "width": 18, "height": 18 },
|
||||
"star-12": { "x": 150, "y": 24, "width": 12, "height": 12 },
|
||||
"cross-24": { "x": 162, "y": 24, "width": 24, "height": 24 },
|
||||
"cross-18": { "x": 186, "y": 24, "width": 18, "height": 18 },
|
||||
"cross-12": { "x": 204, "y": 24, "width": 12, "height": 12 },
|
||||
"marker-stroked-24": { "x": 216, "y": 24, "width": 24, "height": 24 },
|
||||
"marker-stroked-18": { "x": 240, "y": 24, "width": 18, "height": 18 },
|
||||
"marker-stroked-12": { "x": 258, "y": 24, "width": 12, "height": 12 },
|
||||
"marker-24": { "x": 0, "y": 48, "width": 24, "height": 24 },
|
||||
"marker-18": { "x": 24, "y": 48, "width": 18, "height": 18 },
|
||||
"marker-12": { "x": 42, "y": 48, "width": 12, "height": 12 },
|
||||
"religious-jewish-24": { "x": 54, "y": 48, "width": 24, "height": 24 },
|
||||
"religious-jewish-18": { "x": 78, "y": 48, "width": 18, "height": 18 },
|
||||
"religious-jewish-12": { "x": 96, "y": 48, "width": 12, "height": 12 },
|
||||
"religious-christian-24": { "x": 108, "y": 48, "width": 24, "height": 24 },
|
||||
"religious-christian-18": { "x": 132, "y": 48, "width": 18, "height": 18 },
|
||||
"religious-christian-12": { "x": 150, "y": 48, "width": 12, "height": 12 },
|
||||
"religious-muslim-24": { "x": 162, "y": 48, "width": 24, "height": 24 },
|
||||
"religious-muslim-18": { "x": 186, "y": 48, "width": 18, "height": 18 },
|
||||
"religious-muslim-12": { "x": 204, "y": 48, "width": 12, "height": 12 },
|
||||
"cemetery-24": { "x": 216, "y": 48, "width": 24, "height": 24 },
|
||||
"cemetery-18": { "x": 240, "y": 48, "width": 18, "height": 18 },
|
||||
"cemetery-12": { "x": 258, "y": 48, "width": 12, "height": 12 },
|
||||
"rocket-24": { "x": 0, "y": 72, "width": 24, "height": 24 },
|
||||
"rocket-18": { "x": 24, "y": 72, "width": 18, "height": 18 },
|
||||
"rocket-12": { "x": 42, "y": 72, "width": 12, "height": 12 },
|
||||
"airport-24": { "x": 54, "y": 72, "width": 24, "height": 24 },
|
||||
"airport-18": { "x": 78, "y": 72, "width": 18, "height": 18 },
|
||||
"airport-12": { "x": 96, "y": 72, "width": 12, "height": 12 },
|
||||
"heliport-24": { "x": 108, "y": 72, "width": 24, "height": 24 },
|
||||
"heliport-18": { "x": 132, "y": 72, "width": 18, "height": 18 },
|
||||
"heliport-12": { "x": 150, "y": 72, "width": 12, "height": 12 },
|
||||
"rail-24": { "x": 162, "y": 72, "width": 24, "height": 24 },
|
||||
"rail-18": { "x": 186, "y": 72, "width": 18, "height": 18 },
|
||||
"rail-12": { "x": 204, "y": 72, "width": 12, "height": 12 },
|
||||
"rail-metro-24": { "x": 216, "y": 72, "width": 24, "height": 24 },
|
||||
"rail-metro-18": { "x": 240, "y": 72, "width": 18, "height": 18 },
|
||||
"rail-metro-12": { "x": 258, "y": 72, "width": 12, "height": 12 },
|
||||
"rail-light-24": { "x": 0, "y": 96, "width": 24, "height": 24 },
|
||||
"rail-light-18": { "x": 24, "y": 96, "width": 18, "height": 18 },
|
||||
"rail-light-12": { "x": 42, "y": 96, "width": 12, "height": 12 },
|
||||
"bus-24": { "x": 54, "y": 96, "width": 24, "height": 24 },
|
||||
"bus-18": { "x": 78, "y": 96, "width": 18, "height": 18 },
|
||||
"bus-12": { "x": 96, "y": 96, "width": 12, "height": 12 },
|
||||
"fuel-24": { "x": 108, "y": 96, "width": 24, "height": 24 },
|
||||
"fuel-18": { "x": 132, "y": 96, "width": 18, "height": 18 },
|
||||
"fuel-12": { "x": 150, "y": 96, "width": 12, "height": 12 },
|
||||
"parking-24": { "x": 162, "y": 96, "width": 24, "height": 24 },
|
||||
"parking-18": { "x": 186, "y": 96, "width": 18, "height": 18 },
|
||||
"parking-12": { "x": 204, "y": 96, "width": 12, "height": 12 },
|
||||
"parking-garage-24": { "x": 216, "y": 96, "width": 24, "height": 24 },
|
||||
"parking-garage-18": { "x": 240, "y": 96, "width": 18, "height": 18 },
|
||||
"parking-garage-12": { "x": 258, "y": 96, "width": 12, "height": 12 },
|
||||
"airfield-24": { "x": 0, "y": 120, "width": 24, "height": 24 },
|
||||
"airfield-18": { "x": 24, "y": 120, "width": 18, "height": 18 },
|
||||
"airfield-12": { "x": 42, "y": 120, "width": 12, "height": 12 },
|
||||
"roadblock-24": { "x": 54, "y": 120, "width": 24, "height": 24 },
|
||||
"roadblock-18": { "x": 78, "y": 120, "width": 18, "height": 18 },
|
||||
"roadblock-12": { "x": 96, "y": 120, "width": 12, "height": 12 },
|
||||
"ferry-24": { "x": 108, "y": 120, "width": 24, "height": 24 },
|
||||
"ferry-18": { "x": 132, "y": 120, "width": 18, "height": 18 },
|
||||
"ferry-12": { "x": 150, "y": 120, "width": 12, "height": 12 },
|
||||
"harbor-24": { "x": 162, "y": 120, "width": 24, "height": 24 },
|
||||
"harbor-18": { "x": 186, "y": 120, "width": 18, "height": 18 },
|
||||
"harbor-12": { "x": 204, "y": 120, "width": 12, "height": 12 },
|
||||
"bicycle-24": { "x": 216, "y": 120, "width": 24, "height": 24 },
|
||||
"bicycle-18": { "x": 240, "y": 120, "width": 18, "height": 18 },
|
||||
"bicycle-12": { "x": 258, "y": 120, "width": 12, "height": 12 },
|
||||
"park-24": { "x": 0, "y": 144, "width": 24, "height": 24 },
|
||||
"park-18": { "x": 24, "y": 144, "width": 18, "height": 18 },
|
||||
"park-12": { "x": 42, "y": 144, "width": 12, "height": 12 },
|
||||
"park2-24": { "x": 54, "y": 144, "width": 24, "height": 24 },
|
||||
"park2-18": { "x": 78, "y": 144, "width": 18, "height": 18 },
|
||||
"park2-12": { "x": 96, "y": 144, "width": 12, "height": 12 },
|
||||
"museum-24": { "x": 108, "y": 144, "width": 24, "height": 24 },
|
||||
"museum-18": { "x": 132, "y": 144, "width": 18, "height": 18 },
|
||||
"museum-12": { "x": 150, "y": 144, "width": 12, "height": 12 },
|
||||
"lodging-24": { "x": 162, "y": 144, "width": 24, "height": 24 },
|
||||
"lodging-18": { "x": 186, "y": 144, "width": 18, "height": 18 },
|
||||
"lodging-12": { "x": 204, "y": 144, "width": 12, "height": 12 },
|
||||
"monument-24": { "x": 216, "y": 144, "width": 24, "height": 24 },
|
||||
"monument-18": { "x": 240, "y": 144, "width": 18, "height": 18 },
|
||||
"monument-12": { "x": 258, "y": 144, "width": 12, "height": 12 },
|
||||
"zoo-24": { "x": 0, "y": 168, "width": 24, "height": 24 },
|
||||
"zoo-18": { "x": 24, "y": 168, "width": 18, "height": 18 },
|
||||
"zoo-12": { "x": 42, "y": 168, "width": 12, "height": 12 },
|
||||
"garden-24": { "x": 54, "y": 168, "width": 24, "height": 24 },
|
||||
"garden-18": { "x": 78, "y": 168, "width": 18, "height": 18 },
|
||||
"garden-12": { "x": 96, "y": 168, "width": 12, "height": 12 },
|
||||
"campsite-24": { "x": 108, "y": 168, "width": 24, "height": 24 },
|
||||
"campsite-18": { "x": 132, "y": 168, "width": 18, "height": 18 },
|
||||
"campsite-12": { "x": 150, "y": 168, "width": 12, "height": 12 },
|
||||
"theatre-24": { "x": 162, "y": 168, "width": 24, "height": 24 },
|
||||
"theatre-18": { "x": 186, "y": 168, "width": 18, "height": 18 },
|
||||
"theatre-12": { "x": 204, "y": 168, "width": 12, "height": 12 },
|
||||
"art-gallery-24": { "x": 216, "y": 168, "width": 24, "height": 24 },
|
||||
"art-gallery-18": { "x": 240, "y": 168, "width": 18, "height": 18 },
|
||||
"art-gallery-12": { "x": 258, "y": 168, "width": 12, "height": 12 },
|
||||
"pitch-24": { "x": 0, "y": 192, "width": 24, "height": 24 },
|
||||
"pitch-18": { "x": 24, "y": 192, "width": 18, "height": 18 },
|
||||
"pitch-12": { "x": 42, "y": 192, "width": 12, "height": 12 },
|
||||
"soccer-24": { "x": 54, "y": 192, "width": 24, "height": 24 },
|
||||
"soccer-18": { "x": 78, "y": 192, "width": 18, "height": 18 },
|
||||
"soccer-12": { "x": 96, "y": 192, "width": 12, "height": 12 },
|
||||
"america-football-24": { "x": 108, "y": 192, "width": 24, "height": 24 },
|
||||
"america-football-18": { "x": 132, "y": 192, "width": 18, "height": 18 },
|
||||
"america-football-12": { "x": 150, "y": 192, "width": 12, "height": 12 },
|
||||
"tennis-24": { "x": 162, "y": 192, "width": 24, "height": 24 },
|
||||
"tennis-18": { "x": 186, "y": 192, "width": 18, "height": 18 },
|
||||
"tennis-12": { "x": 204, "y": 192, "width": 12, "height": 12 },
|
||||
"basketball-24": { "x": 216, "y": 192, "width": 24, "height": 24 },
|
||||
"basketball-18": { "x": 240, "y": 192, "width": 18, "height": 18 },
|
||||
"basketball-12": { "x": 258, "y": 192, "width": 12, "height": 12 },
|
||||
"baseball-24": { "x": 0, "y": 216, "width": 24, "height": 24 },
|
||||
"baseball-18": { "x": 24, "y": 216, "width": 18, "height": 18 },
|
||||
"baseball-12": { "x": 42, "y": 216, "width": 12, "height": 12 },
|
||||
"golf-24": { "x": 54, "y": 216, "width": 24, "height": 24 },
|
||||
"golf-18": { "x": 78, "y": 216, "width": 18, "height": 18 },
|
||||
"golf-12": { "x": 96, "y": 216, "width": 12, "height": 12 },
|
||||
"swimming-24": { "x": 108, "y": 216, "width": 24, "height": 24 },
|
||||
"swimming-18": { "x": 132, "y": 216, "width": 18, "height": 18 },
|
||||
"swimming-12": { "x": 150, "y": 216, "width": 12, "height": 12 },
|
||||
"cricket-24": { "x": 162, "y": 216, "width": 24, "height": 24 },
|
||||
"cricket-18": { "x": 186, "y": 216, "width": 18, "height": 18 },
|
||||
"cricket-12": { "x": 204, "y": 216, "width": 12, "height": 12 },
|
||||
"skiing-24": { "x": 216, "y": 216, "width": 24, "height": 24 },
|
||||
"skiing-18": { "x": 240, "y": 216, "width": 18, "height": 18 },
|
||||
"skiing-12": { "x": 258, "y": 216, "width": 12, "height": 12 },
|
||||
"school-24": { "x": 0, "y": 240, "width": 24, "height": 24 },
|
||||
"school-18": { "x": 24, "y": 240, "width": 18, "height": 18 },
|
||||
"school-12": { "x": 42, "y": 240, "width": 12, "height": 12 },
|
||||
"college-24": { "x": 54, "y": 240, "width": 24, "height": 24 },
|
||||
"college-18": { "x": 78, "y": 240, "width": 18, "height": 18 },
|
||||
"college-12": { "x": 96, "y": 240, "width": 12, "height": 12 },
|
||||
"library-24": { "x": 108, "y": 240, "width": 24, "height": 24 },
|
||||
"library-18": { "x": 132, "y": 240, "width": 18, "height": 18 },
|
||||
"library-12": { "x": 150, "y": 240, "width": 12, "height": 12 },
|
||||
"post-24": { "x": 162, "y": 240, "width": 24, "height": 24 },
|
||||
"post-18": { "x": 186, "y": 240, "width": 18, "height": 18 },
|
||||
"post-12": { "x": 204, "y": 240, "width": 12, "height": 12 },
|
||||
"fire-station-24": { "x": 216, "y": 240, "width": 24, "height": 24 },
|
||||
"fire-station-18": { "x": 240, "y": 240, "width": 18, "height": 18 },
|
||||
"fire-station-12": { "x": 258, "y": 240, "width": 12, "height": 12 },
|
||||
"town-hall-24": { "x": 0, "y": 264, "width": 24, "height": 24 },
|
||||
"town-hall-18": { "x": 24, "y": 264, "width": 18, "height": 18 },
|
||||
"town-hall-12": { "x": 42, "y": 264, "width": 12, "height": 12 },
|
||||
"police-24": { "x": 54, "y": 264, "width": 24, "height": 24 },
|
||||
"police-18": { "x": 78, "y": 264, "width": 18, "height": 18 },
|
||||
"police-12": { "x": 96, "y": 264, "width": 12, "height": 12 },
|
||||
"prison-24": { "x": 108, "y": 264, "width": 24, "height": 24 },
|
||||
"prison-18": { "x": 132, "y": 264, "width": 18, "height": 18 },
|
||||
"prison-12": { "x": 150, "y": 264, "width": 12, "height": 12 },
|
||||
"embassy-24": { "x": 162, "y": 264, "width": 24, "height": 24 },
|
||||
"embassy-18": { "x": 186, "y": 264, "width": 18, "height": 18 },
|
||||
"embassy-12": { "x": 204, "y": 264, "width": 12, "height": 12 },
|
||||
"beer-24": { "x": 216, "y": 264, "width": 24, "height": 24 },
|
||||
"beer-18": { "x": 240, "y": 264, "width": 18, "height": 18 },
|
||||
"beer-12": { "x": 258, "y": 264, "width": 12, "height": 12 },
|
||||
"restaurant-24": { "x": 0, "y": 288, "width": 24, "height": 24 },
|
||||
"restaurant-18": { "x": 24, "y": 288, "width": 18, "height": 18 },
|
||||
"restaurant-12": { "x": 42, "y": 288, "width": 12, "height": 12 },
|
||||
"cafe-24": { "x": 54, "y": 288, "width": 24, "height": 24 },
|
||||
"cafe-18": { "x": 78, "y": 288, "width": 18, "height": 18 },
|
||||
"cafe-12": { "x": 96, "y": 288, "width": 12, "height": 12 },
|
||||
"shop-24": { "x": 108, "y": 288, "width": 24, "height": 24 },
|
||||
"shop-18": { "x": 132, "y": 288, "width": 18, "height": 18 },
|
||||
"shop-12": { "x": 150, "y": 288, "width": 12, "height": 12 },
|
||||
"fast-food-24": { "x": 162, "y": 288, "width": 24, "height": 24 },
|
||||
"fast-food-18": { "x": 186, "y": 288, "width": 18, "height": 18 },
|
||||
"fast-food-12": { "x": 204, "y": 288, "width": 12, "height": 12 },
|
||||
"bar-24": { "x": 216, "y": 288, "width": 24, "height": 24 },
|
||||
"bar-18": { "x": 240, "y": 288, "width": 18, "height": 18 },
|
||||
"bar-12": { "x": 258, "y": 288, "width": 12, "height": 12 },
|
||||
"bank-24": { "x": 0, "y": 312, "width": 24, "height": 24 },
|
||||
"bank-18": { "x": 24, "y": 312, "width": 18, "height": 18 },
|
||||
"bank-12": { "x": 42, "y": 312, "width": 12, "height": 12 },
|
||||
"grocery-24": { "x": 54, "y": 312, "width": 24, "height": 24 },
|
||||
"grocery-18": { "x": 78, "y": 312, "width": 18, "height": 18 },
|
||||
"grocery-12": { "x": 96, "y": 312, "width": 12, "height": 12 },
|
||||
"cinema-24": { "x": 108, "y": 312, "width": 24, "height": 24 },
|
||||
"cinema-18": { "x": 132, "y": 312, "width": 18, "height": 18 },
|
||||
"cinema-12": { "x": 150, "y": 312, "width": 12, "height": 12 },
|
||||
"pharmacy-24": { "x": 162, "y": 312, "width": 24, "height": 24 },
|
||||
"pharmacy-18": { "x": 186, "y": 312, "width": 18, "height": 18 },
|
||||
"pharmacy-12": { "x": 204, "y": 312, "width": 12, "height": 12 },
|
||||
"hospital-24": { "x": 216, "y": 312, "width": 24, "height": 24 },
|
||||
"hospital-18": { "x": 240, "y": 312, "width": 18, "height": 18 },
|
||||
"hospital-12": { "x": 258, "y": 312, "width": 12, "height": 12 },
|
||||
"danger-24": { "x": 0, "y": 336, "width": 24, "height": 24 },
|
||||
"danger-18": { "x": 24, "y": 336, "width": 18, "height": 18 },
|
||||
"danger-12": { "x": 42, "y": 336, "width": 12, "height": 12 },
|
||||
"industrial-24": { "x": 54, "y": 336, "width": 24, "height": 24 },
|
||||
"industrial-18": { "x": 78, "y": 336, "width": 18, "height": 18 },
|
||||
"industrial-12": { "x": 96, "y": 336, "width": 12, "height": 12 },
|
||||
"warehouse-24": { "x": 108, "y": 336, "width": 24, "height": 24 },
|
||||
"warehouse-18": { "x": 132, "y": 336, "width": 18, "height": 18 },
|
||||
"warehouse-12": { "x": 150, "y": 336, "width": 12, "height": 12 },
|
||||
"commercial-24": { "x": 162, "y": 336, "width": 24, "height": 24 },
|
||||
"commercial-18": { "x": 186, "y": 336, "width": 18, "height": 18 },
|
||||
"commercial-12": { "x": 204, "y": 336, "width": 12, "height": 12 },
|
||||
"building-24": { "x": 216, "y": 336, "width": 24, "height": 24 },
|
||||
"building-18": { "x": 240, "y": 336, "width": 18, "height": 18 },
|
||||
"building-12": { "x": 258, "y": 336, "width": 12, "height": 12 },
|
||||
"place-of-worship-24": { "x": 0, "y": 360, "width": 24, "height": 24 },
|
||||
"place-of-worship-18": { "x": 24, "y": 360, "width": 18, "height": 18 },
|
||||
"place-of-worship-12": { "x": 42, "y": 360, "width": 12, "height": 12 },
|
||||
"alcohol-shop-24": { "x": 54, "y": 360, "width": 24, "height": 24 },
|
||||
"alcohol-shop-18": { "x": 78, "y": 360, "width": 18, "height": 18 },
|
||||
"alcohol-shop-12": { "x": 96, "y": 360, "width": 12, "height": 12 },
|
||||
"logging-24": { "x": 108, "y": 360, "width": 24, "height": 24 },
|
||||
"logging-18": { "x": 132, "y": 360, "width": 18, "height": 18 },
|
||||
"logging-12": { "x": 150, "y": 360, "width": 12, "height": 12 },
|
||||
"oil-well-24": { "x": 162, "y": 360, "width": 24, "height": 24 },
|
||||
"oil-well-18": { "x": 186, "y": 360, "width": 18, "height": 18 },
|
||||
"oil-well-12": { "x": 204, "y": 360, "width": 12, "height": 12 },
|
||||
"slaughterhouse-24": { "x": 216, "y": 360, "width": 24, "height": 24 },
|
||||
"slaughterhouse-18": { "x": 240, "y": 360, "width": 18, "height": 18 },
|
||||
"slaughterhouse-12": { "x": 258, "y": 360, "width": 12, "height": 12 },
|
||||
"dam-24": { "x": 0, "y": 384, "width": 24, "height": 24 },
|
||||
"dam-18": { "x": 24, "y": 384, "width": 18, "height": 18 },
|
||||
"dam-12": { "x": 42, "y": 384, "width": 12, "height": 12 },
|
||||
"water-24": { "x": 54, "y": 384, "width": 24, "height": 24 },
|
||||
"water-18": { "x": 78, "y": 384, "width": 18, "height": 18 },
|
||||
"water-12": { "x": 96, "y": 384, "width": 12, "height": 12 },
|
||||
"wetland-24": { "x": 108, "y": 384, "width": 24, "height": 24 },
|
||||
"wetland-18": { "x": 132, "y": 384, "width": 18, "height": 18 },
|
||||
"wetland-12": { "x": 150, "y": 384, "width": 12, "height": 12 },
|
||||
"disability-24": { "x": 162, "y": 384, "width": 24, "height": 24 },
|
||||
"disability-18": { "x": 186, "y": 384, "width": 18, "height": 18 },
|
||||
"disability-12": { "x": 204, "y": 384, "width": 12, "height": 12 },
|
||||
"telephone-24": { "x": 216, "y": 384, "width": 24, "height": 24 },
|
||||
"telephone-18": { "x": 240, "y": 384, "width": 18, "height": 18 },
|
||||
"telephone-12": { "x": 258, "y": 384, "width": 12, "height": 12 },
|
||||
"emergency-telephone-24": { "x": 0, "y": 408, "width": 24, "height": 24 },
|
||||
"emergency-telephone-18": { "x": 24, "y": 408, "width": 18, "height": 18 },
|
||||
"emergency-telephone-12": { "x": 42, "y": 408, "width": 12, "height": 12 },
|
||||
"toilets-24": { "x": 54, "y": 408, "width": 24, "height": 24 },
|
||||
"toilets-18": { "x": 78, "y": 408, "width": 18, "height": 18 },
|
||||
"toilets-12": { "x": 96, "y": 408, "width": 12, "height": 12 },
|
||||
"waste-basket-24": { "x": 108, "y": 408, "width": 24, "height": 24 },
|
||||
"waste-basket-18": { "x": 132, "y": 408, "width": 18, "height": 18 },
|
||||
"waste-basket-12": { "x": 150, "y": 408, "width": 12, "height": 12 },
|
||||
"music-24": { "x": 162, "y": 408, "width": 24, "height": 24 },
|
||||
"music-18": { "x": 186, "y": 408, "width": 18, "height": 18 },
|
||||
"music-12": { "x": 204, "y": 408, "width": 12, "height": 12 },
|
||||
"land-use-24": { "x": 216, "y": 408, "width": 24, "height": 24 },
|
||||
"land-use-18": { "x": 240, "y": 408, "width": 18, "height": 18 },
|
||||
"land-use-12": { "x": 258, "y": 408, "width": 12, "height": 12 },
|
||||
"city-24": { "x": 0, "y": 432, "width": 24, "height": 24 },
|
||||
"city-18": { "x": 24, "y": 432, "width": 18, "height": 18 },
|
||||
"city-12": { "x": 42, "y": 432, "width": 12, "height": 12 },
|
||||
"town-24": { "x": 54, "y": 432, "width": 24, "height": 24 },
|
||||
"town-18": { "x": 78, "y": 432, "width": 18, "height": 18 },
|
||||
"town-12": { "x": 96, "y": 432, "width": 12, "height": 12 },
|
||||
"village-24": { "x": 108, "y": 432, "width": 24, "height": 24 },
|
||||
"village-18": { "x": 132, "y": 432, "width": 18, "height": 18 },
|
||||
"village-12": { "x": 150, "y": 432, "width": 12, "height": 12 },
|
||||
"farm-24": { "x": 162, "y": 432, "width": 24, "height": 24 },
|
||||
"farm-18": { "x": 186, "y": 432, "width": 18, "height": 18 },
|
||||
"farm-12": { "x": 204, "y": 432, "width": 12, "height": 12 },
|
||||
"bakery-24": { "x": 216, "y": 432, "width": 24, "height": 24 },
|
||||
"bakery-18": { "x": 240, "y": 432, "width": 18, "height": 18 },
|
||||
"bakery-12": { "x": 258, "y": 432, "width": 12, "height": 12 },
|
||||
"dog-park-24": { "x": 0, "y": 456, "width": 24, "height": 24 },
|
||||
"dog-park-18": { "x": 24, "y": 456, "width": 18, "height": 18 },
|
||||
"dog-park-12": { "x": 42, "y": 456, "width": 12, "height": 12 },
|
||||
"lighthouse-24": { "x": 54, "y": 456, "width": 24, "height": 24 },
|
||||
"lighthouse-18": { "x": 78, "y": 456, "width": 18, "height": 18 },
|
||||
"lighthouse-12": { "x": 96, "y": 456, "width": 12, "height": 12 },
|
||||
"clothing-store-24": { "x": 108, "y": 456, "width": 24, "height": 24 },
|
||||
"clothing-store-18": { "x": 132, "y": 456, "width": 18, "height": 18 },
|
||||
"clothing-store-12": { "x": 150, "y": 456, "width": 12, "height": 12 },
|
||||
"polling-place-24": { "x": 162, "y": 456, "width": 24, "height": 24 },
|
||||
"polling-place-18": { "x": 186, "y": 456, "width": 18, "height": 18 },
|
||||
"polling-place-12": { "x": 204, "y": 456, "width": 12, "height": 12 },
|
||||
"playground-24": { "x": 216, "y": 456, "width": 24, "height": 24 },
|
||||
"playground-18": { "x": 240, "y": 456, "width": 18, "height": 18 },
|
||||
"playground-12": { "x": 258, "y": 456, "width": 12, "height": 12 },
|
||||
"entrance-24": { "x": 0, "y": 480, "width": 24, "height": 24 },
|
||||
"entrance-18": { "x": 24, "y": 480, "width": 18, "height": 18 },
|
||||
"entrance-12": { "x": 42, "y": 480, "width": 12, "height": 12 },
|
||||
"heart-24": { "x": 54, "y": 480, "width": 24, "height": 24 },
|
||||
"heart-18": { "x": 78, "y": 480, "width": 18, "height": 18 },
|
||||
"heart-12": { "x": 96, "y": 480, "width": 12, "height": 12 },
|
||||
"london-underground-24": { "x": 108, "y": 480, "width": 24, "height": 24 },
|
||||
"london-underground-18": { "x": 132, "y": 480, "width": 18, "height": 18 },
|
||||
"london-underground-12": { "x": 150, "y": 480, "width": 12, "height": 12 },
|
||||
"minefield-24": { "x": 162, "y": 480, "width": 24, "height": 24 },
|
||||
"minefield-18": { "x": 186, "y": 480, "width": 18, "height": 18 },
|
||||
"minefield-12": { "x": 204, "y": 480, "width": 12, "height": 12 },
|
||||
"rail-underground-24": { "x": 216, "y": 480, "width": 24, "height": 24 },
|
||||
"rail-underground-18": { "x": 240, "y": 480, "width": 18, "height": 18 },
|
||||
"rail-underground-12": { "x": 258, "y": 480, "width": 12, "height": 12 },
|
||||
"rail-above-24": { "x": 0, "y": 504, "width": 24, "height": 24 },
|
||||
"rail-above-18": { "x": 24, "y": 504, "width": 18, "height": 18 },
|
||||
"rail-above-12": { "x": 42, "y": 504, "width": 12, "height": 12 },
|
||||
"camera-24": { "x": 54, "y": 504, "width": 24, "height": 24 },
|
||||
"camera-18": { "x": 78, "y": 504, "width": 18, "height": 18 },
|
||||
"camera-12": { "x": 96, "y": 504, "width": 12, "height": 12 },
|
||||
"laundry-24": { "x": 108, "y": 504, "width": 24, "height": 24 },
|
||||
"laundry-18": { "x": 132, "y": 504, "width": 18, "height": 18 },
|
||||
"laundry-12": { "x": 150, "y": 504, "width": 12, "height": 12 },
|
||||
"car-24": { "x": 162, "y": 504, "width": 24, "height": 24 },
|
||||
"car-18": { "x": 186, "y": 504, "width": 18, "height": 18 },
|
||||
"car-12": { "x": 204, "y": 504, "width": 12, "height": 12 },
|
||||
"suitcase-24": { "x": 216, "y": 504, "width": 24, "height": 24 },
|
||||
"suitcase-18": { "x": 240, "y": 504, "width": 18, "height": 18 },
|
||||
"suitcase-12": { "x": 258, "y": 504, "width": 12, "height": 12 },
|
||||
"hairdresser-24": { "x": 0, "y": 528, "width": 24, "height": 24 },
|
||||
"hairdresser-18": { "x": 24, "y": 528, "width": 18, "height": 18 },
|
||||
"hairdresser-12": { "x": 42, "y": 528, "width": 12, "height": 12 },
|
||||
"chemist-24": { "x": 54, "y": 528, "width": 24, "height": 24 },
|
||||
"chemist-18": { "x": 78, "y": 528, "width": 18, "height": 18 },
|
||||
"chemist-12": { "x": 96, "y": 528, "width": 12, "height": 12 },
|
||||
"mobilephone-24": { "x": 108, "y": 528, "width": 24, "height": 24 },
|
||||
"mobilephone-18": { "x": 132, "y": 528, "width": 18, "height": 18 },
|
||||
"mobilephone-12": { "x": 150, "y": 528, "width": 12, "height": 12 },
|
||||
"scooter-24": { "x": 162, "y": 528, "width": 24, "height": 24 },
|
||||
"scooter-18": { "x": 186, "y": 528, "width": 18, "height": 18 },
|
||||
"scooter-12": { "x": 204, "y": 528, "width": 12, "height": 12 },
|
||||
"gift-24": { "x": 216, "y": 528, "width": 24, "height": 24 },
|
||||
"gift-18": { "x": 240, "y": 528, "width": 18, "height": 18 },
|
||||
"gift-12": { "x": 258, "y": 528, "width": 12, "height": 12 },
|
||||
"ice-cream-24": { "x": 0, "y": 552, "width": 24, "height": 24 },
|
||||
"ice-cream-18": { "x": 24, "y": 552, "width": 18, "height": 18 },
|
||||
"ice-cream-12": { "x": 42, "y": 552, "width": 12, "height": 12 }}
|
||||
@@ -0,0 +1,25 @@
|
||||
export { wikipedia } from 'wmf-sitematrix';
|
||||
export { default as featureIcons } from 'maki/www/maki-sprite.json';
|
||||
export { default as suggestions } from 'name-suggestion-index/name-suggestions.json';
|
||||
|
||||
export { default as deprecated } from './deprecated.json';
|
||||
export { default as discarded } from './discarded.json';
|
||||
export { default as imperial } from './imperial.json';
|
||||
export { default as locales } from './locales.json';
|
||||
export { default as addressFormats } from './address-formats.json';
|
||||
export { default as phoneFormats } from './phone-formats.json';
|
||||
export { default as driveLeft } from './drive-left.json';
|
||||
export { default as imagery } from './imagery.json';
|
||||
export { default as en } from '../dist/locales/en.json';
|
||||
|
||||
import { default as presetsData } from './presets/presets.json';
|
||||
import { default as defaults } from './presets/defaults.json';
|
||||
import { default as categories } from './presets/categories.json';
|
||||
import { default as fields } from './presets/fields.json';
|
||||
|
||||
export var presets = {
|
||||
presets: presetsData,
|
||||
defaults: defaults,
|
||||
categories: categories,
|
||||
fields: fields
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+46591
-70420
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
+23
-40
@@ -13,52 +13,35 @@
|
||||
<meta name='apple-mobile-web-app-status-bar-style' content='black-translucent' />
|
||||
|
||||
<script src='js/lib/d3.v3.js'></script>
|
||||
<script src='js/lib/d3.combobox.js'></script>
|
||||
<script src='js/lib/d3.geo.tile.js'></script>
|
||||
<script src='js/lib/d3.dimensions.js'></script>
|
||||
<script src='js/lib/d3.trigger.js'></script>
|
||||
<script src='js/lib/d3.jsonp.js'></script>
|
||||
<script src='js/lib/d3.keybinding.js'></script>
|
||||
<script src='js/lib/d3.curtain.js'></script>
|
||||
<script src='js/lib/d3.one.js'></script>
|
||||
<script src='js/lib/d3.value.js'></script>
|
||||
<script src='js/lib/d3-compat.js'></script>
|
||||
<script src='js/lib/bootstrap-tooltip.js'></script>
|
||||
<script src='js/lib/id/index.js'></script>
|
||||
|
||||
<script src='data/data_dev.js'></script>
|
||||
<script src='data/introGraph.js'></script>
|
||||
<script src='dist/iD.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id='id-container'></div>
|
||||
<script>
|
||||
iD.data.load(function() {
|
||||
id = iD.Context(window)
|
||||
.presets(iD.data.presets)
|
||||
.imagery(iD.data.imagery)
|
||||
.taginfo(iD.services.taginfo.init())
|
||||
.assetPath('dist/');
|
||||
id = iD.Context(window)
|
||||
.presets(iD.data.presets)
|
||||
.imagery(iD.data.imagery)
|
||||
.taginfo(iD.services.taginfo.init())
|
||||
.assetPath('dist/');
|
||||
|
||||
d3.select('#id-container')
|
||||
.call(id.ui());
|
||||
d3.select('#id-container')
|
||||
.call(id.ui());
|
||||
|
||||
d3.select('#about-list').insert('li', '.user-list')
|
||||
.attr('class', 'source-switch')
|
||||
.call(iD.ui.SourceSwitch(id)
|
||||
.keys([
|
||||
{
|
||||
'url': 'http://www.openstreetmap.org',
|
||||
'oauth_consumer_key': '5A043yRSEugj4DJ5TljuapfnrflWDte8jTOcWLlT',
|
||||
'oauth_secret': 'aB3jKq1TRsCOUrfOIZ6oQMEDmv2ptV76PA54NGLL'
|
||||
},
|
||||
{
|
||||
'url': 'http://api06.dev.openstreetmap.org',
|
||||
'oauth_consumer_key': 'zwQZFivccHkLs3a8Rq5CoS412fE5aPCXDw9DZj7R',
|
||||
'oauth_secret': 'aMnOOCwExO2XYtRVWJ1bI9QOdqh1cay2UgpbhA6p'
|
||||
}
|
||||
]));
|
||||
|
||||
});
|
||||
d3.select('#about-list').insert('li', '.user-list')
|
||||
.attr('class', 'source-switch')
|
||||
.call(iD.ui.SourceSwitch(id)
|
||||
.keys([
|
||||
{
|
||||
'url': 'http://www.openstreetmap.org',
|
||||
'oauth_consumer_key': '5A043yRSEugj4DJ5TljuapfnrflWDte8jTOcWLlT',
|
||||
'oauth_secret': 'aB3jKq1TRsCOUrfOIZ6oQMEDmv2ptV76PA54NGLL'
|
||||
},
|
||||
{
|
||||
'url': 'http://api06.dev.openstreetmap.org',
|
||||
'oauth_consumer_key': 'zwQZFivccHkLs3a8Rq5CoS412fE5aPCXDw9DZj7R',
|
||||
'oauth_secret': 'aMnOOCwExO2XYtRVWJ1bI9QOdqh1cay2UgpbhA6p'
|
||||
}
|
||||
]));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Vendored
-176
@@ -1,176 +0,0 @@
|
||||
(function(exports) {
|
||||
|
||||
var bootstrap = (typeof exports.bootstrap === "object") ?
|
||||
exports.bootstrap :
|
||||
(exports.bootstrap = {});
|
||||
|
||||
bootstrap.tooltip = function() {
|
||||
|
||||
var tooltip = function(selection) {
|
||||
selection.each(setup);
|
||||
},
|
||||
animation = d3.functor(false),
|
||||
html = d3.functor(false),
|
||||
title = function() {
|
||||
var title = this.getAttribute("data-original-title");
|
||||
if (title) {
|
||||
return title;
|
||||
} else {
|
||||
title = this.getAttribute("title");
|
||||
this.removeAttribute("title");
|
||||
this.setAttribute("data-original-title", title);
|
||||
}
|
||||
return title;
|
||||
},
|
||||
over = "mouseenter.tooltip",
|
||||
out = "mouseleave.tooltip",
|
||||
placements = "top left bottom right".split(" "),
|
||||
placement = d3.functor("top");
|
||||
|
||||
tooltip.title = function(_) {
|
||||
if (arguments.length) {
|
||||
title = d3.functor(_);
|
||||
return tooltip;
|
||||
} else {
|
||||
return title;
|
||||
}
|
||||
};
|
||||
|
||||
tooltip.html = function(_) {
|
||||
if (arguments.length) {
|
||||
html = d3.functor(_);
|
||||
return tooltip;
|
||||
} else {
|
||||
return html;
|
||||
}
|
||||
};
|
||||
|
||||
tooltip.placement = function(_) {
|
||||
if (arguments.length) {
|
||||
placement = d3.functor(_);
|
||||
return tooltip;
|
||||
} else {
|
||||
return placement;
|
||||
}
|
||||
};
|
||||
|
||||
tooltip.show = function(selection) {
|
||||
selection.each(show);
|
||||
};
|
||||
|
||||
tooltip.hide = function(selection) {
|
||||
selection.each(hide);
|
||||
};
|
||||
|
||||
tooltip.toggle = function(selection) {
|
||||
selection.each(toggle);
|
||||
};
|
||||
|
||||
tooltip.destroy = function(selection) {
|
||||
selection
|
||||
.on(over, null)
|
||||
.on(out, null)
|
||||
.attr("title", function() {
|
||||
return this.getAttribute("data-original-title") || this.getAttribute("title");
|
||||
})
|
||||
.attr("data-original-title", null)
|
||||
.select(".tooltip")
|
||||
.remove();
|
||||
};
|
||||
|
||||
function setup() {
|
||||
var root = d3.select(this),
|
||||
animate = animation.apply(this, arguments),
|
||||
tip = root.append("div")
|
||||
.attr("class", "tooltip");
|
||||
|
||||
if (animate) {
|
||||
tip.classed("fade", true);
|
||||
}
|
||||
|
||||
// TODO "inside" checks?
|
||||
|
||||
tip.append("div")
|
||||
.attr("class", "tooltip-arrow");
|
||||
tip.append("div")
|
||||
.attr("class", "tooltip-inner");
|
||||
|
||||
var place = placement.apply(this, arguments);
|
||||
tip.classed(place, true);
|
||||
|
||||
root.on(over, show);
|
||||
root.on(out, hide);
|
||||
}
|
||||
|
||||
function show() {
|
||||
var root = d3.select(this),
|
||||
content = title.apply(this, arguments),
|
||||
tip = root.select(".tooltip")
|
||||
.classed("in", true),
|
||||
markup = html.apply(this, arguments),
|
||||
innercontent = tip.select(".tooltip-inner")[markup ? "html" : "text"](content),
|
||||
place = placement.apply(this, arguments),
|
||||
outer = getPosition(root.node()),
|
||||
inner = getPosition(tip.node()),
|
||||
pos;
|
||||
|
||||
switch (place) {
|
||||
case "top":
|
||||
pos = {x: outer.x + (outer.w - inner.w) / 2, y: outer.y - inner.h};
|
||||
break;
|
||||
case "right":
|
||||
pos = {x: outer.x + outer.w, y: outer.y + (outer.h - inner.h) / 2};
|
||||
break;
|
||||
case "left":
|
||||
pos = {x: outer.x - inner.w, y: outer.y + (outer.h - inner.h) / 2};
|
||||
break;
|
||||
case "bottom":
|
||||
pos = {x: Math.max(0, outer.x + (outer.w - inner.w) / 2), y: outer.y + outer.h};
|
||||
break;
|
||||
}
|
||||
|
||||
tip.style(pos ?
|
||||
{left: ~~pos.x + "px", top: ~~pos.y + "px"} :
|
||||
{left: null, top: null});
|
||||
|
||||
this.tooltipVisible = true;
|
||||
}
|
||||
|
||||
function hide() {
|
||||
d3.select(this).select(".tooltip")
|
||||
.classed("in", false);
|
||||
|
||||
this.tooltipVisible = false;
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
if (this.tooltipVisible) {
|
||||
hide.apply(this, arguments);
|
||||
} else {
|
||||
show.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
return tooltip;
|
||||
};
|
||||
|
||||
function getPosition(node) {
|
||||
var mode = d3.select(node).style('position');
|
||||
if (mode === 'absolute' || mode === 'static') {
|
||||
return {
|
||||
x: node.offsetLeft,
|
||||
y: node.offsetTop,
|
||||
w: node.offsetWidth,
|
||||
h: node.offsetHeight
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
x: 0,
|
||||
y: 0,
|
||||
w: node.offsetWidth,
|
||||
h: node.offsetHeight
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
})(this);
|
||||
@@ -284,9 +284,6 @@ d3.combobox = function() {
|
||||
};
|
||||
|
||||
d3.combobox.off = function(input) {
|
||||
data = null;
|
||||
fetcher = null;
|
||||
|
||||
input
|
||||
.on('focus.typeahead', null)
|
||||
.on('blur.typeahead', null)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
d3.selection.prototype.dimensions = function (dimensions) {
|
||||
var refresh = (function(node) {
|
||||
var cr = node.getBoundingClientRect();
|
||||
prop = [cr.width, cr.height];
|
||||
var prop = [cr.width, cr.height];
|
||||
this.property('__dimensions__', prop);
|
||||
return prop;
|
||||
}).bind(this);
|
||||
|
||||
Vendored
+1
-4
@@ -1,5 +1,4 @@
|
||||
!function(){
|
||||
var d3 = {version: "3.5.5"}; // semver
|
||||
var d3 = {version: "3.5.5"}; // semver
|
||||
d3.ascending = d3_ascending;
|
||||
|
||||
function d3_ascending(a, b) {
|
||||
@@ -6039,5 +6038,3 @@ d3.xml = d3_xhrType(function(request) {
|
||||
});
|
||||
if (typeof define === "function" && define.amd) define(d3);
|
||||
else if (typeof module === "object" && module.exports) module.exports = d3;
|
||||
this.d3 = d3;
|
||||
}();
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
require('./d3.combobox');
|
||||
require('./d3.geo.tile');
|
||||
require('./d3.keybinding');
|
||||
require('./d3.one');
|
||||
require('./d3.dimensions');
|
||||
require('./d3.trigger');
|
||||
require('./d3.curtain');
|
||||
require('./d3.value');
|
||||
require('./d3-compat');
|
||||
@@ -1,4 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { t, addTranslation, setLocale } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Background } from '../renderer/background';
|
||||
import { Connection } from './connection';
|
||||
@@ -10,14 +10,16 @@ import { RawMercator } from '../geo/raw_mercator';
|
||||
import { presets as presetsInit } from '../presets/presets';
|
||||
import { init as uiInit } from '../ui/init';
|
||||
|
||||
export var areaKeys = {};
|
||||
|
||||
export function Context(root) {
|
||||
if (!root.locale) {
|
||||
root.locale = {
|
||||
current: function(_) { this._current = _; }
|
||||
};
|
||||
}
|
||||
root.locale.en = iD.data.en;
|
||||
root.locale.current('en');
|
||||
addTranslation('en', iD.data.en);
|
||||
setLocale('en');
|
||||
|
||||
var dispatch = d3.dispatch('enter', 'exit', 'change'),
|
||||
context = {};
|
||||
@@ -259,7 +261,7 @@ export function Context(root) {
|
||||
context.presets = function(_) {
|
||||
if (!arguments.length) return presets;
|
||||
presets.load(_);
|
||||
iD.areaKeys = presets.areaKeys();
|
||||
areaKeys = presets.areaKeys();
|
||||
return context;
|
||||
};
|
||||
|
||||
@@ -331,8 +333,8 @@ export function Context(root) {
|
||||
if (locale && locale !== 'en' && iD.data.locales.indexOf(locale) !== -1) {
|
||||
localePath = localePath || context.asset('locales/' + locale + '.json');
|
||||
d3.json(localePath, function(err, result) {
|
||||
root.locale[locale] = result;
|
||||
root.locale.current(locale);
|
||||
addTranslation(locale, result);
|
||||
setLocale(locale);
|
||||
cb();
|
||||
});
|
||||
} else {
|
||||
|
||||
+5
-2
@@ -2,6 +2,7 @@ import _ from 'lodash';
|
||||
import { Extent, cross } from '../geo/index';
|
||||
import { Entity } from './entity';
|
||||
import { oneWayTags } from './tags';
|
||||
import { areaKeys } from './context';
|
||||
|
||||
export function Way() {
|
||||
if (!(this instanceof Way)) {
|
||||
@@ -217,9 +218,11 @@ _.extend(Way.prototype, {
|
||||
return true;
|
||||
if (!this.isClosed() || this.tags.area === 'no')
|
||||
return false;
|
||||
for (var key in this.tags)
|
||||
if (key in iD.areaKeys && !(this.tags[key] in iD.areaKeys[key]))
|
||||
for (var key in this.tags) {
|
||||
if (key in areaKeys && !(this.tags[key] in areaKeys[key])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import '../js/lib/index';
|
||||
import * as iD from './index';
|
||||
window.iD = iD;
|
||||
@@ -33,7 +33,10 @@ export { Features } from './renderer/features';
|
||||
export { Map } from './renderer/map';
|
||||
export { TileLayer } from './renderer/tile_layer';
|
||||
|
||||
import * as data from '../data/index.js';
|
||||
|
||||
export {
|
||||
data,
|
||||
actions,
|
||||
geo,
|
||||
behavior,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { areaKeys } from '../core/context';
|
||||
|
||||
export function Preset(id, preset, fields) {
|
||||
preset = _.clone(preset);
|
||||
|
||||
@@ -113,7 +115,7 @@ export function Preset(id, preset, fields) {
|
||||
var needsAreaTag = true;
|
||||
if (preset.geometry.indexOf('line') === -1) {
|
||||
for (k in applyTags) {
|
||||
if (k in iD.areaKeys) {
|
||||
if (k in areaKeys) {
|
||||
needsAreaTag = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Extent, polygonIntersectsPolygon } from '../geo/index';
|
||||
import { jsonpRequest } from '../util/jsonp_request';
|
||||
|
||||
export function BackgroundSource(data) {
|
||||
var source = _.clone(data),
|
||||
@@ -98,7 +99,7 @@ BackgroundSource.Bing = function(data, dispatch) {
|
||||
key + '&jsonp={callback}',
|
||||
providers = [];
|
||||
|
||||
d3.jsonp(url, function(json) {
|
||||
jsonpRequest(url, function(json) {
|
||||
providers = json.resourceSets[0].resources[0].imageryProviders.map(function(provider) {
|
||||
return {
|
||||
attribution: provider.attribution,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { jsonpRequest } from '../util/jsonp_request';
|
||||
import { qsString } from '../util/index';
|
||||
|
||||
var wikidata = {},
|
||||
@@ -8,7 +9,7 @@ export function init() {
|
||||
// corresponding Wikidata entities.
|
||||
wikidata.itemsByTitle = function(lang, title, callback) {
|
||||
lang = lang || 'en';
|
||||
d3.jsonp(endpoint + qsString({
|
||||
jsonpRequest(endpoint + qsString({
|
||||
action: 'wbgetentities',
|
||||
format: 'json',
|
||||
sites: lang.replace(/-/g, '_') + 'wiki',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { qsString } from '../util/index';
|
||||
import { jsonpRequest } from '../util/jsonp_request';
|
||||
|
||||
var wikipedia = {},
|
||||
endpoint = 'https://en.wikipedia.org/w/api.php?';
|
||||
@@ -6,7 +7,7 @@ var wikipedia = {},
|
||||
export function init() {
|
||||
wikipedia.search = function(lang, query, callback) {
|
||||
lang = lang || 'en';
|
||||
d3.jsonp(endpoint.replace('en', lang) +
|
||||
jsonpRequest(endpoint.replace('en', lang) +
|
||||
qsString({
|
||||
action: 'query',
|
||||
list: 'search',
|
||||
@@ -25,7 +26,7 @@ export function init() {
|
||||
|
||||
wikipedia.suggestions = function(lang, query, callback) {
|
||||
lang = lang || 'en';
|
||||
d3.jsonp(endpoint.replace('en', lang) +
|
||||
jsonpRequest(endpoint.replace('en', lang) +
|
||||
qsString({
|
||||
action: 'opensearch',
|
||||
namespace: 0,
|
||||
@@ -39,7 +40,7 @@ export function init() {
|
||||
};
|
||||
|
||||
wikipedia.translations = function(lang, title, callback) {
|
||||
d3.jsonp(endpoint.replace('en', lang) +
|
||||
jsonpRequest(endpoint.replace('en', lang) +
|
||||
qsString({
|
||||
action: 'query',
|
||||
prop: 'langlinks',
|
||||
|
||||
+11
-10
@@ -1,4 +1,5 @@
|
||||
import { t } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
import _ from 'lodash';
|
||||
import { metersToOffset, offsetToMeters } from '../geo/index';
|
||||
import { BackgroundSource } from '../renderer/index';
|
||||
@@ -54,7 +55,7 @@ export function Background(context) {
|
||||
selection.each(function(d) {
|
||||
var item = d3.select(this);
|
||||
if (d === previous) {
|
||||
item.call(bootstrap.tooltip()
|
||||
item.call(tooltip()
|
||||
.html(true)
|
||||
.title(function() {
|
||||
var tip = '<div>' + t('background.switch') + '</div>';
|
||||
@@ -63,12 +64,12 @@ export function Background(context) {
|
||||
.placement('top')
|
||||
);
|
||||
} else if (d.description) {
|
||||
item.call(bootstrap.tooltip()
|
||||
item.call(tooltip()
|
||||
.title(d.description)
|
||||
.placement('top')
|
||||
);
|
||||
} else {
|
||||
item.call(bootstrap.tooltip().destroy);
|
||||
item.call(tooltip().destroy);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -136,7 +137,7 @@ export function Background(context) {
|
||||
enter.filter(function(d) { return d.best(); })
|
||||
.append('div')
|
||||
.attr('class', 'best')
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.title(t('background.best_imagery'))
|
||||
.placement('left'))
|
||||
.append('span')
|
||||
@@ -272,7 +273,7 @@ export function Background(context) {
|
||||
|
||||
function toggle() {
|
||||
if (d3.event) d3.event.preventDefault();
|
||||
tooltip.hide(button);
|
||||
tooltipBehavior.hide(button);
|
||||
setVisible(!button.classed('active'));
|
||||
}
|
||||
|
||||
@@ -313,7 +314,7 @@ export function Background(context) {
|
||||
|
||||
var content = selection.append('div')
|
||||
.attr('class', 'fillL map-overlay col3 content hide'),
|
||||
tooltip = bootstrap.tooltip()
|
||||
tooltipBehavior = tooltip()
|
||||
.placement('left')
|
||||
.html(true)
|
||||
.title(tooltipHtml(t('background.description'), key)),
|
||||
@@ -321,7 +322,7 @@ export function Background(context) {
|
||||
.attr('tabindex', -1)
|
||||
.on('click', toggle)
|
||||
.call(Icon('#icon-layers', 'light'))
|
||||
.call(tooltip),
|
||||
.call(tooltipBehavior),
|
||||
shown = false;
|
||||
|
||||
|
||||
@@ -345,7 +346,7 @@ export function Background(context) {
|
||||
})
|
||||
.on('click.set-opacity', setOpacity)
|
||||
.html('<div class="select-box"></div>')
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.placement('left'))
|
||||
.append('div')
|
||||
.attr('class', 'opacity')
|
||||
@@ -363,7 +364,7 @@ export function Background(context) {
|
||||
|
||||
custom.append('button')
|
||||
.attr('class', 'layer-browse')
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.title(t('background.custom_button'))
|
||||
.placement('left'))
|
||||
.on('click', editCustom)
|
||||
@@ -406,7 +407,7 @@ export function Background(context) {
|
||||
|
||||
var minimapLabel = controls
|
||||
.append('label')
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.html(true)
|
||||
.title(tooltipHtml(t('background.minimap.tooltip'), '/'))
|
||||
.placement('top')
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { t } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
import _ from 'lodash';
|
||||
import { displayName, entityOrMemberSelector } from '../util/index';
|
||||
import { Icon } from '../svg/index';
|
||||
@@ -137,7 +138,7 @@ export function Commit(context) {
|
||||
});
|
||||
|
||||
warningLi.filter(function(d) { return d.tooltip; })
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.title(function(d) { return d.tooltip; })
|
||||
.placement('top')
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { t } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
import _ from 'lodash';
|
||||
import { Browse } from '../modes/index';
|
||||
import { ChangeTags } from '../actions/index';
|
||||
@@ -69,7 +70,7 @@ export function EntityEditor(context) {
|
||||
.attr('class', 'preset-list-button-wrap')
|
||||
.append('button')
|
||||
.attr('class', 'preset-list-button preset-reset')
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.title(t('inspector.back_tooltip'))
|
||||
.placement('bottom'))
|
||||
.append('div')
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { t } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
import _ from 'lodash';
|
||||
import { tooltipHtml } from './tooltipHtml';
|
||||
export function FeatureInfo(context) {
|
||||
@@ -16,7 +17,7 @@ export function FeatureInfo(context) {
|
||||
selection.html('');
|
||||
|
||||
if (hiddenList.length) {
|
||||
var tooltip = bootstrap.tooltip()
|
||||
var tooltipBehavior = tooltip()
|
||||
.placement('top')
|
||||
.html(true)
|
||||
.title(function() {
|
||||
@@ -27,9 +28,9 @@ export function FeatureInfo(context) {
|
||||
.attr('href', '#')
|
||||
.attr('tabindex', -1)
|
||||
.html(t('feature_info.hidden_warning', { count: count }))
|
||||
.call(tooltip)
|
||||
.call(tooltipBehavior)
|
||||
.on('click', function() {
|
||||
tooltip.hide(warning);
|
||||
tooltipBehavior.hide(warning);
|
||||
// open map data panel?
|
||||
d3.event.preventDefault();
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { t } from '../../util/locale';
|
||||
import { tooltip } from '../../util/tooltip';
|
||||
import _ from 'lodash';
|
||||
import { Detect } from '../../util/detect';
|
||||
import { Icon } from '../../svg/index';
|
||||
@@ -40,7 +41,7 @@ export function localized(field, context) {
|
||||
.attr('class', 'button-input-action localized-add minor')
|
||||
.attr('tabindex', -1)
|
||||
.call(Icon('#icon-plus'))
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.title(t('translate.translate'))
|
||||
.placement('left'));
|
||||
|
||||
|
||||
@@ -53,9 +53,6 @@ export function FullScreen(context) {
|
||||
if (!isSupported())
|
||||
return;
|
||||
|
||||
// var tooltip = bootstrap.tooltip()
|
||||
// .placement('left');
|
||||
|
||||
// button = selection.append('button')
|
||||
// .attr('title', t('full_screen'))
|
||||
// .attr('tabindex', -1)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { t } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
import { Browse } from '../modes/index';
|
||||
import { Extent } from '../geo/index';
|
||||
import { Icon } from '../svg/index';
|
||||
@@ -46,7 +47,7 @@ export function Geolocate(context) {
|
||||
.attr('title', t('geolocate.title'))
|
||||
.on('click', click)
|
||||
.call(Icon('#icon-geolocate', 'light'))
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.placement('left'));
|
||||
};
|
||||
}
|
||||
|
||||
+5
-4
@@ -1,6 +1,7 @@
|
||||
import { t } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
import { Icon } from '../svg/index';
|
||||
import { intro } from './intro';
|
||||
import { intro } from './intro/index';
|
||||
import marked from 'marked';
|
||||
import { tooltipHtml } from './tooltipHtml';
|
||||
|
||||
@@ -34,7 +35,7 @@ export function Help(context) {
|
||||
|
||||
function toggle() {
|
||||
if (d3.event) d3.event.preventDefault();
|
||||
tooltip.hide(button);
|
||||
tooltipBehavior.hide(button);
|
||||
setVisible(!button.classed('active'));
|
||||
}
|
||||
|
||||
@@ -103,7 +104,7 @@ export function Help(context) {
|
||||
|
||||
var pane = selection.append('div')
|
||||
.attr('class', 'help-wrap map-overlay fillL col5 content hide'),
|
||||
tooltip = bootstrap.tooltip()
|
||||
tooltipBehavior = tooltip()
|
||||
.placement('left')
|
||||
.html(true)
|
||||
.title(tooltipHtml(t('help.title'), key)),
|
||||
@@ -111,7 +112,7 @@ export function Help(context) {
|
||||
.attr('tabindex', -1)
|
||||
.on('click', toggle)
|
||||
.call(Icon('#icon-help', 'light'))
|
||||
.call(tooltip),
|
||||
.call(tooltipBehavior),
|
||||
shown = false;
|
||||
|
||||
|
||||
|
||||
+3
-2
@@ -1,4 +1,5 @@
|
||||
import { t } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
import { Defs, Icon } from '../svg/index';
|
||||
import { Account } from './account';
|
||||
import { Attribution } from './attribution';
|
||||
@@ -158,7 +159,7 @@ export function init(context) {
|
||||
.attr('tabindex', -1)
|
||||
.attr('href', 'https://github.com/openstreetmap/iD/issues')
|
||||
.call(Icon('#icon-bug', 'light'))
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.title(t('report_a_bug'))
|
||||
.placement('top')
|
||||
);
|
||||
@@ -168,7 +169,7 @@ export function init(context) {
|
||||
.attr('tabindex', -1)
|
||||
.attr('href', 'https://github.com/openstreetmap/iD/blob/master/CONTRIBUTING.md#translating')
|
||||
.call(Icon('#icon-translate', 'light'))
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.title(t('help_translate'))
|
||||
.placement('top')
|
||||
);
|
||||
|
||||
+60
-56
@@ -6,6 +6,7 @@ import { line } from './line';
|
||||
import { navigation } from './navigation';
|
||||
import { point } from './point';
|
||||
import { startEditing } from './start_editing';
|
||||
import { default as introGraphRaw } from '../../../data/intro_graph.json';
|
||||
|
||||
var sampleIntros = {
|
||||
area: area,
|
||||
@@ -15,57 +16,69 @@ var sampleIntros = {
|
||||
startEditing: startEditing
|
||||
};
|
||||
|
||||
|
||||
export function intro(context) {
|
||||
var step;
|
||||
|
||||
function localizedName(id) {
|
||||
var features = {
|
||||
n2140018997: 'city_hall',
|
||||
n367813436: 'fire_department',
|
||||
w203988286: 'memory_isle_park',
|
||||
w203972937: 'riverwalk_trail',
|
||||
w203972938: 'riverwalk_trail',
|
||||
w203972940: 'riverwalk_trail',
|
||||
w41785752: 'w_michigan_ave',
|
||||
w134150789: 'w_michigan_ave',
|
||||
w134150795: 'w_michigan_ave',
|
||||
w134150800: 'w_michigan_ave',
|
||||
w134150811: 'w_michigan_ave',
|
||||
w134150802: 'e_michigan_ave',
|
||||
w134150836: 'e_michigan_ave',
|
||||
w41074896: 'e_michigan_ave',
|
||||
w17965834: 'spring_st',
|
||||
w203986457: 'scidmore_park',
|
||||
w203049587: 'petting_zoo',
|
||||
w17967397: 'n_andrews_st',
|
||||
w17967315: 's_andrews_st',
|
||||
w17967326: 'n_constantine_st',
|
||||
w17966400: 's_constantine_st',
|
||||
w170848823: 'rocky_river',
|
||||
w170848824: 'rocky_river',
|
||||
w170848331: 'rocky_river',
|
||||
w17967752: 'railroad_dr',
|
||||
w17965998: 'conrail_rr',
|
||||
w134150845: 'conrail_rr',
|
||||
w170989131: 'st_joseph_river',
|
||||
w143497377: 'n_main_st',
|
||||
w134150801: 's_main_st',
|
||||
w134150830: 's_main_st',
|
||||
w17966462: 's_main_st',
|
||||
w17967734: 'water_st',
|
||||
w17964996: 'foster_st',
|
||||
w170848330: 'portage_river',
|
||||
w17965351: 'flower_st',
|
||||
w17965502: 'elm_st',
|
||||
w17965402: 'walnut_st',
|
||||
w17964793: 'morris_ave',
|
||||
w17967444: 'east_st',
|
||||
w17966984: 'portage_ave'
|
||||
};
|
||||
return features[id] && t('intro.graph.' + features[id]);
|
||||
}
|
||||
|
||||
var introGraph = {};
|
||||
|
||||
for (var key in introGraphRaw) {
|
||||
introGraph[key] = Entity(introGraphRaw[key]);
|
||||
var name = localizedName(key);
|
||||
if (name) {
|
||||
introGraph[key].tags.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
function intro(selection) {
|
||||
|
||||
function localizedName(id) {
|
||||
var features = {
|
||||
n2140018997: 'city_hall',
|
||||
n367813436: 'fire_department',
|
||||
w203988286: 'memory_isle_park',
|
||||
w203972937: 'riverwalk_trail',
|
||||
w203972938: 'riverwalk_trail',
|
||||
w203972940: 'riverwalk_trail',
|
||||
w41785752: 'w_michigan_ave',
|
||||
w134150789: 'w_michigan_ave',
|
||||
w134150795: 'w_michigan_ave',
|
||||
w134150800: 'w_michigan_ave',
|
||||
w134150811: 'w_michigan_ave',
|
||||
w134150802: 'e_michigan_ave',
|
||||
w134150836: 'e_michigan_ave',
|
||||
w41074896: 'e_michigan_ave',
|
||||
w17965834: 'spring_st',
|
||||
w203986457: 'scidmore_park',
|
||||
w203049587: 'petting_zoo',
|
||||
w17967397: 'n_andrews_st',
|
||||
w17967315: 's_andrews_st',
|
||||
w17967326: 'n_constantine_st',
|
||||
w17966400: 's_constantine_st',
|
||||
w170848823: 'rocky_river',
|
||||
w170848824: 'rocky_river',
|
||||
w170848331: 'rocky_river',
|
||||
w17967752: 'railroad_dr',
|
||||
w17965998: 'conrail_rr',
|
||||
w134150845: 'conrail_rr',
|
||||
w170989131: 'st_joseph_river',
|
||||
w143497377: 'n_main_st',
|
||||
w134150801: 's_main_st',
|
||||
w134150830: 's_main_st',
|
||||
w17966462: 's_main_st',
|
||||
w17967734: 'water_st',
|
||||
w17964996: 'foster_st',
|
||||
w170848330: 'portage_river',
|
||||
w17965351: 'flower_st',
|
||||
w17965502: 'elm_st',
|
||||
w17965402: 'walnut_st',
|
||||
w17964793: 'morris_ave',
|
||||
w17967444: 'east_st',
|
||||
w17966984: 'portage_ave'
|
||||
};
|
||||
return features[id] && t('intro.graph.' + features[id]);
|
||||
}
|
||||
|
||||
context.enter(Browse(context));
|
||||
|
||||
@@ -77,8 +90,7 @@ export function intro(context) {
|
||||
background = context.background().baseLayerSource(),
|
||||
opacity = d3.selectAll('#map .layer-background').style('opacity'),
|
||||
loadedTiles = context.connection().loadedTiles(),
|
||||
baseEntities = context.history().graph().base().entities,
|
||||
introGraph, name;
|
||||
baseEntities = context.history().graph().base().entities;
|
||||
|
||||
// Block saving
|
||||
context.inIntro(true);
|
||||
@@ -87,14 +99,6 @@ export function intro(context) {
|
||||
context.connection().toggle(false).flush();
|
||||
context.history().reset();
|
||||
|
||||
introGraph = JSON.parse(iD.introGraph);
|
||||
for (var key in introGraph) {
|
||||
introGraph[key] = Entity(introGraph[key]);
|
||||
name = localizedName(key);
|
||||
if (name) {
|
||||
introGraph[key].tags.name = name;
|
||||
}
|
||||
}
|
||||
context.history().merge(d3.values(Graph().load(introGraph).entities));
|
||||
context.background().bing();
|
||||
|
||||
|
||||
+10
-9
@@ -1,4 +1,5 @@
|
||||
import { t } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
import { Icon } from '../svg/index';
|
||||
import { tooltipHtml } from './tooltipHtml';
|
||||
import _ from 'lodash';
|
||||
@@ -107,7 +108,7 @@ export function MapData(context) {
|
||||
.attr('class', 'list-item-mapillary-images');
|
||||
|
||||
var labelImages = enterImages.append('label')
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.title(t('mapillary_images.tooltip'))
|
||||
.placement('top'));
|
||||
|
||||
@@ -128,7 +129,7 @@ export function MapData(context) {
|
||||
.attr('class', 'list-item-mapillary-signs');
|
||||
|
||||
var labelSigns = enterSigns.append('label')
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.title(t('mapillary_signs.tooltip'))
|
||||
.placement('top'));
|
||||
|
||||
@@ -181,7 +182,7 @@ export function MapData(context) {
|
||||
|
||||
enter.append('button')
|
||||
.attr('class', 'list-item-gpx-extent')
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.title(t('gpx.zoom'))
|
||||
.placement('left'))
|
||||
.on('click', function() {
|
||||
@@ -193,7 +194,7 @@ export function MapData(context) {
|
||||
|
||||
enter.append('button')
|
||||
.attr('class', 'list-item-gpx-browse')
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.title(t('gpx.browse'))
|
||||
.placement('left'))
|
||||
.on('click', function() {
|
||||
@@ -207,7 +208,7 @@ export function MapData(context) {
|
||||
.call(Icon('#icon-geolocate'));
|
||||
|
||||
var labelGpx = enter.append('label')
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.title(t('gpx.drag_drop'))
|
||||
.placement('top'));
|
||||
|
||||
@@ -243,7 +244,7 @@ export function MapData(context) {
|
||||
var enter = items.enter()
|
||||
.append('li')
|
||||
.attr('class', 'layer')
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.html(true)
|
||||
.title(function(d) {
|
||||
var tip = t(name + '.' + d + '.tooltip'),
|
||||
@@ -297,7 +298,7 @@ export function MapData(context) {
|
||||
|
||||
function togglePanel() {
|
||||
if (d3.event) d3.event.preventDefault();
|
||||
tooltip.hide(button);
|
||||
tooltipBehavior.hide(button);
|
||||
setVisible(!button.classed('active'));
|
||||
}
|
||||
|
||||
@@ -342,7 +343,7 @@ export function MapData(context) {
|
||||
|
||||
var content = selection.append('div')
|
||||
.attr('class', 'fillL map-overlay col3 content hide'),
|
||||
tooltip = bootstrap.tooltip()
|
||||
tooltipBehavior = tooltip()
|
||||
.placement('left')
|
||||
.html(true)
|
||||
.title(tooltipHtml(t('map_data.description'), key)),
|
||||
@@ -350,7 +351,7 @@ export function MapData(context) {
|
||||
.attr('tabindex', -1)
|
||||
.on('click', togglePanel)
|
||||
.call(Icon('#icon-data', 'light'))
|
||||
.call(tooltip),
|
||||
.call(tooltipBehavior),
|
||||
shown = false;
|
||||
|
||||
content.append('h4')
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import _ from 'lodash';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
import { AddArea, AddLine, AddPoint, Browse } from '../modes/index';
|
||||
import { Icon } from '../svg/index';
|
||||
import { tooltipHtml } from './tooltipHtml';
|
||||
@@ -27,7 +28,7 @@ export function Modes(context) {
|
||||
context.enter(mode);
|
||||
}
|
||||
})
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.placement('bottom')
|
||||
.html(true)
|
||||
.title(function(mode) {
|
||||
|
||||
+5
-4
@@ -1,4 +1,5 @@
|
||||
import { t } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
import { Save as SaveMode } from '../modes/index';
|
||||
import { cmd } from './cmd';
|
||||
import { tooltipHtml } from './tooltipHtml';
|
||||
@@ -33,7 +34,7 @@ export function Save(context) {
|
||||
}
|
||||
|
||||
return function(selection) {
|
||||
var tooltip = bootstrap.tooltip()
|
||||
var tooltipBehavior = tooltip()
|
||||
.placement('bottom')
|
||||
.html(true)
|
||||
.title(tooltipHtml(t('save.no_changes'), key));
|
||||
@@ -42,7 +43,7 @@ export function Save(context) {
|
||||
.attr('class', 'save col12 disabled')
|
||||
.attr('tabindex', -1)
|
||||
.on('click', save)
|
||||
.call(tooltip);
|
||||
.call(tooltipBehavior);
|
||||
|
||||
button.append('span')
|
||||
.attr('class', 'label')
|
||||
@@ -66,7 +67,7 @@ export function Save(context) {
|
||||
return;
|
||||
numChanges = _;
|
||||
|
||||
tooltip.title(tooltipHtml(t(numChanges > 0 ?
|
||||
tooltipBehavior.title(tooltipHtml(t(numChanges > 0 ?
|
||||
'save.help' : 'save.no_changes'), key));
|
||||
|
||||
var background = getBackground(numChanges);
|
||||
@@ -84,7 +85,7 @@ export function Save(context) {
|
||||
|
||||
context.on('enter.save', function() {
|
||||
button.property('disabled', saving());
|
||||
if (saving()) button.call(tooltip.hide);
|
||||
if (saving()) button.call(tooltipBehavior.hide);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { t } from '../util/locale';
|
||||
import { intro } from './intro';
|
||||
import { intro } from './intro/index';
|
||||
import { modal } from './modal';
|
||||
|
||||
export function Splash(context) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { t } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
import { Icon } from '../svg/index';
|
||||
export function Success(context) {
|
||||
var dispatch = d3.dispatch('cancel'),
|
||||
@@ -55,7 +56,7 @@ export function Success(context) {
|
||||
.attr('class', 'button social col4')
|
||||
.attr('target', '_blank')
|
||||
.attr('href', function(d) { return d.value; })
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.title(function(d) { return t('success.' + d.key); })
|
||||
.placement('bottom'))
|
||||
.each(function(d) { d3.select(this).call(Icon('#logo-' + d.key, 'social')); });
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { t } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
import { Icon } from '../svg/index';
|
||||
import { cmd } from './cmd';
|
||||
import { tooltipHtml } from './tooltipHtml';
|
||||
@@ -21,7 +22,7 @@ export function UndoRedo(context) {
|
||||
}
|
||||
|
||||
return function(selection) {
|
||||
var tooltip = bootstrap.tooltip()
|
||||
var tooltipBehavior = tooltip()
|
||||
.placement('bottom')
|
||||
.html(true)
|
||||
.title(function (d) {
|
||||
@@ -35,7 +36,7 @@ export function UndoRedo(context) {
|
||||
.enter().append('button')
|
||||
.attr('class', 'col6 disabled')
|
||||
.on('click', function(d) { return d.action(); })
|
||||
.call(tooltip);
|
||||
.call(tooltipBehavior);
|
||||
|
||||
buttons.each(function(d) {
|
||||
d3.select(this)
|
||||
@@ -62,7 +63,7 @@ export function UndoRedo(context) {
|
||||
.each(function() {
|
||||
var selection = d3.select(this);
|
||||
if (selection.property('tooltipVisible')) {
|
||||
selection.call(tooltip.show);
|
||||
selection.call(tooltipBehavior.show);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import { t } from '../util/locale';
|
||||
import { tooltip } from '../util/tooltip';
|
||||
import { Icon } from '../svg/index';
|
||||
import { cmd } from './cmd';
|
||||
import { tooltipHtml } from './tooltipHtml';
|
||||
@@ -47,7 +48,7 @@ export function Zoom(context) {
|
||||
.attr('tabindex', -1)
|
||||
.attr('class', function(d) { return d.id; })
|
||||
.on('click.editor', function(d) { d.action(); })
|
||||
.call(bootstrap.tooltip()
|
||||
.call(tooltip()
|
||||
.placement('left')
|
||||
.html(true)
|
||||
.title(function(d) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { currentLocale } from './locale';
|
||||
|
||||
export function Detect() {
|
||||
var detected = {};
|
||||
|
||||
@@ -55,9 +57,9 @@ export function Detect() {
|
||||
detected.locale = (navigator.languages && navigator.languages.length)
|
||||
? navigator.languages[0] : (navigator.language || navigator.userLanguage || 'en-US');
|
||||
|
||||
// Loaded locale is stored in window.locale.current()
|
||||
// Loaded locale is stored in currentLocale
|
||||
// return that instead (except in the situation where 'en' might override 'en-US')
|
||||
var loadedLocale = (window.locale && window.locale.current()) || 'en';
|
||||
var loadedLocale = currentLocale || 'en';
|
||||
if (loadedLocale !== 'en') {
|
||||
detected.locale = loadedLocale;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,19 @@
|
||||
d3.jsonp = function (url, callback) {
|
||||
var jsonpCache = {};
|
||||
window.jsonpCache = jsonpCache;
|
||||
|
||||
export function jsonpRequest(url, callback) {
|
||||
|
||||
if (window.JSONP_FIX) {
|
||||
if (window.JSONP_DELAY === 0) {
|
||||
callback(window.JSONP_FIX);
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
callback(window.JSONP_FIX);
|
||||
}, window.JSONP_DELAY || 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
function rand() {
|
||||
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
|
||||
c = '', i = -1;
|
||||
@@ -7,14 +22,14 @@ d3.jsonp = function (url, callback) {
|
||||
}
|
||||
|
||||
function create(url) {
|
||||
var e = url.match(/callback=d3.jsonp.(\w+)/),
|
||||
var e = url.match(/callback=(\w+)/),
|
||||
c = e ? e[1] : rand();
|
||||
d3.jsonp[c] = function(data) {
|
||||
jsonpCache[c] = function(data) {
|
||||
callback(data);
|
||||
delete d3.jsonp[c];
|
||||
delete jsonpCache[c];
|
||||
script.remove();
|
||||
};
|
||||
return 'd3.jsonp.' + c;
|
||||
return 'jsonpCache.' + c;
|
||||
}
|
||||
|
||||
var cb = create(url),
|
||||
@@ -22,4 +37,4 @@ d3.jsonp = function (url, callback) {
|
||||
.append('script')
|
||||
.attr('type', 'text/javascript')
|
||||
.attr('src', url.replace(/(\{|%7B)callback(\}|%7D)/, cb));
|
||||
};
|
||||
}
|
||||
+24
-11
@@ -1,18 +1,31 @@
|
||||
var locale = { _current: 'en' };
|
||||
window.locale = locale;
|
||||
var translations = Object.create(null);
|
||||
|
||||
locale.current = function(_) {
|
||||
if (!arguments.length) return locale._current;
|
||||
if (locale[_] !== undefined) locale._current = _;
|
||||
else if (locale[_.split('-')[0]]) locale._current = _.split('-')[0];
|
||||
return locale;
|
||||
};
|
||||
export var currentLocale = 'en';
|
||||
|
||||
export function setLocale(_) {
|
||||
if (translations[_] !== undefined) {
|
||||
currentLocale = _;
|
||||
} else if (translations[_.split('-')[0]]) {
|
||||
currentLocale = _.split('-')[0];
|
||||
}
|
||||
}
|
||||
|
||||
export function addTranslation(id, value) {
|
||||
translations[id] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a string identifier, try to find that string in the current
|
||||
* language, and return it.
|
||||
*
|
||||
* @param {string} s string identifier
|
||||
* @returns {string?} locale string
|
||||
*/
|
||||
export function t(s, o, loc) {
|
||||
loc = loc || locale._current;
|
||||
loc = loc || currentLocale;
|
||||
|
||||
var path = s.split('.').reverse(),
|
||||
rep = locale[loc];
|
||||
var path = s.split('.').reverse();
|
||||
var rep = translations[loc];
|
||||
|
||||
while (rep !== undefined && path.length) rep = rep[path.pop()];
|
||||
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
export function tooltip() {
|
||||
|
||||
var tooltip = function(selection) {
|
||||
selection.each(setup);
|
||||
},
|
||||
animation = d3.functor(false),
|
||||
html = d3.functor(false),
|
||||
title = function() {
|
||||
var title = this.getAttribute('data-original-title');
|
||||
if (title) {
|
||||
return title;
|
||||
} else {
|
||||
title = this.getAttribute('title');
|
||||
this.removeAttribute('title');
|
||||
this.setAttribute('data-original-title', title);
|
||||
}
|
||||
return title;
|
||||
},
|
||||
over = 'mouseenter.tooltip',
|
||||
out = 'mouseleave.tooltip',
|
||||
placement = d3.functor('top');
|
||||
|
||||
tooltip.title = function(_) {
|
||||
if (arguments.length) {
|
||||
title = d3.functor(_);
|
||||
return tooltip;
|
||||
} else {
|
||||
return title;
|
||||
}
|
||||
};
|
||||
|
||||
tooltip.html = function(_) {
|
||||
if (arguments.length) {
|
||||
html = d3.functor(_);
|
||||
return tooltip;
|
||||
} else {
|
||||
return html;
|
||||
}
|
||||
};
|
||||
|
||||
tooltip.placement = function(_) {
|
||||
if (arguments.length) {
|
||||
placement = d3.functor(_);
|
||||
return tooltip;
|
||||
} else {
|
||||
return placement;
|
||||
}
|
||||
};
|
||||
|
||||
tooltip.show = function(selection) {
|
||||
selection.each(show);
|
||||
};
|
||||
|
||||
tooltip.hide = function(selection) {
|
||||
selection.each(hide);
|
||||
};
|
||||
|
||||
tooltip.toggle = function(selection) {
|
||||
selection.each(toggle);
|
||||
};
|
||||
|
||||
tooltip.destroy = function(selection) {
|
||||
selection
|
||||
.on(over, null)
|
||||
.on(out, null)
|
||||
.attr('title', function() {
|
||||
return this.getAttribute('data-original-title') || this.getAttribute('title');
|
||||
})
|
||||
.attr('data-original-title', null)
|
||||
.select('.tooltip')
|
||||
.remove();
|
||||
};
|
||||
|
||||
function setup() {
|
||||
var root = d3.select(this),
|
||||
animate = animation.apply(this, arguments),
|
||||
tip = root.append('div')
|
||||
.attr('class', 'tooltip');
|
||||
|
||||
if (animate) {
|
||||
tip.classed('fade', true);
|
||||
}
|
||||
|
||||
tip.append('div')
|
||||
.attr('class', 'tooltip-arrow');
|
||||
tip.append('div')
|
||||
.attr('class', 'tooltip-inner');
|
||||
|
||||
var place = placement.apply(this, arguments);
|
||||
tip.classed(place, true);
|
||||
|
||||
root.on(over, show);
|
||||
root.on(out, hide);
|
||||
}
|
||||
|
||||
function show() {
|
||||
var root = d3.select(this),
|
||||
content = title.apply(this, arguments),
|
||||
tip = root.select('.tooltip')
|
||||
.classed('in', true),
|
||||
markup = html.apply(this, arguments);
|
||||
tip.select('.tooltip-inner')[markup ? 'html' : 'text'](content);
|
||||
var place = placement.apply(this, arguments),
|
||||
outer = getPosition(root.node()),
|
||||
inner = getPosition(tip.node()),
|
||||
pos;
|
||||
|
||||
switch (place) {
|
||||
case 'top':
|
||||
pos = {x: outer.x + (outer.w - inner.w) / 2, y: outer.y - inner.h};
|
||||
break;
|
||||
case 'right':
|
||||
pos = {x: outer.x + outer.w, y: outer.y + (outer.h - inner.h) / 2};
|
||||
break;
|
||||
case 'left':
|
||||
pos = {x: outer.x - inner.w, y: outer.y + (outer.h - inner.h) / 2};
|
||||
break;
|
||||
case 'bottom':
|
||||
pos = {x: Math.max(0, outer.x + (outer.w - inner.w) / 2), y: outer.y + outer.h};
|
||||
break;
|
||||
}
|
||||
|
||||
tip.style(pos ?
|
||||
{left: ~~pos.x + 'px', top: ~~pos.y + 'px'} :
|
||||
{left: null, top: null});
|
||||
|
||||
this.tooltipVisible = true;
|
||||
}
|
||||
|
||||
function hide() {
|
||||
d3.select(this).select('.tooltip')
|
||||
.classed('in', false);
|
||||
|
||||
this.tooltipVisible = false;
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
if (this.tooltipVisible) {
|
||||
hide.apply(this, arguments);
|
||||
} else {
|
||||
show.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
function getPosition(node) {
|
||||
var mode = d3.select(node).style('position');
|
||||
if (mode === 'absolute' || mode === 'static') {
|
||||
return {
|
||||
x: node.offsetLeft,
|
||||
y: node.offsetTop,
|
||||
w: node.offsetWidth,
|
||||
h: node.offsetHeight
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
x: 0,
|
||||
y: 0,
|
||||
w: node.offsetWidth,
|
||||
h: node.offsetHeight
|
||||
};
|
||||
}
|
||||
}
|
||||
+5
-3
@@ -8,8 +8,8 @@
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "npm run lint && phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html dot && make && phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index_packaged.html dot",
|
||||
"start": "http-server .",
|
||||
"test": "npm run lint && make && phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html dot",
|
||||
"start": "rollup --config=./rollup.config.js -w --input ./modules/id.js --output dist/iD.js",
|
||||
"lint": "eslint js/id test/spec modules"
|
||||
},
|
||||
"repository": {
|
||||
@@ -28,16 +28,17 @@
|
||||
"osm-auth": "0.2.9",
|
||||
"rbush": "2.0.1",
|
||||
"sexagesimal": "0.5.0",
|
||||
"wmf-sitematrix": "0.1.2",
|
||||
"togeojson": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "~3.5.0",
|
||||
"brfs": "1.4.3",
|
||||
"d3": "3.5.5",
|
||||
"editor-layer-index": "git://github.com/osmlab/editor-layer-index.git#gh-pages",
|
||||
"eslint": "~3.2.0",
|
||||
"glob": "~7.0.5",
|
||||
"happen": "~0.3.1",
|
||||
"http-server": "~0.9.0",
|
||||
"js-yaml": "~3.6.1",
|
||||
"jsonschema": "~1.1.0",
|
||||
"maki": "0.5.0",
|
||||
@@ -52,6 +53,7 @@
|
||||
"rollup-plugin-node-resolve": "2.0.0",
|
||||
"sinon": "~1.17.5",
|
||||
"sinon-chai": "~2.8.0",
|
||||
"rollup-plugin-json": "2.0.1",
|
||||
"smash": "0.0",
|
||||
"svg-sprite": "1.3.3",
|
||||
"uglify-js": "~2.7.0",
|
||||
|
||||
+3
-1
@@ -1,9 +1,11 @@
|
||||
import nodeResolve from 'rollup-plugin-node-resolve';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import json from 'rollup-plugin-json';
|
||||
|
||||
export default {
|
||||
plugins: [
|
||||
nodeResolve({ jsnext: true, main: true, browser: true }),
|
||||
commonjs()
|
||||
commonjs(),
|
||||
json()
|
||||
]
|
||||
};
|
||||
|
||||
+2
-16
@@ -24,19 +24,7 @@
|
||||
|
||||
<!-- include source files here... -->
|
||||
<script src='../js/lib/d3.v3.js'></script>
|
||||
<script src='../js/lib/d3.combobox.js'></script>
|
||||
<script src='../js/lib/d3.geo.tile.js'></script>
|
||||
<script src='../js/lib/d3.dimensions.js'></script>
|
||||
<script src='../js/lib/d3.trigger.js'></script>
|
||||
<script src='../js/lib/d3.jsonp.js'></script>
|
||||
<script src='../js/lib/d3.keybinding.js'></script>
|
||||
<script src='../js/lib/d3.one.js'></script>
|
||||
<script src='../js/lib/d3.value.js'></script>
|
||||
<script src='../js/lib/d3-compat.js'></script>
|
||||
<script src='../js/lib/bootstrap-tooltip.js'></script>
|
||||
|
||||
<script src='../js/lib/id/index.js'></script>
|
||||
<script src='../data/data_dev.js'></script>
|
||||
<script src='../dist/iD.js'></script>
|
||||
|
||||
<script src='spec/spec_helpers.js'></script>
|
||||
|
||||
@@ -140,9 +128,7 @@
|
||||
<script src='spec/util/util.js'></script>
|
||||
|
||||
<script>
|
||||
iD.data.load('../', function() {
|
||||
window.mocha.run();
|
||||
});
|
||||
window.mocha.run();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<title>Mocha Tests</title>
|
||||
<link rel='stylesheet' href='../node_modules/mocha/mocha.css'>
|
||||
<link rel='stylesheet' href='css/map.css'>
|
||||
</head>
|
||||
<body>
|
||||
<div id='mocha'></div>
|
||||
|
||||
<script src='../node_modules/mocha/mocha.js'></script>
|
||||
<script src='../node_modules/chai/chai.js'></script>
|
||||
<script src='../node_modules/sinon/pkg/sinon.js'></script>
|
||||
<script src='../node_modules/sinon-chai/lib/sinon-chai.js'></script>
|
||||
<script src='../node_modules/happen/happen.js'></script>
|
||||
|
||||
<script>
|
||||
if (typeof initMochaPhantomJS === 'function') {
|
||||
initMochaPhantomJS()
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- include source files here... -->
|
||||
<script src='../dist/iD.js'></script>
|
||||
<script src='../dist/presets.js'></script>
|
||||
<script src='../dist/imagery.js'></script>
|
||||
|
||||
<script src='spec/spec_helpers.js'></script>
|
||||
|
||||
<!-- include spec files below... -->
|
||||
<script src='spec/id.js'></script>
|
||||
|
||||
<script src='spec/actions/add_entity.js'></script>
|
||||
<script src='spec/actions/add_member.js'></script>
|
||||
<script src='spec/actions/add_midpoint.js'></script>
|
||||
<script src='spec/actions/change_member.js'></script>
|
||||
<script src='spec/actions/change_preset.js'></script>
|
||||
<script src='spec/actions/change_tags.js'></script>
|
||||
<script src='spec/actions/circularize.js'></script>
|
||||
<script src='spec/actions/connect.js'></script>
|
||||
<script src='spec/actions/copy_entities.js'></script>
|
||||
<script src='spec/actions/delete_member.js'></script>
|
||||
<script src='spec/actions/delete_multiple.js'></script>
|
||||
<script src='spec/actions/delete_node.js'></script>
|
||||
<script src='spec/actions/delete_relation.js'></script>
|
||||
<script src='spec/actions/delete_way.js'></script>
|
||||
<script src='spec/actions/discard_tags.js'></script>
|
||||
<script src='spec/actions/disconnect.js'></script>
|
||||
<script src='spec/actions/join.js'></script>
|
||||
<script src='spec/actions/merge.js'></script>
|
||||
<script src='spec/actions/merge_polygon.js'></script>
|
||||
<script src='spec/actions/merge_remote_changes.js'></script>
|
||||
<script src='spec/actions/move.js'></script>
|
||||
<script src='spec/actions/move_node.js'></script>
|
||||
<script src='spec/actions/noop.js'></script>
|
||||
<script src='spec/actions/orthogonalize.js'></script>
|
||||
<script src='spec/actions/restrict_turn.js'></script>
|
||||
<script src='spec/actions/reverse.js'></script>
|
||||
<script src='spec/actions/revert.js'></script>
|
||||
<script src='spec/actions/split.js'></script>
|
||||
<script src='spec/actions/straighten.js'></script>
|
||||
<script src='spec/actions/unrestrict_turn.js'></script>
|
||||
|
||||
<script src='spec/behavior/hash.js'></script>
|
||||
<script src='spec/behavior/hover.js'></script>
|
||||
<script src='spec/behavior/select.js'></script>
|
||||
<script src='spec/behavior/lasso.js'></script>
|
||||
|
||||
<script src='spec/core/connection.js'></script>
|
||||
<script src='spec/core/difference.js'></script>
|
||||
<script src='spec/core/entity.js'></script>
|
||||
<script src='spec/core/graph.js'></script>
|
||||
<script src='spec/core/history.js'></script>
|
||||
<script src='spec/core/node.js'></script>
|
||||
<script src='spec/core/relation.js'></script>
|
||||
<script src='spec/core/tree.js'></script>
|
||||
<script src='spec/core/way.js'></script>
|
||||
|
||||
<script src='spec/geo/extent.js'></script>
|
||||
<script src='spec/geo/geo.js'></script>
|
||||
<script src='spec/geo/intersection.js'></script>
|
||||
<script src='spec/geo/multipolygon.js'></script>
|
||||
|
||||
<script src='spec/lib/d3.combobox.js'></script>
|
||||
<script src='spec/lib/d3.keybinding.js'></script>
|
||||
<!-- <script src='spec/lib/diff3.js'></script> -->
|
||||
<script src='spec/lib/locale.js'></script>
|
||||
|
||||
<script src='spec/modes/add_point.js'></script>
|
||||
|
||||
<script src='spec/presets/category.js'></script>
|
||||
<script src='spec/presets/collection.js'></script>
|
||||
<script src='spec/presets/preset.js'></script>
|
||||
<script src='spec/presets/presets.js'></script>
|
||||
|
||||
<script src='spec/renderer/background_source.js'></script>
|
||||
<script src='spec/renderer/features.js'></script>
|
||||
<script src='spec/renderer/map.js'></script>
|
||||
<script src='spec/renderer/tile_layer.js'></script>
|
||||
|
||||
<script src='spec/services/mapillary.js'></script>
|
||||
<script src='spec/services/nominatim.js'></script>
|
||||
<script src='spec/services/taginfo.js'></script>
|
||||
|
||||
<script src='spec/svg/areas.js'></script>
|
||||
<script src='spec/svg/icon.js'></script>
|
||||
<script src='spec/svg/lines.js'></script>
|
||||
<script src='spec/svg/midpoints.js'></script>
|
||||
<script src='spec/svg/points.js'></script>
|
||||
<script src='spec/svg/svg.js'></script>
|
||||
<script src='spec/svg/tag_classes.js'></script>
|
||||
<script src='spec/svg/vertices.js'></script>
|
||||
|
||||
<script src='spec/ui/cmd.js'></script>
|
||||
<script src='spec/ui/confirm.js'></script>
|
||||
<script src='spec/ui/flash.js'></script>
|
||||
<script src='spec/ui/inspector.js'></script>
|
||||
<script src='spec/ui/modal.js'></script>
|
||||
<script src='spec/ui/raw_tag_editor.js'></script>
|
||||
|
||||
<script src='spec/ui/fields/access.js'></script>
|
||||
<script src='spec/ui/fields/localized.js'></script>
|
||||
<script src='spec/ui/fields/wikipedia.js'></script>
|
||||
|
||||
<script src='spec/util/session_mutex.js'></script>
|
||||
<script src='spec/util/suggest_names.js'></script>
|
||||
<script src='spec/util/util.js'></script>
|
||||
|
||||
<script>
|
||||
window.mocha.run();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,20 +1,6 @@
|
||||
describe('wikipedia', function() {
|
||||
var entity, context, selection, field, wikiDelay, selectedId;
|
||||
var entity, context, selection, field, selectedId;
|
||||
|
||||
function jsonp(url, callback) {
|
||||
var args = [{
|
||||
entities: {
|
||||
Q216353: { id: 'Q216353' }
|
||||
}
|
||||
}];
|
||||
if (wikiDelay) {
|
||||
window.setTimeout(function () {
|
||||
callback.apply(null, args);
|
||||
}, wikiDelay);
|
||||
} else {
|
||||
callback.apply(null, args);
|
||||
}
|
||||
}
|
||||
|
||||
function changeTags(changed) {
|
||||
var annotation = 'Changed tags.';
|
||||
@@ -29,14 +15,18 @@ describe('wikipedia', function() {
|
||||
context.history().merge([entity]);
|
||||
selection = d3.select(document.createElement('div'));
|
||||
field = context.presets(iD.data.presets).presets().field('wikipedia');
|
||||
wikiDelay = 0;
|
||||
window.JSONP_DELAY = 0;
|
||||
window.JSONP_FIX = {
|
||||
entities: {
|
||||
Q216353: { id: 'Q216353' }
|
||||
}
|
||||
};
|
||||
|
||||
sinon.stub(d3, 'jsonp', jsonp);
|
||||
sinon.stub(context, 'selectedIDs', function() { return [selectedId]; });
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
d3.jsonp.restore();
|
||||
window.JSONP_FIX = undefined;
|
||||
context.selectedIDs.restore();
|
||||
});
|
||||
|
||||
@@ -100,7 +90,7 @@ describe('wikipedia', function() {
|
||||
var wikipedia = iD.ui.fields.wikipedia(field, context).entity(entity);
|
||||
wikipedia.on('change', changeTags);
|
||||
selection.call(wikipedia);
|
||||
wikiDelay = 20;
|
||||
window.JSONP_DELAY = 20;
|
||||
|
||||
var spy = sinon.spy();
|
||||
wikipedia.on('change.spy', spy);
|
||||
@@ -131,7 +121,7 @@ describe('wikipedia', function() {
|
||||
var wikipedia = iD.ui.fields.wikipedia(field, context).entity(entity);
|
||||
wikipedia.on('change', changeTags);
|
||||
selection.call(wikipedia);
|
||||
wikiDelay = 20;
|
||||
window.JSONP_DELAY = 20;
|
||||
|
||||
var spy = sinon.spy();
|
||||
wikipedia.on('change.spy', spy);
|
||||
|
||||
Reference in New Issue
Block a user