@internetarchive/ia-item-navigator 2.1.1-alpha3 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/demo/app-root.ts +2 -2
  2. package/dist/demo/app-root.js +2 -2
  3. package/dist/demo/app-root.js.map +1 -1
  4. package/dist/src/iaux-item-navigator.js.map +1 -1
  5. package/dist/src/loader.d.ts +4 -4
  6. package/dist/src/menu-slider/ia-menu-slider.d.ts +4 -4
  7. package/dist/src/menu-slider/ia-menu-slider.js.map +1 -1
  8. package/dist/src/menu-slider/menu-button.d.ts +4 -4
  9. package/dist/src/menus/share-panel.d.ts +14 -7
  10. package/dist/src/menus/share-panel.js +113 -89
  11. package/dist/src/menus/share-panel.js.map +1 -1
  12. package/dist/src/menus/viewable-files.js +5 -1
  13. package/dist/src/menus/viewable-files.js.map +1 -1
  14. package/dist/src/no-theater-available.js.map +1 -1
  15. package/dist/test/iaux-sharing-options.test.js +5 -13
  16. package/dist/test/iaux-sharing-options.test.js.map +1 -1
  17. package/package.json +1 -1
  18. package/src/menus/share-panel.ts +126 -99
  19. package/src/menus/viewable-files.ts +5 -1
  20. package/test/iaux-sharing-options.test.ts +4 -21
  21. package/dist/src/menus/share-providers/email.d.ts +0 -11
  22. package/dist/src/menus/share-providers/email.js +0 -15
  23. package/dist/src/menus/share-providers/email.js.map +0 -1
  24. package/dist/src/menus/share-providers/facebook.d.ts +0 -11
  25. package/dist/src/menus/share-providers/facebook.js +0 -15
  26. package/dist/src/menus/share-providers/facebook.js.map +0 -1
  27. package/dist/src/menus/share-providers/pinterest.d.ts +0 -11
  28. package/dist/src/menus/share-providers/pinterest.js +0 -15
  29. package/dist/src/menus/share-providers/pinterest.js.map +0 -1
  30. package/dist/src/menus/share-providers/provider.d.ts +0 -20
  31. package/dist/src/menus/share-providers/provider.js +0 -37
  32. package/dist/src/menus/share-providers/provider.js.map +0 -1
  33. package/dist/src/menus/share-providers/share-provider-interface.d.ts +0 -13
  34. package/dist/src/menus/share-providers/share-provider-interface.js +0 -2
  35. package/dist/src/menus/share-providers/share-provider-interface.js.map +0 -1
  36. package/dist/src/menus/share-providers/tumblr.d.ts +0 -11
  37. package/dist/src/menus/share-providers/tumblr.js +0 -15
  38. package/dist/src/menus/share-providers/tumblr.js.map +0 -1
  39. package/dist/src/menus/share-providers/twitter.d.ts +0 -11
  40. package/dist/src/menus/share-providers/twitter.js +0 -15
  41. package/dist/src/menus/share-providers/twitter.js.map +0 -1
  42. package/src/menus/share-providers/email.ts +0 -23
  43. package/src/menus/share-providers/facebook.ts +0 -23
  44. package/src/menus/share-providers/pinterest.ts +0 -23
  45. package/src/menus/share-providers/provider.ts +0 -63
  46. package/src/menus/share-providers/share-provider-interface.ts +0 -17
  47. package/src/menus/share-providers/tumblr.ts +0 -23
  48. package/src/menus/share-providers/twitter.ts +0 -23
  49. package/test/ia-sharing-options.test.js +0 -78
@@ -1,7 +1,5 @@
1
1
  /* eslint-disable lit-a11y/click-events-have-key-events */
2
2
  /* eslint-disable lit-a11y/list */
