mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-03 05:28:03 +02:00
@@ -5,22 +5,22 @@ import { svgIcon } from '../../svg/icon';
|
||||
import { uiSection } from '../section';
|
||||
|
||||
export function uiSectionPrivacy(context) {
|
||||
|
||||
let section = uiSection('preferences-third-party', context)
|
||||
.label(t.html('preferences.privacy.title'))
|
||||
.disclosureContent(renderDisclosureContent);
|
||||
|
||||
let _showThirdPartyIcons = prefs('preferences.privacy.thirdpartyicons') || 'true';
|
||||
|
||||
function renderDisclosureContent(selection) {
|
||||
// enter
|
||||
let privacyOptionsListEnter = selection.selectAll('.privacy-options-list')
|
||||
selection.selectAll('.privacy-options-list')
|
||||
.data([0])
|
||||
.enter()
|
||||
.append('ul')
|
||||
.attr('class', 'layer-list privacy-options-list');
|
||||
|
||||
let thirdPartyIconsEnter = privacyOptionsListEnter
|
||||
let thirdPartyIconsEnter = selection.select('.privacy-options-list')
|
||||
.selectAll('.privacy-third-party-icons-item')
|
||||
.data([prefs('preferences.privacy.thirdpartyicons') || 'true'])
|
||||
.enter()
|
||||
.append('li')
|
||||
.attr('class', 'privacy-third-party-icons-item')
|
||||
.append('label')
|
||||
@@ -32,17 +32,20 @@ export function uiSectionPrivacy(context) {
|
||||
thirdPartyIconsEnter
|
||||
.append('input')
|
||||
.attr('type', 'checkbox')
|
||||
.on('change', (d3_event) => {
|
||||
.on('change', (d3_event, d) => {
|
||||
d3_event.preventDefault();
|
||||
_showThirdPartyIcons = (_showThirdPartyIcons === 'true') ? 'false' : 'true';
|
||||
prefs('preferences.privacy.thirdpartyicons', _showThirdPartyIcons);
|
||||
update();
|
||||
prefs('preferences.privacy.thirdpartyicons', d === 'true' ? 'false' : 'true');
|
||||
});
|
||||
|
||||
thirdPartyIconsEnter
|
||||
.append('span')
|
||||
.call(t.append('preferences.privacy.third_party_icons.description'));
|
||||
|
||||
// update
|
||||
selection.selectAll('.privacy-third-party-icons-item')
|
||||
.classed('active', d => d === 'true')
|
||||
.select('input')
|
||||
.property('checked', d => d === 'true');
|
||||
|
||||
// Privacy Policy link
|
||||
selection.selectAll('.privacy-link')
|
||||
@@ -57,16 +60,9 @@ export function uiSectionPrivacy(context) {
|
||||
.append('span')
|
||||
.call(t.append('preferences.privacy.privacy_link'));
|
||||
|
||||
update();
|
||||
|
||||
|
||||
function update() {
|
||||
selection.selectAll('.privacy-third-party-icons-item')
|
||||
.classed('active', (_showThirdPartyIcons === 'true'))
|
||||
.select('input')
|
||||
.property('checked', (_showThirdPartyIcons === 'true'));
|
||||
}
|
||||
}
|
||||
|
||||
prefs.onChange('preferences.privacy.thirdpartyicons', section.reRender);
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user