diff --git a/static/js/expand-image.js b/static/js/expand-image.js
index 677265c..3463ec0 100644
--- a/static/js/expand-image.js
+++ b/static/js/expand-image.js
@@ -19,32 +19,32 @@ $(function () {
});
function toggle_image(parent, src_link) {
- let expanded = parent.hasClass("expanded");
let thumb = parent.find(".thumb");
let src = parent.find(".src");
- if (!expanded) {
- if (src.length === 0) {
- thumb.css("opacity", 0.5);
- parent.append(``);
-
- let src = parent.find(".src");
-
- src.hide();
+ if (src.length === 0) {
+ thumb.addClass("loading");
- src.on("load", function () {
- thumb.hide();
- thumb.css("opacity", "");
- src.show();
- });
- } else {
+ parent.append(``);
+
+ let src = parent.find(".src");
+
+ src.hide();
+ src.on("load", function () {
+ thumb.removeClass("loading");
thumb.hide();
src.show();
- }
- } else {
- src.hide();
- thumb.show();
+
+ parent.closest(".post-files").addClass("float-none-b");
+ });
+
+ return;
}
+
+ thumb.toggle();
+ src.toggle();
+
+ parent.closest(".post-files").toggleClass("float-none-b");
}
function toggle_video(parent, src_link) {
@@ -52,35 +52,41 @@ function toggle_video(parent, src_link) {
let thumb = parent.find(".thumb");
let src = parent.parent().find(".src");
- if (!expanded) {
- if (src.length === 0) {
- thumb.css("opacity", 0.5);
+ if (src.length === 0) {
+ thumb.addClass("loading");
- parent.append('[Zavřít]
')
-
- parent.parent().append(
+ parent.append('[Zavřít]
');
+ parent
+ .parent()
+ .append(
``
);
- let src = parent.parent().find(".src");
+ let src = parent.parent().find(".src");
- src.hide();
+ src.hide();
- src.on("loadstart", function () {
- thumb.hide();
- thumb.css("opacity", "");
- src.show();
- });
- } else {
+ src.on("loadstart", function () {
+ thumb.removeClass("loading");
thumb.hide();
src.show();
- src.get(0).play();
- parent.find(".closer").show();
- }
- } else {
- src.get(0).pause();
- src.hide();
- thumb.show();
- parent.find(".closer").hide();
+
+ parent.closest(".post-files").addClass("float-none-b");
+ });
+
+ return;
}
+
+ thumb.toggle();
+ src.toggle();
+
+ if (expanded) {
+ src.get(0).pause();
+ src.get(0).currentTime = 0;
+ } else {
+ src.get(0).play();
+ }
+
+ parent.closest(".post-files").toggleClass("float-none-b");
+ parent.find(".closer").toggle();
}
diff --git a/static/style.css b/static/style.css
index e4f6dc0..949f00d 100755
--- a/static/style.css
+++ b/static/style.css
@@ -208,6 +208,11 @@ summary {
float: right;
}
+.float-none-a,
+.float-none-b {
+ float: none !important;
+}
+
.fixed-table {
table-layout: fixed;
}
@@ -301,6 +306,7 @@ summary {
}
.post-header input[type="checkbox"] {
+ height: 1em;
vertical-align: middle;
margin: 0;
}
@@ -354,10 +360,6 @@ summary {
margin: 0 8px 8px 8px;
}
-.multi-files {
- float: none;
-}
-
.post-file {
display: inline-block;
vertical-align: top;
@@ -472,3 +474,9 @@ summary {
height: 220px;
}
}
+
+/* Only in JS */
+
+.loading {
+ opacity: 0.5;
+}
diff --git a/templates/base.html b/templates/base.html
index f07728c..a6a7bd4 100755
--- a/templates/base.html
+++ b/templates/base.html
@@ -11,6 +11,7 @@
+ {% block scripts %}{% endblock %}