servel 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba7bd2682174a0720a7bbdd976fe70a8c042236c37bb483fbd739e96a4b4a4e5
4
- data.tar.gz: 60472441db9c31fc9b30b93a5cc6df9dd45d0849c58aa7f6a9017b8a386ff58b
3
+ metadata.gz: 75f1adecf46ae4f4e27908dd3fbf9668bcd8f11bf984891dae8ee0c4c4ce4d86
4
+ data.tar.gz: a60bafd99c0e34e664978a7972508b7f8808b04d3f6d59c70cf50bf640863278
5
5
  SHA512:
6
- metadata.gz: 65d2782a424feb924fdd29aac0e510076b0ee9c6f5a524809290966d7d3572b7a5456a778ff4f1cc913999025b056b1866a4805c840193303d015035eba0a361
7
- data.tar.gz: dd7275024f111053d55e66e22d266bea523e2656da47e43d59f9ce6021dda1433acb3bb160a4d25f6867211537c1b8291880f016a25b616882920a3eea97dd5d
6
+ metadata.gz: 4e517dbf1780afa748772644f336acef587e2b60ef25736936f2ac79673f363a4b97bfe59fed2eb559e14c6565ce8b24cd589a6e3c140f2d0002570e540846fd
7
+ data.tar.gz: e78d33037f5aedd290eb798dfa80dbb0aa8886f8724da3ce3f7bc4d12e8b623b64480c57b0a79f81d2922488ded6ca4ef6cffad70d21bb14e90c9a8d0604eb2b
data/app/_gallery.haml CHANGED
@@ -1,7 +1,7 @@
1
1
  #controls
2
2
  #page-back.paginator ◀
3
3
  #page-back-10.paginator ◀◀
4
- #page-max-item.paginator ⤡
4
+ #layout-mode.paginator ⤡
5
5
  #page-jump-listing.paginator 🔗 Listing
6
6
  #page-next-10.paginator ▶▶
7
7
  #page-next.paginator ▶
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 layoutItemMax = false;
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("#page-max-item")) {
124
+ else if(e.target.closest("#layout-mode")) {
118
125
  e.stopPropagation();
119
- layoutItemMax = !layoutItemMax;
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 maxHeight = layoutItemMax ? "none" : viewportHeight;
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
 
@@ -1,3 +1,3 @@
1
1
  module Servel
2
- VERSION = "0.25.0"
2
+ VERSION = "0.26.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brenton "B-Train" Fletcher