You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nextcloud/dist/theming-personal-theming.js

3 lines
29 KiB
JavaScript

/*! For license information please see theming-personal-theming.js.LICENSE.txt */
!function(){"use strict";var e,n={2274:function(e,n,r){var a=r(20144),o=r(79753),i=r(79954),c=r(4820),s=r(20571),u=r.n(s),l=r(13299),d=r.n(l),g=r(80419),p=r(82675),h=r(20296),m=r.n(h),f=r(69867),A=r.n(f),b=r(15168),v=r.n(b),k=r(1082),C=r.n(k),_=(r(97248),r(26932)),y=r(45994);function w(e,t,n,r,a,o,i){try{var c=e[o](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,a)}function x(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){w(o,r,a,i,c,"next",e)}function c(e){w(o,r,a,i,c,"throw",e)}i(void 0)}))}}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var S=(0,i.j)("theming","backgroundImage"),I=(0,i.j)("theming","shippedBackgrounds"),B=(0,i.j)("theming","themingDefaultBackground"),D=(0,i.j)("theming","defaultShippedBackground"),j=function(e){return(0,o.generateFilePath)("theming","","img/background/")+e},P=(0,_.fn)(t("theming","Select a background from your files")).setMultiSelect(!1).setModal(!0).setType(1).setMimeTypeFilter(["image/png","image/gif","image/jpeg","image/svg+xml","image/svg"]).build(),E={name:"BackgroundSettings",directives:{Tooltip:v()},components:{Check:g.default,Close:p.default,NcColorPicker:A()},data:function(){return{loading:!1,Theming:(0,i.j)("theming","data",{}),backgroundImage:S}},computed:{shippedBackgrounds:function(){var e=this;return Object.keys(I).map((function(e){return{name:e,url:j(e),preview:j("preview/"+e),details:I[e]}})).filter((function(t){return!(!e.isGlobalBackgroundDeleted&&!e.isGlobalBackgroundDefault)||t.name!==D}))},isGlobalBackgroundDefault:function(){return!!B},isGlobalBackgroundDeleted:function(){return"backgroundColor"===B}},methods:{invertTextColor:function(e){return this.calculateLuma(e)>.6},calculateLuma:function(e){var t,n,r=(t=this.hexToRGB(e),n=3,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],s=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,a=e}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return T(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?T(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());return(.2126*r[0]+.7152*r[1]+.0722*r[2])/255},hexToRGB:function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:null},update:function(e){var t=this;return x(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:t.backgroundImage=e.backgroundImage,t.Theming.color=e.backgroundColor,t.$emit("update:background"),t.loading=!1;case 4:case"end":return n.stop()}}),n)})))()},setDefault:function(){var e=this;return x(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.loading="default",t.next=3,c.default.post((0,o.generateUrl)("/apps/theming/background/default"));case 3:n=t.sent,e.update(n.data);case 5:case"end":return t.stop()}}),t)})))()},setShipped:function(e){var t=this;return x(regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t.loading=e,n.next=3,c.default.post((0,o.generateUrl)("/apps/theming/background/shipped"),{value:e});case 3:r=n.sent,t.update(r.data);case 5:case"end":return n.stop()}}),n)})))()},setFile:function(e){var t=arguments,n=this;return x(regeneratorRuntime.mark((function r(){var a,i
//# sourceMappingURL=theming-personal-theming.js.map?v=84713e8736bbae49313e