pixelfed/public/js/loops.js

1 line
10 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{11:function(t,e,n){t.exports=n("v6kC")},"9tPo":function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,r=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,i=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?t:(o=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:r+i.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},I1BE:function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var o=(s=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),i=r.sources.map((function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"}));return[n].concat(i).concat([o]).join("\n")}var s;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<t.length;o++){var s=t[o];"number"==typeof s[0]&&r[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),e.push(s))}},e}},"KHd+":function(t,e,n){"use strict";function r(t,e,n,r,o,i,s,a){var c,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),s?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=c):o&&(c=a?function(){o.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:o),c)if(u.functional){u._injectStyles=c;var l=u.render;u.render=function(t,e){return c.call(e),l(t,e)}}else{var f=u.beforeCreate;u.beforeCreate=f?[].concat(f,c):[c]}return{exports:t,options:u}}n.d(e,"a",(function(){return r}))},LsAn:function(t,e,n){(t.exports=n("I1BE")(!1)).push([t.i,"\n.loops-container .card {\n\tbox-shadow: none;\n}\n.loops-container .card .card-img-top{\n\tborder-radius: 0;\n}\n.loops-container a {\n\tcolor: #343a40;\n}\na.hashtag,\n.loops-container .card-body a:hover {\n\tcolor: #28a745 !important;\n}\n",""])},ZmVo:function(t,e,n){"use strict";n("iXJE")},"aET+":function(t,e,n){var r,o,i={},s=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=r.apply(this,arguments)),o}),a=function(t,e){return e?e.querySelector(t):document.querySelector(t)},c=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var r=a.call(this,t,n);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[t]=r}return e[t]}}(),u=null,l=0,f=[],d=n("9tPo");function p(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=i[r.id];if(o){o.refs++;for(var s=0;s<o.parts.length;s++)o.parts[s](r.parts[s]);for(;s<r.parts.length;s++)o.parts.push(g(r.parts[s],e))}else{var a=[];for(s=0;s<r.parts.length;s++)a.push(g(r.parts[s],e));i[r.id]={id:r.id,refs:1,parts:a}}}}function v(t,e){for(var n=[],r={},o=0;o<t.length;o++){var i=t[o],s=e.base?i[0]+e.base:i[0],a={css:i[1],media:i[2],sourceMap:i[3]};r[s]?r[s].parts.push(a):n.push(r[s]={id:s,parts:[a]})}return n}function h(t,e){var n=c(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=f[f.length-1];if("top"===t.insertAt)r?r.nextSibling?n.insertBefore(e,r.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),f.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=c(t.insertAt.before,n);n.insertBefore(e,o)}}function b(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=f.indexOf(t);e>=0&&f.splice(e,1)}function m(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var r=function(){0;return n.nc}();r&&(t.attrs.nonce=r)}return y(e,t.attrs),h(t,e),e}function y(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function g(t,e){var n,r,o,i;if(e.transform&&t.css){if(!(i="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=i}if(e.singleton){var s=l++;n=u||(u=m(e)),r=C.bind(null,n,s,!1),o=C.bind(null,n,s,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",y(e,t.attrs),h(t,e),e}(e),r=S.bind(null,n,e),o=function(){b(n),n.href&&URL.revokeObjectURL(n.href)}):(n=m(e),r=x.bind(null,n),o=function(){b(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=s()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=v(t,e);return p(n,e),function(t){for(var r=[],o=0;o<n.length;o++){var s=n[o];(a=i[s.id]).refs--,r.push(a)}t&&p(v(t,e),e);for(o=0;o<r.length;o++){var a;if(0===(a=r[o]).refs){for(var c=0;c<a.parts.length;c++)a.parts[c]();delete i[a.id]}}}};var _,w=(_=[],function(t,e){return _[t]=e,_.filter(Boolean).join("\n")});function C(t,e,n,r){var o=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=w(e,o);else{var i=document.createTextNode(o),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(i,s[e]):t.appendChild(i)}}function x(t,e){var n=e.css,r=e.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function S(t,e,n){var r=n.css,o=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||i)&&(r=d(r)),o&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var s=new Blob([r],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(s),a&&URL.revokeObjectURL(a)}},i8Ta:function(t,e,n){"use strict";n.r(e);Object.defineProperty(HTMLMediaElement.prototype,"playing",{get:function(){return!!(this.currentTime>0&&!this.paused&&!this.ended&&this.readyState>2)}});var r={data:function(){return{loading:!0,version:1,loops:[],tab:"new"}},mounted:function(){var t=this;axios.get("/api/v2/loops").then((function(e){t.loops=e.data,t.loading=!1}))},methods:{videoSrc:function(t){return t.media_attachments[0].url},posterSrc:function(t){return t.media_attachments[0].preview_url},setTab:function(t){this.tab=t},toggleVideo:function(t,e){var n=e.target;$("video").each((function(){n.src!=$(this)[0].src&&$(this)[0].pause()})),n.playing?n.pause():n.play()},incrementLoop:function(t){},timestamp:function(t){return new Date(t.created_at).toLocaleDateString()},getTitle:function(t){return(t.content?t.content:"Untitled").trim()},truncate:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;return _.truncate(t,{length:e})}}},o=(n("ZmVo"),n("KHd+")),i=Object(o.a)(r,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"w-100 h-100"},[t.loading?n("div",{staticClass:"d-flex justify-content-center align-items-center",staticStyle:{"min-height":"400px"}},[n("img",{attrs:{src:"/img/pixelfed-icon-grey.svg"}})]):n("div",[n("div",{staticClass:"mb-4"},[n("p",{staticClass:"text-center"},[n("a",{class:["new"==t.tab?"btn font-weight-bold py-0 btn-success":"btn font-weight-bold py-0 btn-outline-success"],attrs:{href:"#"},on:{click:function(e){return e.preventDefault(),t.setTab("new")}}},[t._v("New")]),t._v(" "),n("a",{class:["about"==t.tab?"btn font-weight-bold py-0 btn-success":"btn font-weight-bold py-0 btn-outline-success"],attrs:{href:"#"},on:{click:function(e){return e.preventDefault(),t.setTab("about")}}},[t._v("About")])])]),t._v(" "),"about"!=t.tab?n("div",{staticClass:"row loops-container"},t._l(t.loops,(function(e,r){return n("div",{staticClass:"col-12 col-md-4 mb-3"},[n("div",{staticClass:"card border border-success"},[n("div",{staticClass:"embed-responsive embed-responsive-1by1"},[n("video",{staticClass:"embed-responsive-item",attrs:{src:t.videoSrc(e),preload:"none",width:"100%",height:"100%",loop:"",poster:t.posterSrc(e)},on:{click:function(n){return t.toggleVideo(e,n)}}})]),t._v(" "),n("div",{staticClass:"card-body"},[n("p",{staticClass:"username font-weight-bolder lead d-flex justify-content-between"},[n("a",{attrs:{href:e.account.url,title:e.account.acct}},[t._v(t._s(t.truncate(e.account.acct)))]),t._v(" "),n("a",{attrs:{href:e.url}},[t._v(t._s(t.timestamp(e)))])]),t._v(" "),n("p",{staticClass:"small text-muted text-truncate",domProps:{innerHTML:t._s(t.getTitle(e))}}),t._v(" "),n("div",{staticClass:"small text-muted d-flex justify-content-between mb-0"},[n("span",[t._v(t._s(e.favourites_count)+" Likes")]),t._v(" "),n("span",[t._v(t._s(e.reblogs_count)+" Shares")]),t._v(" "),n("span",[t._v(t._s(e.reply_count)+" Comments")])])])])])})),0):n("div",{staticClass:"col-12"},[t._m(0)])])])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"card"},[e("div",{staticClass:"card-body"},[e("p",{staticClass:"lead text-center mb-0"},[this._v("Loops are an exciting new way to explore short videos on Pixelfed.")])])])}],!1,null,null,null);e.default=i.exports},iXJE:function(t,e,n){var r=n("LsAn");"string"==typeof r&&(r=[[t.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n("aET+")(r,o);r.locals&&(t.exports=r.locals)},v6kC:function(t,e,n){Vue.component("loops-component",n("i8Ta").default)}},[[11,0]]]);