hr-design-system-handlebars 1.82.8 → 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 +25 -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/components/teaser/components/teaser_av_consumption.hbs +5 -5
- 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/dist/views_static/components/teaser/components/teaser_av_consumption.hbs +5 -5
- 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
- package/src/stories/views/components/teaser/components/teaser_av_consumption.hbs +5 -5
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
{{#with this.toModel.videoElement}}
|
|
4
4
|
{{~> components/mediaplayer/media_player _uiTestHook="ui-test-video-ondemand-player" _isUsedInTeaser=true _addClassImg=../../_addClassImg~}}
|
|
5
5
|
{{#with ../../this}}
|
|
6
|
-
{{~> components/teaser/components/teaser_media_player _mediaButtonIcon="play_button" _mediaButtonLabel="Video" _aspectRatio=_aspectRatio _noDelay=this.dontLazyload}}
|
|
6
|
+
{{~> components/teaser/components/teaser_media_player _mediaButtonIcon="play_button" _mediaButtonLabel="Video" _aspectRatio=_aspectRatio _addClassImg=_addClassImg _noDelay=this.dontLazyload}}
|
|
7
7
|
{{/with}}
|
|
8
8
|
{{#if ../../_isMobile1to1~}}
|
|
9
9
|
{{> components/teaser/components/teaser_av_consumption_close_button _playerId=this.ardPlayerConfig.playerId }}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
{{#with this.toModel.audioElementForVideoView}}
|
|
15
15
|
{{~> components/mediaplayer/media_player _uiTestHook="ui-test-audio-ondemand-player" _isUsedInTeaser=true _addClassImg=../../_addClassImg~}}
|
|
16
16
|
{{#with ../../this}}
|
|
17
|
-
{{~> components/teaser/components/teaser_media_player _mediaButtonIcon="audio_button" _mediaButtonLabel="Audio" _aspectRatio=_aspectRatio _noDelay=this.dontLazyload}}
|
|
17
|
+
{{~> components/teaser/components/teaser_media_player _mediaButtonIcon="audio_button" _mediaButtonLabel="Audio" _aspectRatio=_aspectRatio _addClassImg=_addClassImg _noDelay=this.dontLazyload}}
|
|
18
18
|
{{/with}}
|
|
19
19
|
{{#if ../../_isMobile1to1~}}
|
|
20
20
|
{{> components/teaser/components/teaser_av_consumption_close_button _playerId=this.ardPlayerConfig.playerId }}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
{{#with this.toModel.audioElementForVideoView}}
|
|
26
26
|
{{~> components/mediaplayer/media_player _uiTestHook="ui-test-audio-ondemand-player" _isUsedInTeaser=true _addClassImg=../../_addClassImg~}}
|
|
27
27
|
{{#with ../../this}}
|
|
28
|
-
{{~> components/teaser/components/teaser_media_player _mediaButtonIcon="audio_button" _mediaButtonLabel="Podcast" _aspectRatio=_aspectRatio _noDelay=this.dontLazyload}}
|
|
28
|
+
{{~> components/teaser/components/teaser_media_player _mediaButtonIcon="audio_button" _mediaButtonLabel="Podcast" _aspectRatio=_aspectRatio _addClassImg=_addClassImg _noDelay=this.dontLazyload}}
|
|
29
29
|
{{/with}}
|
|
30
30
|
{{#if ../../_isMobile1to1~}}
|
|
31
31
|
{{> components/teaser/components/teaser_av_consumption_close_button _playerId=this.ardPlayerConfig.playerId }}
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
{{#with this.toModel.audioLivestreamElementForVideoView}}
|
|
37
37
|
{{~> components/mediaplayer/media_player _uiTestHook="ui-test-audio-livestream-player" _isUsedInTeaser=true _addClassImg=../../_addClassImg~}}
|
|
38
38
|
{{#with ../../this}}
|
|
39
|
-
{{~> components/teaser/components/teaser_media_player _mediaButtonIcon="play_button" _mediaButtonLabel="Live" _isLivestream=true _aspectRatio=_aspectRatio _noDelay=this.dontLazyload}}
|
|
39
|
+
{{~> components/teaser/components/teaser_media_player _mediaButtonIcon="play_button" _mediaButtonLabel="Live" _isLivestream=true _aspectRatio=_aspectRatio _addClassImg=_addClassImg _noDelay=this.dontLazyload}}
|
|
40
40
|
{{/with}}
|
|
41
41
|
{{#if ../../_isMobile1to1~}}
|
|
42
42
|
{{> components/teaser/components/teaser_av_consumption_close_button _playerId=this.ardPlayerConfig.playerId }}
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
{{#with this.toModel.videoLivestreamElement}}
|
|
48
48
|
{{~> components/mediaplayer/media_player _uiTestHook="ui-test-video-livestream-player" _isUsedInTeaser=true _addClassImg=../../_addClassImg~}}
|
|
49
49
|
{{#with ../../this}}
|
|
50
|
-
{{~> components/teaser/components/teaser_media_player _mediaButtonIcon="play_button" _mediaButtonLabel="Live" _isLivestream=true _aspectRatio=_aspectRatio _noDelay=this.dontLazyload}}
|
|
50
|
+
{{~> components/teaser/components/teaser_media_player _mediaButtonIcon="play_button" _mediaButtonLabel="Live" _isLivestream=true _aspectRatio=_aspectRatio _addClassImg=_addClassImg _noDelay=this.dontLazyload}}
|
|
51
51
|
{{/with}}
|
|
52
52
|
{{#if ../../_isMobile1to1~}}
|
|
53
53
|
{{> components/teaser/components/teaser_av_consumption_close_button _playerId=this.ardPlayerConfig.playerId }}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"repository": "https://github.com/szuelch/hr-design-system-handlebars",
|
|
9
|
-
"version": "1.82.
|
|
9
|
+
"version": "1.82.10",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
12
|
"storybook": "storybook dev -p 6006 public",
|
|
@@ -2,12 +2,12 @@ const images = require.context('/src/assets/icons/404/svgmap', true);
|
|
|
2
2
|
|
|
3
3
|
let imageList = {}
|
|
4
4
|
let file
|
|
5
|
-
let
|
|
5
|
+
let svgList404 = {}
|
|
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
|
+
svgList404[file] = file
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export default
|
|
13
|
+
export default svgList404;
|
|
@@ -2,12 +2,12 @@ const images = require.context('/src/assets/icons/epg/svgmap', true);
|
|
|
2
2
|
|
|
3
3
|
let imageList = {}
|
|
4
4
|
let file
|
|
5
|
-
let
|
|
5
|
+
let svgListEpg = {}
|
|
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
|
+
svgListEpg[file] = file
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export default
|
|
13
|
+
export default svgListEpg;
|
|
@@ -2,12 +2,12 @@ const images = require.context('/src/assets/icons/publictransport/svgmap', true)
|
|
|
2
2
|
|
|
3
3
|
let imageList = {}
|
|
4
4
|
let file
|
|
5
|
-
let
|
|
5
|
+
let svgListPublicTransport = {}
|
|
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
|
+
svgListPublicTransport[file] = file
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export default
|
|
13
|
+
export default svgListPublicTransport;
|
|
@@ -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
|