2018-07-06 06:18:55 +05:30
|
|
|
<% content_for "header" do %>
|
2018-12-21 03:02:09 +05:30
|
|
|
<title><%= translate(locale, "Subscription manager") %> - Invidious</title>
|
2018-07-06 06:18:55 +05:30
|
|
|
<% end %>
|
|
|
|
|
2018-07-30 23:04:57 +05:30
|
|
|
<div class="pure-g h-box">
|
2018-12-20 22:35:54 +05:30
|
|
|
<div class="pure-u-1-3">
|
2019-03-06 21:24:56 +05:30
|
|
|
<h3>
|
|
|
|
<a href="/feed/subscriptions"><%= translate(locale, "`x` subscriptions", %(<span id="count">#{subscriptions.size}</span>)) %></a>
|
|
|
|
</h3>
|
2018-07-30 23:04:57 +05:30
|
|
|
</div>
|
2018-12-20 22:35:54 +05:30
|
|
|
<div class="pure-u-1-3" style="text-align:center;">
|
|
|
|
<h3>
|
2018-12-21 03:02:09 +05:30
|
|
|
<a href="/feed/history"><%= translate(locale, "Watch history") %></a>
|
2018-12-20 22:35:54 +05:30
|
|
|
</h3>
|
|
|
|
</div>
|
2018-07-30 23:04:57 +05:30
|
|
|
<div class="pure-u-1-3" style="text-align:right;">
|
|
|
|
<h3>
|
2018-12-21 03:02:09 +05:30
|
|
|
<a href="/data_control?referer=<%= referer %>"><%= translate(locale, "Import/Export") %></a>
|
2018-07-30 23:04:57 +05:30
|
|
|
</h3>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-07-06 06:18:55 +05:30
|
|
|
|
|
|
|
<% subscriptions.each do |channel| %>
|
2018-08-06 06:29:45 +05:30
|
|
|
<div class="h-box">
|
2019-03-06 21:24:56 +05:30
|
|
|
<div class="pure-g<% if channel.deleted %> deleted <% end%>">
|
2018-07-06 06:18:55 +05:30
|
|
|
<div class="pure-u-2-5">
|
2019-03-06 21:24:56 +05:30
|
|
|
<h3 style="padding-left: 0.5em">
|
2018-08-06 06:29:45 +05:30
|
|
|
<a href="/channel/<%= channel.id %>"><%= channel.author %></a>
|
|
|
|
</h3>
|
2018-07-06 06:18:55 +05:30
|
|
|
</div>
|
|
|
|
<div class="pure-u-2-5"></div>
|
2018-07-17 01:00:15 +05:30
|
|
|
<div class="pure-u-1-5" style="text-align: right;">
|
2019-03-06 21:24:56 +05:30
|
|
|
<h3 style="padding-right: 0.5em">
|
2019-04-16 09:53:40 +05:30
|
|
|
<form onsubmit="return false;" action="/subscription_ajax?action_remove_subscriptions=1&c=<%= channel.id %>&referer=<%= env.get("current_page") %>" method="post">
|
|
|
|
<input type="hidden" name="token" value="<%= URI.escape(env.get?("token").try &.as(String) || "") %>">
|
|
|
|
<a onclick="remove_subscription(this)" data-ucid="<%= channel.id %>" href="#">
|
|
|
|
<input style="all:unset" type="submit" value="<%= translate(locale, "unsubscribe") %>">
|
|
|
|
</a>
|
|
|
|
</form>
|
2018-08-06 06:29:45 +05:30
|
|
|
</h3>
|
2018-07-06 06:18:55 +05:30
|
|
|
</div>
|
|
|
|
</div>
|
2018-07-17 01:00:15 +05:30
|
|
|
|
2018-08-06 06:29:45 +05:30
|
|
|
<% if subscriptions[-1].author != channel.author %>
|
|
|
|
<hr>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2018-08-17 21:34:38 +05:30
|
|
|
<% end %>
|
2018-11-22 01:05:37 +05:30
|
|
|
|
|
|
|
<script>
|
|
|
|
function remove_subscription(target) {
|
2019-04-16 09:53:40 +05:30
|
|
|
var row = target.parentNode.parentNode.parentNode.parentNode.parentNode;
|
2018-11-22 01:05:37 +05:30
|
|
|
row.style.display = "none";
|
2018-11-22 06:56:55 +05:30
|
|
|
var count = document.getElementById("count")
|
|
|
|
count.innerText = count.innerText - 1;
|
2018-11-22 01:05:37 +05:30
|
|
|
|
2019-04-16 09:53:40 +05:30
|
|
|
var url = "/subscription_ajax?action_remove_subscriptions=1&redirect=false&referer=<%= env.get("current_page") %>&c=" + target.getAttribute("data-ucid");
|
2018-11-22 01:05:37 +05:30
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
xhr.responseType = "json";
|
|
|
|
xhr.timeout = 20000;
|
2019-04-16 09:53:40 +05:30
|
|
|
xhr.open("POST", url, true);
|
|
|
|
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
|
|
xhr.send("token=<%= URI.escape(env.get?("token").try &.as(String) || "") %>");
|
2018-11-22 01:05:37 +05:30
|
|
|
|
|
|
|
xhr.onreadystatechange = function() {
|
|
|
|
if (xhr.readyState == 4) {
|
2018-11-22 06:56:55 +05:30
|
|
|
if (xhr.status != 200) {
|
2018-12-06 04:32:00 +05:30
|
|
|
count.innerText = count.innerText - 1 + 2;
|
2018-11-22 01:05:37 +05:30
|
|
|
row.style.display = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|