hr-design-system-handlebars 1.38.0 → 1.38.2

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/assets/index.css +20 -3
  3. package/dist/assets/js/components/socialmedia/socialmediaCompact.feature.js +187 -0
  4. package/dist/assets/vendor/js/podcast_player.alpine.js +91 -0
  5. package/dist/views/components/article/components/podcast/podcast_episode_article.hbs +3 -3
  6. package/dist/views/components/article/components/podcast/podcast_playlist_all_episodes.hbs +1 -1
  7. package/dist/views/components/article/components/podcast/podcast_playlist_article.hbs +3 -3
  8. package/dist/views/components/socialmedia/socialmedia.hbs +78 -0
  9. package/dist/views/components/socialmedia/socialmedia_compact.hbs +25 -0
  10. package/dist/views/components/socialmedia/socialmedia_compact_icons.hbs +61 -0
  11. package/dist/views_static/components/article/components/podcast/podcast_episode_article.hbs +3 -3
  12. package/dist/views_static/components/article/components/podcast/podcast_playlist_all_episodes.hbs +1 -1
  13. package/dist/views_static/components/article/components/podcast/podcast_playlist_article.hbs +3 -3
  14. package/dist/views_static/components/socialmedia/socialmedia.hbs +78 -0
  15. package/dist/views_static/components/socialmedia/socialmedia_compact.hbs +25 -0
  16. package/dist/views_static/components/socialmedia/socialmedia_compact_icons.hbs +61 -0
  17. package/package.json +1 -1
  18. package/src/assets/vendor/js/podcast_player.alpine.js +91 -0
  19. package/src/stories/views/components/article/components/podcast/podcast_episode_article.hbs +3 -3
  20. package/src/stories/views/components/article/components/podcast/podcast_playlist_all_episodes.hbs +1 -1
  21. package/src/stories/views/components/article/components/podcast/podcast_playlist_article.hbs +3 -3
  22. package/src/stories/views/components/socialmedia/socialmedia.hbs +78 -0
  23. package/src/stories/views/components/socialmedia/socialmediaCompact.feature.js +187 -0
  24. package/src/stories/views/components/socialmedia/socialmedia_compact.hbs +25 -0
  25. package/src/stories/views/components/socialmedia/socialmedia_compact_icons.hbs +61 -0
  26. package/dist/assets/vendor/js/podcast_player.alpine.new.js +0 -286
  27. package/src/assets/vendor/js/podcast_player.alpine.new.js +0 -286
