servel 0.23.0 → 0.24.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 +2 -2
- data/app/css/gallery.css +1 -1
- data/app/css/listing.css +1 -0
- data/app/index.haml +2 -1
- data/app/js/common.js +11 -0
- data/app/js/gallery.js +11 -13
- data/app/js/index.js +54 -1
- data/app/js/listing.js +0 -6
- data/lib/servel/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a863f769dc401adeac14d38484a6e5ae7492d7f322e80a1fefd62bc4b7e5f286
|
4
|
+
data.tar.gz: c65d410dbf1ad9a645dcb9dc7d94e97c18d6a7a8badcc7f77a21959a4eb02112
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6b43b998bd6f67609370def7f37e4768083a8ec1df98e7ea5c00726b77f718c0a4211249966365315aed058b63d95aef2cc4b597885fb7b63aa655d8255c5e1
|
7
|
+
data.tar.gz: 51a0748759c661a13883a52018ba6819b9d800a1f42413ca469a22d41465c95e653f23b2ed96b606b1949d44ffb02279f714578cd27337985aa546bf0eb7892c
|
data/app/_gallery.haml
CHANGED
@@ -7,8 +7,8 @@
|
|
7
7
|
#page-next.paginator ▶
|
8
8
|
#content
|
9
9
|
%img#image
|
10
|
-
%video#video{
|
11
|
-
%audio#audio{
|
10
|
+
%video#video{controls: true}
|
11
|
+
%audio#audio{controls: true}
|
12
12
|
#text
|
13
13
|
%a#text-anchor{href: '#'}
|
14
14
|
#text-content
|
data/app/css/gallery.css
CHANGED
@@ -13,13 +13,13 @@ body.has-gallery.gallery #gallery {
|
|
13
13
|
align-items: center;
|
14
14
|
justify-content: center;
|
15
15
|
flex-grow: 1;
|
16
|
-
padding-top: 75px;
|
17
16
|
}
|
18
17
|
|
19
18
|
#image, #video, #audio, #text {
|
20
19
|
display: none;
|
21
20
|
max-width: 100%;
|
22
21
|
margin: 0 auto 0 auto;
|
22
|
+
padding-top: 75px;
|
23
23
|
}
|
24
24
|
|
25
25
|
#video:focus, #audio:focus {
|
data/app/css/listing.css
CHANGED
data/app/index.haml
CHANGED
@@ -20,10 +20,11 @@
|
|
20
20
|
:javascript
|
21
21
|
#{include('js/natural-orderby.min.js')}
|
22
22
|
#{include('js/entries.js')}
|
23
|
+
#{include('js/common.js')}
|
24
|
+
#{include('js/index.js')}
|
23
25
|
#{include('js/listing.js')}
|
24
26
|
#{include('js/ume.js')}
|
25
27
|
#{include('js/gallery.js')}
|
26
|
-
#{include('js/index.js')}
|
27
28
|
%body
|
28
29
|
#gallery!= partial('gallery')
|
29
30
|
#listing!= partial('listing', { url_root: url_root, url_path: url_path })
|
data/app/js/common.js
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function atBottom() {
|
4
|
+
return (window.scrollY + window.innerHeight) == document.body.scrollHeight;
|
5
|
+
}
|
6
|
+
|
7
|
+
function common() {
|
8
|
+
window.$ = document.querySelector.bind(document);
|
9
|
+
}
|
10
|
+
|
11
|
+
window.addEventListener("DOMContentLoaded", common);
|
data/app/js/gallery.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var Gallery = (function() {
|
4
|
-
var $;
|
5
4
|
var $gallery;
|
6
5
|
var currentIndex;
|
7
6
|
var layoutItemMax = false;
|
@@ -35,16 +34,21 @@ var Gallery = (function() {
|
|
35
34
|
|
36
35
|
$gallery.classList.add(type);
|
37
36
|
|
37
|
+
var $element;
|
38
38
|
if(type == "text") {
|
39
39
|
renderText(url);
|
40
40
|
}
|
41
41
|
else {
|
42
|
-
|
42
|
+
$element = $("#" + type);
|
43
43
|
$element.src = url;
|
44
44
|
$element.focus();
|
45
45
|
}
|
46
46
|
|
47
|
-
|
47
|
+
if(Index.galleryVisible()) {
|
48
|
+
window.scrollTo(0, 0);
|
49
|
+
|
50
|
+
if(type == "video" || type == "audio") $element.play();
|
51
|
+
}
|
48
52
|
|
49
53
|
//if(currentPage < imageUrls.length) (new Image()).src = imageUrls[currentPage];
|
50
54
|
}
|
@@ -86,10 +90,6 @@ var Gallery = (function() {
|
|
86
90
|
go(index);
|
87
91
|
}
|
88
92
|
|
89
|
-
function atBottom() {
|
90
|
-
return (window.scrollY + window.innerHeight) == document.body.scrollHeight;
|
91
|
-
}
|
92
|
-
|
93
93
|
function initEvents() {
|
94
94
|
document.body.addEventListener("click", function(e) {
|
95
95
|
if(!e.target) return;
|
@@ -136,11 +136,10 @@ var Gallery = (function() {
|
|
136
136
|
}
|
137
137
|
|
138
138
|
function layout() {
|
139
|
-
var viewportHeight = document.documentElement.clientHeight;
|
140
|
-
$gallery.style.minHeight = viewportHeight
|
139
|
+
var viewportHeight = document.documentElement.clientHeight + "px";
|
140
|
+
$gallery.style.minHeight = viewportHeight;
|
141
141
|
|
142
|
-
var
|
143
|
-
var maxHeight = layoutItemMax ? "none" : (viewportHeight - controlsHeight) + "px";
|
142
|
+
var maxHeight = layoutItemMax ? "none" : viewportHeight;
|
144
143
|
$("#image").style.maxHeight = maxHeight;
|
145
144
|
$("#video").style.maxHeight = maxHeight;
|
146
145
|
$("#audio").style.maxHeight = maxHeight;
|
@@ -148,7 +147,7 @@ var Gallery = (function() {
|
|
148
147
|
|
149
148
|
function initLayout() {
|
150
149
|
window.addEventListener("resize", layout);
|
151
|
-
|
150
|
+
layout();
|
152
151
|
}
|
153
152
|
|
154
153
|
function onEntriesUpdate() {
|
@@ -157,7 +156,6 @@ var Gallery = (function() {
|
|
157
156
|
}
|
158
157
|
|
159
158
|
function init() {
|
160
|
-
$ = document.querySelector.bind(document);
|
161
159
|
$gallery = $("#gallery");
|
162
160
|
|
163
161
|
onEntriesUpdate();
|
data/app/js/index.js
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var Index = (function() {
|
4
|
+
function galleryVisible() {
|
5
|
+
return document.body.classList.contains("gallery");
|
6
|
+
}
|
7
|
+
|
8
|
+
function listingVisible() {
|
9
|
+
return document.body.classList.contains("listing");
|
10
|
+
}
|
11
|
+
|
4
12
|
function jumpListing() {
|
5
13
|
document.body.classList.remove("gallery");
|
6
14
|
document.body.classList.add("listing");
|
@@ -11,13 +19,58 @@ var Index = (function() {
|
|
11
19
|
document.body.classList.add("gallery");
|
12
20
|
}
|
13
21
|
|
22
|
+
function jumpScroll() {
|
23
|
+
if(galleryVisible()) {
|
24
|
+
jumpListing();
|
25
|
+
window.scrollTo(0, 0);
|
26
|
+
}
|
27
|
+
else {
|
28
|
+
jumpGallery();
|
29
|
+
window.scrollTo(0, document.body.scrollHeight);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
function atTop() {
|
34
|
+
return window.scrollY == 0;
|
35
|
+
}
|
36
|
+
|
37
|
+
function bottomScrollDown(event) {
|
38
|
+
return galleryVisible() && atBottom() && event.deltaY > 0;
|
39
|
+
}
|
40
|
+
|
41
|
+
function topScrollUp(event) {
|
42
|
+
return listingVisible() && atTop() && event.deltaY < 0;
|
43
|
+
}
|
44
|
+
|
45
|
+
function initEvents() {
|
46
|
+
var scrollSize = 0;
|
47
|
+
|
48
|
+
window.addEventListener("wheel", function(event) {
|
49
|
+
if(bottomScrollDown(event) || topScrollUp(event)) {
|
50
|
+
scrollSize += Math.abs(event.deltaY);
|
51
|
+
|
52
|
+
if(scrollSize >= 1500) {
|
53
|
+
scrollSize = 0;
|
54
|
+
jumpScroll();
|
55
|
+
}
|
56
|
+
}
|
57
|
+
else {
|
58
|
+
scrollSize = 0;
|
59
|
+
}
|
60
|
+
});
|
61
|
+
}
|
62
|
+
|
14
63
|
function init() {
|
15
|
-
if(
|
64
|
+
if((Entries.media().length / Entries.all().length) >= 0.5) jumpGallery();
|
16
65
|
else jumpListing();
|
66
|
+
|
67
|
+
initEvents();
|
17
68
|
}
|
18
69
|
|
19
70
|
return {
|
20
71
|
init: init,
|
72
|
+
galleryVisible: galleryVisible,
|
73
|
+
listingVisible: listingVisible,
|
21
74
|
jumpListing: jumpListing,
|
22
75
|
jumpGallery: jumpGallery
|
23
76
|
};
|
data/app/js/listing.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var Listing = (function() {
|
4
|
-
var $;
|
5
4
|
var $container;
|
6
5
|
var perPage = 99;
|
7
6
|
var currentIndex;
|
@@ -61,10 +60,6 @@ var Listing = (function() {
|
|
61
60
|
$container.insertAdjacentHTML("beforeend", renderTable(currentEntries));
|
62
61
|
}
|
63
62
|
|
64
|
-
function atBottom() {
|
65
|
-
return (window.scrollY + window.innerHeight) == document.body.scrollHeight;
|
66
|
-
}
|
67
|
-
|
68
63
|
function onScrolled() {
|
69
64
|
if(atBottom() && moreContent) {
|
70
65
|
currentIndex += perPage;
|
@@ -131,7 +126,6 @@ var Listing = (function() {
|
|
131
126
|
}
|
132
127
|
|
133
128
|
function init() {
|
134
|
-
$ = document.querySelector.bind(document);
|
135
129
|
$container = $("#listing-container");
|
136
130
|
|
137
131
|
onEntriesUpdate();
|
data/lib/servel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: servel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brenton "B-Train" Fletcher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- app/css/normalize.css
|
132
132
|
- app/home.haml
|
133
133
|
- app/index.haml
|
134
|
+
- app/js/common.js
|
134
135
|
- app/js/entries.js
|
135
136
|
- app/js/gallery.js
|
136
137
|
- app/js/index.js
|