mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 15:56:56 +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;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { fileFetcher } from '../core/file_fetcher';
|
||||
import { t } from '../core/localizer';
|
||||
import { uiIntro } from './intro';
|
||||
import { uiModal } from './modal';
|
||||
import { uiSectionPrivacy } from './sections/privacy';
|
||||
|
||||
|
||||
export function uiSplash(context) {
|
||||
@@ -64,6 +65,10 @@ export function uiSplash(context) {
|
||||
t('splash.privacy_policy') + '</a>' }
|
||||
}));
|
||||
|
||||
uiSectionPrivacy(context)
|
||||
.label(t.html('splash.privacy_settings'))
|
||||
.render(modalSection);
|
||||
|
||||
let buttonWrap = introModal
|
||||
.append('div')
|
||||
.attr('class', 'modal-actions');
|
||||
|
||||
Reference in New Issue
Block a user