@@ -0,0 +1,78 @@
1
+ <div class="w-full flex px-3 first:border-t last:pb-6 border-[#797979] -socialsharing">
2
+ <div class="flex flex-wrap justify-start p-0 m-0 -mx-3">
3
+ <span class="inline-flex text-2xl font-heading">{{loca "share_headline" }}</span><!--
4
+ -->
5
+ <ul class="flex flex-wrap w-full px-5 lg:px-0 -socialsharing">
6
+ {{~#with this.twitterLink ~}}
7
+ <li class="inline-flex pl-10 mr-6 lg:ml-0">
8
+ <a class="link--shareIcon touchArea{{#with ../../this.content.trackingData}} js-load{{/with}}"
9
+ href="{{this}}"
10
+ target="_blank"
11
+ rel="noopener noreferrer"
12
+ title="{{loca "share_twitter_linktitle" }}"
13
+ {{#with ../../this.content.trackingData}}
14
+ data-hr-click-tracking='{"settings": [{"type":"uxAction","secondLevelId": "{{this.secondLevelId}}","clickLabel": "socialShareClick::twitter"}]}'
15
+ {{/with}}
16
+ >
17
+ {{~> components/base/image/icon _addClass="w-8 h-8 rounded-lg fill-[#55acee]" _icon="twitter" _iconmap="icons" ~}}
18
+ </a>
19
+ </li>
20
+ {{~/with~}}
21
+ {{~#with this.facebookLink ~}}
22
+ <li class="inline-flex pl-10 mr-6 lg:ml-0">
23
+ <a class="link--shareIcon touchArea{{#with ../../this.content.trackingData}} js-load{{/with}}"
24
+ href="{{this}}"
25
+ target="_blank"
26
+ rel="noopener noreferrer"
27
+ title="{{loca "share_facebook_linktitle" }}"
28
+ {{#with ../../this.content.trackingData}}
29
+ data-hr-click-tracking='{"settings": [{"type":"uxAction","secondLevelId": "{{this.secondLevelId}}","clickLabel": "socialShareClick::facebook"}]}'
30
+ {{/with}}
31
+ >
32
+ {{~> components/base/image/icon _addClass="icon--facebook" _icon="facebook-ds" _iconmap="icons" ~}}
33
+ </a>
34
+ </li>
35
+ {{~/with~}}
36
+ {{~#with this.whatsappLink ~}}
37
+ <li class="inline-flex pl-10 mr-6 lg:ml-0 list__item--whatsapp">
38
+ <a class="link--shareIcon touchArea{{#with ../../this.content.trackingData}} js-load{{/with}}"
39
+ href="{{this}}"
40
+ target="_blank"
41
+ rel="noopener noreferrer"
42
+ title="{{loca "share_whatsapp_linktitle" }}"
43
+ {{#with ../../this.content.trackingData}}
44
+ data-hr-click-tracking='{"settings": [{"type":"uxAction","secondLevelId": "{{this.secondLevelId}}","clickLabel": "socialShareClick::whatsapp"}]}'
45
+ {{/with}}
46
+ >
47
+ {{~> components/base/image/icon _addClass="icon--whatsapp" _icon="whatsapp-ds" _iconmap="icons" ~}}
48
+ </a>
49
+ </li>
50
+ {{~/with~}}
51
+ {{~#with this.mailtoLink ~}}
52
+ <li class="inline-flex pl-10 mr-6 lg:ml-0">
53
+ <a class="link--shareIcon touchArea{{#with ../../this.content.trackingData}} js-load{{/with}}"
54
+ href="{{this}}"
55
+ title="{{loca "share_mail_linktitle" }}"
56
+ {{#with ../../this.content.trackingData}}
57
+ data-hr-click-tracking='{"settings": [{"type":"uxAction","secondLevelId": "{{this.secondLevelId}}","clickLabel": "socialShareClick::mailto"}]}'
58
+ {{/with}}
59
+ >
60
+ {{~> components/base/image/icon _addClass="icon--mailto" _icon="mail-ds" _iconmap="icons" ~}}
61
+ </a>
62
+ </li>
63
+ {{~/with~}}
64
+
65
+ <li class="inline-flex pl-10 mr-6 lg:ml-0">
66
+ <a class="link--shareIcon touchArea{{#with ../this.content.trackingData}} js-load{{/with}}"
67
+ href="javascript:window.print()"
68
+ title="{{loca "share_print_linktitle" }}"
69
+ {{#with ../this.content.trackingData}}
70
+ data-hr-click-tracking='{"settings": [{"type":"uxAction","secondLevelId": "{{this.secondLevelId}}","clickLabel": "socialShareClick::printbutton"}]}'
71
+ {{/with}}
72
+ >
73
+ {{~> components/base/image/icon _addClass="icon--print" _icon="print" _iconmap="icons" ~}}
74
+ </a>
75
+ </li>
76
+ </ul>
77
+ </div>
78
+ </div>
@@ -0,0 +1,25 @@
1
+ <div class="c-shareCompact">
2
+ <div class="c-shareCompact__wrapper -isClosed js-share-compact-wrapper js-load"
3
+ data-hr-share-compact='{"title":"{{../this.escapedTitle}}", "url":"{{../this.socialSharingUrl}}" }'>
4
+ <div class="c-shareCompact__mainButton">
5
+ <button class="link--shareIcon touchArea "
6
+ id="{{../this.anchor}}-s"
7
+ rel="noopener noreferrer"
8
+ title="{{loca "share_headline" }}"
9
+ >
10
+ {{~> base/image/icon _addClass="icon--teilen-button" _icon="teilen-button" _iconmap="icons" ~}}
11
+ </button>
12
+
13
+ </div>
14
+ <div class="c-shareCompact__shareButtons hide">
15
+ <ul>
16
+ {{~> modules/socialmedia/shareCompact-icons ~}}
17
+ </ul>
18
+ </div>
19
+ <div class="c-shareCompact__message hide">
20
+ {{~> base/image/icon _addClass="" _icon="status-done" _iconmap="icons" ~}}
21
+ {{loca "ticker_sharing_message" }}
22
+ </div>
23
+ </div>
24
+
25
+ </div>
@@ -0,0 +1,61 @@
1
+ {{~#with this.twitterLink ~}}
2
+ <li class="c-shareCompact__item">
3
+ <a class="c-shareCompact__link touchArea js-shareLinkTwitter"
4
+ href="{{this}}"
5
+ target="_blank"
6
+ rel="noopener noreferrer"
7
+ title="{{loca "share_twitter_linktitle" }}"
8
+ >
9
+ {{~> base/image/icon _addClass="icon--twitter" _icon="twitter" _iconmap="icons" ~}}
10
+ </a>
11
+ </li>
12
+ {{~/with~}}
13
+ {{~#with this.facebookLink ~}}
14
+ <li class="c-shareCompact__item">
15
+ <a class="c-shareCompact__link touchArea js-shareLinkFacebook"
16
+ href="{{this}}"
17
+ target="_blank"
18
+ rel="noopener noreferrer"
19
+ title="{{loca "share_facebook_linktitle" }}"
20
+ >
21
+ {{~> base/image/icon _addClass="icon--facebook" _icon="facebook" _iconmap="icons" ~}}
22
+ </a>
23
+ </li>
24
+ {{~/with~}}
25
+ {{~#with this.whatsappLink ~}}
26
+ <li class="c-shareCompact__item -whatsapp">
27
+ <a class="c-shareCompact__link touchArea js-shareLinkWhatsapp"
28
+ href="{{this}}"
29
+ target="_blank"
30
+ rel="noopener noreferrer"
31
+ title="{{loca "share_whatsapp_linktitle" }}"
32
+ >
33
+ {{~> base/image/icon _addClass="icon--whatsapp" _icon="whatsapp" _iconmap="icons" ~}}
34
+ </a>
35
+ </li>
36
+ {{~/with~}}
37
+ {{~#with this.mailtoLink ~}}
38
+ <li class="c-shareCompact__item ">
39
+ <a class="c-shareCompact__link touchArea js-shareLinkMail"
40
+ href="{{this}}"
41
+ title="{{loca "share_mail_linktitle" }}"
42
+ {{#with ../../this.content.trackingData}}
43
+ data-hr-click-tracking='{"settings": [{"type":"uxAction","secondLevelId": "{{this.secondLevelId}}","clickLabel": "newSocialShareClick::compact-mailto"}]}'
44
+ {{/with}}
45
+ >
46
+ {{~> base/image/icon _addClass="icon--mailto" _icon="mail" _iconmap="icons" ~}}
47
+ </a>
48
+ </li>
49
+ {{~/with~}}
50
+
51
+ <li class="c-shareCompact__item -copy">
52
+ <button class="c-shareCompact__link touchArea js-shareLinkCopy"
53
+
54
+ title="{{loca "share_copy_linktitle" }}"
55
+ {{#with ../../this.content.trackingData}}
56
+ data-hr-click-tracking='{"settings": [{"type":"uxAction","secondLevelId": "{{this.secondLevelId}}","clickLabel": "newSocialShareClick::compact-copy"}]}'
57
+ {{/with}}
58
+ >
59
+ {{~> base/image/icon _addClass="icon--mailto" _icon="copy" _iconmap="icons" ~}}
60
+ </button>
61
+ </li>
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.38.0",
9
+ "version": "1.38.2",
10
10
  "scripts": {
11
11
  "test": "echo \"Error: no test specified\" && exit 1",
12
12
  "storybook": "storybook dev -p 6006 public",
@@ -56,12 +56,103 @@ export default function playaudio() {
56
56
  _player.init = false
57
57
  _player.firstPlay = true
58
58
 
59
+ _player.audioElement.addEventListener('play', handlePlay.bind(this))
60
+ _player.audioElement.addEventListener('playing', handlePlaying.bind(this))
61
+ _player.audioElement.addEventListener('pause', handlePause.bind(this))
62
+ _player.audioElement.addEventListener('waiting', handleWaiting.bind(this))
63
+ _player.audioElement.addEventListener('ended', handleStopped.bind(this))
64
+
59
65
  // this.playerCount == 0 ? _player.range.parentNode.classList.remove('hidden') : _player.range.parentNode.classList.add('hidden')
60
66
  this.playerCount++
61
67
 
62
68
  this.playlist[id] = _player
63
69
 
70
+ const settings = JSON.parse(this.playlist[id].audioElement.dataset.propMediaMetadata)
71
+ const avContent = {
72
+ av_content_id: settings.piano.av_content_id,
73
+ av_content: settings.piano.av_content,
74
+ av_content_type: settings.piano.av_content_type,
75
+ av_content_duration: settings.piano.av_content_duration,
76
+ av_broadcasting_type: settings.piano.av_broadcasting_type,
77
+ av_content_theme1: settings.piano.av_content_theme1,
78
+ hr_document_type: settings.piano.hr_document_type,
79
+ site_level2_id: settings.piano.site_level2_id,
80
+ }
81
+
82
+ if (settings.piano.av_content_theme2) {
83
+ avContent.av_content_theme2 = settings.piano.av_content_theme2
84
+ }
85
+ if (settings.piano.av_content_theme3) {
86
+ avContent.av_content_theme3 = settings.piano.av_content_theme3
87
+ }
88
+
89
+ function handlePlay(event) {
90
+ this.dispatchCustomEvent('hr-avInsights:play', {
91
+ data: {
92
+ playerId: getPlayerIdForAvInsights(),
93
+ cursorPosition: _player.audioElement.currentTime * 1000,
94
+ avContent: avContent,
95
+ },
96
+ })
97
+ }
98
+
99
+ function handlePlaying(event) {
100
+ if (_player.firstPlay) {
101
+ this.dispatchCustomEvent('hr-avInsights:playback-start', {
102
+ data: {
103
+ playerId: getPlayerIdForAvInsights(),
104
+ cursorPosition: _player.audioElement.currentTime * 1000,
105
+ avContent: avContent,
106
+ },
107
+ })
108
+ _player.firstPlay = false
109
+ } else {
110
+ this.dispatchCustomEvent('hr-avInsights:playback-resumed', {
111
+ data: {
112
+ playerId: getPlayerIdForAvInsights(),
113
+ cursorPosition: _player.audioElement.currentTime * 1000,
114
+ avContent: avContent,
115
+ },
116
+ })
117
+ }
118
+ }
119
+
120
+ function handleWaiting(event) {
121
+ this.dispatchCustomEvent('hr-avInsights:buffer-start', {
122
+ data: {
123
+ playerId: getPlayerIdForAvInsights(),
124
+ cursorPosition: _player.audioElement.currentTime * 1000,
125
+ avContent: avContent,
126
+ },
127
+ })
128
+ }
129
+
130
+ function handlePause(event) {
131
+ this.dispatchCustomEvent('hr-avInsights:playback-paused', {
132
+ data: {
133
+ playerId: getPlayerIdForAvInsights(),
134
+ cursorPosition: _player.audioElement.currentTime * 1000,
135
+ avContent: avContent,
136
+ },
137
+ })
138
+ }
139
+
140
+ function handleStopped(event) {
141
+ this.dispatchCustomEvent('hr-avInsights:playback-stopped', {
142
+ data: {
143
+ playerId: getPlayerIdForAvInsights(),
144
+ cursorPosition: _player.audioElement.currentTime * 1000,
145
+ avContent: avContent,
146
+ },
147
+ })
148
+ _player.firstPlay = true
149
+ }
150
+
151
+ function getPlayerIdForAvInsights() {
152
+ return _player.id + '-' + avContent.av_content_id
153
+ }
64
154
  },
155
+
65
156
  listenToGlobalStop() {
66
157
  console.log('global listener init')
67
158
  document.addEventListener(
@@ -19,7 +19,7 @@
19
19
  aria-label='{{loca "appendix_title"}}'>
20
20
  <div class="c-appendix">
21
21
  {{#unless _webview}}
22
- {{~#with this.backLinkUrl ~}}
22
+ {{!-- {{~#with this.backLinkUrl ~}}
23
23
  {{~> components/base/link/backlink _addClass="appendix__backlink" ~}}
24
24
  {{~/with~}}
25
25
 
@@ -29,10 +29,10 @@
29
29
 
30
30
  {{~#with this.topictags ~}}
31
31
  {{~> modules/topictag/topictag-list ~}}
32
- {{~/with~}}
32
+ {{~/with~}} --}}
33
33
 
34
34
  {{~#with this.socialSharing ~}}
35
- {{~> modules/socialmedia/shareit ~}}
35
+ {{~> components/socialmedia/socialmedia ~}}
36
36
  {{~/with~}}
37
37
  {{/unless}}
38
38
  </div>
@@ -11,7 +11,7 @@
11
11
  {{~/with~}}
12
12
 
13
13
  {{~#with this.socialSharing ~}}
14
- {{~> modules/socialmedia/shareit ~}}
14
+ {{~> components/socialmedia/socialmedia ~}}
15
15
  {{~/with~}}
16
16
  {{/unless}}
17
17
  {{~#with this.programReference~}}
@@ -21,12 +21,12 @@
21
21
  <aside class="grid order-2 col-span-3 py-6" aria-label='{{loca "appendix_title"}}'>
22
22
  <div class="c-appendix">
23
23
  {{#unless _webview}}
24
- {{~#with this.backLinkUrl ~}}
24
+ {{!-- {{~#with this.backLinkUrl ~}}
25
25
  {{~> base/link/backlink _addClass="appendix__backlink" ~}}
26
- {{~/with~}}
26
+ {{~/with~}} --}}
27
27
 
28
28
  {{~#with this.socialSharing ~}}
29
- {{~> modules/socialmedia/shareit ~}}
29
+ {{~> components/socialmedia/socialmedia ~}}
30
30
  {{~/with~}}
31
31
  {{/unless}}
32
32
  {{~#with this.programReference~}}
@@ -0,0 +1,78 @@
1
+ <div class="w-full flex px-3 first:border-t last:pb-6 border-[#797979] -socialsharing">
2
+ <div class="flex flex-wrap justify-start p-0 m-0 -mx-3">
3
+ <span class="inline-flex text-2xl font-heading">{{loca "share_headline" }}</span><!--
4
+ -->
5
+ <ul class="flex flex-wrap w-full px-5 lg:px-0 -socialsharing">
6
+ {{~#with this.twitterLink ~}}
7
+ <li class="inline-flex pl-10 mr-6 lg:ml-0">
8
+ <a class="link--shareIcon touchArea{{#with ../../this.content.trackingData}} js-load{{/with}}"
9
+ href="{{this}}"
10
+ target="_blank"
11
+ rel="noopener noreferrer"
12
+ title="{{loca "share_twitter_linktitle" }}"
13
+ {{#with ../../this.content.trackingData}}
14
+ data-hr-click-tracking='{"settings": [{"type":"uxAction","secondLevelId": "{{this.secondLevelId}}","clickLabel": "socialShareClick::twitter"}]}'
15
+ {{/with}}
16
+ >
17
+ {{~> components/base/image/icon _addClass="w-8 h-8 rounded-lg fill-[#55acee]" _icon="twitter" _iconmap="icons" ~}}
18
+ </a>
19
+ </li>
20
+ {{~/with~}}
21
+ {{~#with this.facebookLink ~}}
22
+ <li class="inline-flex pl-10 mr-6 lg:ml-0">
23
+ <a class="link--shareIcon touchArea{{#with ../../this.content.trackingData}} js-load{{/with}}"
24
+ href="{{this}}"
25
+ target="_blank"
26
+ rel="noopener noreferrer"
27
+ title="{{loca "share_facebook_linktitle" }}"
28
+ {{#with ../../this.content.trackingData}}
29
+ data-hr-click-tracking='{"settings": [{"type":"uxAction","secondLevelId": "{{this.secondLevelId}}","clickLabel": "socialShareClick::facebook"}]}'
30
+ {{/with}}
31
+ >
32
+ {{~> components/base/image/icon _addClass="icon--facebook" _icon="facebook-ds" _iconmap="icons" ~}}
33
+ </a>
34
+ </li>
35
+ {{~/with~}}
36
+ {{~#with this.whatsappLink ~}}
37
+ <li class="inline-flex pl-10 mr-6 lg:ml-0 list__item--whatsapp">
38
+ <a class="link--shareIcon touchArea{{#with ../../this.content.trackingData}} js-load{{/with}}"
39
+ href="{{this}}"
40
+ target="_blank"
41
+ rel="noopener noreferrer"
42
+ title="{{loca "share_whatsapp_linktitle" }}"
43
+ {{#with ../../this.content.trackingData}}
44
+ data-hr-click-tracking='{"settings": [{"type":"uxAction","secondLevelId": "{{this.secondLevelId}}","clickLabel": "socialShareClick::whatsapp"}]}'
45
+ {{/with}}
46
+ >
47
+ {{~> components/base/image/icon _addClass="icon--whatsapp" _icon="whatsapp-ds" _iconmap="icons" ~}}
48
+ </a>
49
+ </li>
50
+ {{~/with~}}
51
+ {{~#with this.mailtoLink ~}}
52
+ <li class="inline-flex pl-10 mr-6 lg:ml-0">
53
+ <a class="link--shareIcon touchArea{{#with ../../this.content.trackingData}} js-load{{/with}}"
54
+ href="{{this}}"
55
+ title="{{loca "share_mail_linktitle" }}"
56
+ {{#with ../../this.content.trackingData}}
57
+ data-hr-click-tracking='{"settings": [{"type":"uxAction","secondLevelId": "{{this.secondLevelId}}","clickLabel": "socialShareClick::mailto"}]}'
58
+ {{/with}}
59
+ >
60
+ {{~> components/base/image/icon _addClass="icon--mailto" _icon="mail-ds" _iconmap="icons" ~}}
61
+ </a>
62
+ </li>
63
+ {{~/with~}}
64
+
65
+ <li class="inline-flex pl-10 mr-6 lg:ml-0">
66
+ <a class="link--shareIcon touchArea{{#with ../this.content.trackingData}} js-load{{/with}}"
67
+ href="javascript:window.print()"
68
+ title="{{loca "share_print_linktitle" }}"
69
+ {{#with ../this.content.trackingData}}
70
+ data-hr-click-tracking='{"settings": [{"type":"uxAction","secondLevelId": "{{this.secondLevelId}}","clickLabel": "socialShareClick::printbutton"}]}'
71
+ {{/with}}
72
+ >
73
+ {{~> components/base/image/icon _addClass="icon--print" _icon="print" _iconmap="icons" ~}}
74
+ </a>
75
+ </li>
76
+ </ul>
77
+ </div>
78
+ </div>
@@ -0,0 +1,187 @@
1
+ import { fireEvent, getJSONCookie, hr$, listen, setJSONCookie, unlisten } from 'hrQuery'
2
+ import { uxAction } from 'base/tracking/atiHelper.subfeature'
3
+
4
+ const ShareCompact = (context) => {
5
+ const { options } = context
6
+ const { element: rootElement } = context
7
+ const isClosedClass = '-isClosed'
8
+ const mainButton = hr$('.c-shareCompact__mainButton', rootElement)[0]
9
+ const shareButtons = hr$('.c-shareCompact__shareButtons', rootElement)[0]
10
+ const messageDiv = hr$('.c-shareCompact__message', rootElement)[0]
11
+ const { url, title } = options
12
+ const isMobileApple = navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)/i)
13
+ const isMobileOther = navigator.userAgent.match(
14
+ /(Android)|(webOS)|(Blackberry)|(Windows Phone)/i
15
+ )
16
+ const isWebview = window.parent.document.documentElement.classList.contains('webview')
17
+ //const isWebview = window.location.href.match(/(app)(\.[a-zA-Z]*)(\.de)/i) //App URL ...app.hr.de
18
+ //const isWebview = window.location.href.match(/(app)/i)
19
+ let cookie = {}
20
+ const trackingCookieLifetime = 1000 * 60 * 60 * 24 * 365 * 10
21
+
22
+ const shareLinks = {
23
+ twitter: hr$('.js-shareLinkTwitter', rootElement)[0],
24
+ facebook: hr$('.js-shareLinkFacebook', rootElement)[0],
25
+ whatsapp: hr$('.js-shareLinkWhatsapp', rootElement)[0],
26
+ mail: hr$('.js-shareLinkMail', rootElement)[0],
27
+ copy2clip: hr$('.js-shareLinkCopy', rootElement)[0],
28
+ }
29
+
30
+ let isClosed = true
31
+ const readAppVersionCookie = function () {
32
+ cookie = getJSONCookie('appSettings') || {}
33
+ }
34
+ const writeAppVersionCookie = function () {
35
+ cookie = '209'
36
+ setJSONCookie('hsAppBuildNumber', cookie, trackingCookieLifetime)
37
+ }
38
+ const closeMenu = () => {
39
+ console.log('closeMenu')
40
+ rootElement.classList.add(isClosedClass)
41
+ shareButtons.classList.add('hide')
42
+ isClosed = true
43
+ }
44
+ const openMenu = () => {
45
+ console.log('openMenu')
46
+ rootElement.classList.remove(isClosedClass)
47
+ shareButtons.classList.remove('hide')
48
+ isClosed = false
49
+ }
50
+ const nativeShare = () => {
51
+ navigator
52
+ .share({
53
+ title,
54
+ url,
55
+ })
56
+ .then(function () {
57
+ console.log('Danke fürs Teilen!')
58
+ })
59
+ .catch(console.error)
60
+ uxAction('newSocialShareClick::mainButton-nativeShare')
61
+ }
62
+ const handleClickOnMainButton = (event) => {
63
+ event.stopPropagation()
64
+ if (isWebview) {
65
+ readAppVersionCookie()
66
+ if (isMobileApple) {
67
+ console.log('apple mobile browser')
68
+ nativeShare()
69
+ } else if (isMobileOther) {
70
+ console.log('non-apple mobile browser')
71
+ /*Check Build Version of App*/
72
+ if (cookie['fireCustomJsShareEvent'] === true) {
73
+ /*Custom Event für App unter Android*/
74
+ fireEvent('hr:global:shareCompactClickAndroidApp', {
75
+ title: title,
76
+ url: url,
77
+ })
78
+ console.log('Custom-Event für Android')
79
+ } else {
80
+ fireEvent('hr:global:shareCompactClick', {
81
+ origin: rootElement,
82
+ currentTarget: event.currentTarget,
83
+ })
84
+ }
85
+ }
86
+ console.log('sharing - for app channel')
87
+ } else {
88
+ if ((navigator.share && isMobileApple) || (navigator.share && isMobileOther)) {
89
+ console.log('native share in mobile view supported')
90
+ nativeShare()
91
+ } else {
92
+ fireEvent('hr:global:shareCompactClick', {
93
+ origin: rootElement,
94
+ currentTarget: event.currentTarget,
95
+ })
96
+ }
97
+ console.log('sharing - no app channel')
98
+ }
99
+ }
100
+
101
+ const copyToClipboard = (event) => {
102
+ const el = document.createElement('textarea')
103
+ el.value = url
104
+ el.setAttribute('readonly', '')
105
+ el.style.position = 'absolute'
106
+ el.style.left = '-9999px'
107
+ document.body.appendChild(el)
108
+ el.select()
109
+ document.execCommand('copy')
110
+ document.body.removeChild(el)
111
+
112
+ messageDiv.classList.remove('hide')
113
+
114
+ window.setTimeout(() => {
115
+ messageDiv.classList.add('hide')
116
+ }, 2000)
117
+ }
118
+
119
+ const checkIfCloseOrOpen = (event) => {
120
+ if (isClosed) {
121
+ if (event.detail.origin === rootElement) {
122
+ uxAction('newSocialShareClick::mainButton-open')
123
+ openMenu()
124
+ listen('click', handleClickOnMainButton, document)
125
+ }
126
+ } else {
127
+ if (event.detail.currentTarget === mainButton) {
128
+ uxAction('newSocialShareClick::mainButton-close')
129
+ } else {
130
+ uxAction('newSocialShareClick::mainButton-close-outside')
131
+ }
132
+ closeMenu()
133
+ unlisten('click', handleClickOnMainButton, document)
134
+ }
135
+ }
136
+ const initializeShareLinksTracking = () => {
137
+ listen(
138
+ 'click',
139
+ function () {
140
+ console.log('twitter')
141
+ uxAction('newSocialShareClick::twitter')
142
+ },
143
+ shareLinks.twitter
144
+ )
145
+ listen(
146
+ 'click',
147
+ function () {
148
+ console.log('facebook')
149
+ uxAction('newSocialShareClick::facebook')
150
+ },
151
+ shareLinks.facebook
152
+ )
153
+ listen(
154
+ 'click',
155
+ function () {
156
+ console.log('whatsapp')
157
+ uxAction('newSocialShareClick::whatsapp')
158
+ },
159
+ shareLinks.whatsapp
160
+ )
161
+ listen(
162
+ 'click',
163
+ function () {
164
+ console.log('mail')
165
+ uxAction('newSocialShareClick::mail')
166
+ },
167
+ shareLinks.mail
168
+ )
169
+ listen(
170
+ 'click',
171
+ function () {
172
+ console.log('copy2clipboard')
173
+ uxAction('newSocialShareClick::copy2clipboard')
174
+ },
175
+ shareLinks.copy2clip
176
+ )
177
+ }
178
+
179
+ listen('hr:global:shareCompactClick', checkIfCloseOrOpen)
180
+ listen('click', handleClickOnMainButton, mainButton)
181
+ listen('click', copyToClipboard, shareLinks.copy2clip)
182
+ initializeShareLinksTracking()
183
+ /*if (isWebview) {
184
+ writeAppVersionCookie()
185
+ }*/
186
+ }
187
+ export default ShareCompact
@@ -0,0 +1,25 @@
1
+ <div class="c-shareCompact">
2
+ <div class="c-shareCompact__wrapper -isClosed js-share-compact-wrapper js-load"
3
+ data-hr-share-compact='{"title":"{{../this.escapedTitle}}", "url":"{{../this.socialSharingUrl}}" }'>
4
+ <div class="c-shareCompact__mainButton">
5
+ <button class="link--shareIcon touchArea "
6
+ id="{{../this.anchor}}-s"
7
+ rel="noopener noreferrer"
8
+ title="{{loca "share_headline" }}"
9
+ >
10
+ {{~> base/image/icon _addClass="icon--teilen-button" _icon="teilen-button" _iconmap="icons" ~}}
11
+ </button>
12
+
13
+ </div>
14
+ <div class="c-shareCompact__shareButtons hide">
15
+ <ul>
16
+ {{~> modules/socialmedia/shareCompact-icons ~}}
17
+ </ul>
18
+ </div>
19
+ <div class="c-shareCompact__message hide">
20
+ {{~> base/image/icon _addClass="" _icon="status-done" _iconmap="icons" ~}}
21
+ {{loca "ticker_sharing_message" }}
22
+ </div>
23
+ </div>
24
+
25
+ </div>