hr-design-system-handlebars 1.82.9 → 1.82.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/assets/index.css +3 -3
- package/dist/assets/js/components/dataPolicySettings/dataPolicySettingsDs.feature.js +25 -12
- package/dist/assets/js/components/externalService/createWahlErgebnisGemeinde.subfeature.js +157 -0
- package/dist/assets/js/components/externalService/externalServiceDs.feature.js +15 -196
- package/dist/views/components/externalService/components/external_service_data_policy.hbs +1 -1
- package/dist/views/components/externalService/components/external_service_settings_button.hbs +1 -1
- package/dist/views_static/components/externalService/components/external_service_data_policy.hbs +1 -1
- package/dist/views_static/components/externalService/components/external_service_settings_button.hbs +1 -1
- package/package.json +1 -1
- package/src/stories/basics/iconography/page_icon_404_data.js +3 -3
- package/src/stories/basics/iconography/page_icon_epg_data.js +3 -3
- package/src/stories/basics/iconography/page_icon_public_transport_data.js +3 -3
- package/src/stories/basics/iconography/page_icon_traffic_data.js +3 -3
- package/src/stories/basics/iconography/page_icon_weather_data.js +3 -3
- package/src/stories/basics/iconography/page_icons.mdx +7 -7
- package/src/stories/views/components/dataPolicySettings/dataPolicySettingsDs.feature.js +25 -12
- package/src/stories/views/components/externalService/components/external_service_data_policy.hbs +1 -1
- package/src/stories/views/components/externalService/components/external_service_settings_button.hbs +1 -1
- package/src/stories/views/components/externalService/createWahlErgebnisGemeinde.subfeature.js +157 -0
- package/src/stories/views/components/externalService/externalServiceDs.feature.js +15 -196
|
@@ -2,12 +2,12 @@ const images = require.context('/src/assets/icons/traffic/svgmap', true);
|
|
|
2
2
|
|
|
3
3
|
let imageList = {}
|
|
4
4
|
let file
|
|
5
|
-
let
|
|
5
|
+
let svgListTraffic = {}
|
|
6
6
|
imageList = images.keys().map(image => images(image));
|
|
7
7
|
|
|
8
8
|
for(let i=0; i < imageList.length; i++){
|
|
9
9
|
file = imageList[i].replace(/^.*[\\/]/, '').slice(0,-4)
|
|
10
|
-
|
|
10
|
+
svgListTraffic[file] = file
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export default
|
|
13
|
+
export default svgListTraffic;
|
|
@@ -2,12 +2,12 @@ const images = require.context('/src/assets/icons/weather/svgmap', true);
|
|
|
2
2
|
|
|
3
3
|
let imageList = {}
|
|
4
4
|
let file
|
|
5
|
-
let
|
|
5
|
+
let svgListWeather = {}
|
|
6
6
|
imageList = images.keys().map(image => images(image));
|
|
7
7
|
|
|
8
8
|
for(let i=0; i < imageList.length; i++){
|
|
9
9
|
file = imageList[i].replace(/^.*[\\/]/, '').slice(0,-4)
|
|
10
|
-
|
|
10
|
+
svgListWeather[file] = file
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export default
|
|
13
|
+
export default svgListWeather;
|
|
@@ -5,7 +5,7 @@ import svgList404 from './page_icon_404_data.js'
|
|
|
5
5
|
import svgListWeather from './page_icon_weather_data.js'
|
|
6
6
|
import svgListPublicTransport from './page_icon_public_transport_data.js'
|
|
7
7
|
import svgListTraffic from './page_icon_traffic_data.js'
|
|
8
|
-
import
|
|
8
|
+
import svgListEpg from './page_icon_epg_data.js'
|
|
9
9
|
|
|
10
10
|
<Meta title="Grundlegendes/Iconographie/Iconwelt" />
|
|
11
11
|
|
|
@@ -52,7 +52,7 @@ aber auch die anderen noch aus dem alten Delivery stammenden dargestellt werden.
|
|
|
52
52
|
<div style={{backgroundColor:'#fafafa', border: '1px solid #cacaca', display: 'inline-flex', alignItems: 'center', justifyContent: 'center'}}>
|
|
53
53
|
<div style={{ width: '120px', height: '150px', margin: '5px', textAlign:'center', justifyContent: 'center'}}>
|
|
54
54
|
<svg className="svg-item" width="120px" height="100px">
|
|
55
|
-
<use xlinkHref={'./icons/
|
|
55
|
+
<use xlinkHref={'./icons/404/svgmap.min.svg#'+token[0]}></use>
|
|
56
56
|
</svg>
|
|
57
57
|
<span style={{textAlign:'center', fontSize:'12px', display: 'block', backgroundColor:'#000', color: '#fff', marginTop: '10px'}}>{token[0]}</span>
|
|
58
58
|
</div>
|
|
@@ -67,7 +67,7 @@ aber auch die anderen noch aus dem alten Delivery stammenden dargestellt werden.
|
|
|
67
67
|
<div style={{backgroundColor:'#fafafa', border: '1px solid #cacaca', display: 'inline-flex', alignItems: 'center', justifyContent: 'center'}}>
|
|
68
68
|
<div style={{ width: '120px', height: '150px', margin: '5px', textAlign:'center', justifyContent: 'center'}}>
|
|
69
69
|
<svg className="svg-item" width="120px" height="100px">
|
|
70
|
-
<use xlinkHref={'./icons/
|
|
70
|
+
<use xlinkHref={'./icons/weather/svgmap.min.svg#'+token[0]}></use>
|
|
71
71
|
</svg>
|
|
72
72
|
<span style={{textAlign:'center', fontSize:'12px', display: 'block', backgroundColor:'#000', color: '#fff', marginTop: '10px'}}>{token[0]}</span>
|
|
73
73
|
</div>
|
|
@@ -82,7 +82,7 @@ aber auch die anderen noch aus dem alten Delivery stammenden dargestellt werden.
|
|
|
82
82
|
<div style={{backgroundColor:'#fafafa', border: '1px solid #cacaca', display: 'inline-flex', alignItems: 'center', justifyContent: 'center'}}>
|
|
83
83
|
<div style={{ width: '120px', height: '150px', margin: '5px', textAlign:'center', justifyContent: 'center'}}>
|
|
84
84
|
<svg className="svg-item" width="120px" height="100px">
|
|
85
|
-
<use xlinkHref={'./icons/
|
|
85
|
+
<use xlinkHref={'./icons/publictransport/svgmap.min.svg#'+token[0]}></use>
|
|
86
86
|
</svg>
|
|
87
87
|
<span style={{textAlign:'center', fontSize:'12px', display: 'block', backgroundColor:'#000', color: '#fff', marginTop: '10px'}}>{token[0]}</span>
|
|
88
88
|
</div>
|
|
@@ -97,7 +97,7 @@ aber auch die anderen noch aus dem alten Delivery stammenden dargestellt werden.
|
|
|
97
97
|
<div style={{backgroundColor:'#fafafa', border: '1px solid #cacaca', display: 'inline-flex', alignItems: 'center', justifyContent: 'center'}}>
|
|
98
98
|
<div style={{ width: '120px', height: '150px', margin: '5px', textAlign:'center', justifyContent: 'center'}}>
|
|
99
99
|
<svg className="svg-item" width="120px" height="100px">
|
|
100
|
-
<use xlinkHref={'./icons/
|
|
100
|
+
<use xlinkHref={'./icons/traffic/svgmap.min.svg#'+token[0]}></use>
|
|
101
101
|
</svg>
|
|
102
102
|
<span style={{textAlign:'center', fontSize:'12px', display: 'block', backgroundColor:'#000', color: '#fff', marginTop: '10px'}}>{token[0]}</span>
|
|
103
103
|
</div>
|
|
@@ -107,12 +107,12 @@ aber auch die anderen noch aus dem alten Delivery stammenden dargestellt werden.
|
|
|
107
107
|
|
|
108
108
|
## Icons für EPG
|
|
109
109
|
|
|
110
|
-
{Object.entries(
|
|
110
|
+
{Object.entries(svgListEpg).map((token, key) => {
|
|
111
111
|
return (
|
|
112
112
|
<div style={{backgroundColor:'#fafafa', border: '1px solid #cacaca', display: 'inline-flex', alignItems: 'center', justifyContent: 'center'}}>
|
|
113
113
|
<div style={{ width: '120px', height: '150px', margin: '5px', textAlign:'center', justifyContent: 'center'}}>
|
|
114
114
|
<svg className="svg-item" width="120px" height="100px">
|
|
115
|
-
<use xlinkHref={'./icons/
|
|
115
|
+
<use xlinkHref={'./icons/epg/svgmap.min.svg#'+token[0]}></use>
|
|
116
116
|
</svg>
|
|
117
117
|
<span style={{textAlign:'center', fontSize:'12px', display: 'block', backgroundColor:'#000', color: '#fff', marginTop: '10px'}}>{token[0]}</span>
|
|
118
118
|
</div>
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import SettingsCookie from 'components/externalService/globalSettingsCookie.subfeature'
|
|
2
|
-
import DatapolicyCookie from 'components/externalService/datapolicyCookie.subfeature'
|
|
3
|
-
import TrackingCookie from 'components/externalService/trackingCookie.subfeature'
|
|
4
2
|
import { fireEvent, getJSONCookie, hr$, setJSONCookie, listen } from 'hrQuery'
|
|
5
3
|
import { uxAction } from 'base/tracking/pianoHelper.subfeature'
|
|
6
4
|
|
|
@@ -12,16 +10,10 @@ const DataPolicySettings = function (context) {
|
|
|
12
10
|
{ element: rootElement } = context,
|
|
13
11
|
container = hr$('#datapolicy-settings-dialog',document)[0],
|
|
14
12
|
dialog = new A11yDialog(container),
|
|
15
|
-
settingsButtons = hr$('.js-data-policy-settings-button', document),
|
|
16
|
-
overlay = hr$('.js-data-policy-settings-overlay', rootElement)[0],
|
|
17
|
-
closeButton = hr$('.js-data-policy-settings-close-button', rootElement)[0],
|
|
18
13
|
bodyElement = document.getElementsByTagName('html')[0],
|
|
19
|
-
datapolicyCookie = new DatapolicyCookie(),
|
|
20
|
-
trackingCookie = new TrackingCookie(),
|
|
21
14
|
settingsCookie = new SettingsCookie(),
|
|
22
15
|
toggleSwitches = hr$('.js-toggleSwitch-checkbox', container),
|
|
23
16
|
toggleSwitchesExternal = hr$('.js-toggleSwitch-external', container),
|
|
24
|
-
toggleSwitchesTracking = hr$('.js-toggleSwitch-tracking', container),
|
|
25
17
|
toggleAllSwitch = hr$('.js-toggleSwitch-checkbox-all', container)[0],
|
|
26
18
|
providerTitle = hr$('.js-providerTitle', container)[0]
|
|
27
19
|
|
|
@@ -192,18 +184,39 @@ const DataPolicySettings = function (context) {
|
|
|
192
184
|
appSettingsCookie = getJSONCookie('appSettings') || {}
|
|
193
185
|
}
|
|
194
186
|
|
|
195
|
-
//Für die hs-App wird der
|
|
187
|
+
//Für die hs-App wird der Globale Einstellungsbutton ein- und ausgeblendet,
|
|
188
|
+
//sowie der Einstellungsbutton für einen einzelnen externen Dienst, sobald dieser einmalig oder dauerhaft aktiviert wurde
|
|
196
189
|
const showSettingsButton = function () {
|
|
197
190
|
let settingsButton = document.getElementById('globalSettingsButton')
|
|
198
191
|
if (isWebview) {
|
|
199
192
|
readAppSettingsButtonCookie()
|
|
200
193
|
if (appSettingsCookie['hidePrivacySettingsButton'] === true) {
|
|
201
|
-
settingsButton.
|
|
194
|
+
settingsButton.classList.add('hidden')
|
|
195
|
+
document.querySelectorAll('.js-content-settings-button').forEach(function(jscontentSettingsButton) {
|
|
196
|
+
|
|
197
|
+
jscontentSettingsButton.classList.add('hidden')
|
|
198
|
+
|
|
199
|
+
});
|
|
200
|
+
document.querySelectorAll('.js-settings-button-inner').forEach(function(jsSettingsButton) {
|
|
201
|
+
|
|
202
|
+
jsSettingsButton.classList.add('hidden')
|
|
203
|
+
|
|
204
|
+
});
|
|
202
205
|
} else {
|
|
203
|
-
settingsButton.
|
|
206
|
+
settingsButton.classList.remove('hidden')
|
|
207
|
+
document.querySelectorAll('.js-content-settings-button').forEach(function(jscontentSettingsButton) {
|
|
208
|
+
if(jscontentSettingsButton.classList.contains('hidden')) {
|
|
209
|
+
jscontentSettingsButton.classList.remove('hidden')
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
document.querySelectorAll('.js-settings-button-inner').forEach(function(jsSettingsButton) {
|
|
213
|
+
if(jscontentSettingsButton.classList.contains('hidden')) {
|
|
214
|
+
jsSettingsButton.classList.remove('hidden')
|
|
215
|
+
}
|
|
216
|
+
});
|
|
204
217
|
}
|
|
205
218
|
} else {
|
|
206
|
-
|
|
219
|
+
|
|
207
220
|
}
|
|
208
221
|
}
|
|
209
222
|
|
package/src/stories/views/components/externalService/components/external_service_data_policy.hbs
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<div class="float-right pt-4">
|
|
14
14
|
{{#with this}}
|
|
15
15
|
<div class="inline-flex">
|
|
16
|
-
{{~> components/externalService/components/external_service_settings_button ~}}
|
|
16
|
+
{{~> components/externalService/components/external_service_settings_button _css="js-settings-inner-button"~}}
|
|
17
17
|
{{#*inline "htmlProperties"}}
|
|
18
18
|
data-piano-tracking='{"label":"DSGVO-Overlay"}'
|
|
19
19
|
data-a11y-dialog-show="datapolicy-settings-dialog"
|
package/src/stories/views/components/externalService/components/external_service_settings_button.hbs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{{#> components/button/button _size="md" _variant="tertiary" _css=
|
|
1
|
+
{{#> components/button/button _size="md" _variant="tertiary" _css=_css _type="button"}}
|
|
2
2
|
{{> components/button/components/button_icon _icon="settings" _iconmap="icons"}}
|
|
3
3
|
{{> components/button/components/button_label _label="Einstellungen"}}
|
|
4
4
|
{{/components/button/button}}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
const CreateWahlGemeindeErgebnis = function (embedCode,rootElement) {
|
|
2
|
+
let eCode = embedCode,
|
|
3
|
+
cleanUrl,
|
|
4
|
+
wahlKreisVersionJsonUrl,
|
|
5
|
+
wahlkreis,
|
|
6
|
+
wahlid,
|
|
7
|
+
jsonResponse,
|
|
8
|
+
iFrameElement,
|
|
9
|
+
iframeHeight = 300
|
|
10
|
+
|
|
11
|
+
const createErgebnis = function() {
|
|
12
|
+
extractDataFromEmbedCode()
|
|
13
|
+
initMessageEventListener()
|
|
14
|
+
fetchJsonData()
|
|
15
|
+
}
|
|
16
|
+
const cleanVariables = function (variable) {
|
|
17
|
+
while (variable.charAt(0) === '&') {
|
|
18
|
+
variable = variable.substring(1)
|
|
19
|
+
}
|
|
20
|
+
return variable
|
|
21
|
+
}
|
|
22
|
+
const extractDataFromEmbedCode = function () {
|
|
23
|
+
const parts = eCode.split('*')
|
|
24
|
+
if (parts.length === 4) {
|
|
25
|
+
cleanUrl = cleanVariables(decodeURIComponent(parts[0].trim()))
|
|
26
|
+
wahlkreis = cleanVariables(decodeURIComponent(parts[1].trim()))
|
|
27
|
+
wahlid = cleanVariables(decodeURIComponent(parts[2].trim()))
|
|
28
|
+
wahlKreisVersionJsonUrl = cleanVariables(decodeURIComponent(parts[3].trim()))
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const loadIframe = function (version, url, wahlkreis) {
|
|
32
|
+
if (version) {
|
|
33
|
+
let iframeUrl = url.replace('{version}', version)
|
|
34
|
+
let iframe = document.createElement('iframe')
|
|
35
|
+
iframe.className = ''
|
|
36
|
+
iframe.style.border = 'none'
|
|
37
|
+
iframe.style.height = iframeHeight + 'px'
|
|
38
|
+
iframe.style.width = '100%'
|
|
39
|
+
iframe.setAttribute('webkitallowfullscreen', '')
|
|
40
|
+
iframe.setAttribute('mozallowfullscreen', '')
|
|
41
|
+
iframe.setAttribute('allowfullscreen', '')
|
|
42
|
+
iframe.setAttribute('scrolling', 'no')
|
|
43
|
+
iframe.setAttribute('frameborder', '0')
|
|
44
|
+
iframe.src = iframeUrl
|
|
45
|
+
iframe.id = 'wahl-gemeinde-ergebnis-' + wahlkreis
|
|
46
|
+
rootElement.innerHTML = ''
|
|
47
|
+
rootElement.insertBefore(iframe, null)
|
|
48
|
+
iFrameElement = document.getElementById('wahl-gemeinde-ergebnis-' + wahlkreis)
|
|
49
|
+
} else {
|
|
50
|
+
loadNoDataDiv('Es liegen zur Zeit noch keine Ergebnisse vor', 5)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const loadNoDataDiv = function (text, timeout) {
|
|
54
|
+
let div = document.createElement('div')
|
|
55
|
+
div.className =
|
|
56
|
+
'p-5 c-externalService__wahl-gemeinde-ergebnis-no-result rounded-tl-hr rounded-br-hr bg-highlight-1'
|
|
57
|
+
div.innerHTML =
|
|
58
|
+
'<div class="text-2xl text-clusterTeaserHeadline font-titleCluster mb-2">' +
|
|
59
|
+
text +
|
|
60
|
+
'</div>' +
|
|
61
|
+
'<div class="flex flex-row" >' +
|
|
62
|
+
' <div class="">' +
|
|
63
|
+
' <span>Dieser Inhalt wird automatisch aktualisiert in</span>' +
|
|
64
|
+
' <span data-minutes>' +
|
|
65
|
+
timeout +
|
|
66
|
+
' </span>' +
|
|
67
|
+
' <span>Min</span>' +
|
|
68
|
+
' <span data-seconds>0</span>' +
|
|
69
|
+
' <span>Sek</span>' +
|
|
70
|
+
' </div>' +
|
|
71
|
+
'</div>'
|
|
72
|
+
rootElement.innerHTML = ''
|
|
73
|
+
rootElement.insertBefore(div, null)
|
|
74
|
+
countdownMinutes(timeout, fetchJsonData)
|
|
75
|
+
}
|
|
76
|
+
const resizeIframe = function (newheight) {
|
|
77
|
+
if (newheight !== iframeHeight) {
|
|
78
|
+
iFrameElement.style.height = newheight + 'px'
|
|
79
|
+
iframeHeight = newheight
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const processMessage = function (evt) {
|
|
83
|
+
if (evt.origin !== 'https://www.tagesschau.de') {
|
|
84
|
+
console.log('message', evt.origin + ' ist nicht vertrauenswürdig')
|
|
85
|
+
} else {
|
|
86
|
+
resizeIframe(evt.data)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const initMessageEventListener = function () {
|
|
90
|
+
if (window.addEventListener) {
|
|
91
|
+
// For standards-compliant web browsers
|
|
92
|
+
window.addEventListener('message', processMessage, false)
|
|
93
|
+
} else {
|
|
94
|
+
window.attachEvent('onmessage', processMessage)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const fetchJsonData = function () {
|
|
98
|
+
fetch(wahlKreisVersionJsonUrl, {
|
|
99
|
+
method: 'GET',
|
|
100
|
+
headers: {
|
|
101
|
+
Accept: 'application/json',
|
|
102
|
+
},
|
|
103
|
+
})
|
|
104
|
+
.then((response) => response.json())
|
|
105
|
+
.then((jsonData) =>
|
|
106
|
+
loadIframe(
|
|
107
|
+
jsonData.hasOwnProperty(wahlkreis) && jsonData[wahlkreis].v
|
|
108
|
+
? jsonData[wahlkreis].v
|
|
109
|
+
: null,
|
|
110
|
+
cleanUrl,
|
|
111
|
+
wahlkreis,
|
|
112
|
+
),
|
|
113
|
+
)
|
|
114
|
+
.catch(function () {
|
|
115
|
+
loadNoDataDiv('Es liegen zur Zeit noch keine Ergebnisse vor', 5)
|
|
116
|
+
console.log('No JSON Data Loaded')
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function countdownMinutes(minutesToCountdown, callbackFunction) {
|
|
121
|
+
const second = 1000,
|
|
122
|
+
minute = second * 60,
|
|
123
|
+
hour = minute * 60,
|
|
124
|
+
day = hour * 24,
|
|
125
|
+
minuteElement = document.querySelector('[data-minutes]'),
|
|
126
|
+
secondElement = document.querySelector('[data-seconds]')
|
|
127
|
+
|
|
128
|
+
function AddMinutesToDate(date, minutes) {
|
|
129
|
+
return new Date(date.getTime() + minutes * 60000)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
let countDown = AddMinutesToDate(new Date(), minutesToCountdown),
|
|
133
|
+
x = setInterval(function () {
|
|
134
|
+
let now = new Date().getTime(),
|
|
135
|
+
distance = countDown - now
|
|
136
|
+
|
|
137
|
+
if (minuteElement != null) {
|
|
138
|
+
minuteElement.innerText = Math.floor((distance % hour) / minute)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (secondElement != null) {
|
|
142
|
+
secondElement.innerText = Math.floor((distance % minute) / second)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (distance < 1000) {
|
|
146
|
+
callbackFunction()
|
|
147
|
+
clearInterval(x)
|
|
148
|
+
}
|
|
149
|
+
}, second)
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
createErgebnis: createErgebnis
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export default CreateWahlGemeindeErgebnis
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import SettingsCookie from './globalSettingsCookie.subfeature'
|
|
2
2
|
import DataWrapperContentRefresher from './dataWrapperContentRefresher.subfeature'
|
|
3
3
|
import DataWrapperNoResponsiveIframe from './dataWrapperNoResponsiveIframe.subfeature'
|
|
4
|
+
import CreateWahlGemeindeErgebnis from './createWahlErgebnisGemeinde.subfeature'
|
|
4
5
|
import {
|
|
5
6
|
fireEvent,
|
|
6
7
|
hr$,
|
|
@@ -8,9 +9,7 @@ import {
|
|
|
8
9
|
loadScript,
|
|
9
10
|
removeScript,
|
|
10
11
|
replaceAnimated,
|
|
11
|
-
requestTimeout
|
|
12
|
-
getJSONCookie,
|
|
13
|
-
deleteCookie,
|
|
12
|
+
requestTimeout
|
|
14
13
|
} from 'hrQuery'
|
|
15
14
|
|
|
16
15
|
const ExternalService = function (context) {
|
|
@@ -25,17 +24,16 @@ const ExternalService = function (context) {
|
|
|
25
24
|
id = options.id,
|
|
26
25
|
iFrameConfig = options.iFrameConfig
|
|
27
26
|
let acceptButton,
|
|
28
|
-
acceptAlwaysCheckbox = hr$('.js-dataPolicy-acceptPermanentely', rootElement)[0]
|
|
29
|
-
dataPolicySettingsButton = hr$('.js-data-policy-settings-button', rootParent)[0]
|
|
27
|
+
acceptAlwaysCheckbox = hr$('.js-dataPolicy-acceptPermanentely', rootElement)[0]
|
|
30
28
|
let embedCode = options.embedCode,
|
|
31
29
|
iframe,
|
|
32
30
|
settingsCookie,
|
|
33
31
|
noResponsiveIframe,
|
|
34
32
|
contentRefresher,
|
|
33
|
+
gemeindewahlergebnis,
|
|
35
34
|
uniqueId,
|
|
36
|
-
isExternalServiceLoaded = false
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
isExternalServiceLoaded = false
|
|
36
|
+
|
|
39
37
|
const testDOMElements = function () {
|
|
40
38
|
console.log(rootElement)
|
|
41
39
|
console.log(rootParent)
|
|
@@ -58,10 +56,8 @@ const ExternalService = function (context) {
|
|
|
58
56
|
console.log('Done')
|
|
59
57
|
if (undefined !== callback) {
|
|
60
58
|
replaceAnimated(rootElement, data.html, false, callback)
|
|
61
|
-
alert('boing')
|
|
62
59
|
} else {
|
|
63
60
|
replaceAnimated(rootElement, data.html, false)
|
|
64
|
-
alert('boing, boing')
|
|
65
61
|
}
|
|
66
62
|
})
|
|
67
63
|
//Add handlers to be called when the Deferred object is rejected.
|
|
@@ -104,7 +100,7 @@ const ExternalService = function (context) {
|
|
|
104
100
|
createWahlOMatEmbed()
|
|
105
101
|
break
|
|
106
102
|
case 'wahl-gemeinde-ergebnis':
|
|
107
|
-
|
|
103
|
+
createWahlGemeindeErgebnisEmbed()
|
|
108
104
|
break
|
|
109
105
|
default:
|
|
110
106
|
console.error('No JS Config for external service ' + id)
|
|
@@ -115,155 +111,10 @@ const ExternalService = function (context) {
|
|
|
115
111
|
loadIframe() //für alle Dienste die nicht der DSGVO Datapolicy unterliegen
|
|
116
112
|
}
|
|
117
113
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
wahlkreis,
|
|
123
|
-
wahlid,
|
|
124
|
-
jsonResponse,
|
|
125
|
-
iFrameElement,
|
|
126
|
-
iframeHeight = 300
|
|
127
|
-
|
|
128
|
-
const cleanVariables = function (variable) {
|
|
129
|
-
while (variable.charAt(0) === '&') {
|
|
130
|
-
variable = variable.substring(1)
|
|
131
|
-
}
|
|
132
|
-
return variable
|
|
133
|
-
}
|
|
134
|
-
const extractDataFromEmbedCode = function () {
|
|
135
|
-
const parts = embedCode.split('*')
|
|
136
|
-
if (parts.length === 4) {
|
|
137
|
-
cleanUrl = cleanVariables(decodeURIComponent(parts[0].trim()))
|
|
138
|
-
wahlkreis = cleanVariables(decodeURIComponent(parts[1].trim()))
|
|
139
|
-
wahlid = cleanVariables(decodeURIComponent(parts[2].trim()))
|
|
140
|
-
wahlKreisVersionJsonUrl = cleanVariables(decodeURIComponent(parts[3].trim()))
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
const loadIframe = function (version, url, wahlkreis) {
|
|
144
|
-
if (version) {
|
|
145
|
-
let iframeUrl = url.replace('{version}', version)
|
|
146
|
-
let iframe = document.createElement('iframe')
|
|
147
|
-
iframe.className = ''
|
|
148
|
-
iframe.style.border = 'none'
|
|
149
|
-
iframe.style.height = iframeHeight + 'px'
|
|
150
|
-
iframe.style.width = '100%'
|
|
151
|
-
iframe.setAttribute('webkitallowfullscreen', '')
|
|
152
|
-
iframe.setAttribute('mozallowfullscreen', '')
|
|
153
|
-
iframe.setAttribute('allowfullscreen', '')
|
|
154
|
-
iframe.setAttribute('scrolling', 'no')
|
|
155
|
-
iframe.setAttribute('frameborder', '0')
|
|
156
|
-
iframe.src = iframeUrl
|
|
157
|
-
iframe.id = 'wahl-gemeinde-ergebnis-' + wahlkreis
|
|
158
|
-
rootElement.innerHTML = ''
|
|
159
|
-
rootElement.insertBefore(iframe, null)
|
|
160
|
-
iFrameElement = document.getElementById('wahl-gemeinde-ergebnis-' + wahlkreis)
|
|
161
|
-
} else {
|
|
162
|
-
loadNoDataDiv('Es liegen zur Zeit noch keine Ergebnisse vor', 5)
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
const loadNoDataDiv = function (text, timeout) {
|
|
166
|
-
let div = document.createElement('div')
|
|
167
|
-
div.className =
|
|
168
|
-
'p-5 c-externalService__wahl-gemeinde-ergebnis-no-result rounded-tl-hr rounded-br-hr bg-highlight-1'
|
|
169
|
-
div.innerHTML =
|
|
170
|
-
'<div class="text-2xl text-clusterTeaserHeadline font-titleCluster mb-2">' +
|
|
171
|
-
text +
|
|
172
|
-
'</div>' +
|
|
173
|
-
'<div class="flex flex-row" >' +
|
|
174
|
-
' <div class="">' +
|
|
175
|
-
' <span>Dieser Inhalt wird automatisch aktualisiert in</span>' +
|
|
176
|
-
' <span data-minutes>' +
|
|
177
|
-
timeout +
|
|
178
|
-
' </span>' +
|
|
179
|
-
' <span>Min</span>' +
|
|
180
|
-
' <span data-seconds>0</span>' +
|
|
181
|
-
' <span>Sek</span>' +
|
|
182
|
-
' </div>' +
|
|
183
|
-
'</div>'
|
|
184
|
-
rootElement.innerHTML = ''
|
|
185
|
-
rootElement.insertBefore(div, null)
|
|
186
|
-
countdownMinutes(timeout, fetchJsonData)
|
|
187
|
-
}
|
|
188
|
-
const resizeIframe = function (newheight) {
|
|
189
|
-
if (newheight !== iframeHeight) {
|
|
190
|
-
iFrameElement.style.height = newheight + 'px'
|
|
191
|
-
iframeHeight = newheight
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
const processMessage = function (evt) {
|
|
195
|
-
if (evt.origin !== 'https://www.tagesschau.de') {
|
|
196
|
-
console.log('message', evt.origin + ' ist nicht vertrauenswürdig')
|
|
197
|
-
} else {
|
|
198
|
-
resizeIframe(evt.data)
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
const initMessageEventListener = function () {
|
|
202
|
-
if (window.addEventListener) {
|
|
203
|
-
// For standards-compliant web browsers
|
|
204
|
-
window.addEventListener('message', processMessage, false)
|
|
205
|
-
} else {
|
|
206
|
-
window.attachEvent('onmessage', processMessage)
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
const fetchJsonData = function () {
|
|
210
|
-
fetch(wahlKreisVersionJsonUrl, {
|
|
211
|
-
method: 'GET',
|
|
212
|
-
headers: {
|
|
213
|
-
Accept: 'application/json',
|
|
214
|
-
},
|
|
215
|
-
})
|
|
216
|
-
.then((response) => response.json())
|
|
217
|
-
.then((jsonData) =>
|
|
218
|
-
loadIframe(
|
|
219
|
-
jsonData.hasOwnProperty(wahlkreis) && jsonData[wahlkreis].v
|
|
220
|
-
? jsonData[wahlkreis].v
|
|
221
|
-
: null,
|
|
222
|
-
cleanUrl,
|
|
223
|
-
wahlkreis,
|
|
224
|
-
),
|
|
225
|
-
)
|
|
226
|
-
.catch(function () {
|
|
227
|
-
loadNoDataDiv('Es liegen zur Zeit noch keine Ergebnisse vor', 5)
|
|
228
|
-
console.log('No JSON Data Loaded')
|
|
229
|
-
})
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function countdownMinutes(minutesToCountdown, callbackFunction) {
|
|
233
|
-
const second = 1000,
|
|
234
|
-
minute = second * 60,
|
|
235
|
-
hour = minute * 60,
|
|
236
|
-
day = hour * 24,
|
|
237
|
-
minuteElement = document.querySelector('[data-minutes]'),
|
|
238
|
-
secondElement = document.querySelector('[data-seconds]')
|
|
239
|
-
|
|
240
|
-
function AddMinutesToDate(date, minutes) {
|
|
241
|
-
return new Date(date.getTime() + minutes * 60000)
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
let countDown = AddMinutesToDate(new Date(), minutesToCountdown),
|
|
245
|
-
x = setInterval(function () {
|
|
246
|
-
let now = new Date().getTime(),
|
|
247
|
-
distance = countDown - now
|
|
248
|
-
|
|
249
|
-
if (minuteElement != null) {
|
|
250
|
-
minuteElement.innerText = Math.floor((distance % hour) / minute)
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
if (secondElement != null) {
|
|
254
|
-
secondElement.innerText = Math.floor((distance % minute) / second)
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (distance < 1000) {
|
|
258
|
-
callbackFunction()
|
|
259
|
-
clearInterval(x)
|
|
260
|
-
}
|
|
261
|
-
}, second)
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
extractDataFromEmbedCode()
|
|
265
|
-
initMessageEventListener()
|
|
266
|
-
fetchJsonData()
|
|
114
|
+
|
|
115
|
+
const createWahlGemeindeErgebnisEmbed = function () {
|
|
116
|
+
gemeindewahlergebnis = new CreateWahlGemeindeErgebnis(embedCode,rootElement)
|
|
117
|
+
gemeindewahlergebnis.createErgebnis()
|
|
267
118
|
}
|
|
268
119
|
const createWahlOMatEmbed = function () {
|
|
269
120
|
|
|
@@ -297,6 +148,7 @@ const ExternalService = function (context) {
|
|
|
297
148
|
rootElement.appendChild(script)
|
|
298
149
|
}
|
|
299
150
|
const createUniqueID = function() {
|
|
151
|
+
console.log("Erzeuge einzigartige ID")
|
|
300
152
|
uniqueId = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(2, 10)
|
|
301
153
|
}
|
|
302
154
|
|
|
@@ -324,6 +176,7 @@ const ExternalService = function (context) {
|
|
|
324
176
|
const createDataWrapperEmbed = function () {
|
|
325
177
|
removeDatapolicyBox()
|
|
326
178
|
createUniqueID()
|
|
179
|
+
console.log("UniqueID"+uniqueId)
|
|
327
180
|
if (iFrameConfig.noResponsiveIframe == 'true') {
|
|
328
181
|
|
|
329
182
|
//Klassisches Iframe mit AR-Wrapper oder fester Höhe
|
|
@@ -342,7 +195,7 @@ const ExternalService = function (context) {
|
|
|
342
195
|
|
|
343
196
|
// Webcomponent
|
|
344
197
|
const divTag = document.createElement('div')
|
|
345
|
-
divTag.id = 'datawrapper-chart-' +
|
|
198
|
+
divTag.id = 'datawrapper-chart-' + uniqueId
|
|
346
199
|
rootElement.insertBefore(divTag, null)
|
|
347
200
|
const scriptTag = document.createElement('script')
|
|
348
201
|
scriptTag.setAttribute('id', 'datawrapper-component-js')
|
|
@@ -504,18 +357,10 @@ const ExternalService = function (context) {
|
|
|
504
357
|
settingsCookie = new SettingsCookie()
|
|
505
358
|
acceptButton = hr$('.js-dataPolicy-accept', rootElement)[0]
|
|
506
359
|
listen('click', handleDatapolicy, acceptButton)
|
|
507
|
-
if (
|
|
508
|
-
if (settingsCookie.isDataPolicyCookieAccepted(id)) {
|
|
360
|
+
if (settingsCookie.isSettingsCookieAccepted(id)) {
|
|
509
361
|
loadServiceWithDataPolicyButton()
|
|
510
|
-
} else {
|
|
511
|
-
dataPolicyBox.style.visibility = 'visible'
|
|
512
|
-
}
|
|
513
362
|
} else {
|
|
514
|
-
if (settingsCookie.isSettingsCookieAccepted(id)) {
|
|
515
|
-
loadServiceWithDataPolicyButton()
|
|
516
|
-
} else {
|
|
517
363
|
dataPolicyBox.style.visibility = 'visible'
|
|
518
|
-
}
|
|
519
364
|
}
|
|
520
365
|
listen('hr:externalService-activate-' + id, loadServiceWithDataPolicyButton)
|
|
521
366
|
listen('hr:externalService-deactivate-' + id, removeExternalService)
|
|
@@ -528,9 +373,6 @@ const ExternalService = function (context) {
|
|
|
528
373
|
if (acceptAlwaysCheckbox.checked == true) {
|
|
529
374
|
fireEvent('hr:externalService-activate-' + id)
|
|
530
375
|
settingsCookie.setCookieForOptions(id)
|
|
531
|
-
if (isWebview) {
|
|
532
|
-
settingsCookie.setCookieForDataPolicy(id)
|
|
533
|
-
}
|
|
534
376
|
} else {
|
|
535
377
|
loadServiceWithDataPolicyButton()
|
|
536
378
|
console.log('External Service once loaded - ' + id)
|
|
@@ -573,22 +415,6 @@ const ExternalService = function (context) {
|
|
|
573
415
|
toggleContentSettingsButton()
|
|
574
416
|
}
|
|
575
417
|
|
|
576
|
-
const syncAppOptionsToSettingsCookie = function () {
|
|
577
|
-
if (getJSONCookie('datapolicy')) {
|
|
578
|
-
let dataPolicyCookie = getJSONCookie('datapolicy') || {}
|
|
579
|
-
let objArray = Object.entries(dataPolicyCookie)
|
|
580
|
-
objArray.forEach(([key, value]) => {
|
|
581
|
-
settingsCookie.setCookieForOptions(key, value)
|
|
582
|
-
})
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
const setWhitelistServicesForInitialApp = function () {
|
|
587
|
-
let whitelist = ['ard_mediathek', 'arte_concert', 'arte_concert_new', 'datawrapper_cdn']
|
|
588
|
-
for (let i = 0; i < whitelist.length; ++i) {
|
|
589
|
-
settingsCookie.setCookieForDataPolicy(whitelist[i], true)
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
418
|
const resetCheckboxForPermanentService = function () {
|
|
593
419
|
/*Die Autocompletion des Browsers merkt sich die Zustände von Formularelementen nach einem Refresh, das wird hier hart zurückgesetzt*/
|
|
594
420
|
var clist = document.getElementsByClassName('js-dataPolicy-acceptPermanentely')
|
|
@@ -599,13 +425,6 @@ const ExternalService = function (context) {
|
|
|
599
425
|
initDataPolicy()
|
|
600
426
|
resetCheckboxForPermanentService()
|
|
601
427
|
testDOMElements()
|
|
602
|
-
if (isWebview) {
|
|
603
|
-
/*Für die App werden Cookie-Daten des neuen Cookies wieder mit dem alten Cookie synchronisiert */
|
|
604
|
-
syncAppOptionsToSettingsCookie()
|
|
605
|
-
if (!getJSONCookie('datapolicy') || !getJSONCookie('hrSettings')) {
|
|
606
|
-
setWhitelistServicesForInitialApp()
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
428
|
}
|
|
610
429
|
|
|
611
430
|
export default ExternalService
|