mirror of
https://github.com/jfmcbrayer/brutaldon
synced 2025-01-06 20:31:32 +01:00
Restore all of the PJAX stuff because I figured out what was going wrong
This commit is contained in:
parent
9eda3c91cb
commit
347ccb4bbe
@ -151,3 +151,21 @@ function characterCount()
|
|||||||
return $("#id_status").val().length + $("#id_spoiler_text").val().length;
|
return $("#id_status").val().length + $("#id_spoiler_text").val().length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function savePlace()
|
||||||
|
{
|
||||||
|
sessionStorage.setItem("lastScrollPos", window.scrollY);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function restorePlace(ev)
|
||||||
|
{
|
||||||
|
var lastScrollPos = sessionStorage.getItem('lastScrollPos');
|
||||||
|
Intercooler.ready(function (elt)
|
||||||
|
{
|
||||||
|
if (elt[0].id == 'main')
|
||||||
|
{
|
||||||
|
window.scrollTo(0, lastScrollPos);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -75,17 +75,32 @@
|
|||||||
<div class="navbar-menu is-active" id="navMenu">
|
<div class="navbar-menu is-active" id="navMenu">
|
||||||
<!-- navbar start, navbar end -->
|
<!-- navbar start, navbar end -->
|
||||||
<div class="navbar-start">
|
<div class="navbar-start">
|
||||||
<a href="{% url "home" %}" class="navbar-item">
|
<a href="{% url "home" %}" class="navbar-item"
|
||||||
|
ic-get-from="{% url "home" %}"
|
||||||
|
ic-target="#main"
|
||||||
|
ic-scroll-to-target="true"
|
||||||
|
ic-push-url="true"
|
||||||
|
ic-on-beforeSend="savePlace"
|
||||||
|
ic-on-success="afterPage('{{ own_acct.username }}', 'Home');"
|
||||||
|
ic-select-from-response="#main"
|
||||||
|
ic-indicator="#page-load-indicator">
|
||||||
<span class="fa fa-home"></span>
|
<span class="fa fa-home"></span>
|
||||||
<span> Home</span>
|
<span> Home</span>
|
||||||
</a>
|
</a>
|
||||||
<a class="navbar-item" href="{% url "note" %}"
|
<a class="navbar-item" href="{% url "note" %}"
|
||||||
>
|
ic-get-from="{% url "note" %}"
|
||||||
|
ic-target="#main"
|
||||||
|
ic-scroll-to-target="true"
|
||||||
|
ic-select-from-response="#main"
|
||||||
|
ic-push-url="true"
|
||||||
|
ic-on-beforeSend="savePlace"
|
||||||
|
ic-indicator="#page-load-indicator" ic-on-success="afterPage('{{ own_acct.username }}', 'Notifications');">
|
||||||
<span class="fa fa-bell-o"></span>
|
<span class="fa fa-bell-o"></span>
|
||||||
{% if preferences.notifications and not preferences.theme.is_brutalist %}
|
{% if preferences.notifications and not preferences.theme.is_brutalist %}
|
||||||
<span ic-src="{% url 'notes_count' %}"
|
<span ic-src="{% url 'notes_count' %}"
|
||||||
ic-poll="{{ preferences.poll_frequency }}s"
|
ic-poll="{{ preferences.poll_frequency }}s"
|
||||||
ic-target="this">
|
ic-target="this"
|
||||||
|
ic-select-from-response="#notes-count">
|
||||||
<span
|
<span
|
||||||
{% if notifications and notifications != '0' %}
|
{% if notifications and notifications != '0' %}
|
||||||
class="badge"
|
class="badge"
|
||||||
@ -95,19 +110,36 @@
|
|||||||
</span>
|
</span>
|
||||||
{% elif notifications and preferences.notifications %}
|
{% elif notifications and preferences.notifications %}
|
||||||
<span ic-src="{% url 'notes_count' %}"
|
<span ic-src="{% url 'notes_count' %}"
|
||||||
ic-poll="60s"
|
ic-poll="{{ preferences.poll_frequency }}"
|
||||||
ic-target="this">
|
ic-target="this"
|
||||||
|
ic-select-from-response="#notes-count">
|
||||||
<span > Notifications ({{ notifications }})</span>
|
<span > Notifications ({{ notifications }})</span>
|
||||||
</span>
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span > Notifications</span>
|
<span > Notifications</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</a>
|
</a>
|
||||||
<a class="navbar-item" href="{% url "local" %}">
|
<a class="navbar-item" href="{% url "local" %}"
|
||||||
|
ic-get-from="{% url "local" %}"
|
||||||
|
ic-target="#main"
|
||||||
|
ic-scroll-to-target="true"
|
||||||
|
ic-select-from-response="#main"
|
||||||
|
ic-push-url="true"
|
||||||
|
ic-on-beforeSend="savePlace"
|
||||||
|
ic-indicator="#page-load-indicator"
|
||||||
|
ic-on-success="afterPage('{{ own_acct.username }}', 'Local timeline');">
|
||||||
<span class="fa fa-community"></span>
|
<span class="fa fa-community"></span>
|
||||||
<span > Local</span>
|
<span > Local</span>
|
||||||
</a>
|
</a>
|
||||||
<a class="navbar-item" href="{% url "fed" %}">
|
<a class="navbar-item" href="{% url "fed" %}"
|
||||||
|
ic-get-from="{% url "fed" %}"
|
||||||
|
ic-target="#main"
|
||||||
|
ic-scroll-to-target="true"
|
||||||
|
ic-select-from-response="#main"
|
||||||
|
ic-push-url="true"
|
||||||
|
ic-on-beforeSend="savePlace"
|
||||||
|
ic-indicator="#page-load-indicator"
|
||||||
|
ic-on-success="afterPage('{{ own_acct.username }}', 'Federated timeline');">
|
||||||
<span class="fa fa-globe"></span>
|
<span class="fa fa-globe"></span>
|
||||||
<span > Federated</span>
|
<span > Federated</span>
|
||||||
</a>
|
</a>
|
||||||
@ -118,17 +150,35 @@
|
|||||||
<span class="fa fa-edit"> </span>
|
<span class="fa fa-edit"> </span>
|
||||||
<span > New Toot</span>
|
<span > New Toot</span>
|
||||||
</a>
|
</a>
|
||||||
<a class="navbar-item" href="{% url "search" %}">
|
<a class="navbar-item" href="{% url "search" %}"
|
||||||
|
ic-get-from="{% url "search" %}"
|
||||||
|
ic-target="#main"
|
||||||
|
ic-scroll-to-target="true"
|
||||||
|
ic-select-from-response="#main"
|
||||||
|
ic-push-url="true"
|
||||||
|
ic-on-beforeSend="savePlace"
|
||||||
|
ic-indicator="#page-load-indicator"
|
||||||
|
ic-on-success="afterPage('{{ own_acct.username }}', 'Search');">
|
||||||
<span class="fa fa-search"> </span>
|
<span class="fa fa-search"> </span>
|
||||||
<span > Search</span>
|
<span > Search</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-end" >
|
<div class="navbar-end" >
|
||||||
<a class="navbar-item" href="{% url "settings" %}">
|
<a class="navbar-item" href="{% url "settings" %}"
|
||||||
|
ic-get-from="{% url "settings" %}"
|
||||||
|
ic-target="#main"
|
||||||
|
ic-scroll-to-target="true"
|
||||||
|
ic-select-from-response="#main"
|
||||||
|
ic-push-url="true"
|
||||||
|
ic-on-beforeSend="savePlace"
|
||||||
|
ic-indicator="#page-load-indicator"
|
||||||
|
ic-on-success="afterPage('{{ own_acct.username }}', 'Settings');">
|
||||||
<span class="fa fa-gear"></span>
|
<span class="fa fa-gear"></span>
|
||||||
<span > Settings</span>
|
<span > Settings</span>
|
||||||
</a>
|
</a>
|
||||||
<a class="navbar-item" href="{% url "logout" %}">
|
<a class="navbar-item" href="{% url "logout" %}"
|
||||||
|
ic-get-from="{% url "logout" %}"
|
||||||
|
ic-confirm="Are you sure you want to log out?">
|
||||||
<span class="fa fa-power-off"></span>
|
<span class="fa fa-power-off"></span>
|
||||||
<span > Log out</span>
|
<span > Log out</span>
|
||||||
</a>
|
</a>
|
||||||
@ -139,7 +189,7 @@
|
|||||||
</nav>
|
</nav>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<section id="main" class="section">
|
<section id="main" class="section" ic-history-elt="true">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1 class="title">
|
<h1 class="title">
|
||||||
@ -181,6 +231,8 @@
|
|||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
menuPrepare();
|
menuPrepare();
|
||||||
|
$(document).on('handle.onpopstate.ic',
|
||||||
|
restorePlace);
|
||||||
});
|
});
|
||||||
|
|
||||||
{% if preferences.lightbox %}
|
{% if preferences.lightbox %}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
<span id="notes-count">
|
||||||
{% if not preferences.theme.is_brutalist %}
|
{% if not preferences.theme.is_brutalist %}
|
||||||
<span
|
<span
|
||||||
{% if notifications and notifications != '0' %}
|
{% if notifications and notifications != '0' %}
|
||||||
@ -9,3 +10,4 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<span > Notifications ({{ notifications }})</span>
|
<span > Notifications ({{ notifications }})</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
@ -166,7 +166,14 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{{ toot.visibility }}
|
{{ toot.visibility }}
|
||||||
|
|
||||||
<a class="level-item" href="{% url "thread" toot.id %}">
|
<a class="level-item" href="{% url "thread" toot.id %}"
|
||||||
|
ic-get-from="{% url "thread" toot.id %}"
|
||||||
|
ic-target="#main"
|
||||||
|
ic-select-from-response="#main"
|
||||||
|
ic-push-url="true"
|
||||||
|
ic-on-beforeSend="savePlace"
|
||||||
|
ic-on-success="afterPage('{{ own_acct.username }}', 'thread');"
|
||||||
|
ic-indicator="#page-load-indicator">
|
||||||
thread
|
thread
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -401,6 +401,7 @@ def settings(request):
|
|||||||
account.preferences.notifications = form.cleaned_data['notifications']
|
account.preferences.notifications = form.cleaned_data['notifications']
|
||||||
account.preferences.click_to_load = form.cleaned_data['click_to_load']
|
account.preferences.click_to_load = form.cleaned_data['click_to_load']
|
||||||
account.preferences.lightbox = form.cleaned_data['lightbox']
|
account.preferences.lightbox = form.cleaned_data['lightbox']
|
||||||
|
account.preferences.poll_frequency = form.cleaned_data['poll_frequency']
|
||||||
request.session['timezone'] = account.preferences.timezone
|
request.session['timezone'] = account.preferences.timezone
|
||||||
account.preferences.save()
|
account.preferences.save()
|
||||||
account.save()
|
account.save()
|
||||||
|
Loading…
Reference in New Issue
Block a user