hr-design-system-handlebars 1.38.1 → 1.38.3
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 +24 -0
- package/dist/assets/index.css +20 -3
- package/dist/assets/js/components/socialmedia/socialmediaCompact.feature.js +187 -0
- package/dist/views/components/article/components/podcast/podcast_episode_article.hbs +5 -5
- package/dist/views/components/article/components/podcast/podcast_playlist_all_episodes.hbs +1 -1
- package/dist/views/components/article/components/podcast/podcast_playlist_article.hbs +3 -3
- package/dist/views/components/socialmedia/socialmedia.hbs +78 -0
- package/dist/views/components/socialmedia/socialmedia_compact.hbs +25 -0
- package/dist/views/components/socialmedia/socialmedia_compact_icons.hbs +61 -0
- package/dist/views_static/components/article/components/podcast/podcast_episode_article.hbs +5 -5
- package/dist/views_static/components/article/components/podcast/podcast_playlist_all_episodes.hbs +1 -1
- package/dist/views_static/components/article/components/podcast/podcast_playlist_article.hbs +3 -3
- package/dist/views_static/components/socialmedia/socialmedia.hbs +78 -0
- package/dist/views_static/components/socialmedia/socialmedia_compact.hbs +25 -0
- package/dist/views_static/components/socialmedia/socialmedia_compact_icons.hbs +61 -0
- package/package.json +1 -1
- package/src/assets/fixtures/article/components/podcast/podcast_player_episode.json +6 -0
- package/src/assets/fixtures/article/components/podcast/podcast_player_playlist.json +6 -0
- package/src/assets/fixtures/socialsharing/socialsharing.inc.json +6 -0
- package/src/stories/views/components/article/components/podcast/fixtures/podcast_player_episode.json +1 -1
- package/src/stories/views/components/article/components/podcast/fixtures/podcast_player_playlist.json +1 -1
- package/src/stories/views/components/article/components/podcast/podcast_episode_article.hbs +5 -5
- package/src/stories/views/components/article/components/podcast/podcast_playlist_all_episodes.hbs +1 -1
- package/src/stories/views/components/article/components/podcast/podcast_playlist_article.hbs +3 -3
- package/src/stories/views/components/socialmedia/socialmedia.hbs +78 -0
- package/src/stories/views/components/socialmedia/socialmediaCompact.feature.js +187 -0
- package/src/stories/views/components/socialmedia/socialmedia_compact.hbs +25 -0
- package/src/stories/views/components/socialmedia/socialmedia_compact_icons.hbs +61 -0
|
@@ -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>
|
|
@@ -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>
|