Skip to content

Commit

Permalink
Add link to '/clear_watch_history' in '/feed/history'
Browse files Browse the repository at this point in the history
  • Loading branch information
omarroth committed Dec 5, 2018
1 parent 65cc517 commit 89439e1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/invidious/views/history.ecr
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
<title>History - Invidious</title>
<% end %>

<div class="pure-g h-box">
<div class="pure-u-2-3">
<h3><span id="count"><%= user.watched.size %></span> videos</h3>
</div>
<div class="pure-u-1-3" style="text-align:right;">
<h3>
<a href="/clear_watch_history">Clear watch history</a>
</h3>
</div>
</div>

<div class="pure-g">
<% watched.each_slice(4) do |slice| %>
<% slice.each do |item| %>
Expand Down Expand Up @@ -34,6 +45,8 @@
function mark_unwatched(target) {
var tile = target.parentNode.parentNode.parentNode.parentNode;
tile.style.display = "none";
var count = document.getElementById("count")
count.innerText = count.innerText - 1;
var url = "/mark_unwatched?redirect=false&id=" + target.getAttribute("data-id");
var xhr = new XMLHttpRequest();
Expand All @@ -45,6 +58,7 @@ function mark_unwatched(target) {
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status != 200) {
count.innerText = count.innerText - 1 + 2;
tile.style.display = "";
}
}
Expand Down
1 change: 1 addition & 0 deletions src/invidious/views/subscription_manager.ecr
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function remove_subscription(target) {
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status != 200) {
count.innerText = count.innerText - 1 + 2;
row.style.display = "";
}
}
Expand Down

0 comments on commit 89439e1

Please sign in to comment.