mediacms/static/js/history.js

1 wiersz
11 KiB
JavaScript

!function(){"use strict";var t={6768:function(t,e,n){var r=n(2667),o=(n(5101),n(6394),n(3080),n(4669),n(5466)),i=n(3074),u=n.n(i),a=n(8204),c=n(4426),s=n(1397),f=n(5261),l=(n(6116),n(2259)),p=n(612),h=n(5464);function y(t){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function m(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function b(t,e){return!e||"object"!==y(e)&&"function"!=typeof e?v(t):e}function v(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(t){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}n(8170);var w=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)}(a,t);var e,n,r,i,u=(r=a,i=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(t){return!1}}(),function(){var t,e=g(r);if(i){var n=g(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return b(this,t)});function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(e=u.call(this,t,"author-history")).state={resultsCount:null},e.getCountFunc=e.getCountFunc.bind(v(e)),e}return e=a,(n=[{key:"getCountFunc",value:function(t){this.setState({resultsCount:t})}},{key:"pageContent",value:function(){return[this.state.author?o.createElement(p.Z,{key:"ProfilePagesHeader",author:this.state.author,type:"history"}):null,this.state.author?o.createElement(h.Z,{key:"ProfilePagesContent"},o.createElement(s._,{title:this.props.title+(null!==this.state.resultsCount?" ("+this.state.resultsCount+")":""),className:"items-list-ver"},o.createElement(f.J,{itemsCountCallback:this.getCountFunc,requestUrl:c.Z.get("api-user-history"),hideAuthor:!c.Z.get("config-media-item").displayAuthor,hideViews:!c.Z.get("config-media-item").displayViews,hideDate:!c.Z.get("config-media-item").displayPublishDate,canEdit:!1}))):null]}}])&&m(e.prototype,n),a}(l.G);l.G.propTypes={title:u().string.isRequired},l.G.defaultProps={title:"Media history"};var P=n(8024);function _(t){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function O(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function C(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function k(t,e,n){return e&&C(t.prototype,e),n&&C(t,n),t}function D(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&R(t,e)}function R(t,e){return(R=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function j(t){var e=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(t){return!1}}();return function(){var n,r=x(t);if(e){var o=x(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return S(this,n)}}function S(t,e){return!e||"object"!==_(e)&&"function"!=typeof e?E(t):e}function E(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function x(t){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var F=function(t){D(n,t);var e=j(n);function n(t){var r;return O(this,n),(r=e.call(this,t,"history-media")).state={resultsCount:null},r.getCountFunc=r.getCountFunc.bind(E(r)),r}return k(n,[{key:"getCountFunc",value:function(t){this.setState({resultsCount:t})}},{key:"pageContent",value:function(){return o.createElement(s._,{title:this.props.title+(null!==this.state.resultsCount?" ("+this.state.resultsCount+")":""),className:"search-results-wrap items-list-hor"},o.createElement(f.J,{singleLinkContent:!1,horizontalItemsOrientation:!0,itemsCountCallback:this.getCountFunc,requestUrl:this.props.api_url,hideViews:!c.Z.get("config-media-item").displayViews,hideAuthor:!c.Z.get("config-media-item").displayAuthor,hideDate:!c.Z.get("config-media-item").displayPublishDate}))}}]),n}(a.T);F.propTypes={title:u().string.isRequired,api_url:u().string.isRequired},F.defaultProps={title:"Media history",api_url:c.Z.get("api-user-history")};var Z=function(t){D(n,t);var e=j(n);function n(t){return O(this,n),e.call(this,t)}return k(n,[{key:"render",value:function(){return c.Z.get("config-user").is.anonymous||!c.Z.get("config-options").pages.profile.includeHistory?o.createElement(F,null):((0,P.Ec)(document.getElementById("page-history"),"profile-page-history"),window.MediaCMS.profileId=c.Z.get("config-user").username,o.createElement(w,null))}}]),n}(o.PureComponent);(0,r.X)("page-history",Z)},9009:function(t,e,n){n(6394),n(5334),n(7588);var r=n(4559);function o(t,e,n,r,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,o)}function i(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var u=t.apply(e,n);function a(t){o(u,r,i,a,c,"next",t)}function c(t){o(u,r,i,a,c,"throw",t)}a(void 0)}))}}function u(){return(u=i(regeneratorRuntime.mark((function t(e,n,o,i,u){var a,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(c=function(t){u instanceof Function&&u(t)},a=function(t){i instanceof Function&&i(t)},n=n||{},!o){t.next=8;break}return t.next=6,r.delete(e,n||null).then(a).catch(c||null);case 6:t.next=9;break;case 8:r.delete(e,n||null).then(a).catch(c||null);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}n(6028),e.Z=function(t,e,n,r,o){return u.apply(this,arguments)}},6203:function(t,e,n){n(2322),n(9268),n(3233),e.Z=function(){var t,e,n,r=null;if(document.cookie&&""!==document.cookie)for(e=document.cookie.split(";"),t=0;t<e.length;){if("csrftoken="===(n=e[t].trim()).substring(0,10)){r=decodeURIComponent(n.substring(10));break}t+=1}return r}},8170:function(t,e,n){n(4458),n(5101),n(6394),n(3080),n(4669),n(5466);var r=n(1590),o=n.n(r),i=n(8420),u=n(4426);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?l(t):e}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}(h,t);var e,n,r,o,a=(r=h,o=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(t){return!1}}(),function(){var t,e=p(r);if(o){var n=p(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return f(this,t)});function h(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,h),(t=a.call(this)).authorData=null,t.onDataLoad=t.onDataLoad.bind(l(t)),t.onDataLoadFail=t.onDataLoadFail.bind(l(t)),t.removeProfileResponse=t.removeProfileResponse.bind(l(t)),t.removeProfileFail=t.removeProfileFail.bind(l(t)),t.removingProfile=!1,t}return e=h,(n=[{key:"removeProfileResponse",value:function(t){t&&204===t.status&&this.emit("profile_delete",this.authorData.username)}},{key:"removeProfileFail",value:function(){this.emit("profile_delete_fail",this.authorData.username),setTimeout((function(t){this.removingProfile=!1}),100,this)}},{key:"get",value:function(t){switch(t){case"author-data":return this.authorData}}},{key:"onDataLoad",value:function(t){t&&t.data&&(this.authorData=t.data,this.authorData.id=this.authorData.username,this.authorData.name=""!==this.authorData.name?this.authorData.name:this.authorData.username,this.emit("load-author-data"))}},{key:"onDataLoadFail",value:function(t){}},{key:"actions_handler",value:function(t){switch(t.type){case"REMOVE_PROFILE":if(this.removingProfile)return;this.removingProfile=!0;var e=u.Z.get("api-users")+"/"+this.authorData.username;(0,i.Jl)(e,{headers:{"X-CSRFToken":(0,i.m5)()}},!1,this.removeProfileResponse,this.removeProfileFail);break;case"LOAD_AUTHOR_DATA":(0,i.A_)(u.Z.get("api-users")+"/"+window.MediaCMS.profileId,!1,this.onDataLoad,this.onDataLoadFail)}}}])&&c(e.prototype,n),h}(o());e.Z=(0,i.v$)(new h,"actions_handler")}},e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}n.m=t,n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.j=908,function(){var t={908:0},e=[[6768,431]],r=function(){};function o(){for(var r,o=0;o<e.length;o++){for(var i=e[o],u=!0,a=1;a<i.length;a++){var c=i[a];0!==t[c]&&(u=!1)}u&&(e.splice(o--,1),r=n(n.s=i[0]))}return 0===e.length&&(n.x(),n.x=function(){}),r}n.x=function(){n.x=function(){},u=u.slice();for(var t=0;t<u.length;t++)i(u[t]);return(r=o)()};var i=function(o){for(var i,u,c=o[0],s=o[1],f=o[2],l=o[3],p=0,h=[];p<c.length;p++)u=c[p],n.o(t,u)&&t[u]&&h.push(t[u][0]),t[u]=0;for(i in s)n.o(s,i)&&(n.m[i]=s[i]);for(f&&f(n),a(o);h.length;)h.shift()();return l&&e.push.apply(e,l),r()},u=self.webpackChunk_mediacms_frontend=self.webpackChunk_mediacms_frontend||[],a=u.push.bind(u);u.push=i}(),n.x()}();