@mjhls/mjh-framework 1.0.242 → 1.0.244
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/README.md +1 -1
- package/dist/cjs/index.js +43 -11
- package/dist/esm/index.js +43 -11
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -12608,6 +12608,11 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
|
|
|
12608
12608
|
client = _ref.client,
|
|
12609
12609
|
getSerializers = _ref.getSerializers;
|
|
12610
12610
|
|
|
12611
|
+
var builder = index$1.imageUrlBuilder(client);
|
|
12612
|
+
function urlFor(source) {
|
|
12613
|
+
return builder.image(source);
|
|
12614
|
+
}
|
|
12615
|
+
|
|
12611
12616
|
var router = Router.useRouter();
|
|
12612
12617
|
//state
|
|
12613
12618
|
|
|
@@ -12616,15 +12621,20 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
|
|
|
12616
12621
|
vidUrl = _useState2[0],
|
|
12617
12622
|
setVidUrl = _useState2[1];
|
|
12618
12623
|
|
|
12619
|
-
var _useState3 = React.useState(''),
|
|
12624
|
+
var _useState3 = React.useState('youtube'),
|
|
12620
12625
|
_useState4 = slicedToArray._slicedToArray(_useState3, 2),
|
|
12621
|
-
|
|
12622
|
-
|
|
12626
|
+
vidType = _useState4[0],
|
|
12627
|
+
setVidType = _useState4[1];
|
|
12623
12628
|
|
|
12624
|
-
var _useState5 = React.useState(
|
|
12629
|
+
var _useState5 = React.useState(''),
|
|
12625
12630
|
_useState6 = slicedToArray._slicedToArray(_useState5, 2),
|
|
12626
|
-
|
|
12627
|
-
|
|
12631
|
+
series = _useState6[0],
|
|
12632
|
+
setSeries = _useState6[1];
|
|
12633
|
+
|
|
12634
|
+
var _useState7 = React.useState([]),
|
|
12635
|
+
_useState8 = slicedToArray._slicedToArray(_useState7, 2),
|
|
12636
|
+
seriesData = _useState8[0],
|
|
12637
|
+
setData = _useState8[1];
|
|
12628
12638
|
//variables
|
|
12629
12639
|
|
|
12630
12640
|
|
|
@@ -12635,19 +12645,36 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
|
|
|
12635
12645
|
var params = new URL(document.location).searchParams;
|
|
12636
12646
|
var seriesVid = params.get('seriesVid') || 1;
|
|
12637
12647
|
var data = [];
|
|
12648
|
+
|
|
12638
12649
|
nodes.videos.forEach(function (vid) {
|
|
12639
|
-
|
|
12650
|
+
if (vid.type == 'mp4') {
|
|
12651
|
+
data.push({ title: vid.title, thumbnail: urlFor(vid.thumbnail.asset), url: vid.url });
|
|
12652
|
+
} else {
|
|
12653
|
+
if (vid.thumbnail && vid.thumbnail.asset) {
|
|
12654
|
+
data.push({ title: vid.title, thumbnail: urlFor(vid.thumbnail.asset), url: vid.url });
|
|
12655
|
+
} else {
|
|
12656
|
+
data.push({ title: vid.title, thumbnail: 'https://img.youtube.com/vi/' + YoutubeGroup.getYoutubeId(vid.url) + '/hqdefault.jpg', url: vid.url });
|
|
12657
|
+
}
|
|
12658
|
+
}
|
|
12640
12659
|
});
|
|
12641
12660
|
// if series number doesn't exist, route back to first vid of series
|
|
12661
|
+
|
|
12642
12662
|
if (data.length < seriesVid) {
|
|
12643
12663
|
setSeries(1);
|
|
12644
12664
|
setVidUrl(nodes.videos[0].url);
|
|
12665
|
+
if (nodes.videos[0].type) {
|
|
12666
|
+
setVidType(nodes.videos[0].type);
|
|
12667
|
+
}
|
|
12668
|
+
|
|
12645
12669
|
var newPath = '/' + get2 + '/' + get3 + '?seriesVid=1';
|
|
12646
12670
|
var vidState = { vid_id: seriesVid };
|
|
12647
12671
|
window.history.pushState(vidState, '', newPath);
|
|
12648
12672
|
} else {
|
|
12649
12673
|
setSeries(seriesVid);
|
|
12650
12674
|
setVidUrl(nodes.videos[seriesVid - 1].url);
|
|
12675
|
+
if (nodes.videos[0].type) {
|
|
12676
|
+
setVidType(nodes.videos[seriesVid - 1].type);
|
|
12677
|
+
}
|
|
12651
12678
|
}
|
|
12652
12679
|
setData(data);
|
|
12653
12680
|
}, []);
|
|
@@ -12717,9 +12744,14 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
|
|
|
12717
12744
|
React__default.createElement(
|
|
12718
12745
|
'div',
|
|
12719
12746
|
{ className: 'video-block', style: { position: 'relative', overflow: 'hidden' } },
|
|
12720
|
-
vidUrl && React__default.createElement(YouTube, { videoId: YoutubeGroup.getYoutubeId(vidUrl), opts: opts, onEnd: function onEnd(e) {
|
|
12747
|
+
vidUrl && vidType == 'youtube' ? React__default.createElement(YouTube, { videoId: YoutubeGroup.getYoutubeId(vidUrl), opts: opts, onEnd: function onEnd(e) {
|
|
12721
12748
|
return handleOnEnd(e);
|
|
12722
|
-
} })
|
|
12749
|
+
} }) : React__default.createElement(
|
|
12750
|
+
'video',
|
|
12751
|
+
{ style: { width: '100%' }, controls: true },
|
|
12752
|
+
React__default.createElement('source', { src: vidUrl, type: 'video/mp4' }),
|
|
12753
|
+
'Your browser does not support the video tag.'
|
|
12754
|
+
),
|
|
12723
12755
|
React__default.createElement(
|
|
12724
12756
|
'div',
|
|
12725
12757
|
{
|
|
@@ -12765,7 +12797,7 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
|
|
|
12765
12797
|
{ className: 'mb-3' },
|
|
12766
12798
|
nodes.videos[series - 1].title
|
|
12767
12799
|
),
|
|
12768
|
-
nodes.videos[series - 1] && React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({ serializers: getSerializers, blocks: nodes.videos[series - 1].text, imageOptions: { w: 320, h: 240, fit: 'max' } }, client.config()))
|
|
12800
|
+
nodes.videos[series - 1] && nodes.videos[series - 1].text && React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({ serializers: getSerializers, blocks: nodes.videos[series - 1].text, imageOptions: { w: 320, h: 240, fit: 'max' } }, client.config()))
|
|
12769
12801
|
),
|
|
12770
12802
|
React__default.createElement(
|
|
12771
12803
|
'style',
|
|
@@ -14656,7 +14688,7 @@ var RelatedContent = function RelatedContent(props) {
|
|
|
14656
14688
|
dataRecord.map(function (article, index) {
|
|
14657
14689
|
return React__default.createElement(
|
|
14658
14690
|
'a',
|
|
14659
|
-
{ href: '/view/' + article.url.current, className: 'related-article' },
|
|
14691
|
+
{ key: index, href: '/view/' + article.url.current, className: 'related-article' },
|
|
14660
14692
|
React__default.createElement(
|
|
14661
14693
|
'figure',
|
|
14662
14694
|
null,
|
package/dist/esm/index.js
CHANGED
|
@@ -12606,6 +12606,11 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
|
|
|
12606
12606
|
client = _ref.client,
|
|
12607
12607
|
getSerializers = _ref.getSerializers;
|
|
12608
12608
|
|
|
12609
|
+
var builder = imageUrlBuilder(client);
|
|
12610
|
+
function urlFor(source) {
|
|
12611
|
+
return builder.image(source);
|
|
12612
|
+
}
|
|
12613
|
+
|
|
12609
12614
|
var router = useRouter();
|
|
12610
12615
|
//state
|
|
12611
12616
|
|
|
@@ -12614,15 +12619,20 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
|
|
|
12614
12619
|
vidUrl = _useState2[0],
|
|
12615
12620
|
setVidUrl = _useState2[1];
|
|
12616
12621
|
|
|
12617
|
-
var _useState3 = useState(''),
|
|
12622
|
+
var _useState3 = useState('youtube'),
|
|
12618
12623
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
12619
|
-
|
|
12620
|
-
|
|
12624
|
+
vidType = _useState4[0],
|
|
12625
|
+
setVidType = _useState4[1];
|
|
12621
12626
|
|
|
12622
|
-
var _useState5 = useState(
|
|
12627
|
+
var _useState5 = useState(''),
|
|
12623
12628
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
12624
|
-
|
|
12625
|
-
|
|
12629
|
+
series = _useState6[0],
|
|
12630
|
+
setSeries = _useState6[1];
|
|
12631
|
+
|
|
12632
|
+
var _useState7 = useState([]),
|
|
12633
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
12634
|
+
seriesData = _useState8[0],
|
|
12635
|
+
setData = _useState8[1];
|
|
12626
12636
|
//variables
|
|
12627
12637
|
|
|
12628
12638
|
|
|
@@ -12633,19 +12643,36 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
|
|
|
12633
12643
|
var params = new URL(document.location).searchParams;
|
|
12634
12644
|
var seriesVid = params.get('seriesVid') || 1;
|
|
12635
12645
|
var data = [];
|
|
12646
|
+
|
|
12636
12647
|
nodes.videos.forEach(function (vid) {
|
|
12637
|
-
|
|
12648
|
+
if (vid.type == 'mp4') {
|
|
12649
|
+
data.push({ title: vid.title, thumbnail: urlFor(vid.thumbnail.asset), url: vid.url });
|
|
12650
|
+
} else {
|
|
12651
|
+
if (vid.thumbnail && vid.thumbnail.asset) {
|
|
12652
|
+
data.push({ title: vid.title, thumbnail: urlFor(vid.thumbnail.asset), url: vid.url });
|
|
12653
|
+
} else {
|
|
12654
|
+
data.push({ title: vid.title, thumbnail: 'https://img.youtube.com/vi/' + getYoutubeId(vid.url) + '/hqdefault.jpg', url: vid.url });
|
|
12655
|
+
}
|
|
12656
|
+
}
|
|
12638
12657
|
});
|
|
12639
12658
|
// if series number doesn't exist, route back to first vid of series
|
|
12659
|
+
|
|
12640
12660
|
if (data.length < seriesVid) {
|
|
12641
12661
|
setSeries(1);
|
|
12642
12662
|
setVidUrl(nodes.videos[0].url);
|
|
12663
|
+
if (nodes.videos[0].type) {
|
|
12664
|
+
setVidType(nodes.videos[0].type);
|
|
12665
|
+
}
|
|
12666
|
+
|
|
12643
12667
|
var newPath = '/' + get2 + '/' + get3 + '?seriesVid=1';
|
|
12644
12668
|
var vidState = { vid_id: seriesVid };
|
|
12645
12669
|
window.history.pushState(vidState, '', newPath);
|
|
12646
12670
|
} else {
|
|
12647
12671
|
setSeries(seriesVid);
|
|
12648
12672
|
setVidUrl(nodes.videos[seriesVid - 1].url);
|
|
12673
|
+
if (nodes.videos[0].type) {
|
|
12674
|
+
setVidType(nodes.videos[seriesVid - 1].type);
|
|
12675
|
+
}
|
|
12649
12676
|
}
|
|
12650
12677
|
setData(data);
|
|
12651
12678
|
}, []);
|
|
@@ -12715,9 +12742,14 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
|
|
|
12715
12742
|
React__default.createElement(
|
|
12716
12743
|
'div',
|
|
12717
12744
|
{ className: 'video-block', style: { position: 'relative', overflow: 'hidden' } },
|
|
12718
|
-
vidUrl && React__default.createElement(YouTube, { videoId: getYoutubeId(vidUrl), opts: opts, onEnd: function onEnd(e) {
|
|
12745
|
+
vidUrl && vidType == 'youtube' ? React__default.createElement(YouTube, { videoId: getYoutubeId(vidUrl), opts: opts, onEnd: function onEnd(e) {
|
|
12719
12746
|
return handleOnEnd(e);
|
|
12720
|
-
} })
|
|
12747
|
+
} }) : React__default.createElement(
|
|
12748
|
+
'video',
|
|
12749
|
+
{ style: { width: '100%' }, controls: true },
|
|
12750
|
+
React__default.createElement('source', { src: vidUrl, type: 'video/mp4' }),
|
|
12751
|
+
'Your browser does not support the video tag.'
|
|
12752
|
+
),
|
|
12721
12753
|
React__default.createElement(
|
|
12722
12754
|
'div',
|
|
12723
12755
|
{
|
|
@@ -12763,7 +12795,7 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
|
|
|
12763
12795
|
{ className: 'mb-3' },
|
|
12764
12796
|
nodes.videos[series - 1].title
|
|
12765
12797
|
),
|
|
12766
|
-
nodes.videos[series - 1] && React__default.createElement(BlockContent, _extends$2({ serializers: getSerializers, blocks: nodes.videos[series - 1].text, imageOptions: { w: 320, h: 240, fit: 'max' } }, client.config()))
|
|
12798
|
+
nodes.videos[series - 1] && nodes.videos[series - 1].text && React__default.createElement(BlockContent, _extends$2({ serializers: getSerializers, blocks: nodes.videos[series - 1].text, imageOptions: { w: 320, h: 240, fit: 'max' } }, client.config()))
|
|
12767
12799
|
),
|
|
12768
12800
|
React__default.createElement(
|
|
12769
12801
|
'style',
|
|
@@ -14654,7 +14686,7 @@ var RelatedContent = function RelatedContent(props) {
|
|
|
14654
14686
|
dataRecord.map(function (article, index) {
|
|
14655
14687
|
return React__default.createElement(
|
|
14656
14688
|
'a',
|
|
14657
|
-
{ href: '/view/' + article.url.current, className: 'related-article' },
|
|
14689
|
+
{ key: index, href: '/view/' + article.url.current, className: 'related-article' },
|
|
14658
14690
|
React__default.createElement(
|
|
14659
14691
|
'figure',
|
|
14660
14692
|
null,
|