-
Notifications
You must be signed in to change notification settings - Fork 0
/
images-list.html
executable file
·114 lines (93 loc) · 2.77 KB
/
images-list.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<link rel="import" href="components/polymer/polymer.html">
<link rel="import" href="image-service/image-service.html">
<style type="text/css">
.core-overlay-backdrop{
opacity: 0.92 !important;
}
</style>
<polymer-element name="images-list" attributes="show" fit>
<template>
<style>
:host {
display: inline-block;
width: 100%;
}
paper-shadow {
display: inline-block;
background: white;
box-sizing: border-box;
width: 200px;
height: 200px;
padding:2px;
margin: 16px;
}
.thumb {
width:100%;
height: 100%;
border: 1px solid white;
}
#card {
display: box;
position: relative;
width:100%;
height:100%;
padding: 20px;
}
.imageh{
/*min-width: 300px;*/
/*min-height: 300px;*/
border: 3px solid white;
max-width:100%;
height:auto;
}
.imagev{
/*min-width: 300px;*/
/*min-height: 300px;*/
border: 3px solid white;
max-height:100%;
/*width:auto;*/
}
</style>
<app-globals id="globals"></app-globals>
<image-service id="service" images="{{images}}" albumid="{{$.globals.albumid}}" userid={{$.globals.userid}}></image-service>
<div horizontal layout center-justified wrap fit>
<template repeat="{{image in images}}">
<paper-shadow z="1">
<core-image class="thumb"
src="{{image.src}}"
sizing="cover"
preload
fade >
</core-image>
<paper-ripple image="{{image.src}}" fit on-tap="{{open}}"></paper-ripple>
</paper-shadow>
</template>
</div>
<core-overlay id="card" backdrop horizontal layout center center-justified on-tap="{{close}}">
<img src="{{lastSelectedImage.src}}" class="{{ {imageh: lastSelectedImage.width > lastSelectedImage.height, imagev: lastSelectedImage.width < lastSelectedImage.height} | tokenList }}">
</core-overlay>
</template>
<script>
Polymer({
ready: function(){
// console.log(this.$.globals.albumid);
},
lastSelectedImage: null,
open: function(e, detail, sender){
var image = sender.templateInstance.model.image;
this.lastSelectedImage = image;
// if (image.width > image.height){
// this.$.imgOpen.class="image-h";
// }else{
// this.$.imgOpen.class="image-v";
// }
this.$.card.toggle();
//console.log(image.width);
},
close: function(){
this.$.card.toggle();
this.lastSelectedImage = null;
}
});
</script>
</polymer-element>