dasdsa
This commit is contained in:
parent
2072c944cd
commit
23a3af3c2e
12 changed files with 70 additions and 55 deletions
|
@ -18,7 +18,7 @@ function expandDesktopImage(image) {
|
||||||
};
|
};
|
||||||
|
|
||||||
window.addEventListener("hashchange", function (e) {
|
window.addEventListener("hashchange", function (e) {
|
||||||
if(window.location.hash != "#modal") {
|
if(location.hash != "#modal") {
|
||||||
const expandImageModal = document.querySelector('#expandImageModal');
|
const expandImageModal = document.querySelector('#expandImageModal');
|
||||||
const modal = bootstrap.Modal.getInstance(expandImageModal);
|
const modal = bootstrap.Modal.getInstance(expandImageModal);
|
||||||
modal.hide();
|
modal.hide();
|
||||||
|
@ -26,7 +26,7 @@ window.addEventListener("hashchange", function (e) {
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('expandImageModal').addEventListener('hidden.bs.modal', function (e) {
|
document.getElementById('expandImageModal').addEventListener('hidden.bs.modal', function (e) {
|
||||||
if(window.location.hash == "#modal") {
|
if(location.hash == "#modal") {
|
||||||
history.back();
|
history.back();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -915,7 +915,7 @@ function getEmoji(searchTerm) {
|
||||||
const favorite_emojis = JSON.parse(localStorage.getItem("favorite_emojis")) || {}
|
const favorite_emojis = JSON.parse(localStorage.getItem("favorite_emojis")) || {}
|
||||||
if (favorite_emojis[searchTerm]) favorite_emojis[searchTerm] += 1
|
if (favorite_emojis[searchTerm]) favorite_emojis[searchTerm] += 1
|
||||||
else favorite_emojis[searchTerm] = 1
|
else favorite_emojis[searchTerm] = 1
|
||||||
window.localStorage.setItem("favorite_emojis", JSON.stringify(favorite_emojis))
|
localStorage.setItem("favorite_emojis", JSON.stringify(favorite_emojis))
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadEmojis(form) {
|
function loadEmojis(form) {
|
||||||
|
|
|
@ -30,9 +30,9 @@ if (typeof showNewCommentCounts === 'undefined') {
|
||||||
delete comments[key]
|
delete comments[key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.localStorage.setItem("comment-counts", JSON.stringify(comments))
|
localStorage.setItem("comment-counts", JSON.stringify(comments))
|
||||||
}
|
}
|
||||||
window.localStorage.setItem(LAST_CACHE_CLEAN_ID, JSON.stringify(now))
|
localStorage.setItem(LAST_CACHE_CLEAN_ID, JSON.stringify(now))
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(cleanCache, 500)
|
setTimeout(cleanCache, 500)
|
||||||
|
|
|
@ -1337,7 +1337,7 @@ var PusherPushNotifications = (function (exports) {
|
||||||
|
|
||||||
if (serviceWorkerRegistration) {
|
if (serviceWorkerRegistration) {
|
||||||
var serviceWorkerScope = serviceWorkerRegistration.scope;
|
var serviceWorkerScope = serviceWorkerRegistration.scope;
|
||||||
var currentURL = window.location.href;
|
var currentURL = location.href;
|
||||||
var scopeMatchesCurrentPage = currentURL.startsWith(serviceWorkerScope);
|
var scopeMatchesCurrentPage = currentURL.startsWith(serviceWorkerScope);
|
||||||
|
|
||||||
if (!scopeMatchesCurrentPage) {
|
if (!scopeMatchesCurrentPage) {
|
||||||
|
|
|
@ -43,6 +43,6 @@ document.getElementById('file-upload').addEventListener('change', function(){
|
||||||
function savetext() {
|
function savetext() {
|
||||||
let post_title = document.getElementById('post-title').value
|
let post_title = document.getElementById('post-title').value
|
||||||
let post_text = document.getElementById('post-text').value
|
let post_text = document.getElementById('post-text').value
|
||||||
window.localStorage.setItem("post_title", post_title)
|
localStorage.setItem("post_title", post_title)
|
||||||
window.localStorage.setItem("post_text", post_text)
|
localStorage.setItem("post_text", post_text)
|
||||||
}
|
}
|
|
@ -1,3 +1,7 @@
|
||||||
|
const playing = localStorage.getItem("playing")
|
||||||
|
|
||||||
|
if (!playing)
|
||||||
|
{
|
||||||
let uid = document.getElementById('uid')
|
let uid = document.getElementById('uid')
|
||||||
|
|
||||||
if (uid)
|
if (uid)
|
||||||
|
@ -16,6 +20,11 @@ if (uid)
|
||||||
document.getElementById('userpage').addEventListener('click', () => {
|
document.getElementById('userpage').addEventListener('click', () => {
|
||||||
if (audio.paused) audio.play();
|
if (audio.paused) audio.play();
|
||||||
}, {once : true});
|
}, {once : true});
|
||||||
|
|
||||||
|
localStorage.setItem("playing", "1")
|
||||||
|
window.addEventListener("unload", function(e) {
|
||||||
|
localStorage.setItem("playing", "")
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -48,6 +57,12 @@ else
|
||||||
document.getElementById('userpage').addEventListener('click', () => {
|
document.getElementById('userpage').addEventListener('click', () => {
|
||||||
if (audio.paused) audio.play();
|
if (audio.paused) audio.play();
|
||||||
}, {once : true});
|
}, {once : true});
|
||||||
|
|
||||||
|
localStorage.setItem("playing", "1")
|
||||||
|
window.addEventListener("unload", function(e) {
|
||||||
|
localStorage.setItem("playing", "")
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -161,7 +161,7 @@ function submitFormAjax(e) {
|
||||||
myToast.show();
|
myToast.show();
|
||||||
return true
|
return true
|
||||||
} else if (xhr.status >= 300 && xhr.status < 400) {
|
} else if (xhr.status >= 300 && xhr.status < 400) {
|
||||||
window.location.href = JSON.parse(xhr.response)["redirect"]
|
location.href = JSON.parse(xhr.response)["redirect"]
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('toast-post-error-text').innerText = "Error, please try again later."
|
document.getElementById('toast-post-error-text').innerText = "Error, please try again later."
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
{% if success %}
|
{% if success %}
|
||||||
<script>
|
<script>
|
||||||
history.pushState(null, null, '{{p.permalink | full_link}}');
|
history.pushState(null, null, '{{p.permalink | full_link}}');
|
||||||
window.localStorage.setItem("post_title", "")
|
localStorage.setItem("post_title", "")
|
||||||
window.localStorage.setItem("post_text", "")
|
localStorage.setItem("post_text", "")
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -878,7 +878,7 @@
|
||||||
const comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
|
const comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
|
||||||
const newTotal = {{p.comment_count}} || ((comments['{{p.id}}'] || {c: 0}).c + 1)
|
const newTotal = {{p.comment_count}} || ((comments['{{p.id}}'] || {c: 0}).c + 1)
|
||||||
comments['{{p.id}}'] = {c: newTotal, t: Date.now()}
|
comments['{{p.id}}'] = {c: newTotal, t: Date.now()}
|
||||||
window.localStorage.setItem("comment-counts", JSON.stringify(comments))
|
localStorage.setItem("comment-counts", JSON.stringify(comments))
|
||||||
{% endif %}
|
{% endif %}
|
||||||
})()
|
})()
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -195,9 +195,9 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
let fetched_title = window.localStorage.getItem("post_title")
|
let fetched_title = localStorage.getItem("post_title")
|
||||||
document.getElementById('post-title').value = fetched_title
|
document.getElementById('post-title').value = fetched_title
|
||||||
let fetched_text = window.localStorage.getItem("post_text")
|
let fetched_text = localStorage.getItem("post_text")
|
||||||
document.getElementById('post-text').value = fetched_text
|
document.getElementById('post-text').value = fetched_text
|
||||||
|
|
||||||
function checkForRequired() {
|
function checkForRequired() {
|
||||||
|
|
|
@ -698,7 +698,7 @@
|
||||||
<div id="username" class="d-none">{{u.username}}</div>
|
<div id="username" class="d-none">{{u.username}}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<script src="/static/assets/js/userpage.js?a=205"></script>
|
<script src="/static/assets/js/userpage.js?a=206"></script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -114,5 +114,5 @@
|
||||||
<div id="username" class="d-none">{{u.username}}</div>
|
<div id="username" class="d-none">{{u.username}}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<script src="/static/assets/js/userpage.js?a=205"></script>
|
<script src="/static/assets/js/userpage.js?a=206"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -48,5 +48,5 @@
|
||||||
<div id="username" class="d-none">{{u.username}}</div>
|
<div id="username" class="d-none">{{u.username}}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<script src="/static/assets/js/userpage.js?a=205"></script>
|
<script src="/static/assets/js/userpage.js?a=206"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue