mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-01-24 07:09:05 +01:00
1 line
19 KiB
JavaScript
1 line
19 KiB
JavaScript
!function(){"use strict";var e={4311:function(e,t,n){var i=n(2667),a=(n(2004),n(8407),n(4458),n(5101),n(9808),n(5466)),l=(n(6116),n(8204)),o=n(4426),r=n(8349),s=n(5971),p=n(7801),u=n(2431),c=n(3074),m=n.n(c),d=n(1345);function y(e){return a.createElement(d.C,{items:e.media,playlistId:e.playlistId,hidePlaylistOptions:e.hidePlaylistOptions,singleLinkContent:!0,hideDate:!0,hideViews:!0,hidePlaylistOrderNumber:!1,horizontalItemsOrientation:!0,itemsCountCallback:e.itemsCountCallback,pageItems:99999,inPlaylistPage:!0})}y.propTypes={media:m().array.isRequired,playlistId:m().string.isRequired,itemsCountCallback:m().func,hidePlaylistOptions:m().bool},y.defaultProps={hidePlaylistOptions:!0};var f=n(7207),h=n(2836),g=n(8420),v=n(2331),P=n(8534),b=n(6008),E=n(3562),C=n(8852);function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function R(e,t,n){return t&&k(e.prototype,t),n&&k(e,n),e}function Z(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&L(e,t)}function L(e,t){return(L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function N(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=D(e);if(t){var a=D(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return S(this,n)}}function S(e,t){return!t||"object"!==O(t)&&"function"!=typeof t?w(e):t}function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function D(e){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var I=function(e){Z(n,e);var t=N(n);function n(e){var i;return _(this,n),(i=t.call(this,e)).state={isOpenMoreOptionsMenu:!1,optionsCurrentPage:"main"},i.onPopupsDisplayChange=i.onPopupsDisplayChange.bind(w(i)),i.onOptionsPageChangeCallback=i.onOptionsPageChangeCallback.bind(w(i)),i.proceedPlaylistRemoval=i.proceedPlaylistRemoval.bind(w(i)),i.cancelPlaylistRemoval=i.cancelPlaylistRemoval.bind(w(i)),i.settingOptionsList={deleteMedia:{itemType:"open-subpage",text:"Delete",icon:"delete",buttonAttr:{className:"change-page","data-page-id":"proceedPlaylistRemovalPopup"}}},i.moreOptionsPages={main:a.createElement(h.W8,null,a.createElement(P.S,{items:[i.settingOptionsList.deleteMedia]})),proceedPlaylistRemovalPopup:a.createElement(h.W8,null,a.createElement("div",{className:"popup-message"},a.createElement("span",{className:"popup-message-title"},"Playlist removal"),a.createElement("span",{className:"popup-message-main"},"You're willing to remove playlist permanently?")),a.createElement("hr",null),a.createElement("span",{className:"popup-message-bottom"},a.createElement("button",{className:"button-link cancel-playlist-removal",onClick:i.cancelPlaylistRemoval},"CANCEL"),a.createElement("button",{className:"button-link proceed-playlist-removal",onClick:i.proceedPlaylistRemoval},"PROCEED")))},i.initMoreOptionsPopup(),i}return R(n,[{key:"initMoreOptionsPopup",value:function(){this.optionsPopup=new f.Z(a.createElement(u.M,null,a.createElement(v.O,{type:"more_horiz"})),a.createElement(E.o,{pageChangeCallback:this.onOptionsPageChangeCallback,initPage:"main",focusFirstItemOnPageChange:!1,pages:this.moreOptionsPages,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id"}),this.onPopupsDisplayChange)}},{key:"proceedPlaylistRemoval",value:function(){this.optionsPopup.setOpenPopupState(!1),s.vg()}},{key:"cancelPlaylistRemoval",value:function(){this.optionsPopup.setOpenPopupState(!1)}},{key:"onOptionsPageChangeCallback",value:function(e){this.setState({optionsCurrentPage:e})}},{key:"onPopupsDisplayChange",value:function(){this.setState({isOpenMoreOptionsMenu:this.optionsPopup.isPopupOpen(),optionsCurrentPage:this.optionsPopup.isPopupOpen()?this.state.optionsCurrentPage:"main"})}},{key:"render",value:function(){return a.createElement("div",{className:"playlist-options-wrap"+("main"===this.state.optionsCurrentPage?" playlist-options-main":"")},this.optionsPopup.triggerComponent(),this.state.isOpenMoreOptionsMenu?this.optionsPopup.contentComponent():null)}}]),n}(a.PureComponent),T=function(e){Z(n,e);var t=N(n);function n(e){var i;return _(this,n),(i=t.call(this,e)).state={isOpenForm:!1,title:p.Z.get("title"),description:p.Z.get("description")},i.onPopupsDisplayChange=i.onPopupsDisplayChange.bind(w(i)),i.onFormSave=i.onFormSave.bind(w(i)),i.onClickExit=i.onClickExit.bind(w(i)),i.playlistUpdateCompleted=i.playlistUpdateCompleted.bind(w(i)),i.playlistUpdateFailed=i.playlistUpdateFailed.bind(w(i)),p.Z.on("playlist_update_completed",i.playlistUpdateCompleted),p.Z.on("playlist_update_failed",i.playlistUpdateFailed),i.playlistRemovalCompleted=i.playlistRemovalCompleted.bind(w(i)),i.playlistRemovalFailed=i.playlistRemovalFailed.bind(w(i)),p.Z.on("playlist_removal_completed",i.playlistRemovalCompleted),p.Z.on("playlist_removal_failed",i.playlistRemovalFailed),i.initFormPopup(),i}return R(n,[{key:"onClickExit",value:function(){this.optionsPopup.setOpenPopupState(!1),this.setState({isOpenForm:this.optionsPopup.isPopupOpen()})}},{key:"initFormPopup",value:function(){this.optionsPopup=new f.Z(a.createElement(u.M,null,a.createElement(v.O,{type:"edit"}),a.createElement("span",null,"EDIT")),a.createElement("div",{className:"popup-fullscreen"},a.createElement(h.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement("div",{className:"edit-playlist-form-wrap"},a.createElement("div",{className:"edit-playlist-popup-title"},"Edit playlist",a.createElement(u.M,{type:"button",onClick:this.onClickExit},a.createElement(v.O,{type:"close"}))),a.createElement(b.A,{date:(new Date).getTime(),id:p.Z.get("playlistId"),onCancel:this.onClickExit,onPlaylistSave:this.onFormSave})))),this.onPopupsDisplayChange)}},{key:"onPopupsDisplayChange",value:function(){this.setState({isOpenForm:this.optionsPopup.isPopupOpen()})}},{key:"onFormSave",value:function(){}},{key:"playlistUpdateCompleted",value:function(e){setTimeout(function(){r.wN("Playlist updated","playlistUpdateCompleted"),this.onClickExit()}.bind(this),100)}},{key:"playlistUpdateFailed",value:function(){setTimeout(function(){r.wN("Playlist update failed","playlistUpdateFailed"),this.onClickExit()}.bind(this),100)}},{key:"playlistRemovalCompleted",value:function(e){setTimeout((function(){r.wN("Playlist removed. Redirecting...","playlistDelete"),setTimeout((function(){window.location.href=o.Z.get("config-user").pages.playlists}),2e3)}),100)}},{key:"playlistRemovalFailed",value:function(e){setTimeout((function(){r.wN("Playlist removal failed","playlistDeleteFail")}),100)}},{key:"render",value:function(){return a.createElement("div",{className:"edit-playlist"},this.optionsPopup.triggerComponent(),this.state.isOpenForm?this.optionsPopup.contentComponent():null)}}]),n}(a.PureComponent),M=function(e){Z(n,e);var t=N(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n,[{key:"render",value:function(){if(!this.props.thumb)return null;var e;return e=this.props.media&&this.props.media.length?a.createElement("a",{href:this.props.media[0].url+"&pl="+this.props.id,title:""},a.createElement("span",null,a.createElement("img",{src:this.props.thumb,alt:""}),a.createElement("span",{className:"play-all"},a.createElement("span",null,a.createElement("span",null,a.createElement("i",{className:"material-icons"},"play_arrow"),a.createElement("span",{className:"play-all-label"},"PLAY ALL")))))):a.createElement("span",null,a.createElement("span",null,a.createElement("img",{src:this.props.thumb,alt:""}),a.createElement("span",{className:"play-all"},a.createElement("span",null,a.createElement("span",null,a.createElement("i",{className:"material-icons"},"play_arrow"),a.createElement("span",{className:"play-all-label"},"PLAY ALL")))))),a.createElement("div",{className:"playlist-thumb"+(this.props.thumb?"":" no-thumb"),style:{backgroundImage:'url("'+this.props.thumb+'")'}},e)}}]),n}(a.PureComponent),A=function(e){Z(n,e);var t=N(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n,[{key:"render",value:function(){return a.createElement("div",{className:"playlist-title"},a.createElement("h1",null,this.props.title))}}]),n}(a.PureComponent),F=function(e){Z(n,e);var t=N(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n,[{key:"render",value:function(){return a.createElement("div",{className:"playlist-meta"},a.createElement("div",{className:"playlist-videos-number"},this.props.totalItems," media"),this.props.dateLabel?a.createElement("div",{className:"playlist-last-update"},this.props.dateLabel):null)}}]),n}(a.PureComponent),U=function(e){Z(n,e);var t=N(n);function n(e){return _(this,n),t.call(this,e)}return R(n,[{key:"render",value:function(){return this.props.loggedinUserPlaylist?a.createElement("div",{className:"playlist-actions"},this.props.loggedinUserPlaylist?a.createElement(I,null):null):null}}]),n}(a.PureComponent),x=function(e){Z(n,e);var t=N(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n,[{key:"render",value:function(){return a.createElement("div",{className:"playlist-author"},a.createElement("div",null,a.createElement("div",{className:"playlist-author-thumb"},a.createElement("a",{href:this.props.link,title:this.props.name},this.props.thumb?a.createElement("span",{style:{backgroundImage:"url("+this.props.thumb+")"}},a.createElement("img",{src:this.props.thumb,alt:""})):a.createElement("span",null,a.createElement(v.O,{type:"person"})))),a.createElement("div",{className:"playlist-author-name"},a.createElement("a",{href:this.props.link,title:this.props.name},this.props.name)),this.props.loggedinUserPlaylist?a.createElement(T,null):null))}}]),n}(a.PureComponent),j=function(e){Z(n,e);var t=N(n);function n(e){var i;return _(this,n),(i=t.call(this,e)).state={mediaData:e.media},i.onItemsCount=i.onItemsCount.bind(w(i)),i}return R(n,[{key:"onItemsCount",value:function(){if(this.props.loggedinUserPlaylist){var e=this.props.id,t=this.state.mediaData;l=l.bind(this);var n=this.refs.playlistMediaList.querySelector(".items-list");C.Z.create(n,{onStart:function(e){n.classList.add("on-dragging")},onEnd:function(r){for(var s,p,u,c=[],m=n.querySelectorAll(".item-order-number div div"),d=0;d<m.length;)(p=d+1)!==(s=parseInt(m[d].innerHTML,10))&&(u=t[s-1].friendly_token,(0,g.GH)(o.Z.get("api-playlists")+"/"+e,{type:"ordering",ordering:p,media_friendly_token:u},{headers:{"X-CSRFToken":(0,g.m5)()}},!1,i,a)),c.push(s-1),m[d].innerHTML=p,d+=1;n.classList.remove("on-dragging"),l(c)}})}function i(e){}function a(e){}function l(e){for(var n=[],i=0;i<e.length;)n.push(t[e[i]]),i+=1;t=n,this.setState({mediaData:n}),s.wg(n)}}},{key:"render",value:function(){return a.createElement("div",{key:"playlistMediaList",ref:"playlistMediaList",className:"playlist-videos-list"+(this.props.loggedinUserPlaylist?" draggable":"")},this.state.mediaData.length?a.createElement(y,{itemsCountCallback:this.onItemsCount,playlistId:this.props.id,media:this.state.mediaData,hidePlaylistOptions:!this.props.loggedinUserPlaylist}):null)}}]),n}(a.PureComponent),G=function(e){Z(n,e);var t=N(n);function n(e){var i;return _(this,n),(i=t.call(this,e,"playlist-page")).state={thumb:p.Z.get("thumb"),media:p.Z.get("playlist-media"),savedPlaylist:p.Z.get("saved-playlist"),loggedinUserPlaylist:p.Z.get("logged-in-user-playlist"),title:p.Z.get("title"),description:p.Z.get("description")},i.onLoadPlaylistData=i.onLoadPlaylistData.bind(w(i)),p.Z.on("loaded_playlist_data",i.onLoadPlaylistData),i.onMediaRemovedFromPlaylist=i.onMediaRemovedFromPlaylist.bind(w(i)),p.Z.on("removed_media_from_playlist",i.onMediaRemovedFromPlaylist),i.onMediaReorderedInPlaylist=i.onMediaReorderedInPlaylist.bind(w(i)),p.Z.on("reordered_media_in_playlist",i.onMediaReorderedInPlaylist),i.onCompletePlaylistUpdate=i.onCompletePlaylistUpdate.bind(w(i)),p.Z.on("playlist_update_completed",i.onCompletePlaylistUpdate),i}return R(n,[{key:"onCompletePlaylistUpdate",value:function(){this.setState({thumb:p.Z.get("thumb"),title:p.Z.get("title"),description:p.Z.get("description")})}},{key:"onLoadPlaylistData",value:function(){this.setState({thumb:p.Z.get("thumb"),title:p.Z.get("title"),description:p.Z.get("description"),media:p.Z.get("playlist-media"),savedPlaylist:p.Z.get("saved-playlist"),loggedinUserPlaylist:p.Z.get("logged-in-user-playlist")})}},{key:"componentDidMount",value:function(){s.AJ()}},{key:"onMediaRemovedFromPlaylist",value:function(){this.setState({media:p.Z.get("playlist-media"),thumb:p.Z.get("thumb")})}},{key:"onMediaReorderedInPlaylist",value:function(){this.setState({media:p.Z.get("playlist-media"),thumb:p.Z.get("thumb")})}},{key:"pageContent",value:function(){var e=p.Z.get("playlistId");return e?[a.createElement("div",{key:"playlistDetails",className:"playlist-details"},a.createElement(M,{id:e,thumb:this.state.thumb,media:this.state.media}),a.createElement(A,{title:this.state.title}),a.createElement(F,{totalItems:p.Z.get("total-items"),dateLabel:p.Z.get("date-label"),viewsCount:p.Z.get("views-count")}),a.createElement(U,{loggedinUserPlaylist:this.state.loggedinUserPlaylist,savedPlaylist:this.state.savedPlaylist}),this.state.description?a.createElement("div",{className:"playlist-description"},this.state.description):null,a.createElement(x,{name:p.Z.get("author-name"),link:p.Z.get("author-link"),thumb:p.Z.get("author-thumb"),loggedinUserPlaylist:this.state.loggedinUserPlaylist})),a.createElement(j,{key:"playlistMediaList_"+this.state.media.length,id:e,media:this.state.media,loggedinUserPlaylist:this.state.loggedinUserPlaylist})]:null}}]),n}(l.T);(0,i.X)("page-playlist",G)},7188:function(e,t,n){n(9751),n(3233)},8024:function(e,t,n){function i(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function a(e,t){e.classList?e.classList.add(t):e.className+=" "+t}function l(e,t){return e.className&&new RegExp("(\\s|^)"+t+"(\\s|$)").test(e.className)}n.d(t,{dt:function(){return i},Ec:function(){return a},mO:function(){return l}}),n(7441),n(7390),n(2322),n(4669),n(3296),n(9268)},8420:function(e,t,n){n.d(t,{A_:function(){return i.Z},j0:function(){return a.Z},GH:function(){return l.Z},Jl:function(){return o.Z},v$:function(){return r.Z},uf:function(){return s.Z},$4:function(){return p.Z},hm:function(){return u.Z},m5:function(){return c.Z}});var i=n(1712),a=n(9752),l=n(84),o=n(9009),r=n(1438),s=n(4135),p=n(3140),u=(n(1752),n(7514),n(7634)),c=(n(1569),n(6203));n(7188)},3699:function(e,t,n){n.d(t,{createPlaylist:function(){return l}}),n(2322),n(3296);var i=n(8416),a=n.n(i);function l(e){a().dispatch({type:"CREATE_PLAYLIST",playlist_data:e})}},5971:function(e,t,n){n.d(t,{AJ:function(){return l},CE:function(){return o},vg:function(){return r},X1:function(){return s},wg:function(){return p}});var i=n(8416),a=n.n(i);function l(){a().dispatch({type:"LOAD_PLAYLIST_DATA"})}function o(e){a().dispatch({type:"UPDATE_PLAYLIST",playlist_data:e})}function r(){a().dispatch({type:"REMOVE_PLAYLIST"})}function s(e,t){a().dispatch({type:"MEDIA_REMOVED_FROM_PLAYLIST",media_id:e,playlist_id:t})}function p(e){a().dispatch({type:"PLAYLIST_MEDIA_REORDERED",playlist_media:e})}},8204:function(e,t,n){n.d(t,{T:function(){return m}}),n(5101);var i=n(5466),a=(n(6116),n(8349)),l=n(9690),o=n(7370);function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var m=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(y,e);var t,n,r,m,d=(r=y,m=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=c(r);if(m){var n=c(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return u(this,e)});function y(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,y),n=d.call(this,e),void 0!==t&&a.df(t),n}return t=y,(n=[{key:"render",value:function(){return[i.createElement(l.Z,{key:"page-main"},this.pageContent()),i.createElement(o.T,{key:"notifications"})]}}])&&s(t.prototype,n),y}(i.PureComponent)},8349:function(e,t,n){n.d(t,{sc:function(){return l},df:function(){return o},Zr:function(){return r},vh:function(){return s},Qb:function(){return p},wN:function(){return u}});var i=n(8416),a=n.n(i);function l(){a().dispatch({type:"TOGGLE_PAGE_SIDEBAR"})}function o(e){a().dispatch({type:"INIT_PAGE",page:e})}function r(e){a().dispatch({type:"INIT_SIDEBAR",page:e})}function s(e){a().dispatch({type:"TOGGLE_MOBILE_SEARCH_FIELD",open:e})}function p(e){a().dispatch({type:"TOGGLE_DARK_THEME"})}function u(e,t){a().dispatch({type:"ADD_NOTIFICATION",notification:e,notificationId:t})}}},t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={exports:{}};return e[i].call(a.exports,a,a.exports,n),a.exports}n.m=e,n.x=function(){},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.j=449,function(){var e={449:0},t=[[4311,431]],i=function(){},a=function(a,l){for(var o,r,s=l[0],p=l[1],u=l[2],c=l[3],m=0,d=[];m<s.length;m++)r=s[m],n.o(e,r)&&e[r]&&d.push(e[r][0]),e[r]=0;for(o in p)n.o(p,o)&&(n.m[o]=p[o]);for(u&&u(n),a&&a(l);d.length;)d.shift()();return c&&t.push.apply(t,c),i()},l=self.webpackChunk_mediacms_frontend=self.webpackChunk_mediacms_frontend||[];function o(){for(var i,a=0;a<t.length;a++){for(var l=t[a],o=!0,r=1;r<l.length;r++){var s=l[r];0!==e[s]&&(o=!1)}o&&(t.splice(a--,1),i=n(n.s=l[0]))}return 0===t.length&&(n.x(),n.x=function(){}),i}l.forEach(a.bind(null,0)),l.push=a.bind(null,l.push.bind(l));var r=n.x;n.x=function(){return n.x=r||function(){},(i=o)()}}(),n.x()}(); |