servel 0.25.0 → 0.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/_gallery.haml +1 -1
- data/app/js/gallery.js +17 -4
- data/lib/servel/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75f1adecf46ae4f4e27908dd3fbf9668bcd8f11bf984891dae8ee0c4c4ce4d86
|
4
|
+
data.tar.gz: a60bafd99c0e34e664978a7972508b7f8808b04d3f6d59c70cf50bf640863278
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e517dbf1780afa748772644f336acef587e2b60ef25736936f2ac79673f363a4b97bfe59fed2eb559e14c6565ce8b24cd589a6e3c140f2d0002570e540846fd
|
7
|
+
data.tar.gz: e78d33037f5aedd290eb798dfa80dbb0aa8886f8724da3ce3f7bc4d12e8b623b64480c57b0a79f81d2922488ded6ca4ef6cffad70d21bb14e90c9a8d0604eb2b
|
data/app/_gallery.haml
CHANGED
data/app/js/gallery.js
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var Gallery = (function() {
|
4
|
+
var LAYOUT_MODES = ["fit-both", "fit-width", "clamp-width"];
|
5
|
+
|
4
6
|
var $gallery;
|
5
7
|
var currentIndex;
|
6
|
-
var
|
8
|
+
var layoutModeIndex = 0;
|
7
9
|
|
8
10
|
function renderText(url) {
|
9
11
|
var http = new XMLHttpRequest();
|
@@ -90,6 +92,11 @@ var Gallery = (function() {
|
|
90
92
|
go(index);
|
91
93
|
}
|
92
94
|
|
95
|
+
function switchLayoutMode() {
|
96
|
+
layoutModeIndex++;
|
97
|
+
if(layoutModeIndex >= LAYOUT_MODES.length) layoutModeIndex = 0;
|
98
|
+
}
|
99
|
+
|
93
100
|
function initEvents() {
|
94
101
|
document.body.addEventListener("click", function(e) {
|
95
102
|
if(!e.target) return;
|
@@ -114,9 +121,9 @@ var Gallery = (function() {
|
|
114
121
|
e.preventDefault();
|
115
122
|
Index.jumpListing();
|
116
123
|
}
|
117
|
-
else if(e.target.closest("#
|
124
|
+
else if(e.target.closest("#layout-mode")) {
|
118
125
|
e.stopPropagation();
|
119
|
-
|
126
|
+
switchLayoutMode();
|
120
127
|
layout();
|
121
128
|
}
|
122
129
|
});
|
@@ -139,9 +146,15 @@ var Gallery = (function() {
|
|
139
146
|
var viewportHeight = document.documentElement.clientHeight + "px";
|
140
147
|
$gallery.style.minHeight = viewportHeight;
|
141
148
|
|
142
|
-
var
|
149
|
+
var layoutMode = LAYOUT_MODES[layoutModeIndex];
|
150
|
+
var maxHeight = layoutMode == "fit-both" ? viewportHeight : "none";
|
151
|
+
var maxWidth = layoutMode == "clamp-width" ? "1000px" : "100%";
|
152
|
+
|
153
|
+
$("#image").style.maxWidth = maxWidth;
|
143
154
|
$("#image").style.maxHeight = maxHeight;
|
155
|
+
$("#video").style.maxWidth = maxWidth;
|
144
156
|
$("#video").style.maxHeight = maxHeight;
|
157
|
+
$("#audio").style.maxWidth = maxWidth;
|
145
158
|
$("#audio").style.maxHeight = maxHeight;
|
146
159
|
}
|
147
160
|
|
data/lib/servel/version.rb
CHANGED