2018-11-20 04:06:59 +00:00
|
|
|
<% content_for "header" do %>
|
2018-12-20 21:32:09 +00:00
|
|
|
<title><%= translate(locale, "History") %> - Invidious</title>
|
2018-11-20 04:06:59 +00:00
|
|
|
<% end %>
|
|
|
|
|
2018-12-05 23:02:00 +00:00
|
|
|
<div class="pure-g h-box">
|
2019-04-09 22:41:25 +00:00
|
|
|
<div class="pure-u-1-3">
|
2018-12-20 21:32:09 +00:00
|
|
|
<h3><%= translate(locale, "`x` videos", %(<span id="count">#{user.watched.size}</span>)) %></h3>
|
2018-12-05 23:02:00 +00:00
|
|
|
</div>
|
2019-05-02 01:03:39 +00:00
|
|
|
<div class="pure-u-1-3" style="text-align:center">
|
2019-04-09 22:41:25 +00:00
|
|
|
<h3>
|
|
|
|
<a href="/feed/subscriptions"><%= translate(locale, "`x` subscriptions", %(<span id="count">#{user.subscriptions.size}</span>)) %></a>
|
|
|
|
</h3>
|
|
|
|
</div>
|
2019-05-02 01:03:39 +00:00
|
|
|
<div class="pure-u-1-3" style="text-align:right">
|
2018-12-05 23:02:00 +00:00
|
|
|
<h3>
|
2018-12-20 21:32:09 +00:00
|
|
|
<a href="/clear_watch_history"><%= translate(locale, "Clear watch history") %></a>
|
2018-12-05 23:02:00 +00:00
|
|
|
</h3>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2018-11-20 04:06:59 +00:00
|
|
|
<div class="pure-g">
|
|
|
|
<% watched.each_slice(4) do |slice| %>
|
|
|
|
<% slice.each do |item| %>
|
2019-05-02 01:03:39 +00:00
|
|
|
<div class="pure-u-1 pure-u-md-1-4">
|
|
|
|
<div class="h-box">
|
|
|
|
<a style="width:100%" href="/watch?v=<%= item %>">
|
|
|
|
<% if !env.get("preferences").as(Preferences).thin_mode %>
|
|
|
|
<div class="thumbnail">
|
|
|
|
<img class="thumbnail" src="/vi/<%= item %>/mqdefault.jpg"/>
|
|
|
|
<form onsubmit="return false;" action="/watch_ajax?action_mark_unwatched=1&id=<%= item %>&referer=<%= env.get("current_page") %>" method="post">
|
|
|
|
<input type="hidden" name="csrf_token" value="<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>">
|
|
|
|
<p class="watched">
|
|
|
|
<a onclick="mark_unwatched(this)" data-id="<%= item %>" href="#">
|
|
|
|
<button type="submit" style="all:unset">
|
|
|
|
<i class="icon ion-md-trash"></i>
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<p></p>
|
|
|
|
<% end %>
|
|
|
|
</a>
|
|
|
|
</div>
|
2018-11-20 04:06:59 +00:00
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function mark_unwatched(target) {
|
2019-04-16 04:23:40 +00:00
|
|
|
var tile = target.parentNode.parentNode.parentNode.parentNode.parentNode;
|
2018-11-20 04:06:59 +00:00
|
|
|
tile.style.display = "none";
|
2019-05-02 01:03:39 +00:00
|
|
|
var count = document.getElementById('count')
|
2018-12-05 23:02:00 +00:00
|
|
|
count.innerText = count.innerText - 1;
|
2018-11-20 04:06:59 +00:00
|
|
|
|
2019-05-02 01:03:39 +00:00
|
|
|
var url = '/watch_ajax?action_mark_unwatched=1&redirect=false' +
|
|
|
|
'&id=' + target.getAttribute('data-id');
|
2018-11-20 04:06:59 +00:00
|
|
|
var xhr = new XMLHttpRequest();
|
2019-05-02 01:03:39 +00:00
|
|
|
xhr.responseType = 'json';
|
2018-11-20 04:06:59 +00:00
|
|
|
xhr.timeout = 20000;
|
2019-05-02 01:03:39 +00:00
|
|
|
xhr.open('POST', url, true);
|
|
|
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
|
|
xhr.send('csrf_token=<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>');
|
2018-11-20 04:06:59 +00:00
|
|
|
|
|
|
|
xhr.onreadystatechange = function() {
|
|
|
|
if (xhr.readyState == 4) {
|
|
|
|
if (xhr.status != 200) {
|
2018-12-05 23:02:00 +00:00
|
|
|
count.innerText = count.innerText - 1 + 2;
|
2019-05-02 01:03:39 +00:00
|
|
|
tile.style.display = '';
|
2018-11-20 04:06:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="pure-g h-box">
|
2019-04-14 22:04:52 +00:00
|
|
|
<div class="pure-u-1 pure-u-lg-1-5">
|
2019-05-02 01:03:39 +00:00
|
|
|
<% if page >= 2 %>
|
|
|
|
<a href="/feed/history?page=<%= page - 1 %>">
|
|
|
|
<%= translate(locale, "Previous page") %>
|
|
|
|
</a>
|
|
|
|
<% end %>
|
2018-11-20 04:06:59 +00:00
|
|
|
</div>
|
2019-04-14 22:04:52 +00:00
|
|
|
<div class="pure-u-1 pure-u-lg-3-5"></div>
|
2019-05-02 01:03:39 +00:00
|
|
|
<div class="pure-u-1 pure-u-lg-1-5" style="text-align:right">
|
|
|
|
<% if watched.size >= limit %>
|
|
|
|
<a href="/feed/history?page=<%= page + 1 %>">
|
|
|
|
<%= translate(locale, "Next page") %>
|
|
|
|
</a>
|
|
|
|
<% end %>
|
2018-11-20 04:06:59 +00:00
|
|
|
</div>
|
|
|
|
</div>
|