unprint 0.7.2 → 0.8.0
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 +1 -1
- package/src/app.js +24 -0
- package/tests/index.html +1 -1
- package/tests/init.js +2 -0
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -405,6 +405,28 @@ function queryVideos(context, selector = 'source', customOptions) {
|
|
|
405
405
|
return videoUrls.map((videoUrl) => prefixUrl(videoUrl, options.origin, options));
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
+
function queryPoster(context, selector = 'video', customOptions) {
|
|
409
|
+
const options = {
|
|
410
|
+
attribute: 'poster',
|
|
411
|
+
...customOptions,
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
const posterUrl = queryContent(context, selector, options);
|
|
415
|
+
|
|
416
|
+
return prefixUrl(posterUrl, options.origin, options);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function queryPosters(context, selector = 'video', customOptions) {
|
|
420
|
+
const options = {
|
|
421
|
+
attribute: 'poster',
|
|
422
|
+
...customOptions,
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
const posterUrls = queryContents(context, selector, options);
|
|
426
|
+
|
|
427
|
+
return posterUrls.map((posterUrl) => prefixUrl(posterUrl, options.origin, options));
|
|
428
|
+
}
|
|
429
|
+
|
|
408
430
|
function extractJson(element) {
|
|
409
431
|
if (!element) {
|
|
410
432
|
return null;
|
|
@@ -546,6 +568,8 @@ const queryFns = {
|
|
|
546
568
|
num: queryNumber,
|
|
547
569
|
numbers: queryNumbers,
|
|
548
570
|
nums: queryNumbers,
|
|
571
|
+
poster: queryPoster,
|
|
572
|
+
posters: queryPosters,
|
|
549
573
|
date: queryDate,
|
|
550
574
|
dates: queryDates,
|
|
551
575
|
duration: queryDuration,
|
package/tests/index.html
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
<img class="srcset" srcset="https://i.redd.it/e91oo4ueyeb71.jpg 240w, https://i.redd.it/vn9h981hlx281.png 480w, https://i.redd.it/e91oo4ueyeb71.jpg 640w">
|
|
39
39
|
|
|
40
|
-
<video id="video"><source src="https://i.imgur.com/eDQmLys.mp4"></video>
|
|
40
|
+
<video id="video" poster="https://i.imgur.com/eDQmLys.jpg"><source src="https://i.imgur.com/eDQmLys.mp4"></video>
|
|
41
41
|
|
|
42
42
|
<script id="json" type="application/js">{"foo": "bar", "lorem": "ipsum", "hello": "world"}</script>
|
|
43
43
|
</body>
|
package/tests/init.js
CHANGED
|
@@ -33,6 +33,8 @@ async function initTest() {
|
|
|
33
33
|
console.log('relative path', res.context.query.url('#relativePath'));
|
|
34
34
|
console.log('exists', res.context.query.exists('#title'));
|
|
35
35
|
console.log('count', res.context.query.count('.item'), res.context.query.count('.foo'));
|
|
36
|
+
console.log('video', res.context.query.video());
|
|
37
|
+
console.log('poster', res.context.query.poster());
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
async function initServer() {
|