forked from MarseyWorld/MarseyWorld
simplify 3 js functions
parent
472aedb14e
commit
db929c7615
|
@ -1,5 +1,5 @@
|
|||
function removeFollower(event, username) {
|
||||
post_toast(event.target,'/remove_follow/' + username);
|
||||
function removeFollower(t, username) {
|
||||
post_toast(t,'/remove_follow/' + username);
|
||||
let table = document.getElementById("followers-table");
|
||||
table.removeChild(event.target.parentElement.parentElement);
|
||||
}
|
||||
table.removeChild(t.parentElement.parentElement);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function removeFollowing(event, username) {
|
||||
post_toast(event.target,'/unfollow/' + username);
|
||||
function removeFollowing(t, username) {
|
||||
post_toast(t,'/unfollow/' + username);
|
||||
let table = document.getElementById("followers-table");
|
||||
table.removeChild(event.target.parentElement.parentElement);
|
||||
}
|
||||
table.removeChild(t.parentElement.parentElement);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<td>{% include "user_in_table.html" %}</td>
|
||||
<td {% if follow.created_utc > 1599343262 %}data-time="{{follow.created_utc}}"{% endif %}></td>
|
||||
{% if v.id == u.id %}
|
||||
<td><div class="btn btn-danger pr-2" onclick="removeFollower(event, '{{user.username}}')">Remove follow</div></td>
|
||||
<td><div class="btn btn-danger pr-2" onclick="removeFollower(this, '{{user.username}}')">Remove follow</div></td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<td>{{loop.index}}</td>
|
||||
<td>{% include "user_in_table.html" %}</td>
|
||||
{% if v.id == u.id %}
|
||||
<td><div class="btn btn-danger" onclick="removeFollowing(event, '{{user.username}}')">Unfollow</div></td>
|
||||
<td><div class="btn btn-danger" onclick="removeFollowing(this, '{{user.username}}')">Unfollow</div></td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -31,4 +31,4 @@
|
|||
|
||||
<script defer src="{{'js/following.js' | asset}}"></script>
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -213,7 +213,7 @@
|
|||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const tt = bootstrap.Tooltip.getOrCreateInstance(document.getElementById('mobile-prompt'))
|
||||
tt.show()
|
||||
document.getElementsByClassName('tooltip')[0].onclick = function(event){
|
||||
document.getElementsByClassName('tooltip')[0].onclick = function() {
|
||||
tt.hide()
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.withCredentials=true;
|
||||
|
|
Loading…
Reference in New Issue