@mjhls/mjh-framework 1.0.242 → 1.0.243
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 +39 -11
- package/dist/esm/index.js +39 -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,32 @@ 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
|
+
data.push({ title: vid.title, thumbnail: 'https://img.youtube.com/vi/' + YoutubeGroup.getYoutubeId(vid.url) + '/hqdefault.jpg', url: vid.url });
|
|
12654
|
+
}
|
|
12640
12655
|
});
|
|
12641
12656
|
// if series number doesn't exist, route back to first vid of series
|
|
12657
|
+
|
|
12642
12658
|
if (data.length < seriesVid) {
|
|
12643
12659
|
setSeries(1);
|
|
12644
12660
|
setVidUrl(nodes.videos[0].url);
|
|
12661
|
+
if (nodes.videos[0].type) {
|
|
12662
|
+
setVidType(nodes.videos[0].type);
|
|
12663
|
+
}
|
|
12664
|
+
|
|
12645
12665
|
var newPath = '/' + get2 + '/' + get3 + '?seriesVid=1';
|
|
12646
12666
|
var vidState = { vid_id: seriesVid };
|
|
12647
12667
|
window.history.pushState(vidState, '', newPath);
|
|
12648
12668
|
} else {
|
|
12649
12669
|
setSeries(seriesVid);
|
|
12650
12670
|
setVidUrl(nodes.videos[seriesVid - 1].url);
|
|
12671
|
+
if (nodes.videos[0].type) {
|
|
12672
|
+
setVidType(nodes.videos[seriesVid - 1].type);
|
|
12673
|
+
}
|
|
12651
12674
|
}
|
|
12652
12675
|
setData(data);
|
|
12653
12676
|
}, []);
|
|
@@ -12717,9 +12740,14 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
|
|
|
12717
12740
|
React__default.createElement(
|
|
12718
12741
|
'div',
|
|
12719
12742
|
{ className: 'video-block', style: { position: 'relative', overflow: 'hidden' } },
|
|
12720
|
-
vidUrl && React__default.createElement(YouTube, { videoId: YoutubeGroup.getYoutubeId(vidUrl), opts: opts, onEnd: function onEnd(e) {
|
|
12743
|
+
vidUrl && vidType == 'youtube' ? React__default.createElement(YouTube, { videoId: YoutubeGroup.getYoutubeId(vidUrl), opts: opts, onEnd: function onEnd(e) {
|
|
12721
12744
|
return handleOnEnd(e);
|
|
12722
|
-
} })
|
|
12745
|
+
} }) : React__default.createElement(
|
|
12746
|
+
'video',
|
|
12747
|
+
{ style: { width: '100%' }, controls: true },
|
|
12748
|
+
React__default.createElement('source', { src: vidUrl, type: 'video/mp4' }),
|
|
12749
|
+
'Your browser does not support the video tag.'
|
|
12750
|
+
),
|
|
12723
12751
|
React__default.createElement(
|
|
12724
12752
|
'div',
|
|
12725
12753
|
{
|
|
@@ -12765,7 +12793,7 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
|
|
|
12765
12793
|
{ className: 'mb-3' },
|
|
12766
12794
|
nodes.videos[series - 1].title
|
|
12767
12795
|
),
|
|
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()))
|
|
12796
|
+
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
12797
|
),
|
|
12770
12798
|
React__default.createElement(
|
|
12771
12799
|
'style',
|
|
@@ -14656,7 +14684,7 @@ var RelatedContent = function RelatedContent(props) {
|
|
|
14656
14684
|
dataRecord.map(function (article, index) {
|
|
14657
14685
|
return React__default.createElement(
|
|
14658
14686
|
'a',
|
|
14659
|
-
{ href: '/view/' + article.url.current, className: 'related-article' },
|
|
14687
|
+
{ key: index, href: '/view/' + article.url.current, className: 'related-article' },
|
|
14660
14688
|
React__default.createElement(
|
|
14661
14689
|
'figure',
|
|
14662
14690
|
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,32 @@ 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
|
+
data.push({ title: vid.title, thumbnail: 'https://img.youtube.com/vi/' + getYoutubeId(vid.url) + '/hqdefault.jpg', url: vid.url });
|
|
12652
|
+
}
|
|
12638
12653
|
});
|
|
12639
12654
|
// if series number doesn't exist, route back to first vid of series
|
|
12655
|
+
|
|
12640
12656
|
if (data.length < seriesVid) {
|
|
12641
12657
|
setSeries(1);
|
|
12642
12658
|
setVidUrl(nodes.videos[0].url);
|
|
12659
|
+
if (nodes.videos[0].type) {
|
|
12660
|
+
setVidType(nodes.videos[0].type);
|
|
12661
|
+
}
|
|
12662
|
+
|
|
12643
12663
|
var newPath = '/' + get2 + '/' + get3 + '?seriesVid=1';
|
|
12644
12664
|
var vidState = { vid_id: seriesVid };
|
|
12645
12665
|
window.history.pushState(vidState, '', newPath);
|
|
12646
12666
|
} else {
|
|
12647
12667
|
setSeries(seriesVid);
|
|
12648
12668
|
setVidUrl(nodes.videos[seriesVid - 1].url);
|
|
12669
|
+
if (nodes.videos[0].type) {
|
|
12670
|
+
setVidType(nodes.videos[seriesVid - 1].type);
|
|
12671
|
+
}
|
|
12649
12672
|
}
|
|
12650
12673
|
setData(data);
|
|
12651
12674
|
}, []);
|
|
@@ -12715,9 +12738,14 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
|
|
|
12715
12738
|
React__default.createElement(
|
|
12716
12739
|
'div',
|
|
12717
12740
|
{ className: 'video-block', style: { position: 'relative', overflow: 'hidden' } },
|
|
12718
|
-
vidUrl && React__default.createElement(YouTube, { videoId: getYoutubeId(vidUrl), opts: opts, onEnd: function onEnd(e) {
|
|
12741
|
+
vidUrl && vidType == 'youtube' ? React__default.createElement(YouTube, { videoId: getYoutubeId(vidUrl), opts: opts, onEnd: function onEnd(e) {
|
|
12719
12742
|
return handleOnEnd(e);
|
|
12720
|
-
} })
|
|
12743
|
+
} }) : React__default.createElement(
|
|
12744
|
+
'video',
|
|
12745
|
+
{ style: { width: '100%' }, controls: true },
|
|
12746
|
+
React__default.createElement('source', { src: vidUrl, type: 'video/mp4' }),
|
|
12747
|
+
'Your browser does not support the video tag.'
|
|
12748
|
+
),
|
|
12721
12749
|
React__default.createElement(
|
|
12722
12750
|
'div',
|
|
12723
12751
|
{
|
|
@@ -12763,7 +12791,7 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
|
|
|
12763
12791
|
{ className: 'mb-3' },
|
|
12764
12792
|
nodes.videos[series - 1].title
|
|
12765
12793
|
),
|
|
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()))
|
|
12794
|
+
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
12795
|
),
|
|
12768
12796
|
React__default.createElement(
|
|
12769
12797
|
'style',
|
|
@@ -14654,7 +14682,7 @@ var RelatedContent = function RelatedContent(props) {
|
|
|
14654
14682
|
dataRecord.map(function (article, index) {
|
|
14655
14683
|
return React__default.createElement(
|
|
14656
14684
|
'a',
|
|
14657
|
-
{ href: '/view/' + article.url.current, className: 'related-article' },
|
|
14685
|
+
{ key: index, href: '/view/' + article.url.current, className: 'related-article' },
|
|
14658
14686
|
React__default.createElement(
|
|
14659
14687
|
'figure',
|
|
14660
14688
|
null,
|