@latest-thinking/lt-player 1.0.5-m → 1.0.5-n

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latest-thinking/lt-player",
3
- "version": "1.0.5-m",
3
+ "version": "1.0.5-n",
4
4
  "description": "LT player.",
5
5
  "main": "dist/js/lt-player-main.js",
6
6
  "module": "dist/js/lt-player-main.js",
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  @mixin modal-h4 {
12
- font-size: $lt-player-font-size-xxl;
12
+ font-size: $lt-player-font-size-xxl2;
13
13
  font-weight: $lt-player-font-weight-lg;
14
14
  margin-bottom: 0;
15
15
  margin-top: 16px;
@@ -48,6 +48,17 @@
48
48
 
49
49
  .lt-player-portrate--mobile {
50
50
  &.lt-player--portrait {
51
+ &__lg,
52
+ &__md,
53
+ &__sm,
54
+ &__xs {
55
+ .player-lt {
56
+ &__modal-body {
57
+ padding: 0;
58
+ }
59
+ }
60
+ }
61
+
51
62
  &__xs {
52
63
  .player-lt {
53
64
  &__mobile {
@@ -60,7 +71,7 @@
60
71
  h6,
61
72
  p,
62
73
  b,
63
- stronb,
74
+ strong,
64
75
  span {
65
76
  font-size: $lt-player-font-size-base;
66
77
  }
@@ -110,6 +121,7 @@
110
121
  text-align: left;
111
122
  padding: 16px;
112
123
  overflow: auto;
124
+ font-family: $lt-font-family-base;
113
125
 
114
126
  button,
115
127
  a {
@@ -197,13 +209,35 @@
197
209
  transform: translate(-50%, -50%);
198
210
  background-color: $default-lt-player-white;
199
211
  color: $default-lt-player-modal-color;
200
- padding: 32px 40px;
201
212
  border-radius: 0;
202
213
  font-family: $lt-font-family-base;
203
214
  width: 100%;
204
215
  max-height: 540px;
205
- max-width: 715px;
206
216
  overflow: auto;
217
+ max-width: 620px;
218
+ padding: 40px 0;
219
+
220
+ span {
221
+ margin-right: 40px;
222
+ }
223
+
224
+ .modal-flex {
225
+ display: flex;
226
+ align-items: end;
227
+ gap: 24px;
228
+ flex-wrap: wrap;
229
+
230
+ img {
231
+ max-width: 220px;
232
+ margin-bottom: 0;
233
+ flex: 50%;
234
+ }
235
+
236
+ h3 {
237
+ flex: 50%;
238
+ word-break: unset;
239
+ }
240
+ }
207
241
 
208
242
  &::-webkit-scrollbar-track {
209
243
  -webkit-box-shadow: transparent;
@@ -220,7 +254,7 @@
220
254
  }
221
255
 
222
256
  hr {
223
- margin: 16px 0;
257
+ margin: 24px 0;
224
258
  border-top: 1px solid $default-lt-button-other;
225
259
  }
226
260
 
@@ -263,16 +297,24 @@
263
297
  @include modal-p;
264
298
  margin-top: 8px;
265
299
  margin-bottom: 32px;
300
+
301
+ &:last-child {
302
+ margin-bottom: 0;
303
+ }
266
304
  }
267
305
  }
268
306
 
307
+ &__modal-body {
308
+ padding: 0 40px;
309
+ }
310
+
269
311
  &__close-button {
270
312
  z-index: 20;
271
313
  float: right;
272
314
  width: 24px;
273
- font-size: $lt-player-font-size-xxl2 !important;
315
+ font-size: $lt-player-font-size-xxxl2 !important;
274
316
  line-height: 1;
275
- padding: 0 .2em .15em;
317
+ padding: 0;
276
318
  text-align: center;
277
319
  cursor: pointer;
278
320
  border-radius: 0.25rem;
@@ -115,6 +115,7 @@
115
115
 
116
116
  .content {
117
117
  display: flex;
118
+ width: 100%;
118
119
  flex-direction: column;
119
120
  justify-content: space-between;
120
121
  position: absolute;
@@ -186,6 +187,7 @@
186
187
  @extend %lt-player-btn;
187
188
  background-color: $default-lt-button-other;
188
189
  margin-left: auto;
190
+ padding: 12px 12px;
189
191
  }
190
192
  }
191
193
  }
@@ -7,6 +7,10 @@
7
7
  &__controls-enable-settings {
8
8
  .top-controllers {
9
9
  padding: 40px 40px 0;
10
+
11
+ &__background {
12
+ display: none;
13
+ }
10
14
  }
11
15
  }
12
16
  }
@@ -201,12 +201,8 @@ export class LTPlayerSetup {
201
201
  return processVideo();
202
202
 
203
203
  }
204
-
205
204
  }
206
205
 
207
-
208
-
209
-
210
206
  /**
211
207
  * Set Additional Info
212
208
  * @param playerConfig
@@ -215,15 +211,24 @@ export class LTPlayerSetup {
215
211
 
216
212
  const additionalInfoContainer:HTMLElement = playerConfig.body.playerContainer.querySelector('.lt-player-additional-info');
217
213
 
218
- if (!additionalInfoContainer) {
219
- this.additionalInfoService = null;
214
+ if (additionalInfoContainer) {
215
+ this.additionalInfoService = new LTPLayerAddInfo.Controller();
216
+ this.additionalInfoService.setContainer(additionalInfoContainer);
220
217
  return;
221
218
  }
222
219
 
223
- this.additionalInfoService = new LTPLayerAddInfo.Controller();
224
- this.additionalInfoService.set(additionalInfoContainer);
225
220
 
221
+ if (playerConfig.body.additionalInfo !== undefined && Object.keys(playerConfig.body.additionalInfo).length > 0) {
222
+ this.additionalInfoService = new LTPLayerAddInfo.Controller();
223
+ this.additionalInfoService.setConfig(playerConfig.body.additionalInfo);
224
+ return;
225
+ }
226
+
227
+
228
+ this.additionalInfoService = null;
226
229
  return;
230
+
231
+
227
232
  }
228
233
 
229
234
  /**
@@ -40,6 +40,11 @@ export namespace LTPlayer {
40
40
  this.miniPlayer = new LTPlayerMini();
41
41
  this.setPlayerConfig(configData.body, configData.version);
42
42
  this.initPlayer();
43
+
44
+ if (this.additionalInfoService) {
45
+ this.additionalInfoService.init(this, this.playerConfig.getPlayerId(), this.iconService, this.templateService)
46
+ }
47
+
43
48
  this.setEvents();
44
49
 
45
50
  return true;
@@ -42,7 +42,7 @@ export namespace LTPLayerAddInfo {
42
42
  export class Controller extends LTPlayerAddInfoManager {
43
43
  activePlayer: Plyr;
44
44
 
45
- set(container: HTMLElement) {
45
+ setContainer(container: HTMLElement) {
46
46
  this.container = container;
47
47
  this.setDataContent();
48
48
  }
@@ -61,6 +61,14 @@ export namespace LTPLayerAddInfo {
61
61
  })
62
62
  }
63
63
 
64
+ setConfig(config: defaultType) {
65
+ Object.keys(config).forEach(item => {
66
+ if (Object.keys(config[item]).length > 0) {
67
+ Object.assign(this.additionalData, {[item] : config[item]})
68
+ }
69
+ })
70
+ }
71
+
64
72
  init(player: LTPlayer.PortraitType | LTPlayer.LandscapeType, playerId: number, iconService: IconsService, templateService: TemplateService) {
65
73
 
66
74
  if (Object.keys(this.additionalData).length === 0) {
@@ -101,7 +109,6 @@ export namespace LTPLayerAddInfo {
101
109
 
102
110
  setCurrentPlayerPlay(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType, event: PlyrEvent) {
103
111
  this.activePlayer = event.detail.plyr;
104
- console.log(this.activePlayer.elements.container)
105
112
  }
106
113
  remove(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
107
114
 
@@ -132,7 +139,9 @@ export namespace LTPLayerAddInfo {
132
139
 
133
140
  switch (this.controller.device) {
134
141
  case 'mobile':
135
- this.mobile();
142
+ this.controller.plyr.on('ready', () => {
143
+ this.mobile();
144
+ })
136
145
  break
137
146
  case 'desktop':
138
147
  this.desktop();
@@ -176,7 +185,6 @@ export namespace LTPLayerAddInfo {
176
185
 
177
186
 
178
187
  desktop() {
179
- const playerContainer = this.controller.plyr.elements.container;
180
188
  const icons: defaultType = this.controller.iconService.getIconsByComponent('additionalInfo');
181
189
 
182
190
  let templateData: { target: string; icon: any; }[] = [];
@@ -204,7 +212,6 @@ export namespace LTPLayerAddInfo {
204
212
  exist: 'true',
205
213
  buttons: templateData
206
214
  });
207
-
208
215
  this.controller.playerInstance.windowService.setEventAddInfo(buttonsTemplate, this.desktopEvents, this.controller);
209
216
  }
210
217
  }
@@ -37,12 +37,25 @@ export namespace LTPlayerAdditionalInfo {
37
37
  }
38
38
 
39
39
  const createInformationModal = (info: additionalInformation, key: string) => {
40
- let modalTemplate = controller.templateService.getAdditionalInfo({
41
- desktop : true,
42
- modal : true,
43
- id : `${key}-${controller.playerInstance.playerConfig.getPlayerId()}`,
44
- data : info
45
- })
40
+
41
+ let modalTemplate = null;
42
+
43
+ if (typeof info === 'object') {
44
+ modalTemplate = controller.templateService.getAdditionalInfo({
45
+ desktop : true,
46
+ modal : true,
47
+ id : `${key}-${controller.playerInstance.playerConfig.getPlayerId()}`,
48
+ object_data : true,
49
+ [key] : info
50
+ })
51
+ } else {
52
+ modalTemplate = controller.templateService.getAdditionalInfo({
53
+ desktop : true,
54
+ modal : true,
55
+ id : `${key}-${controller.playerInstance.playerConfig.getPlayerId()}`,
56
+ data : info
57
+ })
58
+ }
46
59
 
47
60
  document.querySelector('body').insertAdjacentHTML("afterend", modalTemplate);
48
61
  }
@@ -104,12 +117,24 @@ export namespace LTPlayerAdditionalInfo {
104
117
  }
105
118
 
106
119
  const createInformationModal = (info: additionalInformation, key: string) => {
107
- let modalTemplate = instance.templateService.getAdditionalInfo({
108
- mobile : true,
109
- modal : true,
110
- data : info,
111
- [controller.device] : true
112
- })
120
+ let modalTemplate = null;
121
+
122
+ if (typeof info === 'object') {
123
+ modalTemplate = controller.templateService.getAdditionalInfo({
124
+ mobile : true,
125
+ modal : true,
126
+ [controller.device] : true,
127
+ object_data : true,
128
+ [key] : info
129
+ })
130
+ } else {
131
+ modalTemplate = controller.templateService.getAdditionalInfo({
132
+ mobile : true,
133
+ modal : true,
134
+ data : info,
135
+ [controller.device] : true
136
+ })
137
+ }
113
138
 
114
139
  const playerControlsContainer = instance.plyr.elements.controls;
115
140
  const modal = playerControlsContainer.querySelector('.player-lt__modal__mobile');
@@ -207,10 +207,6 @@ export namespace LTPlayerConfigProcessor {
207
207
  return null
208
208
  }
209
209
 
210
- if (version === 1) {
211
- return null;
212
- }
213
-
214
210
  type shareDataConfig = {
215
211
  canonicalUrl : string,
216
212
  embedUrl : string,
@@ -223,6 +219,15 @@ export namespace LTPlayerConfigProcessor {
223
219
  title : undefined
224
220
  }
225
221
 
222
+ if (version === 1) {
223
+ data = {
224
+ canonicalUrl: data.canonical_url ?? null,
225
+ embedUrl: `${window.location.origin}/embed/${data.id}`,
226
+ title: data.title ?? null,
227
+ };
228
+ }
229
+
230
+
226
231
  if (Object.keys(data).length === 0) {
227
232
  return;
228
233
  }
@@ -240,7 +245,6 @@ export namespace LTPlayerConfigProcessor {
240
245
  }
241
246
 
242
247
  return outputData;
243
-
244
248
  }
245
249
 
246
250
  static processPlayerContainer(data : Element | defaultType, version : number) {
@@ -106,7 +106,6 @@ export class LTPlayerCommon {
106
106
  }
107
107
  });
108
108
  }
109
-
110
109
  onReadyPlayer() {
111
110
 
112
111
  //set share button
@@ -116,9 +115,7 @@ export class LTPlayerCommon {
116
115
  //set poster
117
116
  this.player.posterManager.mobileEvents.onload(this.player);
118
117
 
119
- if (this.player.additionalInfoService) {
120
- this.player.additionalInfoService.init(this.player, this.player.playerId, this.player.iconService, this.player.templateService);
121
- }
118
+
122
119
 
123
120
  if (this.player.playerConfig.isAutoPlay()) {
124
121
  let playerContainer = this.player.plyr.elements.container;
@@ -9,6 +9,7 @@ export namespace LTPlayerShareEvents {
9
9
  activeModal(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType, selectors: defaultType) {
10
10
  selectors.shareContainer.classList.remove('share-inactive');
11
11
  selectors.shareContainer.classList.add('share-active');
12
+ this.setCopyButtonsEvents(instance, selectors)
12
13
  if (instance.plyr.playing) {
13
14
  this.isPlaying = true;
14
15
  instance.plyr.pause();
@@ -31,13 +32,22 @@ export namespace LTPlayerShareEvents {
31
32
  instance.plyr.elements.container.querySelector('.poster-lt-player-share'),
32
33
  instance.plyr.elements.controls.querySelector('.lt-player-share'),
33
34
  ],
34
- shareContainer : instance.plyr.elements.container.querySelector('.share-controller-wrapper')
35
+ shareContainer : instance.plyr.elements.container.querySelector('.share-controller-wrapper'),
36
+ copyButtons : instance.plyr.elements.container.querySelectorAll('.share-controller-link')
35
37
  };
36
38
  }
37
39
 
38
- copyButtons(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
39
- return instance.plyr.elements.container.querySelectorAll('.share-controller-link');
40
+ setCopyButtonsEvents(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType, selectors: defaultType) {
41
+ if (selectors.copyButtons.length > 0) {
42
+ selectors.copyButtons.forEach((button: HTMLElement) => {
43
+ button.addEventListener('click', function LTPlayerShareCopy() {
44
+ navigator.clipboard.writeText(button.dataset.copy);
45
+ })
46
+
47
+ })
48
+ }
40
49
  }
50
+
41
51
  }
42
52
  export class mobile {
43
53
  common : LTPlayerShareEvents.common
@@ -148,7 +148,9 @@ export class ResizeService {
148
148
  this.playerInstance.plyr.elements.container.insertAdjacentHTML("afterend", buttonsTemplate);
149
149
  let inserted = this.playerInstance.playerConfig.getPlayerElementContainer().querySelector('.lt-player__additional-info');
150
150
  inserted.classList.add('lt-player__additional-info__is_set_out-side');
151
- deskEvent.set(controller);
151
+ this.playerInstance.plyr.on('ready', () => {
152
+ deskEvent.set(controller);
153
+ })
152
154
  }
153
155
 
154
156
  const createAddInfoButtonsInSide = () => {
@@ -157,12 +159,29 @@ export class ResizeService {
157
159
  addInfoContainer.remove();
158
160
  }
159
161
 
160
- let controlsInfoBody = this.playerInstance.plyr.elements.controls.querySelector('.content__body');
162
+ if (this.playerInstance.plyr.elements.controls !== undefined) {
163
+ let controlsInfoBody = this.playerInstance.plyr.elements.controls.querySelector('.content__body');
164
+
165
+ controlsInfoBody.insertAdjacentHTML("afterend", buttonsTemplate);
166
+ let inserted = this.playerInstance.playerConfig.getPlayerElementContainer().querySelector('.lt-player__additional-info');
167
+ inserted.classList.add('lt-player__additional-info__is_set_in-side');
168
+
169
+ deskEvent.set(controller);
170
+ } else {
171
+ this.playerInstance.plyr.on('ready', () => {
172
+
173
+ let controlsInfoBody = this.playerInstance.plyr.elements.controls.querySelector('.content__body');
174
+
175
+ controlsInfoBody.insertAdjacentHTML("afterend", buttonsTemplate);
176
+ let inserted = this.playerInstance.playerConfig.getPlayerElementContainer().querySelector('.lt-player__additional-info');
177
+ inserted.classList.add('lt-player__additional-info__is_set_in-side');
178
+
179
+ deskEvent.set(controller);
180
+ })
181
+ }
182
+
183
+
161
184
 
162
- controlsInfoBody.insertAdjacentHTML("afterend", buttonsTemplate);
163
- let inserted = this.playerInstance.playerConfig.getPlayerElementContainer().querySelector('.lt-player__additional-info');
164
- inserted.classList.add('lt-player__additional-info__is_set_in-side');
165
- deskEvent.set(controller);
166
185
  }
167
186
 
168
187
  if (containerWidth >= 380) {
@@ -1,5 +1,30 @@
1
1
  {{#modal}}
2
2
  {{#mobile}}
3
+ {{#object_data}}
4
+ <div class="player-lt__mobile__modal-header">
5
+ <span class="line-button"></span>
6
+ </div>
7
+ <div class="player-lt__mobile__modal-content">
8
+ {{#abstract}}
9
+ <h2>{{abstract.title}}</h2>
10
+ <p>{{abstract.description}}</p>
11
+ <p>{{abstract.videoDOI}}</p>
12
+ <p>{{abstract.videoCitation}}</p>
13
+ {{/abstract}}
14
+
15
+ {{#institution}}
16
+ <h2>{{institution.title}}</h2>
17
+ <img src="{{institution.image}}" alt="image">
18
+ <p>{{institution.institutionName}}</p>
19
+ <p>{{institution.description}}</p>
20
+ {{/institution}}
21
+
22
+ {{#bio}}
23
+ <h2>{{bio.title}}</h2>
24
+ <p>{{bio.description}}</p>
25
+ {{/bio}}
26
+ </div>
27
+ {{/object_data}}
3
28
  {{#data}}
4
29
  <div class="player-lt__mobile__modal-header">
5
30
  <span class="line-button"></span>
@@ -10,6 +35,39 @@
10
35
  {{/data}}
11
36
  {{/mobile}}
12
37
  {{#desktop}}
38
+ {{#object_data}}
39
+ <div class="player-lt__modal lt-modal-{{id}}">
40
+ <div class="player-lt__modal-content">
41
+ <span class="player-lt__close-button">&times;</span>
42
+ <div class="player-lt__modal-body">
43
+ {{#abstract}}
44
+ <h2>{{abstract.title}}</h2>
45
+ <p>{{abstract.description}}</p>
46
+ <hr>
47
+ <h3>Video DOI</h3>
48
+ <p>{{abstract.videoDOI}}</p>
49
+ <h3>Video Citation</h3>
50
+ <p>{{abstract.videoCitation}}</p>
51
+ {{/abstract}}
52
+
53
+ {{#institution}}
54
+ <h2>{{institution.title}}</h2>
55
+ <div class="modal-flex">
56
+ <img src="{{institution.image}}" alt="image">
57
+ <h3>{{institution.institutionName}}</h3>
58
+ </div>
59
+ <hr>
60
+ <p>{{institution.description}}</p>
61
+ {{/institution}}
62
+
63
+ {{#bio}}
64
+ <h2>{{bio.title}}</h2>
65
+ <p>{{bio.description}}</p>
66
+ {{/bio}}
67
+ </div>
68
+ </div>
69
+ </div>
70
+ {{/object_data}}
13
71
  {{#data}}
14
72
  <div class="player-lt__modal lt-modal-{{id}}">
15
73
  <div class="player-lt__modal-content">