3
- import { classMap } from 'lit/directives/class-map.js';
4
- import { ifDefined } from 'lit/directives/if-defined.js';
5
3
  import {
6
4
  css,
7
5
  CSSResult,
@@ -12,19 +10,22 @@ import {
12
10
  TemplateResult,
13
11
  } from 'lit';
14
12
  import { customElement, property } from 'lit/decorators.js';
15
- import '@internetarchive/icon-link/icon-link';
16
13
  import '@internetarchive/icon-share/icon-share';
14
+ import '@internetarchive/icon-twitter/icon-twitter';
15
+ import '@internetarchive/icon-facebook/icon-facebook';
16
+ import '@internetarchive/icon-tumblr/icon-tumblr';
17
+ import '@internetarchive/icon-pinterest/icon-pinterest';
18
+ import '@internetarchive/icon-email/icon-email';
19
+ import '@internetarchive/icon-link/icon-link';
17
20
 
18
- import EmailProvider from './share-providers/email';
19
- import FacebookProvider from './share-providers/facebook';
20
- import PinterestProvider from './share-providers/pinterest';
21
- import TumblrProvider from './share-providers/tumblr';
22
- import TwitterProvider from './share-providers/twitter';
23
- import { ProviderParams } from './share-providers/share-provider-interface';
24
- import type Provider from './share-providers/provider';
21
+ type ShareOption = {
22
+ name: string;
23
+ icon: TemplateResult | string;
24
+ url: string;
25
+ };
25
26
 
26
- const copyToClipboard = (options: Record<any, any>) => {
27
- const currentTarget = options.currentTarget as HTMLElement;
27
+ const copyToClipboard = (event: MouseEvent) => {
28
+ const currentTarget = event.currentTarget as HTMLElement;
28
29
  const textarea = currentTarget.querySelector('textarea');
29
30
  const note = currentTarget.querySelector('small') as any;
30
31
  textarea!.select();
@@ -51,7 +52,7 @@ export class IauxSharingOptions extends LitElement {
51
52
 
52
53
  @property({ type: String }) identifier = '';
53
54
 
54
- @property({ type: Array }) sharingOptions: Provider[] = [];
55
+ @property({ type: Array }) sharingOptions: ShareOption[] = [];
55
56
 
56
57
  @property({ type: String }) type = '';
57
58
 
@@ -66,55 +67,74 @@ export class IauxSharingOptions extends LitElement {
66
67
  }
67
68
 
68
69
  loadProviders() {
69
- const { baseHost, creator, description, identifier, type, fileSubPrefix } =
70
- this;
71
- const params = {
72
- baseHost,
73
- creator,
74
- description,
75
- identifier,
76
- type,
77
- fileSubPrefix,
78
- } as unknown as ProviderParams;
70
+ let shareUrl = `https://${this.baseHost}/details/${this.identifier}`;
71
+ if (this.fileSubPrefix) {
72
+ shareUrl += `/${this.fileSubPrefix}`;
73
+ }
74
+ const shareBlurb = [
75
+ this.description,
76
+ this.creator,
77
+ 'Free Download, Borrow, and Streaming',
78
+ 'Internet Archive',
79
+ ]
80
+ .filter(Boolean)
81
+ .join(' : ');
79
82
 
80
83
  this.sharingOptions = [
81
- new TwitterProvider(params),
82
- new FacebookProvider(params),
83
- new TumblrProvider(params),
84
- new PinterestProvider(params),
85
- new EmailProvider(params),
84
+ {
85
+ name: 'Twitter',
86
+ icon: html`<ia-icon-twitter></ia-icon-twitter>`,
87
+ url: `https://twitter.com/intent/tweet?${new URLSearchParams({
88
+ url: shareUrl,
89
+ text: shareBlurb,
90
+ via: 'internetarchive',
91
+ })}`,
92
+ },
93
+ {
94
+ name: 'Facebook',
95
+ icon: html`<ia-icon-facebook></ia-icon-facebook>`,
96
+ url: `https://www.facebook.com/sharer/sharer.php?${new URLSearchParams({
97
+ u: shareUrl,
98
+ })}`,
99
+ },
100
+ {
101
+ name: 'Tumblr',
102
+ icon: html`<ia-icon-tumblr></ia-icon-tumblr>`,
103
+ url: `https://www.tumblr.com/widgets/share/tool/preview?${new URLSearchParams(
104
+ {
105
+ posttype: 'link',
106
+ canonicalUrl: shareUrl,
107
+ title: shareBlurb,
108
+ },
109
+ )}`,
110
+ },
111
+ {
112
+ name: 'Pinterest',
113
+ icon: html`<ia-icon-pinterest></ia-icon-pinterest>`,
114
+ url: `http://www.pinterest.com/pin/create/button/?${new URLSearchParams(
115
+ {
116
+ url: shareUrl,
117
+ description: shareBlurb,
118
+ },
119
+ )}`,
120
+ },
121
+ {
122
+ name: 'Email',
123
+ icon: html`<ia-icon-email></ia-icon-email>`,
124
+ url: `mailto:?${new URLSearchParams({
125
+ subject: shareBlurb,
126
+ body: shareUrl,
127
+ })}`,
128
+ },
86
129
  ];
87
130
  }
88
131
 
89
- get sharingItems() {
90
- return this.sharingOptions.map(
91
- option =>
92
- html`<li>
93
- <a
94
- class="${ifDefined(option.class)}"
95
- href="${option.url}"
96
- target="_blank"
97
- >
98
- ${option.icon} ${option.name}
99
- </a>
100
- </li>`,
101
- );
102
- }
103
-
104
- get embedOption() {
105
- return html`<li>
106
- <a href="#" @click=${this.toggleEmbedOptions}>
107
- <ia-icon-link></ia-icon-link>
108
- Get an embeddable link
109
- </a>
110
- </li>`;
111
- }
112
-
113
132
  get iframeEmbed() {
114
- return html`&lt;iframe
115
- src="https://${this.baseHost}/embed/${this.identifier}" width="560"
116
- height="384" frameborder="0" webkitallowfullscreen="true"
117
- mozallowfullscreen="true" allowfullscreen&gt;&lt;/iframe&gt;`;
133
+ return `<iframe
134
+ src="https://${this.baseHost}/embed/${this.identifier}"
135
+ width="560" height="384" frameborder="0"
136
+ webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen
137
+ ></iframe>`;
118
138
  }
119
139
 
120
140
  get bbcodeEmbed() {
@@ -125,11 +145,6 @@ export class IauxSharingOptions extends LitElement {
125
145
  return `https://${this.baseHost}/help/audio.php?identifier=${this.identifier}`;
126
146
  }
127
147
 
128
- toggleEmbedOptions(e: Event) {
129
- e.preventDefault();
130
- this.embedOptionsVisible = !this.embedOptionsVisible;
131
- }
132
-
133
148
  get header() {
134
149
  const header = html`<header><h3>Share this ${this.type}</h3></header>`;
135
150
  return this.renderHeader ? header : nothing;
@@ -138,32 +153,41 @@ export class IauxSharingOptions extends LitElement {
138
153
  render() {
139
154
  return html`
140
155
  ${this.header}
141
- <ul>
142
- ${this.sharingItems} ${this.embedOption}
143
- <div
144
- class=${classMap({ visible: this.embedOptionsVisible, embed: true })}
145
- >
146
- <h4>Embed</h4>
147
- <div class="code" @click=${copyToClipboard}>
148
- <textarea readonly>${this.iframeEmbed}</textarea>
149
- <small>Copied to clipboard</small>
150
- </div>
151
- <h4>
152
- Embed for wordpress.com hosted blogs and archive.org item
153
- &lt;description&gt; tags
154
- </h4>
155
- <div class="code" @click=${copyToClipboard}>
156
- <textarea readonly>${this.bbcodeEmbed}</textarea>
157
- <small>Copied to clipboard</small>
156
+ <main>
157
+ ${this.sharingOptions.map(
158
+ option =>
159
+ html` <a class="share-option" href="${option.url}" target="_blank">
160
+ ${option.icon} ${option.name}
161
+ </a>`,
162
+ )}
163
+ <details>
164
+ <summary class="share-option">
165
+ <ia-icon-link></ia-icon-link>
166
+ Get an embeddable link
167
+ </summary>
168
+ <div class="embed">
169
+ <h4>Embed</h4>
170
+ <div class="code" @click=${copyToClipboard}>
171
+ <textarea readonly>${this.iframeEmbed}</textarea>
172
+ <small>Copied to clipboard</small>
173
+ </div>
174
+ <h4>
175
+ Embed for wordpress.com hosted blogs and archive.org item
176
+ &lt;description&gt; tags
177
+ </h4>
178
+ <div class="code" @click=${copyToClipboard}>
179
+ <textarea readonly>${this.bbcodeEmbed}</textarea>
180
+ <small>Copied to clipboard</small>
181
+ </div>
182
+ <p>
183
+ Want more?
184
+ <a href=${this.helpURL}
185
+ >Advanced embedding details, examples, and help</a
186
+ >!
187
+ </p>
158
188
  </div>
159
- <p>
160
- Want more?
161
- <a href=${this.helpURL}
162
- >Advanced embedding details, examples, and help</a
163
- >!
164
- </p>
165
- </div>
166
- </ul>
189
+ </details>
190
+ </main>
167
191
  `;
168
192
  }
169
193
 
@@ -198,22 +222,20 @@ export class IauxSharingOptions extends LitElement {
198
222
  font-size: 1.4rem;
199
223
  }
200
224
 
201
- ul {
202
- padding: 0 0 2rem 0;
203
- list-style: none;
225
+ main {
226
+ padding: 1rem 0;
204
227
  }
205
228
 
206
- li {
207
- padding: 0 0 1rem 0;
208
- }
209
-
210
- li a {
229
+ .share-option {
230
+ display: block;
231
+ padding: 0.5rem 0;
211
232
  font-size: 1.6rem;
212
233
  text-decoration: none;
213
234
  color: var(--shareLinkColor);
235
+ cursor: pointer;
214
236
  }
215
237
 
216
- li a * {
238
+ .share-option > * {
217
239
  display: inline-block;
218
240
  padding: 0.2rem;
219
241
  margin-right: 1rem;
@@ -223,12 +245,17 @@ export class IauxSharingOptions extends LitElement {
223
245
  background: var(--shareIconBg);
224
246
  }
225
247
 
226
- .embed {
248
+ /* Hide the triangle that appears on details tags */
249
+ summary::marker {
250
+ content: '';
251
+ }
252
+
253
+ summary::-webkit-details-marker {
227
254
  display: none;
228
255
  }
229
- .embed.visible {
230
- display: block;
231
- width: 95%;
256
+
257
+ .embed {
258
+ padding-right: 5px;
232
259
  }
233
260
 
234
261
  .embed a {
@@ -230,7 +230,11 @@ export class IauxViewableFiles extends LitElement {
230
230
  activeFile?.scrollIntoViewIfNeeded(true);
231
231
  } else {
232
232
  // `scrollIntoView` always auto-scroll to center of visible area
233
- activeFile?.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' })
233
+ activeFile?.scrollIntoView({
234
+ behavior: 'smooth',
235
+ block: 'nearest',
236
+ inline: 'nearest',
237
+ });
234
238
  }
235
239
  }, 350);
236
240
  }
@@ -38,23 +38,13 @@ describe('<iaux-in-share-panel>', () => {
38
38
 
39
39
  await el.updateComplete;
40
40
 
41
- el.sharingOptions.forEach(option => {
42
- const button =
43
- el.shadowRoot && el.shadowRoot.querySelector(`a.${option.class}`);
41
+ el.sharingOptions.forEach((option, i) => {
42
+ const button = el.shadowRoot?.querySelectorAll('a')[i];
44
43
  expect(button).to.exist;
45
44
  expect(button?.getAttribute('href')).to.equal(option.url);
46
45
  });
47
46
  });
48
47
 
49
- it('toggles visibility of embed options', async () => {
50
- const el = (await fixture(container())) as IauxSharingOptions;
51
-
52
- el.toggleEmbedOptions(new Event('click'));
53
- await el.updateComplete;
54
-
55
- expect(el.embedOptionsVisible).to.equal(true);
56
- });
57
-
58
48
  it('does not show internal header by default', async () => {
59
49
  const el = (await fixture(container())) as IauxSharingOptions;
60
50
  expect(el.shadowRoot?.querySelector('header')).to.be.null;
@@ -68,17 +58,10 @@ describe('<iaux-in-share-panel>', () => {
68
58
  });
69
59
 
70
60
  it('sets file subprefix to end of share URLs if present', async () => {
71
- const optionalFileSubprefix = 'foo- bar - 123-';
72
- const el = (await fixture(
73
- container(optionalFileSubprefix),
74
- )) as IauxSharingOptions;
61
+ const el = (await fixture(container('foo 123'))) as IauxSharingOptions;
75
62
 
76
63
  el.sharingOptions.forEach(option => {
77
- if (option.name !== 'Tumblr') {
78
- expect(option.url).to.contain(
79
- encodeURIComponent(optionalFileSubprefix),
80
- );
81
- }
64
+ expect(option.url).to.contain('foo+123');
82
65
  });
83
66
  });
84
67
  });
@@ -1,11 +0,0 @@
1
- import '@internetarchive/icon-email/icon-email';
2
- import { TemplateResult } from 'lit';
3
- import Provider from './provider';
4
- import type { ProviderParams } from './share-provider-interface';
5
- export default class extends Provider {
6
- name: string;
7
- icon: TemplateResult;
8
- class: string;
9
- constructor(params: ProviderParams);
10
- get url(): string;
11
- }
@@ -1,15 +0,0 @@
1
- import '@internetarchive/icon-email/icon-email';
2
- import { html } from 'lit';
3
- import Provider from './provider';
4
- export default class extends Provider {
5
- constructor(params) {
6
- super(params);
7
- this.name = 'Email';
8
- this.icon = html `<ia-icon-email></ia-icon-email>`;
9
- this.class = 'email';
10
- }
11
- get url() {
12
- return `mailto:?body=https://${this.baseHost}/details/${this.itemPath}&subject=${this.description} : ${this.creator}${this.promoCopy}`;
13
- }
14
- }
15
- //# sourceMappingURL=email.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email.js","sourceRoot":"","sources":["../../../../src/menus/share-providers/email.ts"],"names":[],"mappings":"AAAA,OAAO,wCAAwC,CAAC;AAChD,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,MAAM,CAAC,OAAO,MAAO,SAAQ,QAAQ;IAOnC,YAAY,MAAsB;QAChC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA,iCAAiC,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;IACvB,CAAC;IAED,IAAa,GAAG;QACd,OAAO,wBAAwB,IAAI,CAAC,QAAQ,YAAY,IAAI,CAAC,QAAQ,YAAY,IAAI,CAAC,WAAW,MAAM,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IACzI,CAAC;CACF","sourcesContent":["import '@internetarchive/icon-email/icon-email';\nimport { TemplateResult, html } from 'lit';\nimport Provider from './provider';\nimport type { ProviderParams } from './share-provider-interface';\n\nexport default class extends Provider {\n name: string;\n\n icon: TemplateResult;\n\n class: string;\n\n constructor(params: ProviderParams) {\n super(params);\n this.name = 'Email';\n this.icon = html`<ia-icon-email></ia-icon-email>`;\n this.class = 'email';\n }\n\n override get url(): string {\n return `mailto:?body=https://${this.baseHost}/details/${this.itemPath}&subject=${this.description} : ${this.creator}${this.promoCopy}`;\n }\n}\n"]}
@@ -1,11 +0,0 @@
1
- import '@internetarchive/icon-facebook/icon-facebook';
2
- import { TemplateResult } from 'lit';
3
- import Provider from './provider';
4
- import type { ProviderParams } from './share-provider-interface';
5
- export default class extends Provider {
6
- name: string;
7
- icon: TemplateResult;
8
- class: string;
9
- constructor(params: ProviderParams);
10
- get url(): string;
11
- }
@@ -1,15 +0,0 @@
1
- import '@internetarchive/icon-facebook/icon-facebook';
2
- import { html } from 'lit';
3
- import Provider from './provider';
4
- export default class extends Provider {
5
- constructor(params) {
6
- super(params);
7
- this.name = 'Facebook';
8
- this.icon = html `<ia-icon-facebook></ia-icon-facebook>`;
9
- this.class = 'facebook';
10
- }
11
- get url() {
12
- return `https://www.facebook.com/sharer/sharer.php?u=https://${this.baseHost}/details/${this.itemPath}`;
13
- }
14
- }
15
- //# sourceMappingURL=facebook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"facebook.js","sourceRoot":"","sources":["../../../../src/menus/share-providers/facebook.ts"],"names":[],"mappings":"AAAA,OAAO,8CAA8C,CAAC;AACtD,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,MAAM,CAAC,OAAO,MAAO,SAAQ,QAAQ;IAOnC,YAAY,MAAsB;QAChC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA,uCAAuC,CAAC;QACxD,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC;IAC1B,CAAC;IAED,IAAa,GAAG;QACd,OAAO,wDAAwD,IAAI,CAAC,QAAQ,YAAY,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC1G,CAAC;CACF","sourcesContent":["import '@internetarchive/icon-facebook/icon-facebook';\nimport { TemplateResult, html } from 'lit';\nimport Provider from './provider';\nimport type { ProviderParams } from './share-provider-interface';\n\nexport default class extends Provider {\n name: string;\n\n icon: TemplateResult;\n\n class: string;\n\n constructor(params: ProviderParams) {\n super(params);\n this.name = 'Facebook';\n this.icon = html`<ia-icon-facebook></ia-icon-facebook>`;\n this.class = 'facebook';\n }\n\n override get url(): string {\n return `https://www.facebook.com/sharer/sharer.php?u=https://${this.baseHost}/details/${this.itemPath}`;\n }\n}\n"]}
@@ -1,11 +0,0 @@
1
- import '@internetarchive/icon-pinterest/icon-pinterest';
2
- import { TemplateResult } from 'lit';
3
- import Provider from './provider';
4
- import { ProviderParams } from './share-provider-interface';
5
- export default class extends Provider {
6
- name: string;
7
- icon: TemplateResult;
8
- class: string;
9
- constructor(params: ProviderParams);
10
- get url(): string;
11
- }
@@ -1,15 +0,0 @@
1
- import '@internetarchive/icon-pinterest/icon-pinterest';
2
- import { html } from 'lit';
3
- import Provider from './provider';
4
- export default class extends Provider {
5
- constructor(params) {
6
- super(params);
7
- this.name = 'Pinterest';
8
- this.icon = html `<ia-icon-pinterest></ia-icon-pinterest>`;
9
- this.class = 'pinterest';
10
- }
11
- get url() {
12
- return `http://www.pinterest.com/pin/create/button/?url=https://${this.baseHost}/details/${this.itemPath}&description=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;
13
- }
14
- }
15
- //# sourceMappingURL=pinterest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pinterest.js","sourceRoot":"","sources":["../../../../src/menus/share-providers/pinterest.ts"],"names":[],"mappings":"AAAA,OAAO,gDAAgD,CAAC;AACxD,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,MAAM,CAAC,OAAO,MAAO,SAAQ,QAAQ;IAOnC,YAAY,MAAsB;QAChC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA,yCAAyC,CAAC;QAC1D,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC;IAC3B,CAAC;IAED,IAAa,GAAG;QACd,OAAO,2DAA2D,IAAI,CAAC,QAAQ,YAAY,IAAI,CAAC,QAAQ,gBAAgB,IAAI,CAAC,kBAAkB,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACvM,CAAC;CACF","sourcesContent":["import '@internetarchive/icon-pinterest/icon-pinterest';\nimport { TemplateResult, html } from 'lit';\nimport Provider from './provider';\nimport { ProviderParams } from './share-provider-interface';\n\nexport default class extends Provider {\n name: string;\n\n icon: TemplateResult;\n\n class: string;\n\n constructor(params: ProviderParams) {\n super(params);\n this.name = 'Pinterest';\n this.icon = html`<ia-icon-pinterest></ia-icon-pinterest>`;\n this.class = 'pinterest';\n }\n\n override get url(): string {\n return `http://www.pinterest.com/pin/create/button/?url=https://${this.baseHost}/details/${this.itemPath}&description=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;\n }\n}\n"]}
@@ -1,20 +0,0 @@
1
- import { TemplateResult } from 'lit';
2
- import { ProviderParams } from './share-provider-interface';
3
- export default class Provider {
4
- promoCopy: string;
5
- description: string;
6
- creator: string;
7
- fileSubPrefix: string;
8
- identifier: string;
9
- baseHost: string;
10
- name: string | undefined;
11
- icon: TemplateResult | string | undefined;
12
- class: string | undefined;
13
- constructor(params: ProviderParams);
14
- get encodedDescription(): string;
15
- get encodedCreator(): string;
16
- get encodedPromoCopy(): string;
17
- get itemPath(): string;
18
- get url(): string;
19
- encodeString(str: string): string;
20
- }
@@ -1,37 +0,0 @@
1
- export default class Provider {
2
- constructor(params) {
3
- this.promoCopy =
4
- ' : Free Download, Borrow, and Streaming : Internet Archive';
5
- this.description = (params === null || params === void 0 ? void 0 : params.description) || '';
6
- this.creator = (params === null || params === void 0 ? void 0 : params.creator) || '';
7
- this.fileSubPrefix = (params === null || params === void 0 ? void 0 : params.fileSubPrefix) || '';
8
- this.identifier = (params === null || params === void 0 ? void 0 : params.identifier) || '';
9
- this.baseHost = (params === null || params === void 0 ? void 0 : params.baseHost) || '';
10
- }
11
- get encodedDescription() {
12
- return this.encodeString(this.description);
13
- }
14
- get encodedCreator() {
15
- return this.encodeString(this.creator);
16
- }
17
- get encodedPromoCopy() {
18
- return this.encodeString(this.promoCopy);
19
- }
20
- get itemPath() {
21
- const encodedFileSubPrefix = this.fileSubPrefix
22
- ? encodeURIComponent(this.fileSubPrefix)
23
- : '';
24
- return encodedFileSubPrefix
25
- ? `${this.identifier}/${encodedFileSubPrefix}`
26
- : this.identifier;
27
- }
28
- get url() {
29
- return `https://${this.baseHost}/details/${this.itemPath}`;
30
- }
31
- encodeString(str) {
32
- if (!str)
33
- return '';
34
- return encodeURIComponent(str.replace(/\s/g, '+')).replace(/%2B/g, '+');
35
- }
36
- }
37
- //# sourceMappingURL=provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../../src/menus/share-providers/provider.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,QAAQ;IAmB3B,YAAY,MAAsB;QAChC,IAAI,CAAC,SAAS;YACZ,4DAA4D,CAAC;QAE/D,IAAI,CAAC,WAAW,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,KAAI,EAAE,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,KAAI,EAAE,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,KAAI,EAAE,CAAC;QACjD,IAAI,CAAC,UAAU,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,KAAI,EAAE,CAAC;QAC3C,IAAI,CAAC,QAAQ,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,KAAI,EAAE,CAAC;IACzC,CAAC;IAED,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,QAAQ;QACV,MAAM,oBAAoB,GAAG,IAAI,CAAC,aAAa;YAC7C,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,aAAa,CAAC;YACxC,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,oBAAoB;YACzB,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,IAAI,oBAAoB,EAAE;YAC9C,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;IACtB,CAAC;IAED,IAAI,GAAG;QACL,OAAO,WAAW,IAAI,CAAC,QAAQ,YAAY,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC7D,CAAC;IAED,YAAY,CAAC,GAAW;QACtB,IAAI,CAAC,GAAG;YAAE,OAAO,EAAE,CAAC;QACpB,OAAO,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1E,CAAC;CACF","sourcesContent":["import { TemplateResult } from 'lit';\nimport { ProviderParams } from './share-provider-interface';\n\nexport default class Provider {\n promoCopy: string;\n\n description: string;\n\n creator: string;\n\n fileSubPrefix: string;\n\n identifier: string;\n\n baseHost: string;\n\n name: string | undefined;\n\n icon: TemplateResult | string | undefined;\n\n class: string | undefined;\n\n constructor(params: ProviderParams) {\n this.promoCopy =\n ' : Free Download, Borrow, and Streaming : Internet Archive';\n\n this.description = params?.description || '';\n this.creator = params?.creator || '';\n this.fileSubPrefix = params?.fileSubPrefix || '';\n this.identifier = params?.identifier || '';\n this.baseHost = params?.baseHost || '';\n }\n\n get encodedDescription(): string {\n return this.encodeString(this.description);\n }\n\n get encodedCreator(): string {\n return this.encodeString(this.creator);\n }\n\n get encodedPromoCopy(): string {\n return this.encodeString(this.promoCopy);\n }\n\n get itemPath(): string {\n const encodedFileSubPrefix = this.fileSubPrefix\n ? encodeURIComponent(this.fileSubPrefix)\n : '';\n return encodedFileSubPrefix\n ? `${this.identifier}/${encodedFileSubPrefix}`\n : this.identifier;\n }\n\n get url(): string {\n return `https://${this.baseHost}/details/${this.itemPath}`;\n }\n\n encodeString(str: string): string {\n if (!str) return '';\n return encodeURIComponent(str.replace(/\\s/g, '+')).replace(/%2B/g, '+');\n }\n}\n"]}
@@ -1,13 +0,0 @@
1
- import { TemplateResult } from 'lit';
2
- export type ProviderParams = {
3
- class: string;
4
- icon: TemplateResult | string;
5
- name: string;
6
- promoCopy: string;
7
- description: string;
8
- creator: string;
9
- fileSubPrefix: string;
10
- identifier: string;
11
- baseHost: string;
12
- itemPath: string;
13
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=share-provider-interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"share-provider-interface.js","sourceRoot":"","sources":["../../../../src/menus/share-providers/share-provider-interface.ts"],"names":[],"mappings":"","sourcesContent":["import { TemplateResult } from 'lit';\n\nexport type ProviderParams = {\n class: string;\n icon: TemplateResult | string;\n name: string;\n\n promoCopy: string;\n description: string;\n creator: string;\n\n // ia item\n fileSubPrefix: string;\n identifier: string;\n baseHost: string;\n itemPath: string;\n};\n"]}
@@ -1,11 +0,0 @@
1
- import '@internetarchive/icon-tumblr/icon-tumblr';
2
- import { TemplateResult } from 'lit';
3
- import Provider from './provider';
4
- import { ProviderParams } from './share-provider-interface';
5
- export default class extends Provider {
6
- name: string;
7
- icon: TemplateResult;
8
- class: string;
9
- constructor(params: ProviderParams);
10
- get url(): string;
11
- }
@@ -1,15 +0,0 @@
1
- import '@internetarchive/icon-tumblr/icon-tumblr';
2
- import { html } from 'lit';
3
- import Provider from './provider';
4
- export default class extends Provider {
5
- constructor(params) {
6
- super(params);
7
- this.name = 'Tumblr';
8
- this.icon = html `<ia-icon-tumblr></ia-icon-tumblr>`;
9
- this.class = 'tumblr';
10
- }
11
- get url() {
12
- return `https://www.tumblr.com/share/video?embed=%3Ciframe+width%3D%22640%22+height%3D%22480%22+frameborder%3D%220%22+allowfullscreen+src%3D%22https%3A%2F%2F${this.baseHost}%2Fembed%2F%22+webkitallowfullscreen%3D%22true%22+mozallowfullscreen%3D%22true%22%26gt%3B%26lt%3B%2Fiframe%3E&name=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;
13
- }
14
- }
15
- //# sourceMappingURL=tumblr.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tumblr.js","sourceRoot":"","sources":["../../../../src/menus/share-providers/tumblr.ts"],"names":[],"mappings":"AAAA,OAAO,0CAA0C,CAAC;AAClD,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,MAAM,CAAC,OAAO,MAAO,SAAQ,QAAQ;IAOnC,YAAY,MAAsB;QAChC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA,mCAAmC,CAAC;QACpD,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;IACxB,CAAC;IAED,IAAa,GAAG;QACd,OAAO,wJAAwJ,IAAI,CAAC,QAAQ,sHAAsH,IAAI,CAAC,kBAAkB,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACjX,CAAC;CACF","sourcesContent":["import '@internetarchive/icon-tumblr/icon-tumblr';\nimport { TemplateResult, html } from 'lit';\nimport Provider from './provider';\nimport { ProviderParams } from './share-provider-interface';\n\nexport default class extends Provider {\n name: string;\n\n icon: TemplateResult;\n\n class: string;\n\n constructor(params: ProviderParams) {\n super(params);\n this.name = 'Tumblr';\n this.icon = html`<ia-icon-tumblr></ia-icon-tumblr>`;\n this.class = 'tumblr';\n }\n\n override get url(): string {\n return `https://www.tumblr.com/share/video?embed=%3Ciframe+width%3D%22640%22+height%3D%22480%22+frameborder%3D%220%22+allowfullscreen+src%3D%22https%3A%2F%2F${this.baseHost}%2Fembed%2F%22+webkitallowfullscreen%3D%22true%22+mozallowfullscreen%3D%22true%22%26gt%3B%26lt%3B%2Fiframe%3E&name=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;\n }\n}\n"]}
@@ -1,11 +0,0 @@
1
- import '@internetarchive/icon-twitter/icon-twitter';
2
- import { TemplateResult } from 'lit';
3
- import Provider from './provider';
4
- import { ProviderParams } from './share-provider-interface';
5
- export default class TwitterProvider extends Provider {
6
- name: string;
7
- icon: TemplateResult;
8
- class: string;
9
- constructor(params: ProviderParams);
10
- get url(): string;
11
- }
@@ -1,15 +0,0 @@
1
- import '@internetarchive/icon-twitter/icon-twitter';
2
- import { html } from 'lit';
3
- import Provider from './provider';
4
- export default class TwitterProvider extends Provider {
5
- constructor(params) {
6
- super(params);
7
- this.name = 'Twitter';
8
- this.icon = html `<ia-icon-twitter></ia-icon-twitter>`;
9
- this.class = 'twitter';
10
- }
11
- get url() {
12
- return `https://twitter.com/intent/tweet?url=https://${this.baseHost}/details/${this.itemPath}&via=internetarchive&text=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;
13
- }
14
- }
15
- //# sourceMappingURL=twitter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"twitter.js","sourceRoot":"","sources":["../../../../src/menus/share-providers/twitter.ts"],"names":[],"mappings":"AAAA,OAAO,4CAA4C,CAAC;AACpD,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,QAAQ;IAOnD,YAAY,MAAsB;QAChC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA,qCAAqC,CAAC;QACtD,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACzB,CAAC;IAED,IAAa,GAAG;QACd,OAAO,gDAAgD,IAAI,CAAC,QAAQ,YAAY,IAAI,CAAC,QAAQ,6BAA6B,IAAI,CAAC,kBAAkB,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACzM,CAAC;CACF","sourcesContent":["import '@internetarchive/icon-twitter/icon-twitter';\nimport { TemplateResult, html } from 'lit';\nimport Provider from './provider';\nimport { ProviderParams } from './share-provider-interface';\n\nexport default class TwitterProvider extends Provider {\n name: string;\n\n icon: TemplateResult;\n\n class: string;\n\n constructor(params: ProviderParams) {\n super(params);\n this.name = 'Twitter';\n this.icon = html`<ia-icon-twitter></ia-icon-twitter>`;\n this.class = 'twitter';\n }\n\n override get url(): string {\n return `https://twitter.com/intent/tweet?url=https://${this.baseHost}/details/${this.itemPath}&via=internetarchive&text=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;\n }\n}\n"]}
@@ -1,23 +0,0 @@
1
- import '@internetarchive/icon-email/icon-email';
2
- import { TemplateResult, html } from 'lit';
3
- import Provider from './provider';
4
- import type { ProviderParams } from './share-provider-interface';
5
-
6
- export default class extends Provider {
7
- name: string;
8
-
9
- icon: TemplateResult;
10
-
11
- class: string;
12
-
13
- constructor(params: ProviderParams) {
14
- super(params);
15
- this.name = 'Email';
16
- this.icon = html`<ia-icon-email></ia-icon-email>`;
17
- this.class = 'email';
18
- }
19
-
20
- override get url(): string {
21
- return `mailto:?body=https://${this.baseHost}/details/${this.itemPath}&subject=${this.description} : ${this.creator}${this.promoCopy}`;
22
- }
23
- }