egirlskey/src/web/app/desktop/tags/ui-header-clock.tag

83 lines
1.5 KiB
Text
Raw Normal View History

2017-01-11 20:55:38 +00:00
<mk-ui-header-clock>
<div class="header">
2017-02-20 15:44:18 +00:00
<time ref="time">
<span class="yyyymmdd">{ yyyy }/{ mm }/{ dd }</span>
<span class="hhnn">{ hh }<span style="visibility:{ now.getSeconds() % 2 == 0 ? 'visible' : 'hidden' }">:</span>{ nn }</span>
</time>
2017-01-11 20:55:38 +00:00
</div>
<div class="content">
<mk-analog-clock></mk-analog-clock>
</div>
2017-02-19 03:31:53 +00:00
<style>
2017-01-11 20:55:38 +00:00
:scope
display inline-block
overflow visible
> .header
padding 0 12px
text-align center
2017-02-20 15:44:18 +00:00
font-size 10px
2017-01-11 20:55:38 +00:00
&, *
cursor: default
&:hover
background #899492
& + .content
visibility visible
> time
color #fff !important
*
color #fff !important
&:after
content ""
display block
clear both
> time
display table-cell
vertical-align middle
height 48px
color #9eaba8
> .yyyymmdd
opacity 0.7
> .content
visibility hidden
display block
position absolute
top auto
right 0
z-index 3
margin 0
padding 0
width 256px
background #899492
</style>
<script>
2017-02-20 01:34:57 +00:00
this.draw = () => {
2017-02-20 15:44:18 +00:00
this.now = new Date();
this.yyyy = now.getFullYear();
this.mm = ('0' + (now.getMonth() + 1)).slice(-2);
this.dd = ('0' + now.getDate()).slice(-2);
this.hh = ('0' + now.getHours()).slice(-2);
this.nn = ('0' + now.getMinutes()).slice(-2);
};
2017-01-11 20:55:38 +00:00
2017-02-20 00:53:57 +00:00
this.on('mount', () => {
2017-02-20 15:44:18 +00:00
this.draw();
this.clock = setInterval(this.draw, 1000);
});
2017-01-11 20:55:38 +00:00
2017-02-20 00:53:57 +00:00
this.on('unmount', () => {
2017-02-20 15:44:18 +00:00
clearInterval(this.clock);
});
2017-01-11 20:55:38 +00:00
</script>
</mk-ui-header-clock>