Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
wrap = selection.selectAll('.form-field-input-wrap')
.data([0]);
wrap = wrap.enter()
.append('div')
.attr('class', 'form-field-input-wrap form-field-input-' + field.type)
.merge(wrap);
if (_entity) {
var countryCode;
if (context.inIntro()) {
// localize the address format for the walkthrough
countryCode = t('intro.graph.countrycode');
} else {
var center = _entity.extent(context.graph()).center();
countryCode = countryCoder.iso1A2Code(center);
}
if (countryCode) updateForCountryCode(countryCode);
}
}
newTags['brand:wikipedia'] = newTags.wikipedia;
delete newTags.wikipedia;
}
// I considered setting `name` and other tags here, but they aren't unique per wikidata
// (Q2759586 -> in USA "Papa John's", in Russia "ะะฐะฟะฐ ะะถะพะฝั")
// So users will really need to use a preset or assign `name` themselves.
}
// try key/value|name match against name-suggestion-index
if (newTags.name) {
for (var i = 0; i < nsiKeys.length; i++) {
var k = nsiKeys[i];
if (!newTags[k]) continue;
var center = entity.extent(graph).center();
var countryCode = countryCoder.iso1A2Code(center);
var match = nsiMatcher.matchKVN(k, newTags[k], newTags.name, countryCode && countryCode.toLowerCase());
if (!match) continue;
// for now skip ambiguous matches (like Target~(USA) vs Target~(Australia))
if (match.d) continue;
var brand = brands.brands[match.kvnd];
if (brand && brand.tags['brand:wikidata'] &&
brand.tags['brand:wikidata'] !== entity.tags['not:brand:wikidata']) {
subtype = 'noncanonical_brand';
var keepTags = ['takeaway'].reduce(function(acc, k) {
if (newTags[k]) {
acc[k] = newTags[k];
}
return acc;
} else {
input = container.selectAll('input')
.data([0]);
}
input = input.enter()
.append('input')
.attr('type', 'text')
.attr('id', 'preset-input-' + field.safeid)
.call(utilNoAuto)
.call(initCombo, selection)
.merge(input);
if (isNetwork && _entity) {
var center = _entity.extent(context.graph()).center();
var countryCode = countryCoder.iso1A2Code(center);
_countryCode = countryCode && countryCode.toLowerCase();
}
input
.on('change', change)
.on('blur', change);
input
.on('keydown.field', function() {
switch (d3_event.keyCode) {
case 13: // โฉ Return
input.node().blur(); // blurring also enters the value
d3_event.stopPropagation();
break;
}
});
function loadCountryCode() {
var center = _entity.extent(context.graph()).center();
var countryCode = countryCoder.iso1A2Code(center);
_countryCode = countryCode && countryCode.toLowerCase();
}
.attr('placeholder', field.placeholder() || t('inspector.unknown'))
.classed(field.type, true)
.call(utilNoAuto)
.merge(input);
input
.classed('disabled', !!isLocked)
.attr('readonly', isLocked || null)
.on('input', change(true))
.on('blur', change())
.on('change', change());
if (field.type === 'tel' && _entity) {
var center = _entity.extent(context.graph()).center();
var countryCode = countryCoder.iso1A2Code(center);
var format = countryCode && dataPhoneFormats[countryCode.toLowerCase()];
if (format) {
wrap.selectAll('#' + fieldID)
.attr('placeholder', format);
}
} else if (field.type === 'number') {
var rtl = (textDirection === 'rtl');
input.attr('type', 'text');
var buttons = wrap.selectAll('.increment, .decrement')
.data(rtl ? [1, -1] : [-1, 1]);
buttons.enter()
.append('button')
function inputevent() {
var value = search.property('value');
list.classed('filtered', value.length);
var entity = context.entity(_entityID);
var results, messageText;
if (value.length && entity) {
var center = entity.extent(context.graph()).center();
var countryCode = countryCoder.iso1A2Code(center);
results = presets.search(value, geometry, countryCode && countryCode.toLowerCase());
messageText = t('inspector.results', {
n: results.collection.length,
search: value
});
} else {
results = context.presets().defaults(geometry, 36);
messageText = t('inspector.choose');
}
list.call(drawList, results);
message.text(messageText);
}