platypush/platypush/backend/http/webapp/dist/static/js/6003-legacy.f3446996.js

2 lines
5.2 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[6003,1595],{1595:function(e,t,s){s.r(t),s.d(t,{default:function(){return d}});var r=s(6252),n=s(3577),o={class:"date-time"},i=["textContent"],a=["textContent"];function h(e,t,s,h,u,c){return(0,r.wg)(),(0,r.iD)("div",o,[c._showDate?((0,r.wg)(),(0,r.iD)("div",{key:0,class:"date",textContent:(0,n.zw)(e.formatDate(e.now))},null,8,i)):(0,r.kq)("",!0),c._showTime?((0,r.wg)(),(0,r.iD)("div",{key:1,class:"time",textContent:(0,n.zw)(e.formatTime(e.now,c._showSeconds))},null,8,a)):(0,r.kq)("",!0)])}var u=s(6813),c={name:"DateTime",mixins:[u.Z],props:{showDate:{required:!1,default:!0},showTime:{required:!1,default:!0},showSeconds:{required:!1,default:!0}},computed:{_showTime:function(){return this.parseBoolean(this.showTime)},_showDate:function(){return this.parseBoolean(this.showDate)},_showSeconds:function(){return this.parseBoolean(this.showSeconds)}},data:function(){return{now:new Date}},methods:{refreshTime:function(){this.now=new Date}},mounted:function(){this.refreshTime(),setInterval(this.refreshTime,1e3)}},m=s(3744);const w=(0,m.Z)(c,[["render",h],["__scopeId","data-v-ca42eb9c"]]);var d=w},6003:function(e,t,s){s.r(t),s.d(t,{default:function(){return k}});var r=s(6252),n=s(3577),o={class:"image-carousel"},i={ref:"background",class:"background"},a=["src"],h={key:1,class:"row info-container"},u={class:"col-6 weather-container"},c={key:0},m={class:"col-6 date-time-container"};function w(e,t,s,w,d,l){var f=(0,r.up)("Loading"),g=(0,r.up)("Weather"),p=(0,r.up)("DateTime");return(0,r.wg)(),(0,r.iD)("div",o,[d.images.length?(0,r.kq)("",!0):((0,r.wg)(),(0,r.j4)(f,{key:0})),(0,r._)("div",i,null,512),(0,r._)("img",{ref:"img",src:l.imgURL,alt:"Your carousel images",style:(0,n.j5)({display:d.images.length?"block":"none"})},null,12,a),l._showDate||l._showTime?((0,r.wg)(),(0,r.iD)("div",h,[(0,r._)("div",u,[l._showWeather?((0,r.wg)(),(0,r.j4)(g,{key:1,"show-icon":l._showWeatherIcon,"show-summary":l._showWeatherSummary,"show-temperature":l._showTemperature,"icon-color":s.weatherIconColor,"icon-size":s.weatherIconSize,animate:l._animateWeatherIcon},null,8,["show-icon","show-summary","show-temperature","icon-color","icon-size","animate"])):((0,r.wg)(),(0,r.iD)("span",c," "))]),(0,r._)("div",m,[l._showTime||l._showDate?((0,r.wg)(),(0,r.j4)(p,{key:0,"show-date":l._showDate,"show-time":l._showTime,"show-seconds":l._showSeconds},null,8,["show-date","show-time","show-seconds"])):(0,r.kq)("",!0)])])):(0,r.kq)("",!0)])}var d=s(8534),l=(s(5666),s(9653),s(6813)),f=s(1232),g=s(1595),p=s(1798),_={name:"ImageCarousel",components:{Weather:p["default"],DateTime:g["default"],Loading:f.Z},mixins:[l.Z],props:{imgDir:{type:String,required:!0},refreshSeconds:{type:Number,default:15},showDate:{default:!1},showTime:{default:!1},showSeconds:{default:!1},showWeather:{default:!1},showTemperature:{default:!0},showWeatherIcon:{default:!0},showWeatherSummary:{default:!0},weatherIconColor:{type:String,default:"white"},weatherIconSize:{type:Number,default:70},animateWeatherIcon:{default:!0}},data:function(){return{images:[],currentImage:void 0,loading:!1}},computed:{imgURL:function(){var e=8008;return"backend.http"in this.$root.config&&"port"in this.$root.config["backend.http"]&&(e=this.$root.config["backend.http"].port),"//"+window.location.hostname+":"+e+this.currentImage},_showDate:function(){return this.parseBoolean(this.showDate)},_showTime:function(){return this.parseBoolean(this.showTime)},_showSeconds:function(){return this.parseBoolean(this.showSeconds)},_showTemperature:function(){return this.parseBoolean(this.showTemperature)},_showWeather:function(){return this.parseBoolean(this.showWeather)},_showWeatherIcon:function(){return this.parseBoolean(this.showWeatherIcon)},_showWeatherSummary:function(){return this.parseBoolean(this.showWeatherSummary)},_animateWeatherIcon:function(){return this.parseBoolean(this.animateWeatherIcon)}},methods:{refresh:function(){var e=this;return(0,d.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e.images.length){t.next=10;break}return e.loading=!0,t.prev=2,t.next=5,e.request("utils.search_web_directory",{directory:e.imgDir,extensions:[".jpg",".jpeg",".png"]});case 5:e.images=t.sent,e.shuffleImages();case 7:return t.prev=7,e.loading=!1,t.finish(7);case 10:e.images.length&&(e.currentImage=e.images.pop());case 11:case"end":return t.stop()}}),t,null,[[2,,7,10]])})))()},onNewImage:function(){if(this.$refs.img&&(this.$refs.background.style["background-image"]="url("+this.imgURL+")",this.$refs.img.style.width="auto",this.$refs.img.width>this.$refs.img.height)){var e=this.$refs.img.width/this.$refs.img.height;e>=4/3&&e<=16/9?this.$refs.img.style.width="100%":e<=4/3&&(this.$refs.img.style.height="100%")}},shuffleImages:function(){for(var e=this.images.length-1;e>0;e--){var t=Math.floor(Math.random()*(e+1)),s=this.images[e];this.images[e]=this.images[t],this.images[t]=s}}},mounted:function(){this.$refs.img.addEventListener("load",this.onNewImage),this.$refs.img.addEventListener("error",this.refresh),this.refresh(),setInterval(this.refresh,Math.round(1e3*this.refreshSeconds))}},v=s(3744);const y=(0,v.Z)(_,[["render",w],["__scopeId","data-v-72b02f7c"]]);var k=y}}]);
//# sourceMappingURL=6003-legacy.f3446996.js.map