Updated background logic

This commit is contained in:
Maxim Stewart 2020-10-25 14:59:15 -05:00
parent 9318b7768a
commit d833ec437d
7 changed files with 34 additions and 7 deletions

View File

@ -4,7 +4,8 @@
top: 0%; top: 0%;
left: 0%; left: 0%;
width: 100%; width: 100%;
height: 100%; /* height: 100%; */
height: auto;
z-index: -999; z-index: -999;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 KiB

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 216 KiB

After

Width:  |  Height:  |  Size: 216 KiB

View File

@ -73,9 +73,9 @@ const updateHTMLDirList = async (data) => {
// Setup background if there is a 000.* in selection // Setup background if there is a 000.* in selection
if (background_image.match(/000\.(jpg|png|gif)\b/) != null) { if (background_image.match(/000\.(jpg|png|gif)\b/) != null) {
background_image = formatURL("files/" + images[i][1]); background_image = formatURL("files/" + images[i][1]);
updateBackground(background_image); updateBackground(background_image, false);
} else { } else {
background_image = formatURL("static/imgs/backgrounds/000.jpg"); background_image = formatURL("static/imgs/backgrounds/particles.mp4");
updateBackground(background_image); updateBackground(background_image);
} }

View File

@ -175,9 +175,17 @@ const disableEdit = (elm) => {
elm.readOnly = "true"; elm.readOnly = "true";
} }
const updateBackground = (img_src) => { const updateBackground = (srcLink, isvideo = true) => {
try { try {
document.getElementById("bg").src = img_src; if (isvideo) {
let elm = document.getElementById("bg");
if (elm.getAttribute('src') === "") {
elm.src = srcLink;
}
} else {
document.getElementById("bg").src = "";
document.getElementById("bg").setAttribute("poster", srcLink);
}
} catch (e) { } } catch (e) { }
} }

View File

@ -48,7 +48,19 @@
<button title="File viewer..." class="btn btn-secondary btn-sm" <button title="File viewer..." class="btn btn-secondary btn-sm"
data-toggle="modal" data-target="#file-view-modal">🖼</button> data-toggle="modal" data-target="#file-view-modal">🖼</button>
{% if isLoggedIn %}
<a href="/logout">
<button title="Logout..." class="btn btn-danger btn-sm">
Logout
</button>
</a>
{% else %}
<a href="/login">
<button title="Login..." class="btn btn-success btn-sm">
Login
</button>
</a>
{% endif %}
</div> </div>
</div> </div>
</div> </div>
@ -228,7 +240,13 @@
</template> </template>
<!-- Background --> <!-- Background -->
<img id="bg" src="{{ url_for('static', filename='imgs/backgrounds/000.jpg')}}" /> <!-- <img id="bg" src="{{ url_for('static', filename='imgs/backgrounds/000.png')}}" /> -->
<video id="bg" src="{{ url_for('static', filename='imgs/backgrounds/particles.mp4')}}"
poster="{{ url_for('static', filename='imgs/backgrounds/000.png')}}"
autoplay loop>
</video>
{% block body_content_additional %} {% block body_content_additional %}
{% endblock body_content_additional%} {% endblock body_content_additional%}